@streamlayer/react 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/advertisement.d.ts +1 -0
- package/lib/app/app.d.ts +3 -0
- package/lib/app/provider.d.ts +4 -1
- package/lib/app/useStreamLayerApp.d.ts +2 -1
- package/lib/cjs/advertisement.js +36 -36
- package/lib/cjs/gamification-feature.js +1 -1
- package/lib/cjs/index2.js +2 -2
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/masters2.js +3 -3
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/provider.js +62 -19
- package/lib/cjs/useStreamLayerApp2.js +15 -15
- package/lib/classic/app/advertisement.d.ts +1 -0
- package/lib/classic/app/app.d.ts +3 -0
- package/lib/classic/app/provider.d.ts +4 -1
- package/lib/classic/app/useStreamLayerApp.d.ts +2 -1
- package/lib/classic/cjs/advertisement.js +36 -36
- package/lib/classic/cjs/bet-pack.js +2 -2
- package/lib/classic/cjs/gamification-feature.js +1 -1
- package/lib/classic/cjs/insight.js +1 -1
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/provider.js +57 -14
- package/lib/classic/cjs/useStreamLayerApp2.js +15 -15
- package/lib/classic/es/advertisement.js +6778 -6620
- package/lib/classic/es/bet-pack.js +245 -245
- package/lib/classic/es/gamification-feature.js +1 -1
- package/lib/classic/es/index.js +3 -3
- package/lib/classic/es/insight.js +41 -38
- package/lib/classic/es/notification.js +739 -230
- package/lib/classic/es/points.js +10 -10
- package/lib/classic/es/provider.js +7285 -4829
- package/lib/classic/es/useStreamLayerApp.js +1 -1
- package/lib/classic/es/useStreamLayerApp2.js +4007 -3787
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +47 -43
- package/lib/dist/es/gamification-feature2.js +15 -15
- package/lib/dist/es/index.js +3 -3
- package/lib/dist/es/masters.js +14631 -12156
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +6778 -6620
- package/lib/es/gamification-feature.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/index2.js +362 -362
- package/lib/es/insight.js +41 -38
- package/lib/es/masters2.js +28 -26
- package/lib/es/notification.js +739 -230
- package/lib/es/points.js +10 -10
- package/lib/es/provider.js +7162 -4706
- package/lib/es/useStreamLayerApp.js +1 -1
- package/lib/es/useStreamLayerApp2.js +4007 -3787
- package/lib/style.css +1 -1
- package/package.json +14 -14
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),Me=require("react"),X=require("./provider.js"),de=require("./useStreamLayerApp2.js"),m_=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function fh(i){return typeof i=="string"&&m_.test(i)}function gc(i){if(!fh(i))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(i.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(i.slice(9,13),16))>>>8,e&255,(e=parseInt(i.slice(14,18),16))>>>8,e&255,(e=parseInt(i.slice(19,23),16))>>>8,e&255,(e=parseInt(i.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function f_(i){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<i.length;++t)e[t]=i.charCodeAt(t);return e}const y_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",__="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function b_(i,e,t,r,n,s){const a=typeof t=="string"?f_(t):t,l=typeof r=="string"?gc(r):r;if(typeof r=="string"&&(r=gc(r)),(r==null?void 0:r.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(l),u.set(a,l.length),u=e(u),u[6]=u[6]&15|i,u[8]=u[8]&63|128,n){s=s||0;for(let p=0;p<16;++p)n[s+p]=u[p];return n}return de.unsafeStringify(u)}function v_(i,e,t,r){switch(i){case 0:return e&t^~e&r;case 1:return e^t^r;case 2:return e&t^e&r^t&r;case 3:return e^t^r}}function _o(i,e){return i<<e|i>>>32-e}function T_(i){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(i.length+1);r.set(i),r[i.length]=128,i=r;const n=i.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let l=0;l<s;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=i[l*64+p*4]<<24|i[l*64+p*4+1]<<16|i[l*64+p*4+2]<<8|i[l*64+p*4+3];a[l]=u}a[s-1][14]=(i.length-1)*8/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=(i.length-1)*8&4294967295;for(let l=0;l<s;++l){const u=new Uint32Array(80);for(let C=0;C<16;++C)u[C]=a[l][C];for(let C=16;C<80;++C)u[C]=_o(u[C-3]^u[C-8]^u[C-14]^u[C-16],1);let p=t[0],g=t[1],b=t[2],S=t[3],w=t[4];for(let C=0;C<80;++C){const v=Math.floor(C/20),D=_o(p,5)+v_(v,g,b,S)+w+e[v]+u[C]>>>0;w=S,S=b,b=_o(g,30)>>>0,g=p,p=D}t[0]=t[0]+p>>>0,t[1]=t[1]+g>>>0,t[2]=t[2]+b>>>0,t[3]=t[3]+S>>>0,t[4]=t[4]+w>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function Hs(i,e,t,r){return b_(80,T_,i,e,t,r)}Hs.DNS=y_;Hs.URL=__;const S_=X.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),E_="a1rlj479",w_="s35f1di",k_="sj4471g",C_="b12050d8",I_="b1d5ybek",A_=i=>i==="left"||i==="right"?w_:C_,x_=i=>i==="left"||i==="right"?k_:I_,L_=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",bl=({children:i,style:e,className:t,enabled:r=!0,hiding:n,direction:s="left",onAnimationEnd:a})=>W.jsx(S_,{style:e,className:X.cx_default(t,E_,L_(s),r&&!n&&A_(s),r&&n&&x_(s)),onAnimationEnd:a,children:i}),D_=X.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),P_=X.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),R_=()=>D_,N_=X.styled_default(R_())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),O_=({promotion:i,promotionId:e,hiding:t,direction:r="bottom"})=>{var n,s;if(!((n=i.additionalBanner)!=null&&n.imageUrl))return null;let a=(s=i.additionalBanner)==null?void 0:s.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),W.jsx(bl,{direction:r,hiding:t,children:W.jsx(P_,{className:"BannerContainer",children:W.jsx(N_,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${i.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank"})})})},U_=X.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),M_=X.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),B_=X.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),F_=X.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),vl=X.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),j_=()=>vl,q_=X.styled_default(j_())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),$_=X.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),V_=X.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),H_=X.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),z_=X.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),W_=X.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),G_=X.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),X_={[de.NotificationPromotionImagePosition.BOTTOM]:vl,[de.NotificationPromotionImagePosition.MIDDLE]:q_},K_=({src:i,imagePosition:e})=>{const t=X_[e]||vl;return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},Y_=({notification:i,open:e})=>{if(!i||!i.promotion||i.enabled!==de.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:r,image:n,promotion:s}=i,{sponsorLogo:a,sponsorLogoMode:l,imagePosition:u,ctaButton:p}=s;return W.jsxs(G_,{className:"SL_Lower_Third_Notification",onClick:e,children:[W.jsxs(U_,{children:[W.jsx(K_,{src:n,imagePosition:u}),W.jsxs(M_,{children:[t&&W.jsx(B_,{children:t}),r&&W.jsx(F_,{children:r})]})]}),W.jsxs(z_,{children:[l!==de.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx(H_,{children:W.jsx("img",{src:a,alt:t})}),W.jsx(W_,{})]}),W.jsxs(V_,{name:"promo-button",style:{color:p==null?void 0:p.textColor,backgroundColor:p==null?void 0:p.color},children:[(p==null?void 0:p.ctaIcon)&&(p==null?void 0:p.ctaIconMode)===de.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx($_,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]})]})]})},Q_=X.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),J_=X.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Z_=X.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),e0=X.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),t0=X.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),va=X.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),i0=()=>va,mc=X.styled_default(i0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),r0=()=>va,yh=X.styled_default(r0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),n0=()=>yh,s0=X.styled_default(n0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),a0=()=>va,o0=X.styled_default(a0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),l0=()=>va,u0=X.styled_default(l0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),c0=X.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),d0=X.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),h0=()=>X.k1,p0=X.styled_default(h0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),g0=X.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),m0={[de.NotificationPromotionImagePosition.UNSET]:mc,[de.NotificationPromotionImagePosition.FIT]:mc,[de.NotificationPromotionImagePosition.CENTERED]:yh,[de.NotificationPromotionImagePosition.BOTTOM]:s0,[de.NotificationPromotionImagePosition.SOLID]:o0,[de.NotificationPromotionImagePosition.MIDDLE]:u0},f0=({src:i,imagePosition:e})=>{const t=m0[e];return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},y0=({notification:i,open:e,promotionId:t,hiding:r,direction:n="left"})=>{if(!i||!i.promotion||i.enabled!==de.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===de.NotificationPromotionMode.LOWER_THIRD)return W.jsx(Y_,{notification:i,open:e});const{title:s,body:a,image:l,promotion:u}=i,{sponsorLogo:p,sponsorLogoMode:g,imagePosition:b,ctaButton:S}=u;return W.jsx(bl,{className:"SL_Rich_Notification",direction:n,hiding:r,children:W.jsxs(J_,{onClick:e,children:[g!==de.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&p&&W.jsx(g0,{children:W.jsx("img",{src:p,alt:s})}),W.jsxs(Q_,{children:[W.jsx(f0,{src:l,imagePosition:b}),W.jsxs(Z_,{children:[s&&W.jsx(e0,{children:s}),a&&W.jsx(t0,{children:a})]}),W.jsxs(d0,{name:"promo-button",style:{color:S==null?void 0:S.textColor,backgroundColor:S==null?void 0:S.color},children:[(S==null?void 0:S.ctaIcon)&&(S==null?void 0:S.ctaIconMode)===de.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(c0,{src:S==null?void 0:S.ctaIcon,alt:"cta-icon"}),(S==null?void 0:S.label)||"Open"]}),W.jsx(p0,{name:"chevronRight"})]})]})})},_0=X.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),_h=X.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),bh=X.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),vh=X.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Th="h10toh7",fc=X.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),b0=X.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Sh=X.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),v0=X.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),T0="s1nmch9k",yc=X.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),S0=X.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),E0=X.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),w0=X.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Eh=X.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),k0=X.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),wh=X.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),kh=X.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),C0=X.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),I0="h17rwbtk",A0=X.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),_c=X.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),x0=X.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),L0=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),n=i-r*60;return r===0&&n===0&&e===t?null:W.jsxs(A0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(_c,{children:[t," of ",e]}),W.jsx(x0,{})]}),W.jsxs(_c,{children:[r,":",n<10?`0${n}`:n]})]})},D0=X.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),P0=({whyThisAd:i})=>{const[e,t]=Me.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:W.jsxs(D0,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&W.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&W.jsx("span",{children:"ad choice"})]})},R0=X.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Ch=X.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),N0=()=>Ch,O0=X.styled_default(N0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),U0=()=>Ch,M0=X.styled_default(U0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),B0=X.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),F0=X.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),bc="m12n261r",vc="m16vcml8",Tc="m1078nk6",Sc=globalThis||void 0||self;function Tl(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,adId:i.adId||null,sequence:i.sequence||null,apiFramework:i.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const j0=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function Ec(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],n=Ah(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Dh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const s in e)e[s]=Lh(e[s]);for(const s in n){const a=n[s];typeof a=="string"&&r.push(Ih(a,e))}return r}function Ih(i,e){const t=(i=wc(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(n=>j0.indexOf(n)>-1);return r.length===0?i:(r=r.reduce((n,s)=>(n[s]=-1,n),{}),wc(i,r))}function wc(i,e){let t=i;for(const r in e){const n=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),n)}return t}function Ah(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function kc(i){return/^(https?:\/\/|\/\/)/.test(i)}function Cc(i,e){for(let t=0;t<e.length;t++)if(xh(e[t],i))return!0;return!1}function xh(i,e){if(i&&e){const t=Object.getOwnPropertyNames(i),r=Object.getOwnPropertyNames(e);return t.length===r.length&&i.id===e.id&&i.url===e.url}return!1}function Lh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Dh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const Ee={track:function(i,e,t){Ec(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:Ec,extractURLsFromTemplates:Ah,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return kc(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Cc,isTemplateObjectEqual:xh,encodeURIComponentRFC3986:Lh,replaceUrlMacros:Ih,isNumeric:function(i){return!isNaN(parseFloat(i))&&isFinite(i)},flatten:function i(e){return e.reduce((t,r)=>t.concat(Array.isArray(r)?i(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(i)?i:[],r=Array.isArray(e)?e:[];return t.concat(r).reduce((n,s)=>(Cc(s,n)||n.push(s),n),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Dh,isValidUrl:kc,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(i){return typeof i!="object"?i:JSON.stringify(i)}};function Ic(i){return["true","TRUE","True","1"].includes(i)}function q0(i){if(i==null)return-1;if(Ee.isNumeric(i))return parseInt(i);const e=i.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let r=parseInt(t[0]);t.length===2&&(r+=parseFloat("0.".concat(t[1])));const n=parseInt(60*e[1]),s=parseInt(60*e[0]*60);return isNaN(s)||isNaN(n)||isNaN(r)||n>3600||r>60?-1:s+n+r}const j={childByName:function(i,e){return Array.from(i.childNodes).find(t=>t.nodeName===e)},childrenByName:function(i,e){return Array.from(i.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(i,e){if(!e)return i;if(i.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(i)}if(!i.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(i)}return i},parseBoolean:Ic,parseNodeText:function(i){return i&&(i.textContent||i.text||"").trim()},copyNodeAttribute:function(i,e,t){const r=e.getAttribute(i);r&&t.setAttribute(i,r)},parseAttributes:function(i){return Array.from(i.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:q0,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>!parseInt(i.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>parseInt(i.sequence,10)).sort((i,e)=>i.sequence-e.sequence)},assignAttributes:function(i,e){i&&Array.from(i).forEach(t=>{let{nodeName:r,nodeValue:n}=t;if(r&&n&&e.hasOwnProperty(r)){let s=n;typeof e[r]=="boolean"&&(s=Ic(s)),e[r]=s}})},mergeWrapperAdData:function(i,e){var t;i.errorURLTemplates=e.errorURLTemplates.concat(i.errorURLTemplates),i.impressionURLTemplates=e.impressionURLTemplates.concat(i.impressionURLTemplates),i.extensions=e.extensions.concat(i.extensions),e.viewableImpression.length>0&&(i.viewableImpression=[...i.viewableImpression,...e.viewableImpression]),i.followAdditionalWrappers=e.followAdditionalWrappers,i.allowMultipleAds=e.allowMultipleAds,i.fallbackOnNoAd=e.fallbackOnNoAd;const r=(e.creatives||[]).filter(l=>l&&l.type==="companion"),n=r.reduce((l,u)=>((u.variations||[]).forEach(p=>{(p.companionClickTrackingURLTemplates||[]).forEach(g=>{Ee.containsTemplateObject(g,l)||l.push(g)})}),l),[]);i.creatives=r.concat(i.creatives);const s=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(i.creatives.forEach(l=>{if(e.trackingEvents&&e.trackingEvents[l.type])for(const u in e.trackingEvents[l.type]){const p=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(p)}l.type==="linear"&&(s&&(l.videoClickTrackingURLTemplates=l.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(l.videoCustomClickURLTemplates=l.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||l.videoClickThroughURLTemplate!==null&&l.videoClickThroughURLTemplate!==void 0||(l.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),l.type==="companion"&&n.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=Ee.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,n)})}),e.adVerifications&&(i.adVerifications=i.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(i.blockedAdCategories=i.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const l=e.creatives.filter(u=>{var p;return((p=u.icons)===null||p===void 0?void 0:p.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function $0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"companion",required:null,variations:[]}}(e);return t.required=i.getAttribute("required")||null,t.variations=j.childrenByName(i,"Companion").map(r=>{const n=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:l.id||null,adType:"companionAd",width:l.width||0,height:l.height||0,assetWidth:l.assetWidth||null,assetHeight:l.assetHeight||null,expandedWidth:l.expandedWidth||null,expandedHeight:l.expandedHeight||null,apiFramework:l.apiFramework||null,adSlotId:l.adSlotId||null,pxratio:l.pxratio||"1",renderingMode:l.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(j.parseAttributes(r));n.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat({url:p,creativeType:u.getAttribute("creativeType")||null}):l},[]),n.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const s=j.childByName(r,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(l=>{const u=l.getAttribute("event"),p=j.parseNodeText(l);u&&p&&(Array.isArray(n.trackingEvents[u])||(n.trackingEvents[u]=[]),n.trackingEvents[u].push(p))}),n.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),n.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(n.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),n}),t}function V0(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:p,adId:g,sequence:b,apiFramework:S}=Tl(u);return{id:p,adId:g,sequence:b,apiFramework:S,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);r.duration=j.parseDuration(j.parseNodeText(j.childByName(i,"Duration")));const n=i.getAttribute("skipoffset");if(n==null)r.skipDelay=null;else if(n.charAt(n.length-1)==="%"&&r.duration!==-1){const u=parseInt(n,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(n);const s=j.childByName(i,"VideoClicks");if(s){const u=j.childByName(s,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(s,"ClickTracking").forEach(p=>{r.videoClickTrackingURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})}),j.childrenByName(s,"CustomClick").forEach(p=>{r.videoCustomClickURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})})}const a=j.childByName(i,"AdParameters");a&&(r.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),j.childrenByName(i,"TrackingEvents").forEach(u=>{j.childrenByName(u,"Tracking").forEach(p=>{let g=p.getAttribute("event");const b=j.parseNodeText(p);if(g&&b){if(g==="progress"){if(t=p.getAttribute("offset"),!t)return;g=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[g])||(r.trackingEvents[g]=[]),r.trackingEvents[g].push(b)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(w=>{r.mediaFiles.push(function(C){const v={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};v.id=C.getAttribute("id"),v.fileURL=j.parseNodeText(C),v.deliveryType=C.getAttribute("delivery"),v.codec=C.getAttribute("codec"),v.mimeType=C.getAttribute("type"),v.mediaType=C.getAttribute("mediaType")||"2D",v.apiFramework=C.getAttribute("apiFramework"),v.fileSize=parseInt(C.getAttribute("fileSize")||0),v.bitrate=parseInt(C.getAttribute("bitrate")||0),v.minBitrate=parseInt(C.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(C.getAttribute("maxBitrate")||0),v.width=parseInt(C.getAttribute("width")||0),v.height=parseInt(C.getAttribute("height")||0);const D=C.getAttribute("scalable");D&&typeof D=="string"&&(v.scalable=j.parseBoolean(D));const L=C.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(v.maintainAspectRatio=j.parseBoolean(L)),v}(w))});const p=j.childByName(u,"InteractiveCreativeFile");p&&(r.interactiveCreativeFile=function(w){const C=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,apiFramework:v.apiFramework||null,variableDuration:j.parseBoolean(v.variableDuration),fileURL:null}}(j.parseAttributes(w));return C.fileURL=j.parseNodeText(w),C}(p));const g=j.childByName(u,"ClosedCaptionFiles");g&&j.childrenByName(g,"ClosedCaptionFile").forEach(w=>{const C=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,language:v.language||null,fileURL:null}}(j.parseAttributes(w));C.fileURL=j.parseNodeText(w),r.closedCaptionFiles.push(C)});const b=j.childByName(u,"Mezzanine"),S=function(w,C){const v={};let D=!1;return C.forEach(L=>{w&&w.getAttribute(L)?v[L]=w.getAttribute(L):D=!0}),D?null:v}(b,["delivery","type","width","height"]);if(S){const w={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};w.id=b.getAttribute("id"),w.fileURL=j.parseNodeText(b),w.delivery=S.delivery,w.codec=b.getAttribute("codec"),w.type=S.type,w.width=parseInt(S.width,10),w.height=parseInt(S.height,10),w.fileSize=parseInt(b.getAttribute("fileSize"),10),w.mediaType=b.getAttribute("mediaType")||"2D",r.mezzanine=w}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(p){const g={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[]};g.program=p.getAttribute("program"),g.height=parseInt(p.getAttribute("height")||0),g.width=parseInt(p.getAttribute("width")||0),g.xPosition=function(S){return["left","right"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("xPosition")),g.yPosition=function(S){return["top","bottom"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("yPosition")),g.apiFramework=p.getAttribute("apiFramework"),g.pxratio=p.getAttribute("pxratio")||"1",g.offset=j.parseDuration(p.getAttribute("offset")),g.duration=j.parseDuration(p.getAttribute("duration")),j.childrenByName(p,"HTMLResource").forEach(S=>{g.type=S.getAttribute("creativeType")||"text/html",g.htmlResource=j.parseNodeText(S)}),j.childrenByName(p,"IFrameResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.iframeResource=j.parseNodeText(S)}),j.childrenByName(p,"StaticResource").forEach(S=>{g.type=S.getAttribute("creativeType")||0,g.staticResource=j.parseNodeText(S)});const b=j.childByName(p,"IconClicks");if(b){g.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(b,"IconClickThrough")),j.childrenByName(b,"IconClickTracking").forEach(w=>{g.iconClickTrackingURLTemplates.push({id:w.getAttribute("id")||null,url:j.parseNodeText(w)})});const S=j.childByName(b,"IconClickFallbackImages");S&&j.childrenByName(S,"IconClickFallbackImage").forEach(w=>{g.iconClickFallbackImages.push({url:j.parseNodeText(w)||null,width:w.getAttribute("width")||null,height:w.getAttribute("height")||null})})}return g.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(p,"IconViewTracking")),g}(u))}),r}function H0(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Tl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let n,s;j.childrenByName(r,"Tracking").forEach(a=>{n=a.getAttribute("event"),s=j.parseNodeText(a),n&&s&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(s))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const n={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};n.id=r.getAttribute("id")||null,n.width=r.getAttribute("width"),n.height=r.getAttribute("height"),n.expandedWidth=r.getAttribute("expandedWidth"),n.expandedHeight=r.getAttribute("expandedHeight"),n.scalable=j.parseBoolean(r.getAttribute("scalable")),n.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),n.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),n.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{n.type=a.getAttribute("creativeType")||"text/html",n.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.staticResource=j.parseNodeText(a)});const s=j.childByName(r,"AdParameters");s&&(n.adParameters={value:j.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),n.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{n.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(n)}),t}function Ac(i){const e=[];return i.forEach(t=>{const r=Ph(t);r&&e.push(r)}),e}function Ph(i){if(i.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=i.attributes,r=i.childNodes;if(e.name=i.nodeName,i.attributes){for(const s in t)if(t.hasOwnProperty(s)){const a=t[s];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const s in r)if(r.hasOwnProperty(s)){const a=Ph(r[s]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const s=j.parseNodeText(i);s!==""&&(e.value=s),e.children=[]}return(n=e).value===null&&Object.keys(n.attributes).length===0&&n.children.length===0?null:e;var n}function z0(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const js={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function xc(i,e){if(!js[i.nodeName]||!js[i.nodeName].attributes)return;const t=js[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Lc(i,e,t){const r=js[i.nodeName],n=!t&&i.nodeName!=="Wrapper";if(!(!r||n)){if(r.subElements){const s=r.subElements.filter(a=>!j.childByName(i,a));s.length>0&&Mn({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:s},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(s=>j.childByName(i,s))||Mn({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Dc(i){return i.children&&i.children.length!==0}function Mn(i,e){let{name:t,parentName:r,attributes:n,subElements:s,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const W0={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),xc(e,t),Dc(e)){Lc(e,t,r);for(let n=0;n<e.children.length;n++)i(e.children[n],t,r)}else j.parseNodeText(e).length===0&&Mn({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Dc,emitMissingValueWarning:Mn,verifyRequiredAttributes:xc,verifyRequiredSubElements:Lc};function G0(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=Array.from(i.childNodes).filter(s=>{const a=s.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const s of n){if(j.copyNodeAttribute("id",i,s),j.copyNodeAttribute("sequence",i,s),j.copyNodeAttribute("adType",i,s),s.nodeName==="Wrapper")return{ad:K0(s,e),type:"WRAPPER"};if(s.nodeName==="InLine")return{ad:X0(s,e,{allowMultipleAds:t}),type:"INLINE"};const a=s.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(s.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:s})}}function X0(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Rh(i,e)}function Rh(i,e){let t=[];e&&W0.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),n=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,sequence:s.sequence||null,adType:s.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(j.parseAttributes(i));return r.forEach(s=>{switch(s.nodeName){case"Error":n.errorURLTemplates.push(j.parseNodeText(s));break;case"Impression":n.impressionURLTemplates.push({id:s.getAttribute("id")||null,url:j.parseNodeText(s)});break;case"Creatives":n.creatives=function(a){const l=[];return a.forEach(u=>{const p={id:u.getAttribute("id")||null,adId:z0(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},g=[];let b;j.childrenByName(u,"UniversalAdId").forEach(w=>{const C={idRegistry:w.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(w)};g.push(C)});const S=j.childByName(u,"CreativeExtensions");S&&(b=Ac(j.childrenByName(S,"CreativeExtension")));for(const w in u.childNodes){const C=u.childNodes[w];let v;switch(C.nodeName){case"Linear":v=V0(C,p);break;case"NonLinearAds":v=H0(C,p);break;case"CompanionAds":v=$0(C,p)}v&&(g&&(v.universalAdIds=g),b&&(v.creativeExtensions=b),l.push(v))}}),l}(j.childrenByName(s,"Creative"));break;case"Extensions":{const a=j.childrenByName(s,"Extension");n.extensions=Ac(a),n.adVerifications.length||(t=function(l){let u=null,p=[];return l.some(g=>u=j.childByName(g,"AdVerifications")),u&&(p=Pc(j.childrenByName(u,"Verification"))),p}(a));break}case"AdVerifications":n.adVerifications=Pc(j.childrenByName(s,"Verification"));break;case"AdSystem":n.system={value:j.parseNodeText(s),version:s.getAttribute("version")||null};break;case"AdTitle":n.title=j.parseNodeText(s);break;case"AdServingId":n.adServingId=j.parseNodeText(s);break;case"Category":n.categories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)});break;case"Expires":n.expires=parseInt(j.parseNodeText(s),10);break;case"ViewableImpression":n.viewableImpression.push(function(a){const l=(u,p)=>{const g=j.parseNodeText(p);return g&&u.push(g),u};return{id:a.getAttribute("id")||null,viewable:j.childrenByName(a,"Viewable").reduce(l,[]),notViewable:j.childrenByName(a,"NotViewable").reduce(l,[]),viewUndetermined:j.childrenByName(a,"ViewUndetermined").reduce(l,[])}}(s));break;case"Description":n.description=j.parseNodeText(s);break;case"Advertiser":n.advertiser={id:s.getAttribute("id")||null,value:j.parseNodeText(s)};break;case"Pricing":n.pricing={value:j.parseNodeText(s),model:s.getAttribute("model")||null,currency:s.getAttribute("currency")||null};break;case"Survey":n.survey={value:j.parseNodeText(s),type:s.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)})}}),t.length&&(n.adVerifications=n.adVerifications.concat(t)),n}function K0(i,e){const t=Rh(i,e),r=i.getAttribute("followAdditionalWrappers"),n=i.getAttribute("allowMultipleAds"),s=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!n&&j.parseBoolean(n),t.fallbackOnNoAd=s?j.parseBoolean(s):null;let a=j.childByName(i,"VASTAdTagURI");if(a?t.nextWrapperURL=j.parseNodeText(a):(a=j.childByName(i,"VASTAdTagURL"),a&&(t.nextWrapperURL=j.parseNodeText(j.childByName(a,"URL")))),t.creatives.forEach(l=>{if(["linear","nonlinear"].includes(l.type)){if(l.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[l.type]||(t.trackingEvents[l.type]={});for(const u in l.trackingEvents){const p=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),p.forEach(g=>{t.trackingEvents[l.type][u].push(g)})}}l.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),l.videoClickTrackingURLTemplates.forEach(u=>{t.videoClickTrackingURLTemplates.push(u)})),l.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=l.videoClickThroughURLTemplate),l.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),l.videoCustomClickURLTemplates.forEach(u=>{t.videoCustomClickURLTemplates.push(u)}))}}),t.nextWrapperURL)return t}function Pc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},n=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),n.forEach(a=>{let{nodeName:l,textContent:u,attributes:p}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(p,r);break;case"VerificationParameters":r.parameters=u.trim()}});const s=j.childByName(t,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(a=>{const l=a.getAttribute("event"),u=j.parseNodeText(a);l&&u&&(Array.isArray(r.trackingEvents[l])||(r.trackingEvents[l]=[]),r.trackingEvents[l].push(u))}),e.push(r)}),e}let Nh=class{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(r,n,s){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(n,a.wrapFn),a.fired=!0,s.bind(r)(...arguments))}return a.wrapFn=l,l}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let s=!1;return this._handlers.forEach(a=>{a.event==="*"&&(s=!0,a.handler(e,...r)),a.event===e&&(s=!0,a.handler(...r))}),s}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}},Rc=0,$o=0;const Oh=(i,e)=>{!i||!e||i<=0||e<=0||($o=($o*Rc+8*i/e)/++Rc)},Y0={ERRORCODE:900,extensions:[]},Nc="VAST response version not supported";let Q0=class extends Nh{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];this.emit("VAST-error",Object.assign({},Y0,t,...n)),Ee.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return $o}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),Oh(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(r=>this.buildVASTResponse(r))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(r=>this.buildVASTResponse(r))}buildVASTResponse(e){const t=function(r){let{ads:n,errorURLTemplates:s,version:a}=r;return{ads:n||[],errorURLTemplates:s||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:n=null,wrapperDepth:s=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:n,wrapperDepth:s});const S=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(S?Nc:"Invalid VAST XMLDocument")}const p=[],g=e.documentElement.childNodes,b=e.documentElement.getAttribute("version");r&&b&&(this.vastVersion=b);for(const S in g){const w=g[S];if(w.nodeName==="Error"){const C=j.parseNodeText(w);r?this.rootErrorURLTemplates.push(C):this.errorURLTemplates.push(C)}else if(w.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&p.length>1)break;const C=G0(w,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});C.ad?(p.push(C.ad),this.emit("VAST-ad-parsed",{type:C.type,url:n,wrapperDepth:s,adIndex:p.length-1,vastVersion:b})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return p}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:n=null,previousUrl:s=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:p}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(p=!0);try{g=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:p,followAdditionalWrappers:u})}catch(b){return Promise.reject(b)}if(g.length===1&&n!=null&&(g[0].sequence=n),r===!1){const b=j.getSortedAdPods(g),S=j.getStandAloneAds(g);b.length?g=b:S.length&&(g=[S.shift()]),this.remainingAds=S}return this.resolveAds(g,{wrapperDepth:a,previousUrl:s,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:n}=arguments.length>1?arguments[1]:void 0;const s=[];return r=n,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);s.push(l)}),Promise.all(s).then(a=>Ee.flatten(a))}resolveWrappers(e,t,r){const n={...e};return new Promise(s=>{var a;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,s(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,s(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,s(n);n.nextWrapperURL=j.resolveVastAdTagURI(n.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:n.allowMultipleAds,u=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(p=>this.parse(p,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:l}).then(g=>{if(delete n.nextWrapperURL,g.length===0)return n.creatives=[],s(n);g.forEach(b=>{b&&j.mergeWrapperAdData(b,n)}),s(g)})).catch(p=>{n.errorCode=p.message===Nc?102:301,n.errorMessage=p.message,s(n)})})}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],n=!r.creatives.some(s=>{var a;return((a=s.mediaFiles)===null||a===void 0?void 0:a.length)>0});!r.errorCode&&!n||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}}},di=null;const J0={data:{},length:0,getItem(i){return this.data[i]},setItem(i,e){this.data[i]=e,this.length=Object.keys(this.data).length},removeItem(i){delete this.data[i],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class Z0{constructor(){this.storage=this.initStorage()}initStorage(){if(di)return di;try{di=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{di=null}return di&&!this.isStorageDisabled(di)||(di=J0,di.clear()),di}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const Vo=12e4,eb={get:async function(i,e){try{const t=new AbortController,r=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||Vo," ms (408)"))},e.timeout||Vo),n=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),s=function(a){return Ee.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")}(n);return s?{error:new Error(s),statusCode:n.status}:async function(a){const l=await a.text();let u;return u=Ee.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>qb).then(p=>p.i)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(n)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let tb=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||eb,this.fetchingOptions={timeout:e.timeout||Vo,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:n,emitter:s,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const p=Date.now();this.URLTemplateFilters.forEach(S=>{r=S(r)}),s("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:n,timeout:this.fetchingOptions.timeout,wrapperAd:u});const g=await this.urlHandler.get(r,this.fetchingOptions),b=Math.round(Date.now()-p);if(s("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(g==null?void 0:g.error)||null,duration:b,statusCode:(g==null?void 0:g.statusCode)||null,...g==null?void 0:g.details}),Oh(g==null||(t=g.details)===null||t===void 0?void 0:t.byteLength,b),g.error)throw new Error(g.error);return g.xml}},ib=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new Z0;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new tb,this.vastParser=new Q0({fetcher:this.fetcher}),this.storage=r,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((n,s)=>{if(this.cappingFreeLunch>=this.totalCalls)return s(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return s(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(l=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(l,t).then(u=>{const p=this.vastParser.buildVASTResponse(u);n(p)}))).catch(l=>s(l))})}},rb=class extends Nh{constructor(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const l=this.creative.trackingEvents[a];this.trackingEvents[a]=l.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ee.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ee.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))});const n=this.skipDelay||-1;if(n===-1||this.skippable||(n>e?this.emit("skip-countdown",n-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const s=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<s;l++)a.push("progress-".concat(l+1,"%"));a.push("progress-".concat(e));for(const l in this.quartiles)this.isQuartileReached(l,this.quartiles[l],e)&&(a.push(l),this._alreadyTriggeredQuartiles[l]=!0);this.lastPercentage=s}a.forEach(l=>{this.track(l,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let n=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(n=!0),n}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))})}setSkipDelay(e){Ee.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ee.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(s=>s.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const n=r.trackingEvents;if(n&&n.verificationNotExecuted){const s=n.verificationNotExecuted;this.trackURLs(s,t),this.emit("verificationNotExecuted",{trackingURLTemplates:s})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Ee.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,n={...t};if(r){this.progress&&(n.ADPLAYHEAD=this.progressFormatted());const s=Ee.resolveURLTemplates([r],n)[0];this.emit("clickthrough",s)}}trackProgressEvents(e,t,r){const n=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(s=>{let[a]=s;return a.startsWith("progress-")}).map(s=>{let[a,l]=s;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(s=>{let{time:a}=s;return a<=n&&a>this.progress}).forEach(s=>{let{name:a,urls:l}=s;!r&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:l}),this.trackURLs(l,t),r?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const n=this.trackingEvents[e],s=this.emitAlwaysEvents.indexOf(e)>-1;n?(this.emit(e,{trackingURLTemplates:n}),this.trackURLs(n,t)):s&&this.emit(e,null),r&&(delete this.trackingEvents[e],s&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:s,invalidUrls:a}=Ee.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const l={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(l.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(l.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(l.UNIVERSALADID=this.creative.universalAdIds.map(u=>u.idRegistry.concat(" ",u.value)).join(",")),this.ad&&(this.ad.sequence&&(l.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(l.ADTYPE=this.ad.adType),this.ad.adServingId&&(l.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(l.ADCATEGORIES=this.ad.categories.map(u=>u.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(l.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(u=>u.value).join(","))),Ee.track(s,l,n)}convertToTimecode(e){if(!Ee.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),n=Math.floor(t/6e4%60),s=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ee.addLeadingZeros(r,2),":").concat(Ee.addLeadingZeros(n,2),":").concat(Ee.addLeadingZeros(s,2),".").concat(Ee.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},nb=class{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdTagURI":this.adTagURI={templateType:r.getAttribute("templateType"),uri:(r.textContent||r.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=r.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=r;break}}}};function Uh(i,e){const t=[];for(const r in i.childNodes){const n=i.childNodes[r];(n.nodeName===e||e===`vmap:${n.nodeName}`||n.nodeName===`vmap:${e}`)&&t.push(n)}return t}function sb(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const n in e){const s=e[n];s.nodeName==="#cdata-section"&&t.push(s)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const n in e){const s=e[n];switch(s.nodeName){case"#text":r+=s.textContent.trim();break;case"#cdata-section":r+=s.data;break}}return r}function Sl(i){const e={attributes:{},children:{},value:{}};e.value=sb(i);const t=i.attributes;if(t)for(const n in t){const s=t[n];s.nodeName&&s.nodeValue!==void 0&&s.nodeValue!==null&&(e.attributes[s.nodeName]=s.nodeValue)}const r=i.childNodes;if(r)for(const n in r){const s=r[n];s.nodeName&&s.nodeName.substring(0,1)!=="#"&&(e.children[s.nodeName]=Sl(s))}return e}let ab=class{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdSource":this.adSource=new nb(r);break;case"TrackingEvents":for(const n in r.childNodes){const s=r.childNodes[n];s.localName==="Tracking"&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=Uh(r,"Extension").map(n=>Sl(n));break}}}track(e,t){for(const r in this.trackingEvents){const n=this.trackingEvents[r];if(n.event===e){let{uri:s}=n;n.event==="error"&&(s=s.replace("[ERRORCODE]",t)),this.tracker(s)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}};class ob{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const r=e.documentElement.childNodes[t];switch(r.localName){case"AdBreak":this.adBreaks.push(new ab(r));break;case"Extensions":this.extensions=Uh(r,"Extension").map(n=>Sl(n));break}}}}const lb=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const n=new t.NonceLoader(r);return async()=>{try{const s=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||de.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=de.v4(),sessionStorage.setItem("sl-ad-session-id",u)),fh(l)||(l=Hs(`https://${l}`,Hs.URL)),s.searchParams.get("url")||s.searchParams.set("url","https://streamlayer.io"),s.searchParams.get("description_url")||s.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=s.searchParams.get("vpa")==="auto",a.adWillPlayMuted=s.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=s.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const p=await n.loadNonceManager(a);return s.searchParams.get("is_lat")==="[placeholder]"&&s.searchParams.set("is_lat","1"),s.searchParams.get("rdid")==="[placeholder]"&&s.searchParams.set("rdid",l),s.searchParams.get("correlator")==="[placeholder]"&&s.searchParams.set("correlator",u),s.searchParams.set("wta","1"),s.searchParams.set("givn",p.getNonce()),s}catch(s){console.log("AdsManager could not be started",s);return}}},ub=new ib,cb=i=>i.creatives.find(e=>e.mediaFiles),db=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(r=>r.fileURL))==null?void 0:e.fileURL)||""},Oc=X.a$1({ads:[],autoplay:!0,muted:!1}),hb=(i,e)=>{const[t,r]=Me.useState(),n=Me.useRef(Date.now()),s=Me.useRef(Date.now());return Me.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=lb(i.current,e),l=Date.now();n.current=l,a().then(u=>{n.current===l&&r(u)}).catch(u=>{console.error(u)})},[i,e]),Me.useEffect(()=>{const a=async(l,u)=>{let p=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),C=new DOMParser,v=await w.text(),D=C.parseFromString(v,"text/xml");p=new ob(D).adBreaks.map(L=>L.adSource.adTagURI.uri)}else p=[l.toString()];const g=await Promise.all(p.map((w,C)=>ub.get(w).then(v=>{if(s.current===u){const D=v.ads.find(U=>U.creatives.length>0);if(!D)return;const L=cb(D),O=db(L);return{creative:L,order:C,mediaFileUrl:O,ad:D,raw:v}}}))),b=l.searchParams.get("vpa")!=="click",S=l.searchParams.get("vpmute")==="1";Oc.set({ads:g.filter(w=>!!w),autoplay:b,muted:S})};if(t){const l=Date.now();s.current=l,a(t,l)}return()=>{s.current=0}},[t]),Oc};var Mi={},vi={};function pb(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Object.prototype.hasOwnProperty.call(i,r)){var n=i[r];if(e.call(void 0,n,r,i))return n}}function El(i,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(i):i}function gb(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i}var Mh=El({HTML:"text/html",isHTML:function(i){return i===Mh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Bh=El({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===Bh.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});vi.assign=gb;vi.find=pb;vi.freeze=El;vi.MIME_TYPE=Mh;vi.NAMESPACE=Bh;var Fh=vi,ii=Fh.find,Bn=Fh.NAMESPACE;function mb(i){return i!==""}function fb(i){return i?i.split(/[\t\n\f\r ]+/).filter(mb):[]}function yb(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Uc(i){if(!i)return[];var e=fb(i);return Object.keys(e.reduce(yb,{}))}function _b(i){return function(e){return i&&i.indexOf(e)!==-1}}function zn(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function vt(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,zn(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var Tt={},Ft=Tt.ELEMENT_NODE=1,Pr=Tt.ATTRIBUTE_NODE=2,zs=Tt.TEXT_NODE=3,jh=Tt.CDATA_SECTION_NODE=4,qh=Tt.ENTITY_REFERENCE_NODE=5,bb=Tt.ENTITY_NODE=6,$h=Tt.PROCESSING_INSTRUCTION_NODE=7,Vh=Tt.COMMENT_NODE=8,Hh=Tt.DOCUMENT_NODE=9,zh=Tt.DOCUMENT_TYPE_NODE=10,fi=Tt.DOCUMENT_FRAGMENT_NODE=11,vb=Tt.NOTATION_NODE=12,rt={},Ye={};rt.INDEX_SIZE_ERR=(Ye[1]="Index size error",1);rt.DOMSTRING_SIZE_ERR=(Ye[2]="DOMString size error",2);var ft=rt.HIERARCHY_REQUEST_ERR=(Ye[3]="Hierarchy request error",3);rt.WRONG_DOCUMENT_ERR=(Ye[4]="Wrong document",4);rt.INVALID_CHARACTER_ERR=(Ye[5]="Invalid character",5);rt.NO_DATA_ALLOWED_ERR=(Ye[6]="No data allowed",6);rt.NO_MODIFICATION_ALLOWED_ERR=(Ye[7]="No modification allowed",7);var Wh=rt.NOT_FOUND_ERR=(Ye[8]="Not found",8);rt.NOT_SUPPORTED_ERR=(Ye[9]="Not supported",9);var Mc=rt.INUSE_ATTRIBUTE_ERR=(Ye[10]="Attribute in use",10);rt.INVALID_STATE_ERR=(Ye[11]="Invalid state",11);rt.SYNTAX_ERR=(Ye[12]="Syntax error",12);rt.INVALID_MODIFICATION_ERR=(Ye[13]="Invalid modification",13);rt.NAMESPACE_ERR=(Ye[14]="Invalid namespace",14);rt.INVALID_ACCESS_ERR=(Ye[15]="Invalid access",15);function $e(i,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,Ye[i]),this.message=Ye[i],Error.captureStackTrace&&Error.captureStackTrace(this,$e);return t.code=i,e&&(this.message=this.message+": "+e),t}$e.prototype=Error.prototype;zn(rt,$e);function gi(){}gi.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i,e){for(var t=[],r=0;r<this.length;r++)vr(this[r],t,i,e);return t.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};function Rr(i,e){this._node=i,this._refresh=e,wl(this)}function wl(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(np(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Object.prototype.hasOwnProperty.call(i,r)&&delete i[r];zn(t,i),i._inc=e}}Rr.prototype.item=function(i){return wl(this),this[i]||null};vt(Rr,gi);function Ws(){}function Gh(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function Bc(i,e,t,r){if(r?e[Gh(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&Yh(n,i,r),Tb(n,i,t))}}function Fc(i,e,t){var r=Gh(e,t);if(r>=0){for(var n=e.length-1;r<n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&(Yh(s,i,t),t.ownerElement=null)}}else throw new $e(Wh,new Error(i.tagName+"@"+t))}Ws.prototype={length:0,item:gi.prototype.item,getNamedItem:function(i){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==i)return t}},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!=this._ownerElement)throw new $e(Mc);var t=this.getNamedItem(i.nodeName);return Bc(this._ownerElement,this,i,t),t},setNamedItemNS:function(i){var e=i.ownerElement,t;if(e&&e!=this._ownerElement)throw new $e(Mc);return t=this.getNamedItemNS(i.namespaceURI,i.localName),Bc(this._ownerElement,this,i,t),t},removeNamedItem:function(i){var e=this.getNamedItem(i);return Fc(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);return Fc(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){for(var t=this.length;t--;){var r=this[t];if(r.localName==e&&r.namespaceURI==i)return r}return null}};function Xh(){}Xh.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=new Wn;if(r.implementation=this,r.childNodes=new gi,r.doctype=t||null,t&&r.appendChild(t),e){var n=r.createElementNS(i,e);r.appendChild(n)}return r},createDocumentType:function(i,e,t){var r=new Ta;return r.name=i,r.nodeName=i,r.publicId=e||"",r.systemId=t||"",r}};function _e(){}_e.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(i,e){return Gs(this,i,e)},replaceChild:function(i,e){Gs(this,i,e,Jh),e&&this.removeChild(e)},removeChild:function(i){return Qh(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return Ho(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==zs&&i.nodeType==zs?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r]===i)return r}e=e.nodeType==Pr?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==Pr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function Kh(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}zn(Tt,_e);zn(Tt,_e.prototype);function Fn(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Fn(i,e))return!0;while(i=i.nextSibling)}function Wn(){this.ownerDocument=this}function Tb(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Bn.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Yh(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===Bn.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function kl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function Qh(i,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,kl(i.ownerDocument,i),e}function Sb(i){return i&&(i.nodeType===_e.DOCUMENT_NODE||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.ELEMENT_NODE)}function Eb(i){return i&&(ri(i)||Cl(i)||yi(i)||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.COMMENT_NODE||i.nodeType===_e.PROCESSING_INSTRUCTION_NODE)}function yi(i){return i&&i.nodeType===_e.DOCUMENT_TYPE_NODE}function ri(i){return i&&i.nodeType===_e.ELEMENT_NODE}function Cl(i){return i&&i.nodeType===_e.TEXT_NODE}function jc(i,e){var t=i.childNodes||[];if(ii(t,ri)||yi(e))return!1;var r=ii(t,yi);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function qc(i,e){var t=i.childNodes||[];function r(s){return ri(s)&&s!==e}if(ii(t,r))return!1;var n=ii(t,yi);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function wb(i,e,t){if(!Sb(i))throw new $e(ft,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new $e(Wh,"child not in parent");if(!Eb(e)||yi(e)&&i.nodeType!==_e.DOCUMENT_NODE)throw new $e(ft,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function kb(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!jc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!jc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,yi))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element");if(!t&&a)throw new $e(ft,"Doctype can not be appended since element is present")}}function Jh(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===_e.DOCUMENT_FRAGMENT_NODE){var s=n.filter(ri);if(s.length>1||ii(n,Cl))throw new $e(ft,"More than one element or text in fragment");if(s.length===1&&!qc(i,t))throw new $e(ft,"Element in fragment can not be inserted before doctype")}if(ri(e)&&!qc(i,t))throw new $e(ft,"Only one element can be added and only after doctype");if(yi(e)){if(ii(r,function(l){return yi(l)&&l!==t}))throw new $e(ft,"Only one doctype is allowed");var a=ii(r,ri);if(t&&r.indexOf(a)<r.indexOf(t))throw new $e(ft,"Doctype can only be inserted before an element")}}function Gs(i,e,t,r){wb(i,e,t),i.nodeType===_e.DOCUMENT_NODE&&(r||kb)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===fi){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var l=t?t.previousSibling:i.lastChild;s.previousSibling=l,a.nextSibling=t,l?l.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return kl(i.ownerDocument||i,i),e.nodeType==fi&&(e.firstChild=e.lastChild=null),e}function Cb(i,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=i,e.previousSibling=i.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:i.firstChild=e,i.lastChild=e,kl(i.ownerDocument,i,e),e}Wn.prototype={nodeName:"#document",nodeType:Hh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==fi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return Gs(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===Ft&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),Qh(this,i)},replaceChild:function(i,e){Gs(this,i,e,Jh),i.ownerDocument=this,e&&this.removeChild(e),ri(i)&&(this.documentElement=i)},importNode:function(i,e){return rp(this,i,e)},getElementById:function(i){var e=null;return Fn(this.documentElement,function(t){if(t.nodeType==Ft&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Uc(i);return new Rr(this,function(t){var r=[];return e.length>0&&Fn(t.documentElement,function(n){if(n!==t&&n.nodeType===Ft){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var l=Uc(s);a=e.every(_b(l))}a&&r.push(n)}}}),r})},createElement:function(i){var e=new rr;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new gi;var t=e.attributes=new Ws;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Sa;return i.ownerDocument=this,i.childNodes=new gi,i},createTextNode:function(i){var e=new Il;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Al;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new xl;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Dl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Xs;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Ll;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new rr,r=e.split(":"),n=t.attributes=new Ws;return t.childNodes=new gi,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,n._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Xs,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};vt(Wn,_e);function rr(){this._nsMap={}}rr.prototype={nodeType:Ft,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===fi?this.insertBefore(i,null):Cb(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var r=this.ownerDocument.createAttributeNS(i,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new Rr(this,function(e){var t=[];return Fn(e,function(r){r!==e&&r.nodeType==Ft&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new Rr(this,function(t){var r=[];return Fn(t,function(n){n!==t&&n.nodeType===Ft&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};Wn.prototype.getElementsByTagName=rr.prototype.getElementsByTagName;Wn.prototype.getElementsByTagNameNS=rr.prototype.getElementsByTagNameNS;vt(rr,_e);function Xs(){}Xs.prototype.nodeType=Pr;vt(Xs,_e);function Gn(){}Gn.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(Ye[ft])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};vt(Gn,_e);function Il(){}Il.prototype={nodeName:"#text",nodeType:zs,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};vt(Il,Gn);function Al(){}Al.prototype={nodeName:"#comment",nodeType:Vh};vt(Al,Gn);function xl(){}xl.prototype={nodeName:"#cdata-section",nodeType:jh};vt(xl,Gn);function Ta(){}Ta.prototype.nodeType=zh;vt(Ta,_e);function Zh(){}Zh.prototype.nodeType=vb;vt(Zh,_e);function ep(){}ep.prototype.nodeType=bb;vt(ep,_e);function Ll(){}Ll.prototype.nodeType=qh;vt(Ll,_e);function Sa(){}Sa.prototype.nodeName="#document-fragment";Sa.prototype.nodeType=fi;vt(Sa,_e);function Dl(){}Dl.prototype.nodeType=$h;vt(Dl,_e);function tp(){}tp.prototype.serializeToString=function(i,e,t){return ip.call(i,e,t)};_e.prototype.toString=ip;function ip(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,n=r.prefix,s=r.namespaceURI;if(s&&n==null){var n=r.lookupPrefix(s);if(n==null)var a=[{namespace:s,prefix:null}]}return vr(this,t,i,e,a),t.join("")}function $c(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===Bn.XML||n===Bn.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function bo(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Kh),'"')}function vr(i,e,t,r,n){if(n||(n=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Ft:var s=i.attributes,a=s.length,l=i.firstChild,u=i.tagName;t=Bn.isHTML(i.namespaceURI)||t;var p=u;if(!t&&!i.prefix&&i.namespaceURI){for(var g,b=0;b<s.length;b++)if(s.item(b).name==="xmlns"){g=s.item(b).value;break}if(!g)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.prefix===""&&w.namespace===i.namespaceURI){g=w.namespace;break}}if(g!==i.namespaceURI)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.namespace===i.namespaceURI){w.prefix&&(p=w.prefix+":"+u);break}}}e.push("<",p);for(var C=0;C<a;C++){var v=s.item(C);v.prefix=="xmlns"?n.push({prefix:v.localName,namespace:v.value}):v.nodeName=="xmlns"&&n.push({prefix:"",namespace:v.value})}for(var C=0;C<a;C++){var v=s.item(C);if($c(v,t,n)){var D=v.prefix||"",L=v.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}vr(v,e,t,r,n)}if(u===p&&$c(i,t,n)){var D=i.prefix||"",L=i.namespaceURI;bo(e,D?"xmlns:"+D:"xmlns",L),n.push({prefix:D,namespace:L})}if(l||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(e.push(">"),t&&/^script$/i.test(u))for(;l;)l.data?e.push(l.data):vr(l,e,t,r,n.slice()),l=l.nextSibling;else for(;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;e.push("</",p,">")}else e.push("/>");return;case Hh:case fi:for(var l=i.firstChild;l;)vr(l,e,t,r,n.slice()),l=l.nextSibling;return;case Pr:return bo(e,i.name,i.value);case zs:return e.push(i.data.replace(/[<&>]/g,Kh));case jh:return e.push("<![CDATA[",i.data,"]]>");case Vh:return e.push("<!--",i.data,"-->");case zh:var O=i.publicId,U=i.systemId;if(e.push("<!DOCTYPE ",i.name),O)e.push(" PUBLIC ",O),U&&U!="."&&e.push(" ",U),e.push(">");else if(U&&U!=".")e.push(" SYSTEM ",U,">");else{var F=i.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case $h:return e.push("<?",i.target," ",i.data,"?>");case qh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function rp(i,e,t){var r;switch(e.nodeType){case Ft:r=e.cloneNode(!1),r.ownerDocument=i;case fi:break;case Pr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(rp(i,n,t)),n=n.nextSibling;return r}function Ho(i,e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new gi),r.ownerDocument=i,r.nodeType){case Ft:var a=e.attributes,l=r.attributes=new Ws,u=a.length;l._ownerElement=r;for(var p=0;p<u;p++)r.setAttributeNode(Ho(i,a.item(p),!0));break;case Pr:t=!0}if(t)for(var g=e.firstChild;g;)r.appendChild(Ho(i,g,t)),g=g.nextSibling;return r}function np(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Ft:case fi:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Rr.prototype,"length",{get:function(){return wl(this),this.$$length}}),Object.defineProperty(_e.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Ft:case fi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),np=function(e,t,r){e["$$"+t]=r}}}catch{}Mi.DocumentType=Ta;Mi.DOMException=$e;Mi.DOMImplementation=Xh;Mi.Element=rr;Mi.Node=_e;Mi.NodeList=gi;Mi.XMLSerializer=tp;var Ea={},sp={};(function(i){var e=vi.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
2
|
-
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),i.entityMap=i.HTML_ENTITIES})(sp);var Pl={},jn=vi.NAMESPACE,zo=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Vc=new RegExp("[\\-\\.0-9"+zo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Hc=new RegExp("^"+zo.source+Vc.source+"*(?::"+zo.source+Vc.source+"*)?$"),yn=0,Ai=1,hr=2,_n=3,pr=4,gr=5,bn=6,Ps=7;function Nr(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Nr)}Nr.prototype=new Error;Nr.prototype.name=Nr.name;function ap(){}ap.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),op(e,e={}),Ib(i,e,t,r,this.errorHandler),r.endDocument()}};function Ib(i,e,t,r,n){function s(he){if(he>65535){he-=65536;var we=55296+(he>>10),ze=56320+(he&1023);return String.fromCharCode(we,ze)}else return String.fromCharCode(he)}function a(he){var we=he.slice(1,-1);return Object.hasOwnProperty.call(t,we)?t[we]:we.charAt(0)==="#"?s(parseInt(we.substr(1).replace("x","0x"))):(n.error("entity not found:"+he),he)}function l(he){if(he>v){var we=i.substring(v,he).replace(/&#?\w+;/g,a);S&&u(v),r.characters(we,0,he-v),v=he}}function u(he,we){for(;he>=g&&(we=b.exec(i));)p=we.index,g=p+we[0].length,S.lineNumber++;S.columnNumber=he-p+1}for(var p=0,g=0,b=/.*(?:\r\n?|\n)|.*$/g,S=r.locator,w=[{currentNSMap:e}],C={},v=0;;){try{var D=i.indexOf("<",v);if(D<0){if(!i.substr(v).match(/^\s*$/)){var L=r.doc,O=L.createTextNode(i.substr(v));L.appendChild(O),r.currentElement=O}return}switch(D>v&&l(D),i.charAt(D+1)){case"/":var le=i.indexOf(">",D+3),U=i.substring(D+2,le).replace(/[ \t\n\r]+$/g,""),F=w.pop();le<0?(U=i.substring(D+2).replace(/[\s<].*/,""),n.error("end tag name: "+U+" is not complete:"+F.tagName),le=D+1+U.length):U.match(/\s</)&&(U=U.replace(/[\s<].*/,""),n.error("end tag name: "+U+" maybe not complete"),le=D+1+U.length);var N=F.localNSMap,V=F.tagName==U,J=V||F.tagName&&F.tagName.toLowerCase()==U.toLowerCase();if(J){if(r.endElement(F.uri,F.localName,U),N)for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&r.endPrefixMapping(Y);V||n.fatalError("end tag name: "+U+" is not match the current start tagName:"+F.tagName)}else w.push(F);le++;break;case"?":S&&u(D),le=Pb(i,D,r);break;case"!":S&&u(D),le=Db(i,D,r,n);break;default:S&&u(D);var ie=new lp,pe=w[w.length-1].currentNSMap,le=Ab(i,D,ie,pe,a,n),ge=ie.length;if(!ie.closed&&Lb(i,le,ie.tagName,C)&&(ie.closed=!0,t.nbsp||n.warning("unclosed xml attribute")),S&&ge){for(var ee=zc(S,{}),ce=0;ce<ge;ce++){var ne=ie[ce];u(ne.offset),ne.locator=zc(S,{})}r.locator=ee,Wc(ie,r,pe)&&w.push(ie),r.locator=S}else Wc(ie,r,pe)&&w.push(ie);jn.isHTML(ie.uri)&&!ie.closed?le=xb(i,le,ie.tagName,a,r):le++}}catch(he){if(he instanceof Nr)throw he;n.error("element parse error: "+he),le=-1}le>v?v=le:l(Math.max(D,v)+1)}}function zc(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function Ab(i,e,t,r,n,s){function a(S,w,C){t.attributeNames.hasOwnProperty(S)&&s.fatalError("Attribute "+S+" redefined"),t.addValue(S,w.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),C)}for(var l,u,p=++e,g=yn;;){var b=i.charAt(p);switch(b){case"=":if(g===Ai)l=i.slice(e,p),g=_n;else if(g===hr)g=_n;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(g===_n||g===Ai)if(g===Ai&&(s.warning('attribute value must after "="'),l=i.slice(e,p)),e=p+1,p=i.indexOf(b,e),p>0)u=i.slice(e,p),a(l,u,e-1),g=gr;else throw new Error("attribute value no end '"+b+"' match");else if(g==pr)u=i.slice(e,p),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+b+")!!"),e=p+1,g=gr;else throw new Error('attribute value must after "="');break;case"/":switch(g){case yn:t.setTagName(i.slice(e,p));case gr:case bn:case Ps:g=Ps,t.closed=!0;case pr:case Ai:break;case hr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),g==yn&&t.setTagName(i.slice(e,p)),p;case">":switch(g){case yn:t.setTagName(i.slice(e,p));case gr:case bn:case Ps:break;case pr:case Ai:u=i.slice(e,p),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case hr:g===hr&&(u=l),g==pr?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!jn.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case _n:throw new Error("attribute value missed!!")}return p;case"":b=" ";default:if(b<=" ")switch(g){case yn:t.setTagName(i.slice(e,p)),g=bn;break;case Ai:l=i.slice(e,p),g=hr;break;case pr:var u=i.slice(e,p);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case gr:g=bn;break}else switch(g){case hr:t.tagName,(!jn.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=p,g=Ai;break;case gr:s.warning('attribute space is required"'+l+'"!!');case bn:g=Ai,e=p;break;case _n:g=pr,e=p;break;case Ps:throw new Error("elements closed character '/' and '>' must be connected to")}}p++}}function Wc(i,e,t){for(var r=i.tagName,n=null,s=i.length;s--;){var a=i[s],l=a.qName,u=a.value,S=l.indexOf(":");if(S>0)var p=a.prefix=l.slice(0,S),g=l.slice(S+1),b=p==="xmlns"&&g;else g=l,p=null,b=l==="xmlns"&&"";a.localName=g,b!==!1&&(n==null&&(n={},op(t,t={})),t[b]=n[b]=u,a.uri=jn.XMLNS,e.startPrefixMapping(b,u))}for(var s=i.length;s--;){a=i[s];var p=a.prefix;p&&(p==="xml"&&(a.uri=jn.XML),p!=="xmlns"&&(a.uri=t[p||""]))}var S=r.indexOf(":");S>0?(p=i.prefix=r.slice(0,S),g=i.localName=r.slice(S+1)):(p=null,g=i.localName=r);var w=i.uri=t[p||""];if(e.startElement(w,g,r,i),i.closed){if(e.endElement(w,g,r),n)for(p in n)Object.prototype.hasOwnProperty.call(n,p)&&e.endPrefixMapping(p)}else return i.currentNSMap=t,i.localNSMap=n,!0}function xb(i,e,t,r,n){if(/^(?:script|textarea)$/i.test(t)){var s=i.indexOf("</"+t+">",e),a=i.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(t)?(n.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,r),n.characters(a,0,a.length),s)}return e+1}function Lb(i,e,t,r){var n=r[t];return n==null&&(n=i.lastIndexOf("</"+t+">"),n<e&&(n=i.lastIndexOf("</"+t)),r[t]=n),n<e}function op(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function Db(i,e,t,r){var n=i.charAt(e+2);switch(n){case"-":if(i.charAt(e+3)==="-"){var s=i.indexOf("-->",e+4);return s>e?(t.comment(i,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var s=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,s-e-9),t.endCDATA(),s+3}var a=Rb(i,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],p=!1,g=!1;l>3&&(/^public$/i.test(a[2][0])?(p=a[3][0],g=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(g=a[3][0]));var b=a[l-1];return t.startDTD(u,p,g),t.endDTD(),b.index+b[0].length}}return-1}function Pb(i,e,t){var r=i.indexOf("?>",e);if(r){var n=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,t.processingInstruction(n[1],n[2]),r+2):-1}return-1}function lp(){this.attributeNames={}}lp.prototype={setTagName:function(i){if(!Hc.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!Hc.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function Rb(i,e){var t,r=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=e,n.exec(i);t=n.exec(i);)if(r.push(t),t[1])return r}Pl.XMLReader=ap;Pl.ParseError=Nr;var Nb=vi,Ob=Mi,Gc=sp,up=Pl,Ub=Ob.DOMImplementation,Xc=Nb.NAMESPACE,Mb=up.ParseError,Bb=up.XMLReader;function cp(i){return i.replace(/\r[\n\u0085]/g,`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),Me=require("react"),G=require("./provider.js"),ce=require("./useStreamLayerApp2.js"),S_=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function bh(i){return typeof i=="string"&&S_.test(i)}function gc(i){if(!bh(i))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(i.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(i.slice(9,13),16))>>>8,e&255,(e=parseInt(i.slice(14,18),16))>>>8,e&255,(e=parseInt(i.slice(19,23),16))>>>8,e&255,(e=parseInt(i.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function E_(i){i=unescape(encodeURIComponent(i));const e=new Uint8Array(i.length);for(let t=0;t<i.length;++t)e[t]=i.charCodeAt(t);return e}const w_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",k_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function C_(i,e,t,r,n,s){const a=typeof t=="string"?E_(t):t,l=typeof r=="string"?gc(r):r;if(typeof r=="string"&&(r=gc(r)),(r==null?void 0:r.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let u=new Uint8Array(16+a.length);if(u.set(l),u.set(a,l.length),u=e(u),u[6]=u[6]&15|i,u[8]=u[8]&63|128,n){s=s||0;for(let p=0;p<16;++p)n[s+p]=u[p];return n}return ce.unsafeStringify(u)}function I_(i,e,t,r){switch(i){case 0:return e&t^~e&r;case 1:return e^t^r;case 2:return e&t^e&r^t&r;case 3:return e^t^r}}function bo(i,e){return i<<e|i>>>32-e}function A_(i){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],r=new Uint8Array(i.length+1);r.set(i),r[i.length]=128,i=r;const n=i.length/4+2,s=Math.ceil(n/16),a=new Array(s);for(let l=0;l<s;++l){const u=new Uint32Array(16);for(let p=0;p<16;++p)u[p]=i[l*64+p*4]<<24|i[l*64+p*4+1]<<16|i[l*64+p*4+2]<<8|i[l*64+p*4+3];a[l]=u}a[s-1][14]=(i.length-1)*8/Math.pow(2,32),a[s-1][14]=Math.floor(a[s-1][14]),a[s-1][15]=(i.length-1)*8&4294967295;for(let l=0;l<s;++l){const u=new Uint32Array(80);for(let C=0;C<16;++C)u[C]=a[l][C];for(let C=16;C<80;++C)u[C]=bo(u[C-3]^u[C-8]^u[C-14]^u[C-16],1);let p=t[0],m=t[1],_=t[2],S=t[3],w=t[4];for(let C=0;C<80;++C){const v=Math.floor(C/20),L=bo(p,5)+I_(v,m,_,S)+w+e[v]+u[C]>>>0;w=S,S=_,_=bo(m,30)>>>0,m=p,p=L}t[0]=t[0]+p>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+_>>>0,t[3]=t[3]+S>>>0,t[4]=t[4]+w>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function Ws(i,e,t,r){return C_(80,A_,i,e,t,r)}Ws.DNS=w_;Ws.URL=k_;const x_=G.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),L_="a1rlj479",D_="s35f1di",P_="sj4471g",R_="b12050d8",N_="b1d5ybek",O_=i=>i==="left"||i==="right"?D_:R_,U_=i=>i==="left"||i==="right"?P_:N_,M_=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",vl=({children:i,style:e,className:t,enabled:r=!0,hiding:n,direction:s="left",onAnimationEnd:a})=>W.jsx(x_,{style:e,className:G.cx_default(t,L_,M_(s),r&&!n&&O_(s),r&&n&&U_(s)),onAnimationEnd:a,children:i}),B_=G.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),F_=G.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),j_=()=>B_,$_=G.styled_default(j_())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),vh=({promotion:i,promotionId:e,hiding:t,isEventFired:r,fireEvent:n,direction:s="bottom"})=>{const a=(i==null?void 0:i.adUnit)===ce.AdUnit.STANDART,l=a?i.banner:i.additionalBanner;if(Me.useEffect(()=>{l!=null&&l.imageUrl&&i.type&&e&&(r!=null&&r("banner-showed")||(G.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:i.type}}),n==null||n("banner-showed")))},[l==null?void 0:l.imageUrl,n,r,i.type,e]),!(l!=null&&l.imageUrl))return null;let u=l==null?void 0:l.url;return u&&u.indexOf("http")!==0&&(u=`https://${u}`),W.jsx(vl,{direction:s,hiding:t,children:W.jsx(F_,{className:"BannerContainer","data-is-ad":a,children:W.jsx($_,{as:u?"a":"span",className:"BannerLink",href:u,style:{backgroundImage:`url(${l.imageUrl})`,cursor:u?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},q_=({cardId:i,promotion:e,direction:t="bottom"})=>W.jsx(vh,{promotion:e,promotionId:i,direction:t,hiding:!1}),V_=G.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),H_=G.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),z_=G.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),W_=G.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),Tl=G.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),G_=()=>Tl,X_=G.styled_default(G_())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),fc=G.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),K_=G.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),Y_=G.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Q_=G.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),J_=G.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Th=G.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Z_=()=>Th,e0=G.styled_default(Z_())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),t0=()=>Th,Sh=G.styled_default(t0())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),i0={[ce.NotificationPromotionImagePosition.BOTTOM]:Tl,[ce.NotificationPromotionImagePosition.MIDDLE]:X_},r0=({src:i,imagePosition:e})=>{const t=i0[e]||Tl;return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},n0=G.O(e0),s0=G.O(Sh),a0=({notification:i,open:e,close:t,webos:r})=>{if(!i||!i.promotion||i.enabled!==ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:n,body:s,image:a,promotion:l}=i,{sponsorLogo:u,sponsorLogoMode:p,imagePosition:m,ctaButton:_}=l;return W.jsxs(J_,{className:"SL_Lower_Third_Notification",onClick:r?void 0:e,children:[W.jsxs(V_,{children:[W.jsx(r0,{src:a,imagePosition:m}),W.jsxs(H_,{children:[n&&W.jsx(z_,{children:n}),s&&W.jsx(W_,{children:s})]})]}),W.jsxs(Y_,{children:[p!==ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx(K_,{children:W.jsx("img",{src:u,alt:n})}),W.jsx(Q_,{})]}),r?W.jsxs(W.Fragment,{children:[W.jsx(n0,{webos:!0,onClick:t,children:"Dismiss"}),W.jsxs(s0,{webos:!0,autoFocus:!0,style:{color:_==null?void 0:_.textColor,backgroundColor:_==null?void 0:_.color},onClick:e,children:[(_==null?void 0:_.ctaIcon)&&(_==null?void 0:_.ctaIconMode)===ce.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(fc,{src:_==null?void 0:_.ctaIcon,alt:"cta-icon"}),(_==null?void 0:_.label)||"Open"]})]}):W.jsxs(Sh,{name:"promo-button",style:{color:_==null?void 0:_.textColor,backgroundColor:_==null?void 0:_.color},children:[(_==null?void 0:_.ctaIcon)&&(_==null?void 0:_.ctaIconMode)===ce.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(fc,{src:_==null?void 0:_.ctaIcon,alt:"cta-icon"}),(_==null?void 0:_.label)||"Open"]})]})]})},o0=G.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),l0=G.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),u0=G.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),c0=G.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),d0=G.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Sa=G.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),h0=()=>Sa,yc=G.styled_default(h0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),p0=()=>Sa,Eh=G.styled_default(p0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),m0=()=>Eh,g0=G.styled_default(m0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),f0=()=>Sa,y0=G.styled_default(f0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),_0=()=>Sa,b0=G.styled_default(_0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),v0=G.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),T0=()=>G.B1,S0=G.styled_default(T0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),E0=G.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),wh=G.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),w0=()=>wh,k0=G.styled_default(w0())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),C0=()=>wh,I0=G.styled_default(C0())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),A0={[ce.NotificationPromotionImagePosition.UNSET]:yc,[ce.NotificationPromotionImagePosition.FIT]:yc,[ce.NotificationPromotionImagePosition.CENTERED]:Eh,[ce.NotificationPromotionImagePosition.BOTTOM]:g0,[ce.NotificationPromotionImagePosition.SOLID]:y0,[ce.NotificationPromotionImagePosition.MIDDLE]:b0},x0=({src:i,imagePosition:e})=>{const t=A0[e];return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},L0=G.O(k0),D0=G.O(I0),P0=({notification:i,open:e,promotionId:t,hiding:r,direction:n="left",close:s,webos:a})=>{if(!i||!i.promotion||i.enabled!==ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ce.NotificationPromotionMode.LOWER_THIRD)return W.jsx(a0,{notification:i,open:e,close:s,webos:a});const{title:l,body:u,image:p,promotion:m}=i,{sponsorLogo:_,sponsorLogoMode:S,imagePosition:w,ctaButton:C}=m,v=L=>{L.stopPropagation(),s==null||s()};return W.jsx(vl,{className:"SL_Rich_Notification",direction:n,hiding:r,children:W.jsxs(l0,{onClick:a?()=>{}:e,children:[S!==ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&_&&W.jsx(E0,{children:W.jsx("img",{src:_,alt:l})}),W.jsxs(o0,{children:[W.jsx(x0,{src:p,imagePosition:w}),W.jsxs(u0,{children:[l&&W.jsx(c0,{children:l}),u&&W.jsx(d0,{children:u})]}),a&&W.jsx(L0,{webos:!0,onClick:v,children:"Dismiss"}),W.jsxs(D0,{webos:a,autoFocus:!0,onClick:a?e:()=>{},name:"promo-button",style:{color:C==null?void 0:C.textColor,backgroundColor:C==null?void 0:C.color},children:[(C==null?void 0:C.ctaIcon)&&(C==null?void 0:C.ctaIconMode)===ce.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(v0,{src:C==null?void 0:C.ctaIcon,alt:"cta-icon"}),(C==null?void 0:C.label)||"Open"]}),W.jsx(S0,{name:"chevronRight"})]})]})})},R0=G.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),kh=G.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Ch=G.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Ih=G.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ah="h10toh7",_c=G.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),N0=G.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),xh=G.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),O0=G.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),U0="s1nmch9k",bc=G.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),M0=G.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),B0=G.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),F0=G.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Lh=G.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),j0=G.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Dh=G.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),Ph=G.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),$0=G.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),q0="h17rwbtk",V0=G.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),vc=G.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),H0=G.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),z0=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),n=i-r*60;return r===0&&n===0&&e===t?null:W.jsxs(V0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(vc,{children:[t," of ",e]}),W.jsx(H0,{})]}),W.jsxs(vc,{children:[r,":",n<10?`0${n}`:n]})]})},W0=G.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),G0=({whyThisAd:i})=>{const[e,t]=Me.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:W.jsxs(W0,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&W.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&W.jsx("span",{children:"ad choice"})]})},X0=G.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Rh=G.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),K0=()=>Rh,Y0=G.styled_default(K0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),Q0=()=>Rh,J0=G.styled_default(Q0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),Z0=G.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),eb=G.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),Tc="m12n261r",Sc="m16vcml8",Ec="m1078nk6",wc=globalThis||void 0||self;function Sl(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,adId:i.adId||null,sequence:i.sequence||null,apiFramework:i.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const tb=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function kc(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],n=Oh(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Bh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const s in e)e[s]=Mh(e[s]);for(const s in n){const a=n[s];typeof a=="string"&&r.push(Nh(a,e))}return r}function Nh(i,e){const t=(i=Cc(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(n=>tb.indexOf(n)>-1);return r.length===0?i:(r=r.reduce((n,s)=>(n[s]=-1,n),{}),Cc(i,r))}function Cc(i,e){let t=i;for(const r in e){const n=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),n)}return t}function Oh(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function Ic(i){return/^(https?:\/\/|\/\/)/.test(i)}function Ac(i,e){for(let t=0;t<e.length;t++)if(Uh(e[t],i))return!0;return!1}function Uh(i,e){if(i&&e){const t=Object.getOwnPropertyNames(i),r=Object.getOwnPropertyNames(e);return t.length===r.length&&i.id===e.id&&i.url===e.url}return!1}function Mh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Bh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const Ie={track:function(i,e,t){kc(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:kc,extractURLsFromTemplates:Oh,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return Ic(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Ac,isTemplateObjectEqual:Uh,encodeURIComponentRFC3986:Mh,replaceUrlMacros:Nh,isNumeric:function(i){return!isNaN(parseFloat(i))&&isFinite(i)},flatten:function i(e){return e.reduce((t,r)=>t.concat(Array.isArray(r)?i(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(i)?i:[],r=Array.isArray(e)?e:[];return t.concat(r).reduce((n,s)=>(Ac(s,n)||n.push(s),n),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Bh,isValidUrl:Ic,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(i){return typeof i!="object"?i:JSON.stringify(i)}};function xc(i){return["true","TRUE","True","1"].includes(i)}function ib(i){if(i==null)return-1;if(Ie.isNumeric(i))return parseInt(i);const e=i.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let r=parseInt(t[0]);t.length===2&&(r+=parseFloat("0.".concat(t[1])));const n=parseInt(60*e[1]),s=parseInt(60*e[0]*60);return isNaN(s)||isNaN(n)||isNaN(r)||n>3600||r>60?-1:s+n+r}const j={childByName:function(i,e){return Array.from(i.childNodes).find(t=>t.nodeName===e)},childrenByName:function(i,e){return Array.from(i.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(i,e){if(!e)return i;if(i.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(i)}if(!i.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(i)}return i},parseBoolean:xc,parseNodeText:function(i){return i&&(i.textContent||i.text||"").trim()},copyNodeAttribute:function(i,e,t){const r=e.getAttribute(i);r&&t.setAttribute(i,r)},parseAttributes:function(i){return Array.from(i.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:ib,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>!parseInt(i.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>parseInt(i.sequence,10)).sort((i,e)=>i.sequence-e.sequence)},assignAttributes:function(i,e){i&&Array.from(i).forEach(t=>{let{nodeName:r,nodeValue:n}=t;if(r&&n&&e.hasOwnProperty(r)){let s=n;typeof e[r]=="boolean"&&(s=xc(s)),e[r]=s}})},mergeWrapperAdData:function(i,e){var t;i.errorURLTemplates=e.errorURLTemplates.concat(i.errorURLTemplates),i.impressionURLTemplates=e.impressionURLTemplates.concat(i.impressionURLTemplates),i.extensions=e.extensions.concat(i.extensions),e.viewableImpression.length>0&&(i.viewableImpression=[...i.viewableImpression,...e.viewableImpression]),i.followAdditionalWrappers=e.followAdditionalWrappers,i.allowMultipleAds=e.allowMultipleAds,i.fallbackOnNoAd=e.fallbackOnNoAd;const r=(e.creatives||[]).filter(l=>l&&l.type==="companion"),n=r.reduce((l,u)=>((u.variations||[]).forEach(p=>{(p.companionClickTrackingURLTemplates||[]).forEach(m=>{Ie.containsTemplateObject(m,l)||l.push(m)})}),l),[]);i.creatives=r.concat(i.creatives);const s=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(i.creatives.forEach(l=>{if(e.trackingEvents&&e.trackingEvents[l.type])for(const u in e.trackingEvents[l.type]){const p=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(p)}l.type==="linear"&&(s&&(l.videoClickTrackingURLTemplates=l.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(l.videoCustomClickURLTemplates=l.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||l.videoClickThroughURLTemplate!==null&&l.videoClickThroughURLTemplate!==void 0||(l.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),l.type==="companion"&&n.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=Ie.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,n)})}),e.adVerifications&&(i.adVerifications=i.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(i.blockedAdCategories=i.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const l=e.creatives.filter(u=>{var p;return((p=u.icons)===null||p===void 0?void 0:p.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function rb(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Sl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"companion",required:null,variations:[]}}(e);return t.required=i.getAttribute("required")||null,t.variations=j.childrenByName(i,"Companion").map(r=>{const n=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:l.id||null,adType:"companionAd",width:l.width||0,height:l.height||0,assetWidth:l.assetWidth||null,assetHeight:l.assetHeight||null,expandedWidth:l.expandedWidth||null,expandedHeight:l.expandedHeight||null,apiFramework:l.apiFramework||null,adSlotId:l.adSlotId||null,pxratio:l.pxratio||"1",renderingMode:l.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(j.parseAttributes(r));n.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat(p):l},[]),n.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const p=j.parseNodeText(u);return p?l.concat({url:p,creativeType:u.getAttribute("creativeType")||null}):l},[]),n.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const s=j.childByName(r,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(l=>{const u=l.getAttribute("event"),p=j.parseNodeText(l);u&&p&&(Array.isArray(n.trackingEvents[u])||(n.trackingEvents[u]=[]),n.trackingEvents[u].push(p))}),n.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),n.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(n.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),n}),t}function nb(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:p,adId:m,sequence:_,apiFramework:S}=Sl(u);return{id:p,adId:m,sequence:_,apiFramework:S,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);r.duration=j.parseDuration(j.parseNodeText(j.childByName(i,"Duration")));const n=i.getAttribute("skipoffset");if(n==null)r.skipDelay=null;else if(n.charAt(n.length-1)==="%"&&r.duration!==-1){const u=parseInt(n,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(n);const s=j.childByName(i,"VideoClicks");if(s){const u=j.childByName(s,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(s,"ClickTracking").forEach(p=>{r.videoClickTrackingURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})}),j.childrenByName(s,"CustomClick").forEach(p=>{r.videoCustomClickURLTemplates.push({id:p.getAttribute("id")||null,url:j.parseNodeText(p)})})}const a=j.childByName(i,"AdParameters");a&&(r.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),j.childrenByName(i,"TrackingEvents").forEach(u=>{j.childrenByName(u,"Tracking").forEach(p=>{let m=p.getAttribute("event");const _=j.parseNodeText(p);if(m&&_){if(m==="progress"){if(t=p.getAttribute("offset"),!t)return;m=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[m])||(r.trackingEvents[m]=[]),r.trackingEvents[m].push(_)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(w=>{r.mediaFiles.push(function(C){const v={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};v.id=C.getAttribute("id"),v.fileURL=j.parseNodeText(C),v.deliveryType=C.getAttribute("delivery"),v.codec=C.getAttribute("codec"),v.mimeType=C.getAttribute("type"),v.mediaType=C.getAttribute("mediaType")||"2D",v.apiFramework=C.getAttribute("apiFramework"),v.fileSize=parseInt(C.getAttribute("fileSize")||0),v.bitrate=parseInt(C.getAttribute("bitrate")||0),v.minBitrate=parseInt(C.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(C.getAttribute("maxBitrate")||0),v.width=parseInt(C.getAttribute("width")||0),v.height=parseInt(C.getAttribute("height")||0);const L=C.getAttribute("scalable");L&&typeof L=="string"&&(v.scalable=j.parseBoolean(L));const D=C.getAttribute("maintainAspectRatio");return D&&typeof D=="string"&&(v.maintainAspectRatio=j.parseBoolean(D)),v}(w))});const p=j.childByName(u,"InteractiveCreativeFile");p&&(r.interactiveCreativeFile=function(w){const C=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,apiFramework:v.apiFramework||null,variableDuration:j.parseBoolean(v.variableDuration),fileURL:null}}(j.parseAttributes(w));return C.fileURL=j.parseNodeText(w),C}(p));const m=j.childByName(u,"ClosedCaptionFiles");m&&j.childrenByName(m,"ClosedCaptionFile").forEach(w=>{const C=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,language:v.language||null,fileURL:null}}(j.parseAttributes(w));C.fileURL=j.parseNodeText(w),r.closedCaptionFiles.push(C)});const _=j.childByName(u,"Mezzanine"),S=function(w,C){const v={};let L=!1;return C.forEach(D=>{w&&w.getAttribute(D)?v[D]=w.getAttribute(D):L=!0}),L?null:v}(_,["delivery","type","width","height"]);if(S){const w={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};w.id=_.getAttribute("id"),w.fileURL=j.parseNodeText(_),w.delivery=S.delivery,w.codec=_.getAttribute("codec"),w.type=S.type,w.width=parseInt(S.width,10),w.height=parseInt(S.height,10),w.fileSize=parseInt(_.getAttribute("fileSize"),10),w.mediaType=_.getAttribute("mediaType")||"2D",r.mezzanine=w}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(p){const m={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[]};m.program=p.getAttribute("program"),m.height=parseInt(p.getAttribute("height")||0),m.width=parseInt(p.getAttribute("width")||0),m.xPosition=function(S){return["left","right"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("xPosition")),m.yPosition=function(S){return["top","bottom"].indexOf(S)!==-1?S:parseInt(S||0)}(p.getAttribute("yPosition")),m.apiFramework=p.getAttribute("apiFramework"),m.pxratio=p.getAttribute("pxratio")||"1",m.offset=j.parseDuration(p.getAttribute("offset")),m.duration=j.parseDuration(p.getAttribute("duration")),j.childrenByName(p,"HTMLResource").forEach(S=>{m.type=S.getAttribute("creativeType")||"text/html",m.htmlResource=j.parseNodeText(S)}),j.childrenByName(p,"IFrameResource").forEach(S=>{m.type=S.getAttribute("creativeType")||0,m.iframeResource=j.parseNodeText(S)}),j.childrenByName(p,"StaticResource").forEach(S=>{m.type=S.getAttribute("creativeType")||0,m.staticResource=j.parseNodeText(S)});const _=j.childByName(p,"IconClicks");if(_){m.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(_,"IconClickThrough")),j.childrenByName(_,"IconClickTracking").forEach(w=>{m.iconClickTrackingURLTemplates.push({id:w.getAttribute("id")||null,url:j.parseNodeText(w)})});const S=j.childByName(_,"IconClickFallbackImages");S&&j.childrenByName(S,"IconClickFallbackImage").forEach(w=>{m.iconClickFallbackImages.push({url:j.parseNodeText(w)||null,width:w.getAttribute("width")||null,height:w.getAttribute("height")||null})})}return m.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(p,"IconViewTracking")),m}(u))}),r}function sb(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:n,adId:s,sequence:a,apiFramework:l}=Sl(r);return{id:n,adId:s,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let n,s;j.childrenByName(r,"Tracking").forEach(a=>{n=a.getAttribute("event"),s=j.parseNodeText(a),n&&s&&(Array.isArray(t.trackingEvents[n])||(t.trackingEvents[n]=[]),t.trackingEvents[n].push(s))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const n={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};n.id=r.getAttribute("id")||null,n.width=r.getAttribute("width"),n.height=r.getAttribute("height"),n.expandedWidth=r.getAttribute("expandedWidth"),n.expandedHeight=r.getAttribute("expandedHeight"),n.scalable=j.parseBoolean(r.getAttribute("scalable")),n.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),n.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),n.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{n.type=a.getAttribute("creativeType")||"text/html",n.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{n.type=a.getAttribute("creativeType")||0,n.staticResource=j.parseNodeText(a)});const s=j.childByName(r,"AdParameters");s&&(n.adParameters={value:j.parseNodeText(s),xmlEncoded:s.getAttribute("xmlEncoded")||null}),n.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{n.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(n)}),t}function Lc(i){const e=[];return i.forEach(t=>{const r=Fh(t);r&&e.push(r)}),e}function Fh(i){if(i.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=i.attributes,r=i.childNodes;if(e.name=i.nodeName,i.attributes){for(const s in t)if(t.hasOwnProperty(s)){const a=t[s];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const s in r)if(r.hasOwnProperty(s)){const a=Fh(r[s]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const s=j.parseNodeText(i);s!==""&&(e.value=s),e.children=[]}return(n=e).value===null&&Object.keys(n.attributes).length===0&&n.children.length===0?null:e;var n}function ab(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const qs={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Dc(i,e){if(!qs[i.nodeName]||!qs[i.nodeName].attributes)return;const t=qs[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&$n({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Pc(i,e,t){const r=qs[i.nodeName],n=!t&&i.nodeName!=="Wrapper";if(!(!r||n)){if(r.subElements){const s=r.subElements.filter(a=>!j.childByName(i,a));s.length>0&&$n({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:s},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(s=>j.childByName(i,s))||$n({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Rc(i){return i.children&&i.children.length!==0}function $n(i,e){let{name:t,parentName:r,attributes:n,subElements:s,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=n?" missing required attribute(s) '".concat(n.join(", "),"' "):s?" missing required sub element(s) '".concat(s.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const ob={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),Dc(e,t),Rc(e)){Pc(e,t,r);for(let n=0;n<e.children.length;n++)i(e.children[n],t,r)}else j.parseNodeText(e).length===0&&$n({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Rc,emitMissingValueWarning:$n,verifyRequiredAttributes:Dc,verifyRequiredSubElements:Pc};function lb(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=Array.from(i.childNodes).filter(s=>{const a=s.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const s of n){if(j.copyNodeAttribute("id",i,s),j.copyNodeAttribute("sequence",i,s),j.copyNodeAttribute("adType",i,s),s.nodeName==="Wrapper")return{ad:cb(s,e),type:"WRAPPER"};if(s.nodeName==="InLine")return{ad:ub(s,e,{allowMultipleAds:t}),type:"INLINE"};const a=s.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(s.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:s})}}function ub(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:jh(i,e)}function jh(i,e){let t=[];e&&ob.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),n=function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,sequence:s.sequence||null,adType:s.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(j.parseAttributes(i));return r.forEach(s=>{switch(s.nodeName){case"Error":n.errorURLTemplates.push(j.parseNodeText(s));break;case"Impression":n.impressionURLTemplates.push({id:s.getAttribute("id")||null,url:j.parseNodeText(s)});break;case"Creatives":n.creatives=function(a){const l=[];return a.forEach(u=>{const p={id:u.getAttribute("id")||null,adId:ab(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},m=[];let _;j.childrenByName(u,"UniversalAdId").forEach(w=>{const C={idRegistry:w.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(w)};m.push(C)});const S=j.childByName(u,"CreativeExtensions");S&&(_=Lc(j.childrenByName(S,"CreativeExtension")));for(const w in u.childNodes){const C=u.childNodes[w];let v;switch(C.nodeName){case"Linear":v=nb(C,p);break;case"NonLinearAds":v=sb(C,p);break;case"CompanionAds":v=rb(C,p)}v&&(m&&(v.universalAdIds=m),_&&(v.creativeExtensions=_),l.push(v))}}),l}(j.childrenByName(s,"Creative"));break;case"Extensions":{const a=j.childrenByName(s,"Extension");n.extensions=Lc(a),n.adVerifications.length||(t=function(l){let u=null,p=[];return l.some(m=>u=j.childByName(m,"AdVerifications")),u&&(p=Nc(j.childrenByName(u,"Verification"))),p}(a));break}case"AdVerifications":n.adVerifications=Nc(j.childrenByName(s,"Verification"));break;case"AdSystem":n.system={value:j.parseNodeText(s),version:s.getAttribute("version")||null};break;case"AdTitle":n.title=j.parseNodeText(s);break;case"AdServingId":n.adServingId=j.parseNodeText(s);break;case"Category":n.categories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)});break;case"Expires":n.expires=parseInt(j.parseNodeText(s),10);break;case"ViewableImpression":n.viewableImpression.push(function(a){const l=(u,p)=>{const m=j.parseNodeText(p);return m&&u.push(m),u};return{id:a.getAttribute("id")||null,viewable:j.childrenByName(a,"Viewable").reduce(l,[]),notViewable:j.childrenByName(a,"NotViewable").reduce(l,[]),viewUndetermined:j.childrenByName(a,"ViewUndetermined").reduce(l,[])}}(s));break;case"Description":n.description=j.parseNodeText(s);break;case"Advertiser":n.advertiser={id:s.getAttribute("id")||null,value:j.parseNodeText(s)};break;case"Pricing":n.pricing={value:j.parseNodeText(s),model:s.getAttribute("model")||null,currency:s.getAttribute("currency")||null};break;case"Survey":n.survey={value:j.parseNodeText(s),type:s.getAttribute("type")||null};break;case"BlockedAdCategories":n.blockedAdCategories.push({authority:s.getAttribute("authority")||null,value:j.parseNodeText(s)})}}),t.length&&(n.adVerifications=n.adVerifications.concat(t)),n}function cb(i,e){const t=jh(i,e),r=i.getAttribute("followAdditionalWrappers"),n=i.getAttribute("allowMultipleAds"),s=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!n&&j.parseBoolean(n),t.fallbackOnNoAd=s?j.parseBoolean(s):null;let a=j.childByName(i,"VASTAdTagURI");if(a?t.nextWrapperURL=j.parseNodeText(a):(a=j.childByName(i,"VASTAdTagURL"),a&&(t.nextWrapperURL=j.parseNodeText(j.childByName(a,"URL")))),t.creatives.forEach(l=>{if(["linear","nonlinear"].includes(l.type)){if(l.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[l.type]||(t.trackingEvents[l.type]={});for(const u in l.trackingEvents){const p=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),p.forEach(m=>{t.trackingEvents[l.type][u].push(m)})}}l.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),l.videoClickTrackingURLTemplates.forEach(u=>{t.videoClickTrackingURLTemplates.push(u)})),l.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=l.videoClickThroughURLTemplate),l.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),l.videoCustomClickURLTemplates.forEach(u=>{t.videoCustomClickURLTemplates.push(u)}))}}),t.nextWrapperURL)return t}function Nc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},n=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),n.forEach(a=>{let{nodeName:l,textContent:u,attributes:p}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(p,r);break;case"VerificationParameters":r.parameters=u.trim()}});const s=j.childByName(t,"TrackingEvents");s&&j.childrenByName(s,"Tracking").forEach(a=>{const l=a.getAttribute("event"),u=j.parseNodeText(a);l&&u&&(Array.isArray(r.trackingEvents[l])||(r.trackingEvents[l]=[]),r.trackingEvents[l].push(u))}),e.push(r)}),e}let $h=class{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(r,n,s){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(n,a.wrapFn),a.fired=!0,s.bind(r)(...arguments))}return a.wrapFn=l,l}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];let s=!1;return this._handlers.forEach(a=>{a.event==="*"&&(s=!0,a.handler(e,...r)),a.event===e&&(s=!0,a.handler(...r))}),s}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}},Oc=0,Vo=0;const qh=(i,e)=>{!i||!e||i<=0||e<=0||(Vo=(Vo*Oc+8*i/e)/++Oc)},db={ERRORCODE:900,extensions:[]},Uc="VAST response version not supported";let hb=class extends $h{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];this.emit("VAST-error",Object.assign({},db,t,...n)),Ie.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Vo}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),qh(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(r=>this.buildVASTResponse(r))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(r=>this.buildVASTResponse(r))}buildVASTResponse(e){const t=function(r){let{ads:n,errorURLTemplates:s,version:a}=r;return{ads:n||[],errorURLTemplates:s||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:n=null,wrapperDepth:s=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:n,wrapperDepth:s});const S=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(S?Uc:"Invalid VAST XMLDocument")}const p=[],m=e.documentElement.childNodes,_=e.documentElement.getAttribute("version");r&&_&&(this.vastVersion=_);for(const S in m){const w=m[S];if(w.nodeName==="Error"){const C=j.parseNodeText(w);r?this.rootErrorURLTemplates.push(C):this.errorURLTemplates.push(C)}else if(w.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&p.length>1)break;const C=lb(w,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});C.ad?(p.push(C.ad),this.emit("VAST-ad-parsed",{type:C.type,url:n,wrapperDepth:s,adIndex:p.length-1,vastVersion:_})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return p}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:n=null,previousUrl:s=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:p}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(p=!0);try{m=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:p,followAdditionalWrappers:u})}catch(_){return Promise.reject(_)}if(m.length===1&&n!=null&&(m[0].sequence=n),r===!1){const _=j.getSortedAdPods(m),S=j.getStandAloneAds(m);_.length?m=_:S.length&&(m=[S.shift()]),this.remainingAds=S}return this.resolveAds(m,{wrapperDepth:a,previousUrl:s,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:n}=arguments.length>1?arguments[1]:void 0;const s=[];return r=n,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);s.push(l)}),Promise.all(s).then(a=>Ie.flatten(a))}resolveWrappers(e,t,r){const n={...e};return new Promise(s=>{var a;if(t++,!n.nextWrapperURL)return delete n.nextWrapperURL,s(n);if(!this.fetcher)return n.VASTAdTagURI=n.nextWrapperURL,delete n.nextWrapperURL,s(n);if(t>=this.maxWrapperDepth)return n.errorCode=302,delete n.nextWrapperURL,s(n);n.nextWrapperURL=j.resolveVastAdTagURI(n.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:n.allowMultipleAds,u=n.sequence;this.fetcher.fetchVAST({url:n.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(p=>this.parse(p,{url:n.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:n.followAdditionalWrappers,allowMultipleAds:l}).then(m=>{if(delete n.nextWrapperURL,m.length===0)return n.creatives=[],s(n);m.forEach(_=>{_&&j.mergeWrapperAdData(_,n)}),s(m)})).catch(p=>{n.errorCode=p.message===Uc?102:301,n.errorMessage=p.message,s(n)})})}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const r=e.ads[t],n=!r.creatives.some(s=>{var a;return((a=s.mediaFiles)===null||a===void 0?void 0:a.length)>0});!r.errorCode&&!n||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),e.ads.splice(t,1))}}},mi=null;const pb={data:{},length:0,getItem(i){return this.data[i]},setItem(i,e){this.data[i]=e,this.length=Object.keys(this.data).length},removeItem(i){delete this.data[i],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class mb{constructor(){this.storage=this.initStorage()}initStorage(){if(mi)return mi;try{mi=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{mi=null}return mi&&!this.isStorageDisabled(mi)||(mi=pb,mi.clear()),mi}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const Ho=12e4,gb={get:async function(i,e){try{const t=new AbortController,r=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||Ho," ms (408)"))},e.timeout||Ho),n=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),s=function(a){return Ie.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")}(n);return s?{error:new Error(s),statusCode:n.status}:async function(a){const l=await a.text();let u;return u=Ie.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>iv).then(p=>p.i)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(n)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let fb=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||gb,this.fetchingOptions={timeout:e.timeout||Ho,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:r,maxWrapperDepth:n,emitter:s,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const p=Date.now();this.URLTemplateFilters.forEach(S=>{r=S(r)}),s("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:n,timeout:this.fetchingOptions.timeout,wrapperAd:u});const m=await this.urlHandler.get(r,this.fetchingOptions),_=Math.round(Date.now()-p);if(s("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(m==null?void 0:m.error)||null,duration:_,statusCode:(m==null?void 0:m.statusCode)||null,...m==null?void 0:m.details}),qh(m==null||(t=m.details)===null||t===void 0?void 0:t.byteLength,_),m.error)throw new Error(m.error);return m.xml}},yb=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new mb;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new fb,this.vastParser=new hb({fetcher:this.fetcher}),this.storage=r,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((n,s)=>{if(this.cappingFreeLunch>=this.totalCalls)return s(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return s(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(l=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(l,t).then(u=>{const p=this.vastParser.buildVASTResponse(u);n(p)}))).catch(l=>s(l))})}},_b=class extends $h{constructor(e,t,r){let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,s=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=s,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const l=this.creative.trackingEvents[a];this.trackingEvents[a]=l.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ie.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ie.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});const n=this.skipDelay||-1;if(n===-1||this.skippable||(n>e?this.emit("skip-countdown",n-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const s=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<s;l++)a.push("progress-".concat(l+1,"%"));a.push("progress-".concat(e));for(const l in this.quartiles)this.isQuartileReached(l,this.quartiles[l],e)&&(a.push(l),this._alreadyTriggeredQuartiles[l]=!0);this.lastPercentage=s}a.forEach(l=>{this.track(l,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let n=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(n=!0),n}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setSkipDelay(e){Ie.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ie.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const r=this.ad.adVerifications.find(s=>s.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const n=r.trackingEvents;if(n&&n.verificationNotExecuted){const s=n.verificationNotExecuted;this.trackURLs(s,t),this.emit("verificationNotExecuted",{trackingURLTemplates:s})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,n={...t};if(r){this.progress&&(n.ADPLAYHEAD=this.progressFormatted());const s=Ie.resolveURLTemplates([r],n)[0];this.emit("clickthrough",s)}}trackProgressEvents(e,t,r){const n=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(s=>{let[a]=s;return a.startsWith("progress-")}).map(s=>{let[a,l]=s;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(s=>{let{time:a}=s;return a<=n&&a>this.progress}).forEach(s=>{let{name:a,urls:l}=s;!r&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:l}),this.trackURLs(l,t),r?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:r=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,r);const n=this.trackingEvents[e],s=this.emitAlwaysEvents.indexOf(e)>-1;n?(this.emit(e,{trackingURLTemplates:n}),this.trackURLs(n,t)):s&&this.emit(e,null),r&&(delete this.trackingEvents[e],s&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:s,invalidUrls:a}=Ie.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const l={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(l.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(l.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(l.UNIVERSALADID=this.creative.universalAdIds.map(u=>u.idRegistry.concat(" ",u.value)).join(",")),this.ad&&(this.ad.sequence&&(l.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(l.ADTYPE=this.ad.adType),this.ad.adServingId&&(l.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(l.ADCATEGORIES=this.ad.categories.map(u=>u.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(l.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(u=>u.value).join(","))),Ie.track(s,l,n)}convertToTimecode(e){if(!Ie.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),n=Math.floor(t/6e4%60),s=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ie.addLeadingZeros(r,2),":").concat(Ie.addLeadingZeros(n,2),":").concat(Ie.addLeadingZeros(s,2),".").concat(Ie.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}},bb=class{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdTagURI":this.adTagURI={templateType:r.getAttribute("templateType"),uri:(r.textContent||r.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=r.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=r;break}}}};function Vh(i,e){const t=[];for(const r in i.childNodes){const n=i.childNodes[r];(n.nodeName===e||e===`vmap:${n.nodeName}`||n.nodeName===`vmap:${e}`)&&t.push(n)}return t}function vb(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const n in e){const s=e[n];s.nodeName==="#cdata-section"&&t.push(s)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const n in e){const s=e[n];switch(s.nodeName){case"#text":r+=s.textContent.trim();break;case"#cdata-section":r+=s.data;break}}return r}function El(i){const e={attributes:{},children:{},value:{}};e.value=vb(i);const t=i.attributes;if(t)for(const n in t){const s=t[n];s.nodeName&&s.nodeValue!==void 0&&s.nodeValue!==null&&(e.attributes[s.nodeName]=s.nodeValue)}const r=i.childNodes;if(r)for(const n in r){const s=r[n];s.nodeName&&s.nodeName.substring(0,1)!=="#"&&(e.children[s.nodeName]=El(s))}return e}let Tb=class{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdSource":this.adSource=new bb(r);break;case"TrackingEvents":for(const n in r.childNodes){const s=r.childNodes[n];s.localName==="Tracking"&&this.trackingEvents.push({event:s.getAttribute("event"),uri:(s.textContent||s.text||"").trim()})}break;case"Extensions":this.extensions=Vh(r,"Extension").map(n=>El(n));break}}}track(e,t){for(const r in this.trackingEvents){const n=this.trackingEvents[r];if(n.event===e){let{uri:s}=n;n.event==="error"&&(s=s.replace("[ERRORCODE]",t)),this.tracker(s)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}};class Sb{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const r=e.documentElement.childNodes[t];switch(r.localName){case"AdBreak":this.adBreaks.push(new Tb(r));break;case"Extensions":this.extensions=Vh(r,"Extension").map(n=>El(n));break}}}}const Eb=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const n=new t.NonceLoader(r);return async()=>{try{const s=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||ce.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=ce.v4(),sessionStorage.setItem("sl-ad-session-id",u)),bh(l)||(l=Ws(`https://${l}`,Ws.URL)),s.searchParams.get("url")||s.searchParams.set("url","https://streamlayer.io"),s.searchParams.get("description_url")||s.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=s.searchParams.get("vpa")==="auto",a.adWillPlayMuted=s.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=s.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const p=await n.loadNonceManager(a);return s.searchParams.get("is_lat")==="[placeholder]"&&s.searchParams.set("is_lat","1"),s.searchParams.get("rdid")==="[placeholder]"&&s.searchParams.set("rdid",l),s.searchParams.get("correlator")==="[placeholder]"&&s.searchParams.set("correlator",u),s.searchParams.set("wta","1"),s.searchParams.set("givn",p.getNonce()),s}catch(s){console.log("AdsManager could not be started",s);return}}},wb=new yb,kb=i=>i.creatives.find(e=>e.mediaFiles),Cb=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(r=>r.fileURL))==null?void 0:e.fileURL)||""},Mc=G.a$1({ads:[],autoplay:!0,muted:!1}),Ib=(i,e)=>{const[t,r]=Me.useState(),n=Me.useRef(Date.now()),s=Me.useRef(Date.now());return Me.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=Eb(i.current,e),l=Date.now();n.current=l,a().then(u=>{n.current===l&&r(u)}).catch(u=>{console.error(u)})},[i,e]),Me.useEffect(()=>{const a=async(l,u)=>{let p=[];if(l.searchParams.get("output")==="vmap"){const w=await fetch(l.toString()),C=new DOMParser,v=await w.text(),L=C.parseFromString(v,"text/xml");p=new Sb(L).adBreaks.map(D=>D.adSource.adTagURI.uri)}else p=[l.toString()];const m=await Promise.all(p.map((w,C)=>wb.get(w).then(v=>{if(s.current===u){const L=v.ads.find(U=>U.creatives.length>0);if(!L)return;const D=kb(L),O=Cb(D);return{creative:D,order:C,mediaFileUrl:O,ad:L,raw:v}}}))),_=l.searchParams.get("vpa")!=="click",S=l.searchParams.get("vpmute")==="1";Mc.set({ads:m.filter(w=>!!w),autoplay:_,muted:S})};if(t){const l=Date.now();s.current=l,a(t,l)}return()=>{s.current=0}},[t]),Mc};var ji={},Ei={};function Ab(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Object.prototype.hasOwnProperty.call(i,r)){var n=i[r];if(e.call(void 0,n,r,i))return n}}function wl(i,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(i):i}function xb(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i}var Hh=wl({HTML:"text/html",isHTML:function(i){return i===Hh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),zh=wl({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===zh.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ei.assign=xb;Ei.find=Ab;Ei.freeze=wl;Ei.MIME_TYPE=Hh;Ei.NAMESPACE=zh;var Wh=Ei,oi=Wh.find,qn=Wh.NAMESPACE;function Lb(i){return i!==""}function Db(i){return i?i.split(/[\t\n\f\r ]+/).filter(Lb):[]}function Pb(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Bc(i){if(!i)return[];var e=Db(i);return Object.keys(e.reduce(Pb,{}))}function Rb(i){return function(e){return i&&i.indexOf(e)!==-1}}function Kn(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function Et(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Kn(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var wt={},zt=wt.ELEMENT_NODE=1,Ur=wt.ATTRIBUTE_NODE=2,Gs=wt.TEXT_NODE=3,Gh=wt.CDATA_SECTION_NODE=4,Xh=wt.ENTITY_REFERENCE_NODE=5,Nb=wt.ENTITY_NODE=6,Kh=wt.PROCESSING_INSTRUCTION_NODE=7,Yh=wt.COMMENT_NODE=8,Qh=wt.DOCUMENT_NODE=9,Jh=wt.DOCUMENT_TYPE_NODE=10,bi=wt.DOCUMENT_FRAGMENT_NODE=11,Ob=wt.NOTATION_NODE=12,ot={},et={};ot.INDEX_SIZE_ERR=(et[1]="Index size error",1);ot.DOMSTRING_SIZE_ERR=(et[2]="DOMString size error",2);var bt=ot.HIERARCHY_REQUEST_ERR=(et[3]="Hierarchy request error",3);ot.WRONG_DOCUMENT_ERR=(et[4]="Wrong document",4);ot.INVALID_CHARACTER_ERR=(et[5]="Invalid character",5);ot.NO_DATA_ALLOWED_ERR=(et[6]="No data allowed",6);ot.NO_MODIFICATION_ALLOWED_ERR=(et[7]="No modification allowed",7);var Zh=ot.NOT_FOUND_ERR=(et[8]="Not found",8);ot.NOT_SUPPORTED_ERR=(et[9]="Not supported",9);var Fc=ot.INUSE_ATTRIBUTE_ERR=(et[10]="Attribute in use",10);ot.INVALID_STATE_ERR=(et[11]="Invalid state",11);ot.SYNTAX_ERR=(et[12]="Syntax error",12);ot.INVALID_MODIFICATION_ERR=(et[13]="Invalid modification",13);ot.NAMESPACE_ERR=(et[14]="Invalid namespace",14);ot.INVALID_ACCESS_ERR=(et[15]="Invalid access",15);function We(i,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,et[i]),this.message=et[i],Error.captureStackTrace&&Error.captureStackTrace(this,We);return t.code=i,e&&(this.message=this.message+": "+e),t}We.prototype=Error.prototype;Kn(ot,We);function yi(){}yi.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i,e){for(var t=[],r=0;r<this.length;r++)wr(this[r],t,i,e);return t.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};function Mr(i,e){this._node=i,this._refresh=e,kl(this)}function kl(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(dp(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Object.prototype.hasOwnProperty.call(i,r)&&delete i[r];Kn(t,i),i._inc=e}}Mr.prototype.item=function(i){return kl(this),this[i]||null};Et(Mr,yi);function Xs(){}function ep(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function jc(i,e,t,r){if(r?e[ep(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&rp(n,i,r),Ub(n,i,t))}}function $c(i,e,t){var r=ep(e,t);if(r>=0){for(var n=e.length-1;r<n;)e[r]=e[++r];if(e.length=n,i){var s=i.ownerDocument;s&&(rp(s,i,t),t.ownerElement=null)}}else throw new We(Zh,new Error(i.tagName+"@"+t))}Xs.prototype={length:0,item:yi.prototype.item,getNamedItem:function(i){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==i)return t}},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!=this._ownerElement)throw new We(Fc);var t=this.getNamedItem(i.nodeName);return jc(this._ownerElement,this,i,t),t},setNamedItemNS:function(i){var e=i.ownerElement,t;if(e&&e!=this._ownerElement)throw new We(Fc);return t=this.getNamedItemNS(i.namespaceURI,i.localName),jc(this._ownerElement,this,i,t),t},removeNamedItem:function(i){var e=this.getNamedItem(i);return $c(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);return $c(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){for(var t=this.length;t--;){var r=this[t];if(r.localName==e&&r.namespaceURI==i)return r}return null}};function tp(){}tp.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=new Yn;if(r.implementation=this,r.childNodes=new yi,r.doctype=t||null,t&&r.appendChild(t),e){var n=r.createElementNS(i,e);r.appendChild(n)}return r},createDocumentType:function(i,e,t){var r=new Ea;return r.name=i,r.nodeName=i,r.publicId=e||"",r.systemId=t||"",r}};function Se(){}Se.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(i,e){return Ks(this,i,e)},replaceChild:function(i,e){Ks(this,i,e,sp),e&&this.removeChild(e)},removeChild:function(i){return np(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return zo(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==Gs&&i.nodeType==Gs?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r]===i)return r}e=e.nodeType==Ur?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==Ur?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function ip(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Kn(wt,Se);Kn(wt,Se.prototype);function Vn(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Vn(i,e))return!0;while(i=i.nextSibling)}function Yn(){this.ownerDocument=this}function Ub(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===qn.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function rp(i,e,t,r){i&&i._inc++;var n=t.namespaceURI;n===qn.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Cl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var n=e.firstChild,s=0;n;)r[s++]=n,n=n.nextSibling;r.length=s,delete r[r.length]}}}function np(i,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Cl(i.ownerDocument,i),e}function Mb(i){return i&&(i.nodeType===Se.DOCUMENT_NODE||i.nodeType===Se.DOCUMENT_FRAGMENT_NODE||i.nodeType===Se.ELEMENT_NODE)}function Bb(i){return i&&(li(i)||Il(i)||vi(i)||i.nodeType===Se.DOCUMENT_FRAGMENT_NODE||i.nodeType===Se.COMMENT_NODE||i.nodeType===Se.PROCESSING_INSTRUCTION_NODE)}function vi(i){return i&&i.nodeType===Se.DOCUMENT_TYPE_NODE}function li(i){return i&&i.nodeType===Se.ELEMENT_NODE}function Il(i){return i&&i.nodeType===Se.TEXT_NODE}function qc(i,e){var t=i.childNodes||[];if(oi(t,li)||vi(e))return!1;var r=oi(t,vi);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Vc(i,e){var t=i.childNodes||[];function r(s){return li(s)&&s!==e}if(oi(t,r))return!1;var n=oi(t,vi);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function Fb(i,e,t){if(!Mb(i))throw new We(bt,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new We(Zh,"child not in parent");if(!Bb(e)||vi(e)&&i.nodeType!==Se.DOCUMENT_NODE)throw new We(bt,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function jb(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var s=n.filter(li);if(s.length>1||oi(n,Il))throw new We(bt,"More than one element or text in fragment");if(s.length===1&&!qc(i,t))throw new We(bt,"Element in fragment can not be inserted before doctype")}if(li(e)&&!qc(i,t))throw new We(bt,"Only one element can be added and only after doctype");if(vi(e)){if(oi(r,vi))throw new We(bt,"Only one doctype is allowed");var a=oi(r,li);if(t&&r.indexOf(a)<r.indexOf(t))throw new We(bt,"Doctype can only be inserted before an element");if(!t&&a)throw new We(bt,"Doctype can not be appended since element is present")}}function sp(i,e,t){var r=i.childNodes||[],n=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var s=n.filter(li);if(s.length>1||oi(n,Il))throw new We(bt,"More than one element or text in fragment");if(s.length===1&&!Vc(i,t))throw new We(bt,"Element in fragment can not be inserted before doctype")}if(li(e)&&!Vc(i,t))throw new We(bt,"Only one element can be added and only after doctype");if(vi(e)){if(oi(r,function(l){return vi(l)&&l!==t}))throw new We(bt,"Only one doctype is allowed");var a=oi(r,li);if(t&&r.indexOf(a)<r.indexOf(t))throw new We(bt,"Doctype can only be inserted before an element")}}function Ks(i,e,t,r){Fb(i,e,t),i.nodeType===Se.DOCUMENT_NODE&&(r||jb)(i,e,t);var n=e.parentNode;if(n&&n.removeChild(e),e.nodeType===bi){var s=e.firstChild;if(s==null)return e;var a=e.lastChild}else s=a=e;var l=t?t.previousSibling:i.lastChild;s.previousSibling=l,a.nextSibling=t,l?l.nextSibling=s:i.firstChild=s,t==null?i.lastChild=a:t.previousSibling=a;do s.parentNode=i;while(s!==a&&(s=s.nextSibling));return Cl(i.ownerDocument||i,i),e.nodeType==bi&&(e.firstChild=e.lastChild=null),e}function $b(i,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=i,e.previousSibling=i.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:i.firstChild=e,i.lastChild=e,Cl(i.ownerDocument,i,e),e}Yn.prototype={nodeName:"#document",nodeType:Qh,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==bi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return Ks(this,i,e),i.ownerDocument=this,this.documentElement===null&&i.nodeType===zt&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),np(this,i)},replaceChild:function(i,e){Ks(this,i,e,sp),i.ownerDocument=this,e&&this.removeChild(e),li(i)&&(this.documentElement=i)},importNode:function(i,e){return cp(this,i,e)},getElementById:function(i){var e=null;return Vn(this.documentElement,function(t){if(t.nodeType==zt&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Bc(i);return new Mr(this,function(t){var r=[];return e.length>0&&Vn(t.documentElement,function(n){if(n!==t&&n.nodeType===zt){var s=n.getAttribute("class");if(s){var a=i===s;if(!a){var l=Bc(s);a=e.every(Rb(l))}a&&r.push(n)}}}),r})},createElement:function(i){var e=new or;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new yi;var t=e.attributes=new Xs;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new wa;return i.ownerDocument=this,i.childNodes=new yi,i},createTextNode:function(i){var e=new Al;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new xl;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Ll;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Pl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new Ys;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new Dl;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new or,r=e.split(":"),n=t.attributes=new Xs;return t.childNodes=new yi,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,n._ownerElement=t,t},createAttributeNS:function(i,e){var t=new Ys,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};Et(Yn,Se);function or(){this._nsMap={}}or.prototype={nodeType:zt,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===bi?this.insertBefore(i,null):$b(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var r=this.ownerDocument.createAttributeNS(i,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new Mr(this,function(e){var t=[];return Vn(e,function(r){r!==e&&r.nodeType==zt&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new Mr(this,function(t){var r=[];return Vn(t,function(n){n!==t&&n.nodeType===zt&&(i==="*"||n.namespaceURI===i)&&(e==="*"||n.localName==e)&&r.push(n)}),r})}};Yn.prototype.getElementsByTagName=or.prototype.getElementsByTagName;Yn.prototype.getElementsByTagNameNS=or.prototype.getElementsByTagNameNS;Et(or,Se);function Ys(){}Ys.prototype.nodeType=Ur;Et(Ys,Se);function Qn(){}Qn.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(et[bt])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),n=this.data.substring(i+e);t=r+t+n,this.nodeValue=this.data=t,this.length=t.length}};Et(Qn,Se);function Al(){}Al.prototype={nodeName:"#text",nodeType:Gs,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Et(Al,Qn);function xl(){}xl.prototype={nodeName:"#comment",nodeType:Yh};Et(xl,Qn);function Ll(){}Ll.prototype={nodeName:"#cdata-section",nodeType:Gh};Et(Ll,Qn);function Ea(){}Ea.prototype.nodeType=Jh;Et(Ea,Se);function ap(){}ap.prototype.nodeType=Ob;Et(ap,Se);function op(){}op.prototype.nodeType=Nb;Et(op,Se);function Dl(){}Dl.prototype.nodeType=Xh;Et(Dl,Se);function wa(){}wa.prototype.nodeName="#document-fragment";wa.prototype.nodeType=bi;Et(wa,Se);function Pl(){}Pl.prototype.nodeType=Kh;Et(Pl,Se);function lp(){}lp.prototype.serializeToString=function(i,e,t){return up.call(i,e,t)};Se.prototype.toString=up;function up(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,n=r.prefix,s=r.namespaceURI;if(s&&n==null){var n=r.lookupPrefix(s);if(n==null)var a=[{namespace:s,prefix:null}]}return wr(this,t,i,e,a),t.join("")}function Hc(i,e,t){var r=i.prefix||"",n=i.namespaceURI;if(!n||r==="xml"&&n===qn.XML||n===qn.XMLNS)return!1;for(var s=t.length;s--;){var a=t[s];if(a.prefix===r)return a.namespace!==n}return!0}function vo(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,ip),'"')}function wr(i,e,t,r,n){if(n||(n=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case zt:var s=i.attributes,a=s.length,l=i.firstChild,u=i.tagName;t=qn.isHTML(i.namespaceURI)||t;var p=u;if(!t&&!i.prefix&&i.namespaceURI){for(var m,_=0;_<s.length;_++)if(s.item(_).name==="xmlns"){m=s.item(_).value;break}if(!m)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.prefix===""&&w.namespace===i.namespaceURI){m=w.namespace;break}}if(m!==i.namespaceURI)for(var S=n.length-1;S>=0;S--){var w=n[S];if(w.namespace===i.namespaceURI){w.prefix&&(p=w.prefix+":"+u);break}}}e.push("<",p);for(var C=0;C<a;C++){var v=s.item(C);v.prefix=="xmlns"?n.push({prefix:v.localName,namespace:v.value}):v.nodeName=="xmlns"&&n.push({prefix:"",namespace:v.value})}for(var C=0;C<a;C++){var v=s.item(C);if(Hc(v,t,n)){var L=v.prefix||"",D=v.namespaceURI;vo(e,L?"xmlns:"+L:"xmlns",D),n.push({prefix:L,namespace:D})}wr(v,e,t,r,n)}if(u===p&&Hc(i,t,n)){var L=i.prefix||"",D=i.namespaceURI;vo(e,L?"xmlns:"+L:"xmlns",D),n.push({prefix:L,namespace:D})}if(l||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(e.push(">"),t&&/^script$/i.test(u))for(;l;)l.data?e.push(l.data):wr(l,e,t,r,n.slice()),l=l.nextSibling;else for(;l;)wr(l,e,t,r,n.slice()),l=l.nextSibling;e.push("</",p,">")}else e.push("/>");return;case Qh:case bi:for(var l=i.firstChild;l;)wr(l,e,t,r,n.slice()),l=l.nextSibling;return;case Ur:return vo(e,i.name,i.value);case Gs:return e.push(i.data.replace(/[<&>]/g,ip));case Gh:return e.push("<![CDATA[",i.data,"]]>");case Yh:return e.push("<!--",i.data,"-->");case Jh:var O=i.publicId,U=i.systemId;if(e.push("<!DOCTYPE ",i.name),O)e.push(" PUBLIC ",O),U&&U!="."&&e.push(" ",U),e.push(">");else if(U&&U!=".")e.push(" SYSTEM ",U,">");else{var F=i.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case Kh:return e.push("<?",i.target," ",i.data,"?>");case Xh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function cp(i,e,t){var r;switch(e.nodeType){case zt:r=e.cloneNode(!1),r.ownerDocument=i;case bi:break;case Ur:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var n=e.firstChild;n;)r.appendChild(cp(i,n,t)),n=n.nextSibling;return r}function zo(i,e,t){var r=new e.constructor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var s=e[n];typeof s!="object"&&s!=r[n]&&(r[n]=s)}switch(e.childNodes&&(r.childNodes=new yi),r.ownerDocument=i,r.nodeType){case zt:var a=e.attributes,l=r.attributes=new Xs,u=a.length;l._ownerElement=r;for(var p=0;p<u;p++)r.setAttributeNode(zo(i,a.item(p),!0));break;case Ur:t=!0}if(t)for(var m=e.firstChild;m;)r.appendChild(zo(i,m,t)),m=m.nextSibling;return r}function dp(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case zt:case bi:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Mr.prototype,"length",{get:function(){return kl(this),this.$$length}}),Object.defineProperty(Se.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case zt:case bi:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),dp=function(e,t,r){e["$$"+t]=r}}}catch{}ji.DocumentType=Ea;ji.DOMException=We;ji.DOMImplementation=tp;ji.Element=or;ji.Node=Se;ji.NodeList=yi;ji.XMLSerializer=lp;var ka={},hp={};(function(i){var e=Ei.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
2
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),i.entityMap=i.HTML_ENTITIES})(hp);var Rl={},Hn=Ei.NAMESPACE,Wo=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,zc=new RegExp("[\\-\\.0-9"+Wo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Wc=new RegExp("^"+Wo.source+zc.source+"*(?::"+Wo.source+zc.source+"*)?$"),Tn=0,Di=1,fr=2,Sn=3,yr=4,_r=5,En=6,Ns=7;function Br(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Br)}Br.prototype=new Error;Br.prototype.name=Br.name;function pp(){}pp.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),mp(e,e={}),qb(i,e,t,r,this.errorHandler),r.endDocument()}};function qb(i,e,t,r,n){function s(de){if(de>65535){de-=65536;var be=55296+(de>>10),je=56320+(de&1023);return String.fromCharCode(be,je)}else return String.fromCharCode(de)}function a(de){var be=de.slice(1,-1);return Object.hasOwnProperty.call(t,be)?t[be]:be.charAt(0)==="#"?s(parseInt(be.substr(1).replace("x","0x"))):(n.error("entity not found:"+de),de)}function l(de){if(de>v){var be=i.substring(v,de).replace(/&#?\w+;/g,a);S&&u(v),r.characters(be,0,de-v),v=de}}function u(de,be){for(;de>=m&&(be=_.exec(i));)p=be.index,m=p+be[0].length,S.lineNumber++;S.columnNumber=de-p+1}for(var p=0,m=0,_=/.*(?:\r\n?|\n)|.*$/g,S=r.locator,w=[{currentNSMap:e}],C={},v=0;;){try{var L=i.indexOf("<",v);if(L<0){if(!i.substr(v).match(/^\s*$/)){var D=r.doc,O=D.createTextNode(i.substr(v));D.appendChild(O),r.currentElement=O}return}switch(L>v&&l(L),i.charAt(L+1)){case"/":var oe=i.indexOf(">",L+3),U=i.substring(L+2,oe).replace(/[ \t\n\r]+$/g,""),F=w.pop();oe<0?(U=i.substring(L+2).replace(/[\s<].*/,""),n.error("end tag name: "+U+" is not complete:"+F.tagName),oe=L+1+U.length):U.match(/\s</)&&(U=U.replace(/[\s<].*/,""),n.error("end tag name: "+U+" maybe not complete"),oe=L+1+U.length);var R=F.localNSMap,q=F.tagName==U,J=q||F.tagName&&F.tagName.toLowerCase()==U.toLowerCase();if(J){if(r.endElement(F.uri,F.localName,U),R)for(var Y in R)Object.prototype.hasOwnProperty.call(R,Y)&&r.endPrefixMapping(Y);q||n.fatalError("end tag name: "+U+" is not match the current start tagName:"+F.tagName)}else w.push(F);oe++;break;case"?":S&&u(L),oe=Gb(i,L,r);break;case"!":S&&u(L),oe=Wb(i,L,r,n);break;default:S&&u(L);var ie=new gp,me=w[w.length-1].currentNSMap,oe=Vb(i,L,ie,me,a,n),ge=ie.length;if(!ie.closed&&zb(i,oe,ie.tagName,C)&&(ie.closed=!0,t.nbsp||n.warning("unclosed xml attribute")),S&&ge){for(var ee=Gc(S,{}),ue=0;ue<ge;ue++){var te=ie[ue];u(te.offset),te.locator=Gc(S,{})}r.locator=ee,Xc(ie,r,me)&&w.push(ie),r.locator=S}else Xc(ie,r,me)&&w.push(ie);Hn.isHTML(ie.uri)&&!ie.closed?oe=Hb(i,oe,ie.tagName,a,r):oe++}}catch(de){if(de instanceof Br)throw de;n.error("element parse error: "+de),oe=-1}oe>v?v=oe:l(Math.max(L,v)+1)}}function Gc(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function Vb(i,e,t,r,n,s){function a(S,w,C){t.attributeNames.hasOwnProperty(S)&&s.fatalError("Attribute "+S+" redefined"),t.addValue(S,w.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,n),C)}for(var l,u,p=++e,m=Tn;;){var _=i.charAt(p);switch(_){case"=":if(m===Di)l=i.slice(e,p),m=Sn;else if(m===fr)m=Sn;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(m===Sn||m===Di)if(m===Di&&(s.warning('attribute value must after "="'),l=i.slice(e,p)),e=p+1,p=i.indexOf(_,e),p>0)u=i.slice(e,p),a(l,u,e-1),m=_r;else throw new Error("attribute value no end '"+_+"' match");else if(m==yr)u=i.slice(e,p),a(l,u,e),s.warning('attribute "'+l+'" missed start quot('+_+")!!"),e=p+1,m=_r;else throw new Error('attribute value must after "="');break;case"/":switch(m){case Tn:t.setTagName(i.slice(e,p));case _r:case En:case Ns:m=Ns,t.closed=!0;case yr:case Di:break;case fr:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return s.error("unexpected end of input"),m==Tn&&t.setTagName(i.slice(e,p)),p;case">":switch(m){case Tn:t.setTagName(i.slice(e,p));case _r:case En:case Ns:break;case yr:case Di:u=i.slice(e,p),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case fr:m===fr&&(u=l),m==yr?(s.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!Hn.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case Sn:throw new Error("attribute value missed!!")}return p;case"":_=" ";default:if(_<=" ")switch(m){case Tn:t.setTagName(i.slice(e,p)),m=En;break;case Di:l=i.slice(e,p),m=fr;break;case yr:var u=i.slice(e,p);s.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case _r:m=En;break}else switch(m){case fr:t.tagName,(!Hn.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&s.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=p,m=Di;break;case _r:s.warning('attribute space is required"'+l+'"!!');case En:m=Di,e=p;break;case Sn:m=yr,e=p;break;case Ns:throw new Error("elements closed character '/' and '>' must be connected to")}}p++}}function Xc(i,e,t){for(var r=i.tagName,n=null,s=i.length;s--;){var a=i[s],l=a.qName,u=a.value,S=l.indexOf(":");if(S>0)var p=a.prefix=l.slice(0,S),m=l.slice(S+1),_=p==="xmlns"&&m;else m=l,p=null,_=l==="xmlns"&&"";a.localName=m,_!==!1&&(n==null&&(n={},mp(t,t={})),t[_]=n[_]=u,a.uri=Hn.XMLNS,e.startPrefixMapping(_,u))}for(var s=i.length;s--;){a=i[s];var p=a.prefix;p&&(p==="xml"&&(a.uri=Hn.XML),p!=="xmlns"&&(a.uri=t[p||""]))}var S=r.indexOf(":");S>0?(p=i.prefix=r.slice(0,S),m=i.localName=r.slice(S+1)):(p=null,m=i.localName=r);var w=i.uri=t[p||""];if(e.startElement(w,m,r,i),i.closed){if(e.endElement(w,m,r),n)for(p in n)Object.prototype.hasOwnProperty.call(n,p)&&e.endPrefixMapping(p)}else return i.currentNSMap=t,i.localNSMap=n,!0}function Hb(i,e,t,r,n){if(/^(?:script|textarea)$/i.test(t)){var s=i.indexOf("</"+t+">",e),a=i.substring(e+1,s);if(/[&<]/.test(a))return/^script$/i.test(t)?(n.characters(a,0,a.length),s):(a=a.replace(/&#?\w+;/g,r),n.characters(a,0,a.length),s)}return e+1}function zb(i,e,t,r){var n=r[t];return n==null&&(n=i.lastIndexOf("</"+t+">"),n<e&&(n=i.lastIndexOf("</"+t)),r[t]=n),n<e}function mp(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function Wb(i,e,t,r){var n=i.charAt(e+2);switch(n){case"-":if(i.charAt(e+3)==="-"){var s=i.indexOf("-->",e+4);return s>e?(t.comment(i,e+4,s-e-4),s+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var s=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,s-e-9),t.endCDATA(),s+3}var a=Xb(i,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],p=!1,m=!1;l>3&&(/^public$/i.test(a[2][0])?(p=a[3][0],m=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(m=a[3][0]));var _=a[l-1];return t.startDTD(u,p,m),t.endDTD(),_.index+_[0].length}}return-1}function Gb(i,e,t){var r=i.indexOf("?>",e);if(r){var n=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return n?(n[0].length,t.processingInstruction(n[1],n[2]),r+2):-1}return-1}function gp(){this.attributeNames={}}gp.prototype={setTagName:function(i){if(!Wc.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!Wc.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function Xb(i,e){var t,r=[],n=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(n.lastIndex=e,n.exec(i);t=n.exec(i);)if(r.push(t),t[1])return r}Rl.XMLReader=pp;Rl.ParseError=Br;var Kb=Ei,Yb=ji,Kc=hp,fp=Rl,Qb=Yb.DOMImplementation,Yc=Kb.NAMESPACE,Jb=fp.ParseError,Zb=fp.XMLReader;function yp(i){return i.replace(/\r[\n\u0085]/g,`
|
|
3
3
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
4
|
-
`)}function
|
|
5
|
-
@`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function
|
|
6
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
4
|
+
`)}function _p(i){this.options=i||{locator:{}}}_p.prototype.parseFromString=function(i,e){var t=this.options,r=new Zb,n=t.domBuilder||new Jn,s=t.errorHandler,a=t.locator,l=t.xmlns||{},u=/\/x?html?$/.test(e),p=u?Kc.HTML_ENTITIES:Kc.XML_ENTITIES;a&&n.setDocumentLocator(a),r.errorHandler=ev(s,n,a),r.domBuilder=t.domBuilder||n,u&&(l[""]=Yc.HTML),l.xml=l.xml||Yc.XML;var m=t.normalizeLineEndings||yp;return i&&typeof i=="string"?r.parse(m(i),l,p):r.errorHandler.error("invalid doc source"),n.doc};function ev(i,e,t){if(!i){if(e instanceof Jn)return e;i=e}var r={},n=i instanceof Function;t=t||{};function s(a){var l=i[a];!l&&n&&(l=i.length==2?function(u){i(a,u)}:i),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+Go(t))}||function(){}}return s("warning"),s("error"),s("fatalError"),r}function Jn(){this.cdata=!1}function br(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Jn.prototype={startDocument:function(){this.doc=new Qb().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var n=this.doc,s=n.createElementNS(i,t||e),a=r.length;Os(this,s),this.currentElement=s,this.locator&&br(this.locator,s);for(var l=0;l<a;l++){var i=r.getURI(l),u=r.getValue(l),t=r.getQName(l),p=n.createAttributeNS(i,t);this.locator&&br(r.getLocator(l),p),p.value=p.nodeValue=u,s.setAttributeNode(p)}},endElement:function(i,e,t){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(i,e){},endPrefixMapping:function(i){},processingInstruction:function(i,e){var t=this.doc.createProcessingInstruction(i,e);this.locator&&br(this.locator,t),Os(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=Qc.apply(this,arguments),i){if(this.cdata)var r=this.doc.createCDATASection(i);else var r=this.doc.createTextNode(i);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(i)&&this.doc.appendChild(r),this.locator&&br(this.locator,r)}},skippedEntity:function(i){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(i){(this.locator=i)&&(i.lineNumber=0)},comment:function(i,e,t){i=Qc.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&br(this.locator,r),Os(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(i,e,t){var r=this.doc.implementation;if(r&&r.createDocumentType){var n=r.createDocumentType(i,e,t);this.locator&&br(this.locator,n),Os(this,n),this.doc.doctype=n}},warning:function(i){console.warn("[xmldom warning] "+i,Go(this.locator))},error:function(i){console.error("[xmldom error] "+i,Go(this.locator))},fatalError:function(i){throw new Jb(i,this.locator)}};function Go(i){if(i)return`
|
|
5
|
+
@`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function Qc(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){Jn.prototype[i]=function(){return null}});function Os(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}ka.__DOMHandler=Jn;ka.normalizeLineEndings=yp;ka.DOMParser=_p;var Nl=ka.DOMParser;const tv=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Nl},Symbol.toStringTag,{value:"Module"})),iv=Object.freeze(Object.defineProperty({__proto__:null,D:Nl,i:tv},Symbol.toStringTag,{value:"Module"}));var Qs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof wc<"u"?wc:typeof self<"u"?self:{};function Zn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function rv(i){if(i.__esModule)return i;var e=i.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(i).forEach(function(r){var n=Object.getOwnPropertyDescriptor(i,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return i[r]}})}),t}const Js=globalThis||void 0||self;var An;typeof window<"u"?An=window:typeof Qs<"u"?An=Qs:typeof self<"u"?An=self:An={};var Ca=An;const x=Zn(Ca),nv={},sv=Object.freeze(Object.defineProperty({__proto__:null,default:nv},Symbol.toStringTag,{value:"Module"})),av=rv(sv);var Jc=typeof Qs<"u"?Qs:typeof window<"u"?window:{},ov=av,xn;typeof document<"u"?xn=document:(xn=Jc["__GLOBAL_DOCUMENT_CACHE@4"],xn||(xn=Jc["__GLOBAL_DOCUMENT_CACHE@4"]=ov));var bp=xn;const X=Zn(bp);var Ol={exports:{}},vp={exports:{}};(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var s in n)({}).hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(vp);var lv=vp.exports,uv=dv,cv=Object.prototype.toString;function dv(i){if(!i)return!1;var e=cv.call(i);return e==="[object Function]"||typeof i=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}function hv(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=pv(i))||e){t&&(i=t);var r=0;return function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
6
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pv(i,e){if(i){if(typeof i=="string")return Zc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Zc(i,e)}}function Zc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var mv=function(){function i(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(t,r){this.typeToInterceptorsMap_.has(t)||this.typeToInterceptorsMap_.set(t,new Set);var n=this.typeToInterceptorsMap_.get(t);return n.has(r)?!1:(n.add(r),!0)},e.removeInterceptor=function(t,r){var n=this.typeToInterceptorsMap_.get(t);return n&&n.has(r)?(n.delete(r),!0):!1},e.clearInterceptorsByType=function(t){var r=this.typeToInterceptorsMap_.get(t);return r?(this.typeToInterceptorsMap_.delete(t),this.typeToInterceptorsMap_.set(t,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(t){return this.typeToInterceptorsMap_.get(t)||new Set},e.execute=function(t,r){for(var n=this.getForType(t),s=hv(n),a;!(a=s()).done;){var l=a.value;try{r=l(r)}catch{}}return r},i}(),gv=mv,fv=function(){function i(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=i.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(t){this.maxAttempts_=t},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(t){this.delayFactor_=t},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(t){this.fuzzFactor_=t},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(t){this.initialDelay_=t},e.createRetry=function(t){var r=t===void 0?{}:t,n=r.maxAttempts,s=r.delayFactor,a=r.fuzzFactor,l=r.initialDelay;return new yv({maxAttempts:n||this.maxAttempts_,delayFactor:s||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:l||this.initialDelay_})},i}(),yv=function(){function i(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=i.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var t=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+t},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var t=this.getCurrentMinPossibleDelay(),r=this.getCurrentMaxPossibleDelay();return t+Math.random()*(r-t)},i}(),_v=fv,bv=Ca,vv=function(i,e){return e===void 0&&(e=!1),function(t,r,n){if(t){i(t);return}if(r.statusCode>=400&&r.statusCode<=599){var s=n;if(e)if(bv.TextDecoder){var a=Tv(r.headers&&r.headers["content-type"]);try{s=new TextDecoder(a).decode(n)}catch{}}else s=String.fromCharCode.apply(null,new Uint8Array(n));i({cause:s});return}i(null,n)}};function Tv(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var r=t.split("="),n=r[0],s=r[1];return n.trim()==="charset"?s.trim():e},"utf-8")}var Sv=vv,Tp=Ca,Ev=lv,wv=uv,Sp=gv,kv=_v;ze.httpHandler=Sv;ze.requestInterceptorsStorage=new Sp;ze.responseInterceptorsStorage=new Sp;ze.retryManager=new kv;/**
|
|
7
7
|
* @license
|
|
8
8
|
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
9
9
|
* Copyright (c) 2014 David Björklund
|
|
10
10
|
* Available under the MIT license
|
|
11
11
|
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
12
|
-
*/var
|
|
13
|
-
`).forEach(function(t){var r=t.indexOf(":"),n=t.slice(0,r).trim().toLowerCase(),s=t.slice(r+1).trim();typeof e[n]>"u"?e[n]=s:Array.isArray(e[n])?e[n].push(s):e[n]=[e[n],s]}),e};Nl.exports=qe;Nl.exports.default=qe;qe.XMLHttpRequest=gp.XMLHttpRequest||mv;qe.XDomainRequest="withCredentials"in new qe.XMLHttpRequest?qe.XMLHttpRequest:gp.XDomainRequest;hv(["get","put","post","patch","head","delete"],function(i){qe[i==="delete"?"del":i]=function(e,t,r){return t=fp(e,t,r),t.method=i.toUpperCase(),Ol(t)}});function hv(i,e){for(var t=0;t<i.length;t++)e(i[t])}function pv(i){for(var e in i)if(i.hasOwnProperty(e))return!1;return!0}function fp(i,e,t){var r=i;return uv(e)?(t=e,typeof i=="string"&&(r={uri:i})):r=lv({},e,{uri:i}),r.callback=t,r}function qe(i,e,t){return e=fp(i,e,t),Ol(e)}function Ol(i){if(typeof i.callback>"u")throw new Error("callback argument missing");if(i.requestType&&qe.requestInterceptorsStorage.getIsEnabled()){var e={uri:i.uri||i.url,headers:i.headers||{},body:i.body,metadata:i.metadata||{},retry:i.retry,timeout:i.timeout},t=qe.requestInterceptorsStorage.execute(i.requestType,e);i.uri=t.uri,i.headers=t.headers,i.body=t.body,i.metadata=t.metadata,i.retry=t.retry,i.timeout=t.timeout}var r=!1,n=function(F,N,V){r||(r=!0,i.callback(F,N,V))};function s(){p.readyState===4&&!qe.responseInterceptorsStorage.getIsEnabled()&&setTimeout(u,0)}function a(){var F=void 0;if(p.response?F=p.response:F=p.responseText||gv(p),L)try{F=JSON.parse(F)}catch{}return F}function l(F){if(clearTimeout(O),clearTimeout(i.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!b&&qe.retryManager.getIsEnabled()&&i.retry&&i.retry.shouldRetry()){i.retryTimeout=setTimeout(function(){i.retry.moveToNextAttempt(),i.xhr=p,Ol(i)},i.retry.getCurrentFuzzedDelay());return}if(i.requestType&&qe.responseInterceptorsStorage.getIsEnabled()){var N={headers:U.headers||{},body:U.body,responseUrl:p.responseURL,responseType:p.responseType},V=qe.responseInterceptorsStorage.execute(i.requestType,N);U.body=V.body,U.headers=V.headers}return n(F,U)}function u(){if(!b){var F;clearTimeout(O),clearTimeout(i.retryTimeout),i.useXDR&&p.status===void 0?F=200:F=p.status===1223?204:p.status;var N=U,V=null;if(F!==0?(N={body:a(),statusCode:F,method:w,headers:{},url:S,rawRequest:p},p.getAllResponseHeaders&&(N.headers=dv(p.getAllResponseHeaders()))):V=new Error("Internal XMLHttpRequest Error"),i.requestType&&qe.responseInterceptorsStorage.getIsEnabled()){var J={headers:N.headers||{},body:N.body,responseUrl:p.responseURL,responseType:p.responseType},Y=qe.responseInterceptorsStorage.execute(i.requestType,J);N.body=Y.body,N.headers=Y.headers}return n(V,N,N.body)}}var p=i.xhr||null;p||(i.cors||i.useXDR?p=new qe.XDomainRequest:p=new qe.XMLHttpRequest);var g,b,S=p.url=i.uri||i.url,w=p.method=i.method||"GET",C=i.body||i.data,v=p.headers=i.headers||{},D=!!i.sync,L=!1,O,U={body:void 0,headers:{},statusCode:0,method:w,url:S,rawRequest:p};if("json"in i&&i.json!==!1&&(L=!0,v.accept||v.Accept||(v.Accept="application/json"),w!=="GET"&&w!=="HEAD"&&(v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),C=JSON.stringify(i.json===!0?C:i.json))),p.onreadystatechange=s,p.onload=u,p.onerror=l,p.onprogress=function(){},p.onabort=function(){b=!0,clearTimeout(i.retryTimeout)},p.ontimeout=l,p.open(w,S,!D,i.username,i.password),D||(p.withCredentials=!!i.withCredentials),!D&&i.timeout>0&&(O=setTimeout(function(){if(!b){b=!0,p.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",l(F)}},i.timeout)),p.setRequestHeader)for(g in v)v.hasOwnProperty(g)&&p.setRequestHeader(g,v[g]);else if(i.headers&&!pv(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(p.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(p),p.send(C||null),p}function gv(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch{}return null}function mv(){}var fv=Nl.exports;const yp=Kn(fv);var _p={exports:{}},Jc=hp,Ul=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function wt(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}wt.prototype=Ul(Error.prototype);wt.prototype.constructor=wt;wt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Ml(i){function e(r,n,s,a){return(r|0)*3600+(n|0)*60+(s|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function Ln(){this.values=Ul(null)}Ln.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(i,e);break}},integer:function(i,e){/^-?\d+$/.test(e)&&this.set(i,parseInt(e,10))},percent:function(i,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(i,e),!0):!1}};function Cn(i,e,t,r){var n=r?i.split(r):[i];for(var s in n)if(typeof n[s]=="string"){var a=n[s].split(t);if(a.length===2){var l=a[0].trim(),u=a[1].trim();e(l,u)}}}function yv(i,e,t){var r=i;function n(){var l=Ml(i);if(l===null)throw new wt(wt.Errors.BadTimeStamp,"Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),l}function s(l,u){var p=new Ln;Cn(l,function(g,b){switch(g){case"region":for(var S=t.length-1;S>=0;S--)if(t[S].id===b){p.set(g,t[S].region);break}break;case"vertical":p.alt(g,b,["rl","lr"]);break;case"line":var w=b.split(","),C=w[0];p.integer(g,C),p.percent(g,C)&&p.set("snapToLines",!1),p.alt(g,C,["auto"]),w.length===2&&p.alt("lineAlign",w[1],["start","center","end"]);break;case"position":w=b.split(","),p.percent(g,w[0]),w.length===2&&p.alt("positionAlign",w[1],["start","center","end"]);break;case"size":p.percent(g,b);break;case"align":p.alt(g,b,["start","center","end","left","right"]);break}},/:/,/\s/),u.region=p.get("region",null),u.vertical=p.get("vertical","");try{u.line=p.get("line","auto")}catch{}u.lineAlign=p.get("lineAlign","start"),u.snapToLines=p.get("snapToLines",!0),u.size=p.get("size",100);try{u.align=p.get("align","center")}catch{u.align=p.get("align","middle")}try{u.position=p.get("position","auto")}catch{u.position=p.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},u.align)}u.positionAlign=p.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},u.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),i.substr(0,3)!=="-->")throw new wt(wt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.substr(3),a(),e.endTime=n(),a(),s(i,e)}var vo=Jc.createElement&&Jc.createElement("textarea"),_v={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Zc={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},bv={v:"title",lang:"lang"},ed={rt:"ruby"};function bp(i,e){function t(){if(!e)return null;function C(D){return e=e.substr(D.length),D}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return C(v[1]?v[1]:v[2])}function r(C){return vo.innerHTML=C,C=vo.textContent,vo.textContent="",C}function n(C,v){return!ed[v.localName]||ed[v.localName]===C.localName}function s(C,v){var D=_v[C];if(!D)return null;var L=i.document.createElement(D),O=bv[C];return O&&v&&(L[O]=v.trim()),L}for(var a=i.document.createElement("div"),l=a,u,p=[];(u=t())!==null;){if(u[0]==="<"){if(u[1]==="/"){p.length&&p[p.length-1]===u.substr(2).replace(">","")&&(p.pop(),l=l.parentNode);continue}var g=Ml(u.substr(1,u.length-2)),b;if(g){b=i.document.createProcessingInstruction("timestamp",g),l.appendChild(b);continue}var S=u.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!S||(b=s(S[1],S[3]),!b)||!n(l,b))continue;if(S[2]){var w=S[2].split(".");w.forEach(function(C){var v=/^bg_/.test(C),D=v?C.slice(3):C;if(Zc.hasOwnProperty(D)){var L=v?"background-color":"color",O=Zc[D];b.style[L]=O}}),b.className=w.join(" ")}p.push(S[1]),l.appendChild(b),l=b;continue}l.appendChild(i.document.createTextNode(r(u)))}return a}var td=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function vv(i){for(var e=0;e<td.length;e++){var t=td[e];if(i>=t[0]&&i<=t[1])return!0}return!1}function Tv(i){var e=[],t="",r;if(!i||!i.childNodes)return"ltr";function n(l,u){for(var p=u.childNodes.length-1;p>=0;p--)l.push(u.childNodes[p])}function s(l){if(!l||!l.length)return null;var u=l.pop(),p=u.textContent||u.innerText;if(p){var g=p.match(/^.*(\n|\r)/);return g?(l.length=0,g[0]):p}if(u.tagName==="ruby")return s(l);if(u.childNodes)return n(l,u),s(l)}for(n(e,i);t=s(e);)for(var a=0;a<t.length;a++)if(r=t.charCodeAt(a),vv(r))return"rtl";return"ltr"}function Sv(i){if(typeof i.line=="number"&&(i.snapToLines||i.line>=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,r=0,n=0;n<t.length&&t[n]!==e;n++)t[n].mode==="showing"&&r++;return++r*-1}function ka(){}ka.prototype.applyStyles=function(i,e){e=e||this.div;for(var t in i)i.hasOwnProperty(t)&&(e.style[t]=i[t])};ka.prototype.formatStyle=function(i,e){return i===0?0:i+e};function Qs(i,e,t){ka.call(this),this.cue=e,this.cueDiv=bp(i,e.text);var r={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(r,this.cueDiv),this.div=i.document.createElement("div"),r={direction:Tv(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:t.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(r),this.div.appendChild(this.cueDiv);var n=0;switch(e.positionAlign){case"start":case"line-left":n=e.position;break;case"center":n=e.position-e.size/2;break;case"end":case"line-right":n=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(s){this.applyStyles({top:this.formatStyle(s.top,"px"),bottom:this.formatStyle(s.bottom,"px"),left:this.formatStyle(s.left,"px"),right:this.formatStyle(s.right,"px"),height:this.formatStyle(s.height,"px"),width:this.formatStyle(s.width,"px")})}}Qs.prototype=Ul(ka.prototype);Qs.prototype.constructor=Qs;function ut(i){var e,t,r,n;if(i.div){t=i.div.offsetHeight,r=i.div.offsetWidth,n=i.div.offsetTop;var s=(s=i.div.childNodes)&&(s=s[0])&&s.getClientRects&&s.getClientRects();i=i.div.getBoundingClientRect(),e=s?Math.max(s[0]&&s[0].height||0,i.height/s.length):0}this.left=i.left,this.right=i.right,this.top=i.top||n,this.height=i.height||t,this.bottom=i.bottom||n+(i.height||t),this.width=i.width||r,this.lineHeight=e!==void 0?e:i.lineHeight}ut.prototype.move=function(i,e){switch(e=e!==void 0?e:this.lineHeight,i){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e;break}};ut.prototype.overlaps=function(i){return this.left<i.right&&this.right>i.left&&this.top<i.bottom&&this.bottom>i.top};ut.prototype.overlapsAny=function(i){for(var e=0;e<i.length;e++)if(this.overlaps(i[e]))return!0;return!1};ut.prototype.within=function(i){return this.top>=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right};ut.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.left<i.left;case"-x":return this.right>i.right;case"+y":return this.top<i.top;case"-y":return this.bottom>i.bottom}};ut.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),r=e*t;return r/(this.height*this.width)};ut.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}};ut.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,r=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var n={left:i.left,right:i.right,top:i.top||r,height:i.height||e,bottom:i.bottom||r+(i.height||e),width:i.width||t};return n};function Ev(i,e,t,r){function n(D,L){for(var O,U=new ut(D),F=1,N=0;N<L.length;N++){for(;D.overlapsOppositeAxis(t,L[N])||D.within(t)&&D.overlapsAny(r);)D.move(L[N]);if(D.within(t))return D;var V=D.intersectPercentage(t);F>V&&(O=new ut(D),F=V),D=new ut(U)}return O||U}var s=new ut(e),a=e.cue,l=Sv(a),u=[];if(a.snapToLines){var p;switch(a.vertical){case"":u=["+y","-y"],p="height";break;case"rl":u=["+x","-x"],p="width";break;case"lr":u=["-x","+x"],p="width";break}var g=s.lineHeight,b=g*Math.round(l),S=t[p]+g,w=u[0];Math.abs(b)>S&&(b=b<0?-1:1,b*=Math.ceil(S/g)*g),l<0&&(b+=a.vertical===""?t.height:t.width,u=u.reverse()),s.move(w,b)}else{var C=s.lineHeight/t.height*100;switch(a.lineAlign){case"center":l-=C/2;break;case"end":l-=C;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(l,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(l,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(l,"%")});break}u=["+y","-x","+x","-y"],s=new ut(e)}var v=n(s,u);e.move(v.toCSSCompatValues(t))}function zr(){}zr.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}};zr.convertCueToDOMTree=function(i,e){return!i||!e?null:bp(i,e)};var wv=.05,kv="sans-serif",Cv="1.5%";zr.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var r=i.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=Cv,t.appendChild(r);function n(g){for(var b=0;b<g.length;b++)if(g[b].hasBeenReset||!g[b].displayState)return!0;return!1}if(!n(e)){for(var s=0;s<e.length;s++)r.appendChild(e[s].displayState);return}var a=[],l=ut.getSimpleBoxPosition(r),u=Math.round(l.height*wv*100)/100,p={font:u+"px "+kv};(function(){for(var g,b,S=0;S<e.length;S++)b=e[S],g=new Qs(i,b,p),r.appendChild(g.div),Ev(i,g,l,a),b.displayState=g.div,a.push(ut.getSimpleBoxPosition(g))})()};zr.Parser=function(i,e,t){t||(t=e,e={}),e||(e={}),this.window=i,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};zr.Parser.prototype={reportOrThrowError:function(i){if(i instanceof wt)this.onparsingerror&&this.onparsingerror(i);else throw i},parse:function(i){var e=this;i&&(e.buffer+=e.decoder.decode(i,{stream:!0}));function t(){for(var g=e.buffer,b=0;b<g.length&&g[b]!=="\r"&&g[b]!==`
|
|
14
|
-
`;)++
|
|
15
|
-
`&&++
|
|
12
|
+
*/var Cv=function(i){var e={};return i&&i.trim().split(`
|
|
13
|
+
`).forEach(function(t){var r=t.indexOf(":"),n=t.slice(0,r).trim().toLowerCase(),s=t.slice(r+1).trim();typeof e[n]>"u"?e[n]=s:Array.isArray(e[n])?e[n].push(s):e[n]=[e[n],s]}),e};Ol.exports=ze;Ol.exports.default=ze;ze.XMLHttpRequest=Tp.XMLHttpRequest||Lv;ze.XDomainRequest="withCredentials"in new ze.XMLHttpRequest?ze.XMLHttpRequest:Tp.XDomainRequest;Iv(["get","put","post","patch","head","delete"],function(i){ze[i==="delete"?"del":i]=function(e,t,r){return t=Ep(e,t,r),t.method=i.toUpperCase(),Ul(t)}});function Iv(i,e){for(var t=0;t<i.length;t++)e(i[t])}function Av(i){for(var e in i)if(i.hasOwnProperty(e))return!1;return!0}function Ep(i,e,t){var r=i;return wv(e)?(t=e,typeof i=="string"&&(r={uri:i})):r=Ev({},e,{uri:i}),r.callback=t,r}function ze(i,e,t){return e=Ep(i,e,t),Ul(e)}function Ul(i){if(typeof i.callback>"u")throw new Error("callback argument missing");if(i.requestType&&ze.requestInterceptorsStorage.getIsEnabled()){var e={uri:i.uri||i.url,headers:i.headers||{},body:i.body,metadata:i.metadata||{},retry:i.retry,timeout:i.timeout},t=ze.requestInterceptorsStorage.execute(i.requestType,e);i.uri=t.uri,i.headers=t.headers,i.body=t.body,i.metadata=t.metadata,i.retry=t.retry,i.timeout=t.timeout}var r=!1,n=function(F,R,q){r||(r=!0,i.callback(F,R,q))};function s(){p.readyState===4&&!ze.responseInterceptorsStorage.getIsEnabled()&&setTimeout(u,0)}function a(){var F=void 0;if(p.response?F=p.response:F=p.responseText||xv(p),D)try{F=JSON.parse(F)}catch{}return F}function l(F){if(clearTimeout(O),clearTimeout(i.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!_&&ze.retryManager.getIsEnabled()&&i.retry&&i.retry.shouldRetry()){i.retryTimeout=setTimeout(function(){i.retry.moveToNextAttempt(),i.xhr=p,Ul(i)},i.retry.getCurrentFuzzedDelay());return}if(i.requestType&&ze.responseInterceptorsStorage.getIsEnabled()){var R={headers:U.headers||{},body:U.body,responseUrl:p.responseURL,responseType:p.responseType},q=ze.responseInterceptorsStorage.execute(i.requestType,R);U.body=q.body,U.headers=q.headers}return n(F,U)}function u(){if(!_){var F;clearTimeout(O),clearTimeout(i.retryTimeout),i.useXDR&&p.status===void 0?F=200:F=p.status===1223?204:p.status;var R=U,q=null;if(F!==0?(R={body:a(),statusCode:F,method:w,headers:{},url:S,rawRequest:p},p.getAllResponseHeaders&&(R.headers=Cv(p.getAllResponseHeaders()))):q=new Error("Internal XMLHttpRequest Error"),i.requestType&&ze.responseInterceptorsStorage.getIsEnabled()){var J={headers:R.headers||{},body:R.body,responseUrl:p.responseURL,responseType:p.responseType},Y=ze.responseInterceptorsStorage.execute(i.requestType,J);R.body=Y.body,R.headers=Y.headers}return n(q,R,R.body)}}var p=i.xhr||null;p||(i.cors||i.useXDR?p=new ze.XDomainRequest:p=new ze.XMLHttpRequest);var m,_,S=p.url=i.uri||i.url,w=p.method=i.method||"GET",C=i.body||i.data,v=p.headers=i.headers||{},L=!!i.sync,D=!1,O,U={body:void 0,headers:{},statusCode:0,method:w,url:S,rawRequest:p};if("json"in i&&i.json!==!1&&(D=!0,v.accept||v.Accept||(v.Accept="application/json"),w!=="GET"&&w!=="HEAD"&&(v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),C=JSON.stringify(i.json===!0?C:i.json))),p.onreadystatechange=s,p.onload=u,p.onerror=l,p.onprogress=function(){},p.onabort=function(){_=!0,clearTimeout(i.retryTimeout)},p.ontimeout=l,p.open(w,S,!L,i.username,i.password),L||(p.withCredentials=!!i.withCredentials),!L&&i.timeout>0&&(O=setTimeout(function(){if(!_){_=!0,p.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",l(F)}},i.timeout)),p.setRequestHeader)for(m in v)v.hasOwnProperty(m)&&p.setRequestHeader(m,v[m]);else if(i.headers&&!Av(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(p.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(p),p.send(C||null),p}function xv(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch{}return null}function Lv(){}var Dv=Ol.exports;const wp=Zn(Dv);var kp={exports:{}},ed=bp,Ml=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function xt(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}xt.prototype=Ml(Error.prototype);xt.prototype.constructor=xt;xt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Bl(i){function e(r,n,s,a){return(r|0)*3600+(n|0)*60+(s|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function Nn(){this.values=Ml(null)}Nn.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(i,e);break}},integer:function(i,e){/^-?\d+$/.test(e)&&this.set(i,parseInt(e,10))},percent:function(i,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(i,e),!0):!1}};function Ln(i,e,t,r){var n=r?i.split(r):[i];for(var s in n)if(typeof n[s]=="string"){var a=n[s].split(t);if(a.length===2){var l=a[0].trim(),u=a[1].trim();e(l,u)}}}function Pv(i,e,t){var r=i;function n(){var l=Bl(i);if(l===null)throw new xt(xt.Errors.BadTimeStamp,"Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),l}function s(l,u){var p=new Nn;Ln(l,function(m,_){switch(m){case"region":for(var S=t.length-1;S>=0;S--)if(t[S].id===_){p.set(m,t[S].region);break}break;case"vertical":p.alt(m,_,["rl","lr"]);break;case"line":var w=_.split(","),C=w[0];p.integer(m,C),p.percent(m,C)&&p.set("snapToLines",!1),p.alt(m,C,["auto"]),w.length===2&&p.alt("lineAlign",w[1],["start","center","end"]);break;case"position":w=_.split(","),p.percent(m,w[0]),w.length===2&&p.alt("positionAlign",w[1],["start","center","end"]);break;case"size":p.percent(m,_);break;case"align":p.alt(m,_,["start","center","end","left","right"]);break}},/:/,/\s/),u.region=p.get("region",null),u.vertical=p.get("vertical","");try{u.line=p.get("line","auto")}catch{}u.lineAlign=p.get("lineAlign","start"),u.snapToLines=p.get("snapToLines",!0),u.size=p.get("size",100);try{u.align=p.get("align","center")}catch{u.align=p.get("align","middle")}try{u.position=p.get("position","auto")}catch{u.position=p.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},u.align)}u.positionAlign=p.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},u.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),i.substr(0,3)!=="-->")throw new xt(xt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.substr(3),a(),e.endTime=n(),a(),s(i,e)}var To=ed.createElement&&ed.createElement("textarea"),Rv={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},td={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},Nv={v:"title",lang:"lang"},id={rt:"ruby"};function Cp(i,e){function t(){if(!e)return null;function C(L){return e=e.substr(L.length),L}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return C(v[1]?v[1]:v[2])}function r(C){return To.innerHTML=C,C=To.textContent,To.textContent="",C}function n(C,v){return!id[v.localName]||id[v.localName]===C.localName}function s(C,v){var L=Rv[C];if(!L)return null;var D=i.document.createElement(L),O=Nv[C];return O&&v&&(D[O]=v.trim()),D}for(var a=i.document.createElement("div"),l=a,u,p=[];(u=t())!==null;){if(u[0]==="<"){if(u[1]==="/"){p.length&&p[p.length-1]===u.substr(2).replace(">","")&&(p.pop(),l=l.parentNode);continue}var m=Bl(u.substr(1,u.length-2)),_;if(m){_=i.document.createProcessingInstruction("timestamp",m),l.appendChild(_);continue}var S=u.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!S||(_=s(S[1],S[3]),!_)||!n(l,_))continue;if(S[2]){var w=S[2].split(".");w.forEach(function(C){var v=/^bg_/.test(C),L=v?C.slice(3):C;if(td.hasOwnProperty(L)){var D=v?"background-color":"color",O=td[L];_.style[D]=O}}),_.className=w.join(" ")}p.push(S[1]),l.appendChild(_),l=_;continue}l.appendChild(i.document.createTextNode(r(u)))}return a}var rd=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function Ov(i){for(var e=0;e<rd.length;e++){var t=rd[e];if(i>=t[0]&&i<=t[1])return!0}return!1}function Uv(i){var e=[],t="",r;if(!i||!i.childNodes)return"ltr";function n(l,u){for(var p=u.childNodes.length-1;p>=0;p--)l.push(u.childNodes[p])}function s(l){if(!l||!l.length)return null;var u=l.pop(),p=u.textContent||u.innerText;if(p){var m=p.match(/^.*(\n|\r)/);return m?(l.length=0,m[0]):p}if(u.tagName==="ruby")return s(l);if(u.childNodes)return n(l,u),s(l)}for(n(e,i);t=s(e);)for(var a=0;a<t.length;a++)if(r=t.charCodeAt(a),Ov(r))return"rtl";return"ltr"}function Mv(i){if(typeof i.line=="number"&&(i.snapToLines||i.line>=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,r=0,n=0;n<t.length&&t[n]!==e;n++)t[n].mode==="showing"&&r++;return++r*-1}function Ia(){}Ia.prototype.applyStyles=function(i,e){e=e||this.div;for(var t in i)i.hasOwnProperty(t)&&(e.style[t]=i[t])};Ia.prototype.formatStyle=function(i,e){return i===0?0:i+e};function Zs(i,e,t){Ia.call(this),this.cue=e,this.cueDiv=Cp(i,e.text);var r={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(r,this.cueDiv),this.div=i.document.createElement("div"),r={direction:Uv(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:t.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(r),this.div.appendChild(this.cueDiv);var n=0;switch(e.positionAlign){case"start":case"line-left":n=e.position;break;case"center":n=e.position-e.size/2;break;case"end":case"line-right":n=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(s){this.applyStyles({top:this.formatStyle(s.top,"px"),bottom:this.formatStyle(s.bottom,"px"),left:this.formatStyle(s.left,"px"),right:this.formatStyle(s.right,"px"),height:this.formatStyle(s.height,"px"),width:this.formatStyle(s.width,"px")})}}Zs.prototype=Ml(Ia.prototype);Zs.prototype.constructor=Zs;function pt(i){var e,t,r,n;if(i.div){t=i.div.offsetHeight,r=i.div.offsetWidth,n=i.div.offsetTop;var s=(s=i.div.childNodes)&&(s=s[0])&&s.getClientRects&&s.getClientRects();i=i.div.getBoundingClientRect(),e=s?Math.max(s[0]&&s[0].height||0,i.height/s.length):0}this.left=i.left,this.right=i.right,this.top=i.top||n,this.height=i.height||t,this.bottom=i.bottom||n+(i.height||t),this.width=i.width||r,this.lineHeight=e!==void 0?e:i.lineHeight}pt.prototype.move=function(i,e){switch(e=e!==void 0?e:this.lineHeight,i){case"+x":this.left+=e,this.right+=e;break;case"-x":this.left-=e,this.right-=e;break;case"+y":this.top+=e,this.bottom+=e;break;case"-y":this.top-=e,this.bottom-=e;break}};pt.prototype.overlaps=function(i){return this.left<i.right&&this.right>i.left&&this.top<i.bottom&&this.bottom>i.top};pt.prototype.overlapsAny=function(i){for(var e=0;e<i.length;e++)if(this.overlaps(i[e]))return!0;return!1};pt.prototype.within=function(i){return this.top>=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right};pt.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.left<i.left;case"-x":return this.right>i.right;case"+y":return this.top<i.top;case"-y":return this.bottom>i.bottom}};pt.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),r=e*t;return r/(this.height*this.width)};pt.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}};pt.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,r=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var n={left:i.left,right:i.right,top:i.top||r,height:i.height||e,bottom:i.bottom||r+(i.height||e),width:i.width||t};return n};function Bv(i,e,t,r){function n(L,D){for(var O,U=new pt(L),F=1,R=0;R<D.length;R++){for(;L.overlapsOppositeAxis(t,D[R])||L.within(t)&&L.overlapsAny(r);)L.move(D[R]);if(L.within(t))return L;var q=L.intersectPercentage(t);F>q&&(O=new pt(L),F=q),L=new pt(U)}return O||U}var s=new pt(e),a=e.cue,l=Mv(a),u=[];if(a.snapToLines){var p;switch(a.vertical){case"":u=["+y","-y"],p="height";break;case"rl":u=["+x","-x"],p="width";break;case"lr":u=["-x","+x"],p="width";break}var m=s.lineHeight,_=m*Math.round(l),S=t[p]+m,w=u[0];Math.abs(_)>S&&(_=_<0?-1:1,_*=Math.ceil(S/m)*m),l<0&&(_+=a.vertical===""?t.height:t.width,u=u.reverse()),s.move(w,_)}else{var C=s.lineHeight/t.height*100;switch(a.lineAlign){case"center":l-=C/2;break;case"end":l-=C;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(l,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(l,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(l,"%")});break}u=["+y","-x","+x","-y"],s=new pt(e)}var v=n(s,u);e.move(v.toCSSCompatValues(t))}function Kr(){}Kr.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}};Kr.convertCueToDOMTree=function(i,e){return!i||!e?null:Cp(i,e)};var Fv=.05,jv="sans-serif",$v="1.5%";Kr.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var r=i.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=$v,t.appendChild(r);function n(m){for(var _=0;_<m.length;_++)if(m[_].hasBeenReset||!m[_].displayState)return!0;return!1}if(!n(e)){for(var s=0;s<e.length;s++)r.appendChild(e[s].displayState);return}var a=[],l=pt.getSimpleBoxPosition(r),u=Math.round(l.height*Fv*100)/100,p={font:u+"px "+jv};(function(){for(var m,_,S=0;S<e.length;S++)_=e[S],m=new Zs(i,_,p),r.appendChild(m.div),Bv(i,m,l,a),_.displayState=m.div,a.push(pt.getSimpleBoxPosition(m))})()};Kr.Parser=function(i,e,t){t||(t=e,e={}),e||(e={}),this.window=i,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};Kr.Parser.prototype={reportOrThrowError:function(i){if(i instanceof xt)this.onparsingerror&&this.onparsingerror(i);else throw i},parse:function(i){var e=this;i&&(e.buffer+=e.decoder.decode(i,{stream:!0}));function t(){for(var m=e.buffer,_=0;_<m.length&&m[_]!=="\r"&&m[_]!==`
|
|
14
|
+
`;)++_;var S=m.substr(0,_);return m[_]==="\r"&&++_,m[_]===`
|
|
15
|
+
`&&++_,e.buffer=m.substr(_),S}function r(m){var _=new Nn;if(Ln(m,function(w,C){switch(w){case"id":_.set(w,C);break;case"width":_.percent(w,C);break;case"lines":_.integer(w,C);break;case"regionanchor":case"viewportanchor":var v=C.split(",");if(v.length!==2)break;var L=new Nn;if(L.percent("x",v[0]),L.percent("y",v[1]),!L.has("x")||!L.has("y"))break;_.set(w+"X",L.get("x")),_.set(w+"Y",L.get("y"));break;case"scroll":_.alt(w,C,["up"]);break}},/=/,/\s/),_.has("id")){var S=new(e.vttjs.VTTRegion||e.window.VTTRegion);S.width=_.get("width",100),S.lines=_.get("lines",3),S.regionAnchorX=_.get("regionanchorX",0),S.regionAnchorY=_.get("regionanchorY",100),S.viewportAnchorX=_.get("viewportanchorX",0),S.viewportAnchorY=_.get("viewportanchorY",100),S.scroll=_.get("scroll",""),e.onregion&&e.onregion(S),e.regionList.push({id:_.get("id"),region:S})}}function n(m){var _=new Nn;Ln(m,function(S,w){switch(S){case"MPEGT":_.integer(S+"S",w);break;case"LOCA":_.set(S+"L",Bl(w));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:_.get("MPEGTS"),LOCAL:_.get("LOCAL")})}function s(m){m.match(/X-TIMESTAMP-MAP/)?Ln(m,function(_,S){switch(_){case"X-TIMESTAMP-MAP":n(S);break}},/=/):Ln(m,function(_,S){switch(_){case"Region":r(S);break}},/:/)}try{var a;if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;a=t();var l=a.match(/^WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new xt(xt.Errors.BadSignature);e.state="HEADER"}for(var u=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(u?u=!1:a=t(),e.state){case"HEADER":/:/.test(a)?s(a):a||(e.state="ID");continue;case"NOTE":a||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){e.state="NOTE";break}if(!a)continue;e.cue=new(e.vttjs.VTTCue||e.window.VTTCue)(0,0,"");try{e.cue.align="center"}catch{e.cue.align="middle"}if(e.state="CUE",a.indexOf("-->")===-1){e.cue.id=a;continue}case"CUE":try{Pv(a,e.cue,e.regionList)}catch(m){e.reportOrThrowError(m),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var p=a.indexOf("-->")!==-1;if(!a||p&&(u=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=`
|
|
16
16
|
`),e.cue.text+=a.replace(/\u2028/g,`
|
|
17
17
|
`).replace(/u2029/g,`
|
|
18
|
-
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(
|
|
18
|
+
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(m){e.reportOrThrowError(m),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=`
|
|
19
19
|
|
|
20
|
-
`,i.parse()),i.state==="INITIAL")throw new
|
|
20
|
+
`,i.parse()),i.state==="INITIAL")throw new xt(xt.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var qv=Kr,Vv="auto",Hv={"":1,lr:1,rl:1},zv={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Wv(i){if(typeof i!="string")return!1;var e=Hv[i.toLowerCase()];return e?i.toLowerCase():!1}function So(i){if(typeof i!="string")return!1;var e=zv[i.toLowerCase()];return e?i.toLowerCase():!1}function Ip(i,e,t){this.hasBeenReset=!1;var r="",n=!1,s=i,a=e,l=t,u=null,p="",m=!0,_="auto",S="start",w="auto",C="auto",v=100,L="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(D){r=""+D}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(D){n=!!D}},startTime:{enumerable:!0,get:function(){return s},set:function(D){if(typeof D!="number")throw new TypeError("Start time must be set to a number.");s=D,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(D){if(typeof D!="number")throw new TypeError("End time must be set to a number.");a=D,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(D){l=""+D,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(D){u=D,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return p},set:function(D){var O=Wv(D);if(O===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");p=O,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return m},set:function(D){m=!!D,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return _},set:function(D){if(typeof D!="number"&&D!==Vv)throw new SyntaxError("Line: an invalid number or illegal string was specified.");_=D,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return S},set:function(D){var O=So(D);O?(S=O,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return w},set:function(D){if(D<0||D>100)throw new Error("Position must be between 0 and 100.");w=D,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return C},set:function(D){var O=So(D);O?(C=O,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return v},set:function(D){if(D<0||D>100)throw new Error("Size must be between 0 and 100.");v=D,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return L},set:function(D){var O=So(D);if(!O)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");L=O,this.hasBeenReset=!0}}}),this.displayState=void 0}Ip.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Gv=Ip,Xv={"":!0,up:!0};function Kv(i){if(typeof i!="string")return!1;var e=Xv[i.toLowerCase()];return e?i.toLowerCase():!1}function wn(i){return typeof i=="number"&&i>=0&&i<=100}function Yv(){var i=100,e=3,t=0,r=100,n=0,s=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(l){if(!wn(l))throw new Error("Width must be between 0 and 100.");i=l}},lines:{enumerable:!0,get:function(){return e},set:function(l){if(typeof l!="number")throw new TypeError("Lines must be set to a number.");e=l}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(l){if(!wn(l))throw new Error("RegionAnchorX must be between 0 and 100.");r=l}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(l){if(!wn(l))throw new Error("RegionAnchorY must be between 0 and 100.");t=l}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(l){if(!wn(l))throw new Error("ViewportAnchorY must be between 0 and 100.");s=l}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(l){if(!wn(l))throw new Error("ViewportAnchorX must be between 0 and 100.");n=l}},scroll:{enumerable:!0,get:function(){return a},set:function(l){var u=Kv(l);u===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=u}}})}var Qv=Yv,Ti=Ca,ur=kp.exports={WebVTT:qv,VTTCue:Gv,VTTRegion:Qv};Ti.vttjs=ur;Ti.WebVTT=ur.WebVTT;var Jv=ur.VTTCue,Zv=ur.VTTRegion,eT=Ti.VTTCue,tT=Ti.VTTRegion;ur.shim=function(){Ti.VTTCue=Jv,Ti.VTTRegion=Zv};ur.restore=function(){Ti.VTTCue=eT,Ti.VTTRegion=tT};Ti.VTTCue||ur.shim();var iT=kp.exports;const nd=Zn(iT);function Ge(){return Ge=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ge.apply(null,arguments)}var sd="https://example.com",Aa=function(i,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(i)&&(i=x.location&&x.location.href||"");var t=/^\/\//.test(i),r=!x.location&&!/\/\//i.test(i);i=new x.URL(i,x.location||sd);var n=new URL(e,i);return r?n.href.slice(sd.length):t?n.href.slice(n.protocol.length):n.href},Fl=function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(t,r){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(r)},e.off=function(t,r){if(!this.listeners[t])return!1;var n=this.listeners[t].indexOf(r);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(n,1),n>-1},e.trigger=function(t){var r=this.listeners[t];if(r)if(arguments.length===2)for(var n=r.length,s=0;s<n;++s)r[s].call(this,arguments[1]);else for(var a=Array.prototype.slice.call(arguments,1),l=r.length,u=0;u<l;++u)r[u].apply(this,a)},e.dispose=function(){this.listeners={}},e.pipe=function(t){this.on("data",function(r){t.push(r)})},i}(),Ap={},xa={};xa.byteLength=sT;xa.toByteArray=oT;xa.fromByteArray=cT;var ii=[],Ut=[],rT=typeof Uint8Array<"u"?Uint8Array:Array,Eo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var vr=0,nT=Eo.length;vr<nT;++vr)ii[vr]=Eo[vr],Ut[Eo.charCodeAt(vr)]=vr;Ut[45]=62;Ut[95]=63;function xp(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function sT(i){var e=xp(i),t=e[0],r=e[1];return(t+r)*3/4-r}function aT(i,e,t){return(e+t)*3/4-t}function oT(i){var e,t=xp(i),r=t[0],n=t[1],s=new rT(aT(i,r,n)),a=0,l=n>0?r-4:r,u;for(u=0;u<l;u+=4)e=Ut[i.charCodeAt(u)]<<18|Ut[i.charCodeAt(u+1)]<<12|Ut[i.charCodeAt(u+2)]<<6|Ut[i.charCodeAt(u+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=Ut[i.charCodeAt(u)]<<2|Ut[i.charCodeAt(u+1)]>>4,s[a++]=e&255),n===1&&(e=Ut[i.charCodeAt(u)]<<10|Ut[i.charCodeAt(u+1)]<<4|Ut[i.charCodeAt(u+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function lT(i){return ii[i>>18&63]+ii[i>>12&63]+ii[i>>6&63]+ii[i&63]}function uT(i,e,t){for(var r,n=[],s=e;s<t;s+=3)r=(i[s]<<16&16711680)+(i[s+1]<<8&65280)+(i[s+2]&255),n.push(lT(r));return n.join("")}function cT(i){for(var e,t=i.length,r=t%3,n=[],s=16383,a=0,l=t-r;a<l;a+=s)n.push(uT(i,a,a+s>l?l:a+s));return r===1?(e=i[t-1],n.push(ii[e>>2]+ii[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(ii[e>>10]+ii[e>>4&63]+ii[e<<2&63]+"=")),n.join("")}var jl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */jl.read=function(i,e,t,r,n){var s,a,l=n*8-r-1,u=(1<<l)-1,p=u>>1,m=-7,_=t?n-1:0,S=t?-1:1,w=i[e+_];for(_+=S,s=w&(1<<-m)-1,w>>=-m,m+=l;m>0;s=s*256+i[e+_],_+=S,m-=8);for(a=s&(1<<-m)-1,s>>=-m,m+=r;m>0;a=a*256+i[e+_],_+=S,m-=8);if(s===0)s=1-p;else{if(s===u)return a?NaN:(w?-1:1)*(1/0);a=a+Math.pow(2,r),s=s-p}return(w?-1:1)*a*Math.pow(2,s-r)};jl.write=function(i,e,t,r,n,s){var a,l,u,p=s*8-n-1,m=(1<<p)-1,_=m>>1,S=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=r?0:s-1,C=r?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=m):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+_>=1?e+=S/u:e+=S*Math.pow(2,1-_),e*u>=2&&(a++,u/=2),a+_>=m?(l=0,a=m):a+_>=1?(l=(e*u-1)*Math.pow(2,n),a=a+_):(l=e*Math.pow(2,_-1)*Math.pow(2,n),a=0));n>=8;i[t+w]=l&255,w+=C,l/=256,n-=8);for(a=a<<n|l,p+=n;p>0;i[t+w]=a&255,w+=C,a/=256,p-=8);i[t+w-C]|=v*128};/*!
|
|
21
21
|
* The buffer module from node.js, for the browser.
|
|
22
22
|
*
|
|
23
23
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
24
24
|
* @license MIT
|
|
25
|
-
*/(function(i){const e=Ia,t=Fl,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=g,i.SlowBuffer=N,i.INSPECT_MAX_BYTES=50;const n=2147483647;i.kMaxLength=n;const{Uint8Array:s,ArrayBuffer:a,SharedArrayBuffer:l}=globalThis;g.TYPED_ARRAY_SUPPORT=u(),!g.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{const m=new s(1),_={foo:function(){return 42}};return Object.setPrototypeOf(_,s.prototype),Object.setPrototypeOf(m,_),m.foo()===42}catch{return!1}}Object.defineProperty(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}}),Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function p(m){if(m>n)throw new RangeError('The value "'+m+'" is invalid for option "size"');const _=new s(m);return Object.setPrototypeOf(_,g.prototype),_}function g(m,_,T){if(typeof m=="number"){if(typeof _=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return C(m)}return b(m,_,T)}g.poolSize=8192;function b(m,_,T){if(typeof m=="string")return v(m,_);if(a.isView(m))return L(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(pt(m,a)||m&&pt(m.buffer,a)||typeof l<"u"&&(pt(m,l)||m&&pt(m.buffer,l)))return O(m,_,T);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const P=m.valueOf&&m.valueOf();if(P!=null&&P!==m)return g.from(P,_,T);const M=U(m);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return g.from(m[Symbol.toPrimitive]("string"),_,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}g.from=function(m,_,T){return b(m,_,T)},Object.setPrototypeOf(g.prototype,s.prototype),Object.setPrototypeOf(g,s);function S(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function w(m,_,T){return S(m),m<=0?p(m):_!==void 0?typeof T=="string"?p(m).fill(_,T):p(m).fill(_):p(m)}g.alloc=function(m,_,T){return w(m,_,T)};function C(m){return S(m),p(m<0?0:F(m)|0)}g.allocUnsafe=function(m){return C(m)},g.allocUnsafeSlow=function(m){return C(m)};function v(m,_){if((typeof _!="string"||_==="")&&(_="utf8"),!g.isEncoding(_))throw new TypeError("Unknown encoding: "+_);const T=V(m,_)|0;let P=p(T);const M=P.write(m,_);return M!==T&&(P=P.slice(0,M)),P}function D(m){const _=m.length<0?0:F(m.length)|0,T=p(_);for(let P=0;P<_;P+=1)T[P]=m[P]&255;return T}function L(m){if(pt(m,s)){const _=new s(m);return O(_.buffer,_.byteOffset,_.byteLength)}return D(m)}function O(m,_,T){if(_<0||m.byteLength<_)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<_+(T||0))throw new RangeError('"length" is outside of buffer bounds');let P;return _===void 0&&T===void 0?P=new s(m):T===void 0?P=new s(m,_):P=new s(m,_,T),Object.setPrototypeOf(P,g.prototype),P}function U(m){if(g.isBuffer(m)){const _=F(m.length)|0,T=p(_);return T.length===0||m.copy(T,0,0,_),T}if(m.length!==void 0)return typeof m.length!="number"||qi(m.length)?p(0):D(m);if(m.type==="Buffer"&&Array.isArray(m.data))return D(m.data)}function F(m){if(m>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return m|0}function N(m){return+m!=m&&(m=0),g.alloc(+m)}g.isBuffer=function(m){return m!=null&&m._isBuffer===!0&&m!==g.prototype},g.compare=function(m,_){if(pt(m,s)&&(m=g.from(m,m.offset,m.byteLength)),pt(_,s)&&(_=g.from(_,_.offset,_.byteLength)),!g.isBuffer(m)||!g.isBuffer(_))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(m===_)return 0;let T=m.length,P=_.length;for(let M=0,H=Math.min(T,P);M<H;++M)if(m[M]!==_[M]){T=m[M],P=_[M];break}return T<P?-1:P<T?1:0},g.isEncoding=function(m){switch(String(m).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},g.concat=function(m,_){if(!Array.isArray(m))throw new TypeError('"list" argument must be an Array of Buffers');if(m.length===0)return g.alloc(0);let T;if(_===void 0)for(_=0,T=0;T<m.length;++T)_+=m[T].length;const P=g.allocUnsafe(_);let M=0;for(T=0;T<m.length;++T){let H=m[T];if(pt(H,s))M+H.length>P.length?(g.isBuffer(H)||(H=g.from(H)),H.copy(P,M)):s.prototype.set.call(P,H,M);else if(g.isBuffer(H))H.copy(P,M);else throw new TypeError('"list" argument must be an Array of Buffers');M+=H.length}return P};function V(m,_){if(g.isBuffer(m))return m.length;if(a.isView(m)||pt(m,a))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);const T=m.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&T===0)return 0;let M=!1;for(;;)switch(_){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return me(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return ns(m).length;default:if(M)return P?-1:me(m).length;_=(""+_).toLowerCase(),M=!0}}g.byteLength=V;function J(m,_,T){let P=!1;if((_===void 0||_<0)&&(_=0),_>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,_>>>=0,T<=_))return"";for(m||(m="utf8");;)switch(m){case"hex":return Ut(this,_,T);case"utf8":case"utf-8":return we(this,_,T);case"ascii":return Ot(this,_,T);case"latin1":case"binary":return ht(this,_,T);case"base64":return he(this,_,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vt(this,_,T);default:if(P)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),P=!0}}g.prototype._isBuffer=!0;function Y(m,_,T){const P=m[_];m[_]=m[T],m[T]=P}g.prototype.swap16=function(){const m=this.length;if(m%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let _=0;_<m;_+=2)Y(this,_,_+1);return this},g.prototype.swap32=function(){const m=this.length;if(m%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let _=0;_<m;_+=4)Y(this,_,_+3),Y(this,_+1,_+2);return this},g.prototype.swap64=function(){const m=this.length;if(m%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let _=0;_<m;_+=8)Y(this,_,_+7),Y(this,_+1,_+6),Y(this,_+2,_+5),Y(this,_+3,_+4);return this},g.prototype.toString=function(){const m=this.length;return m===0?"":arguments.length===0?we(this,0,m):J.apply(this,arguments)},g.prototype.toLocaleString=g.prototype.toString,g.prototype.equals=function(m){if(!g.isBuffer(m))throw new TypeError("Argument must be a Buffer");return this===m?!0:g.compare(this,m)===0},g.prototype.inspect=function(){let m="";const _=i.INSPECT_MAX_BYTES;return m=this.toString("hex",0,_).replace(/(.{2})/g,"$1 ").trim(),this.length>_&&(m+=" ... "),"<Buffer "+m+">"},r&&(g.prototype[r]=g.prototype.inspect),g.prototype.compare=function(m,_,T,P,M){if(pt(m,s)&&(m=g.from(m,m.offset,m.byteLength)),!g.isBuffer(m))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof m);if(_===void 0&&(_=0),T===void 0&&(T=m?m.length:0),P===void 0&&(P=0),M===void 0&&(M=this.length),_<0||T>m.length||P<0||M>this.length)throw new RangeError("out of range index");if(P>=M&&_>=T)return 0;if(P>=M)return-1;if(_>=T)return 1;if(_>>>=0,T>>>=0,P>>>=0,M>>>=0,this===m)return 0;let H=M-P,K=T-_;const Te=Math.min(H,K),We=this.slice(P,M),ke=m.slice(_,T);for(let be=0;be<Te;++be)if(We[be]!==ke[be]){H=We[be],K=ke[be];break}return H<K?-1:K<H?1:0};function ie(m,_,T,P,M){if(m.length===0)return-1;if(typeof T=="string"?(P=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,qi(T)&&(T=M?0:m.length-1),T<0&&(T=m.length+T),T>=m.length){if(M)return-1;T=m.length-1}else if(T<0)if(M)T=0;else return-1;if(typeof _=="string"&&(_=g.from(_,P)),g.isBuffer(_))return _.length===0?-1:pe(m,_,T,P,M);if(typeof _=="number")return _=_&255,typeof s.prototype.indexOf=="function"?M?s.prototype.indexOf.call(m,_,T):s.prototype.lastIndexOf.call(m,_,T):pe(m,[_],T,P,M);throw new TypeError("val must be string, number or Buffer")}function pe(m,_,T,P,M){let H=1,K=m.length,Te=_.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(m.length<2||_.length<2)return-1;H=2,K/=2,Te/=2,T/=2}function We(be,Ue){return H===1?be[Ue]:be.readUInt16BE(Ue*H)}let ke;if(M){let be=-1;for(ke=T;ke<K;ke++)if(We(m,ke)===We(_,be===-1?0:ke-be)){if(be===-1&&(be=ke),ke-be+1===Te)return be*H}else be!==-1&&(ke-=ke-be),be=-1}else for(T+Te>K&&(T=K-Te),ke=T;ke>=0;ke--){let be=!0;for(let Ue=0;Ue<Te;Ue++)if(We(m,ke+Ue)!==We(_,Ue)){be=!1;break}if(be)return ke}return-1}g.prototype.includes=function(m,_,T){return this.indexOf(m,_,T)!==-1},g.prototype.indexOf=function(m,_,T){return ie(this,m,_,T,!0)},g.prototype.lastIndexOf=function(m,_,T){return ie(this,m,_,T,!1)};function le(m,_,T,P){T=Number(T)||0;const M=m.length-T;P?(P=Number(P),P>M&&(P=M)):P=M;const H=_.length;P>H/2&&(P=H/2);let K;for(K=0;K<P;++K){const Te=parseInt(_.substr(K*2,2),16);if(qi(Te))return K;m[T+K]=Te}return K}function ge(m,_,T,P){return wi(me(_,m.length-T),m,T,P)}function ee(m,_,T,P){return wi(Ka(_),m,T,P)}function ce(m,_,T,P){return wi(ns(_),m,T,P)}function ne(m,_,T,P){return wi(en(_,m.length-T),m,T,P)}g.prototype.write=function(m,_,T,P){if(_===void 0)P="utf8",T=this.length,_=0;else if(T===void 0&&typeof _=="string")P=_,T=this.length,_=0;else if(isFinite(_))_=_>>>0,isFinite(T)?(T=T>>>0,P===void 0&&(P="utf8")):(P=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const M=this.length-_;if((T===void 0||T>M)&&(T=M),m.length>0&&(T<0||_<0)||_>this.length)throw new RangeError("Attempt to write outside buffer bounds");P||(P="utf8");let H=!1;for(;;)switch(P){case"hex":return le(this,m,_,T);case"utf8":case"utf-8":return ge(this,m,_,T);case"ascii":case"latin1":case"binary":return ee(this,m,_,T);case"base64":return ce(this,m,_,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ne(this,m,_,T);default:if(H)throw new TypeError("Unknown encoding: "+P);P=(""+P).toLowerCase(),H=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function he(m,_,T){return _===0&&T===m.length?e.fromByteArray(m):e.fromByteArray(m.slice(_,T))}function we(m,_,T){T=Math.min(m.length,T);const P=[];let M=_;for(;M<T;){const H=m[M];let K=null,Te=H>239?4:H>223?3:H>191?2:1;if(M+Te<=T){let We,ke,be,Ue;switch(Te){case 1:H<128&&(K=H);break;case 2:We=m[M+1],(We&192)===128&&(Ue=(H&31)<<6|We&63,Ue>127&&(K=Ue));break;case 3:We=m[M+1],ke=m[M+2],(We&192)===128&&(ke&192)===128&&(Ue=(H&15)<<12|(We&63)<<6|ke&63,Ue>2047&&(Ue<55296||Ue>57343)&&(K=Ue));break;case 4:We=m[M+1],ke=m[M+2],be=m[M+3],(We&192)===128&&(ke&192)===128&&(be&192)===128&&(Ue=(H&15)<<18|(We&63)<<12|(ke&63)<<6|be&63,Ue>65535&&Ue<1114112&&(K=Ue))}}K===null?(K=65533,Te=1):K>65535&&(K-=65536,P.push(K>>>10&1023|55296),K=56320|K&1023),P.push(K),M+=Te}return dt(P)}const ze=4096;function dt(m){const _=m.length;if(_<=ze)return String.fromCharCode.apply(String,m);let T="",P=0;for(;P<_;)T+=String.fromCharCode.apply(String,m.slice(P,P+=ze));return T}function Ot(m,_,T){let P="";T=Math.min(m.length,T);for(let M=_;M<T;++M)P+=String.fromCharCode(m[M]&127);return P}function ht(m,_,T){let P="";T=Math.min(m.length,T);for(let M=_;M<T;++M)P+=String.fromCharCode(m[M]);return P}function Ut(m,_,T){const P=m.length;(!_||_<0)&&(_=0),(!T||T<0||T>P)&&(T=P);let M="";for(let H=_;H<T;++H)M+=or[m[H]];return M}function Vt(m,_,T){const P=m.slice(_,T);let M="";for(let H=0;H<P.length-1;H+=2)M+=String.fromCharCode(P[H]+P[H+1]*256);return M}g.prototype.slice=function(m,_){const T=this.length;m=~~m,_=_===void 0?T:~~_,m<0?(m+=T,m<0&&(m=0)):m>T&&(m=T),_<0?(_+=T,_<0&&(_=0)):_>T&&(_=T),_<m&&(_=m);const P=this.subarray(m,_);return Object.setPrototypeOf(P,g.prototype),P};function xe(m,_,T){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+_>T)throw new RangeError("Trying to access beyond buffer length")}g.prototype.readUintLE=g.prototype.readUIntLE=function(m,_,T){m=m>>>0,_=_>>>0,T||xe(m,_,this.length);let P=this[m],M=1,H=0;for(;++H<_&&(M*=256);)P+=this[m+H]*M;return P},g.prototype.readUintBE=g.prototype.readUIntBE=function(m,_,T){m=m>>>0,_=_>>>0,T||xe(m,_,this.length);let P=this[m+--_],M=1;for(;_>0&&(M*=256);)P+=this[m+--_]*M;return P},g.prototype.readUint8=g.prototype.readUInt8=function(m,_){return m=m>>>0,_||xe(m,1,this.length),this[m]},g.prototype.readUint16LE=g.prototype.readUInt16LE=function(m,_){return m=m>>>0,_||xe(m,2,this.length),this[m]|this[m+1]<<8},g.prototype.readUint16BE=g.prototype.readUInt16BE=function(m,_){return m=m>>>0,_||xe(m,2,this.length),this[m]<<8|this[m+1]},g.prototype.readUint32LE=g.prototype.readUInt32LE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),(this[m]|this[m+1]<<8|this[m+2]<<16)+this[m+3]*16777216},g.prototype.readUint32BE=g.prototype.readUInt32BE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),this[m]*16777216+(this[m+1]<<16|this[m+2]<<8|this[m+3])},g.prototype.readBigUInt64LE=It(function(m){m=m>>>0,Ei(m,"offset");const _=this[m],T=this[m+7];(_===void 0||T===void 0)&&ji(m,this.length-8);const P=_+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24,M=this[++m]+this[++m]*2**8+this[++m]*2**16+T*2**24;return BigInt(P)+(BigInt(M)<<BigInt(32))}),g.prototype.readBigUInt64BE=It(function(m){m=m>>>0,Ei(m,"offset");const _=this[m],T=this[m+7];(_===void 0||T===void 0)&&ji(m,this.length-8);const P=_*2**24+this[++m]*2**16+this[++m]*2**8+this[++m],M=this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+T;return(BigInt(P)<<BigInt(32))+BigInt(M)}),g.prototype.readIntLE=function(m,_,T){m=m>>>0,_=_>>>0,T||xe(m,_,this.length);let P=this[m],M=1,H=0;for(;++H<_&&(M*=256);)P+=this[m+H]*M;return M*=128,P>=M&&(P-=Math.pow(2,8*_)),P},g.prototype.readIntBE=function(m,_,T){m=m>>>0,_=_>>>0,T||xe(m,_,this.length);let P=_,M=1,H=this[m+--P];for(;P>0&&(M*=256);)H+=this[m+--P]*M;return M*=128,H>=M&&(H-=Math.pow(2,8*_)),H},g.prototype.readInt8=function(m,_){return m=m>>>0,_||xe(m,1,this.length),this[m]&128?(255-this[m]+1)*-1:this[m]},g.prototype.readInt16LE=function(m,_){m=m>>>0,_||xe(m,2,this.length);const T=this[m]|this[m+1]<<8;return T&32768?T|4294901760:T},g.prototype.readInt16BE=function(m,_){m=m>>>0,_||xe(m,2,this.length);const T=this[m+1]|this[m]<<8;return T&32768?T|4294901760:T},g.prototype.readInt32LE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),this[m]|this[m+1]<<8|this[m+2]<<16|this[m+3]<<24},g.prototype.readInt32BE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),this[m]<<24|this[m+1]<<16|this[m+2]<<8|this[m+3]},g.prototype.readBigInt64LE=It(function(m){m=m>>>0,Ei(m,"offset");const _=this[m],T=this[m+7];(_===void 0||T===void 0)&&ji(m,this.length-8);const P=this[m+4]+this[m+5]*2**8+this[m+6]*2**16+(T<<24);return(BigInt(P)<<BigInt(32))+BigInt(_+this[++m]*2**8+this[++m]*2**16+this[++m]*2**24)}),g.prototype.readBigInt64BE=It(function(m){m=m>>>0,Ei(m,"offset");const _=this[m],T=this[m+7];(_===void 0||T===void 0)&&ji(m,this.length-8);const P=(_<<24)+this[++m]*2**16+this[++m]*2**8+this[++m];return(BigInt(P)<<BigInt(32))+BigInt(this[++m]*2**24+this[++m]*2**16+this[++m]*2**8+T)}),g.prototype.readFloatLE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),t.read(this,m,!0,23,4)},g.prototype.readFloatBE=function(m,_){return m=m>>>0,_||xe(m,4,this.length),t.read(this,m,!1,23,4)},g.prototype.readDoubleLE=function(m,_){return m=m>>>0,_||xe(m,8,this.length),t.read(this,m,!0,52,8)},g.prototype.readDoubleBE=function(m,_){return m=m>>>0,_||xe(m,8,this.length),t.read(this,m,!1,52,8)};function Fe(m,_,T,P,M,H){if(!g.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(_>M||_<H)throw new RangeError('"value" argument is out of bounds');if(T+P>m.length)throw new RangeError("Index out of range")}g.prototype.writeUintLE=g.prototype.writeUIntLE=function(m,_,T,P){if(m=+m,_=_>>>0,T=T>>>0,!P){const K=Math.pow(2,8*T)-1;Fe(this,m,_,T,K,0)}let M=1,H=0;for(this[_]=m&255;++H<T&&(M*=256);)this[_+H]=m/M&255;return _+T},g.prototype.writeUintBE=g.prototype.writeUIntBE=function(m,_,T,P){if(m=+m,_=_>>>0,T=T>>>0,!P){const K=Math.pow(2,8*T)-1;Fe(this,m,_,T,K,0)}let M=T-1,H=1;for(this[_+M]=m&255;--M>=0&&(H*=256);)this[_+M]=m/H&255;return _+T},g.prototype.writeUint8=g.prototype.writeUInt8=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,1,255,0),this[_]=m&255,_+1},g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,2,65535,0),this[_]=m&255,this[_+1]=m>>>8,_+2},g.prototype.writeUint16BE=g.prototype.writeUInt16BE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,2,65535,0),this[_]=m>>>8,this[_+1]=m&255,_+2},g.prototype.writeUint32LE=g.prototype.writeUInt32LE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,4,4294967295,0),this[_+3]=m>>>24,this[_+2]=m>>>16,this[_+1]=m>>>8,this[_]=m&255,_+4},g.prototype.writeUint32BE=g.prototype.writeUInt32BE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,4,4294967295,0),this[_]=m>>>24,this[_+1]=m>>>16,this[_+2]=m>>>8,this[_+3]=m&255,_+4};function oi(m,_,T,P,M){rs(_,P,M,m,T,7);let H=Number(_&BigInt(4294967295));m[T++]=H,H=H>>8,m[T++]=H,H=H>>8,m[T++]=H,H=H>>8,m[T++]=H;let K=Number(_>>BigInt(32)&BigInt(4294967295));return m[T++]=K,K=K>>8,m[T++]=K,K=K>>8,m[T++]=K,K=K>>8,m[T++]=K,T}function Fi(m,_,T,P,M){rs(_,P,M,m,T,7);let H=Number(_&BigInt(4294967295));m[T+7]=H,H=H>>8,m[T+6]=H,H=H>>8,m[T+5]=H,H=H>>8,m[T+4]=H;let K=Number(_>>BigInt(32)&BigInt(4294967295));return m[T+3]=K,K=K>>8,m[T+2]=K,K=K>>8,m[T+1]=K,K=K>>8,m[T]=K,T+8}g.prototype.writeBigUInt64LE=It(function(m,_=0){return oi(this,m,_,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeBigUInt64BE=It(function(m,_=0){return Fi(this,m,_,BigInt(0),BigInt("0xffffffffffffffff"))}),g.prototype.writeIntLE=function(m,_,T,P){if(m=+m,_=_>>>0,!P){const Te=Math.pow(2,8*T-1);Fe(this,m,_,T,Te-1,-Te)}let M=0,H=1,K=0;for(this[_]=m&255;++M<T&&(H*=256);)m<0&&K===0&&this[_+M-1]!==0&&(K=1),this[_+M]=(m/H>>0)-K&255;return _+T},g.prototype.writeIntBE=function(m,_,T,P){if(m=+m,_=_>>>0,!P){const Te=Math.pow(2,8*T-1);Fe(this,m,_,T,Te-1,-Te)}let M=T-1,H=1,K=0;for(this[_+M]=m&255;--M>=0&&(H*=256);)m<0&&K===0&&this[_+M+1]!==0&&(K=1),this[_+M]=(m/H>>0)-K&255;return _+T},g.prototype.writeInt8=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,1,127,-128),m<0&&(m=255+m+1),this[_]=m&255,_+1},g.prototype.writeInt16LE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,2,32767,-32768),this[_]=m&255,this[_+1]=m>>>8,_+2},g.prototype.writeInt16BE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,2,32767,-32768),this[_]=m>>>8,this[_+1]=m&255,_+2},g.prototype.writeInt32LE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,4,2147483647,-2147483648),this[_]=m&255,this[_+1]=m>>>8,this[_+2]=m>>>16,this[_+3]=m>>>24,_+4},g.prototype.writeInt32BE=function(m,_,T){return m=+m,_=_>>>0,T||Fe(this,m,_,4,2147483647,-2147483648),m<0&&(m=4294967295+m+1),this[_]=m>>>24,this[_+1]=m>>>16,this[_+2]=m>>>8,this[_+3]=m&255,_+4},g.prototype.writeBigInt64LE=It(function(m,_=0){return oi(this,m,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),g.prototype.writeBigInt64BE=It(function(m,_=0){return Fi(this,m,_,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function li(m,_,T,P,M,H){if(T+P>m.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function Ht(m,_,T,P,M){return _=+_,T=T>>>0,M||li(m,_,T,4),t.write(m,_,T,P,23,4),T+4}g.prototype.writeFloatLE=function(m,_,T){return Ht(this,m,_,!0,T)},g.prototype.writeFloatBE=function(m,_,T){return Ht(this,m,_,!1,T)};function Ti(m,_,T,P,M){return _=+_,T=T>>>0,M||li(m,_,T,8),t.write(m,_,T,P,52,8),T+8}g.prototype.writeDoubleLE=function(m,_,T){return Ti(this,m,_,!0,T)},g.prototype.writeDoubleBE=function(m,_,T){return Ti(this,m,_,!1,T)},g.prototype.copy=function(m,_,T,P){if(!g.isBuffer(m))throw new TypeError("argument should be a Buffer");if(T||(T=0),!P&&P!==0&&(P=this.length),_>=m.length&&(_=m.length),_||(_=0),P>0&&P<T&&(P=T),P===T||m.length===0||this.length===0)return 0;if(_<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("sourceEnd out of bounds");P>this.length&&(P=this.length),m.length-_<P-T&&(P=m.length-_+T);const M=P-T;return this===m&&typeof s.prototype.copyWithin=="function"?this.copyWithin(_,T,P):s.prototype.set.call(m,this.subarray(T,P),_),M},g.prototype.fill=function(m,_,T,P){if(typeof m=="string"){if(typeof _=="string"?(P=_,_=0,T=this.length):typeof T=="string"&&(P=T,T=this.length),P!==void 0&&typeof P!="string")throw new TypeError("encoding must be a string");if(typeof P=="string"&&!g.isEncoding(P))throw new TypeError("Unknown encoding: "+P);if(m.length===1){const H=m.charCodeAt(0);(P==="utf8"&&H<128||P==="latin1")&&(m=H)}}else typeof m=="number"?m=m&255:typeof m=="boolean"&&(m=Number(m));if(_<0||this.length<_||this.length<T)throw new RangeError("Out of range index");if(T<=_)return this;_=_>>>0,T=T===void 0?this.length:T>>>0,m||(m=0);let M;if(typeof m=="number")for(M=_;M<T;++M)this[M]=m;else{const H=g.isBuffer(m)?m:g.from(m,P),K=H.length;if(K===0)throw new TypeError('The value "'+m+'" is invalid for argument "value"');for(M=0;M<T-_;++M)this[M+_]=H[M%K]}return this};const Si={};function ar(m,_,T){Si[m]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:_.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(P){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:P,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}ar("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ar("ERR_INVALID_ARG_TYPE",function(m,_){return`The "${m}" argument must be of type number. Received type ${typeof _}`},TypeError),ar("ERR_OUT_OF_RANGE",function(m,_,T){let P=`The value of "${m}" is out of range.`,M=T;return Number.isInteger(T)&&Math.abs(T)>2**32?M=is(String(T)):typeof T=="bigint"&&(M=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(M=is(M)),M+="n"),P+=` It must be ${_}. Received ${M}`,P},RangeError);function is(m){let _="",T=m.length;const P=m[0]==="-"?1:0;for(;T>=P+4;T-=3)_=`_${m.slice(T-3,T)}${_}`;return`${m.slice(0,T)}${_}`}function Xa(m,_,T){Ei(_,"offset"),(m[_]===void 0||m[_+T]===void 0)&&ji(_,m.length-(T+1))}function rs(m,_,T,P,M,H){if(m>T||m<_){const K=typeof _=="bigint"?"n":"";let Te;throw _===0||_===BigInt(0)?Te=`>= 0${K} and < 2${K} ** ${(H+1)*8}${K}`:Te=`>= -(2${K} ** ${(H+1)*8-1}${K}) and < 2 ** ${(H+1)*8-1}${K}`,new Si.ERR_OUT_OF_RANGE("value",Te,m)}Xa(P,M,H)}function Ei(m,_){if(typeof m!="number")throw new Si.ERR_INVALID_ARG_TYPE(_,"number",m)}function ji(m,_,T){throw Math.floor(m)!==m?(Ei(m,T),new Si.ERR_OUT_OF_RANGE("offset","an integer",m)):_<0?new Si.ERR_BUFFER_OUT_OF_BOUNDS:new Si.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${_}`,m)}const zt=/[^+/0-9A-Za-z-_]/g;function Zr(m){if(m=m.split("=")[0],m=m.trim().replace(zt,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function me(m,_){_=_||1/0;let T;const P=m.length;let M=null;const H=[];for(let K=0;K<P;++K){if(T=m.charCodeAt(K),T>55295&&T<57344){if(!M){if(T>56319){(_-=3)>-1&&H.push(239,191,189);continue}else if(K+1===P){(_-=3)>-1&&H.push(239,191,189);continue}M=T;continue}if(T<56320){(_-=3)>-1&&H.push(239,191,189),M=T;continue}T=(M-55296<<10|T-56320)+65536}else M&&(_-=3)>-1&&H.push(239,191,189);if(M=null,T<128){if((_-=1)<0)break;H.push(T)}else if(T<2048){if((_-=2)<0)break;H.push(T>>6|192,T&63|128)}else if(T<65536){if((_-=3)<0)break;H.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((_-=4)<0)break;H.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return H}function Ka(m){const _=[];for(let T=0;T<m.length;++T)_.push(m.charCodeAt(T)&255);return _}function en(m,_){let T,P,M;const H=[];for(let K=0;K<m.length&&!((_-=2)<0);++K)T=m.charCodeAt(K),P=T>>8,M=T%256,H.push(M),H.push(P);return H}function ns(m){return e.toByteArray(Zr(m))}function wi(m,_,T,P){let M;for(M=0;M<P&&!(M+T>=_.length||M>=m.length);++M)_[M+T]=m[M];return M}function pt(m,_){return m instanceof _||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===_.name}function qi(m){return m!==m}const or=function(){const m="0123456789abcdef",_=new Array(256);for(let T=0;T<16;++T){const P=T*16;for(let M=0;M<16;++M)_[P+M]=m[T]+m[M]}return _}();function It(m){return typeof BigInt>"u"?ss:m}function ss(){throw new Error("BigInt not supported")}})(Tp);const Yv=Tp.Buffer;var Qv=function(i){return x.atob?x.atob(i):Yv.from(i,"base64").toString("binary")};function Ep(i){for(var e=Qv(i),t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class Jv extends Bl{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
25
|
+
*/(function(i){const e=xa,t=jl,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=m,i.SlowBuffer=R,i.INSPECT_MAX_BYTES=50;const n=2147483647;i.kMaxLength=n;const{Uint8Array:s,ArrayBuffer:a,SharedArrayBuffer:l}=globalThis;m.TYPED_ARRAY_SUPPORT=u(),!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function u(){try{const g=new s(1),b={foo:function(){return 42}};return Object.setPrototypeOf(b,s.prototype),Object.setPrototypeOf(g,b),g.foo()===42}catch{return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.buffer}}),Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.byteOffset}});function p(g){if(g>n)throw new RangeError('The value "'+g+'" is invalid for option "size"');const b=new s(g);return Object.setPrototypeOf(b,m.prototype),b}function m(g,b,T){if(typeof g=="number"){if(typeof b=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return C(g)}return _(g,b,T)}m.poolSize=8192;function _(g,b,T){if(typeof g=="string")return v(g,b);if(a.isView(g))return D(g);if(g==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof g);if(gt(g,a)||g&>(g.buffer,a)||typeof l<"u"&&(gt(g,l)||g&>(g.buffer,l)))return O(g,b,T);if(typeof g=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const P=g.valueOf&&g.valueOf();if(P!=null&&P!==g)return m.from(P,b,T);const M=U(g);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof g[Symbol.toPrimitive]=="function")return m.from(g[Symbol.toPrimitive]("string"),b,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof g)}m.from=function(g,b,T){return _(g,b,T)},Object.setPrototypeOf(m.prototype,s.prototype),Object.setPrototypeOf(m,s);function S(g){if(typeof g!="number")throw new TypeError('"size" argument must be of type number');if(g<0)throw new RangeError('The value "'+g+'" is invalid for option "size"')}function w(g,b,T){return S(g),g<=0?p(g):b!==void 0?typeof T=="string"?p(g).fill(b,T):p(g).fill(b):p(g)}m.alloc=function(g,b,T){return w(g,b,T)};function C(g){return S(g),p(g<0?0:F(g)|0)}m.allocUnsafe=function(g){return C(g)},m.allocUnsafeSlow=function(g){return C(g)};function v(g,b){if((typeof b!="string"||b==="")&&(b="utf8"),!m.isEncoding(b))throw new TypeError("Unknown encoding: "+b);const T=q(g,b)|0;let P=p(T);const M=P.write(g,b);return M!==T&&(P=P.slice(0,M)),P}function L(g){const b=g.length<0?0:F(g.length)|0,T=p(b);for(let P=0;P<b;P+=1)T[P]=g[P]&255;return T}function D(g){if(gt(g,s)){const b=new s(g);return O(b.buffer,b.byteOffset,b.byteLength)}return L(g)}function O(g,b,T){if(b<0||g.byteLength<b)throw new RangeError('"offset" is outside of buffer bounds');if(g.byteLength<b+(T||0))throw new RangeError('"length" is outside of buffer bounds');let P;return b===void 0&&T===void 0?P=new s(g):T===void 0?P=new s(g,b):P=new s(g,b,T),Object.setPrototypeOf(P,m.prototype),P}function U(g){if(m.isBuffer(g)){const b=F(g.length)|0,T=p(b);return T.length===0||g.copy(T,0,0,b),T}if(g.length!==void 0)return typeof g.length!="number"||zi(g.length)?p(0):L(g);if(g.type==="Buffer"&&Array.isArray(g.data))return L(g.data)}function F(g){if(g>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return g|0}function R(g){return+g!=g&&(g=0),m.alloc(+g)}m.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==m.prototype},m.compare=function(g,b){if(gt(g,s)&&(g=m.from(g,g.offset,g.byteLength)),gt(b,s)&&(b=m.from(b,b.offset,b.byteLength)),!m.isBuffer(g)||!m.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===b)return 0;let T=g.length,P=b.length;for(let M=0,V=Math.min(T,P);M<V;++M)if(g[M]!==b[M]){T=g[M],P=b[M];break}return T<P?-1:P<T?1:0},m.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},m.concat=function(g,b){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return m.alloc(0);let T;if(b===void 0)for(b=0,T=0;T<g.length;++T)b+=g[T].length;const P=m.allocUnsafe(b);let M=0;for(T=0;T<g.length;++T){let V=g[T];if(gt(V,s))M+V.length>P.length?(m.isBuffer(V)||(V=m.from(V)),V.copy(P,M)):s.prototype.set.call(P,V,M);else if(m.isBuffer(V))V.copy(P,M);else throw new TypeError('"list" argument must be an Array of Buffers');M+=V.length}return P};function q(g,b){if(m.isBuffer(g))return g.length;if(a.isView(g)||gt(g,a))return g.byteLength;if(typeof g!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof g);const T=g.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&T===0)return 0;let M=!1;for(;;)switch(b){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return fe(g).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return as(g).length;default:if(M)return P?-1:fe(g).length;b=(""+b).toLowerCase(),M=!0}}m.byteLength=q;function J(g,b,T){let P=!1;if((b===void 0||b<0)&&(b=0),b>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,b>>>=0,T<=b))return"";for(g||(g="utf8");;)switch(g){case"hex":return kt(this,b,T);case"utf8":case"utf-8":return be(this,b,T);case"ascii":return ve(this,b,T);case"latin1":case"binary":return ye(this,b,T);case"base64":return de(this,b,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,b,T);default:if(P)throw new TypeError("Unknown encoding: "+g);g=(g+"").toLowerCase(),P=!0}}m.prototype._isBuffer=!0;function Y(g,b,T){const P=g[b];g[b]=g[T],g[T]=P}m.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;b<g;b+=2)Y(this,b,b+1);return this},m.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let b=0;b<g;b+=4)Y(this,b,b+3),Y(this,b+1,b+2);return this},m.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let b=0;b<g;b+=8)Y(this,b,b+7),Y(this,b+1,b+6),Y(this,b+2,b+5),Y(this,b+3,b+4);return this},m.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?be(this,0,g):J.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(g){if(!m.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:m.compare(this,g)===0},m.prototype.inspect=function(){let g="";const b=i.INSPECT_MAX_BYTES;return g=this.toString("hex",0,b).replace(/(.{2})/g,"$1 ").trim(),this.length>b&&(g+=" ... "),"<Buffer "+g+">"},r&&(m.prototype[r]=m.prototype.inspect),m.prototype.compare=function(g,b,T,P,M){if(gt(g,s)&&(g=m.from(g,g.offset,g.byteLength)),!m.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(b===void 0&&(b=0),T===void 0&&(T=g?g.length:0),P===void 0&&(P=0),M===void 0&&(M=this.length),b<0||T>g.length||P<0||M>this.length)throw new RangeError("out of range index");if(P>=M&&b>=T)return 0;if(P>=M)return-1;if(b>=T)return 1;if(b>>>=0,T>>>=0,P>>>=0,M>>>=0,this===g)return 0;let V=M-P,K=T-b;const ke=Math.min(V,K),Ke=this.slice(P,M),xe=g.slice(b,T);for(let Ee=0;Ee<ke;++Ee)if(Ke[Ee]!==xe[Ee]){V=Ke[Ee],K=xe[Ee];break}return V<K?-1:K<V?1:0};function ie(g,b,T,P,M){if(g.length===0)return-1;if(typeof T=="string"?(P=T,T=0):T>2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,zi(T)&&(T=M?0:g.length-1),T<0&&(T=g.length+T),T>=g.length){if(M)return-1;T=g.length-1}else if(T<0)if(M)T=0;else return-1;if(typeof b=="string"&&(b=m.from(b,P)),m.isBuffer(b))return b.length===0?-1:me(g,b,T,P,M);if(typeof b=="number")return b=b&255,typeof s.prototype.indexOf=="function"?M?s.prototype.indexOf.call(g,b,T):s.prototype.lastIndexOf.call(g,b,T):me(g,[b],T,P,M);throw new TypeError("val must be string, number or Buffer")}function me(g,b,T,P,M){let V=1,K=g.length,ke=b.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(g.length<2||b.length<2)return-1;V=2,K/=2,ke/=2,T/=2}function Ke(Ee,qe){return V===1?Ee[qe]:Ee.readUInt16BE(qe*V)}let xe;if(M){let Ee=-1;for(xe=T;xe<K;xe++)if(Ke(g,xe)===Ke(b,Ee===-1?0:xe-Ee)){if(Ee===-1&&(Ee=xe),xe-Ee+1===ke)return Ee*V}else Ee!==-1&&(xe-=xe-Ee),Ee=-1}else for(T+ke>K&&(T=K-ke),xe=T;xe>=0;xe--){let Ee=!0;for(let qe=0;qe<ke;qe++)if(Ke(g,xe+qe)!==Ke(b,qe)){Ee=!1;break}if(Ee)return xe}return-1}m.prototype.includes=function(g,b,T){return this.indexOf(g,b,T)!==-1},m.prototype.indexOf=function(g,b,T){return ie(this,g,b,T,!0)},m.prototype.lastIndexOf=function(g,b,T){return ie(this,g,b,T,!1)};function oe(g,b,T,P){T=Number(T)||0;const M=g.length-T;P?(P=Number(P),P>M&&(P=M)):P=M;const V=b.length;P>V/2&&(P=V/2);let K;for(K=0;K<P;++K){const ke=parseInt(b.substr(K*2,2),16);if(zi(ke))return K;g[T+K]=ke}return K}function ge(g,b,T,P){return Ii(fe(b,g.length-T),g,T,P)}function ee(g,b,T,P){return Ii(Ya(b),g,T,P)}function ue(g,b,T,P){return Ii(as(b),g,T,P)}function te(g,b,T,P){return Ii(sn(b,g.length-T),g,T,P)}m.prototype.write=function(g,b,T,P){if(b===void 0)P="utf8",T=this.length,b=0;else if(T===void 0&&typeof b=="string")P=b,T=this.length,b=0;else if(isFinite(b))b=b>>>0,isFinite(T)?(T=T>>>0,P===void 0&&(P="utf8")):(P=T,T=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const M=this.length-b;if((T===void 0||T>M)&&(T=M),g.length>0&&(T<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");P||(P="utf8");let V=!1;for(;;)switch(P){case"hex":return oe(this,g,b,T);case"utf8":case"utf-8":return ge(this,g,b,T);case"ascii":case"latin1":case"binary":return ee(this,g,b,T);case"base64":return ue(this,g,b,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return te(this,g,b,T);default:if(V)throw new TypeError("Unknown encoding: "+P);P=(""+P).toLowerCase(),V=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(g,b,T){return b===0&&T===g.length?e.fromByteArray(g):e.fromByteArray(g.slice(b,T))}function be(g,b,T){T=Math.min(g.length,T);const P=[];let M=b;for(;M<T;){const V=g[M];let K=null,ke=V>239?4:V>223?3:V>191?2:1;if(M+ke<=T){let Ke,xe,Ee,qe;switch(ke){case 1:V<128&&(K=V);break;case 2:Ke=g[M+1],(Ke&192)===128&&(qe=(V&31)<<6|Ke&63,qe>127&&(K=qe));break;case 3:Ke=g[M+1],xe=g[M+2],(Ke&192)===128&&(xe&192)===128&&(qe=(V&15)<<12|(Ke&63)<<6|xe&63,qe>2047&&(qe<55296||qe>57343)&&(K=qe));break;case 4:Ke=g[M+1],xe=g[M+2],Ee=g[M+3],(Ke&192)===128&&(xe&192)===128&&(Ee&192)===128&&(qe=(V&15)<<18|(Ke&63)<<12|(xe&63)<<6|Ee&63,qe>65535&&qe<1114112&&(K=qe))}}K===null?(K=65533,ke=1):K>65535&&(K-=65536,P.push(K>>>10&1023|55296),K=56320|K&1023),P.push(K),M+=ke}return Ye(P)}const je=4096;function Ye(g){const b=g.length;if(b<=je)return String.fromCharCode.apply(String,g);let T="",P=0;for(;P<b;)T+=String.fromCharCode.apply(String,g.slice(P,P+=je));return T}function ve(g,b,T){let P="";T=Math.min(g.length,T);for(let M=b;M<T;++M)P+=String.fromCharCode(g[M]&127);return P}function ye(g,b,T){let P="";T=Math.min(g.length,T);for(let M=b;M<T;++M)P+=String.fromCharCode(g[M]);return P}function kt(g,b,T){const P=g.length;(!b||b<0)&&(b=0),(!T||T<0||T>P)&&(T=P);let M="";for(let V=b;V<T;++V)M+=dr[g[V]];return M}function Pt(g,b,T){const P=g.slice(b,T);let M="";for(let V=0;V<P.length-1;V+=2)M+=String.fromCharCode(P[V]+P[V+1]*256);return M}m.prototype.slice=function(g,b){const T=this.length;g=~~g,b=b===void 0?T:~~b,g<0?(g+=T,g<0&&(g=0)):g>T&&(g=T),b<0?(b+=T,b<0&&(b=0)):b>T&&(b=T),b<g&&(b=g);const P=this.subarray(g,b);return Object.setPrototypeOf(P,m.prototype),P};function Ae(g,b,T){if(g%1!==0||g<0)throw new RangeError("offset is not uint");if(g+b>T)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(g,b,T){g=g>>>0,b=b>>>0,T||Ae(g,b,this.length);let P=this[g],M=1,V=0;for(;++V<b&&(M*=256);)P+=this[g+V]*M;return P},m.prototype.readUintBE=m.prototype.readUIntBE=function(g,b,T){g=g>>>0,b=b>>>0,T||Ae(g,b,this.length);let P=this[g+--b],M=1;for(;b>0&&(M*=256);)P+=this[g+--b]*M;return P},m.prototype.readUint8=m.prototype.readUInt8=function(g,b){return g=g>>>0,b||Ae(g,1,this.length),this[g]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(g,b){return g=g>>>0,b||Ae(g,2,this.length),this[g]|this[g+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(g,b){return g=g>>>0,b||Ae(g,2,this.length),this[g]<<8|this[g+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},m.prototype.readBigUInt64LE=Rt(function(g){g=g>>>0,qt(g,"offset");const b=this[g],T=this[g+7];(b===void 0||T===void 0)&&Hi(g,this.length-8);const P=b+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,M=this[++g]+this[++g]*2**8+this[++g]*2**16+T*2**24;return BigInt(P)+(BigInt(M)<<BigInt(32))}),m.prototype.readBigUInt64BE=Rt(function(g){g=g>>>0,qt(g,"offset");const b=this[g],T=this[g+7];(b===void 0||T===void 0)&&Hi(g,this.length-8);const P=b*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],M=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+T;return(BigInt(P)<<BigInt(32))+BigInt(M)}),m.prototype.readIntLE=function(g,b,T){g=g>>>0,b=b>>>0,T||Ae(g,b,this.length);let P=this[g],M=1,V=0;for(;++V<b&&(M*=256);)P+=this[g+V]*M;return M*=128,P>=M&&(P-=Math.pow(2,8*b)),P},m.prototype.readIntBE=function(g,b,T){g=g>>>0,b=b>>>0,T||Ae(g,b,this.length);let P=b,M=1,V=this[g+--P];for(;P>0&&(M*=256);)V+=this[g+--P]*M;return M*=128,V>=M&&(V-=Math.pow(2,8*b)),V},m.prototype.readInt8=function(g,b){return g=g>>>0,b||Ae(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},m.prototype.readInt16LE=function(g,b){g=g>>>0,b||Ae(g,2,this.length);const T=this[g]|this[g+1]<<8;return T&32768?T|4294901760:T},m.prototype.readInt16BE=function(g,b){g=g>>>0,b||Ae(g,2,this.length);const T=this[g+1]|this[g]<<8;return T&32768?T|4294901760:T},m.prototype.readInt32LE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},m.prototype.readInt32BE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},m.prototype.readBigInt64LE=Rt(function(g){g=g>>>0,qt(g,"offset");const b=this[g],T=this[g+7];(b===void 0||T===void 0)&&Hi(g,this.length-8);const P=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(T<<24);return(BigInt(P)<<BigInt(32))+BigInt(b+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),m.prototype.readBigInt64BE=Rt(function(g){g=g>>>0,qt(g,"offset");const b=this[g],T=this[g+7];(b===void 0||T===void 0)&&Hi(g,this.length-8);const P=(b<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(P)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+T)}),m.prototype.readFloatLE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),t.read(this,g,!0,23,4)},m.prototype.readFloatBE=function(g,b){return g=g>>>0,b||Ae(g,4,this.length),t.read(this,g,!1,23,4)},m.prototype.readDoubleLE=function(g,b){return g=g>>>0,b||Ae(g,8,this.length),t.read(this,g,!0,52,8)},m.prototype.readDoubleBE=function(g,b){return g=g>>>0,b||Ae(g,8,this.length),t.read(this,g,!1,52,8)};function pe(g,b,T,P,M,V){if(!m.isBuffer(g))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>M||b<V)throw new RangeError('"value" argument is out of bounds');if(T+P>g.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(g,b,T,P){if(g=+g,b=b>>>0,T=T>>>0,!P){const K=Math.pow(2,8*T)-1;pe(this,g,b,T,K,0)}let M=1,V=0;for(this[b]=g&255;++V<T&&(M*=256);)this[b+V]=g/M&255;return b+T},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(g,b,T,P){if(g=+g,b=b>>>0,T=T>>>0,!P){const K=Math.pow(2,8*T)-1;pe(this,g,b,T,K,0)}let M=T-1,V=1;for(this[b+M]=g&255;--M>=0&&(V*=256);)this[b+M]=g/V&255;return b+T},m.prototype.writeUint8=m.prototype.writeUInt8=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,1,255,0),this[b]=g&255,b+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,2,65535,0),this[b]=g&255,this[b+1]=g>>>8,b+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,2,65535,0),this[b]=g>>>8,this[b+1]=g&255,b+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,4,4294967295,0),this[b+3]=g>>>24,this[b+2]=g>>>16,this[b+1]=g>>>8,this[b]=g&255,b+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,4,4294967295,0),this[b]=g>>>24,this[b+1]=g>>>16,this[b+2]=g>>>8,this[b+3]=g&255,b+4};function $e(g,b,T,P,M){$t(b,P,M,g,T,7);let V=Number(b&BigInt(4294967295));g[T++]=V,V=V>>8,g[T++]=V,V=V>>8,g[T++]=V,V=V>>8,g[T++]=V;let K=Number(b>>BigInt(32)&BigInt(4294967295));return g[T++]=K,K=K>>8,g[T++]=K,K=K>>8,g[T++]=K,K=K>>8,g[T++]=K,T}function cr(g,b,T,P,M){$t(b,P,M,g,T,7);let V=Number(b&BigInt(4294967295));g[T+7]=V,V=V>>8,g[T+6]=V,V=V>>8,g[T+5]=V,V=V>>8,g[T+4]=V;let K=Number(b>>BigInt(32)&BigInt(4294967295));return g[T+3]=K,K=K>>8,g[T+2]=K,K=K>>8,g[T+1]=K,K=K>>8,g[T]=K,T+8}m.prototype.writeBigUInt64LE=Rt(function(g,b=0){return $e(this,g,b,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=Rt(function(g,b=0){return cr(this,g,b,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(g,b,T,P){if(g=+g,b=b>>>0,!P){const ke=Math.pow(2,8*T-1);pe(this,g,b,T,ke-1,-ke)}let M=0,V=1,K=0;for(this[b]=g&255;++M<T&&(V*=256);)g<0&&K===0&&this[b+M-1]!==0&&(K=1),this[b+M]=(g/V>>0)-K&255;return b+T},m.prototype.writeIntBE=function(g,b,T,P){if(g=+g,b=b>>>0,!P){const ke=Math.pow(2,8*T-1);pe(this,g,b,T,ke-1,-ke)}let M=T-1,V=1,K=0;for(this[b+M]=g&255;--M>=0&&(V*=256);)g<0&&K===0&&this[b+M+1]!==0&&(K=1),this[b+M]=(g/V>>0)-K&255;return b+T},m.prototype.writeInt8=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,1,127,-128),g<0&&(g=255+g+1),this[b]=g&255,b+1},m.prototype.writeInt16LE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,2,32767,-32768),this[b]=g&255,this[b+1]=g>>>8,b+2},m.prototype.writeInt16BE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,2,32767,-32768),this[b]=g>>>8,this[b+1]=g&255,b+2},m.prototype.writeInt32LE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,4,2147483647,-2147483648),this[b]=g&255,this[b+1]=g>>>8,this[b+2]=g>>>16,this[b+3]=g>>>24,b+4},m.prototype.writeInt32BE=function(g,b,T){return g=+g,b=b>>>0,T||pe(this,g,b,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[b]=g>>>24,this[b+1]=g>>>16,this[b+2]=g>>>8,this[b+3]=g&255,b+4},m.prototype.writeBigInt64LE=Rt(function(g,b=0){return $e(this,g,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=Rt(function(g,b=0){return cr(this,g,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function wi(g,b,T,P,M,V){if(T+P>g.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function ki(g,b,T,P,M){return b=+b,T=T>>>0,M||wi(g,b,T,4),t.write(g,b,T,P,23,4),T+4}m.prototype.writeFloatLE=function(g,b,T){return ki(this,g,b,!0,T)},m.prototype.writeFloatBE=function(g,b,T){return ki(this,g,b,!1,T)};function qi(g,b,T,P,M){return b=+b,T=T>>>0,M||wi(g,b,T,8),t.write(g,b,T,P,52,8),T+8}m.prototype.writeDoubleLE=function(g,b,T){return qi(this,g,b,!0,T)},m.prototype.writeDoubleBE=function(g,b,T){return qi(this,g,b,!1,T)},m.prototype.copy=function(g,b,T,P){if(!m.isBuffer(g))throw new TypeError("argument should be a Buffer");if(T||(T=0),!P&&P!==0&&(P=this.length),b>=g.length&&(b=g.length),b||(b=0),P>0&&P<T&&(P=T),P===T||g.length===0||this.length===0)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(T<0||T>=this.length)throw new RangeError("Index out of range");if(P<0)throw new RangeError("sourceEnd out of bounds");P>this.length&&(P=this.length),g.length-b<P-T&&(P=g.length-b+T);const M=P-T;return this===g&&typeof s.prototype.copyWithin=="function"?this.copyWithin(b,T,P):s.prototype.set.call(g,this.subarray(T,P),b),M},m.prototype.fill=function(g,b,T,P){if(typeof g=="string"){if(typeof b=="string"?(P=b,b=0,T=this.length):typeof T=="string"&&(P=T,T=this.length),P!==void 0&&typeof P!="string")throw new TypeError("encoding must be a string");if(typeof P=="string"&&!m.isEncoding(P))throw new TypeError("Unknown encoding: "+P);if(g.length===1){const V=g.charCodeAt(0);(P==="utf8"&&V<128||P==="latin1")&&(g=V)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(b<0||this.length<b||this.length<T)throw new RangeError("Out of range index");if(T<=b)return this;b=b>>>0,T=T===void 0?this.length:T>>>0,g||(g=0);let M;if(typeof g=="number")for(M=b;M<T;++M)this[M]=g;else{const V=m.isBuffer(g)?g:m.from(g,P),K=V.length;if(K===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for(M=0;M<T-b;++M)this[M+b]=V[M%K]}return this};const Ct={};function Ci(g,b,T){Ct[g]=class extends T{constructor(){super(),Object.defineProperty(this,"message",{value:b.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${g}]`,this.stack,delete this.name}get code(){return g}set code(P){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:P,writable:!0})}toString(){return`${this.name} [${g}]: ${this.message}`}}}Ci("ERR_BUFFER_OUT_OF_BOUNDS",function(g){return g?`${g} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Ci("ERR_INVALID_ARG_TYPE",function(g,b){return`The "${g}" argument must be of type number. Received type ${typeof b}`},TypeError),Ci("ERR_OUT_OF_RANGE",function(g,b,T){let P=`The value of "${g}" is out of range.`,M=T;return Number.isInteger(T)&&Math.abs(T)>2**32?M=Kt(String(T)):typeof T=="bigint"&&(M=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(M=Kt(M)),M+="n"),P+=` It must be ${b}. Received ${M}`,P},RangeError);function Kt(g){let b="",T=g.length;const P=g[0]==="-"?1:0;for(;T>=P+4;T-=3)b=`_${g.slice(T-3,T)}${b}`;return`${g.slice(0,T)}${b}`}function Vi(g,b,T){qt(b,"offset"),(g[b]===void 0||g[b+T]===void 0)&&Hi(b,g.length-(T+1))}function $t(g,b,T,P,M,V){if(g>T||g<b){const K=typeof b=="bigint"?"n":"";let ke;throw b===0||b===BigInt(0)?ke=`>= 0${K} and < 2${K} ** ${(V+1)*8}${K}`:ke=`>= -(2${K} ** ${(V+1)*8-1}${K}) and < 2 ** ${(V+1)*8-1}${K}`,new Ct.ERR_OUT_OF_RANGE("value",ke,g)}Vi(P,M,V)}function qt(g,b){if(typeof g!="number")throw new Ct.ERR_INVALID_ARG_TYPE(b,"number",g)}function Hi(g,b,T){throw Math.floor(g)!==g?(qt(g,T),new Ct.ERR_OUT_OF_RANGE("offset","an integer",g)):b<0?new Ct.ERR_BUFFER_OUT_OF_BOUNDS:new Ct.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${b}`,g)}const Yt=/[^+/0-9A-Za-z-_]/g;function nn(g){if(g=g.split("=")[0],g=g.trim().replace(Yt,""),g.length<2)return"";for(;g.length%4!==0;)g=g+"=";return g}function fe(g,b){b=b||1/0;let T;const P=g.length;let M=null;const V=[];for(let K=0;K<P;++K){if(T=g.charCodeAt(K),T>55295&&T<57344){if(!M){if(T>56319){(b-=3)>-1&&V.push(239,191,189);continue}else if(K+1===P){(b-=3)>-1&&V.push(239,191,189);continue}M=T;continue}if(T<56320){(b-=3)>-1&&V.push(239,191,189),M=T;continue}T=(M-55296<<10|T-56320)+65536}else M&&(b-=3)>-1&&V.push(239,191,189);if(M=null,T<128){if((b-=1)<0)break;V.push(T)}else if(T<2048){if((b-=2)<0)break;V.push(T>>6|192,T&63|128)}else if(T<65536){if((b-=3)<0)break;V.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((b-=4)<0)break;V.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return V}function Ya(g){const b=[];for(let T=0;T<g.length;++T)b.push(g.charCodeAt(T)&255);return b}function sn(g,b){let T,P,M;const V=[];for(let K=0;K<g.length&&!((b-=2)<0);++K)T=g.charCodeAt(K),P=T>>8,M=T%256,V.push(M),V.push(P);return V}function as(g){return e.toByteArray(nn(g))}function Ii(g,b,T,P){let M;for(M=0;M<P&&!(M+T>=b.length||M>=g.length);++M)b[M+T]=g[M];return M}function gt(g,b){return g instanceof b||g!=null&&g.constructor!=null&&g.constructor.name!=null&&g.constructor.name===b.name}function zi(g){return g!==g}const dr=function(){const g="0123456789abcdef",b=new Array(256);for(let T=0;T<16;++T){const P=T*16;for(let M=0;M<16;++M)b[P+M]=g[T]+g[M]}return b}();function Rt(g){return typeof BigInt>"u"?os:g}function os(){throw new Error("BigInt not supported")}})(Ap);const dT=Ap.Buffer;var hT=function(i){return x.atob?x.atob(i):dT.from(i,"base64").toString("binary")};function Lp(i){for(var e=hT(i),t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class pT extends Fl{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
26
26
|
`);t>-1;t=this.buffer.indexOf(`
|
|
27
|
-
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Zv=" ",Eo=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},eT=function(){const i='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+i+")")},at=function(i){const e={};if(!i)return e;const t=i.split(eT());let r=t.length,n;for(;r--;)t[r]!==""&&(n=/([^=]*)=(.*)/.exec(t[r]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},nd=i=>{const e=i.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class tT extends Bl{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,r;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,s)=>{const a=s(e);return a===e?n:n.concat([a])},[e]).forEach(n=>{for(let s=0;s<this.customParsers.length;s++)if(this.customParsers[s].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){r={type:"tag",tagType:"inf"},t[1]&&(r.duration=parseFloat(t[1])),t[2]&&(r.title=t[2]),this.trigger("data",r);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"targetduration"},t[1]&&(r.duration=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"version"},t[1]&&(r.version=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"media-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){r={type:"tag",tagType:"playlist-type"},t[1]&&(r.playlistType=t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){r=Ve(Eo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){r={type:"tag",tagType:"allow-cache"},t[1]&&(r.allowed=!/NO/.test(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(r={type:"tag",tagType:"map"},t[1]){const s=at(t[1]);s.URI&&(r.uri=s.URI),s.BYTERANGE&&(r.byterange=Eo(s.BYTERANGE))}this.trigger("data",r);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"stream-inf"},t[1]&&(r.attributes=at(t[1]),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=nd(r.attributes.RESOLUTION)),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"]&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10))),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){r={type:"tag",tagType:"media"},t[1]&&(r.attributes=at(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){r={type:"tag",tagType:"program-date-time"},t[1]&&(r.dateTimeString=t[1],r.dateTimeObject=new Date(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){r={type:"tag",tagType:"key"},t[1]&&(r.attributes=at(t[1]),r.attributes.IV&&(r.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV))),this.trigger("data",r);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){r={type:"tag",tagType:"start"},t[1]&&(r.attributes=at(t[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out-cont"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-in"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"skip"},r.attributes=at(t[1]),r.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(r.attributes["SKIPPED-SEGMENTS"]=parseInt(r.attributes["SKIPPED-SEGMENTS"],10)),r.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(r.attributes["RECENTLY-REMOVED-DATERANGES"]=r.attributes["RECENTLY-REMOVED-DATERANGES"].split(Zv)),this.trigger("data",r);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part"},r.attributes=at(t[1]),["DURATION"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["INDEPENDENT","GAP"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),r.attributes.hasOwnProperty("BYTERANGE")&&(r.attributes.byterange=Eo(r.attributes.BYTERANGE)),this.trigger("data",r);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"server-control"},r.attributes=at(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part-inf"},r.attributes=at(t[1]),["PART-TARGET"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"preload-hint"},r.attributes=at(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(s){if(r.attributes.hasOwnProperty(s)){r.attributes[s]=parseInt(r.attributes[s],10);const a=s==="BYTERANGE-LENGTH"?"length":"offset";r.attributes.byterange=r.attributes.byterange||{},r.attributes.byterange[a]=r.attributes[s],delete r.attributes[s]}}),this.trigger("data",r);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"rendition-report"},r.attributes=at(t[1]),["LAST-MSN","LAST-PART"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseInt(r.attributes[s],10))}),this.trigger("data",r);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"daterange"},r.attributes=at(t[1]),["ID","CLASS"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=String(r.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=new Date(r.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=/YES/i.test(r.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=r.attributes[a].toString(16))});const s=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in r.attributes){if(!s.test(a))continue;const l=/[0-9A-Fa-f]{6}/g.test(r.attributes[a]),u=/^\d+(\.\d+)?$/.test(r.attributes[a]);r.attributes[a]=l?r.attributes[a].toString(16):u?parseFloat(r.attributes[a]):String(r.attributes[a])}this.trigger("data",r);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){r={type:"tag",tagType:"content-steering"},r.attributes=at(t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"i-frame-playlist"},r.attributes=at(t[1]),r.attributes.URI&&(r.uri=r.attributes.URI),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=nd(r.attributes.RESOLUTION)),r.attributes["AVERAGE-BANDWIDTH"]&&(r.attributes["AVERAGE-BANDWIDTH"]=parseInt(r.attributes["AVERAGE-BANDWIDTH"],10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),this.trigger("data",r);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){r={type:"tag",tagType:"define"},r.attributes=at(t[1]),this.trigger("data",r);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}}addParser({expression:e,customType:t,dataParser:r,segment:n}){typeof r!="function"&&(r=s=>s),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:r(s),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const r=n=>e.test(n)?t(n):n;this.tagMappers.push(r)}}const iT=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),xi=function(i){const e={};return Object.keys(i).forEach(function(t){e[iT(t)]=i[t]}),e},wo=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:r}=i;if(!e)return;const n="#EXT-X-SERVER-CONTROL",s="holdBack",a="partHoldBack",l=t&&t*3,u=r&&r*2;t&&!e.hasOwnProperty(s)&&(e[s]=l,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${l}).`})),l&&e[s]<l&&(this.trigger("warn",{message:`${n} clamping HOLD-BACK (${e[s]}) to targetDuration * 3 (${l})`}),e[s]=l),r&&!e.hasOwnProperty(a)&&(e[a]=r*3,this.trigger("info",{message:`${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),r&&e[a]<u&&(this.trigger("warn",{message:`${n} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${u}).`}),e[a]=u)};class rT extends Bl{constructor(e={}){super(),this.lineStream=new Jv,this.parseStream=new tT,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,r=[];let n={},s,a,l=!1;const u=function(){},p={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},g="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let b=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let S=0,w=0;const C={};this.on("end",()=>{n.uri||!n.parts&&!n.preloadHints||(!n.map&&s&&(n.map=s),!n.key&&a&&(n.key=a),!n.timeline&&typeof b=="number"&&(n.timeline=b),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(v){let D,L;if(t.manifest.definitions){for(const O in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${O}}`,t.manifest.definitions[O])),v.attributes)for(const U in v.attributes)typeof v.attributes[U]=="string"&&(v.attributes[U]=v.attributes[U].replace(`{$${O}}`,t.manifest.definitions[O]))}({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const O={};"length"in v&&(n.byterange=O,O.length=v.length,"offset"in v||(v.offset=S)),"offset"in v&&(n.byterange=O,O.offset=v.offset),S=O.offset+O.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.title&&(n.title=v.title),v.duration>0&&(n.duration=v.duration),v.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){a=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===g){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:Ep(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(a.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,b=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){s={},v.uri&&(s.uri=v.uri),v.byterange&&(s.byterange=v.byterange),a&&(s.key=a)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||p,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),Ve(n.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||p,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const O=this.manifest.mediaGroups[v.attributes.TYPE];O[v.attributes["GROUP-ID"]]=O[v.attributes["GROUP-ID"]]||{},D=O[v.attributes["GROUP-ID"]],L={default:/yes/i.test(v.attributes.DEFAULT)},L.default?L.autoselect=!0:L.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(L.language=v.attributes.LANGUAGE),v.attributes.URI&&(L.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(L.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(L.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(L.forced=/yes/i.test(v.attributes.FORCED)),D[v.attributes.NAME]=L},discontinuity(){b+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),n.dateTimeString=v.dateTimeString,n.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:O}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),O===null&&this.manifest.segments.reduceRight((U,F)=>(F.programDateTime=U-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,wo.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){n.cueOut=v.data},"cue-out-cont"(){n.cueOutCont=v.data},"cue-in"(){n.cueIn=v.data},skip(){this.manifest.skip=xi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;const O=this.manifest.segments.length,U=xi(v.attributes);n.parts=n.parts||[],n.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=w),w=U.byterange.offset+U.byterange.length);const F=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${O}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((N,V)=>{N.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${V} lacks required attribute(s): LAST-PART`})})},"server-control"(){const O=this.manifest.serverControl=xi(v.attributes);O.hasOwnProperty("canBlockReload")||(O.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),wo.call(this,this.manifest),O.canSkipDateranges&&!O.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const O=this.manifest.segments.length,U=xi(v.attributes),F=U.type&&U.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=F?w:0,F&&(w=U.byterange.offset+U.byterange.length)));const N=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${N} for segment #${O}`,v.attributes,["TYPE","URI"]),!!U.type)for(let V=0;V<n.preloadHints.length-1;V++){const J=n.preloadHints[V];J.type&&J.type===U.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${N} for segment #${O} has the same TYPE ${U.type} as preload hint #${V}`})}},"rendition-report"(){const O=xi(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(O);const U=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];l&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${U}`,v.attributes,F)},"part-inf"(){this.manifest.partInf=xi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),wo.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(xi(v.attributes));const O=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${O}`,v.attributes,["ID","START-DATE"]);const U=this.manifest.dateRanges[O];U.endDate&&U.startDate&&new Date(U.endDate)<new Date(U.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),U.duration&&U.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),U.plannedDuration&&U.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!U.endOnNext;if(F&&!U.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(U.duration||U.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),U.duration&&U.endDate){const N=U.startDate.getTime()+U.duration*1e3;this.manifest.dateRanges[O].endDate=new Date(N)}if(!C[U.id])C[U.id]=U;else{for(const V in C[U.id])if(U[V]&&JSON.stringify(C[U.id][V])!==JSON.stringify(U[V])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const N=this.manifest.dateRanges.findIndex(V=>V.id===U.id);this.manifest.dateRanges[N]=Ve(this.manifest.dateRanges[N],U),C[U.id]=Ve(C[U.id],U),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=xi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const O=(U,F)=>{if(U in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${U}`});return}this.manifest.definitions[U]=F};if("QUERYPARAM"in v.attributes){if("NAME"in v.attributes||"IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const U=this.params.get(v.attributes.QUERYPARAM);if(!U){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}O(v.attributes.QUERYPARAM,decodeURIComponent(U));return}if("NAME"in v.attributes){if("IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in v.attributes)||typeof v.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${v.attributes.NAME}`});return}O(v.attributes.NAME,v.attributes.VALUE);return}if("IMPORT"in v.attributes){if(!this.mainDefinitions[v.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${v.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}O(v.attributes.IMPORT,this.mainDefinitions[v.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:v.attributes,uri:v.uri,timeline:b}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",v.attributes,["BANDWIDTH","URI"])}}[v.tagType]||u).call(t)},uri(){n.uri=v.uri,r.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=b,s&&(n.map=s),w=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){v.segment?(n.custom=n.custom||{},n.custom[v.customType]=v.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[v.customType]=v.data)}})[v.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,r){const n=[];r.forEach(function(s){t.hasOwnProperty(s)||n.push(s)}),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
28
|
-
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var Ji={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},nT=["video","audio","text"],sd=["Video","Audio","Text"],wp=function(i){return i&&i.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,r){var n=("00"+Number(t).toString(16)).slice(-2),s=("00"+Number(r).toString(16)).slice(-2);return"avc1."+n+"00"+s})},Kt=function(i){i===void 0&&(i="");var e=i.split(","),t=[];return e.forEach(function(r){r=r.trim();var n;nT.forEach(function(s){var a=Ji[s].exec(r.toLowerCase());if(!(!a||a.length<=1)){n=s;var l=r.substring(0,a[1].length),u=r.replace(l,"");t.push({type:l,details:u,mediaType:s})}}),n||t.push({type:r,details:"",mediaType:"unknown"})}),t},sT=function(i,e){if(!i.mediaGroups.AUDIO||!e)return null;var t=i.mediaGroups.AUDIO[e];if(!t)return null;for(var r in t){var n=t[r];if(n.default&&n.playlists)return Kt(n.playlists[0].attributes.CODECS)}return null},kp=function(i){return i===void 0&&(i=""),Ji.audio.test(i.trim().toLowerCase())},aT=function(i){return i===void 0&&(i=""),Ji.text.test(i.trim().toLowerCase())},Or=function(i){if(!(!i||typeof i!="string")){var e=i.toLowerCase().split(",").map(function(n){return wp(n.trim())}),t="video";e.length===1&&kp(e[0])?t="audio":e.length===1&&aT(e[0])&&(t="application");var r="mp4";return e.every(function(n){return Ji.mp4.test(n)})?r="mp4":e.every(function(n){return Ji.webm.test(n)})?r="webm":e.every(function(n){return Ji.ogg.test(n)})&&(r="ogg"),t+"/"+r+';codecs="'+i+'"'}},Dn=function(i,e){return i===void 0&&(i=""),e===void 0&&(e=!1),x.MediaSource&&x.MediaSource.isTypeSupported&&x.MediaSource.isTypeSupported(Or(i))||e&&x.ManagedMediaSource&&x.ManagedMediaSource.isTypeSupported&&x.ManagedMediaSource.isTypeSupported(Or(i))||!1},ko=function(i){return i===void 0&&(i=""),i.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<sd.length;t++){var r=sd[t];if(Ji["muxer"+r].test(e))return!0}return!1})},ad="mp4a.40.2",oT="avc1.4d400d",lT=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,uT=/^application\/dash\+xml/i,Cp=function(i){return lT.test(i)?"hls":uT.test(i)?"dash":i==="application/vnd.videojs.vhs+json"?"vhs-json":null},cT=function(i){return i.toString(2).length},dT=function(i){return Math.ceil(cT(i)/8)},Ip=function(i){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer},hT=function(i){return Ip(i)},re=function(i){return i instanceof Uint8Array?i:(!Array.isArray(i)&&!hT(i)&&!(i instanceof ArrayBuffer)&&(typeof i!="number"||typeof i=="number"&&i!==i?i=0:i=[i]),new Uint8Array(i&&i.buffer||i,i&&i.byteOffset||0,i&&i.byteLength||0))},Qe=x.BigInt||Number,Go=[Qe("0x1"),Qe("0x100"),Qe("0x10000"),Qe("0x1000000"),Qe("0x100000000"),Qe("0x10000000000"),Qe("0x1000000000000"),Qe("0x100000000000000"),Qe("0x10000000000000000")];(function(){var i=new Uint16Array([65484]),e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var pT=function(i,e){var t=e===void 0?{}:e,r=t.signed,n=r===void 0?!1:r,s=t.le,a=s===void 0?!1:s;i=re(i);var l=a?"reduce":"reduceRight",u=i[l]?i[l]:Array.prototype[l],p=u.call(i,function(b,S,w){var C=a?w:Math.abs(w+1-i.length);return b+Qe(S)*Go[C]},Qe(0));if(n){var g=Go[i.length]/Qe(2)-Qe(1);p=Qe(p),p>g&&(p-=g,p-=g,p-=Qe(2))}return Number(p)},gT=function(i,e){var t={},r=t.le,n=r===void 0?!1:r;(typeof i!="bigint"&&typeof i!="number"||typeof i=="number"&&i!==i)&&(i=0),i=Qe(i);for(var s=dT(i),a=new Uint8Array(new ArrayBuffer(s)),l=0;l<s;l++){var u=n?l:Math.abs(l+1-a.length);a[u]=Number(i/Go[l]&Qe(255)),i<0&&(a[u]=Math.abs(~a[u]),a[u]-=l===0?1:2)}return a},Ap=function(i,e){if(typeof i!="string"&&i&&typeof i.toString=="function"&&(i=i.toString()),typeof i!="string")return new Uint8Array;e||(i=unescape(encodeURIComponent(i)));for(var t=new Uint8Array(i.length),r=0;r<i.length;r++)t[r]=i.charCodeAt(r);return t},mT=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return re(e[0]);var r=e.reduce(function(a,l,u){return a+(l.byteLength||l.length)},0),n=new Uint8Array(r),s=0;return e.forEach(function(a){a=re(a),n.set(a,s),s+=a.byteLength}),n},Pe=function(i,e,t){var r=t===void 0?{}:t,n=r.offset,s=n===void 0?0:n,a=r.mask,l=a===void 0?[]:a;i=re(i),e=re(e);var u=e.every?e.every:Array.prototype.every;return e.length&&i.length-s>=e.length&&u.call(e,function(p,g){var b=l[g]?l[g]&i[s+g]:i[s+g];return p===b})},fT=function(i,e,t){e.forEach(function(r){for(var n in i.mediaGroups[r])for(var s in i.mediaGroups[r][n]){var a=i.mediaGroups[r][n][s];t(a,r,n,s)}})};/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const od=i=>!!i&&typeof i=="object",Ke=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):od(e[r])&&od(t[r])?e[r]=Ke(e[r],t[r]):e[r]=t[r]}),e),{}),xp=i=>Object.keys(i).map(e=>i[e]),yT=(i,e)=>{const t=[];for(let r=i;r<e;r++)t.push(r);return t},Ur=i=>i.reduce((e,t)=>e.concat(t),[]),Lp=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},_T=(i,e)=>i.reduce((t,r,n)=>(r[e]&&t.push(n),t),[]),bT=(i,e)=>xp(i.reduce((t,r)=>(r.forEach(n=>{t[e(n)]=n}),t),{}));var Mr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const qn=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const n={uri:e,resolvedUri:Ca(i||"",e)};if(t||r){const s=(t||r).split("-");let a=x.BigInt?x.BigInt(s[0]):parseInt(s[0],10),l=x.BigInt?x.BigInt(s[1]):parseInt(s[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l));let u;typeof l=="bigint"||typeof a=="bigint"?u=x.BigInt(l)-x.BigInt(a)+x.BigInt(1):u=l-a+1,typeof u=="bigint"&&u<Number.MAX_SAFE_INTEGER&&(u=Number(u)),n.byterange={length:u,offset:a}}return n},vT=i=>{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=x.BigInt(i.offset)+x.BigInt(i.length)-x.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},ld=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),TT={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:n}=i,s=ld(i.endNumber),a=e/t;return typeof s=="number"?{start:0,end:s}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:n=1,duration:s,periodStart:a=0,minimumUpdatePeriod:l=0,timeShiftBufferDepth:u=1/0}=i,p=ld(i.endNumber),g=(e+t)/1e3,b=r+a,S=g+l-b,w=Math.ceil(S*n/s),C=Math.floor((g-b-u)*n/s),v=Math.floor((g-b)*n/s);return{start:Math.max(0,C),end:typeof p=="number"?p:Math.min(w,v)}}},ST=i=>e=>{const{duration:t,timescale:r=1,periodStart:n,startNumber:s=1}=i;return{number:s+e,duration:t/r,timeline:n,time:e*t}},jl=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:n,sourceDuration:s}=i,{start:a,end:l}=TT[e](i),u=yT(a,l).map(ST(i));if(e==="static"){const p=u.length-1,g=typeof n=="number"?n:s;u[p].duration=g-t/r*p}return u},Dp=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:n="",periodStart:s,presentationTime:a,number:l=0,duration:u}=i;if(!e)throw new Error(Mr.NO_BASE_URL);const p=qn({baseUrl:e,source:t.sourceURL,range:t.range}),g=qn({baseUrl:e,source:e,indexRange:n});if(g.map=p,u){const b=jl(i);b.length&&(g.duration=b[0].duration,g.timeline=b[0].timeline)}else r&&(g.duration=r,g.timeline=s);return g.presentationTime=a||s,g.number=l,[g]},ql=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,n=i.sidx.duration,s=i.timeline||0,a=i.sidx.byterange,l=a.offset+a.length,u=e.timescale,p=e.references.filter(D=>D.referenceType!==1),g=[],b=i.endList?"static":"dynamic",S=i.sidx.timeline;let w=S,C=i.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=x.BigInt(l)+e.firstOffset:v=l+e.firstOffset;for(let D=0;D<p.length;D++){const L=e.references[D],O=L.referencedSize,U=L.subsegmentDuration;let F;typeof v=="bigint"?F=v+x.BigInt(O)-x.BigInt(1):F=v+O-1;const N=`${v}-${F}`,V=Dp({baseUrl:t,timescale:u,timeline:s,periodStart:S,presentationTime:w,number:C,duration:U,sourceDuration:n,indexRange:N,type:b})[0];r&&(V.map=r),g.push(V),typeof v=="bigint"?v+=x.BigInt(O):v+=O,w+=U/u,C++}return i.segments=g,i},ET=["AUDIO","SUBTITLES"],wT=1/60,Pp=i=>bT(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),kT=(i,e)=>{for(let t=0;t<i.length;t++)if(i[t].attributes.NAME===e)return i[t];return null},ud=i=>{let e=[];return fT(i,ET,(t,r,n,s)=>{e=e.concat(t.playlists||[])}),e},cd=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},CT=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:l}){return l===r.timeline});const n=kT(i,r.attributes.NAME);if(!n||r.sidx)return;const s=r.segments[0],a=n.segments.findIndex(function(l){return Math.abs(l.presentationTime-s.presentationTime)<wT});if(a===-1){cd({playlist:r,mediaSequence:n.mediaSequence+n.segments.length}),r.segments[0].discontinuity=!0,r.discontinuityStarts.unshift(0),(!n.segments.length&&r.timeline>n.timeline||n.segments.length&&r.timeline>n.segments[n.segments.length-1].timeline)&&r.discontinuitySequence--;return}n.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),cd({playlist:r,mediaSequence:n.segments[a].number})})},IT=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(ud(i)),r=e.playlists.concat(ud(e));return e.timelineStarts=Pp([i.timelineStarts,e.timelineStarts]),CT({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},Aa=i=>i&&i.uri+"-"+vT(i.byterange),Co=i=>{const e=i.reduce(function(r,n){return r[n.attributes.baseUrl]||(r[n.attributes.baseUrl]=[]),r[n.attributes.baseUrl].push(n),r},{});let t=[];return Object.values(e).forEach(r=>{const n=xp(r.reduce((s,a)=>{const l=a.attributes.id+(a.attributes.lang||"");return s[l]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),s[l].segments.push(...a.segments)),a.attributes.contentProtection&&(s[l].attributes.contentProtection=a.attributes.contentProtection)):(s[l]=a,s[l].attributes.timelineStarts=[]),s[l].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),s},{}));t=t.concat(n)}),t.map(r=>(r.discontinuityStarts=_T(r.segments||[],"discontinuity"),r))},$l=(i,e)=>{const t=Aa(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&ql(i,r,i.sidx.resolvedUri),i},AT=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=$l(i[t],e);return i},xT=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:n,discontinuityStarts:s},a)=>{const l={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:n,discontinuityStarts:s,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(l.contentProtection=i.contentProtection),i.serviceLocation&&(l.attributes.serviceLocation=i.serviceLocation),t&&(l.sidx=t),a&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l},LT=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const s={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(s.CODECS=i.codecs);const a={attributes:s,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:n,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},DT=(i,e={},t=!1)=>{let r;const n=i.reduce((s,a)=>{const l=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let p=a.attributes.label||"main";if(u&&!a.attributes.label){const b=l?` (${l})`:"";p=`${a.attributes.lang}${b}`}s[p]||(s[p]={language:u,autoselect:!0,default:l==="main",playlists:[],uri:""});const g=$l(xT(a,t),e);return s[p].playlists.push(g),typeof r>"u"&&l==="main"&&(r=a,r.default=!0),s},{});if(!r){const s=Object.keys(n)[0];n[s].default=!0}return n},PT=(i,e={})=>i.reduce((t,r)=>{const n=r.attributes.label||r.attributes.lang||"text",s=r.attributes.lang||"und";return t[n]||(t[n]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push($l(LT(r),e)),t},{}),RT=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:n,language:s}=r;e[s]={autoselect:!1,default:!1,instreamId:n,language:s},r.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[s].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[s]["3D"]=r["3D"])}),e),{}),NT=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const n={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(n.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(n.contentProtection=i.contentProtection),i.serviceLocation&&(n.attributes.serviceLocation=i.serviceLocation),t&&(n.sidx=t),n},OT=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",UT=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",MT=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",BT=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,n)=>{r.number=n})})},dd=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],FT=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:n,eventStream:s})=>{if(!i.length)return{};const{sourceDuration:a,type:l,suggestedPresentationDelay:u,minimumUpdatePeriod:p}=i[0].attributes,g=Co(i.filter(OT)).map(NT),b=Co(i.filter(UT)),S=Co(i.filter(MT)),w=i.map(F=>F.attributes.captionServices).filter(Boolean),C={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:AT(g,r)};p>=0&&(C.minimumUpdatePeriod=p*1e3),e&&(C.locations=e),t&&(C.contentSteering=t),l==="dynamic"&&(C.suggestedPresentationDelay=u),s&&s.length>0&&(C.eventStream=s);const v=C.playlists.length===0,D=b.length?DT(b,r,v):null,L=S.length?PT(S,r):null,O=g.concat(dd(D),dd(L)),U=O.map(({timelineStarts:F})=>F);return C.timelineStarts=Pp(U),BT(O,C.timelineStarts),D&&(C.mediaGroups.AUDIO.audio=D),L&&(C.mediaGroups.SUBTITLES.subs=L),w.length&&(C.mediaGroups["CLOSED-CAPTIONS"].cc=RT(w)),n?IT({oldManifest:n,newManifest:C}):C},jT=(i,e,t)=>{const{NOW:r,clientOffset:n,availabilityStartTime:s,timescale:a=1,periodStart:l=0,minimumUpdatePeriod:u=0}=i,p=(r+n)/1e3,g=s+l,b=p+u-g;return Math.ceil((b*a-e)/t)},Rp=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:n="",sourceDuration:s,timescale:a=1,startNumber:l=1,periodStart:u}=i,p=[];let g=-1;for(let b=0;b<e.length;b++){const S=e[b],w=S.d,C=S.r||0,v=S.t||0;g<0&&(g=v),v&&v>g&&(g=v);let D;if(C<0){const U=b+1;U===e.length?t==="dynamic"&&r>0&&n.indexOf("$Number$")>0?D=jT(i,g,w):D=(s*a-g)/w:D=(e[U].t-g)/w}else D=C+1;const L=l+p.length+D;let O=l+p.length;for(;O<L;)p.push({number:O,duration:w/a,time:g,timeline:u}),g+=w,O++}return p},qT=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,$T=i=>(e,t,r,n)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const s=""+i[t];return t==="RepresentationID"||(r?n=parseInt(n,10):n=1,s.length>=n)?s:`${new Array(n-s.length+1).join("0")}${s}`},hd=(i,e)=>i.replace(qT,$T(e)),VT=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?jl(i):Rp(i,e),HT=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,n=qn({baseUrl:i.baseUrl,source:hd(r.sourceURL,t),range:r.range});return VT(i,e).map(s=>{t.Number=s.number,t.Time=s.time;const a=hd(i.media||"",t),l=i.timescale||1,u=i.presentationTimeOffset||0,p=i.periodStart+(s.time-u)/l;return{uri:a,timeline:s.timeline,duration:s.duration,resolvedUri:Ca(i.baseUrl||"",a),map:n,number:s.number,presentationTime:p}})},zT=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,n=qn({baseUrl:t,source:r.sourceURL,range:r.range}),s=qn({baseUrl:t,source:e.media,range:e.mediaRange});return s.map=n,s},WT=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:n}=i;if(!t&&!e||t&&e)throw new Error(Mr.SEGMENT_TIME_UNSPECIFIED);const s=r.map(l=>zT(i,l));let a;return t&&(a=jl(i)),e&&(a=Rp(i,e)),a.map((l,u)=>{if(s[u]){const p=s[u],g=i.timescale||1,b=i.presentationTimeOffset||0;return p.timeline=l.timeline,p.duration=l.duration,p.number=l.number,p.presentationTime=n+(l.time-b)/g,p}}).filter(l=>l)},GT=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=HT,t=Ke(i,e.template)):e.base?(r=Dp,t=Ke(i,e.base)):e.list&&(r=WT,t=Ke(i,e.list));const n={attributes:i};if(!r)return n;const s=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:l=1}=t;t.duration=a/l}else s.length?t.duration=s.reduce((a,l)=>Math.max(a,Math.ceil(l.duration)),0):t.duration=0;return n.attributes=t,n.segments=s,e.base&&t.indexRange&&(n.sidx=s[0],n.segments=[]),n},XT=i=>i.map(GT),Re=(i,e)=>Lp(i.childNodes).filter(({tagName:t})=>t===e),Yn=i=>i.textContent.trim(),KT=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),yr=i=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!e)return 0;const[t,r,n,s,a,l]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(r||0)*2592e3+parseFloat(n||0)*86400+parseFloat(s||0)*3600+parseFloat(a||0)*60+parseFloat(l||0)},YT=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),pd={mediaPresentationDuration(i){return yr(i)},availabilityStartTime(i){return YT(i)/1e3},minimumUpdatePeriod(i){return yr(i)},suggestedPresentationDelay(i){return yr(i)},type(i){return i},timeShiftBufferDepth(i){return yr(i)},start(i){return yr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return KT(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?yr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},He=i=>i&&i.attributes?Lp(i.attributes).reduce((e,t)=>{const r=pd[t.name]||pd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},QT={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},xa=(i,e)=>e.length?Ur(i.map(function(t){return e.map(function(r){const n=Yn(r),s=Ca(t.baseUrl,n),a=Ke(He(r),{baseUrl:s});return s!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Vl=i=>{const e=Re(i,"SegmentTemplate")[0],t=Re(i,"SegmentList")[0],r=t&&Re(t,"SegmentURL").map(b=>Ke({tag:"SegmentURL"},He(b))),n=Re(i,"SegmentBase")[0],s=t||e,a=s&&Re(s,"SegmentTimeline")[0],l=t||n||e,u=l&&Re(l,"Initialization")[0],p=e&&He(e);p&&u?p.initialization=u&&He(u):p&&p.initialization&&(p.initialization={sourceURL:p.initialization});const g={template:p,segmentTimeline:a&&Re(a,"S").map(b=>He(b)),list:t&&Ke(He(t),{segmentUrls:r,initialization:He(u)}),base:n&&Ke(He(n),{initialization:He(u)})};return Object.keys(g).forEach(b=>{g[b]||delete g[b]}),g},JT=(i,e,t)=>r=>{const n=Re(r,"BaseURL"),s=xa(e,n),a=Ke(i,He(r)),l=Vl(r);return s.map(u=>({segmentInfo:Ke(t,l),attributes:Ke(a,u)}))},ZT=i=>i.reduce((e,t)=>{const r=He(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const n=QT[r.schemeIdUri];if(n){e[n]={attributes:r};const s=Re(t,"cenc:pssh")[0];if(s){const a=Yn(s);e[n].pssh=a&&Ep(a)}}return e},{}),e1=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{let t,r;return r=e,/^CC\d=/.test(e)?[t,r]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:r}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[r,n=""]=e.split("=");t.channel=r,t.language=e,n.split(",").forEach(s=>{const[a,l]=s.split(":");a==="lang"?t.language=l:a==="er"?t.easyReader=Number(l):a==="war"?t.aspectRatio=Number(l):a==="3D"&&(t["3D"]=Number(l))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},t1=i=>Ur(Re(i.node,"EventStream").map(e=>{const t=He(e),r=t.schemeIdUri;return Re(e,"Event").map(n=>{const s=He(n),a=s.presentationTime||0,l=t.timescale||1,u=s.duration||0,p=a/l+i.attributes.start;return{schemeIdUri:r,value:t.value,id:s.id,start:p,end:p+u/l,messageData:Yn(n)||s.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),i1=(i,e,t)=>r=>{const n=He(r),s=xa(e,Re(r,"BaseURL")),a=Re(r,"Role")[0],l={role:He(a)};let u=Ke(i,n,l);const p=Re(r,"Accessibility")[0],g=e1(He(p));g&&(u=Ke(u,{captionServices:g}));const b=Re(r,"Label")[0];if(b&&b.childNodes.length){const D=b.childNodes[0].nodeValue.trim();u=Ke(u,{label:D})}const S=ZT(Re(r,"ContentProtection"));Object.keys(S).length&&(u=Ke(u,{contentProtection:S}));const w=Vl(r),C=Re(r,"Representation"),v=Ke(t,w);return Ur(C.map(JT(u,s,v)))},r1=(i,e)=>(t,r)=>{const n=xa(e,Re(t.node,"BaseURL")),s=Ke(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(s.periodDuration=t.attributes.duration);const a=Re(t.node,"AdaptationSet"),l=Vl(t.node);return Ur(a.map(i1(s,n,l)))},n1=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=Ke({serverURL:Yn(i[0])},He(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},s1=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,a1=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:n=0,eventHandler:s=function(){}}=e,a=Re(i,"Period");if(!a.length)throw new Error(Mr.INVALID_NUMBER_OF_PERIOD);const l=Re(i,"Location"),u=He(i),p=xa([{baseUrl:t}],Re(i,"BaseURL")),g=Re(i,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=r,u.clientOffset=n,l.length&&(u.locations=l.map(Yn));const b=[];return a.forEach((S,w)=>{const C=He(S),v=b[w-1];C.start=s1({attributes:C,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),b.push({node:S,attributes:C})}),{locations:u.locations,contentSteeringInfo:n1(g,s),representationInfo:Ur(b.map(r1(u,p))),eventStream:Ur(b.map(t1))}},Np=i=>{if(i==="")throw new Error(Mr.DASH_EMPTY_MANIFEST);const e=new Rl;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(Mr.DASH_INVALID_XML);return r},o1=i=>{const e=Re(i,"UTCTiming")[0];if(!e)return null;const t=He(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Mr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},l1=(i,e={})=>{const t=a1(Np(i),e),r=XT(t.representationInfo);return FT({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},u1=i=>o1(Np(i));var Op=Math.pow(2,32),c1=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*Op+e.getUint32(4)},d1={getUint64:c1,MAX_UINT32:Op},gd=d1.getUint64,h1=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},r=12;t.version===0?(t.earliestPresentationTime=e.getUint32(r),t.firstOffset=e.getUint32(r+4),r+=8):(t.earliestPresentationTime=gd(i.subarray(r)),t.firstOffset=gd(i.subarray(r+8)),r+=16),r+=2;var n=e.getUint16(r);for(r+=2;n>0;r+=12,n--)t.references.push({referenceType:(i[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(i[r+8]&128),sapType:(i[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return t},p1=h1;const g1=Kn(p1);var m1=re([73,68,51]),f1=function(i,e){e===void 0&&(e=0),i=re(i);var t=i[e+5],r=i[e+6]<<21|i[e+7]<<14|i[e+8]<<7|i[e+9],n=(t&16)>>4;return n?r+20:r+10},In=function i(e,t){return t===void 0&&(t=0),e=re(e),e.length-t<10||!Pe(e,m1,{offset:t})?t:(t+=f1(e,t),i(e,t))},md=function(i){return typeof i=="string"?Ap(i):i},y1=function(i){return Array.isArray(i)?i.map(function(e){return md(e)}):[md(i)]},_1=function i(e,t,r){r===void 0&&(r=!1),t=y1(t),e=re(e);var n=[];if(!t.length)return n;for(var s=0;s<e.length;){var a=(e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3])>>>0,l=e.subarray(s+4,s+8);if(a===0)break;var u=s+a;if(u>e.length){if(r)break;u=e.length}var p=e.subarray(s+8,u);Pe(l,t[0])&&(t.length===1?n.push(p):n.push.apply(n,i(p,t.slice(1),r))),s=u}return n},Ns={EBML:re([26,69,223,163]),DocType:re([66,130]),Segment:re([24,83,128,103]),SegmentInfo:re([21,73,169,102]),Tracks:re([22,84,174,107]),Track:re([174]),TrackNumber:re([215]),DefaultDuration:re([35,227,131]),TrackEntry:re([174]),TrackType:re([131]),FlagDefault:re([136]),CodecID:re([134]),CodecPrivate:re([99,162]),VideoTrack:re([224]),AudioTrack:re([225]),Cluster:re([31,67,182,117]),Timestamp:re([231]),TimestampScale:re([42,215,177]),BlockGroup:re([160]),BlockDuration:re([155]),Block:re([161]),SimpleBlock:re([163])},Xo=[128,64,32,16,8,4,2,1],b1=function(i){for(var e=1,t=0;t<Xo.length&&!(i&Xo[t]);t++)e++;return e},Js=function(i,e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1);var n=b1(i[e]),s=i.subarray(e,e+n);return t&&(s=Array.prototype.slice.call(i,e,e+n),s[0]^=Xo[n-1]),{length:n,value:pT(s,{signed:r}),bytes:s}},fd=function i(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return i(t)}):typeof e=="number"?gT(e):e},v1=function(i){return Array.isArray(i)?i.map(function(e){return fd(e)}):[fd(i)]},T1=function i(e,t,r){if(r>=t.length)return t.length;var n=Js(t,r,!1);if(Pe(e.bytes,n.bytes))return r;var s=Js(t,r+n.length);return i(e,t,r+s.length+s.value+n.length)},yd=function i(e,t){t=v1(t),e=re(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var s=Js(e,n,!1),a=Js(e,n+s.length),l=n+s.length+a.length;a.value===127&&(a.value=T1(s,e,l),a.value!==e.length&&(a.value-=l));var u=l+a.value>e.length?e.length:l+a.value,p=e.subarray(l,u);Pe(t[0],s.bytes)&&(t.length===1?r.push(p):r=r.concat(i(p,t.slice(1))));var g=s.length+a.length+p.length;n+=g}return r},S1=re([0,0,0,1]),E1=re([0,0,1]),w1=re([0,0,3]),k1=function(i){for(var e=[],t=1;t<i.length-2;)Pe(i.subarray(t,t+3),w1)&&(e.push(t+2),t++),t++;if(e.length===0)return i;var r=i.length-e.length,n=new Uint8Array(r),s=0;for(t=0;t<r;s++,t++)s===e[0]&&(s++,e.shift()),n[t]=i[s];return n},Up=function(i,e,t,r){i=re(i),t=[].concat(t);for(var n=0,s,a=0;n<i.length&&(a<r||s);){var l=void 0;if(Pe(i.subarray(n),S1)?l=4:Pe(i.subarray(n),E1)&&(l=3),!l){n++;continue}if(a++,s)return k1(i.subarray(s,n));var u=void 0;e==="h264"?u=i[n+l]&31:e==="h265"&&(u=i[n+l]>>1&63),t.indexOf(u)!==-1&&(s=n+l),n+=l+(e==="h264"?1:2)}return i.subarray(0,0)},C1=function(i,e,t){return Up(i,"h264",e,t)},I1=function(i,e,t){return Up(i,"h265",e,t)},ot={webm:re([119,101,98,109]),matroska:re([109,97,116,114,111,115,107,97]),flac:re([102,76,97,67]),ogg:re([79,103,103,83]),ac3:re([11,119]),riff:re([82,73,70,70]),avi:re([65,86,73]),wav:re([87,65,86,69]),"3gp":re([102,116,121,112,51,103]),mp4:re([102,116,121,112]),fmp4:re([115,116,121,112]),mov:re([102,116,121,112,113,116]),moov:re([109,111,111,118]),moof:re([109,111,111,102])},Br={aac:function(i){var e=In(i);return Pe(i,[255,16],{offset:e,mask:[255,22]})},mp3:function(i){var e=In(i);return Pe(i,[255,2],{offset:e,mask:[255,6]})},webm:function(i){var e=yd(i,[Ns.EBML,Ns.DocType])[0];return Pe(e,ot.webm)},mkv:function(i){var e=yd(i,[Ns.EBML,Ns.DocType])[0];return Pe(e,ot.matroska)},mp4:function(i){if(Br["3gp"](i)||Br.mov(i))return!1;if(Pe(i,ot.mp4,{offset:4})||Pe(i,ot.fmp4,{offset:4})||Pe(i,ot.moof,{offset:4})||Pe(i,ot.moov,{offset:4}))return!0},mov:function(i){return Pe(i,ot.mov,{offset:4})},"3gp":function(i){return Pe(i,ot["3gp"],{offset:4})},ac3:function(i){var e=In(i);return Pe(i,ot.ac3,{offset:e})},ts:function(i){if(i.length<189&&i.length>=1)return i[0]===71;for(var e=0;e+188<i.length&&e<188;){if(i[e]===71&&i[e+188]===71)return!0;e+=1}return!1},flac:function(i){var e=In(i);return Pe(i,ot.flac,{offset:e})},ogg:function(i){return Pe(i,ot.ogg)},avi:function(i){return Pe(i,ot.riff)&&Pe(i,ot.avi,{offset:8})},wav:function(i){return Pe(i,ot.riff)&&Pe(i,ot.wav,{offset:8})},h264:function(i){return C1(i,7,3).length},h265:function(i){return I1(i,[32,33],3).length}},Ko=Object.keys(Br).filter(function(i){return i!=="ts"&&i!=="h264"&&i!=="h265"}).concat(["ts","h264","h265"]);Ko.forEach(function(i){var e=Br[i];Br[i]=function(t){return e(re(t))}});var A1=Br,Hl=function(i){i=re(i);for(var e=0;e<Ko.length;e++){var t=Ko[e];if(A1[t](i))return t}return""},x1=function(i){return _1(i,["moof"]).length>0},zl=9e4,Wl,Gl,La,Xl,Mp,Bp,Fp;Wl=function(i){return i*zl};Gl=function(i,e){return i*e};La=function(i){return i/zl};Xl=function(i,e){return i/e};Mp=function(i,e){return Wl(Xl(i,e))};Bp=function(i,e){return Gl(La(i),e)};Fp=function(i,e,t){return La(t?i:i-e)};var Yi={ONE_SECOND_IN_TS:zl,secondsToVideoTs:Wl,secondsToAudioTs:Gl,videoTsToSeconds:La,audioTsToSeconds:Xl,audioTsToVideoTs:Mp,videoTsToAudioTs:Bp,metadataTsToSeconds:Fp},Yo="8.21.0";const hi={},Oi=function(i,e){return hi[i]=hi[i]||[],e&&(hi[i]=hi[i].concat(e)),hi[i]},L1=function(i,e){Oi(i,e)},jp=function(i,e){const t=Oi(i).indexOf(e);return t<=-1?!1:(hi[i]=hi[i].slice(),hi[i].splice(t,1),!0)},D1=function(i,e){Oi(i,[].concat(e).map(t=>{const r=(...n)=>(jp(i,r),t(...n));return r}))},Zs={prefixed:!0},qs=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],_d=qs[0];let An;for(let i=0;i<qs.length;i++)if(qs[i][1]in G){An=qs[i];break}if(An){for(let i=0;i<An.length;i++)Zs[_d[i]]=An[i];Zs.prefixed=An[0]!==_d[0]}let mt=[];const P1=(i,e,t)=>(r,n,s)=>{const a=e.levels[n],l=new RegExp(`^(${a})$`);let u=i;if(r!=="log"&&s.unshift(r.toUpperCase()+":"),t&&(u=`%c${i}`,s.unshift(t)),s.unshift(u+":"),mt){mt.push([].concat(s));const g=mt.length-1e3;mt.splice(0,g>0?g:0)}if(!x.console)return;let p=x.console[r];!p&&r==="debug"&&(p=x.console.info||x.console.log),!(!p||!a||!l.test(r))&&p[Array.isArray(s)?"apply":"call"](x.console,s)};function Qo(i,e=":",t=""){let r="info",n;function s(...a){n("log",r,a)}return n=P1(i,s,t),s.createLogger=(a,l,u)=>{const p=l!==void 0?l:e,g=u!==void 0?u:t,b=`${i} ${p} ${a}`;return Qo(b,p,g)},s.createNewLogger=(a,l,u)=>Qo(a,l,u),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},s.level=a=>{if(typeof a=="string"){if(!s.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},s.history=()=>mt?[].concat(mt):[],s.history.filter=a=>(mt||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),s.history.clear=()=>{mt&&(mt.length=0)},s.history.disable=()=>{mt!==null&&(mt.length=0,mt=null)},s.history.enable=()=>{mt===null&&(mt=[])},s.error=(...a)=>n("error",r,a),s.warn=(...a)=>n("warn",r,a),s.debug=(...a)=>n("debug",r,a),s}const ue=Qo("VIDEOJS"),qp=ue.createLogger,R1=Object.prototype.toString,$p=function(i){return ni(i)?Object.keys(i):[]};function wr(i,e){$p(i).forEach(t=>e(i[t],t))}function Vp(i,e,t=0){return $p(i).reduce((r,n)=>e(r,i[n],n),t)}function ni(i){return!!i&&typeof i=="object"}function Fr(i){return ni(i)&&R1.call(i)==="[object Object]"&&i.constructor===Object}function ve(...i){const e={};return i.forEach(t=>{t&&wr(t,(r,n)=>{if(!Fr(r)){e[n]=r;return}Fr(e[n])||(e[n]={}),e[n]=ve(e[n],r)})}),e}function Hp(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function Da(i,e,t,r=!0){const n=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),s={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return r&&(s.set=n),Object.defineProperty(i,e,s)}var N1=Object.freeze({__proto__:null,each:wr,reduce:Vp,isObject:ni,isPlain:Fr,merge:ve,values:Hp,defineLazyProperty:Da});let Kl=!1,zp=null,qt=!1,Wp,Gp=!1,kr=!1,Cr=!1,si=!1,Yl=null,Pa=null;const O1=!!(x.cast&&x.cast.framework&&x.cast.framework.CastReceiverContext);let Xp=null,ea=!1,Ra=!1,ta=!1,Na=!1,ia=!1,ra=!1,na=!1;const $n=!!(Wr()&&("ontouchstart"in x||x.navigator.maxTouchPoints||x.DocumentTouch&&x.document instanceof x.DocumentTouch)),Li=x.navigator&&x.navigator.userAgentData;Li&&Li.platform&&Li.brands&&(qt=Li.platform==="Android",kr=!!Li.brands.find(i=>i.brand==="Microsoft Edge"),Cr=!!Li.brands.find(i=>i.brand==="Chromium"),si=!kr&&Cr,Yl=Pa=(Li.brands.find(i=>i.brand==="Chromium")||{}).version||null,Ra=Li.platform==="Windows");if(!Cr){const i=x.navigator&&x.navigator.userAgent||"";Kl=/iPod/i.test(i),zp=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),qt=/Android/i.test(i),Wp=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null}(),Gp=/Firefox/i.test(i),kr=/Edg/i.test(i),Cr=/Chrome/i.test(i)||/CriOS/i.test(i),si=!kr&&Cr,Yl=Pa=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Xp=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),ia=/Tizen/i.test(i),ra=/Web0S/i.test(i),na=ia||ra,ea=/Safari/i.test(i)&&!si&&!qt&&!kr&&!na,Ra=/Windows/i.test(i),ta=/iPad/i.test(i)||ea&&$n&&!/iPhone/i.test(i),Na=/iPhone/i.test(i)&&!ta}const Ze=Na||ta||Kl,Oa=(ea||Ze)&&!si;var Kp=Object.freeze({__proto__:null,get IS_IPOD(){return Kl},get IOS_VERSION(){return zp},get IS_ANDROID(){return qt},get ANDROID_VERSION(){return Wp},get IS_FIREFOX(){return Gp},get IS_EDGE(){return kr},get IS_CHROMIUM(){return Cr},get IS_CHROME(){return si},get CHROMIUM_VERSION(){return Yl},get CHROME_VERSION(){return Pa},IS_CHROMECAST_RECEIVER:O1,get IE_VERSION(){return Xp},get IS_SAFARI(){return ea},get IS_WINDOWS(){return Ra},get IS_IPAD(){return ta},get IS_IPHONE(){return Na},get IS_TIZEN(){return ia},get IS_WEBOS(){return ra},get IS_SMART_TV(){return na},TOUCH_ENABLED:$n,IS_IOS:Ze,IS_ANY_SAFARI:Oa});function bd(i){return typeof i=="string"&&!!i.trim()}function U1(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Wr(){return G===x.document}function Gr(i){return ni(i)&&i.nodeType===1}function Yp(){try{return x.parent!==x.self}catch{return!0}}function Qp(i){return function(e,t){if(!bd(e))return G[i](null);bd(t)&&(t=G.querySelector(t));const r=Gr(t)?t:G;return r[i]&&r[i](e)}}function se(i="div",e={},t={},r){const n=G.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(s){const a=e[s];s==="textContent"?Bi(n,a):(n[s]!==a||s==="tabIndex")&&(n[s]=a)}),Object.getOwnPropertyNames(t).forEach(function(s){n.setAttribute(s,t[s])}),r&&Ql(n,r),n}function Bi(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function Jo(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Pn(i,e){return U1(e),i.classList.contains(e)}function Zi(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function Ua(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(ue.warn("removeClass was called with an element that doesn't exist"),null)}function Jp(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function Zp(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r>"u"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function Ri(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let n=r.length-1;n>=0;n--){const s=r[n].name;let a=r[n].value;t.includes(s)&&(a=a!==null),e[s]=a}}return e}function eg(i,e){return i.getAttribute(e)}function jr(i,e,t){i.setAttribute(e,t)}function Ma(i,e){i.removeAttribute(e)}function tg(){G.body.focus(),G.onselectstart=function(){return!1}}function ig(){G.onselectstart=function(){return!0}}function qr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat($r(i,"height"))),t.width||(t.width=parseFloat($r(i,"width"))),t}}function Vn(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,n=0;for(;i.offsetParent&&i!==G[Zs.fullscreenElement];)r+=i.offsetLeft,n+=i.offsetTop,i=i.offsetParent;return{left:r,top:n,width:e,height:t}}function Ba(i,e){const t={x:0,y:0};if(Ze){let g=i;for(;g&&g.nodeName.toLowerCase()!=="html";){const b=$r(g,"transform");if(/^matrix/.test(b)){const S=b.slice(7,-1).split(/,\s/).map(Number);t.x+=S[4],t.y+=S[5]}else if(/^matrix3d/.test(b)){const S=b.slice(9,-1).split(/,\s/).map(Number);t.x+=S[12],t.y+=S[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&x.WebKitCSSMatrix){const S=x.getComputedStyle(g.assignedSlot.parentElement).transform,w=new x.WebKitCSSMatrix(S);t.x+=w.m41,t.y+=w.m42}g=g.parentNode||g.host}}const r={},n=Vn(e.target),s=Vn(i),a=s.width,l=s.height;let u=e.offsetY-(s.top-n.top),p=e.offsetX-(s.left-n.left);return e.changedTouches&&(p=e.changedTouches[0].pageX-s.left,u=e.changedTouches[0].pageY+s.top,Ze&&(p-=t.x,u-=t.y)),r.y=1-Math.max(0,Math.min(1,u/l)),r.x=Math.max(0,Math.min(1,p/a)),r}function rg(i){return ni(i)&&i.nodeType===3}function Fa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function ng(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Gr(e)||rg(e))return e;if(typeof e=="string"&&/\S/.test(e))return G.createTextNode(e)}).filter(e=>e)}function Ql(i,e){return ng(e).forEach(t=>i.appendChild(t)),i}function sg(i,e){return Ql(Fa(i),e)}function Hn(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Ui=Qp("querySelector"),ag=Qp("querySelectorAll");function $r(i,e){if(!i||!e)return"";if(typeof x.getComputedStyle=="function"){let t;try{t=x.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function og(i){[...G.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),r=G.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch{const t=G.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,i.document.head.appendChild(t)}})}var lg=Object.freeze({__proto__:null,isReal:Wr,isEl:Gr,isInFrame:Yp,createEl:se,textContent:Bi,prependTo:Jo,hasClass:Pn,addClass:Zi,removeClass:Ua,toggleClass:Jp,setAttributes:Zp,getAttributes:Ri,getAttribute:eg,setAttribute:jr,removeAttribute:Ma,blockTextSelection:tg,unblockTextSelection:ig,getBoundingClientRect:qr,findPosition:Vn,getPointerPosition:Ba,isTextNode:rg,emptyEl:Fa,normalizeContent:ng,appendContent:Ql,insertContent:sg,isSingleLeftClick:Hn,$:Ui,$$:ag,computedStyle:$r,copyStyleSheetsToWindow:og});let ug=!1,Zo;const M1=function(){if(Zo.options.autoSetup===!1)return;const i=Array.prototype.slice.call(G.getElementsByTagName("video")),e=Array.prototype.slice.call(G.getElementsByTagName("audio")),t=Array.prototype.slice.call(G.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let n=0,s=r.length;n<s;n++){const a=r[n];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Zo(a);else{el(1);break}}else ug||el(1)};function el(i,e){Wr()&&(e&&(Zo=e),x.setTimeout(M1,i))}function tl(){ug=!0,x.removeEventListener("load",tl)}Wr()&&(G.readyState==="complete"?tl():x.addEventListener("load",tl));const cg=function(i){const e=G.createElement("style");return e.className=i,e},dg=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var ct=new WeakMap;const B1=3;let F1=B1;function Pt(){return F1++}function vd(i,e){if(!ct.has(i))return;const t=ct.get(i);t.handlers[e].length===0&&(delete t.handlers[e],i.removeEventListener?i.removeEventListener(e,t.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&ct.delete(i)}function Jl(i,e,t,r){t.forEach(function(n){i(e,n,r)})}function ja(i){if(i.fixed_)return i;function e(){return!0}function t(){return!1}if(!i||!i.isPropagationStopped||!i.isImmediatePropagationStopped){const r=i||x.event;i={};const n=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const s in r)n.includes(s)||s==="returnValue"&&r.preventDefault||(i[s]=r[s]);if(i.target||(i.target=i.srcElement||G),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){r.preventDefault&&r.preventDefault(),i.returnValue=!1,r.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),i.cancelBubble=!0,r.cancelBubble=!0,i.isPropagationStopped=e},i.isPropagationStopped=t,i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),i.isImmediatePropagationStopped=e,i.stopPropagation()},i.isImmediatePropagationStopped=t,i.clientX!==null&&i.clientX!==void 0){const s=G.documentElement,a=G.body;i.pageX=i.clientX+(s&&s.scrollLeft||a&&a.scrollLeft||0)-(s&&s.clientLeft||a&&a.clientLeft||0),i.pageY=i.clientY+(s&&s.scrollTop||a&&a.scrollTop||0)-(s&&s.clientTop||a&&a.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}let Os;const j1=function(){if(typeof Os!="boolean"){Os=!1;try{const i=Object.defineProperty({},"passive",{get(){Os=!0}});x.addEventListener("test",null,i),x.removeEventListener("test",null,i)}catch{}}return Os},q1=["touchstart","touchmove"];function kt(i,e,t){if(Array.isArray(e))return Jl(kt,i,e,t);ct.has(i)||ct.set(i,{});const r=ct.get(i);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),t.guid||(t.guid=Pt()),r.handlers[e].push(t),r.dispatcher||(r.disabled=!1,r.dispatcher=function(n,s){if(r.disabled)return;n=ja(n);const a=r.handlers[n.type];if(a){const l=a.slice(0);for(let u=0,p=l.length;u<p&&!n.isImmediatePropagationStopped();u++)try{l[u].call(i,n,s)}catch(g){ue.error(g)}}}),r.handlers[e].length===1)if(i.addEventListener){let n=!1;j1()&&q1.indexOf(e)>-1&&(n={passive:!0}),i.addEventListener(e,r.dispatcher,n)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function et(i,e,t){if(!ct.has(i))return;const r=ct.get(i);if(!r.handlers)return;if(Array.isArray(e))return Jl(et,i,e,t);const n=function(a,l){r.handlers[l]=[],vd(a,l)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&n(i,a);return}const s=r.handlers[e];if(s){if(!t){n(i,e);return}if(t.guid)for(let a=0;a<s.length;a++)s[a].guid===t.guid&&s.splice(a--,1);vd(i,e)}}function Xr(i,e,t){const r=ct.has(i)?ct.get(i):{},n=i.parentNode||i.ownerDocument;if(typeof e=="string"?e={type:e,target:i}:e.target||(e.target=i),e=ja(e),r.dispatcher&&r.dispatcher.call(i,e,t),n&&!e.isPropagationStopped()&&e.bubbles===!0)Xr.call(null,n,e,t);else if(!n&&!e.defaultPrevented&&e.target&&e.target[e.type]){ct.has(e.target)||ct.set(e.target,{});const s=ct.get(e.target);e.target[e.type]&&(s.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),s.disabled=!1)}return!e.defaultPrevented}function qa(i,e,t){if(Array.isArray(e))return Jl(qa,i,e,t);const r=function(){et(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Pt(),kt(i,e,r)}function Zl(i,e,t){const r=function(){et(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Pt(),kt(i,e,r)}var $1=Object.freeze({__proto__:null,fixEvent:ja,on:kt,off:et,trigger:Xr,one:qa,any:Zl});const Rt=30,Ce=function(i,e,t){e.guid||(e.guid=Pt());const r=e.bind(i);return r.guid=t?t+"_"+e.guid:e.guid,r},ai=function(i,e){let t=x.performance.now();return function(...r){const n=x.performance.now();n-t>=e&&(i(...r),t=n)}},hg=function(i,e,t,r=x){let n;const s=()=>{r.clearTimeout(n),n=null},a=function(){const l=this,u=arguments;let p=function(){n=null,p=null,t||i.apply(l,u)};!n&&t&&i.apply(l,u),r.clearTimeout(n),n=r.setTimeout(p,e)};return a.cancel=s,a};var V1=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Rt,bind_:Ce,throttle:ai,debounce:hg});let Tn;class Ct{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},kt(this,e,t),this.addEventListener=r}off(e,t){et(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},qa(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Zl(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=ja(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Xr(this,e)}queueTrigger(e){Tn||(Tn=new Map);const t=e.type||e;let r=Tn.get(this);r||(r=new Map,Tn.set(this,r));const n=r.get(t);r.delete(t),x.clearTimeout(n);const s=x.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,Tn.delete(this)),this.trigger(e)},0);r.set(t,s)}}Ct.prototype.allowedEvents_={};Ct.prototype.addEventListener=Ct.prototype.on;Ct.prototype.removeEventListener=Ct.prototype.off;Ct.prototype.dispatchEvent=Ct.prototype.trigger;const $a=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,mi=i=>i instanceof Ct||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),H1=(i,e)=>{mi(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},il=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,sa=(i,e,t)=>{if(!i||!i.nodeName&&!mi(i))throw new Error(`Invalid target for ${$a(e)}#${t}; must be a DOM node or evented object.`)},pg=(i,e,t)=>{if(!il(i))throw new Error(`Invalid event type for ${$a(e)}#${t}; must be a non-empty string or array.`)},gg=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${$a(e)}#${t}; must be a function.`)},Io=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let n,s,a;return r?(n=i.eventBusEl_,e.length>=3&&e.shift(),[s,a]=e):(n=e[0],s=e[1],a=e[2]),sa(n,i,t),pg(s,i,t),gg(a,i,t),a=Ce(i,a),{isTargetingSelf:r,target:n,type:s,listener:a}},Gi=(i,e,t,r)=>{sa(i,i,e),i.nodeName?$1[e](i,t,r):i[e](t,r)},z1={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Io(this,i,"on");if(Gi(t,"on",r,n),!e){const s=()=>this.off(t,r,n);s.guid=n.guid;const a=()=>this.off("dispose",s);a.guid=n.guid,Gi(this,"on","dispose",s),Gi(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Io(this,i,"one");if(e)Gi(t,"one",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Gi(t,"one",r,s)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Io(this,i,"any");if(e)Gi(t,"any",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Gi(t,"any",r,s)}},off(i,e,t){if(!i||il(i))et(this.eventBusEl_,i,e);else{const r=i,n=e;sa(r,this,"off"),pg(n,this,"off"),gg(t,this,"off"),t=Ce(this,t),this.off("dispose",t),r.nodeName?(et(r,n,t),et(r,"dispose",t)):mi(r)&&(r.off(n,t),r.off("dispose",t))}},trigger(i,e){sa(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!il(t))throw new Error(`Invalid event type for ${$a(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Xr(this.eventBusEl_,i,e)}};function eu(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=se("span",{className:"vjs-event-bus"});return Object.assign(i,z1),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&ct.has(r)&&ct.delete(r)}),x.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const W1={state:{},setState(i){typeof i=="function"&&(i=i());let e;return wr(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&mi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function mg(i,e){return Object.assign(i,W1),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&mi(i)&&i.on("statechanged",i.handleStateChanged),i}const Rn=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},Be=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},fg=function(i,e){return Be(i)===Be(e)};var G1=Object.freeze({__proto__:null,toLowerCase:Rn,toTitleCase:Be,titleCaseEquals:fg});class ${constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ve({},this.options_),t=this.options_=ve(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${Pt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(eu(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),mg(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=ve(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return se(e,t,r)}localize(e,t,r=e){const n=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),a=s&&s[n],l=n&&n.split("-")[0],u=s&&s[l];let p=r;return a&&a[e]?p=a[e]:u&&u[e]&&(p=u[e]),t&&(p=p.replace(/\{(\d+)\}/g,function(g,b){const S=t[b-1];let w=S;return typeof S>"u"&&(w=g),w})),p}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,n)=>r.concat(n),[]);let t=this;for(let r=0;r<e.length;r++)if(t=t.getChild(e[r]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const r="http://www.w3.org/2000/svg",n=se("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),s=G.createElementNS(r,"svg");s.setAttributeNS(null,"viewBox","0 0 512 512");const a=G.createElementNS(r,"use");return s.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),n.appendChild(s),this.iconIsSet_?t.replaceChild(n,t.querySelector(".vjs-icon-placeholder")):t.appendChild(n),this.iconIsSet_=!0,n}addChild(e,t={},r=this.children_.length){let n,s;if(typeof e=="string"){s=Be(e);const a=t.componentClass||s;t.name=s;const l=$.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;n=new l(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(r,0,n),n.parentComponent_=this,typeof n.id=="function"&&(this.childIndex_[n.id()]=n),s=s||n.name&&Be(n.name()),s&&(this.childNameIndex_[s]=n,this.childNameIndex_[Rn(s)]=n),typeof n.el=="function"&&n.el()){let a=null;this.children_[r+1]&&(this.children_[r+1].el_?a=this.children_[r+1].el_:Gr(this.children_[r+1])&&(a=this.children_[r+1])),this.contentEl().insertBefore(n.el(),a)}return n}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Be(e.name())]=null,this.childNameIndex_[Rn(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const l=a.name;let u=a.opts;if(t[l]!==void 0&&(u=t[l]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const p=this.addChild(l,u);p&&(this[l]=p)};let n;const s=$.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,u;return typeof a=="string"?(l=a,u=e[l]||this.options_[l]||{}):(l=a.name,u=a),{name:l,opts:u}}).filter(a=>{const l=$.getComponent(a.opts.componentClass||Be(a.name));return l&&!s.isTech(l)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Ui(e,t||this.contentEl())}$$(e,t){return ag(e,t||this.contentEl())}hasClass(e){return Pn(this.el_,e)}addClass(...e){Zi(this.el_,...e)}removeClass(...e){Ua(this.el_,...e)}toggleClass(e,t){Jp(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return eg(this.el_,e)}setAttribute(e,t){jr(this.el_,e,t)}removeAttribute(e){Ma(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],s=n.indexOf("px");return parseInt(s!==-1?n.slice(0,s):this.el_["offset"+Be(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=$r(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${Be(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},r={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:r}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const r=10,n=200;let s;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=x.performance.now(),s=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)s=!1;else if(t){const u=l.touches[0].pageX-t.pageX,p=l.touches[0].pageY-t.pageY;Math.sqrt(u*u+p*p)>r&&(s=!1)}});const a=function(){s=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,s===!0&&x.performance.now()-e<n&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ce(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const r=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",r),this.on("touchcancel",r)}setTimeout(e,t){var r;return e=Ce(this,e),this.clearTimersOnDispose_(),r=x.setTimeout(()=>{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),x.clearTimeout(e)),e}setInterval(e,t){e=Ce(this,e),this.clearTimersOnDispose_();const r=x.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),x.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ce(this,e),t=x.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Ce(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),x.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(s){const a=x.getComputedStyle(s,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function r(s){return!(!t(s.parentElement)||!t(s)||s.style.opacity==="0"||x.getComputedStyle(s).height==="0px"||x.getComputedStyle(s).width==="0px")}function n(s){if(s.offsetWidth+s.offsetHeight+s.getBoundingClientRect().height+s.getBoundingClientRect().width===0)return!1;const a={x:s.getBoundingClientRect().left+s.offsetWidth/2,y:s.getBoundingClientRect().top+s.offsetHeight/2};if(a.x<0||a.x>(G.documentElement.clientWidth||x.innerWidth)||a.y<0||a.y>(G.documentElement.clientHeight||x.innerHeight))return!1;let l=G.elementFromPoint(a.x,a.y);for(;l;){if(l===s)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&r(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const r=$.getComponent("Tech"),n=r&&r.isTech(t),s=$===t||$.prototype.isPrototypeOf(t.prototype);if(n||!s){let l;throw n?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=Be(e),$.components_||($.components_={});const a=$.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,u=Object.keys(l);if(l&&u.length>0&&u.map(p=>l[p]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return $.components_[e]=t,$.components_[Rn(e)]=t,t}static getComponent(e){if(!(!e||!$.components_))return $.components_[e]}}$.registerComponent("Component",$);function X1(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Td(i,e,t,r){return X1(i,r,t.length-1),t[r][e]}function Ao(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:Td.bind(null,"start",0,i),end:Td.bind(null,"end",1,i)},x.Symbol&&x.Symbol.iterator&&(e[x.Symbol.iterator]=()=>(i||[]).values()),e}function jt(i,e){return Array.isArray(i)?Ao(i):i===void 0||e===void 0?Ao():Ao([[i,e]])}const yg=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const s=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=t="-"),n=n>0||a>0?n+":":"",r=((n||s>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,n+r+t};let tu=yg;function _g(i){tu=i}function bg(){tu=yg}function nr(i,e=i){return tu(i,e)}var K1=Object.freeze({__proto__:null,createTimeRanges:jt,createTimeRange:jt,setFormatTime:_g,resetFormatTime:bg,formatTime:nr});function vg(i,e){let t=0,r,n;if(!e)return 0;(!i||!i.length)&&(i=jt(0,0));for(let s=0;s<i.length;s++)r=i.start(s),n=i.end(s),n>e&&(n=e),t+=n-r;return t/e}function Oe(i){if(i instanceof Oe)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:ni(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=Oe.defaultMessages[this.code]||"")}Oe.prototype.code=0;Oe.prototype.message="";Oe.prototype.status=null;Oe.prototype.metadata=null;Oe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Oe.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Oe.MEDIA_ERR_CUSTOM=0;Oe.prototype.MEDIA_ERR_CUSTOM=0;Oe.MEDIA_ERR_ABORTED=1;Oe.prototype.MEDIA_ERR_ABORTED=1;Oe.MEDIA_ERR_NETWORK=2;Oe.prototype.MEDIA_ERR_NETWORK=2;Oe.MEDIA_ERR_DECODE=3;Oe.prototype.MEDIA_ERR_DECODE=3;Oe.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Oe.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Oe.MEDIA_ERR_ENCRYPTED=5;Oe.prototype.MEDIA_ERR_ENCRYPTED=5;function Nn(i){return i!=null&&typeof i.then=="function"}function Jt(i){Nn(i)&&i.then(null,e=>{})}const rl=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,r)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},Y1=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=rl(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(r){return t.indexOf(r)===-1}).map(rl))},Q1=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>r.addCue(n))}),e.textTracks()};var Sd={textTracksToJson:Y1,jsonToTextTracks:Q1,trackToJson_:rl};const xo="vjs-modal-dialog";class Kr extends ${constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=se("div",{className:`${xo}-content`},{role:"document"}),this.descEl_=se("p",{className:`${xo}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Bi(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${xo} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let r=this.getChild("closeButton");if(t&&!r){const n=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),sg(t,e),this.trigger("modalfill"),n?r.insertBefore(t,n):r.appendChild(t);const s=this.getChild("closeButton");s&&r.appendChild(s.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Fa(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=G.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),r=this.el_.querySelector(":focus");let n;for(let s=0;s<t.length;s++)if(r===t[s]){n=s;break}G.activeElement===this.el_&&(n=0),e.shiftKey&&n===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof x.HTMLAnchorElement||t instanceof x.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof x.HTMLInputElement||t instanceof x.HTMLSelectElement||t instanceof x.HTMLTextAreaElement||t instanceof x.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof x.HTMLIFrameElement||t instanceof x.HTMLObjectElement||t instanceof x.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Kr.prototype.options_={pauseOnOpen:!0,temporary:!0};$.registerComponent("ModalDialog",Kr);class Vr extends Ct{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},mi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,n=this.length;r<n;r++)if(this[r]===e){t=this[r],t.off&&t.off(),this.tracks_.splice(r,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}Vr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const i in Vr.prototype.allowedEvents_)Vr.prototype["on"+i]=null;const Lo=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].enabled=!1)};class J1 extends Vr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Lo(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Lo(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Lo(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Do=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].selected=!1)};class Z1 extends Vr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Do(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&Do(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Do(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Tg extends Vr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class eS{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t<r;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let r=0,n=this.trackElements_.length;r<n;r++)if(e===this.trackElements_[r].track){t=this.trackElements_[r];break}return t}removeTrackElement_(e){for(let t=0,r=this.trackElements_.length;t<r;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class aa{constructor(e){aa.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let r=0;const n=e.length;this.cues_=e,this.length_=e.length;const s=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<n)for(r=t;r<n;r++)s.call(this,r)}getCueById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}const tS={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},iS={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},rS={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ed={disabled:"disabled",hidden:"hidden",showing:"showing"};class iu extends Ct{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Pt(),kind:e.kind||"",language:e.language||""};let r=e.label||"";for(const n in t)Object.defineProperty(this,n,{get(){return t[n]},set(){}});Object.defineProperty(this,"label",{get(){return r},set(n){n!==r&&(r=n,this.trigger("labelchange"))}})}}const ru=function(i){return new URL(i,G.baseURI)},Sg=function(i){return new URL(i,G.baseURI).href},nu=function(i){if(typeof i=="string"){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(i);if(e)return e.pop().toLowerCase()}return""},Va=function(i,e=x.location){return ru(i).origin!==e.origin};var nS=Object.freeze({__proto__:null,parseUrl:ru,getAbsoluteURL:Sg,getFileExtension:nu,isCrossOrigin:Va});const wd=function(i,e){const t=new x.WebVTT.Parser(x,x.vttjs,x.WebVTT.StringDecoder()),r=[];t.oncue=function(n){e.addCue(n)},t.onparsingerror=function(n){r.push(n)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(i),r.length>0&&(x.console&&x.console.groupCollapsed&&x.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(n=>ue.error(n)),x.console&&x.console.groupEnd&&x.console.groupEnd()),t.flush()},kd=function(i,e){const t={uri:i},r=Va(i);r&&(t.cors=r);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),yp(t,Ce(this,function(s,a,l){if(s)return ue.error(s,a);e.loaded_=!0,typeof x.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){ue.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return wd(l,e)}):wd(l,e)}))};class Qn extends iu{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=ve(e,{kind:rS[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=Ed[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const s=new aa(this.cues_),a=new aa(this.activeCues_);let l=!1;this.timeupdateHandler=Ce(this,function(p={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return r},set(p){Ed[p]&&r!==p&&(r=p,!this.preload_&&r!=="disabled"&&this.cues.length===0&&kd(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const p=this.tech_.currentTime(),g=[];for(let b=0,S=this.cues.length;b<S;b++){const w=this.cues[b];w.startTime<=p&&w.endTime>=p&&g.push(w)}if(l=!1,g.length!==this.activeCues_.length)l=!0;else for(let b=0;b<g.length;b++)this.activeCues_.indexOf(g[b])===-1&&(l=!0);return this.activeCues_=g,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&kd(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new x.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const r=this.tech_.textTracks();for(let n=0;n<r.length;n++)r[n]!==this&&r[n].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const r=this.cues_[t];if(r===e||r.originalCue_&&r.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}Qn.prototype.allowedEvents_={cuechange:"cuechange"};class Eg extends iu{constructor(e={}){const t=ve(e,{kind:iS[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"enabled",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class wg extends iu{constructor(e={}){const t=ve(e,{kind:tS[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"selected",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class bi extends Ct{constructor(e={}){super();let t;const r=new Qn(e);this.kind=r.kind,this.src=r.src,this.srclang=r.language,this.label=r.label,this.default=r.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return r}}}),t=bi.NONE,r.addEventListener("loadeddata",()=>{t=bi.LOADED,this.trigger({type:"load",target:this})})}}bi.prototype.allowedEvents_={load:"load"};bi.NONE=0;bi.LOADING=1;bi.LOADED=2;bi.ERROR=3;const Dt={audio:{ListClass:J1,TrackClass:Eg,capitalName:"Audio"},video:{ListClass:Z1,TrackClass:wg,capitalName:"Video"},text:{ListClass:Tg,TrackClass:Qn,capitalName:"Text"}};Object.keys(Dt).forEach(function(i){Dt[i].getterName=`${i}Tracks`,Dt[i].privateName=`${i}Tracks_`});const Hr={remoteText:{ListClass:Tg,TrackClass:Qn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:eS,TrackClass:bi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},lt=Object.assign({},Dt,Hr);Hr.names=Object.keys(Hr);Dt.names=Object.keys(Dt);lt.names=[].concat(Hr.names).concat(Dt.names);function sS(i,e,t,r,n={}){const s=i.textTracks();n.kind=e,t&&(n.label=t),r&&(n.language=r),n.tech=i;const a=new lt.text.TrackClass(n);return s.addTrack(a),a}class oe extends ${constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),lt.names.forEach(r=>{const n=lt[r];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new lt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Ce(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return jt(0,0)}bufferedPercent(){return vg(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Dt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let n=r.length;for(;n--;){const s=r[n];t==="text"&&this.removeRemoteTextTrack(s),r.removeTrack(s)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Oe(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?jt(0,0):jt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Dt.names.forEach(e=>{const t=Dt[e],r=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),this.on("dispose",()=>{n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!x.WebVTT)if(G.body.contains(this.el())){if(!this.options_["vtt.js"]&&Fr(id)&&Object.keys(id).length>0){this.trigger("vttjsloaded");return}const e=G.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),x.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=l=>e.addTrack(l.track),n=l=>e.removeTrack(l.track);t.on("addtrack",r),t.on("removetrack",n),this.addWebVttScript_();const s=()=>this.trigger("texttrackchange"),a=()=>{s();for(let l=0;l<e.length;l++){const u=e[l];u.removeEventListener("cuechange",s),u.mode==="showing"&&u.addEventListener("cuechange",s)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",r),t.off("removetrack",n),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",s)})}addTextTrack(e,t,r){if(!e)throw new Error("TextTrack kind is required but was not provided");return sS(this,e,t,r)}createRemoteTextTrack(e){const t=ve(e,{tech:this});return new Hr.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const r=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Pt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return oe.canPlayType(e.type)}static isTech(e){return e.prototype instanceof oe||e instanceof oe||e===oe}static registerTech(e,t){if(oe.techs_||(oe.techs_={}),!oe.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!oe.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!oe.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Be(e),oe.techs_[e]=t,oe.techs_[Rn(e)]=t,e!=="Tech"&&oe.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(oe.techs_&&oe.techs_[e])return oe.techs_[e];if(e=Be(e),x&&x.videojs&&x.videojs[e])return ue.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),x.videojs[e]}}}lt.names.forEach(function(i){const e=lt[i];oe.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});oe.prototype.featuresVolumeControl=!0;oe.prototype.featuresMuteControl=!0;oe.prototype.featuresFullscreenResize=!1;oe.prototype.featuresPlaybackRate=!1;oe.prototype.featuresProgressEvents=!1;oe.prototype.featuresSourceset=!1;oe.prototype.featuresTimeupdateEvents=!1;oe.prototype.featuresNativeTextTracks=!1;oe.prototype.featuresVideoFrameCallback=!1;oe.withSourceHandlers=function(i){i.registerSourceHandler=function(e,t){let r=i.sourceHandlers;r||(r=i.sourceHandlers=[]),t===void 0&&(t=r.length),r.splice(t,0,e)},i.canPlayType=function(e){const t=i.sourceHandlers||[];let r;for(let n=0;n<t.length;n++)if(r=t[n].canPlayType(e),r)return r;return""},i.selectSourceHandler=function(e,t){const r=i.sourceHandlers||[];let n;for(let s=0;s<r.length;s++)if(n=r[s].canHandleSource(e,t),n)return r[s];return null},i.canPlaySource=function(e,t){const r=i.selectSourceHandler(e,t);return r?r.canHandleSource(e,t):""},["seekable","seeking","duration"].forEach(function(e){const t=this[e];typeof t=="function"&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(e){let t=i.selectSourceHandler(e,this.options_);t||(i.nativeSourceHandler?t=i.nativeSourceHandler:ue.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==i.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},i.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};$.registerComponent("Tech",oe);oe.registerTech("Tech",oe);oe.defaultTechOrder_=[];const er={},oa={},la={};function aS(i,e){er[i]=er[i]||[],er[i].push(e)}function oS(i,e,t){i.setTimeout(()=>Xi(e,er[e.type],t,i),1)}function lS(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function uS(i,e,t){return i.reduceRight(su(t),e[t]())}function cS(i,e,t,r){return e[t](i.reduce(su(t),r))}function Cd(i,e,t,r=null){const n="call"+Be(t),s=i.reduce(su(n),r),a=s===la,l=a?null:e[t](s);return pS(i,t,l,a),l}const dS={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},hS={setCurrentTime:1,setMuted:1,setVolume:1},Id={play:1,pause:1};function su(i){return(e,t)=>e===la?la:t[i]?t[i](e):e}function pS(i,e,t,r){for(let n=i.length-1;n>=0;n--){const s=i[n];s[e]&&s[e](r,t)}}function gS(i){oa.hasOwnProperty(i.id())&&delete oa[i.id()]}function mS(i,e){const t=oa[i.id()];let r=null;if(t==null)return r=e(i),oa[i.id()]=[[e,r]],r;for(let n=0;n<t.length;n++){const[s,a]=t[n];s===e&&(r=a)}return r===null&&(r=e(i),t.push([e,r])),r}function Xi(i={},e=[],t,r,n=[],s=!1){const[a,...l]=e;if(typeof a=="string")Xi(i,er[a],t,r,n,s);else if(a){const u=mS(r,a);if(!u.setSource)return n.push(u),Xi(i,l,t,r,n,s);u.setSource(Object.assign({},i),function(p,g){if(p)return Xi(i,l,t,r,n,s);n.push(u),Xi(g,i.type===g.type?l:er[g.type],t,r,n,s)})}else l.length?Xi(i,l,t,r,n,s):s?t(i,n):Xi(i,er["*"],t,r,n,!0)}const fS={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},ua=function(i=""){const e=nu(i);return fS[e.toLowerCase()]||""},yS=(i,e)=>{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let n=0;n<r.length;n++){const s=r[n];if(s.type&&s.src&&s.src===e)return s.type}return ua(e)},kg=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=kg(t),Array.isArray(t)?e=e.concat(t):ni(t)&&e.push(t)}),i=e}else typeof i=="string"&&i.trim()?i=[Ad({src:i})]:ni(i)&&typeof i.src=="string"&&i.src&&i.src.trim()?i=[Ad(i)]:i=[];return i};function Ad(i){if(!i.type){const e=ua(i.src);e&&(i.type=e)}return i}var _S=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
27
|
+
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const mT=" ",wo=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},gT=function(){const i='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+i+")")},ct=function(i){const e={};if(!i)return e;const t=i.split(gT());let r=t.length,n;for(;r--;)t[r]!==""&&(n=/([^=]*)=(.*)/.exec(t[r]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},ad=i=>{const e=i.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class fT extends Fl{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,r;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,s)=>{const a=s(e);return a===e?n:n.concat([a])},[e]).forEach(n=>{for(let s=0;s<this.customParsers.length;s++)if(this.customParsers[s].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){r={type:"tag",tagType:"inf"},t[1]&&(r.duration=parseFloat(t[1])),t[2]&&(r.title=t[2]),this.trigger("data",r);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"targetduration"},t[1]&&(r.duration=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"version"},t[1]&&(r.version=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"media-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){r={type:"tag",tagType:"playlist-type"},t[1]&&(r.playlistType=t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){r=Ge(wo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){r={type:"tag",tagType:"allow-cache"},t[1]&&(r.allowed=!/NO/.test(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(r={type:"tag",tagType:"map"},t[1]){const s=ct(t[1]);s.URI&&(r.uri=s.URI),s.BYTERANGE&&(r.byterange=wo(s.BYTERANGE))}this.trigger("data",r);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"stream-inf"},t[1]&&(r.attributes=ct(t[1]),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=ad(r.attributes.RESOLUTION)),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"]&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10))),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){r={type:"tag",tagType:"media"},t[1]&&(r.attributes=ct(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){r={type:"tag",tagType:"program-date-time"},t[1]&&(r.dateTimeString=t[1],r.dateTimeObject=new Date(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){r={type:"tag",tagType:"key"},t[1]&&(r.attributes=ct(t[1]),r.attributes.IV&&(r.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV))),this.trigger("data",r);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){r={type:"tag",tagType:"start"},t[1]&&(r.attributes=ct(t[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out-cont"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-in"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"skip"},r.attributes=ct(t[1]),r.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(r.attributes["SKIPPED-SEGMENTS"]=parseInt(r.attributes["SKIPPED-SEGMENTS"],10)),r.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(r.attributes["RECENTLY-REMOVED-DATERANGES"]=r.attributes["RECENTLY-REMOVED-DATERANGES"].split(mT)),this.trigger("data",r);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part"},r.attributes=ct(t[1]),["DURATION"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["INDEPENDENT","GAP"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),r.attributes.hasOwnProperty("BYTERANGE")&&(r.attributes.byterange=wo(r.attributes.BYTERANGE)),this.trigger("data",r);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"server-control"},r.attributes=ct(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=/YES/.test(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part-inf"},r.attributes=ct(t[1]),["PART-TARGET"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseFloat(r.attributes[s]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"preload-hint"},r.attributes=ct(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(s){if(r.attributes.hasOwnProperty(s)){r.attributes[s]=parseInt(r.attributes[s],10);const a=s==="BYTERANGE-LENGTH"?"length":"offset";r.attributes.byterange=r.attributes.byterange||{},r.attributes.byterange[a]=r.attributes[s],delete r.attributes[s]}}),this.trigger("data",r);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"rendition-report"},r.attributes=ct(t[1]),["LAST-MSN","LAST-PART"].forEach(function(s){r.attributes.hasOwnProperty(s)&&(r.attributes[s]=parseInt(r.attributes[s],10))}),this.trigger("data",r);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"daterange"},r.attributes=ct(t[1]),["ID","CLASS"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=String(r.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=new Date(r.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=/YES/i.test(r.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=r.attributes[a].toString(16))});const s=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in r.attributes){if(!s.test(a))continue;const l=/[0-9A-Fa-f]{6}/g.test(r.attributes[a]),u=/^\d+(\.\d+)?$/.test(r.attributes[a]);r.attributes[a]=l?r.attributes[a].toString(16):u?parseFloat(r.attributes[a]):String(r.attributes[a])}this.trigger("data",r);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){r={type:"tag",tagType:"content-steering"},r.attributes=ct(t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"i-frame-playlist"},r.attributes=ct(t[1]),r.attributes.URI&&(r.uri=r.attributes.URI),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=ad(r.attributes.RESOLUTION)),r.attributes["AVERAGE-BANDWIDTH"]&&(r.attributes["AVERAGE-BANDWIDTH"]=parseInt(r.attributes["AVERAGE-BANDWIDTH"],10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),this.trigger("data",r);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){r={type:"tag",tagType:"define"},r.attributes=ct(t[1]),this.trigger("data",r);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}}addParser({expression:e,customType:t,dataParser:r,segment:n}){typeof r!="function"&&(r=s=>s),this.customParsers.push(s=>{if(e.exec(s))return this.trigger("data",{type:"custom",data:r(s),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const r=n=>e.test(n)?t(n):n;this.tagMappers.push(r)}}const yT=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Pi=function(i){const e={};return Object.keys(i).forEach(function(t){e[yT(t)]=i[t]}),e},ko=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:r}=i;if(!e)return;const n="#EXT-X-SERVER-CONTROL",s="holdBack",a="partHoldBack",l=t&&t*3,u=r&&r*2;t&&!e.hasOwnProperty(s)&&(e[s]=l,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${l}).`})),l&&e[s]<l&&(this.trigger("warn",{message:`${n} clamping HOLD-BACK (${e[s]}) to targetDuration * 3 (${l})`}),e[s]=l),r&&!e.hasOwnProperty(a)&&(e[a]=r*3,this.trigger("info",{message:`${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),r&&e[a]<u&&(this.trigger("warn",{message:`${n} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${u}).`}),e[a]=u)};class _T extends Fl{constructor(e={}){super(),this.lineStream=new pT,this.parseStream=new fT,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,r=[];let n={},s,a,l=!1;const u=function(){},p={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let S=0,w=0;const C={};this.on("end",()=>{n.uri||!n.parts&&!n.preloadHints||(!n.map&&s&&(n.map=s),!n.key&&a&&(n.key=a),!n.timeline&&typeof _=="number"&&(n.timeline=_),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(v){let L,D;if(t.manifest.definitions){for(const O in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${O}}`,t.manifest.definitions[O])),v.attributes)for(const U in v.attributes)typeof v.attributes[U]=="string"&&(v.attributes[U]=v.attributes[U].replace(`{$${O}}`,t.manifest.definitions[O]))}({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const O={};"length"in v&&(n.byterange=O,O.length=v.length,"offset"in v||(v.offset=S)),"offset"in v&&(n.byterange=O,O.offset=v.offset),S=O.offset+O.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.title&&(n.title=v.title),v.duration>0&&(n.duration=v.duration),v.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){a=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:Lp(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(a.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,_=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){s={},v.uri&&(s.uri=v.uri),v.byterange&&(s.byterange=v.byterange),a&&(s.key=a)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||p,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),Ge(n.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||p,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const O=this.manifest.mediaGroups[v.attributes.TYPE];O[v.attributes["GROUP-ID"]]=O[v.attributes["GROUP-ID"]]||{},L=O[v.attributes["GROUP-ID"]],D={default:/yes/i.test(v.attributes.DEFAULT)},D.default?D.autoselect=!0:D.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(D.language=v.attributes.LANGUAGE),v.attributes.URI&&(D.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(D.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(D.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(D.forced=/yes/i.test(v.attributes.FORCED)),L[v.attributes.NAME]=D},discontinuity(){_+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),n.dateTimeString=v.dateTimeString,n.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:O}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),O===null&&this.manifest.segments.reduceRight((U,F)=>(F.programDateTime=U-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,ko.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){n.cueOut=v.data},"cue-out-cont"(){n.cueOutCont=v.data},"cue-in"(){n.cueIn=v.data},skip(){this.manifest.skip=Pi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;const O=this.manifest.segments.length,U=Pi(v.attributes);n.parts=n.parts||[],n.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=w),w=U.byterange.offset+U.byterange.length);const F=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${O}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((R,q)=>{R.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${q} lacks required attribute(s): LAST-PART`})})},"server-control"(){const O=this.manifest.serverControl=Pi(v.attributes);O.hasOwnProperty("canBlockReload")||(O.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),ko.call(this,this.manifest),O.canSkipDateranges&&!O.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const O=this.manifest.segments.length,U=Pi(v.attributes),F=U.type&&U.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=F?w:0,F&&(w=U.byterange.offset+U.byterange.length)));const R=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${R} for segment #${O}`,v.attributes,["TYPE","URI"]),!!U.type)for(let q=0;q<n.preloadHints.length-1;q++){const J=n.preloadHints[q];J.type&&J.type===U.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${R} for segment #${O} has the same TYPE ${U.type} as preload hint #${q}`})}},"rendition-report"(){const O=Pi(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(O);const U=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];l&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${U}`,v.attributes,F)},"part-inf"(){this.manifest.partInf=Pi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),ko.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Pi(v.attributes));const O=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${O}`,v.attributes,["ID","START-DATE"]);const U=this.manifest.dateRanges[O];U.endDate&&U.startDate&&new Date(U.endDate)<new Date(U.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),U.duration&&U.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),U.plannedDuration&&U.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!U.endOnNext;if(F&&!U.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(U.duration||U.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),U.duration&&U.endDate){const R=U.startDate.getTime()+U.duration*1e3;this.manifest.dateRanges[O].endDate=new Date(R)}if(!C[U.id])C[U.id]=U;else{for(const q in C[U.id])if(U[q]&&JSON.stringify(C[U.id][q])!==JSON.stringify(U[q])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const R=this.manifest.dateRanges.findIndex(q=>q.id===U.id);this.manifest.dateRanges[R]=Ge(this.manifest.dateRanges[R],U),C[U.id]=Ge(C[U.id],U),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Pi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const O=(U,F)=>{if(U in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${U}`});return}this.manifest.definitions[U]=F};if("QUERYPARAM"in v.attributes){if("NAME"in v.attributes||"IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const U=this.params.get(v.attributes.QUERYPARAM);if(!U){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}O(v.attributes.QUERYPARAM,decodeURIComponent(U));return}if("NAME"in v.attributes){if("IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in v.attributes)||typeof v.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${v.attributes.NAME}`});return}O(v.attributes.NAME,v.attributes.VALUE);return}if("IMPORT"in v.attributes){if(!this.mainDefinitions[v.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${v.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}O(v.attributes.IMPORT,this.mainDefinitions[v.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:v.attributes,uri:v.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",v.attributes,["BANDWIDTH","URI"])}}[v.tagType]||u).call(t)},uri(){n.uri=v.uri,r.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=_,s&&(n.map=s),w=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){v.segment?(n.custom=n.custom||{},n.custom[v.customType]=v.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[v.customType]=v.data)}})[v.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,r){const n=[];r.forEach(function(s){t.hasOwnProperty(s)||n.push(s)}),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
28
|
+
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var ir={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},bT=["video","audio","text"],od=["Video","Audio","Text"],Dp=function(i){return i&&i.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,r){var n=("00"+Number(t).toString(16)).slice(-2),s=("00"+Number(r).toString(16)).slice(-2);return"avc1."+n+"00"+s})},ei=function(i){i===void 0&&(i="");var e=i.split(","),t=[];return e.forEach(function(r){r=r.trim();var n;bT.forEach(function(s){var a=ir[s].exec(r.toLowerCase());if(!(!a||a.length<=1)){n=s;var l=r.substring(0,a[1].length),u=r.replace(l,"");t.push({type:l,details:u,mediaType:s})}}),n||t.push({type:r,details:"",mediaType:"unknown"})}),t},vT=function(i,e){if(!i.mediaGroups.AUDIO||!e)return null;var t=i.mediaGroups.AUDIO[e];if(!t)return null;for(var r in t){var n=t[r];if(n.default&&n.playlists)return ei(n.playlists[0].attributes.CODECS)}return null},Pp=function(i){return i===void 0&&(i=""),ir.audio.test(i.trim().toLowerCase())},TT=function(i){return i===void 0&&(i=""),ir.text.test(i.trim().toLowerCase())},Fr=function(i){if(!(!i||typeof i!="string")){var e=i.toLowerCase().split(",").map(function(n){return Dp(n.trim())}),t="video";e.length===1&&Pp(e[0])?t="audio":e.length===1&&TT(e[0])&&(t="application");var r="mp4";return e.every(function(n){return ir.mp4.test(n)})?r="mp4":e.every(function(n){return ir.webm.test(n)})?r="webm":e.every(function(n){return ir.ogg.test(n)})&&(r="ogg"),t+"/"+r+';codecs="'+i+'"'}},On=function(i,e){return i===void 0&&(i=""),e===void 0&&(e=!1),x.MediaSource&&x.MediaSource.isTypeSupported&&x.MediaSource.isTypeSupported(Fr(i))||e&&x.ManagedMediaSource&&x.ManagedMediaSource.isTypeSupported&&x.ManagedMediaSource.isTypeSupported(Fr(i))||!1},Co=function(i){return i===void 0&&(i=""),i.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<od.length;t++){var r=od[t];if(ir["muxer"+r].test(e))return!0}return!1})},ld="mp4a.40.2",ST="avc1.4d400d",ET=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,wT=/^application\/dash\+xml/i,Rp=function(i){return ET.test(i)?"hls":wT.test(i)?"dash":i==="application/vnd.videojs.vhs+json"?"vhs-json":null},kT=function(i){return i.toString(2).length},CT=function(i){return Math.ceil(kT(i)/8)},Np=function(i){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer},IT=function(i){return Np(i)},ne=function(i){return i instanceof Uint8Array?i:(!Array.isArray(i)&&!IT(i)&&!(i instanceof ArrayBuffer)&&(typeof i!="number"||typeof i=="number"&&i!==i?i=0:i=[i]),new Uint8Array(i&&i.buffer||i,i&&i.byteOffset||0,i&&i.byteLength||0))},tt=x.BigInt||Number,Xo=[tt("0x1"),tt("0x100"),tt("0x10000"),tt("0x1000000"),tt("0x100000000"),tt("0x10000000000"),tt("0x1000000000000"),tt("0x100000000000000"),tt("0x10000000000000000")];(function(){var i=new Uint16Array([65484]),e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var AT=function(i,e){var t=e===void 0?{}:e,r=t.signed,n=r===void 0?!1:r,s=t.le,a=s===void 0?!1:s;i=ne(i);var l=a?"reduce":"reduceRight",u=i[l]?i[l]:Array.prototype[l],p=u.call(i,function(_,S,w){var C=a?w:Math.abs(w+1-i.length);return _+tt(S)*Xo[C]},tt(0));if(n){var m=Xo[i.length]/tt(2)-tt(1);p=tt(p),p>m&&(p-=m,p-=m,p-=tt(2))}return Number(p)},xT=function(i,e){var t={},r=t.le,n=r===void 0?!1:r;(typeof i!="bigint"&&typeof i!="number"||typeof i=="number"&&i!==i)&&(i=0),i=tt(i);for(var s=CT(i),a=new Uint8Array(new ArrayBuffer(s)),l=0;l<s;l++){var u=n?l:Math.abs(l+1-a.length);a[u]=Number(i/Xo[l]&tt(255)),i<0&&(a[u]=Math.abs(~a[u]),a[u]-=l===0?1:2)}return a},Op=function(i,e){if(typeof i!="string"&&i&&typeof i.toString=="function"&&(i=i.toString()),typeof i!="string")return new Uint8Array;e||(i=unescape(encodeURIComponent(i)));for(var t=new Uint8Array(i.length),r=0;r<i.length;r++)t[r]=i.charCodeAt(r);return t},LT=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return ne(e[0]);var r=e.reduce(function(a,l,u){return a+(l.byteLength||l.length)},0),n=new Uint8Array(r),s=0;return e.forEach(function(a){a=ne(a),n.set(a,s),s+=a.byteLength}),n},Oe=function(i,e,t){var r=t===void 0?{}:t,n=r.offset,s=n===void 0?0:n,a=r.mask,l=a===void 0?[]:a;i=ne(i),e=ne(e);var u=e.every?e.every:Array.prototype.every;return e.length&&i.length-s>=e.length&&u.call(e,function(p,m){var _=l[m]?l[m]&i[s+m]:i[s+m];return p===_})},DT=function(i,e,t){e.forEach(function(r){for(var n in i.mediaGroups[r])for(var s in i.mediaGroups[r][n]){var a=i.mediaGroups[r][n][s];t(a,r,n,s)}})};/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const ud=i=>!!i&&typeof i=="object",Ze=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):ud(e[r])&&ud(t[r])?e[r]=Ze(e[r],t[r]):e[r]=t[r]}),e),{}),Up=i=>Object.keys(i).map(e=>i[e]),PT=(i,e)=>{const t=[];for(let r=i;r<e;r++)t.push(r);return t},jr=i=>i.reduce((e,t)=>e.concat(t),[]),Mp=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},RT=(i,e)=>i.reduce((t,r,n)=>(r[e]&&t.push(n),t),[]),NT=(i,e)=>Up(i.reduce((t,r)=>(r.forEach(n=>{t[e(n)]=n}),t),{}));var $r={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const zn=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const n={uri:e,resolvedUri:Aa(i||"",e)};if(t||r){const s=(t||r).split("-");let a=x.BigInt?x.BigInt(s[0]):parseInt(s[0],10),l=x.BigInt?x.BigInt(s[1]):parseInt(s[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l));let u;typeof l=="bigint"||typeof a=="bigint"?u=x.BigInt(l)-x.BigInt(a)+x.BigInt(1):u=l-a+1,typeof u=="bigint"&&u<Number.MAX_SAFE_INTEGER&&(u=Number(u)),n.byterange={length:u,offset:a}}return n},OT=i=>{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=x.BigInt(i.offset)+x.BigInt(i.length)-x.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},cd=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),UT={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:n}=i,s=cd(i.endNumber),a=e/t;return typeof s=="number"?{start:0,end:s}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:n=1,duration:s,periodStart:a=0,minimumUpdatePeriod:l=0,timeShiftBufferDepth:u=1/0}=i,p=cd(i.endNumber),m=(e+t)/1e3,_=r+a,S=m+l-_,w=Math.ceil(S*n/s),C=Math.floor((m-_-u)*n/s),v=Math.floor((m-_)*n/s);return{start:Math.max(0,C),end:typeof p=="number"?p:Math.min(w,v)}}},MT=i=>e=>{const{duration:t,timescale:r=1,periodStart:n,startNumber:s=1}=i;return{number:s+e,duration:t/r,timeline:n,time:e*t}},$l=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:n,sourceDuration:s}=i,{start:a,end:l}=UT[e](i),u=PT(a,l).map(MT(i));if(e==="static"){const p=u.length-1,m=typeof n=="number"?n:s;u[p].duration=m-t/r*p}return u},Bp=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:n="",periodStart:s,presentationTime:a,number:l=0,duration:u}=i;if(!e)throw new Error($r.NO_BASE_URL);const p=zn({baseUrl:e,source:t.sourceURL,range:t.range}),m=zn({baseUrl:e,source:e,indexRange:n});if(m.map=p,u){const _=$l(i);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else r&&(m.duration=r,m.timeline=s);return m.presentationTime=a||s,m.number=l,[m]},ql=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,n=i.sidx.duration,s=i.timeline||0,a=i.sidx.byterange,l=a.offset+a.length,u=e.timescale,p=e.references.filter(L=>L.referenceType!==1),m=[],_=i.endList?"static":"dynamic",S=i.sidx.timeline;let w=S,C=i.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=x.BigInt(l)+e.firstOffset:v=l+e.firstOffset;for(let L=0;L<p.length;L++){const D=e.references[L],O=D.referencedSize,U=D.subsegmentDuration;let F;typeof v=="bigint"?F=v+x.BigInt(O)-x.BigInt(1):F=v+O-1;const R=`${v}-${F}`,q=Bp({baseUrl:t,timescale:u,timeline:s,periodStart:S,presentationTime:w,number:C,duration:U,sourceDuration:n,indexRange:R,type:_})[0];r&&(q.map=r),m.push(q),typeof v=="bigint"?v+=x.BigInt(O):v+=O,w+=U/u,C++}return i.segments=m,i},BT=["AUDIO","SUBTITLES"],FT=1/60,Fp=i=>NT(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),jT=(i,e)=>{for(let t=0;t<i.length;t++)if(i[t].attributes.NAME===e)return i[t];return null},dd=i=>{let e=[];return DT(i,BT,(t,r,n,s)=>{e=e.concat(t.playlists||[])}),e},hd=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},$T=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:l}){return l===r.timeline});const n=jT(i,r.attributes.NAME);if(!n||r.sidx)return;const s=r.segments[0],a=n.segments.findIndex(function(l){return Math.abs(l.presentationTime-s.presentationTime)<FT});if(a===-1){hd({playlist:r,mediaSequence:n.mediaSequence+n.segments.length}),r.segments[0].discontinuity=!0,r.discontinuityStarts.unshift(0),(!n.segments.length&&r.timeline>n.timeline||n.segments.length&&r.timeline>n.segments[n.segments.length-1].timeline)&&r.discontinuitySequence--;return}n.segments[a].discontinuity&&!s.discontinuity&&(s.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),hd({playlist:r,mediaSequence:n.segments[a].number})})},qT=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(dd(i)),r=e.playlists.concat(dd(e));return e.timelineStarts=Fp([i.timelineStarts,e.timelineStarts]),$T({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},La=i=>i&&i.uri+"-"+OT(i.byterange),Io=i=>{const e=i.reduce(function(r,n){return r[n.attributes.baseUrl]||(r[n.attributes.baseUrl]=[]),r[n.attributes.baseUrl].push(n),r},{});let t=[];return Object.values(e).forEach(r=>{const n=Up(r.reduce((s,a)=>{const l=a.attributes.id+(a.attributes.lang||"");return s[l]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),s[l].segments.push(...a.segments)),a.attributes.contentProtection&&(s[l].attributes.contentProtection=a.attributes.contentProtection)):(s[l]=a,s[l].attributes.timelineStarts=[]),s[l].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),s},{}));t=t.concat(n)}),t.map(r=>(r.discontinuityStarts=RT(r.segments||[],"discontinuity"),r))},Vl=(i,e)=>{const t=La(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&ql(i,r,i.sidx.resolvedUri),i},VT=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=Vl(i[t],e);return i},HT=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:n,discontinuityStarts:s},a)=>{const l={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:n,discontinuityStarts:s,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(l.contentProtection=i.contentProtection),i.serviceLocation&&(l.attributes.serviceLocation=i.serviceLocation),t&&(l.sidx=t),a&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l},zT=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const s={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(s.CODECS=i.codecs);const a={attributes:s,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:n,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},WT=(i,e={},t=!1)=>{let r;const n=i.reduce((s,a)=>{const l=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let p=a.attributes.label||"main";if(u&&!a.attributes.label){const _=l?` (${l})`:"";p=`${a.attributes.lang}${_}`}s[p]||(s[p]={language:u,autoselect:!0,default:l==="main",playlists:[],uri:""});const m=Vl(HT(a,t),e);return s[p].playlists.push(m),typeof r>"u"&&l==="main"&&(r=a,r.default=!0),s},{});if(!r){const s=Object.keys(n)[0];n[s].default=!0}return n},GT=(i,e={})=>i.reduce((t,r)=>{const n=r.attributes.label||r.attributes.lang||"text",s=r.attributes.lang||"und";return t[n]||(t[n]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(Vl(zT(r),e)),t},{}),XT=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:n,language:s}=r;e[s]={autoselect:!1,default:!1,instreamId:n,language:s},r.hasOwnProperty("aspectRatio")&&(e[s].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[s].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[s]["3D"]=r["3D"])}),e),{}),KT=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const n={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(n.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(n.contentProtection=i.contentProtection),i.serviceLocation&&(n.attributes.serviceLocation=i.serviceLocation),t&&(n.sidx=t),n},YT=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",QT=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",JT=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",ZT=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,n)=>{r.number=n})})},pd=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],e1=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:n,eventStream:s})=>{if(!i.length)return{};const{sourceDuration:a,type:l,suggestedPresentationDelay:u,minimumUpdatePeriod:p}=i[0].attributes,m=Io(i.filter(YT)).map(KT),_=Io(i.filter(QT)),S=Io(i.filter(JT)),w=i.map(F=>F.attributes.captionServices).filter(Boolean),C={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:VT(m,r)};p>=0&&(C.minimumUpdatePeriod=p*1e3),e&&(C.locations=e),t&&(C.contentSteering=t),l==="dynamic"&&(C.suggestedPresentationDelay=u),s&&s.length>0&&(C.eventStream=s);const v=C.playlists.length===0,L=_.length?WT(_,r,v):null,D=S.length?GT(S,r):null,O=m.concat(pd(L),pd(D)),U=O.map(({timelineStarts:F})=>F);return C.timelineStarts=Fp(U),ZT(O,C.timelineStarts),L&&(C.mediaGroups.AUDIO.audio=L),D&&(C.mediaGroups.SUBTITLES.subs=D),w.length&&(C.mediaGroups["CLOSED-CAPTIONS"].cc=XT(w)),n?qT({oldManifest:n,newManifest:C}):C},t1=(i,e,t)=>{const{NOW:r,clientOffset:n,availabilityStartTime:s,timescale:a=1,periodStart:l=0,minimumUpdatePeriod:u=0}=i,p=(r+n)/1e3,m=s+l,_=p+u-m;return Math.ceil((_*a-e)/t)},jp=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:n="",sourceDuration:s,timescale:a=1,startNumber:l=1,periodStart:u}=i,p=[];let m=-1;for(let _=0;_<e.length;_++){const S=e[_],w=S.d,C=S.r||0,v=S.t||0;m<0&&(m=v),v&&v>m&&(m=v);let L;if(C<0){const U=_+1;U===e.length?t==="dynamic"&&r>0&&n.indexOf("$Number$")>0?L=t1(i,m,w):L=(s*a-m)/w:L=(e[U].t-m)/w}else L=C+1;const D=l+p.length+L;let O=l+p.length;for(;O<D;)p.push({number:O,duration:w/a,time:m,timeline:u}),m+=w,O++}return p},i1=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,r1=i=>(e,t,r,n)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const s=""+i[t];return t==="RepresentationID"||(r?n=parseInt(n,10):n=1,s.length>=n)?s:`${new Array(n-s.length+1).join("0")}${s}`},md=(i,e)=>i.replace(i1,r1(e)),n1=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?$l(i):jp(i,e),s1=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,n=zn({baseUrl:i.baseUrl,source:md(r.sourceURL,t),range:r.range});return n1(i,e).map(s=>{t.Number=s.number,t.Time=s.time;const a=md(i.media||"",t),l=i.timescale||1,u=i.presentationTimeOffset||0,p=i.periodStart+(s.time-u)/l;return{uri:a,timeline:s.timeline,duration:s.duration,resolvedUri:Aa(i.baseUrl||"",a),map:n,number:s.number,presentationTime:p}})},a1=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,n=zn({baseUrl:t,source:r.sourceURL,range:r.range}),s=zn({baseUrl:t,source:e.media,range:e.mediaRange});return s.map=n,s},o1=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:n}=i;if(!t&&!e||t&&e)throw new Error($r.SEGMENT_TIME_UNSPECIFIED);const s=r.map(l=>a1(i,l));let a;return t&&(a=$l(i)),e&&(a=jp(i,e)),a.map((l,u)=>{if(s[u]){const p=s[u],m=i.timescale||1,_=i.presentationTimeOffset||0;return p.timeline=l.timeline,p.duration=l.duration,p.number=l.number,p.presentationTime=n+(l.time-_)/m,p}}).filter(l=>l)},l1=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=s1,t=Ze(i,e.template)):e.base?(r=Bp,t=Ze(i,e.base)):e.list&&(r=o1,t=Ze(i,e.list));const n={attributes:i};if(!r)return n;const s=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:l=1}=t;t.duration=a/l}else s.length?t.duration=s.reduce((a,l)=>Math.max(a,Math.ceil(l.duration)),0):t.duration=0;return n.attributes=t,n.segments=s,e.base&&t.indexRange&&(n.sidx=s[0],n.segments=[]),n},u1=i=>i.map(l1),Ue=(i,e)=>Mp(i.childNodes).filter(({tagName:t})=>t===e),es=i=>i.textContent.trim(),c1=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),Tr=i=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!e)return 0;const[t,r,n,s,a,l]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(r||0)*2592e3+parseFloat(n||0)*86400+parseFloat(s||0)*3600+parseFloat(a||0)*60+parseFloat(l||0)},d1=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),gd={mediaPresentationDuration(i){return Tr(i)},availabilityStartTime(i){return d1(i)/1e3},minimumUpdatePeriod(i){return Tr(i)},suggestedPresentationDelay(i){return Tr(i)},type(i){return i},timeShiftBufferDepth(i){return Tr(i)},start(i){return Tr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return c1(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?Tr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},Xe=i=>i&&i.attributes?Mp(i.attributes).reduce((e,t)=>{const r=gd[t.name]||gd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},h1={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Da=(i,e)=>e.length?jr(i.map(function(t){return e.map(function(r){const n=es(r),s=Aa(t.baseUrl,n),a=Ze(Xe(r),{baseUrl:s});return s!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Hl=i=>{const e=Ue(i,"SegmentTemplate")[0],t=Ue(i,"SegmentList")[0],r=t&&Ue(t,"SegmentURL").map(_=>Ze({tag:"SegmentURL"},Xe(_))),n=Ue(i,"SegmentBase")[0],s=t||e,a=s&&Ue(s,"SegmentTimeline")[0],l=t||n||e,u=l&&Ue(l,"Initialization")[0],p=e&&Xe(e);p&&u?p.initialization=u&&Xe(u):p&&p.initialization&&(p.initialization={sourceURL:p.initialization});const m={template:p,segmentTimeline:a&&Ue(a,"S").map(_=>Xe(_)),list:t&&Ze(Xe(t),{segmentUrls:r,initialization:Xe(u)}),base:n&&Ze(Xe(n),{initialization:Xe(u)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},p1=(i,e,t)=>r=>{const n=Ue(r,"BaseURL"),s=Da(e,n),a=Ze(i,Xe(r)),l=Hl(r);return s.map(u=>({segmentInfo:Ze(t,l),attributes:Ze(a,u)}))},m1=i=>i.reduce((e,t)=>{const r=Xe(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const n=h1[r.schemeIdUri];if(n){e[n]={attributes:r};const s=Ue(t,"cenc:pssh")[0];if(s){const a=es(s);e[n].pssh=a&&Lp(a)}}return e},{}),g1=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{let t,r;return r=e,/^CC\d=/.test(e)?[t,r]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:r}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[r,n=""]=e.split("=");t.channel=r,t.language=e,n.split(",").forEach(s=>{const[a,l]=s.split(":");a==="lang"?t.language=l:a==="er"?t.easyReader=Number(l):a==="war"?t.aspectRatio=Number(l):a==="3D"&&(t["3D"]=Number(l))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},f1=i=>jr(Ue(i.node,"EventStream").map(e=>{const t=Xe(e),r=t.schemeIdUri;return Ue(e,"Event").map(n=>{const s=Xe(n),a=s.presentationTime||0,l=t.timescale||1,u=s.duration||0,p=a/l+i.attributes.start;return{schemeIdUri:r,value:t.value,id:s.id,start:p,end:p+u/l,messageData:es(n)||s.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),y1=(i,e,t)=>r=>{const n=Xe(r),s=Da(e,Ue(r,"BaseURL")),a=Ue(r,"Role")[0],l={role:Xe(a)};let u=Ze(i,n,l);const p=Ue(r,"Accessibility")[0],m=g1(Xe(p));m&&(u=Ze(u,{captionServices:m}));const _=Ue(r,"Label")[0];if(_&&_.childNodes.length){const L=_.childNodes[0].nodeValue.trim();u=Ze(u,{label:L})}const S=m1(Ue(r,"ContentProtection"));Object.keys(S).length&&(u=Ze(u,{contentProtection:S}));const w=Hl(r),C=Ue(r,"Representation"),v=Ze(t,w);return jr(C.map(p1(u,s,v)))},_1=(i,e)=>(t,r)=>{const n=Da(e,Ue(t.node,"BaseURL")),s=Ze(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(s.periodDuration=t.attributes.duration);const a=Ue(t.node,"AdaptationSet"),l=Hl(t.node);return jr(a.map(y1(s,n,l)))},b1=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=Ze({serverURL:es(i[0])},Xe(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},v1=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,T1=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:n=0,eventHandler:s=function(){}}=e,a=Ue(i,"Period");if(!a.length)throw new Error($r.INVALID_NUMBER_OF_PERIOD);const l=Ue(i,"Location"),u=Xe(i),p=Da([{baseUrl:t}],Ue(i,"BaseURL")),m=Ue(i,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=r,u.clientOffset=n,l.length&&(u.locations=l.map(es));const _=[];return a.forEach((S,w)=>{const C=Xe(S),v=_[w-1];C.start=v1({attributes:C,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),_.push({node:S,attributes:C})}),{locations:u.locations,contentSteeringInfo:b1(m,s),representationInfo:jr(_.map(_1(u,p))),eventStream:jr(_.map(f1))}},$p=i=>{if(i==="")throw new Error($r.DASH_EMPTY_MANIFEST);const e=new Nl;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error($r.DASH_INVALID_XML);return r},S1=i=>{const e=Ue(i,"UTCTiming")[0];if(!e)return null;const t=Xe(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error($r.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},E1=(i,e={})=>{const t=T1($p(i),e),r=u1(t.representationInfo);return e1({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},w1=i=>S1($p(i));var qp=Math.pow(2,32),k1=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*qp+e.getUint32(4)},C1={getUint64:k1,MAX_UINT32:qp},fd=C1.getUint64,I1=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},r=12;t.version===0?(t.earliestPresentationTime=e.getUint32(r),t.firstOffset=e.getUint32(r+4),r+=8):(t.earliestPresentationTime=fd(i.subarray(r)),t.firstOffset=fd(i.subarray(r+8)),r+=16),r+=2;var n=e.getUint16(r);for(r+=2;n>0;r+=12,n--)t.references.push({referenceType:(i[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(i[r+8]&128),sapType:(i[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return t},A1=I1;const x1=Zn(A1);var L1=ne([73,68,51]),D1=function(i,e){e===void 0&&(e=0),i=ne(i);var t=i[e+5],r=i[e+6]<<21|i[e+7]<<14|i[e+8]<<7|i[e+9],n=(t&16)>>4;return n?r+20:r+10},Dn=function i(e,t){return t===void 0&&(t=0),e=ne(e),e.length-t<10||!Oe(e,L1,{offset:t})?t:(t+=D1(e,t),i(e,t))},yd=function(i){return typeof i=="string"?Op(i):i},P1=function(i){return Array.isArray(i)?i.map(function(e){return yd(e)}):[yd(i)]},R1=function i(e,t,r){r===void 0&&(r=!1),t=P1(t),e=ne(e);var n=[];if(!t.length)return n;for(var s=0;s<e.length;){var a=(e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3])>>>0,l=e.subarray(s+4,s+8);if(a===0)break;var u=s+a;if(u>e.length){if(r)break;u=e.length}var p=e.subarray(s+8,u);Oe(l,t[0])&&(t.length===1?n.push(p):n.push.apply(n,i(p,t.slice(1),r))),s=u}return n},Us={EBML:ne([26,69,223,163]),DocType:ne([66,130]),Segment:ne([24,83,128,103]),SegmentInfo:ne([21,73,169,102]),Tracks:ne([22,84,174,107]),Track:ne([174]),TrackNumber:ne([215]),DefaultDuration:ne([35,227,131]),TrackEntry:ne([174]),TrackType:ne([131]),FlagDefault:ne([136]),CodecID:ne([134]),CodecPrivate:ne([99,162]),VideoTrack:ne([224]),AudioTrack:ne([225]),Cluster:ne([31,67,182,117]),Timestamp:ne([231]),TimestampScale:ne([42,215,177]),BlockGroup:ne([160]),BlockDuration:ne([155]),Block:ne([161]),SimpleBlock:ne([163])},Ko=[128,64,32,16,8,4,2,1],N1=function(i){for(var e=1,t=0;t<Ko.length&&!(i&Ko[t]);t++)e++;return e},ea=function(i,e,t,r){t===void 0&&(t=!0),r===void 0&&(r=!1);var n=N1(i[e]),s=i.subarray(e,e+n);return t&&(s=Array.prototype.slice.call(i,e,e+n),s[0]^=Ko[n-1]),{length:n,value:AT(s,{signed:r}),bytes:s}},_d=function i(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return i(t)}):typeof e=="number"?xT(e):e},O1=function(i){return Array.isArray(i)?i.map(function(e){return _d(e)}):[_d(i)]},U1=function i(e,t,r){if(r>=t.length)return t.length;var n=ea(t,r,!1);if(Oe(e.bytes,n.bytes))return r;var s=ea(t,r+n.length);return i(e,t,r+s.length+s.value+n.length)},bd=function i(e,t){t=O1(t),e=ne(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var s=ea(e,n,!1),a=ea(e,n+s.length),l=n+s.length+a.length;a.value===127&&(a.value=U1(s,e,l),a.value!==e.length&&(a.value-=l));var u=l+a.value>e.length?e.length:l+a.value,p=e.subarray(l,u);Oe(t[0],s.bytes)&&(t.length===1?r.push(p):r=r.concat(i(p,t.slice(1))));var m=s.length+a.length+p.length;n+=m}return r},M1=ne([0,0,0,1]),B1=ne([0,0,1]),F1=ne([0,0,3]),j1=function(i){for(var e=[],t=1;t<i.length-2;)Oe(i.subarray(t,t+3),F1)&&(e.push(t+2),t++),t++;if(e.length===0)return i;var r=i.length-e.length,n=new Uint8Array(r),s=0;for(t=0;t<r;s++,t++)s===e[0]&&(s++,e.shift()),n[t]=i[s];return n},Vp=function(i,e,t,r){i=ne(i),t=[].concat(t);for(var n=0,s,a=0;n<i.length&&(a<r||s);){var l=void 0;if(Oe(i.subarray(n),M1)?l=4:Oe(i.subarray(n),B1)&&(l=3),!l){n++;continue}if(a++,s)return j1(i.subarray(s,n));var u=void 0;e==="h264"?u=i[n+l]&31:e==="h265"&&(u=i[n+l]>>1&63),t.indexOf(u)!==-1&&(s=n+l),n+=l+(e==="h264"?1:2)}return i.subarray(0,0)},$1=function(i,e,t){return Vp(i,"h264",e,t)},q1=function(i,e,t){return Vp(i,"h265",e,t)},dt={webm:ne([119,101,98,109]),matroska:ne([109,97,116,114,111,115,107,97]),flac:ne([102,76,97,67]),ogg:ne([79,103,103,83]),ac3:ne([11,119]),riff:ne([82,73,70,70]),avi:ne([65,86,73]),wav:ne([87,65,86,69]),"3gp":ne([102,116,121,112,51,103]),mp4:ne([102,116,121,112]),fmp4:ne([115,116,121,112]),mov:ne([102,116,121,112,113,116]),moov:ne([109,111,111,118]),moof:ne([109,111,111,102])},qr={aac:function(i){var e=Dn(i);return Oe(i,[255,16],{offset:e,mask:[255,22]})},mp3:function(i){var e=Dn(i);return Oe(i,[255,2],{offset:e,mask:[255,6]})},webm:function(i){var e=bd(i,[Us.EBML,Us.DocType])[0];return Oe(e,dt.webm)},mkv:function(i){var e=bd(i,[Us.EBML,Us.DocType])[0];return Oe(e,dt.matroska)},mp4:function(i){if(qr["3gp"](i)||qr.mov(i))return!1;if(Oe(i,dt.mp4,{offset:4})||Oe(i,dt.fmp4,{offset:4})||Oe(i,dt.moof,{offset:4})||Oe(i,dt.moov,{offset:4}))return!0},mov:function(i){return Oe(i,dt.mov,{offset:4})},"3gp":function(i){return Oe(i,dt["3gp"],{offset:4})},ac3:function(i){var e=Dn(i);return Oe(i,dt.ac3,{offset:e})},ts:function(i){if(i.length<189&&i.length>=1)return i[0]===71;for(var e=0;e+188<i.length&&e<188;){if(i[e]===71&&i[e+188]===71)return!0;e+=1}return!1},flac:function(i){var e=Dn(i);return Oe(i,dt.flac,{offset:e})},ogg:function(i){return Oe(i,dt.ogg)},avi:function(i){return Oe(i,dt.riff)&&Oe(i,dt.avi,{offset:8})},wav:function(i){return Oe(i,dt.riff)&&Oe(i,dt.wav,{offset:8})},h264:function(i){return $1(i,7,3).length},h265:function(i){return q1(i,[32,33],3).length}},Yo=Object.keys(qr).filter(function(i){return i!=="ts"&&i!=="h264"&&i!=="h265"}).concat(["ts","h264","h265"]);Yo.forEach(function(i){var e=qr[i];qr[i]=function(t){return e(ne(t))}});var V1=qr,zl=function(i){i=ne(i);for(var e=0;e<Yo.length;e++){var t=Yo[e];if(V1[t](i))return t}return""},H1=function(i){return R1(i,["moof"]).length>0},Wl=9e4,Gl,Xl,Pa,Kl,Hp,zp,Wp;Gl=function(i){return i*Wl};Xl=function(i,e){return i*e};Pa=function(i){return i/Wl};Kl=function(i,e){return i/e};Hp=function(i,e){return Gl(Kl(i,e))};zp=function(i,e){return Xl(Pa(i),e)};Wp=function(i,e,t){return Pa(t?i:i-e)};var er={ONE_SECOND_IN_TS:Wl,secondsToVideoTs:Gl,secondsToAudioTs:Xl,videoTsToSeconds:Pa,audioTsToSeconds:Kl,audioTsToVideoTs:Hp,videoTsToAudioTs:zp,metadataTsToSeconds:Wp},Qo="8.21.0";const gi={},Bi=function(i,e){return gi[i]=gi[i]||[],e&&(gi[i]=gi[i].concat(e)),gi[i]},z1=function(i,e){Bi(i,e)},Gp=function(i,e){const t=Bi(i).indexOf(e);return t<=-1?!1:(gi[i]=gi[i].slice(),gi[i].splice(t,1),!0)},W1=function(i,e){Bi(i,[].concat(e).map(t=>{const r=(...n)=>(Gp(i,r),t(...n));return r}))},ta={prefixed:!0},Vs=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],vd=Vs[0];let Pn;for(let i=0;i<Vs.length;i++)if(Vs[i][1]in X){Pn=Vs[i];break}if(Pn){for(let i=0;i<Pn.length;i++)ta[vd[i]]=Pn[i];ta.prefixed=Pn[0]!==vd[0]}let _t=[];const G1=(i,e,t)=>(r,n,s)=>{const a=e.levels[n],l=new RegExp(`^(${a})$`);let u=i;if(r!=="log"&&s.unshift(r.toUpperCase()+":"),t&&(u=`%c${i}`,s.unshift(t)),s.unshift(u+":"),_t){_t.push([].concat(s));const m=_t.length-1e3;_t.splice(0,m>0?m:0)}if(!x.console)return;let p=x.console[r];!p&&r==="debug"&&(p=x.console.info||x.console.log),!(!p||!a||!l.test(r))&&p[Array.isArray(s)?"apply":"call"](x.console,s)};function Jo(i,e=":",t=""){let r="info",n;function s(...a){n("log",r,a)}return n=G1(i,s,t),s.createLogger=(a,l,u)=>{const p=l!==void 0?l:e,m=u!==void 0?u:t,_=`${i} ${p} ${a}`;return Jo(_,p,m)},s.createNewLogger=(a,l,u)=>Jo(a,l,u),s.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},s.level=a=>{if(typeof a=="string"){if(!s.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},s.history=()=>_t?[].concat(_t):[],s.history.filter=a=>(_t||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),s.history.clear=()=>{_t&&(_t.length=0)},s.history.disable=()=>{_t!==null&&(_t.length=0,_t=null)},s.history.enable=()=>{_t===null&&(_t=[])},s.error=(...a)=>n("error",r,a),s.warn=(...a)=>n("warn",r,a),s.debug=(...a)=>n("debug",r,a),s}const he=Jo("VIDEOJS"),Xp=he.createLogger,X1=Object.prototype.toString,Kp=function(i){return ui(i)?Object.keys(i):[]};function Ar(i,e){Kp(i).forEach(t=>e(i[t],t))}function Yp(i,e,t=0){return Kp(i).reduce((r,n)=>e(r,i[n],n),t)}function ui(i){return!!i&&typeof i=="object"}function Vr(i){return ui(i)&&X1.call(i)==="[object Object]"&&i.constructor===Object}function we(...i){const e={};return i.forEach(t=>{t&&Ar(t,(r,n)=>{if(!Vr(r)){e[n]=r;return}Vr(e[n])||(e[n]={}),e[n]=we(e[n],r)})}),e}function Qp(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function Ra(i,e,t,r=!0){const n=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),s={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return r&&(s.set=n),Object.defineProperty(i,e,s)}var K1=Object.freeze({__proto__:null,each:Ar,reduce:Yp,isObject:ui,isPlain:Vr,merge:we,values:Qp,defineLazyProperty:Ra});let Yl=!1,Jp=null,Gt=!1,Zp,em=!1,xr=!1,Lr=!1,ci=!1,Ql=null,Na=null;const Y1=!!(x.cast&&x.cast.framework&&x.cast.framework.CastReceiverContext);let tm=null,ia=!1,Oa=!1,ra=!1,Ua=!1,na=!1,sa=!1,aa=!1;const Wn=!!(Yr()&&("ontouchstart"in x||x.navigator.maxTouchPoints||x.DocumentTouch&&x.document instanceof x.DocumentTouch)),Ri=x.navigator&&x.navigator.userAgentData;Ri&&Ri.platform&&Ri.brands&&(Gt=Ri.platform==="Android",xr=!!Ri.brands.find(i=>i.brand==="Microsoft Edge"),Lr=!!Ri.brands.find(i=>i.brand==="Chromium"),ci=!xr&&Lr,Ql=Na=(Ri.brands.find(i=>i.brand==="Chromium")||{}).version||null,Oa=Ri.platform==="Windows");if(!Lr){const i=x.navigator&&x.navigator.userAgent||"";Yl=/iPod/i.test(i),Jp=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Gt=/Android/i.test(i),Zp=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null}(),em=/Firefox/i.test(i),xr=/Edg/i.test(i),Lr=/Chrome/i.test(i)||/CriOS/i.test(i),ci=!xr&&Lr,Ql=Na=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),tm=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),na=/Tizen/i.test(i),sa=/Web0S/i.test(i),aa=na||sa,ia=/Safari/i.test(i)&&!ci&&!Gt&&!xr&&!aa,Oa=/Windows/i.test(i),ra=/iPad/i.test(i)||ia&&Wn&&!/iPhone/i.test(i),Ua=/iPhone/i.test(i)&&!ra}const rt=Ua||ra||Yl,Ma=(ia||rt)&&!ci;var im=Object.freeze({__proto__:null,get IS_IPOD(){return Yl},get IOS_VERSION(){return Jp},get IS_ANDROID(){return Gt},get ANDROID_VERSION(){return Zp},get IS_FIREFOX(){return em},get IS_EDGE(){return xr},get IS_CHROMIUM(){return Lr},get IS_CHROME(){return ci},get CHROMIUM_VERSION(){return Ql},get CHROME_VERSION(){return Na},IS_CHROMECAST_RECEIVER:Y1,get IE_VERSION(){return tm},get IS_SAFARI(){return ia},get IS_WINDOWS(){return Oa},get IS_IPAD(){return ra},get IS_IPHONE(){return Ua},get IS_TIZEN(){return na},get IS_WEBOS(){return sa},get IS_SMART_TV(){return aa},TOUCH_ENABLED:Wn,IS_IOS:rt,IS_ANY_SAFARI:Ma});function Td(i){return typeof i=="string"&&!!i.trim()}function Q1(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Yr(){return X===x.document}function Qr(i){return ui(i)&&i.nodeType===1}function rm(){try{return x.parent!==x.self}catch{return!0}}function nm(i){return function(e,t){if(!Td(e))return X[i](null);Td(t)&&(t=X.querySelector(t));const r=Qr(t)?t:X;return r[i]&&r[i](e)}}function se(i="div",e={},t={},r){const n=X.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(s){const a=e[s];s==="textContent"?$i(n,a):(n[s]!==a||s==="tabIndex")&&(n[s]=a)}),Object.getOwnPropertyNames(t).forEach(function(s){n.setAttribute(s,t[s])}),r&&Jl(n,r),n}function $i(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function Zo(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Un(i,e){return Q1(e),i.classList.contains(e)}function rr(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function Ba(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(he.warn("removeClass was called with an element that doesn't exist"),null)}function sm(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function am(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r>"u"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function Ui(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let n=r.length-1;n>=0;n--){const s=r[n].name;let a=r[n].value;t.includes(s)&&(a=a!==null),e[s]=a}}return e}function om(i,e){return i.getAttribute(e)}function Hr(i,e,t){i.setAttribute(e,t)}function Fa(i,e){i.removeAttribute(e)}function lm(){X.body.focus(),X.onselectstart=function(){return!1}}function um(){X.onselectstart=function(){return!0}}function zr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat(Wr(i,"height"))),t.width||(t.width=parseFloat(Wr(i,"width"))),t}}function Gn(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,n=0;for(;i.offsetParent&&i!==X[ta.fullscreenElement];)r+=i.offsetLeft,n+=i.offsetTop,i=i.offsetParent;return{left:r,top:n,width:e,height:t}}function ja(i,e){const t={x:0,y:0};if(rt){let m=i;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=Wr(m,"transform");if(/^matrix/.test(_)){const S=_.slice(7,-1).split(/,\s/).map(Number);t.x+=S[4],t.y+=S[5]}else if(/^matrix3d/.test(_)){const S=_.slice(9,-1).split(/,\s/).map(Number);t.x+=S[12],t.y+=S[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&x.WebKitCSSMatrix){const S=x.getComputedStyle(m.assignedSlot.parentElement).transform,w=new x.WebKitCSSMatrix(S);t.x+=w.m41,t.y+=w.m42}m=m.parentNode||m.host}}const r={},n=Gn(e.target),s=Gn(i),a=s.width,l=s.height;let u=e.offsetY-(s.top-n.top),p=e.offsetX-(s.left-n.left);return e.changedTouches&&(p=e.changedTouches[0].pageX-s.left,u=e.changedTouches[0].pageY+s.top,rt&&(p-=t.x,u-=t.y)),r.y=1-Math.max(0,Math.min(1,u/l)),r.x=Math.max(0,Math.min(1,p/a)),r}function cm(i){return ui(i)&&i.nodeType===3}function $a(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function dm(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Qr(e)||cm(e))return e;if(typeof e=="string"&&/\S/.test(e))return X.createTextNode(e)}).filter(e=>e)}function Jl(i,e){return dm(e).forEach(t=>i.appendChild(t)),i}function hm(i,e){return Jl($a(i),e)}function Xn(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Fi=nm("querySelector"),pm=nm("querySelectorAll");function Wr(i,e){if(!i||!e)return"";if(typeof x.getComputedStyle=="function"){let t;try{t=x.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function mm(i){[...X.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),r=X.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch{const t=X.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,i.document.head.appendChild(t)}})}var gm=Object.freeze({__proto__:null,isReal:Yr,isEl:Qr,isInFrame:rm,createEl:se,textContent:$i,prependTo:Zo,hasClass:Un,addClass:rr,removeClass:Ba,toggleClass:sm,setAttributes:am,getAttributes:Ui,getAttribute:om,setAttribute:Hr,removeAttribute:Fa,blockTextSelection:lm,unblockTextSelection:um,getBoundingClientRect:zr,findPosition:Gn,getPointerPosition:ja,isTextNode:cm,emptyEl:$a,normalizeContent:dm,appendContent:Jl,insertContent:hm,isSingleLeftClick:Xn,$:Fi,$$:pm,computedStyle:Wr,copyStyleSheetsToWindow:mm});let fm=!1,el;const J1=function(){if(el.options.autoSetup===!1)return;const i=Array.prototype.slice.call(X.getElementsByTagName("video")),e=Array.prototype.slice.call(X.getElementsByTagName("audio")),t=Array.prototype.slice.call(X.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let n=0,s=r.length;n<s;n++){const a=r[n];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&el(a);else{tl(1);break}}else fm||tl(1)};function tl(i,e){Yr()&&(e&&(el=e),x.setTimeout(J1,i))}function il(){fm=!0,x.removeEventListener("load",il)}Yr()&&(X.readyState==="complete"?il():x.addEventListener("load",il));const ym=function(i){const e=X.createElement("style");return e.className=i,e},_m=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var mt=new WeakMap;const Z1=3;let eS=Z1;function Bt(){return eS++}function Sd(i,e){if(!mt.has(i))return;const t=mt.get(i);t.handlers[e].length===0&&(delete t.handlers[e],i.removeEventListener?i.removeEventListener(e,t.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&mt.delete(i)}function Zl(i,e,t,r){t.forEach(function(n){i(e,n,r)})}function qa(i){if(i.fixed_)return i;function e(){return!0}function t(){return!1}if(!i||!i.isPropagationStopped||!i.isImmediatePropagationStopped){const r=i||x.event;i={};const n=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const s in r)n.includes(s)||s==="returnValue"&&r.preventDefault||(i[s]=r[s]);if(i.target||(i.target=i.srcElement||X),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){r.preventDefault&&r.preventDefault(),i.returnValue=!1,r.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),i.cancelBubble=!0,r.cancelBubble=!0,i.isPropagationStopped=e},i.isPropagationStopped=t,i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),i.isImmediatePropagationStopped=e,i.stopPropagation()},i.isImmediatePropagationStopped=t,i.clientX!==null&&i.clientX!==void 0){const s=X.documentElement,a=X.body;i.pageX=i.clientX+(s&&s.scrollLeft||a&&a.scrollLeft||0)-(s&&s.clientLeft||a&&a.clientLeft||0),i.pageY=i.clientY+(s&&s.scrollTop||a&&a.scrollTop||0)-(s&&s.clientTop||a&&a.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}let Ms;const tS=function(){if(typeof Ms!="boolean"){Ms=!1;try{const i=Object.defineProperty({},"passive",{get(){Ms=!0}});x.addEventListener("test",null,i),x.removeEventListener("test",null,i)}catch{}}return Ms},iS=["touchstart","touchmove"];function Lt(i,e,t){if(Array.isArray(e))return Zl(Lt,i,e,t);mt.has(i)||mt.set(i,{});const r=mt.get(i);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),t.guid||(t.guid=Bt()),r.handlers[e].push(t),r.dispatcher||(r.disabled=!1,r.dispatcher=function(n,s){if(r.disabled)return;n=qa(n);const a=r.handlers[n.type];if(a){const l=a.slice(0);for(let u=0,p=l.length;u<p&&!n.isImmediatePropagationStopped();u++)try{l[u].call(i,n,s)}catch(m){he.error(m)}}}),r.handlers[e].length===1)if(i.addEventListener){let n=!1;tS()&&iS.indexOf(e)>-1&&(n={passive:!0}),i.addEventListener(e,r.dispatcher,n)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function nt(i,e,t){if(!mt.has(i))return;const r=mt.get(i);if(!r.handlers)return;if(Array.isArray(e))return Zl(nt,i,e,t);const n=function(a,l){r.handlers[l]=[],Sd(a,l)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&n(i,a);return}const s=r.handlers[e];if(s){if(!t){n(i,e);return}if(t.guid)for(let a=0;a<s.length;a++)s[a].guid===t.guid&&s.splice(a--,1);Sd(i,e)}}function Jr(i,e,t){const r=mt.has(i)?mt.get(i):{},n=i.parentNode||i.ownerDocument;if(typeof e=="string"?e={type:e,target:i}:e.target||(e.target=i),e=qa(e),r.dispatcher&&r.dispatcher.call(i,e,t),n&&!e.isPropagationStopped()&&e.bubbles===!0)Jr.call(null,n,e,t);else if(!n&&!e.defaultPrevented&&e.target&&e.target[e.type]){mt.has(e.target)||mt.set(e.target,{});const s=mt.get(e.target);e.target[e.type]&&(s.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),s.disabled=!1)}return!e.defaultPrevented}function Va(i,e,t){if(Array.isArray(e))return Zl(Va,i,e,t);const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Bt(),Lt(i,e,r)}function eu(i,e,t){const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Bt(),Lt(i,e,r)}var rS=Object.freeze({__proto__:null,fixEvent:qa,on:Lt,off:nt,trigger:Jr,one:Va,any:eu});const Ft=30,Le=function(i,e,t){e.guid||(e.guid=Bt());const r=e.bind(i);return r.guid=t?t+"_"+e.guid:e.guid,r},di=function(i,e){let t=x.performance.now();return function(...r){const n=x.performance.now();n-t>=e&&(i(...r),t=n)}},bm=function(i,e,t,r=x){let n;const s=()=>{r.clearTimeout(n),n=null},a=function(){const l=this,u=arguments;let p=function(){n=null,p=null,t||i.apply(l,u)};!n&&t&&i.apply(l,u),r.clearTimeout(n),n=r.setTimeout(p,e)};return a.cancel=s,a};var nS=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Le,throttle:di,debounce:bm});let kn;class Dt{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Lt(this,e,t),this.addEventListener=r}off(e,t){nt(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Va(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},eu(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=qa(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Jr(this,e)}queueTrigger(e){kn||(kn=new Map);const t=e.type||e;let r=kn.get(this);r||(r=new Map,kn.set(this,r));const n=r.get(t);r.delete(t),x.clearTimeout(n);const s=x.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,kn.delete(this)),this.trigger(e)},0);r.set(t,s)}}Dt.prototype.allowedEvents_={};Dt.prototype.addEventListener=Dt.prototype.on;Dt.prototype.removeEventListener=Dt.prototype.off;Dt.prototype.dispatchEvent=Dt.prototype.trigger;const Ha=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,_i=i=>i instanceof Dt||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),sS=(i,e)=>{_i(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},rl=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,oa=(i,e,t)=>{if(!i||!i.nodeName&&!_i(i))throw new Error(`Invalid target for ${Ha(e)}#${t}; must be a DOM node or evented object.`)},vm=(i,e,t)=>{if(!rl(i))throw new Error(`Invalid event type for ${Ha(e)}#${t}; must be a non-empty string or array.`)},Tm=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${Ha(e)}#${t}; must be a function.`)},Ao=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let n,s,a;return r?(n=i.eventBusEl_,e.length>=3&&e.shift(),[s,a]=e):(n=e[0],s=e[1],a=e[2]),oa(n,i,t),vm(s,i,t),Tm(a,i,t),a=Le(i,a),{isTargetingSelf:r,target:n,type:s,listener:a}},Qi=(i,e,t,r)=>{oa(i,i,e),i.nodeName?rS[e](i,t,r):i[e](t,r)},aS={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Ao(this,i,"on");if(Qi(t,"on",r,n),!e){const s=()=>this.off(t,r,n);s.guid=n.guid;const a=()=>this.off("dispose",s);a.guid=n.guid,Qi(this,"on","dispose",s),Qi(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Ao(this,i,"one");if(e)Qi(t,"one",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Qi(t,"one",r,s)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:n}=Ao(this,i,"any");if(e)Qi(t,"any",r,n);else{const s=(...a)=>{this.off(t,r,s),n.apply(null,a)};s.guid=n.guid,Qi(t,"any",r,s)}},off(i,e,t){if(!i||rl(i))nt(this.eventBusEl_,i,e);else{const r=i,n=e;oa(r,this,"off"),vm(n,this,"off"),Tm(t,this,"off"),t=Le(this,t),this.off("dispose",t),r.nodeName?(nt(r,n,t),nt(r,"dispose",t)):_i(r)&&(r.off(n,t),r.off("dispose",t))}},trigger(i,e){oa(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!rl(t))throw new Error(`Invalid event type for ${Ha(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Jr(this.eventBusEl_,i,e)}};function tu(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=se("span",{className:"vjs-event-bus"});return Object.assign(i,aS),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&mt.has(r)&&mt.delete(r)}),x.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const oS={state:{},setState(i){typeof i=="function"&&(i=i());let e;return Ar(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&_i(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Sm(i,e){return Object.assign(i,oS),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&_i(i)&&i.on("statechanged",i.handleStateChanged),i}const Mn=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},Ve=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},Em=function(i,e){return Ve(i)===Ve(e)};var lS=Object.freeze({__proto__:null,toLowerCase:Mn,toTitleCase:Ve,titleCaseEquals:Em});let z=class yt{constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=we({},this.options_),t=this.options_=we(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${Bt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(tu(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Sm(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=we(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return se(e,t,r)}localize(e,t,r=e){const n=this.player_.language&&this.player_.language(),s=this.player_.languages&&this.player_.languages(),a=s&&s[n],l=n&&n.split("-")[0],u=s&&s[l];let p=r;return a&&a[e]?p=a[e]:u&&u[e]&&(p=u[e]),t&&(p=p.replace(/\{(\d+)\}/g,function(m,_){const S=t[_-1];let w=S;return typeof S>"u"&&(w=m),w})),p}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,n)=>r.concat(n),[]);let t=this;for(let r=0;r<e.length;r++)if(t=t.getChild(e[r]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const r="http://www.w3.org/2000/svg",n=se("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),s=X.createElementNS(r,"svg");s.setAttributeNS(null,"viewBox","0 0 512 512");const a=X.createElementNS(r,"use");return s.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),n.appendChild(s),this.iconIsSet_?t.replaceChild(n,t.querySelector(".vjs-icon-placeholder")):t.appendChild(n),this.iconIsSet_=!0,n}addChild(e,t={},r=this.children_.length){let n,s;if(typeof e=="string"){s=Ve(e);const a=t.componentClass||s;t.name=s;const l=yt.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;n=new l(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(r,0,n),n.parentComponent_=this,typeof n.id=="function"&&(this.childIndex_[n.id()]=n),s=s||n.name&&Ve(n.name()),s&&(this.childNameIndex_[s]=n,this.childNameIndex_[Mn(s)]=n),typeof n.el=="function"&&n.el()){let a=null;this.children_[r+1]&&(this.children_[r+1].el_?a=this.children_[r+1].el_:Qr(this.children_[r+1])&&(a=this.children_[r+1])),this.contentEl().insertBefore(n.el(),a)}return n}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Ve(e.name())]=null,this.childNameIndex_[Mn(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const l=a.name;let u=a.opts;if(t[l]!==void 0&&(u=t[l]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const p=this.addChild(l,u);p&&(this[l]=p)};let n;const s=yt.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,u;return typeof a=="string"?(l=a,u=e[l]||this.options_[l]||{}):(l=a.name,u=a),{name:l,opts:u}}).filter(a=>{const l=yt.getComponent(a.opts.componentClass||Ve(a.name));return l&&!s.isTech(l)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Fi(e,t||this.contentEl())}$$(e,t){return pm(e,t||this.contentEl())}hasClass(e){return Un(this.el_,e)}addClass(...e){rr(this.el_,...e)}removeClass(...e){Ba(this.el_,...e)}toggleClass(e,t){sm(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return om(this.el_,e)}setAttribute(e,t){Hr(this.el_,e,t)}removeAttribute(e){Fa(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],s=n.indexOf("px");return parseInt(s!==-1?n.slice(0,s):this.el_["offset"+Ve(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Wr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${Ve(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},r={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:r}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const r=10,n=200;let s;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=x.performance.now(),s=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)s=!1;else if(t){const u=l.touches[0].pageX-t.pageX,p=l.touches[0].pageY-t.pageY;Math.sqrt(u*u+p*p)>r&&(s=!1)}});const a=function(){s=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,s===!0&&x.performance.now()-e<n&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Le(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const r=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",r),this.on("touchcancel",r)}setTimeout(e,t){var r;return e=Le(this,e),this.clearTimersOnDispose_(),r=x.setTimeout(()=>{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),x.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const r=x.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),x.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=x.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Le(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),x.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,n)=>this[t](n))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(s){const a=x.getComputedStyle(s,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function r(s){return!(!t(s.parentElement)||!t(s)||s.style.opacity==="0"||x.getComputedStyle(s).height==="0px"||x.getComputedStyle(s).width==="0px")}function n(s){if(s.offsetWidth+s.offsetHeight+s.getBoundingClientRect().height+s.getBoundingClientRect().width===0)return!1;const a={x:s.getBoundingClientRect().left+s.offsetWidth/2,y:s.getBoundingClientRect().top+s.offsetHeight/2};if(a.x<0||a.x>(X.documentElement.clientWidth||x.innerWidth)||a.y<0||a.y>(X.documentElement.clientHeight||x.innerHeight))return!1;let l=X.elementFromPoint(a.x,a.y);for(;l;){if(l===s)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&r(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const r=yt.getComponent("Tech"),n=r&&r.isTech(t),s=yt===t||yt.prototype.isPrototypeOf(t.prototype);if(n||!s){let l;throw n?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=Ve(e),yt.components_||(yt.components_={});const a=yt.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,u=Object.keys(l);if(l&&u.length>0&&u.map(p=>l[p]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return yt.components_[e]=t,yt.components_[Mn(e)]=t,t}static getComponent(e){if(!(!e||!yt.components_))return yt.components_[e]}};z.registerComponent("Component",z);function uS(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Ed(i,e,t,r){return uS(i,r,t.length-1),t[r][e]}function xo(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:Ed.bind(null,"start",0,i),end:Ed.bind(null,"end",1,i)},x.Symbol&&x.Symbol.iterator&&(e[x.Symbol.iterator]=()=>(i||[]).values()),e}function Wt(i,e){return Array.isArray(i)?xo(i):i===void 0||e===void 0?xo():xo([[i,e]])}const wm=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),n=Math.floor(i/3600);const s=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=r=t="-"),n=n>0||a>0?n+":":"",r=((n||s>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,n+r+t};let iu=wm;function km(i){iu=i}function Cm(){iu=wm}function lr(i,e=i){return iu(i,e)}var cS=Object.freeze({__proto__:null,createTimeRanges:Wt,createTimeRange:Wt,setFormatTime:km,resetFormatTime:Cm,formatTime:lr});function Im(i,e){let t=0,r,n;if(!e)return 0;(!i||!i.length)&&(i=Wt(0,0));for(let s=0;s<i.length;s++)r=i.start(s),n=i.end(s),n>e&&(n=e),t+=n-r;return t/e}function Fe(i){if(i instanceof Fe)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:ui(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=Fe.defaultMessages[this.code]||"")}Fe.prototype.code=0;Fe.prototype.message="";Fe.prototype.status=null;Fe.prototype.metadata=null;Fe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Fe.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};Fe.MEDIA_ERR_CUSTOM=0;Fe.prototype.MEDIA_ERR_CUSTOM=0;Fe.MEDIA_ERR_ABORTED=1;Fe.prototype.MEDIA_ERR_ABORTED=1;Fe.MEDIA_ERR_NETWORK=2;Fe.prototype.MEDIA_ERR_NETWORK=2;Fe.MEDIA_ERR_DECODE=3;Fe.prototype.MEDIA_ERR_DECODE=3;Fe.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fe.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fe.MEDIA_ERR_ENCRYPTED=5;Fe.prototype.MEDIA_ERR_ENCRYPTED=5;function Bn(i){return i!=null&&typeof i.then=="function"}function ri(i){Bn(i)&&i.then(null,e=>{})}const nl=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,r)=>(i[t]&&(e[t]=i[t]),e),{cues:i.cues&&Array.prototype.map.call(i.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},dS=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=nl(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(r){return t.indexOf(r)===-1}).map(nl))},hS=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>r.addCue(n))}),e.textTracks()};var wd={textTracksToJson:dS,jsonToTextTracks:hS,trackToJson_:nl};const Lo="vjs-modal-dialog";class Zr extends z{constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=se("div",{className:`${Lo}-content`},{role:"document"}),this.descEl_=se("p",{className:`${Lo}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),$i(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Lo} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let r=this.getChild("closeButton");if(t&&!r){const n=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),hm(t,e),this.trigger("modalfill"),n?r.insertBefore(t,n):r.appendChild(t);const s=this.getChild("closeButton");s&&r.appendChild(s.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),$a(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=X.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),r=this.el_.querySelector(":focus");let n;for(let s=0;s<t.length;s++)if(r===t[s]){n=s;break}X.activeElement===this.el_&&(n=0),e.shiftKey&&n===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof x.HTMLAnchorElement||t instanceof x.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof x.HTMLInputElement||t instanceof x.HTMLSelectElement||t instanceof x.HTMLTextAreaElement||t instanceof x.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof x.HTMLIFrameElement||t instanceof x.HTMLObjectElement||t instanceof x.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Zr.prototype.options_={pauseOnOpen:!0,temporary:!0};z.registerComponent("ModalDialog",Zr);class Gr extends Dt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},_i(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,n=this.length;r<n;r++)if(this[r]===e){t=this[r],t.off&&t.off(),this.tracks_.splice(r,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}Gr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const i in Gr.prototype.allowedEvents_)Gr.prototype["on"+i]=null;const Do=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].enabled=!1)};class pS extends Gr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Do(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Do(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Do(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Po=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].selected=!1)};class mS extends Gr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Po(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&Po(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Po(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class Am extends Gr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class gS{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t<r;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let r=0,n=this.trackElements_.length;r<n;r++)if(e===this.trackElements_[r].track){t=this.trackElements_[r];break}return t}removeTrackElement_(e){for(let t=0,r=this.trackElements_.length;t<r;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class la{constructor(e){la.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let r=0;const n=e.length;this.cues_=e,this.length_=e.length;const s=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<n)for(r=t;r<n;r++)s.call(this,r)}getCueById(e){let t=null;for(let r=0,n=this.length;r<n;r++){const s=this[r];if(s.id===e){t=s;break}}return t}}const fS={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},yS={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},_S={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},kd={disabled:"disabled",hidden:"hidden",showing:"showing"};class ru extends Dt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Bt(),kind:e.kind||"",language:e.language||""};let r=e.label||"";for(const n in t)Object.defineProperty(this,n,{get(){return t[n]},set(){}});Object.defineProperty(this,"label",{get(){return r},set(n){n!==r&&(r=n,this.trigger("labelchange"))}})}}const nu=function(i){return new URL(i,X.baseURI)},xm=function(i){return new URL(i,X.baseURI).href},su=function(i){if(typeof i=="string"){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(i);if(e)return e.pop().toLowerCase()}return""},za=function(i,e=x.location){return nu(i).origin!==e.origin};var bS=Object.freeze({__proto__:null,parseUrl:nu,getAbsoluteURL:xm,getFileExtension:su,isCrossOrigin:za});const Cd=function(i,e){const t=new x.WebVTT.Parser(x,x.vttjs,x.WebVTT.StringDecoder()),r=[];t.oncue=function(n){e.addCue(n)},t.onparsingerror=function(n){r.push(n)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(i),r.length>0&&(x.console&&x.console.groupCollapsed&&x.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(n=>he.error(n)),x.console&&x.console.groupEnd&&x.console.groupEnd()),t.flush()},Id=function(i,e){const t={uri:i},r=za(i);r&&(t.cors=r);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),wp(t,Le(this,function(s,a,l){if(s)return he.error(s,a);e.loaded_=!0,typeof x.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){he.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Cd(l,e)}):Cd(l,e)}))};class ts extends ru{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=we(e,{kind:_S[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=kd[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const s=new la(this.cues_),a=new la(this.activeCues_);let l=!1;this.timeupdateHandler=Le(this,function(p={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),p.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return r},set(p){kd[p]&&r!==p&&(r=p,!this.preload_&&r!=="disabled"&&this.cues.length===0&&Id(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?s:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const p=this.tech_.currentTime(),m=[];for(let _=0,S=this.cues.length;_<S;_++){const w=this.cues[_];w.startTime<=p&&w.endTime>=p&&m.push(w)}if(l=!1,m.length!==this.activeCues_.length)l=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(l=!0);return this.activeCues_=m,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&Id(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new x.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const r=this.tech_.textTracks();for(let n=0;n<r.length;n++)r[n]!==this&&r[n].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const r=this.cues_[t];if(r===e||r.originalCue_&&r.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}ts.prototype.allowedEvents_={cuechange:"cuechange"};class Lm extends ru{constructor(e={}){const t=we(e,{kind:yS[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"enabled",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Dm extends ru{constructor(e={}){const t=we(e,{kind:fS[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"selected",{get(){return r},set(n){typeof n!="boolean"||n===r||(r=n,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Si extends Dt{constructor(e={}){super();let t;const r=new ts(e);this.kind=r.kind,this.src=r.src,this.srclang=r.language,this.label=r.label,this.default=r.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return r}}}),t=Si.NONE,r.addEventListener("loadeddata",()=>{t=Si.LOADED,this.trigger({type:"load",target:this})})}}Si.prototype.allowedEvents_={load:"load"};Si.NONE=0;Si.LOADING=1;Si.LOADED=2;Si.ERROR=3;const Mt={audio:{ListClass:pS,TrackClass:Lm,capitalName:"Audio"},video:{ListClass:mS,TrackClass:Dm,capitalName:"Video"},text:{ListClass:Am,TrackClass:ts,capitalName:"Text"}};Object.keys(Mt).forEach(function(i){Mt[i].getterName=`${i}Tracks`,Mt[i].privateName=`${i}Tracks_`});const Xr={remoteText:{ListClass:Am,TrackClass:ts,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:gS,TrackClass:Si,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ht=Object.assign({},Mt,Xr);Xr.names=Object.keys(Xr);Mt.names=Object.keys(Mt);ht.names=[].concat(Xr.names).concat(Mt.names);function vS(i,e,t,r,n={}){const s=i.textTracks();n.kind=e,t&&(n.label=t),r&&(n.language=r),n.tech=i;const a=new ht.text.TrackClass(n);return s.addTrack(a),a}class le extends z{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ht.names.forEach(r=>{const n=ht[r];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new ht.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Le(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Wt(0,0)}bufferedPercent(){return Im(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Mt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let n=r.length;for(;n--;){const s=r[n];t==="text"&&this.removeRemoteTextTrack(s),r.removeTrack(s)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Fe(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Wt(0,0):Wt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Mt.names.forEach(e=>{const t=Mt[e],r=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),this.on("dispose",()=>{n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!x.WebVTT)if(X.body.contains(this.el())){if(!this.options_["vtt.js"]&&Vr(nd)&&Object.keys(nd).length>0){this.trigger("vttjsloaded");return}const e=X.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),x.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=l=>e.addTrack(l.track),n=l=>e.removeTrack(l.track);t.on("addtrack",r),t.on("removetrack",n),this.addWebVttScript_();const s=()=>this.trigger("texttrackchange"),a=()=>{s();for(let l=0;l<e.length;l++){const u=e[l];u.removeEventListener("cuechange",s),u.mode==="showing"&&u.addEventListener("cuechange",s)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",r),t.off("removetrack",n),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",s)})}addTextTrack(e,t,r){if(!e)throw new Error("TextTrack kind is required but was not provided");return vS(this,e,t,r)}createRemoteTextTrack(e){const t=we(e,{tech:this});return new Xr.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const r=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Bt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return le.canPlayType(e.type)}static isTech(e){return e.prototype instanceof le||e instanceof le||e===le}static registerTech(e,t){if(le.techs_||(le.techs_={}),!le.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!le.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!le.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ve(e),le.techs_[e]=t,le.techs_[Mn(e)]=t,e!=="Tech"&&le.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(le.techs_&&le.techs_[e])return le.techs_[e];if(e=Ve(e),x&&x.videojs&&x.videojs[e])return he.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),x.videojs[e]}}}ht.names.forEach(function(i){const e=ht[i];le.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});le.prototype.featuresVolumeControl=!0;le.prototype.featuresMuteControl=!0;le.prototype.featuresFullscreenResize=!1;le.prototype.featuresPlaybackRate=!1;le.prototype.featuresProgressEvents=!1;le.prototype.featuresSourceset=!1;le.prototype.featuresTimeupdateEvents=!1;le.prototype.featuresNativeTextTracks=!1;le.prototype.featuresVideoFrameCallback=!1;le.withSourceHandlers=function(i){i.registerSourceHandler=function(e,t){let r=i.sourceHandlers;r||(r=i.sourceHandlers=[]),t===void 0&&(t=r.length),r.splice(t,0,e)},i.canPlayType=function(e){const t=i.sourceHandlers||[];let r;for(let n=0;n<t.length;n++)if(r=t[n].canPlayType(e),r)return r;return""},i.selectSourceHandler=function(e,t){const r=i.sourceHandlers||[];let n;for(let s=0;s<r.length;s++)if(n=r[s].canHandleSource(e,t),n)return r[s];return null},i.canPlaySource=function(e,t){const r=i.selectSourceHandler(e,t);return r?r.canHandleSource(e,t):""},["seekable","seeking","duration"].forEach(function(e){const t=this[e];typeof t=="function"&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(e){let t=i.selectSourceHandler(e,this.options_);t||(i.nativeSourceHandler?t=i.nativeSourceHandler:he.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==i.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},i.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};z.registerComponent("Tech",le);le.registerTech("Tech",le);le.defaultTechOrder_=[];const nr={},ua={},ca={};function TS(i,e){nr[i]=nr[i]||[],nr[i].push(e)}function SS(i,e,t){i.setTimeout(()=>Ji(e,nr[e.type],t,i),1)}function ES(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function wS(i,e,t){return i.reduceRight(au(t),e[t]())}function kS(i,e,t,r){return e[t](i.reduce(au(t),r))}function Ad(i,e,t,r=null){const n="call"+Ve(t),s=i.reduce(au(n),r),a=s===ca,l=a?null:e[t](s);return AS(i,t,l,a),l}const CS={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},IS={setCurrentTime:1,setMuted:1,setVolume:1},xd={play:1,pause:1};function au(i){return(e,t)=>e===ca?ca:t[i]?t[i](e):e}function AS(i,e,t,r){for(let n=i.length-1;n>=0;n--){const s=i[n];s[e]&&s[e](r,t)}}function xS(i){ua.hasOwnProperty(i.id())&&delete ua[i.id()]}function LS(i,e){const t=ua[i.id()];let r=null;if(t==null)return r=e(i),ua[i.id()]=[[e,r]],r;for(let n=0;n<t.length;n++){const[s,a]=t[n];s===e&&(r=a)}return r===null&&(r=e(i),t.push([e,r])),r}function Ji(i={},e=[],t,r,n=[],s=!1){const[a,...l]=e;if(typeof a=="string")Ji(i,nr[a],t,r,n,s);else if(a){const u=LS(r,a);if(!u.setSource)return n.push(u),Ji(i,l,t,r,n,s);u.setSource(Object.assign({},i),function(p,m){if(p)return Ji(i,l,t,r,n,s);n.push(u),Ji(m,i.type===m.type?l:nr[m.type],t,r,n,s)})}else l.length?Ji(i,l,t,r,n,s):s?t(i,n):Ji(i,nr["*"],t,r,n,!0)}const DS={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},da=function(i=""){const e=su(i);return DS[e.toLowerCase()]||""},PS=(i,e)=>{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(n=>n.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let n=0;n<r.length;n++){const s=r[n];if(s.type&&s.src&&s.src===e)return s.type}return da(e)},Pm=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=Pm(t),Array.isArray(t)?e=e.concat(t):ui(t)&&e.push(t)}),i=e}else typeof i=="string"&&i.trim()?i=[Ld({src:i})]:ui(i)&&typeof i.src=="string"&&i.src&&i.src.trim()?i=[Ld(i)]:i=[];return i};function Ld(i){if(!i.type){const e=da(i.src);e&&(i.type=e)}return i}var RS=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
29
29
|
<defs>
|
|
30
30
|
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
31
31
|
<path d="M16 10v28l22-14z"></path>
|
|
@@ -167,8 +167,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
167
167
|
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
168
168
|
</symbol>
|
|
169
169
|
</defs>
|
|
170
|
-
</svg>`;const xd=ia?10009:ra?461:8,_r={codes:{play:415,pause:19,ff:417,rw:412,back:xd},names:{415:"play",19:"pause",417:"ff",412:"rw",[xd]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},Ld=5;class bS extends Ct{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const r=t.key.substring(5).toLowerCase();this.move(r)}else if(_r.isEventKey(t,"play")||_r.isEventKey(t,"pause")||_r.isEventKey(t,"ff")||_r.isEventKey(t,"rw")){t.preventDefault();const r=_r.getEventName(t);this.performMediaAction_(r)}else _r.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Ld);break;case"rw":this.userSeek_(this.player_.currentTime()-Ld);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let r=null;const n=this.getCurrentComponent(e.target);t&&(r=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!r||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function r(n){for(const s of n)s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())&&t.push(s),s.hasOwnProperty("children_")&&s.children_.length>0&&r(s.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?r(n.children_):n.hasOwnProperty("items")&&n.items.length>0?r(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const s=n.el_.querySelector(".vjs-errors-ok-button-container");s&&s.querySelectorAll("button").forEach((a,l)=>{t.push({name:()=>"ModalButton"+(l+1),el:()=>a,getPositions:()=>{const u=a.getBoundingClientRect(),p={x:u.x,y:u.y,width:u.width,height:u.height,top:u.top,right:u.right,bottom:u.bottom,left:u.left},g={x:u.left+u.width/2,y:u.top+u.height/2,width:0,height:0,top:u.top+u.height/2,right:u.left+u.width/2,bottom:u.top+u.height/2,left:u.left+u.width/2};return{boundingClientRect:p,center:g}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:u=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(r){if(e.getIsFocusable(r)&&e.getIsAvailableToBeFocused(r))return r;for(let n=0;n<r.children.length;n++){const s=r.children[n],a=t(s);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const r of this.focusableComponents)if(r.el()===t)return r}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const r=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(r.boundingClientRect,a.getPositions().boundingClientRect,e)),s=this.findBestCandidate_(r.center,n,e);s?this.focus(s):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,r){let n=1/0,s=null;for(const a of t){const l=a.getPositions().center,u=this.calculateDistance_(e,l,r);u<n&&(n=u,s=a)}return s}isInDirection_(e,t,r){switch(r){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,r){const n=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);let a;switch(r){case"right":case"left":a=n+s*100;break;case"up":a=s*2+n*.5;break;case"down":a=s*5+n;break;default:a=n+s}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class vS extends ${constructor(e,t,r){const n=ve({createEl:!1},t);if(super(e,n,r),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let s=0,a=t.playerOptions.techOrder;s<a.length;s++){const l=Be(a[s]);let u=oe.getTech(l);if(l||(u=$.getComponent(l)),u&&u.isSupported()){e.loadTech_(l);break}}else e.src(t.playerOptions.sources)}}$.registerComponent("MediaLoader",vS);class Ha extends ${constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=r=>this.handleMouseOver(r),this.handleMouseOut_=r=>this.handleMouseOut(r),this.handleClick_=r=>this.handleClick(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.emitTapEvents(),this.enable()}createEl(e="div",t={},r={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ue.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),r=Object.assign({role:"button"},r),this.tabIndex_=t.tabIndex;const n=se(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=se("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const r=this.localize(e);this.controlText_=e,Bi(this.controlTextEl_,r),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",r)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}$.registerComponent("ClickableComponent",Ha);class nl extends Ha{constructor(e,t){super(e,t),this.update(),this.update_=r=>this.update(r),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return se("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(se("picture",{className:"vjs-poster",tabIndex:-1},{},se("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Jt(this.player_.play()):this.player_.pause())}}nl.prototype.crossorigin=nl.prototype.crossOrigin;$.registerComponent("PosterImage",nl);const xt="#222",Dd="#ccc",TS={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Po(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Xt(i,e,t){try{i.style[e]=t}catch{return}}function Pd(i){return i?`${i}px`:""}class SS extends ${constructor(e,t,r){super(e,t,r);const n=a=>this.updateDisplay(a),s=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Ce(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);const a=x.screen.orientation||x,l=x.screen.orientation?"change":"orientationchange";a.addEventListener(l,s),e.on("dispose",()=>a.removeEventListener(l,s));const u=this.options_.playerOptions.tracks||[];for(let p=0;p<u.length;p++)this.player_.addRemoteTextTrack(u[p],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),r=this.player_.cache_.selectedLanguage;let n,s,a;for(let l=0;l<t.length;l++){const u=t[l];r&&r.enabled&&r.language&&r.language===u.language&&u.kind in e?u.kind===r.kind?a=u:a||(a=u):r&&!r.enabled?(a=null,n=null,s=null):u.default&&(u.kind==="descriptions"&&!n?n=u:u.kind in e&&!s&&(s=u))}a?a.mode="showing":s?s.mode="showing":n&&(n.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof x.WebVTT=="function"&&x.WebVTT.processCues(x,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let l=0;l<e.length;++l){const u=e[l];u.mode==="showing"&&a.push(u)}this.updateForTrack(a);return}let r=null,n=null,s=e.length;for(;s--;){const a=e[s];a.mode==="showing"&&(a.kind==="descriptions"?r=a:n=a)}if(n?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):r&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(r)),!x.CSS.supports("inset","10px")){const a=this.el_,l=a.querySelectorAll(".vjs-text-track-cue"),u=this.player_.controlBar.el_.getBoundingClientRect().height,p=this.player_.el_.getBoundingClientRect().height;a.style="",Xt(a,"position","relative"),Xt(a,"height",p-u+"px"),Xt(a,"top","unset"),na?Xt(a,"bottom",p+"px"):Xt(a,"bottom","0px"),l.length>0&&l.forEach(g=>{if(g.style.inset){const b=g.style.inset.split(" ");b.length===3&&Object.assign(g.style,{top:b[0],right:b[1],bottom:b[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!x.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),r=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let s=0,a=0;Math.abs(r-n)>.1&&(r>n?s=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),Xt(this.el_,"insetInline",Pd(s)),Xt(this.el_,"insetBlock",Pd(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),r=e.activeCues;let n=r.length;for(;n--;){const s=r[n];if(!s)continue;const a=s.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Xt(a.firstChild,"color",Po(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Xt(a.firstChild,"backgroundColor",Po(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Xt(a,"backgroundColor",Po(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${xt}, 2px 2px 4px ${xt}, 2px 2px 5px ${xt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${xt}, 2px 2px ${xt}, 3px 3px ${xt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Dd}, 0 1px ${Dd}, -1px -1px ${xt}, 0 -1px ${xt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${xt}, 0 0 4px ${xt}, 0 0 4px ${xt}, 0 0 4px ${xt}`)),t.fontPercent&&t.fontPercent!==1){const l=x.parseFloat(a.style.fontSize);a.style.fontSize=l*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=TS[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof x.WebVTT!="function"||e.every(r=>!r.activeCues))return;const t=[];for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s)t.push(n.activeCues[s])}x.WebVTT.processCues(x,t,this.el_);for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s){const a=n.activeCues[s].displayState;Zi(a,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language?n.language:r)),n.language&&jr(a,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}$.registerComponent("TextTrackDisplay",SS);class ES extends ${createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),r=se("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),n=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(r),n}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}$.registerComponent("LoadingSpinner",ES);class tt extends Ha{createEl(e,t={},r={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),r=Object.assign({type:"button"},r);const n=se(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}addChild(e,t={}){const r=this.constructor.name;return ue.warn(`Adding an actionable (user controllable) child to a Button (${r}) is not supported; use a ClickableComponent instead.`),$.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}$.registerComponent("Button",tt);class Cg extends tt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",r=>this.handleMouseDown(r))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){Jt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const r=this.player_.getChild("controlBar"),n=r&&r.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const s=()=>n.focus();Nn(t)?t.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Cg.prototype.controlText_="Play Video";$.registerComponent("BigPlayButton",Cg);class wS extends tt{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}$.registerComponent("CloseButton",wS);class Ig extends tt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",r=>this.handlePlay(r)),this.on(e,"pause",r=>this.handlePause(r)),t.replay&&this.on(e,"ended",r=>this.handleEnded(r))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Jt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}Ig.prototype.controlText_="Play";$.registerComponent("PlayToggle",Ig);class Yr extends ${constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],r=>this.update(r)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),r=se("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(r),this.contentEl_=se("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=nr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,ue.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=G.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Yr.prototype.labelText_="Time";Yr.prototype.controlText_="Time";$.registerComponent("TimeDisplay",Yr);class au extends Yr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}au.prototype.labelText_="Current Time";au.prototype.controlText_="Current Time";$.registerComponent("CurrentTimeDisplay",au);class ou extends Yr{constructor(e,t){super(e,t);const r=n=>this.updateContent(n);this.on(e,"durationchange",r),this.on(e,"loadstart",r),this.on(e,"loadedmetadata",r)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}ou.prototype.labelText_="Duration";ou.prototype.controlText_="Duration";$.registerComponent("DurationDisplay",ou);class kS extends ${createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),r=super.createEl("span",{textContent:"/"});return t.appendChild(r),e.appendChild(t),e}}$.registerComponent("TimeDivider",kS);class lu extends Yr{constructor(e,t){super(e,t),this.on(e,"durationchange",r=>this.updateContent(r))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(se("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}lu.prototype.labelText_="Remaining Time";lu.prototype.controlText_="Remaining Time";$.registerComponent("RemainingTimeDisplay",lu);class CS extends ${constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",r=>this.updateShowing(r))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=se("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(se("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(G.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}$.registerComponent("LiveDisplay",CS);class Ag extends tt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=r=>this.updateLiveEdgeStatus(r),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=se("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}Ag.prototype.controlText_="Seek to live, currently playing live";$.registerComponent("SeekToLive",Ag);function Jn(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var IS=Object.freeze({__proto__:null,clamp:Jn});class uu extends ${constructor(e,t){super(e,t),this.handleMouseDown_=r=>this.handleMouseDown(r),this.handleMouseUp_=r=>this.handleMouseUp(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.handleClick_=r=>this.handleClick(r),this.handleMouseMove_=r=>this.handleMouseMove(r),this.update_=r=>this.update(r),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},r={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),super.createEl(e,t,r)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!si&&e.preventDefault(),tg(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;ig(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Jn(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Ba(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,r=t&&t.enabled,n=t&&t.horizontalSeek;r?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}$.registerComponent("Slider",uu);const Ro=(i,e)=>Jn(i/e*100,0,100).toFixed(2)+"%";class AS extends ${constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",r=>this.update(r))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=se("span",{className:"vjs-control-text"}),r=se("span",{textContent:this.localize("Loaded")}),n=G.createTextNode(": ");return this.percentageEl_=se("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(r),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,r=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),a=this.partEls_,l=Ro(s,n);this.percent_!==l&&(this.el_.style.width=l,Bi(this.percentageEl_,l),this.percent_=l);for(let u=0;u<r.length;u++){const p=r.start(u),g=r.end(u);let b=a[u];b||(b=this.el_.appendChild(se()),a[u]=b),!(b.dataset.start===p&&b.dataset.end===g)&&(b.dataset.start=p,b.dataset.end=g,b.style.left=Ro(p,s),b.style.width=Ro(g-p,s))}for(let u=a.length;u>r.length;u--)this.el_.removeChild(a[u-1]);a.length=r.length})}}$.registerComponent("LoadProgressBar",AS);class xS extends ${constructor(e,t){super(e,t),this.update=ai(Ce(this,this.update),Rt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,r){const n=Vn(this.el_),s=qr(this.player_.el()),a=e.width*t;if(!s||!n)return;let l=e.left-s.left+a,u=e.width-a+(s.right-e.right);u||(u=e.width-a,l=a);let p=n.width/2;l<p?p+=p-l:u<p&&(p=u),p<0?p=0:p>n.width&&(p=n.width),p=Math.round(p),this.el_.style.right=`-${p}px`,this.write(r)}write(e){Bi(this.el_,e)}updateTime(e,t,r,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const l=this.player_.liveTracker.liveWindow(),u=l-t*l;s=(u<1?"":"-")+nr(u,l)}else s=nr(r,a);this.update(e,t,s),n&&n()})}}$.registerComponent("TimeTooltip",xS);class cu extends ${constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ai(Ce(this,this.update),Rt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const r=this.getChild("timeTooltip");if(!r)return;const n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}cu.prototype.options_={children:[]};!Ze&&!qt&&cu.prototype.options_.children.push("timeTooltip");$.registerComponent("PlayProgressBar",cu);class xg extends ${constructor(e,t){super(e,t),this.update=ai(Ce(this,this.update),Rt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,()=>{this.el_.style.left=`${e.width*t}px`})}}xg.prototype.options_={children:["timeTooltip"]};$.registerComponent("MouseTimeDisplay",xg);const Us=5,Rd=12;class za extends uu{constructor(e,t){t=ve(za.prototype.options_,t),t.children=[...t.children];const r=e.options_.disableSeekWhileScrubbingOnMobile&&(Ze||qt);(!Ze&&!qt||r)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=r,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ce(this,this.update),this.update=ai(this.update_,Rt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in G&&"visibilityState"in G&&this.on(G,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){G.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Rt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(G.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const r=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let s=this.player_.duration();n&&n.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==r||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[nr(r,s),nr(s,s)],"{1} of {2}")),this.currentTime_=r,this.duration_=s),this.bar&&this.bar.update(qr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();const e=this.getCurrentTime_();let t;const r=this.player_.liveTracker;return r&&r.isLive()?(t=(e-r.seekableStart())/r.liveWindow(),r.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Hn(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Hn(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let r;const n=this.calculateDistance(e),s=this.player_.liveTracker;if(!s||!s.isLive())r=n*this.player_.duration(),r===this.player_.duration()&&(r=r-.1);else{if(n>=.99){s.seekToLiveEdge();return}const a=s.seekableStart(),l=s.liveCurrentTime();if(r=a+n*s.liveWindow(),r>=l&&(r=l),r<=a&&(r=a+.1),r===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=r:this.userSeek_(r),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Jt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+Us)}stepBack(){this.userSeek_(this.player_.currentTime()-Us)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const r=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-Us*Rd)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+Us*Rd)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in G&&"visibilityState"in G&&this.off(G,"visibilitychange",this.toggleVisibility_),super.dispose()}}za.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};$.registerComponent("SeekBar",za);class Lg extends ${constructor(e,t){super(e,t),this.handleMouseMove=ai(Ce(this,this.handleMouseMove),Rt),this.throttledHandleMouseSeek=ai(Ce(this,this.handleMouseSeek),Rt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.handleMouseDownHandler_=r=>this.handleMouseDown(r),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const r=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!r&&!n)return;const s=t.el(),a=Vn(s);let l=Ba(s,e).x;l=Jn(l,0,1),n&&n.update(a,l),r&&r.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Jt(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Lg.prototype.options_={children:["seekBar"]};$.registerComponent("ProgressControl",Lg);class Dg extends tt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],r=>this.handlePictureInPictureChange(r)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],r=>this.handlePictureInPictureEnabledChange(r)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){G.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in x?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof G.exitPictureInPicture=="function"&&super.show()}}Dg.prototype.controlText_="Picture-in-Picture";$.registerComponent("PictureInPictureToggle",Dg);class Pg extends tt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",r=>this.handleFullscreenChange(r)),G[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Pg.prototype.controlText_="Fullscreen";$.registerComponent("FullscreenToggle",Pg);const LS=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class DS extends ${createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}$.registerComponent("VolumeLevel",DS);class PS extends ${constructor(e,t){super(e,t),this.update=ai(Ce(this,this.update),Rt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,r,n){if(!r){const s=qr(this.el_),a=qr(this.player_.el()),l=e.width*t;if(!a||!s)return;const u=e.left-a.left+l,p=e.width-l+(a.right-e.right);let g=s.width/2;u<g?g+=g-u:p<g&&(g=p),g<0?g=0:g>s.width&&(g=s.width),this.el_.style.right=`-${g}px`}this.write(`${n}%`)}write(e){Bi(this.el_,e)}updateVolume(e,t,r,n,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,r,n.toFixed(0)),s&&s()})}}$.registerComponent("VolumeLevelTooltip",PS);class Rg extends ${constructor(e,t){super(e,t),this.update=ai(Ce(this,this.update),Rt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,r){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,r,n,()=>{r?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Rg.prototype.options_={children:["volumeLevelTooltip"]};$.registerComponent("MouseVolumeLevelDisplay",Rg);class Wa extends uu{constructor(e,t){super(e,t),this.on("slideractive",r=>this.updateLastVolume_(r)),this.on(e,"volumechange",r=>this.updateARIAAttributes(r)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Hn(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const r=this.el(),n=qr(r),s=this.vertical();let a=Ba(r,e);a=s?a.y:a.x,a=Jn(a,0,1),t.update(n,a,s)}Hn(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Wa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Ze&&!qt&&Wa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Wa.prototype.playerEvent="volumechange";$.registerComponent("VolumeBar",Wa);class Ng extends ${constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Fr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),LS(this,e),this.throttledHandleMouseMove=ai(Ce(this,this.handleMouseMove),Rt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.on("mousedown",r=>this.handleMouseDown(r)),this.on("touchstart",r=>this.handleMouseDown(r)),this.on("mousemove",r=>this.handleMouseMove(r)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Ng.prototype.options_={children:["volumeBar"]};$.registerComponent("VolumeControl",Ng);const RS=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class Og extends tt{constructor(e,t){super(e,t),RS(this,e),this.on(e,["loadstart","volumechange"],r=>this.update(r))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),r=this.player_.lastVolume_();if(t===0){const n=r<.1?.1:r;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),Ze&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Ua(this.el_,[0,1,2,3].reduce((r,n)=>r+`${n?" ":""}vjs-vol-${n}`,"")),Zi(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Og.prototype.controlText_="Mute";$.registerComponent("MuteToggle",Og);class Ug extends ${constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Fr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=r=>this.handleKeyPress(r),this.on(e,["loadstart"],r=>this.volumePanelState_(r)),this.on(this.muteToggle,"keyup",r=>this.handleKeyPress(r)),this.on(this.volumeControl,"keyup",r=>this.handleVolumeControlKeyUp(r)),this.on("keydown",r=>this.handleKeyPress(r)),this.on("mouseover",r=>this.handleMouseOver(r)),this.on("mouseout",r=>this.handleMouseOut(r)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),kt(G,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),et(G,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Ug.prototype.options_={children:["muteToggle","volumeControl"]};$.registerComponent("VolumePanel",Ug);class Mg extends tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()?r.seekableEnd():this.player_.duration();let s;t+this.skipTime<=n?s=t+this.skipTime:s=n,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Mg.prototype.controlText_="Skip Forward";$.registerComponent("SkipForward",Mg);class Bg extends tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()&&r.seekableStart();let s;n&&t-this.skipTime<=n?s=n:t>=this.skipTime?s=t-this.skipTime:s=0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Bg.prototype.controlText_="Skip Backward";$.registerComponent("SkipBackward",Bg);class Fg extends ${constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",r=>this.handleKeyDown(r)),this.boundHandleBlur_=r=>this.handleBlur(r),this.boundHandleTapClick_=r=>this.handleTapClick(r)}addEventListenerForItem(e){e instanceof $&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof $&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=se(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),kt(t,"click",function(r){r.preventDefault(),r.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||G.activeElement;if(!this.children().some(r=>r.el()===t)){const r=this.menuButton_;r&&r.buttonPressed_&&t!==r.el().firstChild&&r.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const r=t.filter(n=>n.el()===e.target)[0];if(!r)return;r.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}$.registerComponent("Menu",Fg);class du extends ${constructor(e,t={}){super(e,t),this.menuButton_=new tt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const r=tt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+r,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=s=>this.handleClick(s);this.handleMenuKeyUp_=s=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",s=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),kt(G,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",s=>this.handleMouseLeave(s)),this.on("keydown",s=>this.handleSubmenuKeyDown(s))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Fg(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=se("li",{className:"vjs-menu-title",textContent:Be(this.options_.title),tabIndex:-1}),r=new $(this.player_,{el:t});e.addItem(r)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=tt.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),et(G,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),Ze&&Yp())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}$.registerComponent("MenuButton",du);class hu extends du{constructor(e,t){const r=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!r)return;const n=Ce(this,this.update);r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),r.addEventListener("labelchange",n),this.player_.on("ready",n),this.player_.on("dispose",function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n),r.removeEventListener("labelchange",n)})}}$.registerComponent("TrackButton",hu);class Zn extends Ha{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,r){this.nonIconControl=!0;const n=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),r),s=se("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?n.appendChild(s):n.replaceChild(s,n.querySelector(".vjs-icon-placeholder")),n}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}$.registerComponent("MenuItem",Zn);class es extends Zn{constructor(e,t){const r=t.track,n=e.textTracks();t.label=r.label||r.language||"Unknown",t.selected=r.mode==="showing",super(e,t),this.track=r,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const s=(...l)=>{this.handleTracksChange.apply(this,l)},a=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],s),n.addEventListener("change",s),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),n.removeEventListener("change",s),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof x.Event!="object")try{l=new x.Event("change")}catch{}l||(l=G.createEvent("Event"),l.initEvent("change",!0,!0)),n.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){const t=this.track,r=this.player_.textTracks();if(super.handleClick(e),!!r)for(let n=0;n<r.length;n++){const s=r[n];this.kinds.indexOf(s.kind)!==-1&&(s===t?s.mode!=="showing"&&(s.mode="showing"):s.mode!=="disabled"&&(s.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}$.registerComponent("TextTrackMenuItem",es);class jg extends es{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r!==this.isSelected_&&this.selected(r)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}$.registerComponent("OffTextTrackMenuItem",jg);class Qr extends hu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=es){let r;this.label_&&(r=`${this.label_} off`),e.push(new jg(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let s=0;s<n.length;s++){const a=n[s];if(this.kinds_.indexOf(a.kind)>-1){const l=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${a.kind}-menu-item`),e.push(l)}}return e}}$.registerComponent("TextTrackButton",Qr);class qg extends Zn{constructor(e,t){const r=t.track,n=t.cue,s=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=s&&s<n.endTime,super(e,t),this.track=r,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}$.registerComponent("ChaptersTrackMenuItem",qg);class pu extends Qr{constructor(e,t,r){super(e,t,r),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const r=e[t];if(r.kind===this.kind_)return r}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Be(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let r=0,n=t.length;r<n;r++){const s=t[r],a=new qg(this.player_,{track:this.track_,cue:s});e.push(a)}return e}}pu.prototype.kind_="chapters";pu.prototype.controlText_="Chapters";$.registerComponent("ChaptersButton",pu);class gu extends Qr{constructor(e,t,r){super(e,t,r),this.setIcon("audio-description");const n=e.textTracks(),s=Ce(this,this.handleTracksChange);n.addEventListener("change",s),this.on("dispose",function(){n.removeEventListener("change",s)})}handleTracksChange(e){const t=this.player().textTracks();let r=!1;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(a.kind!==this.kind_&&a.mode==="showing"){r=!0;break}}r?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}gu.prototype.kind_="descriptions";gu.prototype.controlText_="Descriptions";$.registerComponent("DescriptionsButton",gu);class mu extends Qr{constructor(e,t,r){super(e,t,r),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}mu.prototype.kind_="subtitles";mu.prototype.controlText_="Subtitles";$.registerComponent("SubtitlesButton",mu);class fu extends es{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}$.registerComponent("CaptionSettingsMenuItem",fu);class yu extends Qr{constructor(e,t,r){super(e,t,r),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new fu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}yu.prototype.kind_="captions";yu.prototype.controlText_="Captions";$.registerComponent("CaptionsButton",yu);class $g extends es{createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",n):s.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(se("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),n}}$.registerComponent("SubsCapsMenuItem",$g);class _u extends Qr{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Be(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new fu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,$g),e}}_u.prototype.kinds_=["captions","subtitles"];_u.prototype.controlText_="Subtitles";$.registerComponent("SubsCapsButton",_u);class Vg extends Zn{constructor(e,t){const r=t.track,n=e.audioTracks();t.label=r.label||r.language||"Unknown",t.selected=r.enabled,super(e,t),this.track=r,this.addClass(`vjs-${r.kind}-menu-item`);const s=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",s),this.on("dispose",()=>{n.removeEventListener("change",s)})}createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(se("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];n!==this.track&&(n.enabled=n===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}$.registerComponent("AudioTrackMenuItem",Vg);class Hg extends hu{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];e.push(new Vg(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}Hg.prototype.controlText_="Audio Track";$.registerComponent("AudioTrackButton",Hg);class bu extends Zn{constructor(e,t){const r=t.rate,n=parseFloat(r,10);t.label=r,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=r,this.rate=n,this.on(e,"ratechange",s=>this.update(s))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}bu.prototype.contentElType="button";$.registerComponent("PlaybackRateMenuItem",bu);class zg extends du{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",r=>this.updateVisibility(r)),this.on(e,"ratechange",r=>this.updateLabel(r)),this.on(e,"playbackrateschange",r=>this.handlePlaybackRateschange(r))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=se("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let r=e.length-1;r>=0;r--)t.push(new bu(this.player(),{rate:e[r]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}zg.prototype.controlText_="Playback Rate";$.registerComponent("PlaybackRateMenuButton",zg);class Wg extends ${buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},r={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,r)}}$.registerComponent("Spacer",Wg);class NS extends Wg{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}$.registerComponent("CustomControlSpacer",NS);class Gg extends ${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Gg.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};$.registerComponent("ControlBar",Gg);class Xg extends Kr{constructor(e,t){super(e,t),this.on(e,"error",r=>{this.open(r)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Xg.prototype.options_=Object.assign({},Kr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});$.registerComponent("ErrorDisplay",Xg);class Kg extends ${constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),se("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Pt()}`)+"-"+e[1].replace(/\W+/g,""),r=se("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),r}))}}$.registerComponent("TextTrackSelect",Kg);class tr extends ${constructor(e,t={}){super(e,t);const r=se("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(r);const n=this.options_.selects;for(const s of n){const a=this.options_.selectConfigs[s],l=a.className,u=a.id.replace("%s",this.options_.id_);let p=null;const g=`vjs_select_${Pt()}`;if(this.options_.type==="colors"){p=se("span",{className:l});const S=se("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});S.setAttribute("for",g),p.appendChild(S)}const b=new Kg(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:g,labelId:u});this.addChild(b),this.options_.type==="colors"&&(p.appendChild(b.el()),this.el().appendChild(p))}}createEl(){return se("fieldset",{className:this.options_.className})}}$.registerComponent("TextTrackFieldset",tr);class Yg extends ${constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new tr(e,{id_:r,legendId:`captions-text-legend-${r}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const s=new tr(e,{id_:r,legendId:`captions-background-${r}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const a=new tr(e,{id_:r,legendId:`captions-window-${r}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-colors"})}}$.registerComponent("TextTrackSettingsColors",Yg);class Qg extends ${constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new tr(e,{id_:r,legendId:`captions-font-size-${r}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const s=new tr(e,{id_:r,legendId:`captions-edge-style-${r}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const a=new tr(e,{id_:r,legendId:`captions-font-family-${r}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-font"})}}$.registerComponent("TextTrackSettingsFont",Qg);class Jg extends ${constructor(e,t={}){super(e,t);const r=this.localize("restore all settings to the default values"),n=new tt(e,{controlText:r,className:"vjs-default-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Reset"),this.addChild(n);const s=new tt(e,{controlText:r,className:"vjs-done-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Done"),this.addChild(s)}createEl(){return se("div",{className:"vjs-track-settings-controls"})}}$.registerComponent("TrackSettingsControls",Jg);const No="vjs-text-track-settings",Nd=["#000","Black"],Od=["#00F","Blue"],Ud=["#0FF","Cyan"],Md=["#0F0","Green"],Bd=["#F0F","Magenta"],Fd=["#F00","Red"],jd=["#FFF","White"],qd=["#FF0","Yellow"],Oo=["1","Opaque"],Uo=["0.5","Semi-Transparent"],$d=["0","Transparent"],Ni={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Nd,jd,Fd,Md,Od,qd,Bd,Ud],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Oo,Uo,$d],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[jd,Nd,Fd,Md,Od,qd,Bd,Ud],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Oo,Uo],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[$d,Uo,Oo],className:"vjs-window-opacity vjs-opacity"}};Ni.windowColor.options=Ni.backgroundColor.options;function Zg(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function OS(i,e){const t=i.options[i.options.selectedIndex].value;return Zg(t,e)}function US(i,e,t){if(e){for(let r=0;r<i.options.length;r++)if(Zg(i.options[r].value,t)===e){i.selectedIndex=r;break}}}class MS extends Kr{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=se("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new Yg(e,{textTrackComponentid:this.id_,selectConfigs:Ni,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const r=new Qg(e,{textTrackComponentid:this.id_,selectConfigs:Ni,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(r);const n=new Jg(e);this.addChild(n)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),wr(Ni,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Vp(Ni,(e,t,r)=>{const n=OS(this.$(t.selector),t.parser);return n!==void 0&&(e[r]=n),e},{})}setValues(e){wr(Ni,(t,r)=>{US(this.$(t.selector),e[r],t.parser)})}setDefaults(){wr(Ni,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(x.localStorage.getItem(No))}catch(t){ue.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?x.localStorage.setItem(No,JSON.stringify(e)):x.localStorage.removeItem(No)}catch(t){ue.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}$.registerComponent("TextTrackSettings",MS);class BS extends ${constructor(e,t){let r=t.ResizeObserver||x.ResizeObserver;t.ResizeObserver===null&&(r=!1);const n=ve({createEl:!r,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||x.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=hg(()=>{this.resizeHandler()},100,!1,this),r?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const s=this.debouncedHandler_;let a=this.unloadListener_=function(){et(this,"resize",s),et(this,"unload",a),a=null};kt(this.el_.contentWindow,"unload",a),kt(this.el_.contentWindow,"resize",s)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}$.registerComponent("ResizeManager",BS);const FS={trackingThreshold:20,liveTolerance:15};class jS extends ${constructor(e,t){const r=ve(FS,t,{createEl:!1});super(e,r),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(x.performance.now().toFixed(4)),r=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+r;const n=this.liveCurrentTime(),s=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-s)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Rt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.end(r));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.start(r));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}$.registerComponent("LiveTracker",jS);class qS extends ${constructor(e,t){super(e,t),this.on("statechanged",r=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:se("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Pt()}`}),description:se("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Pt()}`})},se("div",{className:"vjs-title-bar"},{},Hp(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const s=this.state[n],a=this.els[n],l=r[n];Fa(a),s&&Bi(a,s),t&&(t.removeAttribute(l),s&&t.setAttribute(l,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}$.registerComponent("TitleBar",qS);const $S={initialDisplay:4e3,position:[],takeFocus:!1};class VS extends tt{constructor(e,t){t=ve($S,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],r=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=se("button",{},{type:"button",class:this.buildCSSClass()},se("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}$.registerComponent("TransientButton",VS);const sl=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),r=[];let n="";if(!t.length)return!1;for(let s=0;s<t.length;s++){const a=t[s].src;a&&r.indexOf(a)===-1&&r.push(a)}return r.length?(r.length===1&&(n=r[0]),i.triggerSourceset(n),!0):!1},HS=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(i){const e=G.createElement(this.nodeName.toLowerCase());e.innerHTML=i;const t=G.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",x.Element.prototype.appendChild.call(this,t),this.innerHTML}}),em=(i,e)=>{let t={};for(let r=0;r<i.length&&(t=Object.getOwnPropertyDescriptor(i[r],e),!(t&&t.set&&t.get));r++);return t.enumerable=!0,t.configurable=!0,t},zS=i=>em([i.el(),x.HTMLMediaElement.prototype,x.Element.prototype,HS],"innerHTML"),Vd=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=zS(i),n=s=>(...a)=>{const l=s.apply(e,a);return sl(i),l};["append","appendChild","insertAdjacentHTML"].forEach(s=>{e[s]&&(t[s]=e[s],e[s]=n(t[s]))}),Object.defineProperty(e,"innerHTML",ve(r,{set:n(r.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(s=>{e[s]=t[s]}),Object.defineProperty(e,"innerHTML",r)},i.one("sourceset",e.resetSourceWatch_)},WS=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Sg(x.Element.prototype.getAttribute.call(this,"src")):""},set(i){return x.Element.prototype.setAttribute.call(this,"src",i),i}}),GS=i=>em([i.el(),x.HTMLMediaElement.prototype,WS],"src"),XS=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=GS(i),r=e.setAttribute,n=e.load;Object.defineProperty(e,"src",ve(t,{set:s=>{const a=t.set.call(e,s);return i.triggerSourceset(e.src),a}})),e.setAttribute=(s,a)=>{const l=r.call(e,s,a);return/src/i.test(s)&&i.triggerSourceset(e.src),l},e.load=()=>{const s=n.call(e);return sl(i)||(i.triggerSourceset(""),Vd(i)),s},e.currentSrc?i.triggerSourceset(e.currentSrc):sl(i)||Vd(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=r,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Z extends oe{constructor(e,t){super(e,t);const r=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",r&&(this.el_.currentSrc!==r.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(r):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const s=this.el_.childNodes;let a=s.length;const l=[];for(;a--;){const u=s[a];u.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(u),this.remoteTextTracks().addTrack(u.track),this.textTracks().addTrack(u.track),!n&&!this.el_.hasAttribute("crossorigin")&&Va(u.src)&&(n=!0)):l.push(u))}for(let u=0;u<l.length;u++)this.el_.removeChild(l[u])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&ue.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
-
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),($n||Na)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Z.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){XS(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const r=()=>{t=[];for(let s=0;s<e.length;s++){const a=e[s];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};r(),e.addEventListener("change",r),this.on("dispose",()=>e.removeEventListener("change",r));const n=()=>{for(let s=0;s<t.length;s++){const a=t[s];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",n)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",r),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",r),e.addEventListener("change",r),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const r=e.toLowerCase();this[`${r}TracksListeners_`]&&Object.keys(this[`${r}TracksListeners_`]).forEach(n=>{this.el()[`${r}Tracks`].removeEventListener(n,this[`${r}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${r}TracksListeners_`]=null,this.proxyNativeTracksForType_(r)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Dt[e],r=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!r||!r.addEventListener)return;const s={change:l=>{const u={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(u),e==="text"&&this[Hr.remoteText.getterName]().trigger(u)},addtrack(l){n.addTrack(l.track)},removetrack(l){n.removeTrack(l.track)}},a=function(){const l=[];for(let u=0;u<n.length;u++){let p=!1;for(let g=0;g<r.length;g++)if(r[g]===n[u]){p=!0;break}p||l.push(n[u])}for(;l.length;)n.removeTrack(l.shift())};this[t.getterName+"Listeners_"]=s,Object.keys(s).forEach(l=>{const u=s[l];r.addEventListener(l,u),this.on("dispose",p=>r.removeEventListener(l,u))}),this.on("loadstart",a),this.on("dispose",l=>this.off("loadstart",a))}proxyNativeTracks_(){Dt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const r=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(r,e),Z.disposeMediaElement(e),e=r}else{e=G.createElement("video");const r=this.options_.tag&&Ri(this.options_.tag),n=ve({},r);(!$n||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,Zp(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&jr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let r=0;r<t.length;r++){const n=t[r],s=this.options_[n];typeof s<"u"&&(s?jr(e,n,n):Ma(e,n),e[n]=s)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let r=!1;const n=function(){r=!0};this.on("loadstart",n);const s=function(){r||this.trigger("loadstart")};this.on("loadedmetadata",s),this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",s),r||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(r){this.trigger(r)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Oa?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ue(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&qt&&si&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Jt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return ue.error("Invalid source URL."),!1;const r={src:e};t&&(r.type=t);const n=se("source",{},r);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return ue.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const r of t)if(r.src===e)return this.el_.removeChild(r),!0;return ue.warn(`No matching source element found with src: ${e}`),!1}reset(){Z.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):super.addTextTrack(e,t,r)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=G.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const r=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let r=t.length;for(;r--;)(e===t[r]||e===t[r].track)&&this.el().removeChild(t[r])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),x.performance&&(e.creationTime=x.performance.now()),e}}Da(Z,"TEST_VID",function(){if(!Wr())return;const i=G.createElement("video"),e=G.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});Z.isSupported=function(){try{Z.TEST_VID.volume=.5}catch{return!1}return!!(Z.TEST_VID&&Z.TEST_VID.canPlayType)};Z.canPlayType=function(i){return Z.TEST_VID.canPlayType(i)};Z.canPlaySource=function(i,e){return Z.canPlayType(i.type)};Z.canControlVolume=function(){try{const i=Z.TEST_VID.volume;Z.TEST_VID.volume=i/2+.1;const e=i!==Z.TEST_VID.volume;return e&&Ze?(x.setTimeout(()=>{Z&&Z.prototype&&(Z.prototype.featuresVolumeControl=i!==Z.TEST_VID.volume)}),!1):e}catch{return!1}};Z.canMuteVolume=function(){try{const i=Z.TEST_VID.muted;return Z.TEST_VID.muted=!i,Z.TEST_VID.muted?jr(Z.TEST_VID,"muted","muted"):Ma(Z.TEST_VID,"muted","muted"),i!==Z.TEST_VID.muted}catch{return!1}};Z.canControlPlaybackRate=function(){if(qt&&si&&Pa<58)return!1;try{const i=Z.TEST_VID.playbackRate;return Z.TEST_VID.playbackRate=i/2+.1,i!==Z.TEST_VID.playbackRate}catch{return!1}};Z.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(G.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(G.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(G.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(G.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0};Z.supportsNativeTextTracks=function(){return Oa||Ze&&si};Z.supportsNativeVideoTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.videoTracks)};Z.supportsNativeAudioTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.audioTracks)};Z.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){Da(Z.prototype,i,()=>Z[e](),!0)});Z.prototype.featuresVolumeControl=Z.canControlVolume();Z.prototype.movingMediaElementInDOM=!Ze;Z.prototype.featuresFullscreenResize=!0;Z.prototype.featuresProgressEvents=!0;Z.prototype.featuresTimeupdateEvents=!0;Z.prototype.featuresVideoFrameCallback=!!(Z.TEST_VID&&Z.TEST_VID.requestVideoFrameCallback);Z.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()}};Z.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){Z.prototype["set"+Be(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){Z.prototype["set"+Be(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]()}});oe.withSourceHandlers(Z);Z.nativeSourceHandler={};Z.nativeSourceHandler.canPlayType=function(i){try{return Z.TEST_VID.canPlayType(i)}catch{return""}};Z.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return Z.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=nu(i.src);return Z.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Z.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};Z.nativeSourceHandler.dispose=function(){};Z.registerSourceHandler(Z.nativeSourceHandler);oe.registerTech("Html5",Z);const tm=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Mo={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},al=["tiny","xsmall","small","medium","large","xlarge","huge"],$s={};al.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;$s[i]=`vjs-layout-${e}`});const KS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ae extends ${constructor(e,t,r){if(e.id=e.id||t.id||`vjs_video_${Pt()}`,t=Object.assign(Ae.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,r),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=qp(this.id_),this.fsApi_=Zs,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Ri(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(l){a[l.toLowerCase()]=t.languages[l]}),this.languages_=a}else this.languages_=Ae.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),eu(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(kt(G,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=ve(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new x.DOMParser().parseFromString(_S,"image/svg+xml");if(a.querySelector("parsererror"))ue.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const l=a.documentElement;l.style.display="none",this.el_.appendChild(l),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new bS(this),this.addClass("vjs-spatial-navigation-enabled")),$n&&this.addClass("vjs-touch-enabled"),Ze||this.addClass("vjs-workinghover"),Ae.players[this.id_]=this;const s=Yo.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),et(G,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),et(G,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ae.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),gS(this),lt.names.forEach(e=>{const t=lt[e],r=this[t.getterName]();r&&r.off&&r.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";r?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const s=Ri(e);if(n){for(t=this.el_=e,e=this.tag=G.createElement("video");t.children.length;)e.appendChild(t.firstChild);Pn(t,"video-js")||Zi(t,"video-js"),t.appendChild(e),r=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),s.tabindex="-1",si&&Ra&&(e.setAttribute("role","application"),s.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(u){n&&u==="class"||t.setAttribute(u,s[u]),n&&e.setAttribute(u,s[u])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(u=>Kp[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),x.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=cg("vjs-styles-dimensions");const u=Ui(".vjs-styles-defaults"),p=Ui("head");p.insertBefore(this.styleEl_,u?u.nextSibling:p.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const l=e.getElementsByTagName("a");for(let u=0;u<l.length;u++){const p=l.item(u);Zi(p,"vjs-hidden"),p.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(t,e),Jo(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){ue.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const r=e+"_";if(t===void 0)return this[r]||0;if(t===""||t==="auto"){this[r]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){ue.error(`Improper value "${t}" supplied for for ${e}`);return}this[r]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,mi(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),H1(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(x.VIDEOJS_NO_DYNAMIC_STYLE===!0){const l=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,p=this.tech_&&this.tech_.el();p&&(l>=0&&(p.width=l),u>=0&&(p.height=u));return}let e,t,r,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?r=this.aspectRatio_:this.videoWidth()>0?r=this.videoWidth()+":"+this.videoHeight():r="16:9";const s=r.split(":"),a=s[1]/s[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),dg(this.styleEl_,`
|
|
170
|
+
</svg>`;const Dd=na?10009:sa?461:8,Sr={codes:{play:415,pause:19,ff:417,rw:412,back:Dd},names:{415:"play",19:"pause",417:"ff",412:"rw",[Dd]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},Pd=5;class NS extends Dt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const r=t.key.substring(5).toLowerCase();this.move(r)}else if(Sr.isEventKey(t,"play")||Sr.isEventKey(t,"pause")||Sr.isEventKey(t,"ff")||Sr.isEventKey(t,"rw")){t.preventDefault();const r=Sr.getEventName(t);this.performMediaAction_(r)}else Sr.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Pd);break;case"rw":this.userSeek_(this.player_.currentTime()-Pd);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let r=null;const n=this.getCurrentComponent(e.target);t&&(r=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!r||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function r(n){for(const s of n)s.hasOwnProperty("el_")&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())&&t.push(s),s.hasOwnProperty("children_")&&s.children_.length>0&&r(s.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?r(n.children_):n.hasOwnProperty("items")&&n.items.length>0?r(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const s=n.el_.querySelector(".vjs-errors-ok-button-container");s&&s.querySelectorAll("button").forEach((a,l)=>{t.push({name:()=>"ModalButton"+(l+1),el:()=>a,getPositions:()=>{const u=a.getBoundingClientRect(),p={x:u.x,y:u.y,width:u.width,height:u.height,top:u.top,right:u.right,bottom:u.bottom,left:u.left},m={x:u.left+u.width/2,y:u.top+u.height/2,width:0,height:0,top:u.top+u.height/2,right:u.left+u.width/2,bottom:u.top+u.height/2,left:u.left+u.width/2};return{boundingClientRect:p,center:m}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:u=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(r){if(e.getIsFocusable(r)&&e.getIsAvailableToBeFocused(r))return r;for(let n=0;n<r.children.length;n++){const s=r.children[n],a=t(s);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const r of this.focusableComponents)if(r.el()===t)return r}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const r=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(r.boundingClientRect,a.getPositions().boundingClientRect,e)),s=this.findBestCandidate_(r.center,n,e);s?this.focus(s):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,r){let n=1/0,s=null;for(const a of t){const l=a.getPositions().center,u=this.calculateDistance_(e,l,r);u<n&&(n=u,s=a)}return s}isInDirection_(e,t,r){switch(r){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,r){const n=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);let a;switch(r){case"right":case"left":a=n+s*100;break;case"up":a=s*2+n*.5;break;case"down":a=s*5+n;break;default:a=n+s}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class OS extends z{constructor(e,t,r){const n=we({createEl:!1},t);if(super(e,n,r),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let s=0,a=t.playerOptions.techOrder;s<a.length;s++){const l=Ve(a[s]);let u=le.getTech(l);if(l||(u=z.getComponent(l)),u&&u.isSupported()){e.loadTech_(l);break}}else e.src(t.playerOptions.sources)}}z.registerComponent("MediaLoader",OS);class Wa extends z{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=r=>this.handleMouseOver(r),this.handleMouseOut_=r=>this.handleMouseOut(r),this.handleClick_=r=>this.handleClick(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.emitTapEvents(),this.enable()}createEl(e="div",t={},r={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&he.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),r=Object.assign({role:"button"},r),this.tabIndex_=t.tabIndex;const n=se(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=se("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const r=this.localize(e);this.controlText_=e,$i(this.controlTextEl_,r),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",r)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}z.registerComponent("ClickableComponent",Wa);class sl extends Wa{constructor(e,t){super(e,t),this.update(),this.update_=r=>this.update(r),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return se("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(se("picture",{className:"vjs-poster",tabIndex:-1},{},se("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?ri(this.player_.play()):this.player_.pause())}}sl.prototype.crossorigin=sl.prototype.crossOrigin;z.registerComponent("PosterImage",sl);const Ot="#222",Rd="#ccc",US={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ro(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Zt(i,e,t){try{i.style[e]=t}catch{return}}function Nd(i){return i?`${i}px`:""}class MS extends z{constructor(e,t,r){super(e,t,r);const n=a=>this.updateDisplay(a),s=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Le(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",s),e.on("playerresize",s);const a=x.screen.orientation||x,l=x.screen.orientation?"change":"orientationchange";a.addEventListener(l,s),e.on("dispose",()=>a.removeEventListener(l,s));const u=this.options_.playerOptions.tracks||[];for(let p=0;p<u.length;p++)this.player_.addRemoteTextTrack(u[p],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),r=this.player_.cache_.selectedLanguage;let n,s,a;for(let l=0;l<t.length;l++){const u=t[l];r&&r.enabled&&r.language&&r.language===u.language&&u.kind in e?u.kind===r.kind?a=u:a||(a=u):r&&!r.enabled?(a=null,n=null,s=null):u.default&&(u.kind==="descriptions"&&!n?n=u:u.kind in e&&!s&&(s=u))}a?a.mode="showing":s?s.mode="showing":n&&(n.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof x.WebVTT=="function"&&x.WebVTT.processCues(x,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let l=0;l<e.length;++l){const u=e[l];u.mode==="showing"&&a.push(u)}this.updateForTrack(a);return}let r=null,n=null,s=e.length;for(;s--;){const a=e[s];a.mode==="showing"&&(a.kind==="descriptions"?r=a:n=a)}if(n?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):r&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(r)),!x.CSS.supports("inset","10px")){const a=this.el_,l=a.querySelectorAll(".vjs-text-track-cue"),u=this.player_.controlBar.el_.getBoundingClientRect().height,p=this.player_.el_.getBoundingClientRect().height;a.style="",Zt(a,"position","relative"),Zt(a,"height",p-u+"px"),Zt(a,"top","unset"),aa?Zt(a,"bottom",p+"px"):Zt(a,"bottom","0px"),l.length>0&&l.forEach(m=>{if(m.style.inset){const _=m.style.inset.split(" ");_.length===3&&Object.assign(m.style,{top:_[0],right:_[1],bottom:_[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!x.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),r=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let s=0,a=0;Math.abs(r-n)>.1&&(r>n?s=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),Zt(this.el_,"insetInline",Nd(s)),Zt(this.el_,"insetBlock",Nd(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),r=e.activeCues;let n=r.length;for(;n--;){const s=r[n];if(!s)continue;const a=s.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Zt(a.firstChild,"color",Ro(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Zt(a.firstChild,"backgroundColor",Ro(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Zt(a,"backgroundColor",Ro(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Ot}, 2px 2px 4px ${Ot}, 2px 2px 5px ${Ot}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Ot}, 2px 2px ${Ot}, 3px 3px ${Ot}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Rd}, 0 1px ${Rd}, -1px -1px ${Ot}, 0 -1px ${Ot}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}`)),t.fontPercent&&t.fontPercent!==1){const l=x.parseFloat(a.style.fontSize);a.style.fontSize=l*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=US[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof x.WebVTT!="function"||e.every(r=>!r.activeCues))return;const t=[];for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s)t.push(n.activeCues[s])}x.WebVTT.processCues(x,t,this.el_);for(let r=0;r<e.length;++r){const n=e[r];for(let s=0;s<n.activeCues.length;++s){const a=n.activeCues[s].displayState;rr(a,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language?n.language:r)),n.language&&Hr(a,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}z.registerComponent("TextTrackDisplay",MS);class BS extends z{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),r=se("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),n=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(r),n}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}z.registerComponent("LoadingSpinner",BS);class st extends Wa{createEl(e,t={},r={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),r=Object.assign({type:"button"},r);const n=se(e,t,r);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}addChild(e,t={}){const r=this.constructor.name;return he.warn(`Adding an actionable (user controllable) child to a Button (${r}) is not supported; use a ClickableComponent instead.`),z.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}z.registerComponent("Button",st);class Rm extends st{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",r=>this.handleMouseDown(r))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){ri(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const r=this.player_.getChild("controlBar"),n=r&&r.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const s=()=>n.focus();Bn(t)?t.then(s,()=>{}):this.setTimeout(s,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Rm.prototype.controlText_="Play Video";z.registerComponent("BigPlayButton",Rm);class FS extends st{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}z.registerComponent("CloseButton",FS);class Nm extends st{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",r=>this.handlePlay(r)),this.on(e,"pause",r=>this.handlePause(r)),t.replay&&this.on(e,"ended",r=>this.handleEnded(r))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ri(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}Nm.prototype.controlText_="Play";z.registerComponent("PlayToggle",Nm);class en extends z{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],r=>this.update(r)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),r=se("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(r),this.contentEl_=se("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=lr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,he.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=X.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}en.prototype.labelText_="Time";en.prototype.controlText_="Time";z.registerComponent("TimeDisplay",en);class ou extends en{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}ou.prototype.labelText_="Current Time";ou.prototype.controlText_="Current Time";z.registerComponent("CurrentTimeDisplay",ou);class lu extends en{constructor(e,t){super(e,t);const r=n=>this.updateContent(n);this.on(e,"durationchange",r),this.on(e,"loadstart",r),this.on(e,"loadedmetadata",r)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}lu.prototype.labelText_="Duration";lu.prototype.controlText_="Duration";z.registerComponent("DurationDisplay",lu);class jS extends z{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),r=super.createEl("span",{textContent:"/"});return t.appendChild(r),e.appendChild(t),e}}z.registerComponent("TimeDivider",jS);let uu=class extends en{constructor(e,t){super(e,t),this.on(e,"durationchange",r=>this.updateContent(r))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(se("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}};uu.prototype.labelText_="Remaining Time";uu.prototype.controlText_="Remaining Time";z.registerComponent("RemainingTimeDisplay",uu);class $S extends z{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",r=>this.updateShowing(r))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=se("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(se("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(X.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}z.registerComponent("LiveDisplay",$S);class Om extends st{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=r=>this.updateLiveEdgeStatus(r),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=se("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}Om.prototype.controlText_="Seek to live, currently playing live";z.registerComponent("SeekToLive",Om);function is(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var qS=Object.freeze({__proto__:null,clamp:is});class cu extends z{constructor(e,t){super(e,t),this.handleMouseDown_=r=>this.handleMouseDown(r),this.handleMouseUp_=r=>this.handleMouseUp(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.handleClick_=r=>this.handleClick(r),this.handleMouseMove_=r=>this.handleMouseMove(r),this.update_=r=>this.update(r),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},r={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),super.createEl(e,t,r)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ci&&e.preventDefault(),lm(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;um(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(is(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=ja(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,r=t&&t.enabled,n=t&&t.horizontalSeek;r?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}z.registerComponent("Slider",cu);const No=(i,e)=>is(i/e*100,0,100).toFixed(2)+"%";class VS extends z{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",r=>this.update(r))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=se("span",{className:"vjs-control-text"}),r=se("span",{textContent:this.localize("Loaded")}),n=X.createTextNode(": ");return this.percentageEl_=se("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(r),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,r=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),s=this.player_.bufferedEnd(),a=this.partEls_,l=No(s,n);this.percent_!==l&&(this.el_.style.width=l,$i(this.percentageEl_,l),this.percent_=l);for(let u=0;u<r.length;u++){const p=r.start(u),m=r.end(u);let _=a[u];_||(_=this.el_.appendChild(se()),a[u]=_),!(_.dataset.start===p&&_.dataset.end===m)&&(_.dataset.start=p,_.dataset.end=m,_.style.left=No(p,s),_.style.width=No(m-p,s))}for(let u=a.length;u>r.length;u--)this.el_.removeChild(a[u-1]);a.length=r.length})}}z.registerComponent("LoadProgressBar",VS);class HS extends z{constructor(e,t){super(e,t),this.update=di(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,r){const n=Gn(this.el_),s=zr(this.player_.el()),a=e.width*t;if(!s||!n)return;let l=e.left-s.left+a,u=e.width-a+(s.right-e.right);u||(u=e.width-a,l=a);let p=n.width/2;l<p?p+=p-l:u<p&&(p=u),p<0?p=0:p>n.width&&(p=n.width),p=Math.round(p),this.el_.style.right=`-${p}px`,this.write(r)}write(e){$i(this.el_,e)}updateTime(e,t,r,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let s;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const l=this.player_.liveTracker.liveWindow(),u=l-t*l;s=(u<1?"":"-")+lr(u,l)}else s=lr(r,a);this.update(e,t,s),n&&n()})}}z.registerComponent("TimeTooltip",HS);class du extends z{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=di(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const r=this.getChild("timeTooltip");if(!r)return;const n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}du.prototype.options_={children:[]};!rt&&!Gt&&du.prototype.options_.children.push("timeTooltip");z.registerComponent("PlayProgressBar",du);class Um extends z{constructor(e,t){super(e,t),this.update=di(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,()=>{this.el_.style.left=`${e.width*t}px`})}}Um.prototype.options_={children:["timeTooltip"]};z.registerComponent("MouseTimeDisplay",Um);const Bs=5,Od=12;class Ga extends cu{constructor(e,t){t=we(Ga.prototype.options_,t),t.children=[...t.children];const r=e.options_.disableSeekWhileScrubbingOnMobile&&(rt||Gt);(!rt&&!Gt||r)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=r,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=di(this.update_,Ft),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in X&&"visibilityState"in X&&this.on(X,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){X.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,Ft))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(X.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const r=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let s=this.player_.duration();n&&n.isLive()&&(s=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==r||this.duration_!==s)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[lr(r,s),lr(s,s)],"{1} of {2}")),this.currentTime_=r,this.duration_=s),this.bar&&this.bar.update(zr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();const e=this.getCurrentTime_();let t;const r=this.player_.liveTracker;return r&&r.isLive()?(t=(e-r.seekableStart())/r.liveWindow(),r.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){Xn(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Xn(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let r;const n=this.calculateDistance(e),s=this.player_.liveTracker;if(!s||!s.isLive())r=n*this.player_.duration(),r===this.player_.duration()&&(r=r-.1);else{if(n>=.99){s.seekToLiveEdge();return}const a=s.seekableStart(),l=s.liveCurrentTime();if(r=a+n*s.liveWindow(),r>=l&&(r=l),r<=a&&(r=a+.1),r===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=r:this.userSeek_(r),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?ri(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+Bs)}stepBack(){this.userSeek_(this.player_.currentTime()-Bs)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const r=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-Bs*Od)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+Bs*Od)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in X&&"visibilityState"in X&&this.off(X,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ga.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};z.registerComponent("SeekBar",Ga);class Mm extends z{constructor(e,t){super(e,t),this.handleMouseMove=di(Le(this,this.handleMouseMove),Ft),this.throttledHandleMouseSeek=di(Le(this,this.handleMouseSeek),Ft),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.handleMouseDownHandler_=r=>this.handleMouseDown(r),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const r=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!r&&!n)return;const s=t.el(),a=Gn(s);let l=ja(s,e).x;l=is(l,0,1),n&&n.update(a,l),r&&r.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&ri(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Mm.prototype.options_={children:["seekBar"]};z.registerComponent("ProgressControl",Mm);class Bm extends st{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],r=>this.handlePictureInPictureChange(r)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],r=>this.handlePictureInPictureEnabledChange(r)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){X.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in x?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof X.exitPictureInPicture=="function"&&super.show()}}Bm.prototype.controlText_="Picture-in-Picture";z.registerComponent("PictureInPictureToggle",Bm);class Fm extends st{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",r=>this.handleFullscreenChange(r)),X[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Fm.prototype.controlText_="Fullscreen";z.registerComponent("FullscreenToggle",Fm);const zS=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class WS extends z{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}z.registerComponent("VolumeLevel",WS);class GS extends z{constructor(e,t){super(e,t),this.update=di(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,r,n){if(!r){const s=zr(this.el_),a=zr(this.player_.el()),l=e.width*t;if(!a||!s)return;const u=e.left-a.left+l,p=e.width-l+(a.right-e.right);let m=s.width/2;u<m?m+=m-u:p<m&&(m=p),m<0?m=0:m>s.width&&(m=s.width),this.el_.style.right=`-${m}px`}this.write(`${n}%`)}write(e){$i(this.el_,e)}updateVolume(e,t,r,n,s){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,r,n.toFixed(0)),s&&s()})}}z.registerComponent("VolumeLevelTooltip",GS);class jm extends z{constructor(e,t){super(e,t),this.update=di(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,r){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,r,n,()=>{r?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}jm.prototype.options_={children:["volumeLevelTooltip"]};z.registerComponent("MouseVolumeLevelDisplay",jm);class Xa extends cu{constructor(e,t){super(e,t),this.on("slideractive",r=>this.updateLastVolume_(r)),this.on(e,"volumechange",r=>this.updateARIAAttributes(r)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){Xn(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const r=this.el(),n=zr(r),s=this.vertical();let a=ja(r,e);a=s?a.y:a.x,a=is(a,0,1),t.update(n,a,s)}Xn(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}Xa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!rt&&!Gt&&Xa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Xa.prototype.playerEvent="volumechange";z.registerComponent("VolumeBar",Xa);class $m extends z{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Vr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),zS(this,e),this.throttledHandleMouseMove=di(Le(this,this.handleMouseMove),Ft),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.on("mousedown",r=>this.handleMouseDown(r)),this.on("touchstart",r=>this.handleMouseDown(r)),this.on("mousemove",r=>this.handleMouseMove(r)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}$m.prototype.options_={children:["volumeBar"]};z.registerComponent("VolumeControl",$m);const XS=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class qm extends st{constructor(e,t){super(e,t),XS(this,e),this.on(e,["loadstart","volumechange"],r=>this.update(r))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),r=this.player_.lastVolume_();if(t===0){const n=r<.1?.1:r;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),rt&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Ba(this.el_,[0,1,2,3].reduce((r,n)=>r+`${n?" ":""}vjs-vol-${n}`,"")),rr(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}qm.prototype.controlText_="Mute";z.registerComponent("MuteToggle",qm);class Vm extends z{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Vr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=r=>this.handleKeyPress(r),this.on(e,["loadstart"],r=>this.volumePanelState_(r)),this.on(this.muteToggle,"keyup",r=>this.handleKeyPress(r)),this.on(this.volumeControl,"keyup",r=>this.handleVolumeControlKeyUp(r)),this.on("keydown",r=>this.handleKeyPress(r)),this.on("mouseover",r=>this.handleMouseOver(r)),this.on("mouseout",r=>this.handleMouseOut(r)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Lt(X,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),nt(X,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Vm.prototype.options_={children:["muteToggle","volumeControl"]};z.registerComponent("VolumePanel",Vm);class Hm extends st{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()?r.seekableEnd():this.player_.duration();let s;t+this.skipTime<=n?s=t+this.skipTime:s=n,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Hm.prototype.controlText_="Skip Forward";z.registerComponent("SkipForward",Hm);class zm extends st{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),r=this.player_.liveTracker,n=r&&r.isLive()&&r.seekableStart();let s;n&&t-this.skipTime<=n?s=n:t>=this.skipTime?s=t-this.skipTime:s=0,this.player_.currentTime(s)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}zm.prototype.controlText_="Skip Backward";z.registerComponent("SkipBackward",zm);class Wm extends z{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",r=>this.handleKeyDown(r)),this.boundHandleBlur_=r=>this.handleBlur(r),this.boundHandleTapClick_=r=>this.handleTapClick(r)}addEventListenerForItem(e){e instanceof z&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof z&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=se(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),Lt(t,"click",function(r){r.preventDefault(),r.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||X.activeElement;if(!this.children().some(r=>r.el()===t)){const r=this.menuButton_;r&&r.buttonPressed_&&t!==r.el().firstChild&&r.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const r=t.filter(n=>n.el()===e.target)[0];if(!r)return;r.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}z.registerComponent("Menu",Wm);class hu extends z{constructor(e,t={}){super(e,t),this.menuButton_=new st(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const r=st.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+r,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=s=>this.handleClick(s);this.handleMenuKeyUp_=s=>this.handleMenuKeyUp(s),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",s=>this.handleKeyDown(s)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Lt(X,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",s=>this.handleMouseLeave(s)),this.on("keydown",s=>this.handleSubmenuKeyDown(s))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new Wm(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=se("li",{className:"vjs-menu-title",textContent:Ve(this.options_.title),tabIndex:-1}),r=new z(this.player_,{el:t});e.addItem(r)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=st.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),nt(X,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),rt&&rm())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}z.registerComponent("MenuButton",hu);class pu extends hu{constructor(e,t){const r=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!r)return;const n=Le(this,this.update);r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),r.addEventListener("labelchange",n),this.player_.on("ready",n),this.player_.on("dispose",function(){r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n),r.removeEventListener("labelchange",n)})}}z.registerComponent("TrackButton",pu);class rs extends Wa{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,r){this.nonIconControl=!0;const n=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),r),s=se("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?n.appendChild(s):n.replaceChild(s,n.querySelector(".vjs-icon-placeholder")),n}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}z.registerComponent("MenuItem",rs);class ns extends rs{constructor(e,t){const r=t.track,n=e.textTracks();t.label=r.label||r.language||"Unknown",t.selected=r.mode==="showing",super(e,t),this.track=r,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const s=(...l)=>{this.handleTracksChange.apply(this,l)},a=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],s),n.addEventListener("change",s),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],s),n.removeEventListener("change",s),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof x.Event!="object")try{l=new x.Event("change")}catch{}l||(l=X.createEvent("Event"),l.initEvent("change",!0,!0)),n.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){const t=this.track,r=this.player_.textTracks();if(super.handleClick(e),!!r)for(let n=0;n<r.length;n++){const s=r[n];this.kinds.indexOf(s.kind)!==-1&&(s===t?s.mode!=="showing"&&(s.mode="showing"):s.mode!=="disabled"&&(s.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}z.registerComponent("TextTrackMenuItem",ns);class Gm extends ns{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r!==this.isSelected_&&this.selected(r)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let r=!0;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}z.registerComponent("OffTextTrackMenuItem",Gm);class tn extends pu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=ns){let r;this.label_&&(r=`${this.label_} off`),e.push(new Gm(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let s=0;s<n.length;s++){const a=n[s];if(this.kinds_.indexOf(a.kind)>-1){const l=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${a.kind}-menu-item`),e.push(l)}}return e}}z.registerComponent("TextTrackButton",tn);class Xm extends rs{constructor(e,t){const r=t.track,n=t.cue,s=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=s&&s<n.endTime,super(e,t),this.track=r,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}z.registerComponent("ChaptersTrackMenuItem",Xm);class mu extends tn{constructor(e,t,r){super(e,t,r),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const r=e[t];if(r.kind===this.kind_)return r}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ve(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let r=0,n=t.length;r<n;r++){const s=t[r],a=new Xm(this.player_,{track:this.track_,cue:s});e.push(a)}return e}}mu.prototype.kind_="chapters";mu.prototype.controlText_="Chapters";z.registerComponent("ChaptersButton",mu);class gu extends tn{constructor(e,t,r){super(e,t,r),this.setIcon("audio-description");const n=e.textTracks(),s=Le(this,this.handleTracksChange);n.addEventListener("change",s),this.on("dispose",function(){n.removeEventListener("change",s)})}handleTracksChange(e){const t=this.player().textTracks();let r=!1;for(let n=0,s=t.length;n<s;n++){const a=t[n];if(a.kind!==this.kind_&&a.mode==="showing"){r=!0;break}}r?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}gu.prototype.kind_="descriptions";gu.prototype.controlText_="Descriptions";z.registerComponent("DescriptionsButton",gu);class fu extends tn{constructor(e,t,r){super(e,t,r),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}fu.prototype.kind_="subtitles";fu.prototype.controlText_="Subtitles";z.registerComponent("SubtitlesButton",fu);class yu extends ns{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}z.registerComponent("CaptionSettingsMenuItem",yu);class _u extends tn{constructor(e,t,r){super(e,t,r),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new yu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}_u.prototype.kind_="captions";_u.prototype.controlText_="Captions";z.registerComponent("CaptionsButton",_u);class Km extends ns{createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",n):s.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(se("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),n}}z.registerComponent("SubsCapsMenuItem",Km);class bu extends tn{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Ve(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new yu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Km),e}}bu.prototype.kinds_=["captions","subtitles"];bu.prototype.controlText_="Subtitles";z.registerComponent("SubsCapsButton",bu);class Ym extends rs{constructor(e,t){const r=t.track,n=e.audioTracks();t.label=r.label||r.language||"Unknown",t.selected=r.enabled,super(e,t),this.track=r,this.addClass(`vjs-${r.kind}-menu-item`);const s=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",s),this.on("dispose",()=>{n.removeEventListener("change",s)})}createEl(e,t,r){const n=super.createEl(e,t,r),s=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(s.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),s.appendChild(se("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];n!==this.track&&(n.enabled=n===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}z.registerComponent("AudioTrackMenuItem",Ym);class Qm extends pu{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const n=t[r];e.push(new Ym(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}Qm.prototype.controlText_="Audio Track";z.registerComponent("AudioTrackButton",Qm);class vu extends rs{constructor(e,t){const r=t.rate,n=parseFloat(r,10);t.label=r,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=r,this.rate=n,this.on(e,"ratechange",s=>this.update(s))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}vu.prototype.contentElType="button";z.registerComponent("PlaybackRateMenuItem",vu);class Jm extends hu{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",r=>this.updateVisibility(r)),this.on(e,"ratechange",r=>this.updateLabel(r)),this.on(e,"playbackrateschange",r=>this.handlePlaybackRateschange(r))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=se("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let r=e.length-1;r>=0;r--)t.push(new vu(this.player(),{rate:e[r]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}Jm.prototype.controlText_="Playback Rate";z.registerComponent("PlaybackRateMenuButton",Jm);class Zm extends z{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},r={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,r)}}z.registerComponent("Spacer",Zm);class KS extends Zm{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}z.registerComponent("CustomControlSpacer",KS);class eg extends z{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}eg.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};z.registerComponent("ControlBar",eg);class tg extends Zr{constructor(e,t){super(e,t),this.on(e,"error",r=>{this.open(r)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}tg.prototype.options_=Object.assign({},Zr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});z.registerComponent("ErrorDisplay",tg);class ig extends z{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),se("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Bt()}`)+"-"+e[1].replace(/\W+/g,""),r=se("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),r}))}}z.registerComponent("TextTrackSelect",ig);class sr extends z{constructor(e,t={}){super(e,t);const r=se("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(r);const n=this.options_.selects;for(const s of n){const a=this.options_.selectConfigs[s],l=a.className,u=a.id.replace("%s",this.options_.id_);let p=null;const m=`vjs_select_${Bt()}`;if(this.options_.type==="colors"){p=se("span",{className:l});const S=se("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});S.setAttribute("for",m),p.appendChild(S)}const _=new ig(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:u});this.addChild(_),this.options_.type==="colors"&&(p.appendChild(_.el()),this.el().appendChild(p))}}createEl(){return se("fieldset",{className:this.options_.className})}}z.registerComponent("TextTrackFieldset",sr);class rg extends z{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new sr(e,{id_:r,legendId:`captions-text-legend-${r}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const s=new sr(e,{id_:r,legendId:`captions-background-${r}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const a=new sr(e,{id_:r,legendId:`captions-window-${r}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-colors"})}}z.registerComponent("TextTrackSettingsColors",rg);class ng extends z{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,n=new sr(e,{id_:r,legendId:`captions-font-size-${r}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const s=new sr(e,{id_:r,legendId:`captions-edge-style-${r}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const a=new sr(e,{id_:r,legendId:`captions-font-family-${r}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-font"})}}z.registerComponent("TextTrackSettingsFont",ng);class sg extends z{constructor(e,t={}){super(e,t);const r=this.localize("restore all settings to the default values"),n=new st(e,{controlText:r,className:"vjs-default-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Reset"),this.addChild(n);const s=new st(e,{controlText:r,className:"vjs-done-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Done"),this.addChild(s)}createEl(){return se("div",{className:"vjs-track-settings-controls"})}}z.registerComponent("TrackSettingsControls",sg);const Oo="vjs-text-track-settings",Ud=["#000","Black"],Md=["#00F","Blue"],Bd=["#0FF","Cyan"],Fd=["#0F0","Green"],jd=["#F0F","Magenta"],$d=["#F00","Red"],qd=["#FFF","White"],Vd=["#FF0","Yellow"],Uo=["1","Opaque"],Mo=["0.5","Semi-Transparent"],Hd=["0","Transparent"],Mi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ud,qd,$d,Fd,Md,Vd,jd,Bd],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Uo,Mo,Hd],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[qd,Ud,$d,Fd,Md,Vd,jd,Bd],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Uo,Mo],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[Hd,Mo,Uo],className:"vjs-window-opacity vjs-opacity"}};Mi.windowColor.options=Mi.backgroundColor.options;function ag(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function YS(i,e){const t=i.options[i.options.selectedIndex].value;return ag(t,e)}function QS(i,e,t){if(e){for(let r=0;r<i.options.length;r++)if(ag(i.options[r].value,t)===e){i.selectedIndex=r;break}}}class JS extends Zr{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=se("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new rg(e,{textTrackComponentid:this.id_,selectConfigs:Mi,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const r=new ng(e,{textTrackComponentid:this.id_,selectConfigs:Mi,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(r);const n=new sg(e);this.addChild(n)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),Ar(Mi,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return Yp(Mi,(e,t,r)=>{const n=YS(this.$(t.selector),t.parser);return n!==void 0&&(e[r]=n),e},{})}setValues(e){Ar(Mi,(t,r)=>{QS(this.$(t.selector),e[r],t.parser)})}setDefaults(){Ar(Mi,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(x.localStorage.getItem(Oo))}catch(t){he.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?x.localStorage.setItem(Oo,JSON.stringify(e)):x.localStorage.removeItem(Oo)}catch(t){he.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}z.registerComponent("TextTrackSettings",JS);class ZS extends z{constructor(e,t){let r=t.ResizeObserver||x.ResizeObserver;t.ResizeObserver===null&&(r=!1);const n=we({createEl:!r,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||x.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=bm(()=>{this.resizeHandler()},100,!1,this),r?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const s=this.debouncedHandler_;let a=this.unloadListener_=function(){nt(this,"resize",s),nt(this,"unload",a),a=null};Lt(this.el_.contentWindow,"unload",a),Lt(this.el_.contentWindow,"resize",s)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}z.registerComponent("ResizeManager",ZS);const eE={trackingThreshold:20,liveTolerance:15};class tE extends z{constructor(e,t){const r=we(eE,t,{createEl:!1});super(e,r),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(x.performance.now().toFixed(4)),r=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+r;const n=this.liveCurrentTime(),s=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-s)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Ft),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.end(r));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.start(r));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}z.registerComponent("LiveTracker",tE);class iE extends z{constructor(e,t){super(e,t),this.on("statechanged",r=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:se("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Bt()}`}),description:se("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Bt()}`})},se("div",{className:"vjs-title-bar"},{},Qp(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const s=this.state[n],a=this.els[n],l=r[n];$a(a),s&&$i(a,s),t&&(t.removeAttribute(l),s&&t.setAttribute(l,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}z.registerComponent("TitleBar",iE);const rE={initialDisplay:4e3,position:[],takeFocus:!1};class nE extends st{constructor(e,t){t=we(rE,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],r=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=se("button",{},{type:"button",class:this.buildCSSClass()},se("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}z.registerComponent("TransientButton",nE);const al=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),r=[];let n="";if(!t.length)return!1;for(let s=0;s<t.length;s++){const a=t[s].src;a&&r.indexOf(a)===-1&&r.push(a)}return r.length?(r.length===1&&(n=r[0]),i.triggerSourceset(n),!0):!1},sE=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(i){const e=X.createElement(this.nodeName.toLowerCase());e.innerHTML=i;const t=X.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",x.Element.prototype.appendChild.call(this,t),this.innerHTML}}),og=(i,e)=>{let t={};for(let r=0;r<i.length&&(t=Object.getOwnPropertyDescriptor(i[r],e),!(t&&t.set&&t.get));r++);return t.enumerable=!0,t.configurable=!0,t},aE=i=>og([i.el(),x.HTMLMediaElement.prototype,x.Element.prototype,sE],"innerHTML"),zd=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=aE(i),n=s=>(...a)=>{const l=s.apply(e,a);return al(i),l};["append","appendChild","insertAdjacentHTML"].forEach(s=>{e[s]&&(t[s]=e[s],e[s]=n(t[s]))}),Object.defineProperty(e,"innerHTML",we(r,{set:n(r.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(s=>{e[s]=t[s]}),Object.defineProperty(e,"innerHTML",r)},i.one("sourceset",e.resetSourceWatch_)},oE=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?xm(x.Element.prototype.getAttribute.call(this,"src")):""},set(i){return x.Element.prototype.setAttribute.call(this,"src",i),i}}),lE=i=>og([i.el(),x.HTMLMediaElement.prototype,oE],"src"),uE=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=lE(i),r=e.setAttribute,n=e.load;Object.defineProperty(e,"src",we(t,{set:s=>{const a=t.set.call(e,s);return i.triggerSourceset(e.src),a}})),e.setAttribute=(s,a)=>{const l=r.call(e,s,a);return/src/i.test(s)&&i.triggerSourceset(e.src),l},e.load=()=>{const s=n.call(e);return al(i)||(i.triggerSourceset(""),zd(i)),s},e.currentSrc?i.triggerSourceset(e.currentSrc):al(i)||zd(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=r,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Z extends le{constructor(e,t){super(e,t);const r=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",r&&(this.el_.currentSrc!==r.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(r):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const s=this.el_.childNodes;let a=s.length;const l=[];for(;a--;){const u=s[a];u.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(u),this.remoteTextTracks().addTrack(u.track),this.textTracks().addTrack(u.track),!n&&!this.el_.hasAttribute("crossorigin")&&za(u.src)&&(n=!0)):l.push(u))}for(let u=0;u<l.length;u++)this.el_.removeChild(l[u])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&he.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
+
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(Wn||Ua)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Z.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){uE(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const r=()=>{t=[];for(let s=0;s<e.length;s++){const a=e[s];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};r(),e.addEventListener("change",r),this.on("dispose",()=>e.removeEventListener("change",r));const n=()=>{for(let s=0;s<t.length;s++){const a=t[s];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",n)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",r),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",r),e.addEventListener("change",r),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const r=e.toLowerCase();this[`${r}TracksListeners_`]&&Object.keys(this[`${r}TracksListeners_`]).forEach(n=>{this.el()[`${r}Tracks`].removeEventListener(n,this[`${r}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${r}TracksListeners_`]=null,this.proxyNativeTracksForType_(r)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Mt[e],r=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!r||!r.addEventListener)return;const s={change:l=>{const u={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(u),e==="text"&&this[Xr.remoteText.getterName]().trigger(u)},addtrack(l){n.addTrack(l.track)},removetrack(l){n.removeTrack(l.track)}},a=function(){const l=[];for(let u=0;u<n.length;u++){let p=!1;for(let m=0;m<r.length;m++)if(r[m]===n[u]){p=!0;break}p||l.push(n[u])}for(;l.length;)n.removeTrack(l.shift())};this[t.getterName+"Listeners_"]=s,Object.keys(s).forEach(l=>{const u=s[l];r.addEventListener(l,u),this.on("dispose",p=>r.removeEventListener(l,u))}),this.on("loadstart",a),this.on("dispose",l=>this.off("loadstart",a))}proxyNativeTracks_(){Mt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const r=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(r,e),Z.disposeMediaElement(e),e=r}else{e=X.createElement("video");const r=this.options_.tag&&Ui(this.options_.tag),n=we({},r);(!Wn||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,am(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Hr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let r=0;r<t.length;r++){const n=t[r],s=this.options_[n];typeof s<"u"&&(s?Hr(e,n,n):Fa(e,n),e[n]=s)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let r=!1;const n=function(){r=!0};this.on("loadstart",n);const s=function(){r||this.trigger("loadstart")};this.on("loadedmetadata",s),this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",s),r||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(r){this.trigger(r)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Ma?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){he(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Gt&&ci&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)ri(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return he.error("Invalid source URL."),!1;const r={src:e};t&&(r.type=t);const n=se("source",{},r);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return he.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const r of t)if(r.src===e)return this.el_.removeChild(r),!0;return he.warn(`No matching source element found with src: ${e}`),!1}reset(){Z.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):super.addTextTrack(e,t,r)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=X.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const r=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let r=t.length;for(;r--;)(e===t[r]||e===t[r].track)&&this.el().removeChild(t[r])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),x.performance&&(e.creationTime=x.performance.now()),e}}Ra(Z,"TEST_VID",function(){if(!Yr())return;const i=X.createElement("video"),e=X.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});Z.isSupported=function(){try{Z.TEST_VID.volume=.5}catch{return!1}return!!(Z.TEST_VID&&Z.TEST_VID.canPlayType)};Z.canPlayType=function(i){return Z.TEST_VID.canPlayType(i)};Z.canPlaySource=function(i,e){return Z.canPlayType(i.type)};Z.canControlVolume=function(){try{const i=Z.TEST_VID.volume;Z.TEST_VID.volume=i/2+.1;const e=i!==Z.TEST_VID.volume;return e&&rt?(x.setTimeout(()=>{Z&&Z.prototype&&(Z.prototype.featuresVolumeControl=i!==Z.TEST_VID.volume)}),!1):e}catch{return!1}};Z.canMuteVolume=function(){try{const i=Z.TEST_VID.muted;return Z.TEST_VID.muted=!i,Z.TEST_VID.muted?Hr(Z.TEST_VID,"muted","muted"):Fa(Z.TEST_VID,"muted","muted"),i!==Z.TEST_VID.muted}catch{return!1}};Z.canControlPlaybackRate=function(){if(Gt&&ci&&Na<58)return!1;try{const i=Z.TEST_VID.playbackRate;return Z.TEST_VID.playbackRate=i/2+.1,i!==Z.TEST_VID.playbackRate}catch{return!1}};Z.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(X.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(X.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(X.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(X.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0};Z.supportsNativeTextTracks=function(){return Ma||rt&&ci};Z.supportsNativeVideoTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.videoTracks)};Z.supportsNativeAudioTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.audioTracks)};Z.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){Ra(Z.prototype,i,()=>Z[e](),!0)});Z.prototype.featuresVolumeControl=Z.canControlVolume();Z.prototype.movingMediaElementInDOM=!rt;Z.prototype.featuresFullscreenResize=!0;Z.prototype.featuresProgressEvents=!0;Z.prototype.featuresTimeupdateEvents=!0;Z.prototype.featuresVideoFrameCallback=!!(Z.TEST_VID&&Z.TEST_VID.requestVideoFrameCallback);Z.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()}};Z.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){Z.prototype["set"+Ve(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){Z.prototype["set"+Ve(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]()}});le.withSourceHandlers(Z);Z.nativeSourceHandler={};Z.nativeSourceHandler.canPlayType=function(i){try{return Z.TEST_VID.canPlayType(i)}catch{return""}};Z.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return Z.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=su(i.src);return Z.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Z.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};Z.nativeSourceHandler.dispose=function(){};Z.registerSourceHandler(Z.nativeSourceHandler);le.registerTech("Html5",Z);const lg=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Bo={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ol=["tiny","xsmall","small","medium","large","xlarge","huge"],Hs={};ol.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;Hs[i]=`vjs-layout-${e}`});const cE={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Pe extends z{constructor(e,t,r){if(e.id=e.id||t.id||`vjs_video_${Bt()}`,t=Object.assign(Pe.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,r),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Xp(this.id_),this.fsApi_=ta,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={controlBarHeight:null,playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&Ui(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(l){a[l.toLowerCase()]=t.languages[l]}),this.languages_=a}else this.languages_=Pe.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),tu(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Lt(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=we(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new x.DOMParser().parseFromString(RS,"image/svg+xml");if(a.querySelector("parsererror"))he.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const l=a.documentElement;l.style.display="none",this.el_.appendChild(l),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new NS(this),this.addClass("vjs-spatial-navigation-enabled")),Wn&&this.addClass("vjs-touch-enabled"),rt||this.addClass("vjs-workinghover"),Pe.players[this.id_]=this;const s=Qo.split(".")[0];this.addClass(`vjs-v${s}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),nt(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),nt(X,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Pe.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),xS(this),ht.names.forEach(e=>{const t=ht[e],r=this[t.getterName]();r&&r.off&&r.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";r?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const s=Ui(e);if(n){for(t=this.el_=e,e=this.tag=X.createElement("video");t.children.length;)e.appendChild(t.firstChild);Un(t,"video-js")||rr(t,"video-js"),t.appendChild(e),r=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),s.tabindex="-1",ci&&Oa&&(e.setAttribute("role","application"),s.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(u){n&&u==="class"||t.setAttribute(u,s[u]),n&&e.setAttribute(u,s[u])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(u=>im[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),x.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=ym("vjs-styles-dimensions");const u=Fi(".vjs-styles-defaults"),p=Fi("head");p.insertBefore(this.styleEl_,u?u.nextSibling:p.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const l=e.getElementsByTagName("a");for(let u=0;u<l.length;u++){const p=l.item(u);rr(p,"vjs-hidden"),p.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(t,e),Zo(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){he.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const r=e+"_";if(t===void 0)return this[r]||0;if(t===""||t==="auto"){this[r]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){he.error(`Improper value "${t}" supplied for for ${e}`);return}this[r]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,_i(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),sS(this,()=>{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(x.VIDEOJS_NO_DYNAMIC_STYLE===!0){const l=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,p=this.tech_&&this.tech_.el();p&&(l>=0&&(p.width=l),u>=0&&(p.height=u));return}let e,t,r,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?r=this.aspectRatio_:this.videoWidth()>0?r=this.videoWidth()+":"+this.videoHeight():r="16:9";const s=r.split(":"),a=s[1]/s[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),_m(this.styleEl_,`
|
|
172
172
|
.${n} {
|
|
173
173
|
width: ${e}px;
|
|
174
174
|
height: ${t}px;
|
|
@@ -177,9 +177,9 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati
|
|
|
177
177
|
.${n}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
178
|
padding-top: ${a*100}%;
|
|
179
179
|
}
|
|
180
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=
|
|
180
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=Ve(e),n=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(le.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let s=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(s=!1);const a={source:t,autoplay:s,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${n}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};ht.names.forEach(u=>{const p=ht[u];a[p.getterName]=this[p.privateName]}),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[n]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const l=le.getTech(e);if(!l)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new l(a),this.tech_.ready(Le(this,this.handleTechReady_),!0),wd.jsonToTextTracks(this.textTracksJson_||[],this.tech_),lg.forEach(u=>{this.on(this.tech_,u,p=>this[`handleTech${Ve(u)}_`](p))}),Object.keys(Bo).forEach(u=>{this.on(this.tech_,u,p=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Bo[u]}_`].bind(this),event:p});return}this[`handleTech${Bo[u]}_`](p)})}),this.on(this.tech_,"loadstart",u=>this.handleTechLoadStart_(u)),this.on(this.tech_,"sourceset",u=>this.handleTechSourceset_(u)),this.on(this.tech_,"waiting",u=>this.handleTechWaiting_(u)),this.on(this.tech_,"ended",u=>this.handleTechEnded_(u)),this.on(this.tech_,"seeking",u=>this.handleTechSeeking_(u)),this.on(this.tech_,"play",u=>this.handleTechPlay_(u)),this.on(this.tech_,"pause",u=>this.handleTechPause_(u)),this.on(this.tech_,"durationchange",u=>this.handleTechDurationChange_(u)),this.on(this.tech_,"fullscreenchange",(u,p)=>this.handleTechFullscreenChange_(u,p)),this.on(this.tech_,"fullscreenerror",(u,p)=>this.handleTechFullscreenError_(u,p)),this.on(this.tech_,"enterpictureinpicture",u=>this.handleTechEnterPictureInPicture_(u)),this.on(this.tech_,"leavepictureinpicture",u=>this.handleTechLeavePictureInPicture_(u)),this.on(this.tech_,"error",u=>this.handleTechError_(u)),this.on(this.tech_,"posterchange",u=>this.handleTechPosterChange_(u)),this.on(this.tech_,"textdata",u=>this.handleTechTextData_(u)),this.on(this.tech_,"ratechange",u=>this.handleTechRateChange_(u)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&Zo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){ht.names.forEach(e=>{const t=ht[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=wd.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&he.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
181
181
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
182
|
-
`),this.tech_}version(){return{"video.js":Yo}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const s=()=>{this.muted(n)};this.playTerminatedQueue_.push(s);const a=this.play();if(Nn(a))return a.catch(l=>{throw s(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${l||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),Nn(r)&&(r=r.catch(t))):e==="muted"&&!this.muted()?r=t():r=this.play(),!!Nn(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,r="";typeof t!="string"&&(t=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!r&&(r=yS(this,t)),this.cache_.source=ve({},e,{src:t,type:r});const n=this.cache_.sources.filter(u=>u.src&&u.src===t),s=[],a=this.$$("source"),l=[];for(let u=0;u<a.length;u++){const p=Ri(a[u]);s.push(p),p.src&&p.src===t&&l.push(p.src)}l.length&&!n.length?this.cache_.sources=s:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=s=>this.updateSourceCaches_(s);const r=this.currentSource().src,n=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==r)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],s=>{if(s.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Jt(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!G.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const r=this.el();let n=G[this.fsApi_.fullscreenElement]===r;!n&&r.matches&&(n=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in hS)return cS(this.middleware_,this.tech_,e,t);if(e in Id)return Cd(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(r){throw ue(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in dS)return uS(this.middleware_,this.tech_,e);if(e in Id)return Cd(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ue(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ue(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ue(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Jt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(Oa||Ze);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=s=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&r&&this.load();return}const n=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||jt(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=jt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=jt(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return vg(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let r=e.end(e.length-1);return r>t&&(r=t),r}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((r,n)=>{function s(){t.off("fullscreenerror",l),t.off("fullscreenchange",a)}function a(){s(),r()}function l(p,g){s(),n(g)}t.one("fullscreenchange",a),t.one("fullscreenerror",l);const u=t.requestFullscreenHelper_(e);u&&(u.then(s,s),u.then(r,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,r)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",s)}function s(){n(),t()}function a(u,p){n(),r(p)}e.one("fullscreenchange",s),e.one("fullscreenerror",a);const l=e.exitFullscreenHelper_();l&&(l.then(n,n),l.then(t,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=G[this.fsApi_.exitFullscreen]();return e&&Jt(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=G.documentElement.style.overflow,kt(G,"keydown",this.boundFullWindowOnEscKey_),G.documentElement.style.overflow="hidden",Zi(G.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,et(G,"keydown",this.boundFullWindowOnEscKey_),G.documentElement.style.overflow=this.docOrigOverflow,Ua(G.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&x.documentPictureInPicture){const e=G.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(se("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),x.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(og(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",r=>{const n=r.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in G&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(x.documentPictureInPicture&&x.documentPictureInPicture.window)return x.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in G)return G.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();return r.isContentEditable?!0:n==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(r.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:s=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const a=$.getComponent("FullscreenToggle");G[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),$.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),$.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let r=0,n=this.options_.techOrder;r<n.length;r++){const s=n[r];let a=oe.getTech(s);if(a||(a=$.getComponent(s)),!a){ue.error(`The "${s}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(l=>[l,oe.getTech(l)]).filter(([l,u])=>u?u.isSupported():(ue.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(l,u,p){let g;return l.some(b=>u.some(S=>{if(g=p(b,S),g)return!0})),g};let n;const s=l=>(u,p)=>l(p,u),a=([l,u],p)=>{if(u.canPlaySource(p,this.options_[l.toLowerCase()]))return{source:p,tech:l}};return this.options_.sourceOrder?n=r(e,t,s(a)):n=r(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=kg(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),oS(this,r[0],(n,s)=>{if(this.middleware_=s,t||(this.cache_.sources=r),this.updateSourceCaches_(n),this.src_(n)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}lS(s,this.tech_)}),r.length>1){const n=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",n)};this.one("error",n),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",s)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?fg(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Jt(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),mi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:r,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:s}=r||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Oi("beforeerror").forEach(t=>{const r=t(this,e);if(!(ni(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Oe(e),this.addClass("vjs-error"),ue.error(`(CODE:${this.error_.code} ${Oe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Oi("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,r;const n=Ce(this,this.reportUserActivity),s=function(b){(b.screenX!==t||b.screenY!==r)&&(t=b.screenX,r=b.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},l=function(b){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",s),this.on("mouseup",l),this.on("mouseleave",l);const u=this.getChild("controlBar");u&&!Ze&&!qt&&(u.on("mouseenter",function(b){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),u.on("mouseleave",function(b){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let p;const g=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);const b=this.options_.inactivityTimeout;b<=0||(p=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},b))};this.setInterval(g,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),r=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,r){if(this.tech_)return this.tech_.addTextTrack(e,t,r)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),mi(this)&&this.trigger("languagechange"))}languages(){return ve(Ae.prototype.options_.languages,this.languages_)}toJSON(){const e=ve(this.options_),t=e.tracks;e.tracks=[];for(let r=0;r<t.length;r++){let n=t[r];n=ve(n),n.player=void 0,e.tracks[r]=n}return e}createModal(e,t){t=t||{},t.content=e||"";const r=new Kr(this,t);return this.addChild(r),r.on("dispose",()=>{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let r=0;r<al.length;r++){const n=al[r],s=this.breakpoints_[n];if(t<=s){if(e===n)return;e&&this.removeClass($s[e]),this.addClass($s[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},KS,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return $s[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const r=this.crossOrigin();this.reset(),this.cache_.media=ve(e);const{artist:n,artwork:s,description:a,poster:l,src:u,textTracks:p,title:g}=this.cache_.media;!s&&l&&(this.cache_.media.artwork=[{src:l,type:ua(l)}]),r&&this.crossOrigin(r),u&&this.src(u),l&&this.poster(l),Array.isArray(p)&&p.forEach(b=>this.addRemoteTextTrack(b,!1)),this.titleBar&&this.titleBar.update({title:g,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),s=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),n={src:t,textTracks:r};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:ua(n.poster)}]),n}return ve(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},r=Ri(e),n=r["data-setup"];if(Pn(e,"vjs-fill")&&(r.fill=!0),Pn(e,"vjs-fluid")&&(r.fluid=!0),n!==null)try{Object.assign(r,JSON.parse(n||"{}"))}catch(s){ue.error("data-setup",s)}if(Object.assign(t,r),e.hasChildNodes()){const s=e.childNodes;for(let a=0,l=s.length;a<l;a++){const u=s[a],p=u.nodeName.toLowerCase();p==="source"?t.sources.push(Ri(u)):p==="track"&&t.tracks.push(Ri(u))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}lt.names.forEach(function(i){const e=lt[i];Ae.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ae.prototype.crossorigin=Ae.prototype.crossOrigin;Ae.players={};const Sn=x.navigator;Ae.prototype.options_={techOrder:oe.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Sn&&(Sn.languages&&Sn.languages[0]||Sn.userLanguage||Sn.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1};tm.forEach(function(i){Ae.prototype[`handleTech${Be(i)}_`]=function(){return this.trigger(i)}});$.registerComponent("Player",Ae);const ca="plugin",Ir="activePlugins_",Tr={},da=i=>Tr.hasOwnProperty(i),Vs=i=>da(i)?Tr[i]:void 0,im=(i,e)=>{i[Ir]=i[Ir]||{},i[Ir][e]=!0},ha=(i,e,t)=>{const r=(t?"before":"")+"pluginsetup";i.trigger(r,e),i.trigger(r+":"+e.name,e)},YS=function(i,e){const t=function(){ha(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return im(this,i),ha(this,{name:i,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},Hd=(i,e)=>(e.prototype.name=i,function(...t){ha(this,{name:i,plugin:e,instance:null},!0);const r=new e(this,...t);return this[i]=()=>r,ha(this,r.getEventHash()),r});class bt{constructor(e){if(this.constructor===bt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),eu(this),delete this.trigger,mg(this,this.constructor.defaultState),im(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Xr(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Ir][e]=!1,this.player=this.state=null,t[e]=Hd(e,Tr[e])}static isBasic(e){const t=typeof e=="string"?Vs(e):e;return typeof t=="function"&&!bt.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(da(e))ue.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ae.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return Tr[e]=t,e!==ca&&(bt.isBasic(t)?Ae.prototype[e]=YS(e,t):Ae.prototype[e]=Hd(e,t)),t}static deregisterPlugin(e){if(e===ca)throw new Error("Cannot de-register base plugin.");da(e)&&(delete Tr[e],delete Ae.prototype[e])}static getPlugins(e=Object.keys(Tr)){let t;return e.forEach(r=>{const n=Vs(r);n&&(t=t||{},t[r]=n)}),t}static getPluginVersion(e){const t=Vs(e);return t&&t.VERSION||""}}bt.getPlugin=Vs;bt.BASE_PLUGIN_NAME=ca;bt.registerPlugin(ca,bt);Ae.prototype.usingPlugin=function(i){return!!this[Ir]&&this[Ir][i]===!0};Ae.prototype.hasPlugin=function(i){return!!da(i)};function QS(i,e){let t=!1;return function(...r){return t||ue.warn(i),t=!0,e.apply(this,r)}}function $t(i,e,t,r){return QS(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}var JS={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const rm=i=>i.indexOf("#")===0?i.slice(1):i;function B(i,e,t){let r=B.getPlayer(i);if(r)return e&&ue.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&r.ready(t),r;const n=typeof i=="string"?Ui("#"+rm(i)):i;if(!Gr(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const s="getRootNode"in n&&n.getRootNode()instanceof x.ShadowRoot?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!s.contains(n))&&ue.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),Oi("beforesetup").forEach(l=>{const u=l(n,ve(e));if(!ni(u)||Array.isArray(u)){ue.error("please return an object in beforesetup hooks");return}e=ve(e,u)});const a=$.getComponent("Player");return r=new a(n,e,t),Oi("setup").forEach(l=>l(r)),r}B.hooks_=hi;B.hooks=Oi;B.hook=L1;B.hookOnce=D1;B.removeHook=jp;if(x.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Wr()){let i=Ui(".vjs-styles-defaults");if(!i){i=cg("vjs-styles-defaults");const e=Ui("head");e&&e.insertBefore(i,e.firstChild),dg(i,`
|
|
182
|
+
`),this.tech_}version(){return{"video.js":Qo}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const n=this.muted();this.muted(!0);const s=()=>{this.muted(n)};this.playTerminatedQueue_.push(s);const a=this.play();if(Bn(a))return a.catch(l=>{throw s(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${l||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),Bn(r)&&(r=r.catch(t))):e==="muted"&&!this.muted()?r=t():r=this.play(),!!Bn(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,r="";typeof t!="string"&&(t=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!r&&(r=PS(this,t)),this.cache_.source=we({},e,{src:t,type:r});const n=this.cache_.sources.filter(u=>u.src&&u.src===t),s=[],a=this.$$("source"),l=[];for(let u=0;u<a.length;u++){const p=Ui(a[u]);s.push(p),p.src&&p.src===t&&l.push(p.src)}l.length&&!n.length?this.cache_.sources=s:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=s=>this.updateSourceCaches_(s);const r=this.currentSource().src,n=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==r)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],s=>{if(s.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?ri(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!X.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const r=this.el();let n=X[this.fsApi_.fullscreenElement]===r;!n&&r.matches&&(n=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();e&&this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in IS)return kS(this.middleware_,this.tech_,e,t);if(e in xd)return Ad(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(r){throw he(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in CS)return wS(this.middleware_,this.tech_,e);if(e in xd)return Ad(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(he(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(he(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(he(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=ri){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(Ma||rt);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=s=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&r&&this.load();return}const n=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Wt(0,0)}scrubbing(e){if(typeof e>"u")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Wt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Wt(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Im(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let r=e.end(e.length-1);return r>t&&(r=t),r}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((r,n)=>{function s(){t.off("fullscreenerror",l),t.off("fullscreenchange",a)}function a(){s(),r()}function l(p,m){s(),n(m)}t.one("fullscreenchange",a),t.one("fullscreenerror",l);const u=t.requestFullscreenHelper_(e);u&&(u.then(s,s),u.then(r,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,r)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",s)}function s(){n(),t()}function a(u,p){n(),r(p)}e.one("fullscreenchange",s),e.one("fullscreenerror",a);const l=e.exitFullscreenHelper_();l&&(l.then(n,n),l.then(t,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=X[this.fsApi_.exitFullscreen]();return e&&ri(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=X.documentElement.style.overflow,Lt(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow="hidden",rr(X.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,nt(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow=this.docOrigOverflow,Ba(X.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&x.documentPictureInPicture){const e=X.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(se("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),x.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(mm(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",r=>{const n=r.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in X&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(x.documentPictureInPicture&&x.documentPictureInPicture.window)return x.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in X)return X.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();return r.isContentEditable?!0:n==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(r.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:s=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const a=z.getComponent("FullscreenToggle");X[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),z.getComponent("MuteToggle").prototype.handleClick.call(this,e)):s.call(this,e)&&(e.preventDefault(),e.stopPropagation(),z.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let r=0,n=this.options_.techOrder;r<n.length;r++){const s=n[r];let a=le.getTech(s);if(a||(a=z.getComponent(s)),!a){he.error(`The "${s}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(l=>[l,le.getTech(l)]).filter(([l,u])=>u?u.isSupported():(he.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(l,u,p){let m;return l.some(_=>u.some(S=>{if(m=p(_,S),m)return!0})),m};let n;const s=l=>(u,p)=>l(p,u),a=([l,u],p)=>{if(u.canPlaySource(p,this.options_[l.toLowerCase()]))return{source:p,tech:l}};return this.options_.sourceOrder?n=r(e,t,s(a)):n=r(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Pm(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),SS(this,r[0],(n,s)=>{if(this.middleware_=s,t||(this.cache_.sources=r),this.updateSourceCaches_(n),this.src_(n)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}ES(s,this.tech_)}),r.length>1){const n=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},s=()=>{this.off("error",n)};this.one("error",n),this.one("playing",s),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",s)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Em(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();ri(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),_i(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:r,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:s}=r||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),s&&(s.update(),s.loadProgressBar&&s.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"u"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(Bi("beforeerror").forEach(t=>{const r=t(this,e);if(!(ui(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Fe(e),this.addClass("vjs-error"),he.error(`(CODE:${this.error_.code} ${Fe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Bi("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,r;const n=Le(this,this.reportUserActivity),s=function(_){(_.screenX!==t||_.screenY!==r)&&(t=_.screenX,r=_.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},l=function(_){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",s),this.on("mouseup",l),this.on("mouseleave",l);const u=this.getChild("controlBar");u&&!rt&&!Gt&&(u.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),u.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let p;const m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(p);const _=this.options_.inactivityTimeout;_<=0||(p=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},_))};this.setInterval(m,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),r=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,r){if(this.tech_)return this.tech_.addTextTrack(e,t,r)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),_i(this)&&this.trigger("languagechange"))}languages(){return we(Pe.prototype.options_.languages,this.languages_)}toJSON(){const e=we(this.options_),t=e.tracks;e.tracks=[];for(let r=0;r<t.length;r++){let n=t[r];n=we(n),n.player=void 0,e.tracks[r]=n}return e}createModal(e,t){t=t||{},t.content=e||"";const r=new Zr(this,t);return this.addChild(r),r.on("dispose",()=>{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let r=0;r<ol.length;r++){const n=ol[r],s=this.breakpoints_[n];if(t<=s){if(e===n)return;e&&this.removeClass(Hs[e]),this.addClass(Hs[n]),this.breakpoint_=n;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},cE,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return Hs[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const r=this.crossOrigin();this.reset(),this.cache_.media=we(e);const{artist:n,artwork:s,description:a,poster:l,src:u,textTracks:p,title:m}=this.cache_.media;!s&&l&&(this.cache_.media.artwork=[{src:l,type:da(l)}]),r&&this.crossOrigin(r),u&&this.src(u),l&&this.poster(l),Array.isArray(p)&&p.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:m,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),s=>({kind:s.kind,label:s.label,language:s.language,src:s.src})),n={src:t,textTracks:r};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:da(n.poster)}]),n}return we(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},r=Ui(e),n=r["data-setup"];if(Un(e,"vjs-fill")&&(r.fill=!0),Un(e,"vjs-fluid")&&(r.fluid=!0),n!==null)try{Object.assign(r,JSON.parse(n||"{}"))}catch(s){he.error("data-setup",s)}if(Object.assign(t,r),e.hasChildNodes()){const s=e.childNodes;for(let a=0,l=s.length;a<l;a++){const u=s[a],p=u.nodeName.toLowerCase();p==="source"?t.sources.push(Ui(u)):p==="track"&&t.tracks.push(Ui(u))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}ht.names.forEach(function(i){const e=ht[i];Pe.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Pe.prototype.crossorigin=Pe.prototype.crossOrigin;Pe.players={};const Cn=x.navigator;Pe.prototype.options_={techOrder:le.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Cn&&(Cn.languages&&Cn.languages[0]||Cn.userLanguage||Cn.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",normalizeAutoplay:!1,fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1,audioOnlyMode:!1,audioPosterMode:!1,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1};lg.forEach(function(i){Pe.prototype[`handleTech${Ve(i)}_`]=function(){return this.trigger(i)}});z.registerComponent("Player",Pe);const ha="plugin",Dr="activePlugins_",kr={},pa=i=>kr.hasOwnProperty(i),zs=i=>pa(i)?kr[i]:void 0,ug=(i,e)=>{i[Dr]=i[Dr]||{},i[Dr][e]=!0},ma=(i,e,t)=>{const r=(t?"before":"")+"pluginsetup";i.trigger(r,e),i.trigger(r+":"+e.name,e)},dE=function(i,e){const t=function(){ma(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return ug(this,i),ma(this,{name:i,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},Wd=(i,e)=>(e.prototype.name=i,function(...t){ma(this,{name:i,plugin:e,instance:null},!0);const r=new e(this,...t);return this[i]=()=>r,ma(this,r.getEventHash()),r});class St{constructor(e){if(this.constructor===St)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),tu(this),delete this.trigger,Sm(this,this.constructor.defaultState),ug(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Jr(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Dr][e]=!1,this.player=this.state=null,t[e]=Wd(e,kr[e])}static isBasic(e){const t=typeof e=="string"?zs(e):e;return typeof t=="function"&&!St.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(pa(e))he.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Pe.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return kr[e]=t,e!==ha&&(St.isBasic(t)?Pe.prototype[e]=dE(e,t):Pe.prototype[e]=Wd(e,t)),t}static deregisterPlugin(e){if(e===ha)throw new Error("Cannot de-register base plugin.");pa(e)&&(delete kr[e],delete Pe.prototype[e])}static getPlugins(e=Object.keys(kr)){let t;return e.forEach(r=>{const n=zs(r);n&&(t=t||{},t[r]=n)}),t}static getPluginVersion(e){const t=zs(e);return t&&t.VERSION||""}}St.getPlugin=zs;St.BASE_PLUGIN_NAME=ha;St.registerPlugin(ha,St);Pe.prototype.usingPlugin=function(i){return!!this[Dr]&&this[Dr][i]===!0};Pe.prototype.hasPlugin=function(i){return!!pa(i)};function hE(i,e){let t=!1;return function(...r){return t||he.warn(i),t=!0,e.apply(this,r)}}function Xt(i,e,t,r){return hE(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}var pE={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const cg=i=>i.indexOf("#")===0?i.slice(1):i;function B(i,e,t){let r=B.getPlayer(i);if(r)return e&&he.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&r.ready(t),r;const n=typeof i=="string"?Fi("#"+cg(i)):i;if(!Qr(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const s="getRootNode"in n&&n.getRootNode()instanceof x.ShadowRoot?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!s.contains(n))&&he.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),Bi("beforesetup").forEach(l=>{const u=l(n,we(e));if(!ui(u)||Array.isArray(u)){he.error("please return an object in beforesetup hooks");return}e=we(e,u)});const a=z.getComponent("Player");return r=new a(n,e,t),Bi("setup").forEach(l=>l(r)),r}B.hooks_=gi;B.hooks=Bi;B.hook=z1;B.hookOnce=W1;B.removeHook=Gp;if(x.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Yr()){let i=Fi(".vjs-styles-defaults");if(!i){i=ym("vjs-styles-defaults");const e=Fi("head");e&&e.insertBefore(i,e.firstChild),_m(i,`
|
|
183
183
|
.video-js {
|
|
184
184
|
width: 300px;
|
|
185
185
|
height: 150px;
|
|
@@ -188,36 +188,36 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
|
188
188
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
189
189
|
padding-top: 56.25%
|
|
190
190
|
}
|
|
191
|
-
`)}}
|
|
191
|
+
`)}}tl(1,B);B.VERSION=Qo;B.options=Pe.prototype.options_;B.getPlayers=()=>Pe.players;B.getPlayer=i=>{const e=Pe.players;let t;if(typeof i=="string"){const r=cg(i),n=e[r];if(n)return n;t=Fi("#"+r)}else t=i;if(Qr(t)){const{player:r,playerId:n}=t;if(r||e[n])return r||e[n]}};B.getAllPlayers=()=>Object.keys(Pe.players).map(i=>Pe.players[i]).filter(Boolean);B.players=Pe.players;B.getComponent=z.getComponent;B.registerComponent=(i,e)=>(le.isTech(e)&&he.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),z.registerComponent.call(z,i,e));B.getTech=le.getTech;B.registerTech=le.registerTech;B.use=TS;Object.defineProperty(B,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(B.middleware,"TERMINATOR",{value:ca,writeable:!1,enumerable:!0});B.browser=im;B.obj=K1;B.mergeOptions=Xt(9,"videojs.mergeOptions","videojs.obj.merge",we);B.defineLazyProperty=Xt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Ra);B.bind=Xt(9,"videojs.bind","native Function.prototype.bind",Le);B.registerPlugin=St.registerPlugin;B.deregisterPlugin=St.deregisterPlugin;B.plugin=(i,e)=>(he.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),St.registerPlugin(i,e));B.getPlugins=St.getPlugins;B.getPlugin=St.getPlugin;B.getPluginVersion=St.getPluginVersion;B.addLanguage=function(i,e){return i=(""+i).toLowerCase(),B.options.languages=we(B.options.languages,{[i]:e}),B.options.languages[i]};B.log=he;B.createLogger=Xp;B.time=cS;B.createTimeRange=Xt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Wt);B.createTimeRanges=Xt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Wt);B.formatTime=Xt(9,"videojs.formatTime","videojs.time.formatTime",lr);B.setFormatTime=Xt(9,"videojs.setFormatTime","videojs.time.setFormatTime",km);B.resetFormatTime=Xt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Cm);B.parseUrl=Xt(9,"videojs.parseUrl","videojs.url.parseUrl",nu);B.isCrossOrigin=Xt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",za);B.EventTarget=Dt;B.any=eu;B.on=Lt;B.one=Va;B.off=nt;B.trigger=Jr;B.xhr=wp;B.TextTrack=ts;B.AudioTrack=Lm;B.VideoTrack=Dm;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{B[i]=function(){return he.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),gm[i].apply(null,arguments)}});B.computedStyle=Xt(9,"videojs.computedStyle","videojs.dom.computedStyle",Wr);B.dom=gm;B.fn=nS;B.num=qS;B.str=lS;B.url=bS;B.Error=pE;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class mE{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(r){t.enabled_(r)}}),t}}class ga extends B.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const r=this.levels_.length;return t=new mE(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let r=0,n=this.length;r<n;r++)if(this[r]===e){t=this.levels_.splice(r,1)[0],this.selectedIndex_===r?this.selectedIndex_=-1:this.selectedIndex_>r&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,r=this.length;t<r;t++){const n=this[t];if(n.id===e)return n}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}ga.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const i in ga.prototype.allowedEvents_)ga.prototype["on"+i]=null;var dg="4.1.0";const gE=function(i,e){const t=i.qualityLevels,r=new ga,n=function(){r.dispose(),i.qualityLevels=t,i.off("dispose",n)};return i.on("dispose",n),i.qualityLevels=()=>r,i.qualityLevels.VERSION=dg,r},hg=function(i){return gE(this,B.obj.merge({},i))};B.registerPlugin("qualityLevels",hg);hg.VERSION=dg;/*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */const vt=Aa,fa=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,jt=i=>B.log.debug?B.log.debug.bind(B,"VHS:",`${i} >`):function(){};function _e(...i){const e=B.obj||B;return(e.merge||e.mergeOptions).apply(e,i)}function at(...i){const e=B.time||B;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function fE(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
192
192
|
`;for(let t=0;t<i.length;t++){const r=i.start(t),n=i.end(t);e+=`${r} --> ${n}. Duration (${n-r})
|
|
193
|
-
`}return e}const Zt=1/30,ei=Zt*3,am=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r<i.length;r++)e(i.start(r),i.end(r))&&t.push([i.start(r),i.end(r)]);return it(t)},Sr=function(i,e){return am(i,function(t,r){return t-ei<=e&&r+ei>=e})},Ms=function(i,e){return am(i,function(t){return t-Zt>=e})},iE=function(i){if(i.length<2)return it();const e=[];for(let t=1;t<i.length;t++){const r=i.end(t-1),n=i.start(t);e.push([r,n])}return it(e)},rE=function(i,e){let t=null,r=null,n=0;const s=[],a=[];if(!i||!i.length||!e||!e.length)return it();let l=i.length;for(;l--;)s.push({time:i.start(l),type:"start"}),s.push({time:i.end(l),type:"end"});for(l=e.length;l--;)s.push({time:e.start(l),type:"start"}),s.push({time:e.end(l),type:"end"});for(s.sort(function(u,p){return u.time-p.time}),l=0;l<s.length;l++)s[l].type==="start"?(n++,n===2&&(t=s[l].time)):s[l].type==="end"&&(n--,n===1&&(r=s[l].time)),t!==null&&r!==null&&(a.push([t,r]),t=null,r=null);return it(a)},om=i=>{const e=[];if(!i||!i.length)return"";for(let t=0;t<i.length;t++)e.push(i.start(t)+" => "+i.end(t));return e.join(", ")},nE=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},Qi=i=>{const e=[];for(let t=0;t<i.length;t++)e.push({start:i.start(t),end:i.end(t)});return e},sE=function(i,e){if(i===e)return!1;if(!i&&e||!e&&i||i.length!==e.length)return!0;for(let t=0;t<i.length;t++)if(i.start(t)!==e.start(t)||i.end(t)!==e.end(t))return!0;return!1},Bo=function(i){if(!(!i||!i.length||!i.end))return i.end(i.length-1)},vu=function(i,e){let t=0;if(!i||!i.length)return t;for(let r=0;r<i.length;r++){const n=i.start(r),s=i.end(r);if(!(e>s)){if(e>n&&e<=s){t+=s-e;continue}t+=s-n}}return t},Tu=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},ol=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(n,s){e.push({duration:n.duration,segmentIndex:r,partIndex:s,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),lm=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},um=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((n,s)=>n+(s.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},cm=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=lm(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},aE=function(i,e){let t=0,r=e-i.mediaSequence,n=i.segments[r];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;r--;){if(n=i.segments[r],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Tu(i,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},oE=function(i,e){let t=0,r,n=e-i.mediaSequence;for(;n<i.segments.length;n++){if(r=i.segments[n],typeof r.start<"u")return{result:r.start-t,precise:!0};if(t+=Tu(i,r),typeof r.end<"u")return{result:r.end-t,precise:!0}}return{result:-1,precise:!1}},dm=function(i,e,t){if(typeof e>"u"&&(e=i.mediaSequence+i.segments.length),e<i.mediaSequence)return 0;const r=aE(i,e);if(r.precise)return r.result;const n=oE(i,e);return n.precise?n.result:r.result+t},hm=function(i,e,t){if(!i)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return x.Infinity}return dm(i,e,t)},On=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:r}){let n=0;if(t>r&&([t,r]=[r,t]),t<0){for(let s=t;s<Math.min(0,r);s++)n+=i;t=0}for(let s=t;s<r;s++)n+=e[s].duration;return n},pm=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return hm(i);if(e===null)return null;e=e||0;let n=dm(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:cm(null,i),n-=r),Math.max(0,n)},lE=function(i,e,t){const r=e||0;let n=pm(i,e,!0,t);return n===null?it():(n<r&&(n=r),it(r,n))},uE=function({playlist:i,currentTime:e,startingSegmentIndex:t,startingPartIndex:r,startTime:n,exactManifestTimings:s}){let a=e-n;const l=ol(i);let u=0;for(let p=0;p<l.length;p++){const g=l[p];if(t===g.segmentIndex&&!(typeof r=="number"&&typeof g.partIndex=="number"&&r!==g.partIndex)){u=p;break}}if(a<0){if(u>0)for(let p=u-1;p>=0;p--){const g=l[p];if(a+=g.duration,s){if(a<0)continue}else if(a+Zt<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:n-On({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:p})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(u<0){for(let p=u;p<0;p++)if(a-=i.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};u=0}for(let p=u;p<l.length;p++){const g=l[p];a-=g.duration;const b=g.duration>Zt,S=a===0,w=b&&a+Zt>=0;if(!((S||w)&&p!==l.length-1)){if(s){if(a>0)continue}else if(a-Zt>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:n+On({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:p})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},gm=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Su=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Ga=function(i){const e=gm(i);return!i.disabled&&!e},cE=function(i){return i.disabled},dE=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},mm=function(i,e){return e.attributes&&e.attributes[i]},hE=function(i,e,t,r=0){return mm("BANDWIDTH",t)?(i*t.attributes.BANDWIDTH-r*8)/e:NaN},ll=(i,e)=>{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>Ga(r)?(r.attributes.BANDWIDTH||0)<t:!1).length===0},Eu=(i,e)=>!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),zd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const n in t){for(const s in t[n])if(r=e(t[n][s]),r)break;if(r)break}return!!r},ts=i=>{if(!i||!i.playlists||!i.playlists.length)return zd(i,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<i.playlists.length;e++){const t=i.playlists[e],r=t.attributes&&t.attributes.CODECS;if(!(r&&r.split(",").every(n=>kp(n))||zd(i,n=>Eu(t,n))))return!1}return!0};var _t={liveEdgeDelay:cm,duration:hm,seekable:lE,getMediaInfoForTime:uE,isEnabled:Ga,isDisabled:cE,isExcluded:gm,isIncompatible:Su,playlistEnd:pm,isAes:dE,hasAttribute:mm,estimateSegmentRequestTime:hE,isLowestEnabledRendition:ll,isAudioOnly:ts,playlistMatch:Eu,segmentDurationWithParts:Tu};const{log:fm}=B,Ar=(i,e)=>`${i}-${e}`,ym=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,pE=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:n=[],llhls:s})=>{const a=new rT;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(p=>a.addParser(p)),n.forEach(p=>a.addTagMapper(p)),a.push(t),a.end();const l=a.manifest;if(s||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(p){l.hasOwnProperty(p)&&delete l[p]}),l.segments&&l.segments.forEach(function(p){["parts","preloadHints"].forEach(function(g){p.hasOwnProperty(g)&&delete p[g]})})),!l.targetDuration){let p=10;l.segments&&l.segments.length&&(p=l.segments.reduce((g,b)=>Math.max(g,b.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${p}`}),l.targetDuration=p}const u=lm(l);if(u.length&&!l.partTargetDuration){const p=u.reduce((g,b)=>Math.max(g,b.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${p}`}),fm.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=p}return l},Jr=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const n in i.mediaGroups[t][r]){const s=i.mediaGroups[t][r][n];e(s,t,r,n)}})},_m=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},gE=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];_m({playlist:t,id:Ar(e,t.uri)}),t.resolvedUri=yt(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||fm.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},mE=i=>{Jr(i,e=>{e.uri&&(e.resolvedUri=yt(i.uri,e.uri))})},fE=(i,e)=>{const t=Ar(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:x.location.href,resolvedUri:x.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},bm=(i,e,t=ym)=>{i.uri=e;for(let n=0;n<i.playlists.length;n++)if(!i.playlists[n].uri){const s=`placeholder-uri-${n}`;i.playlists[n].uri=s}const r=ts(i);Jr(i,(n,s,a,l)=>{if(!n.playlists||!n.playlists.length){if(r&&s==="AUDIO"&&!n.uri)for(let u=0;u<i.playlists.length;u++){const p=i.playlists[u];if(p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===a)return}n.playlists=[Ve({},n)]}n.playlists.forEach(function(u,p){const g=t(s,a,l,u),b=Ar(p,g);u.uri?u.resolvedUri=u.resolvedUri||yt(i.uri,u.uri):(u.uri=p===0?g:b,u.resolvedUri=u.uri),u.id=u.id||b,u.attributes=u.attributes||{},i.playlists[u.id]=u,i.playlists[u.uri]=u})}),gE(i),mE(i)};class Wd{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,r=t.startDate.getTime();this.trimProcessedDateRanges_(r),this.pendingDateRanges_=e.reduce((n,s)=>(n.set(s.id,s),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,n)=>{if(!this.processedDateRanges_.has(n)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const s=e[r.class].push(r);r.classListIndex=s-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const n=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&n[r.classListIndex+1]?r.endTime=n[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,r)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(r)})}}const vm=22,ir=({requestType:i,request:e,error:t,parseFailure:r})=>{const n=e.status<200||e.status>299,s=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},l=n&&!s||r;if(t&&s)a.error=Ve({},t),a.errorType=B.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=B.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=B.Error.NetworkRequestTimeout;else if(l){const u=r?B.Error.NetworkBodyParserFailed:B.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:yE}=B,_E=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let n=e.mediaSequence+e.segments.length;if(r){const s=r.parts||[],a=um(e)-1;a>-1&&a!==s.length-1&&(t._HLS_part=a),(a>-1||s.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new x.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&r.searchParams.set(n,t[n])}),i=r.toString()}return i},bE=(i,e)=>{if(!i)return e;const t=fe(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r<e.parts.length;r++)i.parts&&i.parts[r]&&(t.parts[r]=fe(i.parts[r],e.parts[r]));return!i.skipped&&e.skipped&&(t.skipped=!1),i.preload&&!e.preload&&(t.preload=!1),t},vE=(i,e,t)=>{const r=i.slice(),n=e.slice();t=t||0;const s=[];let a;for(let l=0;l<n.length;l++){const u=r[l+t],p=n[l];u?(a=u.map||a,s.push(bE(u,p))):(a&&!p.map&&(p.map=a),s.push(p))}return s},Tm=(i,e)=>{!i.resolvedUri&&i.uri&&(i.resolvedUri=yt(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=yt(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=yt(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=yt(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=yt(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=yt(e,t.uri))})},Sm=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;r<t.preloadHints.length;r++)if(t.preloadHints[r].type==="MAP")return e}t.duration=i.targetDuration,t.preload=!0,e.push(t)}return e},Em=(i,e)=>i===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,ul=(i,e,t=Em)=>{const r=fe(i,{}),n=r.playlists[e.id];if(!n||t(n,e))return null;e.segments=Sm(e);const s=fe(n,e);if(s.preloadSegment&&!e.preloadSegment&&delete s.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}s.segments=vE(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}s.segments.forEach(a=>{Tm(a,s.resolvedUri)});for(let a=0;a<r.playlists.length;a++)r.playlists[a].id===e.id&&(r.playlists[a]=s);return r.playlists[e.id]=s,r.playlists[e.uri]=s,Jr(i,(a,l,u,p)=>{if(a.playlists)for(let g=0;g<a.playlists.length;g++)e.id===a.playlists[g].id&&(a.playlists[g]=s)}),r},cl=(i,e)=>{const t=i.segments||[],r=t[t.length-1],n=r&&r.parts&&r.parts[r.parts.length-1],s=n&&n.duration||r&&r.duration;return e&&s?s*1e3:(i.partTargetDuration||i.targetDuration||10)*500},Gd=(i,e,t)=>{if(!i)return;const r=[];return i.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:s,RESOLUTION:a,CODECS:l}=n.attributes;r.push({id:n.id,bandwidth:s,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:r}};class Er extends yE{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Nt("PlaylistLoader");const{withCredentials:n=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new Wd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=yt(this.main.uri,e.uri);this.llhls&&(t=_E(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,n)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:n,id:s}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ir({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return pE({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:B.Error.StreamingHlsPlaylistParserError,error:r}}}haveMetadata({playlistString:e,playlistObject:t,url:r,id:n}){this.request=null,this.state="HAVE_METADATA";const s={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:s});const a=t||this.parseManifest_({url:r,manifestString:e});a.lastRequest=Date.now(),_m({playlist:a,uri:r,id:n});const l=ul(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(cl(this.media(),!!l)),s.parsedPlaylist=Gd(this.main.playlists,s.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:s}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),x.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Wd,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(x.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=x.setTimeout(this.media.bind(this,e,!1),l);return}const r=this.state,n=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(cl(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=ga(e.resolvedUri,u),l)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=x.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,r)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:ir({requestType:r.requestType,request:r,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=ga(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=Gd(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,bm(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=Sm(r),r.segments.forEach(n=>{Tm(n,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||x.location.href;this.main=fE(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const r=this.main,n=e.ID;let s=r.playlists.length;for(;s--;){const a=r.playlists[s];if(a.attributes["PATHWAY-ID"]===n){const l=a.resolvedUri,u=a.id;if(t){const p=this.createCloneURI_(a.resolvedUri,e),g=Ar(n,p),b=this.createCloneAttributes_(n,a.attributes),S=this.createClonePlaylist_(a,g,e,b);r.playlists[s]=S,r.playlists[g]=S,r.playlists[p]=S}else r.playlists.splice(s,1);delete r.playlists[u],delete r.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const r=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!r.mediaGroups[s]||!r.mediaGroups[s][n])){for(const a in r.mediaGroups[s])if(a===n){for(const l in r.mediaGroups[s][a])r.mediaGroups[s][a][l].playlists.forEach((u,p)=>{const g=r.playlists[u.id],b=g.id,S=g.resolvedUri;delete r.playlists[b],delete r.playlists[S]});delete r.mediaGroups[s][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const r=this.main,n=r.playlists.length,s=this.createCloneURI_(t.resolvedUri,e),a=Ar(e.ID,s),l=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,l);r.playlists[n]=u,r.playlists[a]=u,r.playlists[s]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,r=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!n.mediaGroups[s]||n.mediaGroups[s][t]))for(const a in n.mediaGroups[s]){if(a===r)n.mediaGroups[s][t]={};else continue;for(const l in n.mediaGroups[s][a]){const u=n.mediaGroups[s][a][l];n.mediaGroups[s][t][l]=Ve({},u);const p=n.mediaGroups[s][t][l],g=this.createCloneURI_(u.resolvedUri,e);p.resolvedUri=g,p.uri=g,p.playlists=[],u.playlists.forEach((b,S)=>{const w=n.playlists[b.id],C=ym(s,t,l),v=Ar(t,C);if(w&&!n.playlists[v]){const D=this.createClonePlaylist_(w,v,e),L=D.resolvedUri;n.playlists[v]=D,n.playlists[L]=D}p.playlists[S]=this.createClonePlaylist_(b,v,e)})}}})}createClonePlaylist_(e,t,r,n){const s=this.createCloneURI_(e.resolvedUri,r),a={resolvedUri:s,uri:s,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),fe(e,a)}createCloneURI_(e,t){const r=new URL(e);r.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const s of Object.keys(n))r.searchParams.set(s,n[s]);return r.href}createCloneAttributes_(e,t){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(r[n]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const n=e.contentProtection[r].attributes.keyId;n&&t.add(n.toLowerCase())}return t}}}const dl=function(i,e,t,r){const n=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&n&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=n.byteLength||n.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(n||i.responseText)))),r(e,i)},TE=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},SE=(i,e,t,r)=>{!i||!i.size||i.forEach(n=>{n(e,t,r)})},wm=function(){const i=function e(t,r){t=fe({timeout:45e3},t);const n=e.beforeRequest||B.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||B.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||B.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(B.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(n));const l=B.Vhs.xhr.original===!0?B.xhr:B.Vhs.xhr,u=TE(s,t);s.delete(n);const p=l(u||t,function(b,S){return SE(a,p,b,S),dl(p,b,S,r)}),g=p.abort;return p.abort=function(){return p.aborted=!0,g.apply(p,arguments)},p.uri=t.uri,p.requestType=t.requestType,p.requestTime=Date.now(),p};return i.original=!0,i},EE=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=x.BigInt(i.offset)+x.BigInt(i.length)-x.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},hl=function(i){const e={};return i.byterange&&(e.Range=EE(i.byterange)),e},wE=function(i,e){return i.start(e)+"-"+i.end(e)},kE=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},CE=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},km=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];Ip(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},ma=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},Cm=function(i){return i.resolvedUri},Im=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",n,s;for(let a=0;a<e.length/t;a++)n=e.slice(a*t,a*t+t).map(kE).join(""),s=e.slice(a*t,a*t+t).map(CE).join(""),r+=n+" "+s+`
|
|
194
|
-
`;return r},IE=({bytes:i})=>Im(i),AE=i=>{let e="",t;for(t=0;t<i.length;t++)e+=wE(i,t)+" ";return e};var xE=Object.freeze({__proto__:null,createTransferableMessage:km,initSegmentId:ma,segmentKeyId:Cm,hexDump:Im,tagDump:IE,textRanges:AE});const Am=.25,LE=(i,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},DE=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,PE=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(t<new Date(r.dateTimeObject))return null;for(let u=0;u<e.segments.length-1;u++){r=e.segments[u];const p=new Date(e.segments[u+1].dateTimeObject);if(t<p)break}const n=e.segments[e.segments.length-1],s=n.dateTimeObject,a=n.videoTimingInfo?DE(n.videoTimingInfo):n.duration+n.duration*Am,l=new Date(s.getTime()+a*1e3);return t>l?null:(t>new Date(s)&&(r=n),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:_t.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},RE=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let s=0;s<e.segments.length&&(r=e.segments[s],t=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:t+r.duration,!(i<=t));s++);const n=e.segments[e.segments.length-1];if(n.videoTimingInfo&&n.videoTimingInfo.transmuxedPresentationEnd<i)return null;if(i>t){if(i>t+n.duration*Am)return null;r=n}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},NE=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const n=t.getTime();return(r.getTime()-n)/1e3},OE=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e<i.segments.length;e++)if(!i.segments[e].dateTimeObject)return!1;return!0},UE=({playlist:i,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=RE(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const n={mediaSeconds:e},s=LE(e,r.segment);return s&&(n.programDateTime=s.toISOString()),t(null,n)},xm=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:n=!0,tech:s,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!s.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!OE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=PE(i,e);if(!l)return a({message:`${i} was not found in the stream`});const u=l.segment,p=NE(u.dateTimeObject,i);if(l.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(l.estimatedStart+p),s.one("seeked",()=>{xm({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:n,tech:s,callback:a})});return}const g=u.start+p,b=()=>a(null,s.currentTime());s.one("seeked",b),n&&s.pause(),r(g)},Fo=(i,e)=>{if(i.readyState===4)return e()},ME=(i,e,t,r)=>{let n=[],s,a=!1;const l=function(g,b,S,w){return b.abort(),a=!0,t(g,b,S,w)},u=function(g,b){if(a)return;if(g)return g.metadata=ir({requestType:r,request:b,error:g}),l(g,b,"",n);const S=b.responseText.substring(n&&n.byteLength||0,b.responseText.length);if(n=mT(n,Ap(S,!0)),s=s||In(n),n.length<10||s&&n.length<s+2)return Fo(b,()=>l(g,b,"",n));const w=Hl(n);return w==="ts"&&n.length<188?Fo(b,()=>l(g,b,"",n)):!w&&n.length<376?Fo(b,()=>l(g,b,"",n)):l(null,b,w,n)},p=e({uri:i,beforeSend(g){g.overrideMimeType("text/plain; charset=x-user-defined"),g.addEventListener("progress",function({total:b,loaded:S}){return dl(g,null,{statusCode:g.status},u)})}},function(g,b){return dl(p,g,b,u)});return p},{EventTarget:BE}=B,Xd=function(i,e){if(!Em(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length)||!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t<i.segments.length;t++){const r=i.segments[t],n=e.segments[t];if(r.uri!==n.uri)return!1;if(!r.byterange&&!n.byterange)continue;const s=r.byterange,a=n.byterange;if(s&&!a||!s&&a||s.offset!==a.offset||s.length!==a.length)return!1}return!0},FE=(i,e,t,r)=>{const n=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${n}`},jE=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:n})=>{const s=l1(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:n});return bm(s,e,FE),s},qE=(i,e)=>{Jr(i,(t,r,n,s)=>{(!e.mediaGroups[r][n]||!(s in e.mediaGroups[r][n]))&&delete i.mediaGroups[r][n][s]})},$E=(i,e,t)=>{let r=!0,n=fe(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let s=0;s<e.playlists.length;s++){const a=e.playlists[s];if(a.sidx){const u=Aa(a.sidx);t&&t[u]&&t[u].sidx&&ql(a,t[u].sidx,a.sidx.resolvedUri)}const l=ul(n,a,Xd);l&&(n=l,r=!1)}return Jr(e,(s,a,l,u)=>{if(s.playlists&&s.playlists.length){const p=s.playlists[0].id,g=ul(n,s.playlists[0],Xd);g&&(n=g,u in n.mediaGroups[a][l]||(n.mediaGroups[a][l][u]=s),n.mediaGroups[a][l][u].playlists[0]=n.playlists[p],r=!1)}}),qE(n,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:n},VE=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Kd=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const s=Aa(n);if(!e[s])break;const a=e[s].sidxInfo;VE(a,n)&&(t[s]=e[s])}}return t},HE=(i,e)=>{let t=Kd(i.playlists,e);return Jr(i,(r,n,s,a)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;t=fe(t,Kd(l,e))}}),t};class pl extends BE{constructor(e,t,r={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:s=!1}=r;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Nt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const n=e.sidx&&Aa(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>r(!1),0);return}const s=ga(e.sidx.resolvedUri),a=(u,p)=>{if(this.requestErrored_(u,p,t))return;const g=this.mainPlaylistLoader_.sidxMapping_,{requestType:b}=p;let S;try{S=g1(re(p.response).subarray(8))}catch(w){w.metadata=ir({requestType:b,request:p,parseFailure:!0}),this.requestErrored_(w,p,t);return}return g[n]={sidxInfo:e.sidx,sidx:S},ql(e,S,e.sidx.resolvedUri),r(!0)},l="dash-sidx";this.request=ME(s,this.vhs_.xhr,(u,p,g,b)=>{if(u)return a(u,p);if(!g||g!=="mp4"){const C=g||"unknown";return a({status:p.status,message:`Unsupported ${C} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},p)}const{offset:S,length:w}=e.sidx.byterange;if(b.length>=w+S)return a(u,{response:b.subarray(S,S+w),status:p.status,uri:p.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",requestType:"dash-sidx",headers:hl({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},x.clearTimeout(this.minimumUpdatePeriodTimeout_),x.clearTimeout(this.mediaRequest_),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(x.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,n)=>{if(r){const{requestType:a}=n;r.metadata=ir({requestType:a,request:n,error:r})}if(this.requestErrored_(r,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const s=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=ga(this.mainPlaylistLoader_.srcUrl,n),s){this.handleMain_(),this.syncClientServerClock_(()=>e(n,s));return}return e(n,s)})}syncClientServerClock_(e){const t=u1(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:yt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,n)=>{if(!this.request)return;if(r){const{requestType:a}=n;return this.error.metadata=ir({requestType:a,request:n,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let s;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?s=this.mainLoaded_:s=Date.parse(n.responseHeaders.date):s=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let r;try{r=jE({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(s){this.error=s,this.error.metadata={errorType:B.Error.StreamingDashManifestParserError,error:s},this.trigger("error")}e&&(r=$E(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:s,endList:a}=r,l=[];r.playlists.forEach(p=>{l.push({id:p.id,bandwidth:p.attributes.BANDWIDTH,resolution:p.attributes.RESOLUTION,codecs:p.attributes.CODECS})});const u={duration:s,isLive:!a,renditions:l};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(x.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=x.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=HE(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=x.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},cl(this.media(),!!r)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const n=e.contentProtection[r].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var Xe={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const zE=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer},Lm=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},WE=function(i){try{return URL.createObjectURL(new Blob([i],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(i),URL.createObjectURL(e.getBlob())}},Dm=function(i){return function(){const e=WE(i),t=Lm(new Worker(e));t.objURL=e;const r=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),r.call(this)},t}},Pm=function(i){return`var browserWorkerPolyFill = ${Lm.toString()};
|
|
193
|
+
`}return e}const ni=1/30,si=ni*3,pg=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r<i.length;r++)e(i.start(r),i.end(r))&&t.push([i.start(r),i.end(r)]);return at(t)},Cr=function(i,e){return pg(i,function(t,r){return t-si<=e&&r+si>=e})},Fs=function(i,e){return pg(i,function(t){return t-ni>=e})},yE=function(i){if(i.length<2)return at();const e=[];for(let t=1;t<i.length;t++){const r=i.end(t-1),n=i.start(t);e.push([r,n])}return at(e)},_E=function(i,e){let t=null,r=null,n=0;const s=[],a=[];if(!i||!i.length||!e||!e.length)return at();let l=i.length;for(;l--;)s.push({time:i.start(l),type:"start"}),s.push({time:i.end(l),type:"end"});for(l=e.length;l--;)s.push({time:e.start(l),type:"start"}),s.push({time:e.end(l),type:"end"});for(s.sort(function(u,p){return u.time-p.time}),l=0;l<s.length;l++)s[l].type==="start"?(n++,n===2&&(t=s[l].time)):s[l].type==="end"&&(n--,n===1&&(r=s[l].time)),t!==null&&r!==null&&(a.push([t,r]),t=null,r=null);return at(a)},mg=i=>{const e=[];if(!i||!i.length)return"";for(let t=0;t<i.length;t++)e.push(i.start(t)+" => "+i.end(t));return e.join(", ")},bE=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},tr=i=>{const e=[];for(let t=0;t<i.length;t++)e.push({start:i.start(t),end:i.end(t)});return e},vE=function(i,e){if(i===e)return!1;if(!i&&e||!e&&i||i.length!==e.length)return!0;for(let t=0;t<i.length;t++)if(i.start(t)!==e.start(t)||i.end(t)!==e.end(t))return!0;return!1},Fo=function(i){if(!(!i||!i.length||!i.end))return i.end(i.length-1)},Tu=function(i,e){let t=0;if(!i||!i.length)return t;for(let r=0;r<i.length;r++){const n=i.start(r),s=i.end(r);if(!(e>s)){if(e>n&&e<=s){t+=s-e;continue}t+=s-n}}return t},Su=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},ll=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(n,s){e.push({duration:n.duration,segmentIndex:r,partIndex:s,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),gg=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},fg=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((n,s)=>n+(s.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},yg=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=gg(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},TE=function(i,e){let t=0,r=e-i.mediaSequence,n=i.segments[r];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;r--;){if(n=i.segments[r],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=Su(i,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},SE=function(i,e){let t=0,r,n=e-i.mediaSequence;for(;n<i.segments.length;n++){if(r=i.segments[n],typeof r.start<"u")return{result:r.start-t,precise:!0};if(t+=Su(i,r),typeof r.end<"u")return{result:r.end-t,precise:!0}}return{result:-1,precise:!1}},_g=function(i,e,t){if(typeof e>"u"&&(e=i.mediaSequence+i.segments.length),e<i.mediaSequence)return 0;const r=TE(i,e);if(r.precise)return r.result;const n=SE(i,e);return n.precise?n.result:r.result+t},bg=function(i,e,t){if(!i)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return x.Infinity}return _g(i,e,t)},Fn=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:r}){let n=0;if(t>r&&([t,r]=[r,t]),t<0){for(let s=t;s<Math.min(0,r);s++)n+=i;t=0}for(let s=t;s<r;s++)n+=e[s].duration;return n},vg=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return bg(i);if(e===null)return null;e=e||0;let n=_g(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:yg(null,i),n-=r),Math.max(0,n)},EE=function(i,e,t){const r=e||0;let n=vg(i,e,!0,t);return n===null?at():(n<r&&(n=r),at(r,n))},wE=function({playlist:i,currentTime:e,startingSegmentIndex:t,startingPartIndex:r,startTime:n,exactManifestTimings:s}){let a=e-n;const l=ll(i);let u=0;for(let p=0;p<l.length;p++){const m=l[p];if(t===m.segmentIndex&&!(typeof r=="number"&&typeof m.partIndex=="number"&&r!==m.partIndex)){u=p;break}}if(a<0){if(u>0)for(let p=u-1;p>=0;p--){const m=l[p];if(a+=m.duration,s){if(a<0)continue}else if(a+ni<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:n-Fn({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:p})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(u<0){for(let p=u;p<0;p++)if(a-=i.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};u=0}for(let p=u;p<l.length;p++){const m=l[p];a-=m.duration;const _=m.duration>ni,S=a===0,w=_&&a+ni>=0;if(!((S||w)&&p!==l.length-1)){if(s){if(a>0)continue}else if(a-ni>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:n+Fn({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:p})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},Tg=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Eu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Ka=function(i){const e=Tg(i);return!i.disabled&&!e},kE=function(i){return i.disabled},CE=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},Sg=function(i,e){return e.attributes&&e.attributes[i]},IE=function(i,e,t,r=0){return Sg("BANDWIDTH",t)?(i*t.attributes.BANDWIDTH-r*8)/e:NaN},ul=(i,e)=>{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>Ka(r)?(r.attributes.BANDWIDTH||0)<t:!1).length===0},wu=(i,e)=>!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),Gd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const n in t){for(const s in t[n])if(r=e(t[n][s]),r)break;if(r)break}return!!r},ss=i=>{if(!i||!i.playlists||!i.playlists.length)return Gd(i,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<i.playlists.length;e++){const t=i.playlists[e],r=t.attributes&&t.attributes.CODECS;if(!(r&&r.split(",").every(n=>Pp(n))||Gd(i,n=>wu(t,n))))return!1}return!0};var Tt={liveEdgeDelay:yg,duration:bg,seekable:EE,getMediaInfoForTime:wE,isEnabled:Ka,isDisabled:kE,isExcluded:Tg,isIncompatible:Eu,playlistEnd:vg,isAes:CE,hasAttribute:Sg,estimateSegmentRequestTime:IE,isLowestEnabledRendition:ul,isAudioOnly:ss,playlistMatch:wu,segmentDurationWithParts:Su};const{log:Eg}=B,Pr=(i,e)=>`${i}-${e}`,wg=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,AE=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:n=[],llhls:s})=>{const a=new _T;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(p=>a.addParser(p)),n.forEach(p=>a.addTagMapper(p)),a.push(t),a.end();const l=a.manifest;if(s||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(p){l.hasOwnProperty(p)&&delete l[p]}),l.segments&&l.segments.forEach(function(p){["parts","preloadHints"].forEach(function(m){p.hasOwnProperty(m)&&delete p[m]})})),!l.targetDuration){let p=10;l.segments&&l.segments.length&&(p=l.segments.reduce((m,_)=>Math.max(m,_.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${p}`}),l.targetDuration=p}const u=gg(l);if(u.length&&!l.partTargetDuration){const p=u.reduce((m,_)=>Math.max(m,_.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${p}`}),Eg.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),l.partTargetDuration=p}return l},rn=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const n in i.mediaGroups[t][r]){const s=i.mediaGroups[t][r][n];e(s,t,r,n)}})},kg=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},xE=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];kg({playlist:t,id:Pr(e,t.uri)}),t.resolvedUri=vt(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||Eg.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},LE=i=>{rn(i,e=>{e.uri&&(e.resolvedUri=vt(i.uri,e.uri))})},DE=(i,e)=>{const t=Pr(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:x.location.href,resolvedUri:x.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},Cg=(i,e,t=wg)=>{i.uri=e;for(let n=0;n<i.playlists.length;n++)if(!i.playlists[n].uri){const s=`placeholder-uri-${n}`;i.playlists[n].uri=s}const r=ss(i);rn(i,(n,s,a,l)=>{if(!n.playlists||!n.playlists.length){if(r&&s==="AUDIO"&&!n.uri)for(let u=0;u<i.playlists.length;u++){const p=i.playlists[u];if(p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===a)return}n.playlists=[Ge({},n)]}n.playlists.forEach(function(u,p){const m=t(s,a,l,u),_=Pr(p,m);u.uri?u.resolvedUri=u.resolvedUri||vt(i.uri,u.uri):(u.uri=p===0?m:_,u.resolvedUri=u.uri),u.id=u.id||_,u.attributes=u.attributes||{},i.playlists[u.id]=u,i.playlists[u.uri]=u})}),xE(i),LE(i)};class Xd{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,r=t.startDate.getTime();this.trimProcessedDateRanges_(r),this.pendingDateRanges_=e.reduce((n,s)=>(n.set(s.id,s),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,n)=>{if(!this.processedDateRanges_.has(n)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const s=e[r.class].push(r);r.classListIndex=s-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const n=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&n[r.classListIndex+1]?r.endTime=n[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,r)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(r)})}}const Ig=22,ar=({requestType:i,request:e,error:t,parseFailure:r})=>{const n=e.status<200||e.status>299,s=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},l=n&&!s||r;if(t&&s)a.error=Ge({},t),a.errorType=B.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=B.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=B.Error.NetworkRequestTimeout;else if(l){const u=r?B.Error.NetworkBodyParserFailed:B.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:PE}=B,RE=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let n=e.mediaSequence+e.segments.length;if(r){const s=r.parts||[],a=fg(e)-1;a>-1&&a!==s.length-1&&(t._HLS_part=a),(a>-1||s.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new x.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&r.searchParams.set(n,t[n])}),i=r.toString()}return i},NE=(i,e)=>{if(!i)return e;const t=_e(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r<e.parts.length;r++)i.parts&&i.parts[r]&&(t.parts[r]=_e(i.parts[r],e.parts[r]));return!i.skipped&&e.skipped&&(t.skipped=!1),i.preload&&!e.preload&&(t.preload=!1),t},OE=(i,e,t)=>{const r=i.slice(),n=e.slice();t=t||0;const s=[];let a;for(let l=0;l<n.length;l++){const u=r[l+t],p=n[l];u?(a=u.map||a,s.push(NE(u,p))):(a&&!p.map&&(p.map=a),s.push(p))}return s},Ag=(i,e)=>{!i.resolvedUri&&i.uri&&(i.resolvedUri=vt(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=vt(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=vt(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=vt(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=vt(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=vt(e,t.uri))})},xg=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;r<t.preloadHints.length;r++)if(t.preloadHints[r].type==="MAP")return e}t.duration=i.targetDuration,t.preload=!0,e.push(t)}return e},Lg=(i,e)=>i===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,cl=(i,e,t=Lg)=>{const r=_e(i,{}),n=r.playlists[e.id];if(!n||t(n,e))return null;e.segments=xg(e);const s=_e(n,e);if(s.preloadSegment&&!e.preloadSegment&&delete s.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}s.segments=OE(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}s.segments.forEach(a=>{Ag(a,s.resolvedUri)});for(let a=0;a<r.playlists.length;a++)r.playlists[a].id===e.id&&(r.playlists[a]=s);return r.playlists[e.id]=s,r.playlists[e.uri]=s,rn(i,(a,l,u,p)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=s)}),r},dl=(i,e)=>{const t=i.segments||[],r=t[t.length-1],n=r&&r.parts&&r.parts[r.parts.length-1],s=n&&n.duration||r&&r.duration;return e&&s?s*1e3:(i.partTargetDuration||i.targetDuration||10)*500},Kd=(i,e,t)=>{if(!i)return;const r=[];return i.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:s,RESOLUTION:a,CODECS:l}=n.attributes;r.push({id:n.id,bandwidth:s,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:r}};class Ir extends PE{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=jt("PlaylistLoader");const{withCredentials:n=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const s=t.options_;this.customTagParsers=s&&s.customTagParsers||[],this.customTagMappers=s&&s.customTagMappers||[],this.llhls=s&&s.llhls,this.dateRangesStorage_=new Xd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=vt(this.main.uri,e.uri);this.llhls&&(t=RE(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,n)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:n,id:s}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[s],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:ar({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return AE({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:B.Error.StreamingHlsPlaylistParserError,error:r}}}haveMetadata({playlistString:e,playlistObject:t,url:r,id:n}){this.request=null,this.state="HAVE_METADATA";const s={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:s});const a=t||this.parseManifest_({url:r,manifestString:e});a.lastRequest=Date.now(),kg({playlist:a,uri:r,id:n});const l=cl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(dl(this.media(),!!l)),s.parsedPlaylist=Kd(this.main.playlists,s.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:s}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),x.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Xd,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(x.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=x.setTimeout(this.media.bind(this,e,!1),l);return}const r=this.state,n=!this.media_||e.id!==this.media_.id,s=this.main.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(dl(e,!0)),!n)return;if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(l,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=fa(e.resolvedUri,u),l)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=x.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=x.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,r)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:ar({requestType:r.requestType,request:r,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=fa(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=Kd(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Cg(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=xg(r),r.segments.forEach(n=>{Ag(n,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||x.location.href;this.main=DE(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const r=this.main,n=e.ID;let s=r.playlists.length;for(;s--;){const a=r.playlists[s];if(a.attributes["PATHWAY-ID"]===n){const l=a.resolvedUri,u=a.id;if(t){const p=this.createCloneURI_(a.resolvedUri,e),m=Pr(n,p),_=this.createCloneAttributes_(n,a.attributes),S=this.createClonePlaylist_(a,m,e,_);r.playlists[s]=S,r.playlists[m]=S,r.playlists[p]=S}else r.playlists.splice(s,1);delete r.playlists[u],delete r.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const r=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!r.mediaGroups[s]||!r.mediaGroups[s][n])){for(const a in r.mediaGroups[s])if(a===n){for(const l in r.mediaGroups[s][a])r.mediaGroups[s][a][l].playlists.forEach((u,p)=>{const m=r.playlists[u.id],_=m.id,S=m.resolvedUri;delete r.playlists[_],delete r.playlists[S]});delete r.mediaGroups[s][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const r=this.main,n=r.playlists.length,s=this.createCloneURI_(t.resolvedUri,e),a=Pr(e.ID,s),l=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,l);r.playlists[n]=u,r.playlists[a]=u,r.playlists[s]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,r=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{if(!(!n.mediaGroups[s]||n.mediaGroups[s][t]))for(const a in n.mediaGroups[s]){if(a===r)n.mediaGroups[s][t]={};else continue;for(const l in n.mediaGroups[s][a]){const u=n.mediaGroups[s][a][l];n.mediaGroups[s][t][l]=Ge({},u);const p=n.mediaGroups[s][t][l],m=this.createCloneURI_(u.resolvedUri,e);p.resolvedUri=m,p.uri=m,p.playlists=[],u.playlists.forEach((_,S)=>{const w=n.playlists[_.id],C=wg(s,t,l),v=Pr(t,C);if(w&&!n.playlists[v]){const L=this.createClonePlaylist_(w,v,e),D=L.resolvedUri;n.playlists[v]=L,n.playlists[D]=L}p.playlists[S]=this.createClonePlaylist_(_,v,e)})}}})}createClonePlaylist_(e,t,r,n){const s=this.createCloneURI_(e.resolvedUri,r),a={resolvedUri:s,uri:s,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),_e(e,a)}createCloneURI_(e,t){const r=new URL(e);r.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const s of Object.keys(n))r.searchParams.set(s,n[s]);return r.href}createCloneAttributes_(e,t){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(r[n]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const n=e.contentProtection[r].attributes.keyId;n&&t.add(n.toLowerCase())}return t}}}const hl=function(i,e,t,r){const n=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&n&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=n.byteLength||n.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(n||i.responseText)))),r(e,i)},UE=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},ME=(i,e,t,r)=>{!i||!i.size||i.forEach(n=>{n(e,t,r)})},Dg=function(){const i=function e(t,r){t=_e({timeout:45e3},t);const n=e.beforeRequest||B.Vhs.xhr.beforeRequest,s=e._requestCallbackSet||B.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||B.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(B.log.warn("beforeRequest is deprecated, use onRequest instead."),s.add(n));const l=B.Vhs.xhr.original===!0?B.xhr:B.Vhs.xhr,u=UE(s,t);s.delete(n);const p=l(u||t,function(_,S){return ME(a,p,_,S),hl(p,_,S,r)}),m=p.abort;return p.abort=function(){return p.aborted=!0,m.apply(p,arguments)},p.uri=t.uri,p.requestType=t.requestType,p.requestTime=Date.now(),p};return i.original=!0,i},BE=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=x.BigInt(i.offset)+x.BigInt(i.length)-x.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},pl=function(i){const e={};return i.byterange&&(e.Range=BE(i.byterange)),e},FE=function(i,e){return i.start(e)+"-"+i.end(e)},jE=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},$E=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},Pg=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];Np(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},ya=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},Rg=function(i){return i.resolvedUri},Ng=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",n,s;for(let a=0;a<e.length/t;a++)n=e.slice(a*t,a*t+t).map(jE).join(""),s=e.slice(a*t,a*t+t).map($E).join(""),r+=n+" "+s+`
|
|
194
|
+
`;return r},qE=({bytes:i})=>Ng(i),VE=i=>{let e="",t;for(t=0;t<i.length;t++)e+=FE(i,t)+" ";return e};var HE=Object.freeze({__proto__:null,createTransferableMessage:Pg,initSegmentId:ya,segmentKeyId:Rg,hexDump:Ng,tagDump:qE,textRanges:VE});const Og=.25,zE=(i,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},WE=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,GE=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(t<new Date(r.dateTimeObject))return null;for(let u=0;u<e.segments.length-1;u++){r=e.segments[u];const p=new Date(e.segments[u+1].dateTimeObject);if(t<p)break}const n=e.segments[e.segments.length-1],s=n.dateTimeObject,a=n.videoTimingInfo?WE(n.videoTimingInfo):n.duration+n.duration*Og,l=new Date(s.getTime()+a*1e3);return t>l?null:(t>new Date(s)&&(r=n),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Tt.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},XE=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let s=0;s<e.segments.length&&(r=e.segments[s],t=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:t+r.duration,!(i<=t));s++);const n=e.segments[e.segments.length-1];if(n.videoTimingInfo&&n.videoTimingInfo.transmuxedPresentationEnd<i)return null;if(i>t){if(i>t+n.duration*Og)return null;r=n}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},KE=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const n=t.getTime();return(r.getTime()-n)/1e3},YE=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e<i.segments.length;e++)if(!i.segments[e].dateTimeObject)return!1;return!0},QE=({playlist:i,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=XE(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const n={mediaSeconds:e},s=zE(e,r.segment);return s&&(n.programDateTime=s.toISOString()),t(null,n)},Ug=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:n=!0,tech:s,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!s.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!YE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=GE(i,e);if(!l)return a({message:`${i} was not found in the stream`});const u=l.segment,p=KE(u.dateTimeObject,i);if(l.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(l.estimatedStart+p),s.one("seeked",()=>{Ug({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:n,tech:s,callback:a})});return}const m=u.start+p,_=()=>a(null,s.currentTime());s.one("seeked",_),n&&s.pause(),r(m)},jo=(i,e)=>{if(i.readyState===4)return e()},JE=(i,e,t,r)=>{let n=[],s,a=!1;const l=function(m,_,S,w){return _.abort(),a=!0,t(m,_,S,w)},u=function(m,_){if(a)return;if(m)return m.metadata=ar({requestType:r,request:_,error:m}),l(m,_,"",n);const S=_.responseText.substring(n&&n.byteLength||0,_.responseText.length);if(n=LT(n,Op(S,!0)),s=s||Dn(n),n.length<10||s&&n.length<s+2)return jo(_,()=>l(m,_,"",n));const w=zl(n);return w==="ts"&&n.length<188?jo(_,()=>l(m,_,"",n)):!w&&n.length<376?jo(_,()=>l(m,_,"",n)):l(null,_,w,n)},p=e({uri:i,beforeSend(m){m.overrideMimeType("text/plain; charset=x-user-defined"),m.addEventListener("progress",function({total:_,loaded:S}){return hl(m,null,{statusCode:m.status},u)})}},function(m,_){return hl(p,m,_,u)});return p},{EventTarget:ZE}=B,Yd=function(i,e){if(!Lg(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length)||!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t<i.segments.length;t++){const r=i.segments[t],n=e.segments[t];if(r.uri!==n.uri)return!1;if(!r.byterange&&!n.byterange)continue;const s=r.byterange,a=n.byterange;if(s&&!a||!s&&a||s.offset!==a.offset||s.length!==a.length)return!1}return!0},ew=(i,e,t,r)=>{const n=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${n}`},tw=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:n})=>{const s=E1(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:n});return Cg(s,e,ew),s},iw=(i,e)=>{rn(i,(t,r,n,s)=>{(!e.mediaGroups[r][n]||!(s in e.mediaGroups[r][n]))&&delete i.mediaGroups[r][n][s]})},rw=(i,e,t)=>{let r=!0,n=_e(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let s=0;s<e.playlists.length;s++){const a=e.playlists[s];if(a.sidx){const u=La(a.sidx);t&&t[u]&&t[u].sidx&&ql(a,t[u].sidx,a.sidx.resolvedUri)}const l=cl(n,a,Yd);l&&(n=l,r=!1)}return rn(e,(s,a,l,u)=>{if(s.playlists&&s.playlists.length){const p=s.playlists[0].id,m=cl(n,s.playlists[0],Yd);m&&(n=m,u in n.mediaGroups[a][l]||(n.mediaGroups[a][l][u]=s),n.mediaGroups[a][l][u].playlists[0]=n.playlists[p],r=!1)}}),iw(n,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:n},nw=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Qd=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const s=La(n);if(!e[s])break;const a=e[s].sidxInfo;nw(a,n)&&(t[s]=e[s])}}return t},sw=(i,e)=>{let t=Qd(i.playlists,e);return rn(i,(r,n,s,a)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;t=_e(t,Qd(l,e))}}),t};class ml extends ZE{constructor(e,t,r={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:s=!1}=r;if(this.vhs_=t,this.withCredentials=s,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=jt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const n=e.sidx&&La(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>r(!1),0);return}const s=fa(e.sidx.resolvedUri),a=(u,p)=>{if(this.requestErrored_(u,p,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=p;let S;try{S=x1(ne(p.response).subarray(8))}catch(w){w.metadata=ar({requestType:_,request:p,parseFailure:!0}),this.requestErrored_(w,p,t);return}return m[n]={sidxInfo:e.sidx,sidx:S},ql(e,S,e.sidx.resolvedUri),r(!0)},l="dash-sidx";this.request=JE(s,this.vhs_.xhr,(u,p,m,_)=>{if(u)return a(u,p);if(!m||m!=="mp4"){const C=m||"unknown";return a({status:p.status,message:`Unsupported ${C} container type for sidx segment at URL: ${s}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},p)}const{offset:S,length:w}=e.sidx.byterange;if(_.length>=w+S)return a(u,{response:_.subarray(S,S+w),status:p.status,uri:p.uri});this.request=this.vhs_.xhr({uri:s,responseType:"arraybuffer",requestType:"dash-sidx",headers:pl({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},x.clearTimeout(this.minimumUpdatePeriodTimeout_),x.clearTimeout(this.mediaRequest_),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(x.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,x.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=x.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=x.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(r,n)=>{if(r){const{requestType:a}=n;r.metadata=ar({requestType:a,request:n,error:r})}if(this.requestErrored_(r,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const s=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=fa(this.mainPlaylistLoader_.srcUrl,n),s){this.handleMain_(),this.syncClientServerClock_(()=>e(n,s));return}return e(n,s)})}syncClientServerClock_(e){const t=w1(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:vt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,n)=>{if(!this.request)return;if(r){const{requestType:a}=n;return this.error.metadata=ar({requestType:a,request:n,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let s;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?s=this.mainLoaded_:s=Date.parse(n.responseHeaders.date):s=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=s-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){x.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let r;try{r=tw({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(s){this.error=s,this.error.metadata={errorType:B.Error.StreamingDashManifestParserError,error:s},this.trigger("error")}e&&(r=rw(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:s,endList:a}=r,l=[];r.playlists.forEach(p=>{l.push({id:p.id,bandwidth:p.attributes.BANDWIDTH,resolution:p.attributes.RESOLUTION,codecs:p.attributes.CODECS})});const u={duration:s,isLive:!a,renditions:l};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(x.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=x.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{t&&(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=sw(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=x.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},dl(this.media(),!!r)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const n=e.contentProtection[r].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var Je={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const aw=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer},Mg=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},ow=function(i){try{return URL.createObjectURL(new Blob([i],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(i),URL.createObjectURL(e.getBlob())}},Bg=function(i){return function(){const e=ow(i),t=Mg(new Worker(e));t.objURL=e;const r=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),r.call(this)},t}},Fg=function(i){return`var browserWorkerPolyFill = ${Mg.toString()};
|
|
195
195
|
browserWorkerPolyFill(self);
|
|
196
|
-
`+i},Rm=function(i){return i.toString().replace(/^function.+?{/,"").slice(0,-1)},GE=Pm(Rm(function(){var i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ys<"u"?Ys:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(c,d){o[c]||(o[c]=[]),o[c]=o[c].concat(d)},this.off=function(c,d){var h;return o[c]?(h=o[c].indexOf(d),o[c]=o[c].slice(),o[c].splice(h,1),h>-1):!1},this.trigger=function(c){var d,h,f,y;if(d=o[c],!!d)if(arguments.length===2)for(f=d.length,h=0;h<f;++h)d[h].call(this,arguments[1]);else{for(y=[],h=arguments.length,h=1;h<arguments.length;++h)y.push(arguments[h]);for(f=d.length,h=0;h<f;++h)d[h].apply(this,y)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(c){o.push(c)}),this.on("done",function(c){o.flush(c)}),this.on("partialdone",function(c){o.partialFlush(c)}),this.on("endedtimeline",function(c){o.endTimeline(c)}),this.on("reset",function(c){o.reset(c)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,r=Math.pow(2,32),n=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d;return c.getBigUint64?(d=c.getBigUint64(0),d<Number.MAX_SAFE_INTEGER?Number(d):d):c.getUint32(0)*r+c.getUint32(4)},s={getUint64:n,MAX_UINT32:r},a=s.MAX_UINT32,l,u,p,g,b,S,w,C,v,D,L,O,U,F,N,V,J,Y,ie,pe,le,ge,ee,ce,ne,he,we,ze,dt,Ot,ht,Ut,Vt,xe,Fe,oi;(function(){var o;if(ee={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in ee)ee.hasOwnProperty(o)&&(ee[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);ce=new Uint8Array([105,115,111,109]),he=new Uint8Array([97,118,99,49]),ne=new Uint8Array([0,0,0,1]),we=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]),ze=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]),dt={video:we,audio:ze},Ut=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ht=new Uint8Array([0,0,0,0,0,0,0,0]),Vt=new Uint8Array([0,0,0,0,0,0,0,0]),xe=Vt,Fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),oi=Vt,Ot=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),l=function(o){var c=[],d=0,h,f,y;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)d+=c[h].byteLength;for(f=new Uint8Array(d+8),y=new DataView(f.buffer,f.byteOffset,f.byteLength),y.setUint32(0,f.byteLength),f.set(o,4),h=0,d=8;h<c.length;h++)f.set(c[h],d),d+=c[h].byteLength;return f},u=function(){return l(ee.dinf,l(ee.dref,Ut))},p=function(o){return l(ee.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},g=function(){return l(ee.ftyp,ce,ne,ce,he)},V=function(o){return l(ee.hdlr,dt[o])},b=function(o){return l(ee.mdat,o)},N=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(c[12]=o.samplerate>>>24&255,c[13]=o.samplerate>>>16&255,c[14]=o.samplerate>>>8&255,c[15]=o.samplerate&255),l(ee.mdhd,c)},F=function(o){return l(ee.mdia,N(o),V(o.type),w(o))},S=function(o){return l(ee.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},w=function(o){return l(ee.minf,o.type==="video"?l(ee.vmhd,Ot):l(ee.smhd,ht),u(),Y(o))},C=function(o,c){for(var d=[],h=c.length;h--;)d[h]=pe(c[h]);return l.apply(null,[ee.moof,S(o)].concat(d))},v=function(o){for(var c=o.length,d=[];c--;)d[c]=O(o[c]);return l.apply(null,[ee.moov,L(4294967295)].concat(d).concat(D(o)))},D=function(o){for(var c=o.length,d=[];c--;)d[c]=le(o[c]);return l.apply(null,[ee.mvex].concat(d))},L=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&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 l(ee.mvhd,c)},J=function(o){var c=o.samples||[],d=new Uint8Array(4+c.length),h,f;for(f=0;f<c.length;f++)h=c[f].flags,d[f+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return l(ee.sdtp,d)},Y=function(o){return l(ee.stbl,ie(o),l(ee.stts,oi),l(ee.stsc,xe),l(ee.stsz,Fe),l(ee.stco,Vt))},function(){var o,c;ie=function(d){return l(ee.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),d.type==="video"?o(d):c(d))},o=function(d){var h=d.sps||[],f=d.pps||[],y=[],E=[],k,I;for(k=0;k<h.length;k++)y.push((h[k].byteLength&65280)>>>8),y.push(h[k].byteLength&255),y=y.concat(Array.prototype.slice.call(h[k]));for(k=0;k<f.length;k++)E.push((f[k].byteLength&65280)>>>8),E.push(f[k].byteLength&255),E=E.concat(Array.prototype.slice.call(f[k]));if(I=[ee.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,(d.width&65280)>>8,d.width&255,(d.height&65280)>>8,d.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(ee.avcC,new Uint8Array([1,d.profileIdc,d.profileCompatibility,d.levelIdc,255].concat([h.length],y,[f.length],E))),l(ee.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],d.sarRatio){var A=d.sarRatio[0],R=d.sarRatio[1];I.push(l(ee.pasp,new Uint8Array([(A&4278190080)>>24,(A&16711680)>>16,(A&65280)>>8,A&255,(R&4278190080)>>24,(R&16711680)>>16,(R&65280)>>8,R&255])))}return l.apply(null,I)},c=function(d){return l(ee.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(d.channelcount&65280)>>8,d.channelcount&255,(d.samplesize&65280)>>8,d.samplesize&255,0,0,0,0,(d.samplerate&65280)>>8,d.samplerate&255,0,0]),p(d))}}(),U=function(o){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return l(ee.tkhd,c)},pe=function(o){var c,d,h,f,y,E,k;return c=l(ee.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(o.baseMediaDecodeTime/a),k=Math.floor(o.baseMediaDecodeTime%a),d=l(ee.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255])),y=92,o.type==="audio"?(h=ge(o,y),l(ee.traf,c,d,h)):(f=J(o),h=ge(o,f.length+y),l(ee.traf,c,d,h,f))},O=function(o){return o.duration=o.duration||4294967295,l(ee.trak,U(o),F(o))},le=function(o){var c=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(c[c.length-1]=0),l(ee.trex,c)},function(){var o,c,d;d=function(h,f){var y=0,E=0,k=0,I=0;return h.length&&(h[0].duration!==void 0&&(y=1),h[0].size!==void 0&&(E=2),h[0].flags!==void 0&&(k=4),h[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,y|E|k|I,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(f&4278190080)>>>24,(f&16711680)>>>16,(f&65280)>>>8,f&255]},c=function(h,f){var y,E,k,I,A,R;for(I=h.samples||[],f+=20+16*I.length,k=d(I,f),E=new Uint8Array(k.length+I.length*16),E.set(k),y=k.length,R=0;R<I.length;R++)A=I[R],E[y++]=(A.duration&4278190080)>>>24,E[y++]=(A.duration&16711680)>>>16,E[y++]=(A.duration&65280)>>>8,E[y++]=A.duration&255,E[y++]=(A.size&4278190080)>>>24,E[y++]=(A.size&16711680)>>>16,E[y++]=(A.size&65280)>>>8,E[y++]=A.size&255,E[y++]=A.flags.isLeading<<2|A.flags.dependsOn,E[y++]=A.flags.isDependedOn<<6|A.flags.hasRedundancy<<4|A.flags.paddingValue<<1|A.flags.isNonSyncSample,E[y++]=A.flags.degradationPriority&61440,E[y++]=A.flags.degradationPriority&15,E[y++]=(A.compositionTimeOffset&4278190080)>>>24,E[y++]=(A.compositionTimeOffset&16711680)>>>16,E[y++]=(A.compositionTimeOffset&65280)>>>8,E[y++]=A.compositionTimeOffset&255;return l(ee.trun,E)},o=function(h,f){var y,E,k,I,A,R;for(I=h.samples||[],f+=20+8*I.length,k=d(I,f),y=new Uint8Array(k.length+I.length*8),y.set(k),E=k.length,R=0;R<I.length;R++)A=I[R],y[E++]=(A.duration&4278190080)>>>24,y[E++]=(A.duration&16711680)>>>16,y[E++]=(A.duration&65280)>>>8,y[E++]=A.duration&255,y[E++]=(A.size&4278190080)>>>24,y[E++]=(A.size&16711680)>>>16,y[E++]=(A.size&65280)>>>8,y[E++]=A.size&255;return l(ee.trun,y)},ge=function(h,f){return h.type==="audio"?o(h,f):c(h,f)}}();var Fi={ftyp:g,mdat:b,moof:C,moov:v,initSegment:function(o){var c=g(),d=v(o),h;return h=new Uint8Array(c.byteLength+d.byteLength),h.set(c),h.set(d,c.byteLength),h}},li=function(o){var c,d,h=[],f=[];for(f.byteLength=0,f.nalCount=0,f.duration=0,h.byteLength=0,c=0;c<o.length;c++)d=o[c],d.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=d.dts-h.dts,f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h)),h=[d],h.byteLength=d.data.byteLength,h.pts=d.pts,h.dts=d.dts):(d.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=d.dts-h.dts,h.byteLength+=d.data.byteLength,h.push(d));return f.length&&(!h.duration||h.duration<=0)&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h),f},Ht=function(o){var c,d,h=[],f=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=o[0].pts,h.dts=o[0].dts,f.byteLength=0,f.nalCount=0,f.duration=0,f.pts=o[0].pts,f.dts=o[0].dts,c=0;c<o.length;c++)d=o[c],d.keyFrame?(h.length&&(f.push(h),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration),h=[d],h.nalCount=d.length,h.byteLength=d.byteLength,h.pts=d.pts,h.dts=d.dts,h.duration=d.duration):(h.duration+=d.duration,h.nalCount+=d.length,h.byteLength+=d.byteLength,h.push(d));return f.length&&h.duration<=0&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration,f.push(h),f},Ti=function(o){var c;return!o[0][0].keyFrame&&o.length>1&&(c=o.shift(),o.byteLength-=c.byteLength,o.nalCount-=c.nalCount,o[0][0].dts=c.dts,o[0][0].pts=c.pts,o[0][0].duration+=c.duration),o},Si=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ar=function(o,c){var d=Si();return d.dataOffset=c,d.compositionTimeOffset=o.pts-o.dts,d.duration=o.duration,d.size=4*o.length,d.size+=o.byteLength,o.keyFrame&&(d.flags.dependsOn=2,d.flags.isNonSyncSample=0),d},is=function(o,c){var d,h,f,y,E,k=c||0,I=[];for(d=0;d<o.length;d++)for(y=o[d],h=0;h<y.length;h++)E=y[h],f=ar(E,k),k+=f.size,I.push(f);return I},Xa=function(o){var c,d,h,f,y,E,k=0,I=o.byteLength,A=o.nalCount,R=I+4*A,q=new Uint8Array(R),Q=new DataView(q.buffer);for(c=0;c<o.length;c++)for(f=o[c],d=0;d<f.length;d++)for(y=f[d],h=0;h<y.length;h++)E=y[h],Q.setUint32(k,E.data.byteLength),k+=4,q.set(E.data,k),k+=E.data.byteLength;return q},rs=function(o,c){var d,h=c||0,f=[];return d=ar(o,h),f.push(d),f},Ei=function(o){var c,d,h=0,f=o.byteLength,y=o.length,E=f+4*y,k=new Uint8Array(E),I=new DataView(k.buffer);for(c=0;c<o.length;c++)d=o[c],I.setUint32(h,d.data.byteLength),h+=4,k.set(d.data,h),h+=d.data.byteLength;return k},ji={groupNalsIntoFrames:li,groupFramesIntoGops:Ht,extendFirstKeyFrame:Ti,generateSampleTable:is,concatenateNalData:Xa,generateSampleTableForFrame:rs,concatenateNalDataForFrame:Ei},zt=[33,16,5,32,164,27],Zr=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],me=function(o){for(var c=[];o--;)c.push(0);return c},Ka=function(o){return Object.keys(o).reduce(function(c,d){return c[d]=new Uint8Array(o[d].reduce(function(h,f){return h.concat(f)},[])),c},{})},en,ns=function(){if(!en){var o={96e3:[zt,[227,64],me(154),[56]],88200:[zt,[231],me(170),[56]],64e3:[zt,[248,192],me(240),[56]],48e3:[zt,[255,192],me(268),[55,148,128],me(54),[112]],44100:[zt,[255,192],me(268),[55,163,128],me(84),[112]],32e3:[zt,[255,192],me(268),[55,234],me(226),[112]],24e3:[zt,[255,192],me(268),[55,255,128],me(268),[111,112],me(126),[224]],16e3:[zt,[255,192],me(268),[55,255,128],me(268),[111,255],me(269),[223,108],me(195),[1,192]],12e3:[Zr,me(268),[3,127,248],me(268),[6,255,240],me(268),[13,255,224],me(268),[27,253,128],me(259),[56]],11025:[Zr,me(268),[3,127,248],me(268),[6,255,240],me(268),[13,255,224],me(268),[27,255,192],me(268),[55,175,128],me(108),[112]],8e3:[Zr,me(268),[3,121,16],me(47),[7]]};en=Ka(o)}return en},wi=9e4,pt,qi,or,It,ss,m,_;pt=function(o){return o*wi},qi=function(o,c){return o*c},or=function(o){return o/wi},It=function(o,c){return o/c},ss=function(o,c){return pt(It(o,c))},m=function(o,c){return qi(or(o),c)},_=function(o,c,d){return or(d?o:o-c)};var T={ONE_SECOND_IN_TS:wi,secondsToVideoTs:pt,secondsToAudioTs:qi,videoTsToSeconds:or,audioTsToSeconds:It,audioTsToVideoTs:ss,videoTsToAudioTs:m,metadataTsToSeconds:_},P=ns,M=T,H=function(o){var c,d,h=0;for(c=0;c<o.length;c++)d=o[c],h+=d.data.byteLength;return h},K=function(o,c,d,h){var f,y=0,E=0,k=0,I=0,A,R,q;if(c.length&&(f=M.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),y=Math.ceil(M.ONE_SECOND_IN_TS/(o.samplerate/1024)),d&&h&&(E=f-Math.max(d,h),k=Math.floor(E/y),I=k*y),!(k<1||I>M.ONE_SECOND_IN_TS/2))){for(A=P()[o.samplerate],A||(A=c[0].data),R=0;R<k;R++)q=c[0],c.splice(0,0,{data:A,dts:q.dts-y,pts:q.pts-y});return o.baseMediaDecodeTime-=Math.floor(M.videoTsToAudioTs(I,o.samplerate)),I}},Te=function(o,c,d){return c.minSegmentDts>=d?o:(c.minSegmentDts=1/0,o.filter(function(h){return h.dts>=d?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},We=function(o){var c,d,h=[];for(c=0;c<o.length;c++)d=o[c],h.push({size:d.data.byteLength,duration:1024});return h},ke=function(o){var c,d,h=0,f=new Uint8Array(H(o));for(c=0;c<o.length;c++)d=o[c],f.set(d.data,h),h+=d.data.byteLength;return f},be={prefixWithSilence:K,trimAdtsFramesByEarliestDts:Te,generateSampleTable:We,concatenateFrameData:ke},Ue=T.ONE_SECOND_IN_TS,cf=function(o,c){typeof c.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=c.pts),o.minSegmentPts===void 0?o.minSegmentPts=c.pts:o.minSegmentPts=Math.min(o.minSegmentPts,c.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=c.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=c.dts),o.minSegmentDts===void 0?o.minSegmentDts=c.dts:o.minSegmentDts=Math.min(o.minSegmentDts,c.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=c.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,c.dts))},df=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},hf=function(o,c){var d,h,f=o.minSegmentDts;return c||(f-=o.timelineStartInfo.dts),d=o.timelineStartInfo.baseMediaDecodeTime,d+=f,d=Math.max(0,d),o.type==="audio"&&(h=o.samplerate/Ue,d*=h,d=Math.floor(d)),d},pf={clearDtsInfo:df,calculateTrackBaseMediaDecodeTime:hf,collectDtsInfo:cf},Cu=4,gf=128,mf=function(o){for(var c=0,d={payloadType:-1,payloadSize:0},h=0,f=0;c<o.byteLength&&o[c]!==gf;){for(;o[c]===255;)h+=255,c++;for(h+=o[c++];o[c]===255;)f+=255,c++;if(f+=o[c++],!d.payload&&h===Cu){var y=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(y==="GA94"){d.payloadType=h,d.payloadSize=f,d.payload=o.subarray(c,c+f);break}else d.payload=void 0}c+=f,h=0,f=0}return d},ff=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},yf=function(o,c){var d=[],h,f,y,E;if(!(c[0]&64))return d;for(f=c[0]&31,h=0;h<f;h++)y=h*3,E={type:c[y+2]&3,pts:o},c[y+2]&4&&(E.ccData=c[y+3]<<8|c[y+4],d.push(E));return d},_f=function(o){for(var c=o.byteLength,d=[],h=1,f,y;h<c-2;)o[h]===0&&o[h+1]===0&&o[h+2]===3?(d.push(h+2),h+=2):h++;if(d.length===0)return o;f=c-d.length,y=new Uint8Array(f);var E=0;for(h=0;h<f;E++,h++)E===d[0]&&(E++,d.shift()),y[h]=o[E];return y},Iu={parseSei:mf,parseUserData:ff,parseCaptionPackets:yf,discardEmulationPreventionBytes:_f,USER_DATA_REGISTERED_ITU_T_T35:Cu},Ya=t,as=Iu,gt=function(o){o=o||{},gt.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Le(0,0),new Le(0,1),new Le(1,0),new Le(1,1)],this.parse708captions_&&(this.cc708Stream_=new Se({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};gt.prototype=new Ya,gt.prototype.push=function(o){var c,d,h;if(o.nalUnitType==="sei_rbsp"&&(c=as.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===as.USER_DATA_REGISTERED_ITU_T_T35&&(d=as.parseUserData(c),!!d))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=as.parseCaptionPackets(o.pts,d),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},gt.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},gt.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(c,d){c.presortIndex=d}),this.captionPackets_.sort(function(c,d){return c.pts===d.pts?c.presortIndex-d.presortIndex:c.pts-d.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},gt.prototype.flush=function(){return this.flushStream("flush")},gt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},gt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},gt.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},gt.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},gt.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},gt.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},gt.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var bf={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},vf=function(o){var c=bf[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},os=function(o){return 32<=o&&o<=127||160<=o&&o<=255},ui=function(o){this.windowNum=o,this.reset()};ui.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},ui.prototype.getText=function(){return this.rows.join(`
|
|
197
|
-
`)},
|
|
196
|
+
`+i},jg=function(i){return i.toString().replace(/^function.+?{/,"").slice(0,-1)},lw=Fg(jg(function(){var i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Js<"u"?Js:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(c,d){o[c]||(o[c]=[]),o[c]=o[c].concat(d)},this.off=function(c,d){var h;return o[c]?(h=o[c].indexOf(d),o[c]=o[c].slice(),o[c].splice(h,1),h>-1):!1},this.trigger=function(c){var d,h,f,y;if(d=o[c],!!d)if(arguments.length===2)for(f=d.length,h=0;h<f;++h)d[h].call(this,arguments[1]);else{for(y=[],h=arguments.length,h=1;h<arguments.length;++h)y.push(arguments[h]);for(f=d.length,h=0;h<f;++h)d[h].apply(this,y)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(c){o.push(c)}),this.on("done",function(c){o.flush(c)}),this.on("partialdone",function(c){o.partialFlush(c)}),this.on("endedtimeline",function(c){o.endTimeline(c)}),this.on("reset",function(c){o.reset(c)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,r=Math.pow(2,32),n=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d;return c.getBigUint64?(d=c.getBigUint64(0),d<Number.MAX_SAFE_INTEGER?Number(d):d):c.getUint32(0)*r+c.getUint32(4)},s={getUint64:n,MAX_UINT32:r},a=s.MAX_UINT32,l,u,p,m,_,S,w,C,v,L,D,O,U,F,R,q,J,Y,ie,me,oe,ge,ee,ue,te,de,be,je,Ye,ve,ye,kt,Pt,Ae,pe,$e;(function(){var o;if(ee={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in ee)ee.hasOwnProperty(o)&&(ee[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);ue=new Uint8Array([105,115,111,109]),de=new Uint8Array([97,118,99,49]),te=new Uint8Array([0,0,0,1]),be=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]),je=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]),Ye={video:be,audio:je},kt=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ye=new Uint8Array([0,0,0,0,0,0,0,0]),Pt=new Uint8Array([0,0,0,0,0,0,0,0]),Ae=Pt,pe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),$e=Pt,ve=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),l=function(o){var c=[],d=0,h,f,y;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)d+=c[h].byteLength;for(f=new Uint8Array(d+8),y=new DataView(f.buffer,f.byteOffset,f.byteLength),y.setUint32(0,f.byteLength),f.set(o,4),h=0,d=8;h<c.length;h++)f.set(c[h],d),d+=c[h].byteLength;return f},u=function(){return l(ee.dinf,l(ee.dref,kt))},p=function(o){return l(ee.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},m=function(){return l(ee.ftyp,ue,te,ue,de)},q=function(o){return l(ee.hdlr,Ye[o])},_=function(o){return l(ee.mdat,o)},R=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(c[12]=o.samplerate>>>24&255,c[13]=o.samplerate>>>16&255,c[14]=o.samplerate>>>8&255,c[15]=o.samplerate&255),l(ee.mdhd,c)},F=function(o){return l(ee.mdia,R(o),q(o.type),w(o))},S=function(o){return l(ee.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},w=function(o){return l(ee.minf,o.type==="video"?l(ee.vmhd,ve):l(ee.smhd,ye),u(),Y(o))},C=function(o,c){for(var d=[],h=c.length;h--;)d[h]=me(c[h]);return l.apply(null,[ee.moof,S(o)].concat(d))},v=function(o){for(var c=o.length,d=[];c--;)d[c]=O(o[c]);return l.apply(null,[ee.moov,D(4294967295)].concat(d).concat(L(o)))},L=function(o){for(var c=o.length,d=[];c--;)d[c]=oe(o[c]);return l.apply(null,[ee.mvex].concat(d))},D=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&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 l(ee.mvhd,c)},J=function(o){var c=o.samples||[],d=new Uint8Array(4+c.length),h,f;for(f=0;f<c.length;f++)h=c[f].flags,d[f+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return l(ee.sdtp,d)},Y=function(o){return l(ee.stbl,ie(o),l(ee.stts,$e),l(ee.stsc,Ae),l(ee.stsz,pe),l(ee.stco,Pt))},function(){var o,c;ie=function(d){return l(ee.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),d.type==="video"?o(d):c(d))},o=function(d){var h=d.sps||[],f=d.pps||[],y=[],E=[],k,I;for(k=0;k<h.length;k++)y.push((h[k].byteLength&65280)>>>8),y.push(h[k].byteLength&255),y=y.concat(Array.prototype.slice.call(h[k]));for(k=0;k<f.length;k++)E.push((f[k].byteLength&65280)>>>8),E.push(f[k].byteLength&255),E=E.concat(Array.prototype.slice.call(f[k]));if(I=[ee.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,(d.width&65280)>>8,d.width&255,(d.height&65280)>>8,d.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l(ee.avcC,new Uint8Array([1,d.profileIdc,d.profileCompatibility,d.levelIdc,255].concat([h.length],y,[f.length],E))),l(ee.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],d.sarRatio){var A=d.sarRatio[0],N=d.sarRatio[1];I.push(l(ee.pasp,new Uint8Array([(A&4278190080)>>24,(A&16711680)>>16,(A&65280)>>8,A&255,(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255])))}return l.apply(null,I)},c=function(d){return l(ee.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(d.channelcount&65280)>>8,d.channelcount&255,(d.samplesize&65280)>>8,d.samplesize&255,0,0,0,0,(d.samplerate&65280)>>8,d.samplerate&255,0,0]),p(d))}}(),U=function(o){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return l(ee.tkhd,c)},me=function(o){var c,d,h,f,y,E,k;return c=l(ee.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(o.baseMediaDecodeTime/a),k=Math.floor(o.baseMediaDecodeTime%a),d=l(ee.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255])),y=92,o.type==="audio"?(h=ge(o,y),l(ee.traf,c,d,h)):(f=J(o),h=ge(o,f.length+y),l(ee.traf,c,d,h,f))},O=function(o){return o.duration=o.duration||4294967295,l(ee.trak,U(o),F(o))},oe=function(o){var c=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(c[c.length-1]=0),l(ee.trex,c)},function(){var o,c,d;d=function(h,f){var y=0,E=0,k=0,I=0;return h.length&&(h[0].duration!==void 0&&(y=1),h[0].size!==void 0&&(E=2),h[0].flags!==void 0&&(k=4),h[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,y|E|k|I,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(f&4278190080)>>>24,(f&16711680)>>>16,(f&65280)>>>8,f&255]},c=function(h,f){var y,E,k,I,A,N;for(I=h.samples||[],f+=20+16*I.length,k=d(I,f),E=new Uint8Array(k.length+I.length*16),E.set(k),y=k.length,N=0;N<I.length;N++)A=I[N],E[y++]=(A.duration&4278190080)>>>24,E[y++]=(A.duration&16711680)>>>16,E[y++]=(A.duration&65280)>>>8,E[y++]=A.duration&255,E[y++]=(A.size&4278190080)>>>24,E[y++]=(A.size&16711680)>>>16,E[y++]=(A.size&65280)>>>8,E[y++]=A.size&255,E[y++]=A.flags.isLeading<<2|A.flags.dependsOn,E[y++]=A.flags.isDependedOn<<6|A.flags.hasRedundancy<<4|A.flags.paddingValue<<1|A.flags.isNonSyncSample,E[y++]=A.flags.degradationPriority&61440,E[y++]=A.flags.degradationPriority&15,E[y++]=(A.compositionTimeOffset&4278190080)>>>24,E[y++]=(A.compositionTimeOffset&16711680)>>>16,E[y++]=(A.compositionTimeOffset&65280)>>>8,E[y++]=A.compositionTimeOffset&255;return l(ee.trun,E)},o=function(h,f){var y,E,k,I,A,N;for(I=h.samples||[],f+=20+8*I.length,k=d(I,f),y=new Uint8Array(k.length+I.length*8),y.set(k),E=k.length,N=0;N<I.length;N++)A=I[N],y[E++]=(A.duration&4278190080)>>>24,y[E++]=(A.duration&16711680)>>>16,y[E++]=(A.duration&65280)>>>8,y[E++]=A.duration&255,y[E++]=(A.size&4278190080)>>>24,y[E++]=(A.size&16711680)>>>16,y[E++]=(A.size&65280)>>>8,y[E++]=A.size&255;return l(ee.trun,y)},ge=function(h,f){return h.type==="audio"?o(h,f):c(h,f)}}();var cr={ftyp:m,mdat:_,moof:C,moov:v,initSegment:function(o){var c=m(),d=v(o),h;return h=new Uint8Array(c.byteLength+d.byteLength),h.set(c),h.set(d,c.byteLength),h}},wi=function(o){var c,d,h=[],f=[];for(f.byteLength=0,f.nalCount=0,f.duration=0,h.byteLength=0,c=0;c<o.length;c++)d=o[c],d.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=d.dts-h.dts,f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h)),h=[d],h.byteLength=d.data.byteLength,h.pts=d.pts,h.dts=d.dts):(d.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=d.dts-h.dts,h.byteLength+=d.data.byteLength,h.push(d));return f.length&&(!h.duration||h.duration<=0)&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.length,f.duration+=h.duration,f.push(h),f},ki=function(o){var c,d,h=[],f=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=o[0].pts,h.dts=o[0].dts,f.byteLength=0,f.nalCount=0,f.duration=0,f.pts=o[0].pts,f.dts=o[0].dts,c=0;c<o.length;c++)d=o[c],d.keyFrame?(h.length&&(f.push(h),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration),h=[d],h.nalCount=d.length,h.byteLength=d.byteLength,h.pts=d.pts,h.dts=d.dts,h.duration=d.duration):(h.duration+=d.duration,h.nalCount+=d.length,h.byteLength+=d.byteLength,h.push(d));return f.length&&h.duration<=0&&(h.duration=f[f.length-1].duration),f.byteLength+=h.byteLength,f.nalCount+=h.nalCount,f.duration+=h.duration,f.push(h),f},qi=function(o){var c;return!o[0][0].keyFrame&&o.length>1&&(c=o.shift(),o.byteLength-=c.byteLength,o.nalCount-=c.nalCount,o[0][0].dts=c.dts,o[0][0].pts=c.pts,o[0][0].duration+=c.duration),o},Ct=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ci=function(o,c){var d=Ct();return d.dataOffset=c,d.compositionTimeOffset=o.pts-o.dts,d.duration=o.duration,d.size=4*o.length,d.size+=o.byteLength,o.keyFrame&&(d.flags.dependsOn=2,d.flags.isNonSyncSample=0),d},Kt=function(o,c){var d,h,f,y,E,k=c||0,I=[];for(d=0;d<o.length;d++)for(y=o[d],h=0;h<y.length;h++)E=y[h],f=Ci(E,k),k+=f.size,I.push(f);return I},Vi=function(o){var c,d,h,f,y,E,k=0,I=o.byteLength,A=o.nalCount,N=I+4*A,$=new Uint8Array(N),Q=new DataView($.buffer);for(c=0;c<o.length;c++)for(f=o[c],d=0;d<f.length;d++)for(y=f[d],h=0;h<y.length;h++)E=y[h],Q.setUint32(k,E.data.byteLength),k+=4,$.set(E.data,k),k+=E.data.byteLength;return $},$t=function(o,c){var d,h=c||0,f=[];return d=Ci(o,h),f.push(d),f},qt=function(o){var c,d,h=0,f=o.byteLength,y=o.length,E=f+4*y,k=new Uint8Array(E),I=new DataView(k.buffer);for(c=0;c<o.length;c++)d=o[c],I.setUint32(h,d.data.byteLength),h+=4,k.set(d.data,h),h+=d.data.byteLength;return k},Hi={groupNalsIntoFrames:wi,groupFramesIntoGops:ki,extendFirstKeyFrame:qi,generateSampleTable:Kt,concatenateNalData:Vi,generateSampleTableForFrame:$t,concatenateNalDataForFrame:qt},Yt=[33,16,5,32,164,27],nn=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],fe=function(o){for(var c=[];o--;)c.push(0);return c},Ya=function(o){return Object.keys(o).reduce(function(c,d){return c[d]=new Uint8Array(o[d].reduce(function(h,f){return h.concat(f)},[])),c},{})},sn,as=function(){if(!sn){var o={96e3:[Yt,[227,64],fe(154),[56]],88200:[Yt,[231],fe(170),[56]],64e3:[Yt,[248,192],fe(240),[56]],48e3:[Yt,[255,192],fe(268),[55,148,128],fe(54),[112]],44100:[Yt,[255,192],fe(268),[55,163,128],fe(84),[112]],32e3:[Yt,[255,192],fe(268),[55,234],fe(226),[112]],24e3:[Yt,[255,192],fe(268),[55,255,128],fe(268),[111,112],fe(126),[224]],16e3:[Yt,[255,192],fe(268),[55,255,128],fe(268),[111,255],fe(269),[223,108],fe(195),[1,192]],12e3:[nn,fe(268),[3,127,248],fe(268),[6,255,240],fe(268),[13,255,224],fe(268),[27,253,128],fe(259),[56]],11025:[nn,fe(268),[3,127,248],fe(268),[6,255,240],fe(268),[13,255,224],fe(268),[27,255,192],fe(268),[55,175,128],fe(108),[112]],8e3:[nn,fe(268),[3,121,16],fe(47),[7]]};sn=Ya(o)}return sn},Ii=9e4,gt,zi,dr,Rt,os,g,b;gt=function(o){return o*Ii},zi=function(o,c){return o*c},dr=function(o){return o/Ii},Rt=function(o,c){return o/c},os=function(o,c){return gt(Rt(o,c))},g=function(o,c){return zi(dr(o),c)},b=function(o,c,d){return dr(d?o:o-c)};var T={ONE_SECOND_IN_TS:Ii,secondsToVideoTs:gt,secondsToAudioTs:zi,videoTsToSeconds:dr,audioTsToSeconds:Rt,audioTsToVideoTs:os,videoTsToAudioTs:g,metadataTsToSeconds:b},P=as,M=T,V=function(o){var c,d,h=0;for(c=0;c<o.length;c++)d=o[c],h+=d.data.byteLength;return h},K=function(o,c,d,h){var f,y=0,E=0,k=0,I=0,A,N,$;if(c.length&&(f=M.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),y=Math.ceil(M.ONE_SECOND_IN_TS/(o.samplerate/1024)),d&&h&&(E=f-Math.max(d,h),k=Math.floor(E/y),I=k*y),!(k<1||I>M.ONE_SECOND_IN_TS/2))){for(A=P()[o.samplerate],A||(A=c[0].data),N=0;N<k;N++)$=c[0],c.splice(0,0,{data:A,dts:$.dts-y,pts:$.pts-y});return o.baseMediaDecodeTime-=Math.floor(M.videoTsToAudioTs(I,o.samplerate)),I}},ke=function(o,c,d){return c.minSegmentDts>=d?o:(c.minSegmentDts=1/0,o.filter(function(h){return h.dts>=d?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},Ke=function(o){var c,d,h=[];for(c=0;c<o.length;c++)d=o[c],h.push({size:d.data.byteLength,duration:1024});return h},xe=function(o){var c,d,h=0,f=new Uint8Array(V(o));for(c=0;c<o.length;c++)d=o[c],f.set(d.data,h),h+=d.data.byteLength;return f},Ee={prefixWithSilence:K,trimAdtsFramesByEarliestDts:ke,generateSampleTable:Ke,concatenateFrameData:xe},qe=T.ONE_SECOND_IN_TS,yf=function(o,c){typeof c.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=c.pts),o.minSegmentPts===void 0?o.minSegmentPts=c.pts:o.minSegmentPts=Math.min(o.minSegmentPts,c.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=c.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=c.dts),o.minSegmentDts===void 0?o.minSegmentDts=c.dts:o.minSegmentDts=Math.min(o.minSegmentDts,c.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=c.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,c.dts))},_f=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},bf=function(o,c){var d,h,f=o.minSegmentDts;return c||(f-=o.timelineStartInfo.dts),d=o.timelineStartInfo.baseMediaDecodeTime,d+=f,d=Math.max(0,d),o.type==="audio"&&(h=o.samplerate/qe,d*=h,d=Math.floor(d)),d},vf={clearDtsInfo:_f,calculateTrackBaseMediaDecodeTime:bf,collectDtsInfo:yf},Iu=4,Tf=128,Sf=function(o){for(var c=0,d={payloadType:-1,payloadSize:0},h=0,f=0;c<o.byteLength&&o[c]!==Tf;){for(;o[c]===255;)h+=255,c++;for(h+=o[c++];o[c]===255;)f+=255,c++;if(f+=o[c++],!d.payload&&h===Iu){var y=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(y==="GA94"){d.payloadType=h,d.payloadSize=f,d.payload=o.subarray(c,c+f);break}else d.payload=void 0}c+=f,h=0,f=0}return d},Ef=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},wf=function(o,c){var d=[],h,f,y,E;if(!(c[0]&64))return d;for(f=c[0]&31,h=0;h<f;h++)y=h*3,E={type:c[y+2]&3,pts:o},c[y+2]&4&&(E.ccData=c[y+3]<<8|c[y+4],d.push(E));return d},kf=function(o){for(var c=o.byteLength,d=[],h=1,f,y;h<c-2;)o[h]===0&&o[h+1]===0&&o[h+2]===3?(d.push(h+2),h+=2):h++;if(d.length===0)return o;f=c-d.length,y=new Uint8Array(f);var E=0;for(h=0;h<f;E++,h++)E===d[0]&&(E++,d.shift()),y[h]=o[E];return y},Au={parseSei:Sf,parseUserData:Ef,parseCaptionPackets:wf,discardEmulationPreventionBytes:kf,USER_DATA_REGISTERED_ITU_T_T35:Iu},Qa=t,ls=Au,ft=function(o){o=o||{},ft.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Re(0,0),new Re(0,1),new Re(1,0),new Re(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ce({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};ft.prototype=new Qa,ft.prototype.push=function(o){var c,d,h;if(o.nalUnitType==="sei_rbsp"&&(c=ls.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===ls.USER_DATA_REGISTERED_ITU_T_T35&&(d=ls.parseUserData(c),!!d))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=ls.parseCaptionPackets(o.pts,d),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},ft.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},ft.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(c,d){c.presortIndex=d}),this.captionPackets_.sort(function(c,d){return c.pts===d.pts?c.presortIndex-d.presortIndex:c.pts-d.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},ft.prototype.flush=function(){return this.flushStream("flush")},ft.prototype.partialFlush=function(){return this.flushStream("partialFlush")},ft.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},ft.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},ft.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},ft.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},ft.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},ft.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var Cf={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},If=function(o){var c=Cf[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},us=function(o){return 32<=o&&o<=127||160<=o&&o<=255},hi=function(o){this.windowNum=o,this.reset()};hi.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},hi.prototype.getText=function(){return this.rows.join(`
|
|
197
|
+
`)},hi.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},hi.prototype.newLine=function(o){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(o),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},hi.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},hi.prototype.addText=function(o){this.rows[this.rowIdx]+=o},hi.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var cs=function(o,c,d){this.serviceNum=o,this.text="",this.currentWindow=new hi(-1),this.windows=[],this.stream=d,typeof c=="string"&&this.createTextDecoder(c)};cs.prototype.init=function(o,c){this.startPts=o;for(var d=0;d<8;d++)this.windows[d]=new hi(d),typeof c=="function"&&(this.windows[d].beforeRowOverflow=c)},cs.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},cs.prototype.createTextDecoder=function(o){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(o)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+o+" encoding. "+c})}};var Ce=function(o){o=o||{},Ce.prototype.init.call(this);var c=this,d=o.captionServices||{},h={},f;Object.keys(d).forEach(y=>{f=d[y],/^SERVICE/.test(y)&&(h[y]=f.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(y){y.type===3?(c.new708Packet(),c.add708Bytes(y)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(y))}};Ce.prototype=new Qa,Ce.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ce.prototype.add708Bytes=function(o){var c=o.ccData,d=c>>>8,h=c&255;this.current708Packet.ptsVals.push(o.pts),this.current708Packet.data.push(d),this.current708Packet.data.push(h)},Ce.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,d=null,h=null,f=0,y=c[f++];for(o.seq=y>>6,o.sizeCode=y&63;f<c.length;f++)y=c[f++],d=y>>5,h=y&31,d===7&&h>0&&(y=c[f++],d=y),this.pushServiceBlock(d,f,h),h>0&&(f+=h-1)},Ce.prototype.pushServiceBlock=function(o,c,d){var h,f=c,y=this.current708Packet.data,E=this.services[o];for(E||(E=this.initService(o,f));f<c+d&&f<y.length;f++)h=y[f],us(h)?f=this.handleText(f,E):h===24?f=this.multiByteCharacter(f,E):h===16?f=this.extendedCommands(f,E):128<=h&&h<=135?f=this.setCurrentWindow(f,E):152<=h&&h<=159?f=this.defineWindow(f,E):h===136?f=this.clearWindows(f,E):h===140?f=this.deleteWindows(f,E):h===137?f=this.displayWindows(f,E):h===138?f=this.hideWindows(f,E):h===139?f=this.toggleWindows(f,E):h===151?f=this.setWindowAttributes(f,E):h===144?f=this.setPenAttributes(f,E):h===145?f=this.setPenColor(f,E):h===146?f=this.setPenLocation(f,E):h===143?E=this.reset(f,E):h===8?E.currentWindow.backspace():h===12?E.currentWindow.clearText():h===13?E.currentWindow.pendingNewLine=!0:h===14?E.currentWindow.clearText():h===141&&f++},Ce.prototype.extendedCommands=function(o,c){var d=this.current708Packet.data,h=d[++o];return us(h)&&(o=this.handleText(o,c,{isExtended:!0})),o},Ce.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Ce.prototype.initService=function(o,c){var h="SERVICE"+o,d=this,h,f;return h in this.serviceEncodings&&(f=this.serviceEncodings[h]),this.services[o]=new cs(o,f,d),this.services[o].init(this.getPts(c),function(y){d.flushDisplayed(y,d.services[o])}),this.services[o]},Ce.prototype.handleText=function(o,c,d){var h=d&&d.isExtended,f=d&&d.isMultiByte,y=this.current708Packet.data,E=h?4096:0,k=y[o],I=y[o+1],A=c.currentWindow,N,$;function Q(H){return H.map(re=>("0"+(re&255).toString(16)).slice(-2)).join("")}if(f?($=[k,I],o++):$=[k],c.textDecoder_&&!h)N=c.textDecoder_.decode(new Uint8Array($));else if(f){const H=Q($);N=String.fromCharCode(parseInt(H,16))}else N=If(E|k);return A.pendingNewLine&&!A.isEmpty()&&A.newLine(this.getPts(o)),A.pendingNewLine=!1,A.addText(N),o},Ce.prototype.multiByteCharacter=function(o,c){var d=this.current708Packet.data,h=d[o+1],f=d[o+2];return us(h)&&us(f)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},Ce.prototype.setCurrentWindow=function(o,c){var d=this.current708Packet.data,h=d[o],f=h&7;return c.setCurrentWindow(f),o},Ce.prototype.defineWindow=function(o,c){var d=this.current708Packet.data,h=d[o],f=h&7;c.setCurrentWindow(f);var y=c.currentWindow;return h=d[++o],y.visible=(h&32)>>5,y.rowLock=(h&16)>>4,y.columnLock=(h&8)>>3,y.priority=h&7,h=d[++o],y.relativePositioning=(h&128)>>7,y.anchorVertical=h&127,h=d[++o],y.anchorHorizontal=h,h=d[++o],y.anchorPoint=(h&240)>>4,y.rowCount=h&15,h=d[++o],y.columnCount=h&63,h=d[++o],y.windowStyle=(h&56)>>3,y.penStyle=h&7,y.virtualRowCount=y.rowCount+1,o},Ce.prototype.setWindowAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.winAttr;return h=d[++o],f.fillOpacity=(h&192)>>6,f.fillRed=(h&48)>>4,f.fillGreen=(h&12)>>2,f.fillBlue=h&3,h=d[++o],f.borderType=(h&192)>>6,f.borderRed=(h&48)>>4,f.borderGreen=(h&12)>>2,f.borderBlue=h&3,h=d[++o],f.borderType+=(h&128)>>5,f.wordWrap=(h&64)>>6,f.printDirection=(h&48)>>4,f.scrollDirection=(h&12)>>2,f.justify=h&3,h=d[++o],f.effectSpeed=(h&240)>>4,f.effectDirection=(h&12)>>2,f.displayEffect=h&3,o},Ce.prototype.flushDisplayed=function(o,c){for(var d=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&d.push(c.windows[h].getText());c.endPts=o,c.text=d.join(`
|
|
198
198
|
|
|
199
|
-
`),this.pushCaption(c),c.startPts=o},Se.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},Se.prototype.displayWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible=1);return o},Se.prototype.hideWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible=0);return o},Se.prototype.toggleWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible^=1);return o},Se.prototype.clearWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&c.windows[y].clearText();return o},Se.prototype.deleteWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&c.windows[y].reset();return o},Se.prototype.setPenAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penAttr;return h=d[++o],f.textTag=(h&240)>>4,f.offset=(h&12)>>2,f.penSize=h&3,h=d[++o],f.italics=(h&128)>>7,f.underline=(h&64)>>6,f.edgeType=(h&56)>>3,f.fontStyle=h&7,o},Se.prototype.setPenColor=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penColor;return h=d[++o],f.fgOpacity=(h&192)>>6,f.fgRed=(h&48)>>4,f.fgGreen=(h&12)>>2,f.fgBlue=h&3,h=d[++o],f.bgOpacity=(h&192)>>6,f.bgRed=(h&48)>>4,f.bgGreen=(h&12)>>2,f.bgBlue=h&3,h=d[++o],f.edgeRed=(h&48)>>4,f.edgeGreen=(h&12)>>2,f.edgeBlue=h&3,o},Se.prototype.setPenLocation=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=d[++o],f.row=h&15,h=d[++o],f.column=h&63,o},Se.prototype.reset=function(o,c){var d=this.getPts(o);return this.flushDisplayed(d,c),this.initService(c.serviceNum,o)};var Tf={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},us=function(o){return o===null?"":(o=Tf[o]||o,String.fromCharCode(o))},cs=14,Sf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],$i=function(){for(var o=[],c=cs+1;c--;)o.push({text:"",indent:0,offset:0});return o},Le=function(o,c){Le.prototype.init.call(this),this.field_=o||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(d){var h,f,y,E,k;if(h=d.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),y=h>>>8,E=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(d.pts),this.flushDisplayed(d.pts),f=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=f,this.startPts_=d.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(d.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(d.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(d.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(d.pts),this.flushDisplayed(d.pts),this.shiftRowsUp_(),this.startPts_=d.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(d.pts),this.displayed_=$i();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=$i();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(d.pts),this.displayed_=$i()),this.mode_="paintOn",this.startPts_=d.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,k=us(y|E),this[this.mode_](d.pts,k),this.column_++;else if(this.isExtCharacter(y,E))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),y=(y&3)<<8,k=us(y|E),this[this.mode_](d.pts,k),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(d.pts),this[this.mode_](d.pts," "),this.column_++,(E&14)===14&&this.addFormatting(d.pts,["i"]),(E&1)===1&&this.addFormatting(d.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const A=E&3;this.nonDisplayed_[this.row_].offset=A,this.column_+=A}else if(this.isPAC(y,E)){var I=Sf.indexOf(h&7968);if(this.mode_==="rollUp"&&(I-this.rollUpRows_+1<0&&(I=this.rollUpRows_-1),this.setRollUp(d.pts,I)),I!==this.row_&&I>=0&&I<=14&&(this.clearFormatting(d.pts),this.row_=I),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(d.pts,["u"]),(h&16)===16){const A=(h&14)>>1;this.column_=A*4,this.nonDisplayed_[this.row_].indent+=A}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(d.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),k=us(y),k+=us(E),this[this.mode_](d.pts,k),this.column_+=k.length)}};Le.prototype=new Ya,Le.prototype.flushDisplayed=function(o){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},d=[];this.displayed_.forEach((h,f)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(f)}h.text.length&&d.push({text:h.text,line:f+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(f)}),d.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:d,stream:this.name_})},Le.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=$i(),this.nonDisplayed_=$i(),this.lastControlCode_=null,this.column_=0,this.row_=cs,this.rollUpRows_=2,this.formatting_=[]},Le.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Le.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Le.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Le.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Le.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Le.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Le.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Le.prototype.isNormalChar=function(o){return o>=32&&o<=127},Le.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=cs,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=$i(),this.displayed_=$i()),c!==void 0&&c!==this.row_)for(var d=0;d<this.rollUpRows_;d++)this.displayed_[c-d]=this.displayed_[this.row_-d],this.displayed_[this.row_-d]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Le.prototype.addFormatting=function(o,c){this.formatting_=this.formatting_.concat(c);var d=c.reduce(function(h,f){return h+"<"+f+">"},"");this[this.mode_](o,d)},Le.prototype.clearFormatting=function(o){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(d,h){return d+"</"+h+">"},"");this.formatting_=[],this[this.mode_](o,c)}},Le.prototype.popOn=function(o,c){var d=this.nonDisplayed_[this.row_].text;d+=c,this.nonDisplayed_[this.row_].text=d},Le.prototype.rollUp=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d},Le.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<cs+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Le.prototype.paintOn=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d};var Au={CaptionStream:gt,Cea608Stream:Le,Cea708Stream:Se},ds={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ef=t,wf=8589934592,kf=4294967296,xu="shared",Qa=function(o,c){var d=1;for(o>c&&(d=-1);Math.abs(c-o)>kf;)o+=d*wf;return o},Ja=function(o){var c,d;Ja.prototype.init.call(this),this.type_=o||xu,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==xu&&h.type!==this.type_||(d===void 0&&(d=h.dts),h.dts=Qa(h.dts,d),h.pts=Qa(h.pts,d),c=h.dts,this.trigger("data",h))},this.flush=function(){d=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){d=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ja.prototype=new Ef;var Lu={TimestampRolloverStream:Ja,handleRollover:Qa},Cf=(o,c,d)=>{if(!o)return-1;for(var h=d;h<o.length;h++)if(o[h]===c)return h;return-1},If={typedArrayIndexOf:Cf},hs=If.typedArrayIndexOf,ps={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Du=function(o,c,d){var h,f="";for(h=c;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},tn=function(o,c,d){return decodeURIComponent(Du(o,c,d))},rn=function(o,c,d){return unescape(Du(o,c,d))},nn=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},sn={APIC:function(o){var c=1,d,h,f="-->";o.data[0]===ps.Utf8&&(d=hs(o.data,0,c),!(d<0)&&(o.mimeType=rn(o.data,c,d),c=d+1,o.pictureType=o.data[c],c++,h=hs(o.data,0,c),!(h<0)&&(o.description=tn(o.data,c,h),c=h+1,o.mimeType===f?o.url=rn(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===ps.Utf8&&(o.value=tn(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===ps.Utf8&&(c=hs(o.data,0,1),c!==-1&&(o.description=tn(o.data,1,c),o.value=tn(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=rn(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===ps.Utf8&&(c=hs(o.data,0,1),c!==-1&&(o.description=tn(o.data,1,c),o.url=rn(o.data,c+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var c;for(c=0;c<o.data.length;c++)if(o.data[c]===0){o.owner=rn(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},Af=function(o){var c,d,h=10,f=0,y=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){f=nn(o.subarray(6,10)),f+=10;var E=o[5]&64;E&&(h+=4,h+=nn(o.subarray(10,14)),f-=nn(o.subarray(16,20)));do{if(c=nn(o.subarray(h+4,h+8)),c<1)break;d=String.fromCharCode(o[h],o[h+1],o[h+2],o[h+3]);var k={id:d,data:o.subarray(h+10,h+c+10)};k.key=k.id,sn[k.id]?sn[k.id](k):k.id[0]==="T"?sn["T*"](k):k.id[0]==="W"&&sn["W*"](k),y.push(k),h+=10,h+=c}while(h<f);return y}},Pu={parseId3Frames:Af,parseSyncSafeInteger:nn,frameParsers:sn},xf=t,Lf=ds,ki=Pu,gs;gs=function(o){var c={descriptor:o&&o.descriptor},d=0,h=[],f=0,y;if(gs.prototype.init.call(this),this.dispatchType=Lf.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(y=0;y<c.descriptor.length;y++)this.dispatchType+=("00"+c.descriptor[y].toString(16)).slice(-2);this.push=function(E){var k,I,A,R,q,Q;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(f=0,h.length=0),h.length===0&&(E.data.length<10||E.data[0]!==73||E.data[1]!==68||E.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(E),f+=E.data.byteLength,h.length===1&&(d=ki.parseSyncSafeInteger(E.data.subarray(6,10)),d+=10),!(f<d)){for(k={data:new Uint8Array(d),frames:[],pts:h[0].pts,dts:h[0].dts},q=0;q<d;)k.data.set(h[0].data.subarray(0,d-q),q),q+=h[0].data.byteLength,f-=h[0].data.byteLength,h.shift();I=10,k.data[5]&64&&(I+=4,I+=ki.parseSyncSafeInteger(k.data.subarray(10,14)),d-=ki.parseSyncSafeInteger(k.data.subarray(16,20)));do{if(A=ki.parseSyncSafeInteger(k.data.subarray(I+4,I+8)),A<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Q=String.fromCharCode(k.data[I],k.data[I+1],k.data[I+2],k.data[I+3]),R={id:Q,data:k.data.subarray(I+10,I+A+10)},R.key=R.id,ki.frameParsers[R.id]?ki.frameParsers[R.id](R):R.id[0]==="T"?ki.frameParsers["T*"](R):R.id[0]==="W"&&ki.frameParsers["W*"](R),R.owner==="com.apple.streaming.transportStreamTimestamp"){var z=R.data,te=(z[3]&1)<<30|z[4]<<22|z[5]<<14|z[6]<<6|z[7]>>>2;te*=4,te+=z[7]&3,R.timeStamp=te,k.pts===void 0&&k.dts===void 0&&(k.pts=R.timeStamp,k.dts=R.timeStamp),this.trigger("timestamp",R)}k.frames.push(R),I+=10,I+=A}while(I<d);this.trigger("data",k)}}}},gs.prototype=new xf;var Df=gs,Za=t,eo=Au,Mt=ds,Pf=Lu.TimestampRolloverStream,ms,an,fs,lr=188,to=71;ms=function(){var o=new Uint8Array(lr),c=0;ms.prototype.init.call(this),this.push=function(d){var h=0,f=lr,y;for(c?(y=new Uint8Array(d.byteLength+c),y.set(o.subarray(0,c)),y.set(d,c),c=0):y=d;f<y.byteLength;){if(y[h]===to&&y[f]===to){this.trigger("data",y.subarray(h,f)),h+=lr,f+=lr;continue}h++,f++}h<y.byteLength&&(o.set(y.subarray(h),0),c=y.byteLength-h)},this.flush=function(){c===lr&&o[0]===to&&(this.trigger("data",o),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},ms.prototype=new Za,an=function(){var o,c,d,h;an.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(f,y){var E=0;y.payloadUnitStartIndicator&&(E+=f[E]+1),y.type==="pat"?c(f.subarray(E),y):d(f.subarray(E),y)},c=function(f,y){y.section_number=f[7],y.last_section_number=f[8],h.pmtPid=(f[10]&31)<<8|f[11],y.pmtPid=h.pmtPid},d=function(f,y){var E,k,I,A;if(f[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(f[1]&15)<<8|f[2],k=3+E-4,I=(f[10]&15)<<8|f[11],A=12+I;A<k;){var R=f[A],q=(f[A+1]&31)<<8|f[A+2];R===Mt.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=q:R===Mt.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=q:R===Mt.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][q]=R),A+=((f[A+3]&15)<<8|f[A+4])+5}y.programMapTable=h.programMapTable}},this.push=function(f){var y={},E=4;if(y.payloadUnitStartIndicator=!!(f[1]&64),y.pid=f[1]&31,y.pid<<=8,y.pid|=f[2],(f[3]&48)>>>4>1&&(E+=f[E]+1),y.pid===0)y.type="pat",o(f.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",o(f.subarray(E),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([f,E,y]):this.processPes_(f,E,y)},this.processPes_=function(f,y,E){E.pid===this.programMapTable.video?E.streamType=Mt.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=Mt.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=f.subarray(y),this.trigger("data",E)}},an.prototype=new Za,an.STREAM_TYPES={h264:27,adts:15},fs=function(){var o=this,c=!1,d={data:[],size:0},h={data:[],size:0},f={data:[],size:0},y,E=function(I,A){var R;const q=I[0]<<16|I[1]<<8|I[2];A.data=new Uint8Array,q===1&&(A.packetLength=6+(I[4]<<8|I[5]),A.dataAlignmentIndicator=(I[6]&4)!==0,R=I[7],R&192&&(A.pts=(I[9]&14)<<27|(I[10]&255)<<20|(I[11]&254)<<12|(I[12]&255)<<5|(I[13]&254)>>>3,A.pts*=4,A.pts+=(I[13]&6)>>>1,A.dts=A.pts,R&64&&(A.dts=(I[14]&14)<<27|(I[15]&255)<<20|(I[16]&254)<<12|(I[17]&255)<<5|(I[18]&254)>>>3,A.dts*=4,A.dts+=(I[18]&6)>>>1)),A.data=I.subarray(9+I[8]))},k=function(I,A,R){var q=new Uint8Array(I.size),Q={type:A},z=0,te=0,ae=!1,Ge;if(!(!I.data.length||I.size<9)){for(Q.trackId=I.data[0].pid,z=0;z<I.data.length;z++)Ge=I.data[z],q.set(Ge.data,te),te+=Ge.data.byteLength;E(q,Q),ae=A==="video"||Q.packetLength<=I.size,(R||ae)&&(I.size=0,I.data.length=0),ae&&o.trigger("data",Q)}};fs.prototype.init.call(this),this.push=function(I){({pat:function(){},pes:function(){var A,R;switch(I.streamType){case Mt.H264_STREAM_TYPE:A=d,R="video";break;case Mt.ADTS_STREAM_TYPE:A=h,R="audio";break;case Mt.METADATA_STREAM_TYPE:A=f,R="timed-metadata";break;default:return}I.payloadUnitStartIndicator&&k(A,R,!0),A.data.push(I),A.size+=I.data.byteLength},pmt:function(){var A={type:"metadata",tracks:[]};y=I.programMapTable,y.video!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",A)}})[I.type]()},this.reset=function(){d.size=0,d.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){k(d,"video"),k(h,"audio"),k(f,"timed-metadata")},this.flush=function(){if(!c&&y){var I={type:"metadata",tracks:[]};y.video!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),o.trigger("data",I)}c=!1,this.flushStreams_(),this.trigger("done")}},fs.prototype=new Za;var Ru={PAT_PID:0,MP2T_PACKET_LENGTH:lr,TransportPacketStream:ms,TransportParseStream:an,ElementaryStream:fs,TimestampRolloverStream:Pf,CaptionStream:eo.CaptionStream,Cea608Stream:eo.Cea608Stream,Cea708Stream:eo.Cea708Stream,MetadataStream:Df};for(var io in Mt)Mt.hasOwnProperty(io)&&(Ru[io]=Mt[io]);var Rf=Ru,Nf=t,Of=T.ONE_SECOND_IN_TS,ys,Nu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];ys=function(o){var c,d=0;ys.prototype.init.call(this),this.skipWarn_=function(h,f){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${f} in frame ${d} outside syncword`})},this.push=function(h){var f=0,y,E,k,I,A;if(o||(d=0),h.type==="audio"){c&&c.length?(k=c,c=new Uint8Array(k.byteLength+h.data.byteLength),c.set(k),c.set(h.data,k.byteLength)):c=h.data;for(var R;f+7<c.length;){if(c[f]!==255||(c[f+1]&246)!==240){typeof R!="number"&&(R=f),f++;continue}if(typeof R=="number"&&(this.skipWarn_(R,f),R=null),E=(~c[f+1]&1)*2,y=(c[f+3]&3)<<11|c[f+4]<<3|(c[f+5]&224)>>5,I=((c[f+6]&3)+1)*1024,A=I*Of/Nu[(c[f+2]&60)>>>2],c.byteLength-f<y)break;this.trigger("data",{pts:h.pts+d*A,dts:h.dts+d*A,sampleCount:I,audioobjecttype:(c[f+2]>>>6&3)+1,channelcount:(c[f+2]&1)<<2|(c[f+3]&192)>>>6,samplerate:Nu[(c[f+2]&60)>>>2],samplingfrequencyindex:(c[f+2]&60)>>>2,samplesize:16,data:c.subarray(f+7+E,f+y)}),d++,f+=y}typeof R=="number"&&(this.skipWarn_(R,f),R=null),c=c.subarray(f)}},this.flush=function(){d=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},ys.prototype=new Nf;var Uf=ys,Ou;Ou=function(o){var c=o.byteLength,d=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var f=o.byteLength-c,y=new Uint8Array(4),E=Math.min(4,c);if(E===0)throw new Error("no bytes available");y.set(o.subarray(f,f+E)),d=new DataView(y.buffer).getUint32(0),h=E*8,c-=E},this.skipBits=function(f){var y;h>f?(d<<=f,h-=f):(f-=h,y=Math.floor(f/8),f-=y*8,c-=y,this.loadWord(),d<<=f,h-=f)},this.readBits=function(f){var y=Math.min(h,f),E=d>>>32-y;return h-=y,h>0?d<<=y:c>0&&this.loadWord(),y=f-y,y>0?E<<y|this.readBits(y):E},this.skipLeadingZeros=function(){var f;for(f=0;f<h;++f)if(d&2147483648>>>f)return d<<=f,h-=f,f;return this.loadWord(),f+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var f=this.skipLeadingZeros();return this.readBits(f+1)-1},this.readExpGolomb=function(){var f=this.readUnsignedExpGolomb();return 1&f?1+f>>>1:-1*(f>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Mf=Ou,Uu=t,Bf=Mf,_s,on,Mu;on=function(){var o=0,c,d;on.prototype.init.call(this),this.push=function(h){var f;d?(f=new Uint8Array(d.byteLength+h.data.byteLength),f.set(d),f.set(h.data,d.byteLength),d=f):d=h.data;for(var y=d.byteLength;o<y-3;o++)if(d[o+2]===1){c=o+5;break}for(;c<y;)switch(d[c]){case 0:if(d[c-1]!==0){c+=2;break}else if(d[c-2]!==0){c++;break}o+3!==c-2&&this.trigger("data",d.subarray(o+3,c-2));do c++;while(d[c]!==1&&c<y);o=c-2,c+=3;break;case 1:if(d[c-1]!==0||d[c-2]!==0){c+=3;break}this.trigger("data",d.subarray(o+3,c-2)),o=c-2,c+=3;break;default:c+=3;break}d=d.subarray(o),c-=o,o=0},this.reset=function(){d=null,o=0,this.trigger("reset")},this.flush=function(){d&&d.byteLength>3&&this.trigger("data",d.subarray(o+3)),d=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},on.prototype=new Uu,Mu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},_s=function(){var o=new on,c,d,h,f,y,E,k;_s.prototype.init.call(this),c=this,this.push=function(I){I.type==="video"&&(d=I.trackId,h=I.pts,f=I.dts,o.push(I))},o.on("data",function(I){var A={trackId:d,pts:h,dts:f,data:I,nalUnitTypeCode:I[0]&31};switch(A.nalUnitTypeCode){case 5:A.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:A.nalUnitType="sei_rbsp",A.escapedRBSP=y(I.subarray(1));break;case 7:A.nalUnitType="seq_parameter_set_rbsp",A.escapedRBSP=y(I.subarray(1)),A.config=E(A.escapedRBSP);break;case 8:A.nalUnitType="pic_parameter_set_rbsp";break;case 9:A.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",A)}),o.on("done",function(){c.trigger("done")}),o.on("partialdone",function(){c.trigger("partialdone")}),o.on("reset",function(){c.trigger("reset")}),o.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},k=function(I,A){var R=8,q=8,Q,z;for(Q=0;Q<I;Q++)q!==0&&(z=A.readExpGolomb(),q=(R+z+256)%256),R=q===0?R:q},y=function(I){for(var A=I.byteLength,R=[],q=1,Q,z;q<A-2;)I[q]===0&&I[q+1]===0&&I[q+2]===3?(R.push(q+2),q+=2):q++;if(R.length===0)return I;Q=A-R.length,z=new Uint8Array(Q);var te=0;for(q=0;q<Q;te++,q++)te===R[0]&&(te++,R.shift()),z[q]=I[te];return z},E=function(I){var A=0,R=0,q=0,Q=0,z,te,ae,Ge,st,Gt,mn,Ls,Ds,zi,fn,Ie=[1,1],pc,Wi;if(z=new Bf(I),te=z.readUnsignedByte(),Ge=z.readUnsignedByte(),ae=z.readUnsignedByte(),z.skipUnsignedExpGolomb(),Mu[te]&&(st=z.readUnsignedExpGolomb(),st===3&&z.skipBits(1),z.skipUnsignedExpGolomb(),z.skipUnsignedExpGolomb(),z.skipBits(1),z.readBoolean()))for(fn=st!==3?8:12,Wi=0;Wi<fn;Wi++)z.readBoolean()&&(Wi<6?k(16,z):k(64,z));if(z.skipUnsignedExpGolomb(),Gt=z.readUnsignedExpGolomb(),Gt===0)z.readUnsignedExpGolomb();else if(Gt===1)for(z.skipBits(1),z.skipExpGolomb(),z.skipExpGolomb(),mn=z.readUnsignedExpGolomb(),Wi=0;Wi<mn;Wi++)z.skipExpGolomb();if(z.skipUnsignedExpGolomb(),z.skipBits(1),Ls=z.readUnsignedExpGolomb(),Ds=z.readUnsignedExpGolomb(),zi=z.readBits(1),zi===0&&z.skipBits(1),z.skipBits(1),z.readBoolean()&&(A=z.readUnsignedExpGolomb(),R=z.readUnsignedExpGolomb(),q=z.readUnsignedExpGolomb(),Q=z.readUnsignedExpGolomb()),z.readBoolean()&&z.readBoolean()){switch(pc=z.readUnsignedByte(),pc){case 1:Ie=[1,1];break;case 2:Ie=[12,11];break;case 3:Ie=[10,11];break;case 4:Ie=[16,11];break;case 5:Ie=[40,33];break;case 6:Ie=[24,11];break;case 7:Ie=[20,11];break;case 8:Ie=[32,11];break;case 9:Ie=[80,33];break;case 10:Ie=[18,11];break;case 11:Ie=[15,11];break;case 12:Ie=[64,33];break;case 13:Ie=[160,99];break;case 14:Ie=[4,3];break;case 15:Ie=[3,2];break;case 16:Ie=[2,1];break;case 255:{Ie=[z.readUnsignedByte()<<8|z.readUnsignedByte(),z.readUnsignedByte()<<8|z.readUnsignedByte()];break}}Ie&&Ie[0]/Ie[1]}return{profileIdc:te,levelIdc:ae,profileCompatibility:Ge,width:(Ls+1)*16-A*2-R*2,height:(2-zi)*(Ds+1)*16-q*2-Q*2,sarRatio:Ie}}},_s.prototype=new Uu;var Ff={H264Stream:_s,NalByteStream:on},jf=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Bu=function(o,c){var d=o[c+6]<<21|o[c+7]<<14|o[c+8]<<7|o[c+9],h=o[c+5],f=(h&16)>>4;return d=d>=0?d:0,f?d+20:d+10},Fu=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=Bu(o,c),Fu(o,c))},qf=function(o){var c=Fu(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},ju=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},$f=function(o,c,d){var h,f="";for(h=c;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},Vf=function(o,c,d){return unescape($f(o,c,d))},Hf=function(o,c){var d=(o[c+5]&224)>>5,h=o[c+4]<<3,f=o[c+3]&6144;return f|h|d},zf=function(o,c){return o[c]===73&&o[c+1]===68&&o[c+2]===51?"timed-metadata":o[c]&!0&&(o[c+1]&240)===240?"audio":null},Wf=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return jf[(o[c+2]&60)>>>2]}return null},Gf=function(o){var c,d,h,f;c=10,o[5]&64&&(c+=4,c+=ju(o.subarray(10,14)));do{if(d=ju(o.subarray(c+4,c+8)),d<1)return null;if(f=String.fromCharCode(o[c],o[c+1],o[c+2],o[c+3]),f==="PRIV"){h=o.subarray(c+10,c+d+10);for(var y=0;y<h.byteLength;y++)if(h[y]===0){var E=Vf(h,0,y);if(E==="com.apple.streaming.transportStreamTimestamp"){var k=h.subarray(y+1),I=(k[3]&1)<<30|k[4]<<22|k[5]<<14|k[6]<<6|k[7]>>>2;return I*=4,I+=k[7]&3,I}break}}c+=10,c+=d}while(c<o.byteLength);return null},ro={isLikelyAacData:qf,parseId3TagSize:Bu,parseAdtsSize:Hf,parseType:zf,parseSampleRate:Wf,parseAacTimestamp:Gf},Xf=t,qu=ro,bs;bs=function(){var o=new Uint8Array,c=0;bs.prototype.init.call(this),this.setTimestamp=function(d){c=d},this.push=function(d){var h=0,f=0,y,E,k,I;for(o.length?(I=o.length,o=new Uint8Array(d.byteLength+I),o.set(o.subarray(0,I)),o.set(d,I)):o=d;o.length-f>=3;){if(o[f]===73&&o[f+1]===68&&o[f+2]===51){if(o.length-f<10||(h=qu.parseId3TagSize(o,f),f+h>o.length))break;E={type:"timed-metadata",data:o.subarray(f,f+h)},this.trigger("data",E),f+=h;continue}else if((o[f]&255)===255&&(o[f+1]&240)===240){if(o.length-f<7||(h=qu.parseAdtsSize(o,f),f+h>o.length))break;k={type:"audio",data:o.subarray(f,f+h),pts:c,dts:c},this.trigger("data",k),f+=h;continue}f++}y=o.length-f,y>0?o=o.subarray(f):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},bs.prototype=new Xf;var Kf=bs,Yf=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Qf=Yf,Jf=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Zf=Jf,vs=t,ln=Fi,un=ji,Ts=be,Bt=pf,ci=Rf,Ss=T,$u=Uf,ey=Ff.H264Stream,ty=Kf,iy=ro.isLikelyAacData,ry=T.ONE_SECOND_IN_TS,no=Qf,so=Zf,cn,ur,Es,Vi,ny=function(o,c){c.stream=o,this.trigger("log",c)},Vu=function(o,c){for(var d=Object.keys(c),h=0;h<d.length;h++){var f=d[h];f==="headOfPipeline"||!c[f].on||c[f].on("log",ny.bind(o,f))}},Hu=function(o,c){var d;if(o.length!==c.length)return!1;for(d=0;d<o.length;d++)if(o[d]!==c[d])return!1;return!0},ao=function(o,c,d,h,f,y){var E=d-c,k=h-c,I=f-d;return{start:{dts:o,pts:o+E},end:{dts:o+k,pts:o+I},prependedContentDuration:y,baseMediaDecodeTime:o}};ur=function(o,c){var d=[],h,f=0,y=0,E=1/0;c=c||{},h=c.firstSequenceNumber||0,ur.prototype.init.call(this),this.push=function(k){Bt.collectDtsInfo(o,k),o&&no.forEach(function(I){o[I]=k[I]}),d.push(k)},this.setEarliestDts=function(k){f=k},this.setVideoBaseMediaDecodeTime=function(k){E=k},this.setAudioAppendStart=function(k){y=k},this.flush=function(){var k,I,A,R,q,Q,z;if(d.length===0){this.trigger("done","AudioSegmentStream");return}k=Ts.trimAdtsFramesByEarliestDts(d,o,f),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),z=Ts.prefixWithSilence(o,k,y,E),o.samples=Ts.generateSampleTable(k),A=ln.mdat(Ts.concatenateFrameData(k)),d=[],I=ln.moof(h,[o]),R=new Uint8Array(I.byteLength+A.byteLength),h++,R.set(I),R.set(A,I.byteLength),Bt.clearDtsInfo(o),q=Math.ceil(ry*1024/o.samplerate),k.length&&(Q=k.length*q,this.trigger("segmentTimingInfo",ao(Ss.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),k[0].dts,k[0].pts,k[0].dts+Q,k[0].pts+Q,z||0)),this.trigger("timingInfo",{start:k[0].pts,end:k[0].pts+Q})),this.trigger("data",{track:o,boxes:R}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Bt.clearDtsInfo(o),d=[],this.trigger("reset")}},ur.prototype=new vs,cn=function(o,c){var d,h=[],f=[],y,E;c=c||{},d=c.firstSequenceNumber||0,cn.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(k){Bt.collectDtsInfo(o,k),k.nalUnitType==="seq_parameter_set_rbsp"&&!y&&(y=k.config,o.sps=[k.data],so.forEach(function(I){o[I]=y[I]},this)),k.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=k.data,o.pps=[k.data]),h.push(k)},this.flush=function(){for(var k,I,A,R,q,Q,z=0,te,ae;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(k=un.groupNalsIntoFrames(h),A=un.groupFramesIntoGops(k),A[0][0].keyFrame||(I=this.getGopForFusion_(h[0],o),I?(z=I.duration,A.unshift(I),A.byteLength+=I.byteLength,A.nalCount+=I.nalCount,A.pts=I.pts,A.dts=I.dts,A.duration+=I.duration):A=un.extendFirstKeyFrame(A)),f.length){var Ge;if(c.alignGopsAtEnd?Ge=this.alignGopsAtEnd_(A):Ge=this.alignGopsAtStart_(A),!Ge){this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Bt.clearDtsInfo(o),A=Ge}Bt.collectDtsInfo(o,A),o.samples=un.generateSampleTable(A),q=ln.mdat(un.concatenateNalData(A)),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",A.map(function(st){return{pts:st.pts,dts:st.dts,byteLength:st.byteLength}})),te=A[0],ae=A[A.length-1],this.trigger("segmentTimingInfo",ao(o.baseMediaDecodeTime,te.dts,te.pts,ae.dts+ae.duration,ae.pts+ae.duration,z)),this.trigger("timingInfo",{start:A[0].pts,end:A[A.length-1].pts+A[A.length-1].duration}),this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),R=ln.moof(d,[o]),Q=new Uint8Array(R.byteLength+q.byteLength),d++,Q.set(R),Q.set(q,R.byteLength),this.trigger("data",{track:o,boxes:Q}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,f.length=0,this.trigger("reset")},this.resetStream_=function(){Bt.clearDtsInfo(o),y=void 0,E=void 0},this.getGopForFusion_=function(k){var I=45e3,A=1e4,R=1/0,q,Q,z,te,ae;for(ae=0;ae<this.gopCache_.length;ae++)te=this.gopCache_[ae],z=te.gop,!(!(o.pps&&Hu(o.pps[0],te.pps[0]))||!(o.sps&&Hu(o.sps[0],te.sps[0])))&&(z.dts<o.timelineStartInfo.dts||(q=k.dts-z.dts-z.duration,q>=-A&&q<=I&&(!Q||R>q)&&(Q=te,R=q)));return Q?Q.gop:null},this.alignGopsAtStart_=function(k){var I,A,R,q,Q,z,te,ae;for(Q=k.byteLength,z=k.nalCount,te=k.duration,I=A=0;I<f.length&&A<k.length&&(R=f[I],q=k[A],R.pts!==q.pts);){if(q.pts>R.pts){I++;continue}A++,Q-=q.byteLength,z-=q.nalCount,te-=q.duration}return A===0?k:A===k.length?null:(ae=k.slice(A),ae.byteLength=Q,ae.duration=te,ae.nalCount=z,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae)},this.alignGopsAtEnd_=function(k){var I,A,R,q,Q,z;for(I=f.length-1,A=k.length-1,Q=null,z=!1;I>=0&&A>=0;){if(R=f[I],q=k[A],R.pts===q.pts){z=!0;break}if(R.pts>q.pts){I--;continue}I===f.length-1&&(Q=A),A--}if(!z&&Q===null)return null;var te;if(z?te=A:te=Q,te===0)return k;var ae=k.slice(te),Ge=ae.reduce(function(st,Gt){return st.byteLength+=Gt.byteLength,st.duration+=Gt.duration,st.nalCount+=Gt.nalCount,st},{byteLength:0,duration:0,nalCount:0});return ae.byteLength=Ge.byteLength,ae.duration=Ge.duration,ae.nalCount=Ge.nalCount,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae},this.alignGopsWith=function(k){f=k}},cn.prototype=new vs,Vi=function(o,c){this.numberOfTracks=0,this.metadataStream=c,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Vi.prototype.init.call(this),this.push=function(d){if(d.content||d.text)return this.pendingCaptions.push(d);if(d.frames)return this.pendingMetadata.push(d);this.pendingTracks.push(d.track),this.pendingBytes+=d.boxes.byteLength,d.track.type==="video"&&(this.videoTrack=d.track,this.pendingBoxes.push(d.boxes)),d.track.type==="audio"&&(this.audioTrack=d.track,this.pendingBoxes.unshift(d.boxes))}},Vi.prototype=new vs,Vi.prototype.flush=function(o){var c=0,d={captions:[],captionStreams:{},metadata:[],info:{}},h,f,y,E=0,k;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,so.forEach(function(I){d.info[I]=this.videoTrack[I]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,no.forEach(function(I){d.info[I]=this.audioTrack[I]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?d.type=this.pendingTracks[0].type:d.type="combined",this.emittedTracks+=this.pendingTracks.length,y=ln.initSegment(this.pendingTracks),d.initSegment=new Uint8Array(y.byteLength),d.initSegment.set(y),d.data=new Uint8Array(this.pendingBytes),k=0;k<this.pendingBoxes.length;k++)d.data.set(this.pendingBoxes[k],c),c+=this.pendingBoxes[k].byteLength;for(k=0;k<this.pendingCaptions.length;k++)h=this.pendingCaptions[k],h.startTime=Ss.metadataTsToSeconds(h.startPts,E,this.keepOriginalTimestamps),h.endTime=Ss.metadataTsToSeconds(h.endPts,E,this.keepOriginalTimestamps),d.captionStreams[h.stream]=!0,d.captions.push(h);for(k=0;k<this.pendingMetadata.length;k++)f=this.pendingMetadata[k],f.cueTime=Ss.metadataTsToSeconds(f.pts,E,this.keepOriginalTimestamps),d.metadata.push(f);for(d.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",d),k=0;k<d.captions.length;k++)h=d.captions[k],this.trigger("caption",h);for(k=0;k<d.metadata.length;k++)f=d.metadata[k],this.trigger("id3Frame",f)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Vi.prototype.setRemux=function(o){this.remuxTracks=o},Es=function(o){var c=this,d=!0,h,f;Es.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new ci.MetadataStream,y.aacStream=new ty,y.audioTimestampRolloverStream=new ci.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new ci.TimestampRolloverStream("timed-metadata"),y.adtsStream=new $u,y.coalesceStream=new Vi(o,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(E){y.aacStream.setTimestamp(E.timeStamp)}),y.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||y.audioSegmentStream||(f=f||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new ur(f,o),y.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),c.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Vu(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new ci.MetadataStream,y.packetStream=new ci.TransportPacketStream,y.parseStream=new ci.TransportParseStream,y.elementaryStream=new ci.ElementaryStream,y.timestampRolloverStream=new ci.TimestampRolloverStream,y.adtsStream=new $u,y.h264Stream=new ey,y.captionStream=new ci.CaptionStream(o),y.coalesceStream=new Vi(o,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(E){var k;if(E.type==="metadata"){for(k=E.tracks.length;k--;)!h&&E.tracks[k].type==="video"?(h=E.tracks[k],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!f&&E.tracks[k].type==="audio"&&(f=E.tracks[k],f.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new cn(h,o),y.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(I){f&&!o.keepOriginalTimestamps&&(f.timelineStartInfo=I,y.audioSegmentStream.setEarliestDts(I.dts-c.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(I){f&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(I)}),y.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),f&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new ur(f,o),y.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,c.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Vu(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),f&&(f.timelineStartInfo.dts=void 0,f.timelineStartInfo.pts=void 0,Bt.clearDtsInfo(f),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),h&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Bt.clearDtsInfo(h),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){f&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;o.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var E=this;return function(k){k.stream=y,E.trigger("log",k)}},this.push=function(y){if(d){var E=iy(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},Es.prototype=new vs;var sy={Transmuxer:Es,VideoSegmentStream:cn,AudioSegmentStream:ur,AUDIO_PROPERTIES:no,VIDEO_PROPERTIES:so,generateSegmentTimingInfo:ao},ay=function(o){return o>>>0},oy=function(o){return("00"+o.toString(16)).slice(-2)},ws={toUnsigned:ay,toHexString:oy},ly=function(o){var c="";return c+=String.fromCharCode(o[0]),c+=String.fromCharCode(o[1]),c+=String.fromCharCode(o[2]),c+=String.fromCharCode(o[3]),c},oo=ly,uy=ws.toUnsigned,cy=oo,zu=function(o,c){var d=[],h,f,y,E,k;if(!c.length)return null;for(h=0;h<o.byteLength;)f=uy(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3]),y=cy(o.subarray(h+4,h+8)),E=f>1?h+f:o.byteLength,y===c[0]&&(c.length===1?d.push(o.subarray(h+8,E)):(k=zu(o.subarray(h+8,E),c.slice(1)),k.length&&(d=d.concat(k)))),h=E;return d},ks=zu,dy=ws.toUnsigned,hy=s.getUint64,py=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=hy(o.subarray(4)):c.baseMediaDecodeTime=dy(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},lo=py,gy=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4)},h=d.flags[2]&1,f=d.flags[2]&2,y=d.flags[2]&8,E=d.flags[2]&16,k=d.flags[2]&32,I=d.flags[0]&65536,A=d.flags[0]&131072,R;return R=8,h&&(R+=4,d.baseDataOffset=c.getUint32(12),R+=4),f&&(d.sampleDescriptionIndex=c.getUint32(R),R+=4),y&&(d.defaultSampleDuration=c.getUint32(R),R+=4),E&&(d.defaultSampleSize=c.getUint32(R),R+=4),k&&(d.defaultSampleFlags=c.getUint32(R)),I&&(d.durationIsEmpty=!0),!h&&A&&(d.baseDataOffsetIsMoof=!0),d},uo=gy,Wu=s.getUint64,my=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),references:[],referenceId:c.getUint32(4),timescale:c.getUint32(8)},h=12;d.version===0?(d.earliestPresentationTime=c.getUint32(h),d.firstOffset=c.getUint32(h+4),h+=8):(d.earliestPresentationTime=Wu(o.subarray(h)),d.firstOffset=Wu(o.subarray(h+8)),h+=16),h+=2;var f=c.getUint16(h);for(h+=2;f>0;h+=12,f--)d.references.push({referenceType:(o[h]&128)>>>7,referencedSize:c.getUint32(h)&2147483647,subsegmentDuration:c.getUint32(h+4),startsWithSap:!!(o[h+8]&128),sapType:(o[h+8]&112)>>>4,sapDeltaTime:c.getUint32(h+8)&268435455});return d},fy=my,yy=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},_y=yy,Gu=_y,by=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d=new DataView(o.buffer,o.byteOffset,o.byteLength),h=c.flags[2]&1,f=c.flags[2]&4,y=c.flags[1]&1,E=c.flags[1]&2,k=c.flags[1]&4,I=c.flags[1]&8,A=d.getUint32(4),R=8,q;for(h&&(c.dataOffset=d.getInt32(R),R+=4),f&&A&&(q={flags:Gu(o.subarray(R,R+4))},R+=4,y&&(q.duration=d.getUint32(R),R+=4),E&&(q.size=d.getUint32(R),R+=4),I&&(c.version===1?q.compositionTimeOffset=d.getInt32(R):q.compositionTimeOffset=d.getUint32(R),R+=4),c.samples.push(q),A--);A--;)q={},y&&(q.duration=d.getUint32(R),R+=4),E&&(q.size=d.getUint32(R),R+=4),k&&(q.flags=Gu(o.subarray(R,R+4)),R+=4),I&&(c.version===1?q.compositionTimeOffset=d.getInt32(R):q.compositionTimeOffset=d.getUint32(R),R+=4),c.samples.push(q);return c},Xu=by,vy=s,Ku=vy.getUint64,Je,co,At=function(o){return new Date(o*1e3-20828448e5)},dn=oo,Ty=ks,Sy=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=[],h,f;for(h=0;h+4<o.length;h+=f){if(f=c.getUint32(h),h+=4,f<=0){d.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(o[h]&31){case 1:d.push("slice_layer_without_partitioning_rbsp");break;case 5:d.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:d.push("sei_rbsp");break;case 7:d.push("seq_parameter_set_rbsp");break;case 8:d.push("pic_parameter_set_rbsp");break;case 9:d.push("access_unit_delimiter_rbsp");break;default:d.push("UNKNOWN NAL - "+o[h]&31);break}}return d},Ci={avc1:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{dataReferenceIndex:c.getUint16(6),width:c.getUint16(24),height:c.getUint16(26),horizresolution:c.getUint16(28)+c.getUint16(30)/16,vertresolution:c.getUint16(32)+c.getUint16(34)/16,frameCount:c.getUint16(40),depth:c.getUint16(74),config:Je(o.subarray(78,o.byteLength))}},avcC:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={configurationVersion:o[0],avcProfileIndication:o[1],profileCompatibility:o[2],avcLevelIndication:o[3],lengthSizeMinusOne:o[4]&3,sps:[],pps:[]},h=o[5]&31,f,y,E,k;for(E=6,k=0;k<h;k++)y=c.getUint16(E),E+=2,d.sps.push(new Uint8Array(o.subarray(E,E+y))),E+=y;for(f=o[E],E++,k=0;k<f;k++)y=c.getUint16(E),E+=2,d.pps.push(new Uint8Array(o.subarray(E,E+y))),E+=y;return d},btrt:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{bufferSizeDB:c.getUint32(0),maxBitrate:c.getUint32(4),avgBitrate:c.getUint32(8)}},edts:function(o){return{boxes:Je(o)}},elst:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),edits:[]},h=c.getUint32(4),f;for(f=8;h;h--)d.version===0?(d.edits.push({segmentDuration:c.getUint32(f),mediaTime:c.getInt32(f+4),mediaRate:c.getUint16(f+8)+c.getUint16(f+10)/(256*256)}),f+=12):(d.edits.push({segmentDuration:Ku(o.subarray(f)),mediaTime:Ku(o.subarray(f+8)),mediaRate:c.getUint16(f+16)+c.getUint16(f+18)/(256*256)}),f+=20);return d},esds:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),esId:o[6]<<8|o[7],streamPriority:o[8]&31,decoderConfig:{objectProfileIndication:o[11],streamType:o[12]>>>2&63,bufferSize:o[13]<<16|o[14]<<8|o[15],maxBitrate:o[16]<<24|o[17]<<16|o[18]<<8|o[19],avgBitrate:o[20]<<24|o[21]<<16|o[22]<<8|o[23],decoderConfigDescriptor:{tag:o[24],length:o[25],audioObjectType:o[26]>>>3&31,samplingFrequencyIndex:(o[26]&7)<<1|o[27]>>>7&1,channelConfiguration:o[27]>>>3&15}}}},ftyp:function(o){for(var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={majorBrand:dn(o.subarray(0,4)),minorVersion:c.getUint32(4),compatibleBrands:[]},h=8;h<o.byteLength;)d.compatibleBrands.push(dn(o.subarray(h,h+4))),h+=4;return d},dinf:function(o){return{boxes:Je(o)}},dref:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),dataReferences:Je(o.subarray(8))}},hdlr:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),handlerType:dn(o.subarray(8,12)),name:""},h=8;for(h=24;h<o.byteLength;h++){if(o[h]===0){h++;break}d.name+=String.fromCharCode(o[h])}return d.name=decodeURIComponent(escape(d.name)),d},mdat:function(o){return{byteLength:o.byteLength,nals:Sy(o)}},mdhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h,f={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),language:""};return f.version===1?(d+=4,f.creationTime=At(c.getUint32(d)),d+=8,f.modificationTime=At(c.getUint32(d)),d+=4,f.timescale=c.getUint32(d),d+=8,f.duration=c.getUint32(d)):(f.creationTime=At(c.getUint32(d)),d+=4,f.modificationTime=At(c.getUint32(d)),d+=4,f.timescale=c.getUint32(d),d+=4,f.duration=c.getUint32(d)),d+=4,h=c.getUint16(d),f.language+=String.fromCharCode((h>>10)+96),f.language+=String.fromCharCode(((h&992)>>5)+96),f.language+=String.fromCharCode((h&31)+96),f},mdia:function(o){return{boxes:Je(o)}},mfhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sequenceNumber:o[4]<<24|o[5]<<16|o[6]<<8|o[7]}},minf:function(o){return{boxes:Je(o)}},mp4a:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={dataReferenceIndex:c.getUint16(6),channelcount:c.getUint16(16),samplesize:c.getUint16(18),samplerate:c.getUint16(24)+c.getUint16(26)/65536};return o.byteLength>28&&(d.streamDescriptor=Je(o.subarray(28))[0]),d},moof:function(o){return{boxes:Je(o)}},moov:function(o){return{boxes:Je(o)}},mvex:function(o){return{boxes:Je(o)}},mvhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=At(c.getUint32(d)),d+=8,h.modificationTime=At(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=8,h.duration=c.getUint32(d)):(h.creationTime=At(c.getUint32(d)),d+=4,h.modificationTime=At(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=4,h.duration=c.getUint32(d)),d+=4,h.rate=c.getUint16(d)+c.getUint16(d+2)/16,d+=4,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,d+=2*4,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,d+=6*4,h.nextTrackId=c.getUint32(d),h},pdin:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),rate:c.getUint32(4),initialDelay:c.getUint32(8)}},sdtp:function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d;for(d=4;d<o.byteLength;d++)c.samples.push({dependsOn:(o[d]&48)>>4,isDependedOn:(o[d]&12)>>2,hasRedundancy:o[d]&3});return c},sidx:fy,smhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),balance:o[4]+o[5]/256}},stbl:function(o){return{boxes:Je(o)}},ctts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),compositionOffsets:[]},h=c.getUint32(4),f;for(f=8;h;f+=8,h--)d.compositionOffsets.push({sampleCount:c.getUint32(f),sampleOffset:c[d.version===0?"getUint32":"getInt32"](f+4)});return d},stss:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),syncSamples:[]},h=c.getUint32(4),f;for(f=8;h;f+=4,h--)d.syncSamples.push(c.getUint32(f));return d},stco:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),chunkOffsets:[]},h=c.getUint32(4),f;for(f=8;h;f+=4,h--)d.chunkOffsets.push(c.getUint32(f));return d},stsc:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=c.getUint32(4),h={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleToChunks:[]},f;for(f=8;d;f+=12,d--)h.sampleToChunks.push({firstChunk:c.getUint32(f),samplesPerChunk:c.getUint32(f+4),sampleDescriptionIndex:c.getUint32(f+8)});return h},stsd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleDescriptions:Je(o.subarray(8))}},stsz:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleSize:c.getUint32(4),entries:[]},h;for(h=12;h<o.byteLength;h+=4)d.entries.push(c.getUint32(h));return d},stts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),timeToSamples:[]},h=c.getUint32(4),f;for(f=8;h;f+=8,h--)d.timeToSamples.push({sampleCount:c.getUint32(f),sampleDelta:c.getUint32(f+4)});return d},styp:function(o){return Ci.ftyp(o)},tfdt:lo,tfhd:uo,tkhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=At(c.getUint32(d)),d+=8,h.modificationTime=At(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=8,h.duration=c.getUint32(d)):(h.creationTime=At(c.getUint32(d)),d+=4,h.modificationTime=At(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=4,h.duration=c.getUint32(d)),d+=4,d+=2*4,h.layer=c.getUint16(d),d+=2,h.alternateGroup=c.getUint16(d),d+=2,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,h.width=c.getUint16(d)+c.getUint16(d+2)/65536,d+=4,h.height=c.getUint16(d)+c.getUint16(d+2)/65536,h},traf:function(o){return{boxes:Je(o)}},trak:function(o){return{boxes:Je(o)}},trex:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4),defaultSampleDescriptionIndex:c.getUint32(8),defaultSampleDuration:c.getUint32(12),defaultSampleSize:c.getUint32(16),sampleDependsOn:o[20]&3,sampleIsDependedOn:(o[21]&192)>>6,sampleHasRedundancy:(o[21]&48)>>4,samplePaddingValue:(o[21]&14)>>1,sampleIsDifferenceSample:!!(o[21]&1),sampleDegradationPriority:c.getUint16(22)}},trun:Xu,"url ":function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4))}},vmhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),graphicsmode:c.getUint16(4),opcolor:new Uint16Array([c.getUint16(6),c.getUint16(8),c.getUint16(10)])}}};Je=function(o){for(var c=0,d=[],h,f,y,E,k,I=new ArrayBuffer(o.length),A=new Uint8Array(I),R=0;R<o.length;++R)A[R]=o[R];for(h=new DataView(I);c<o.byteLength;)f=h.getUint32(c),y=dn(o.subarray(c+4,c+8)),E=f>1?c+f:o.byteLength,k=(Ci[y]||function(q){return{data:q}})(o.subarray(c+8,E)),k.size=f,k.type=y,d.push(k),c=E;return d},co=function(o,c){var d;return c=c||0,d=new Array(c*2+1).join(" "),o.map(function(h,f){return d+h.type+`
|
|
199
|
+
`),this.pushCaption(c),c.startPts=o},Ce.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},Ce.prototype.displayWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible=1);return o},Ce.prototype.hideWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible=0);return o},Ce.prototype.toggleWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&(c.windows[y].visible^=1);return o},Ce.prototype.clearWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&c.windows[y].clearText();return o},Ce.prototype.deleteWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],f=this.getPts(o);this.flushDisplayed(f,c);for(var y=0;y<8;y++)h&1<<y&&c.windows[y].reset();return o},Ce.prototype.setPenAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penAttr;return h=d[++o],f.textTag=(h&240)>>4,f.offset=(h&12)>>2,f.penSize=h&3,h=d[++o],f.italics=(h&128)>>7,f.underline=(h&64)>>6,f.edgeType=(h&56)>>3,f.fontStyle=h&7,o},Ce.prototype.setPenColor=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penColor;return h=d[++o],f.fgOpacity=(h&192)>>6,f.fgRed=(h&48)>>4,f.fgGreen=(h&12)>>2,f.fgBlue=h&3,h=d[++o],f.bgOpacity=(h&192)>>6,f.bgRed=(h&48)>>4,f.bgGreen=(h&12)>>2,f.bgBlue=h&3,h=d[++o],f.edgeRed=(h&48)>>4,f.edgeGreen=(h&12)>>2,f.edgeBlue=h&3,o},Ce.prototype.setPenLocation=function(o,c){var d=this.current708Packet.data,h=d[o],f=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=d[++o],f.row=h&15,h=d[++o],f.column=h&63,o},Ce.prototype.reset=function(o,c){var d=this.getPts(o);return this.flushDisplayed(d,c),this.initService(c.serviceNum,o)};var Af={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},ds=function(o){return o===null?"":(o=Af[o]||o,String.fromCharCode(o))},hs=14,xf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Wi=function(){for(var o=[],c=hs+1;c--;)o.push({text:"",indent:0,offset:0});return o},Re=function(o,c){Re.prototype.init.call(this),this.field_=o||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(d){var h,f,y,E,k;if(h=d.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),y=h>>>8,E=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(d.pts),this.flushDisplayed(d.pts),f=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=f,this.startPts_=d.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(d.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(d.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(d.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(d.pts),this.flushDisplayed(d.pts),this.shiftRowsUp_(),this.startPts_=d.pts;else if(h===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(d.pts),this.displayed_=Wi();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Wi();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(d.pts),this.displayed_=Wi()),this.mode_="paintOn",this.startPts_=d.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,k=ds(y|E),this[this.mode_](d.pts,k),this.column_++;else if(this.isExtCharacter(y,E))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),y=(y&3)<<8,k=ds(y|E),this[this.mode_](d.pts,k),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(d.pts),this[this.mode_](d.pts," "),this.column_++,(E&14)===14&&this.addFormatting(d.pts,["i"]),(E&1)===1&&this.addFormatting(d.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const A=E&3;this.nonDisplayed_[this.row_].offset=A,this.column_+=A}else if(this.isPAC(y,E)){var I=xf.indexOf(h&7968);if(this.mode_==="rollUp"&&(I-this.rollUpRows_+1<0&&(I=this.rollUpRows_-1),this.setRollUp(d.pts,I)),I!==this.row_&&I>=0&&I<=14&&(this.clearFormatting(d.pts),this.row_=I),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(d.pts,["u"]),(h&16)===16){const A=(h&14)>>1;this.column_=A*4,this.nonDisplayed_[this.row_].indent+=A}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(d.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),k=ds(y),k+=ds(E),this[this.mode_](d.pts,k),this.column_+=k.length)}};Re.prototype=new Qa,Re.prototype.flushDisplayed=function(o){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},d=[];this.displayed_.forEach((h,f)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(f)}h.text.length&&d.push({text:h.text,line:f+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(f)}),d.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:d,stream:this.name_})},Re.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Wi(),this.nonDisplayed_=Wi(),this.lastControlCode_=null,this.column_=0,this.row_=hs,this.rollUpRows_=2,this.formatting_=[]},Re.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Re.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Re.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Re.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Re.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Re.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Re.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Re.prototype.isNormalChar=function(o){return o>=32&&o<=127},Re.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=hs,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Wi(),this.displayed_=Wi()),c!==void 0&&c!==this.row_)for(var d=0;d<this.rollUpRows_;d++)this.displayed_[c-d]=this.displayed_[this.row_-d],this.displayed_[this.row_-d]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Re.prototype.addFormatting=function(o,c){this.formatting_=this.formatting_.concat(c);var d=c.reduce(function(h,f){return h+"<"+f+">"},"");this[this.mode_](o,d)},Re.prototype.clearFormatting=function(o){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(d,h){return d+"</"+h+">"},"");this.formatting_=[],this[this.mode_](o,c)}},Re.prototype.popOn=function(o,c){var d=this.nonDisplayed_[this.row_].text;d+=c,this.nonDisplayed_[this.row_].text=d},Re.prototype.rollUp=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d},Re.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<hs+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Re.prototype.paintOn=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d};var xu={CaptionStream:ft,Cea608Stream:Re,Cea708Stream:Ce},ps={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Lf=t,Df=8589934592,Pf=4294967296,Lu="shared",Ja=function(o,c){var d=1;for(o>c&&(d=-1);Math.abs(c-o)>Pf;)o+=d*Df;return o},Za=function(o){var c,d;Za.prototype.init.call(this),this.type_=o||Lu,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Lu&&h.type!==this.type_||(d===void 0&&(d=h.dts),h.dts=Ja(h.dts,d),h.pts=Ja(h.pts,d),c=h.dts,this.trigger("data",h))},this.flush=function(){d=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){d=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Za.prototype=new Lf;var Du={TimestampRolloverStream:Za,handleRollover:Ja},Rf=(o,c,d)=>{if(!o)return-1;for(var h=d;h<o.length;h++)if(o[h]===c)return h;return-1},Nf={typedArrayIndexOf:Rf},ms=Nf.typedArrayIndexOf,gs={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Pu=function(o,c,d){var h,f="";for(h=c;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},an=function(o,c,d){return decodeURIComponent(Pu(o,c,d))},on=function(o,c,d){return unescape(Pu(o,c,d))},ln=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},un={APIC:function(o){var c=1,d,h,f="-->";o.data[0]===gs.Utf8&&(d=ms(o.data,0,c),!(d<0)&&(o.mimeType=on(o.data,c,d),c=d+1,o.pictureType=o.data[c],c++,h=ms(o.data,0,c),!(h<0)&&(o.description=an(o.data,c,h),c=h+1,o.mimeType===f?o.url=on(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===gs.Utf8&&(o.value=an(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===gs.Utf8&&(c=ms(o.data,0,1),c!==-1&&(o.description=an(o.data,1,c),o.value=an(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=on(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===gs.Utf8&&(c=ms(o.data,0,1),c!==-1&&(o.description=an(o.data,1,c),o.url=on(o.data,c+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var c;for(c=0;c<o.data.length;c++)if(o.data[c]===0){o.owner=on(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},Of=function(o){var c,d,h=10,f=0,y=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){f=ln(o.subarray(6,10)),f+=10;var E=o[5]&64;E&&(h+=4,h+=ln(o.subarray(10,14)),f-=ln(o.subarray(16,20)));do{if(c=ln(o.subarray(h+4,h+8)),c<1)break;d=String.fromCharCode(o[h],o[h+1],o[h+2],o[h+3]);var k={id:d,data:o.subarray(h+10,h+c+10)};k.key=k.id,un[k.id]?un[k.id](k):k.id[0]==="T"?un["T*"](k):k.id[0]==="W"&&un["W*"](k),y.push(k),h+=10,h+=c}while(h<f);return y}},Ru={parseId3Frames:Of,parseSyncSafeInteger:ln,frameParsers:un},Uf=t,Mf=ps,Ai=Ru,fs;fs=function(o){var c={descriptor:o&&o.descriptor},d=0,h=[],f=0,y;if(fs.prototype.init.call(this),this.dispatchType=Mf.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(y=0;y<c.descriptor.length;y++)this.dispatchType+=("00"+c.descriptor[y].toString(16)).slice(-2);this.push=function(E){var k,I,A,N,$,Q;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(f=0,h.length=0),h.length===0&&(E.data.length<10||E.data[0]!==73||E.data[1]!==68||E.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(E),f+=E.data.byteLength,h.length===1&&(d=Ai.parseSyncSafeInteger(E.data.subarray(6,10)),d+=10),!(f<d)){for(k={data:new Uint8Array(d),frames:[],pts:h[0].pts,dts:h[0].dts},$=0;$<d;)k.data.set(h[0].data.subarray(0,d-$),$),$+=h[0].data.byteLength,f-=h[0].data.byteLength,h.shift();I=10,k.data[5]&64&&(I+=4,I+=Ai.parseSyncSafeInteger(k.data.subarray(10,14)),d-=Ai.parseSyncSafeInteger(k.data.subarray(16,20)));do{if(A=Ai.parseSyncSafeInteger(k.data.subarray(I+4,I+8)),A<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Q=String.fromCharCode(k.data[I],k.data[I+1],k.data[I+2],k.data[I+3]),N={id:Q,data:k.data.subarray(I+10,I+A+10)},N.key=N.id,Ai.frameParsers[N.id]?Ai.frameParsers[N.id](N):N.id[0]==="T"?Ai.frameParsers["T*"](N):N.id[0]==="W"&&Ai.frameParsers["W*"](N),N.owner==="com.apple.streaming.transportStreamTimestamp"){var H=N.data,re=(H[3]&1)<<30|H[4]<<22|H[5]<<14|H[6]<<6|H[7]>>>2;re*=4,re+=H[7]&3,N.timeStamp=re,k.pts===void 0&&k.dts===void 0&&(k.pts=N.timeStamp,k.dts=N.timeStamp),this.trigger("timestamp",N)}k.frames.push(N),I+=10,I+=A}while(I<d);this.trigger("data",k)}}}},fs.prototype=new Uf;var Bf=fs,eo=t,to=xu,Vt=ps,Ff=Du.TimestampRolloverStream,ys,cn,_s,hr=188,io=71;ys=function(){var o=new Uint8Array(hr),c=0;ys.prototype.init.call(this),this.push=function(d){var h=0,f=hr,y;for(c?(y=new Uint8Array(d.byteLength+c),y.set(o.subarray(0,c)),y.set(d,c),c=0):y=d;f<y.byteLength;){if(y[h]===io&&y[f]===io){this.trigger("data",y.subarray(h,f)),h+=hr,f+=hr;continue}h++,f++}h<y.byteLength&&(o.set(y.subarray(h),0),c=y.byteLength-h)},this.flush=function(){c===hr&&o[0]===io&&(this.trigger("data",o),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},ys.prototype=new eo,cn=function(){var o,c,d,h;cn.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(f,y){var E=0;y.payloadUnitStartIndicator&&(E+=f[E]+1),y.type==="pat"?c(f.subarray(E),y):d(f.subarray(E),y)},c=function(f,y){y.section_number=f[7],y.last_section_number=f[8],h.pmtPid=(f[10]&31)<<8|f[11],y.pmtPid=h.pmtPid},d=function(f,y){var E,k,I,A;if(f[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(f[1]&15)<<8|f[2],k=3+E-4,I=(f[10]&15)<<8|f[11],A=12+I;A<k;){var N=f[A],$=(f[A+1]&31)<<8|f[A+2];N===Vt.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=$:N===Vt.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=$:N===Vt.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][$]=N),A+=((f[A+3]&15)<<8|f[A+4])+5}y.programMapTable=h.programMapTable}},this.push=function(f){var y={},E=4;if(y.payloadUnitStartIndicator=!!(f[1]&64),y.pid=f[1]&31,y.pid<<=8,y.pid|=f[2],(f[3]&48)>>>4>1&&(E+=f[E]+1),y.pid===0)y.type="pat",o(f.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",o(f.subarray(E),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([f,E,y]):this.processPes_(f,E,y)},this.processPes_=function(f,y,E){E.pid===this.programMapTable.video?E.streamType=Vt.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=Vt.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=f.subarray(y),this.trigger("data",E)}},cn.prototype=new eo,cn.STREAM_TYPES={h264:27,adts:15},_s=function(){var o=this,c=!1,d={data:[],size:0},h={data:[],size:0},f={data:[],size:0},y,E=function(I,A){var N;const $=I[0]<<16|I[1]<<8|I[2];A.data=new Uint8Array,$===1&&(A.packetLength=6+(I[4]<<8|I[5]),A.dataAlignmentIndicator=(I[6]&4)!==0,N=I[7],N&192&&(A.pts=(I[9]&14)<<27|(I[10]&255)<<20|(I[11]&254)<<12|(I[12]&255)<<5|(I[13]&254)>>>3,A.pts*=4,A.pts+=(I[13]&6)>>>1,A.dts=A.pts,N&64&&(A.dts=(I[14]&14)<<27|(I[15]&255)<<20|(I[16]&254)<<12|(I[17]&255)<<5|(I[18]&254)>>>3,A.dts*=4,A.dts+=(I[18]&6)>>>1)),A.data=I.subarray(9+I[8]))},k=function(I,A,N){var $=new Uint8Array(I.size),Q={type:A},H=0,re=0,ae=!1,Qe;if(!(!I.data.length||I.size<9)){for(Q.trackId=I.data[0].pid,H=0;H<I.data.length;H++)Qe=I.data[H],$.set(Qe.data,re),re+=Qe.data.byteLength;E($,Q),ae=A==="video"||Q.packetLength<=I.size,(N||ae)&&(I.size=0,I.data.length=0),ae&&o.trigger("data",Q)}};_s.prototype.init.call(this),this.push=function(I){({pat:function(){},pes:function(){var A,N;switch(I.streamType){case Vt.H264_STREAM_TYPE:A=d,N="video";break;case Vt.ADTS_STREAM_TYPE:A=h,N="audio";break;case Vt.METADATA_STREAM_TYPE:A=f,N="timed-metadata";break;default:return}I.payloadUnitStartIndicator&&k(A,N,!0),A.data.push(I),A.size+=I.data.byteLength},pmt:function(){var A={type:"metadata",tracks:[]};y=I.programMapTable,y.video!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",A)}})[I.type]()},this.reset=function(){d.size=0,d.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){k(d,"video"),k(h,"audio"),k(f,"timed-metadata")},this.flush=function(){if(!c&&y){var I={type:"metadata",tracks:[]};y.video!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),o.trigger("data",I)}c=!1,this.flushStreams_(),this.trigger("done")}},_s.prototype=new eo;var Nu={PAT_PID:0,MP2T_PACKET_LENGTH:hr,TransportPacketStream:ys,TransportParseStream:cn,ElementaryStream:_s,TimestampRolloverStream:Ff,CaptionStream:to.CaptionStream,Cea608Stream:to.Cea608Stream,Cea708Stream:to.Cea708Stream,MetadataStream:Bf};for(var ro in Vt)Vt.hasOwnProperty(ro)&&(Nu[ro]=Vt[ro]);var jf=Nu,$f=t,qf=T.ONE_SECOND_IN_TS,bs,Ou=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];bs=function(o){var c,d=0;bs.prototype.init.call(this),this.skipWarn_=function(h,f){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${f} in frame ${d} outside syncword`})},this.push=function(h){var f=0,y,E,k,I,A;if(o||(d=0),h.type==="audio"){c&&c.length?(k=c,c=new Uint8Array(k.byteLength+h.data.byteLength),c.set(k),c.set(h.data,k.byteLength)):c=h.data;for(var N;f+7<c.length;){if(c[f]!==255||(c[f+1]&246)!==240){typeof N!="number"&&(N=f),f++;continue}if(typeof N=="number"&&(this.skipWarn_(N,f),N=null),E=(~c[f+1]&1)*2,y=(c[f+3]&3)<<11|c[f+4]<<3|(c[f+5]&224)>>5,I=((c[f+6]&3)+1)*1024,A=I*qf/Ou[(c[f+2]&60)>>>2],c.byteLength-f<y)break;this.trigger("data",{pts:h.pts+d*A,dts:h.dts+d*A,sampleCount:I,audioobjecttype:(c[f+2]>>>6&3)+1,channelcount:(c[f+2]&1)<<2|(c[f+3]&192)>>>6,samplerate:Ou[(c[f+2]&60)>>>2],samplingfrequencyindex:(c[f+2]&60)>>>2,samplesize:16,data:c.subarray(f+7+E,f+y)}),d++,f+=y}typeof N=="number"&&(this.skipWarn_(N,f),N=null),c=c.subarray(f)}},this.flush=function(){d=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},bs.prototype=new $f;var Vf=bs,Uu;Uu=function(o){var c=o.byteLength,d=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var f=o.byteLength-c,y=new Uint8Array(4),E=Math.min(4,c);if(E===0)throw new Error("no bytes available");y.set(o.subarray(f,f+E)),d=new DataView(y.buffer).getUint32(0),h=E*8,c-=E},this.skipBits=function(f){var y;h>f?(d<<=f,h-=f):(f-=h,y=Math.floor(f/8),f-=y*8,c-=y,this.loadWord(),d<<=f,h-=f)},this.readBits=function(f){var y=Math.min(h,f),E=d>>>32-y;return h-=y,h>0?d<<=y:c>0&&this.loadWord(),y=f-y,y>0?E<<y|this.readBits(y):E},this.skipLeadingZeros=function(){var f;for(f=0;f<h;++f)if(d&2147483648>>>f)return d<<=f,h-=f,f;return this.loadWord(),f+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var f=this.skipLeadingZeros();return this.readBits(f+1)-1},this.readExpGolomb=function(){var f=this.readUnsignedExpGolomb();return 1&f?1+f>>>1:-1*(f>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Hf=Uu,Mu=t,zf=Hf,vs,dn,Bu;dn=function(){var o=0,c,d;dn.prototype.init.call(this),this.push=function(h){var f;d?(f=new Uint8Array(d.byteLength+h.data.byteLength),f.set(d),f.set(h.data,d.byteLength),d=f):d=h.data;for(var y=d.byteLength;o<y-3;o++)if(d[o+2]===1){c=o+5;break}for(;c<y;)switch(d[c]){case 0:if(d[c-1]!==0){c+=2;break}else if(d[c-2]!==0){c++;break}o+3!==c-2&&this.trigger("data",d.subarray(o+3,c-2));do c++;while(d[c]!==1&&c<y);o=c-2,c+=3;break;case 1:if(d[c-1]!==0||d[c-2]!==0){c+=3;break}this.trigger("data",d.subarray(o+3,c-2)),o=c-2,c+=3;break;default:c+=3;break}d=d.subarray(o),c-=o,o=0},this.reset=function(){d=null,o=0,this.trigger("reset")},this.flush=function(){d&&d.byteLength>3&&this.trigger("data",d.subarray(o+3)),d=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},dn.prototype=new Mu,Bu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},vs=function(){var o=new dn,c,d,h,f,y,E,k;vs.prototype.init.call(this),c=this,this.push=function(I){I.type==="video"&&(d=I.trackId,h=I.pts,f=I.dts,o.push(I))},o.on("data",function(I){var A={trackId:d,pts:h,dts:f,data:I,nalUnitTypeCode:I[0]&31};switch(A.nalUnitTypeCode){case 5:A.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:A.nalUnitType="sei_rbsp",A.escapedRBSP=y(I.subarray(1));break;case 7:A.nalUnitType="seq_parameter_set_rbsp",A.escapedRBSP=y(I.subarray(1)),A.config=E(A.escapedRBSP);break;case 8:A.nalUnitType="pic_parameter_set_rbsp";break;case 9:A.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",A)}),o.on("done",function(){c.trigger("done")}),o.on("partialdone",function(){c.trigger("partialdone")}),o.on("reset",function(){c.trigger("reset")}),o.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},k=function(I,A){var N=8,$=8,Q,H;for(Q=0;Q<I;Q++)$!==0&&(H=A.readExpGolomb(),$=(N+H+256)%256),N=$===0?N:$},y=function(I){for(var A=I.byteLength,N=[],$=1,Q,H;$<A-2;)I[$]===0&&I[$+1]===0&&I[$+2]===3?(N.push($+2),$+=2):$++;if(N.length===0)return I;Q=A-N.length,H=new Uint8Array(Q);var re=0;for($=0;$<Q;re++,$++)re===N[0]&&(re++,N.shift()),H[$]=I[re];return H},E=function(I){var A=0,N=0,$=0,Q=0,H,re,ae,Qe,ut,Jt,bn,Ps,Rs,Ki,vn,De=[1,1],mc,Yi;if(H=new zf(I),re=H.readUnsignedByte(),Qe=H.readUnsignedByte(),ae=H.readUnsignedByte(),H.skipUnsignedExpGolomb(),Bu[re]&&(ut=H.readUnsignedExpGolomb(),ut===3&&H.skipBits(1),H.skipUnsignedExpGolomb(),H.skipUnsignedExpGolomb(),H.skipBits(1),H.readBoolean()))for(vn=ut!==3?8:12,Yi=0;Yi<vn;Yi++)H.readBoolean()&&(Yi<6?k(16,H):k(64,H));if(H.skipUnsignedExpGolomb(),Jt=H.readUnsignedExpGolomb(),Jt===0)H.readUnsignedExpGolomb();else if(Jt===1)for(H.skipBits(1),H.skipExpGolomb(),H.skipExpGolomb(),bn=H.readUnsignedExpGolomb(),Yi=0;Yi<bn;Yi++)H.skipExpGolomb();if(H.skipUnsignedExpGolomb(),H.skipBits(1),Ps=H.readUnsignedExpGolomb(),Rs=H.readUnsignedExpGolomb(),Ki=H.readBits(1),Ki===0&&H.skipBits(1),H.skipBits(1),H.readBoolean()&&(A=H.readUnsignedExpGolomb(),N=H.readUnsignedExpGolomb(),$=H.readUnsignedExpGolomb(),Q=H.readUnsignedExpGolomb()),H.readBoolean()&&H.readBoolean()){switch(mc=H.readUnsignedByte(),mc){case 1:De=[1,1];break;case 2:De=[12,11];break;case 3:De=[10,11];break;case 4:De=[16,11];break;case 5:De=[40,33];break;case 6:De=[24,11];break;case 7:De=[20,11];break;case 8:De=[32,11];break;case 9:De=[80,33];break;case 10:De=[18,11];break;case 11:De=[15,11];break;case 12:De=[64,33];break;case 13:De=[160,99];break;case 14:De=[4,3];break;case 15:De=[3,2];break;case 16:De=[2,1];break;case 255:{De=[H.readUnsignedByte()<<8|H.readUnsignedByte(),H.readUnsignedByte()<<8|H.readUnsignedByte()];break}}De&&De[0]/De[1]}return{profileIdc:re,levelIdc:ae,profileCompatibility:Qe,width:(Ps+1)*16-A*2-N*2,height:(2-Ki)*(Rs+1)*16-$*2-Q*2,sarRatio:De}}},vs.prototype=new Mu;var Wf={H264Stream:vs,NalByteStream:dn},Gf=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Fu=function(o,c){var d=o[c+6]<<21|o[c+7]<<14|o[c+8]<<7|o[c+9],h=o[c+5],f=(h&16)>>4;return d=d>=0?d:0,f?d+20:d+10},ju=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=Fu(o,c),ju(o,c))},Xf=function(o){var c=ju(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},$u=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Kf=function(o,c,d){var h,f="";for(h=c;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},Yf=function(o,c,d){return unescape(Kf(o,c,d))},Qf=function(o,c){var d=(o[c+5]&224)>>5,h=o[c+4]<<3,f=o[c+3]&6144;return f|h|d},Jf=function(o,c){return o[c]===73&&o[c+1]===68&&o[c+2]===51?"timed-metadata":o[c]&!0&&(o[c+1]&240)===240?"audio":null},Zf=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return Gf[(o[c+2]&60)>>>2]}return null},ey=function(o){var c,d,h,f;c=10,o[5]&64&&(c+=4,c+=$u(o.subarray(10,14)));do{if(d=$u(o.subarray(c+4,c+8)),d<1)return null;if(f=String.fromCharCode(o[c],o[c+1],o[c+2],o[c+3]),f==="PRIV"){h=o.subarray(c+10,c+d+10);for(var y=0;y<h.byteLength;y++)if(h[y]===0){var E=Yf(h,0,y);if(E==="com.apple.streaming.transportStreamTimestamp"){var k=h.subarray(y+1),I=(k[3]&1)<<30|k[4]<<22|k[5]<<14|k[6]<<6|k[7]>>>2;return I*=4,I+=k[7]&3,I}break}}c+=10,c+=d}while(c<o.byteLength);return null},no={isLikelyAacData:Xf,parseId3TagSize:Fu,parseAdtsSize:Qf,parseType:Jf,parseSampleRate:Zf,parseAacTimestamp:ey},ty=t,qu=no,Ts;Ts=function(){var o=new Uint8Array,c=0;Ts.prototype.init.call(this),this.setTimestamp=function(d){c=d},this.push=function(d){var h=0,f=0,y,E,k,I;for(o.length?(I=o.length,o=new Uint8Array(d.byteLength+I),o.set(o.subarray(0,I)),o.set(d,I)):o=d;o.length-f>=3;){if(o[f]===73&&o[f+1]===68&&o[f+2]===51){if(o.length-f<10||(h=qu.parseId3TagSize(o,f),f+h>o.length))break;E={type:"timed-metadata",data:o.subarray(f,f+h)},this.trigger("data",E),f+=h;continue}else if((o[f]&255)===255&&(o[f+1]&240)===240){if(o.length-f<7||(h=qu.parseAdtsSize(o,f),f+h>o.length))break;k={type:"audio",data:o.subarray(f,f+h),pts:c,dts:c},this.trigger("data",k),f+=h;continue}f++}y=o.length-f,y>0?o=o.subarray(f):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},Ts.prototype=new ty;var iy=Ts,ry=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],ny=ry,sy=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ay=sy,Ss=t,hn=cr,pn=Hi,Es=Ee,Ht=vf,pi=jf,ws=T,Vu=Vf,oy=Wf.H264Stream,ly=iy,uy=no.isLikelyAacData,cy=T.ONE_SECOND_IN_TS,so=ny,ao=ay,mn,pr,ks,Gi,dy=function(o,c){c.stream=o,this.trigger("log",c)},Hu=function(o,c){for(var d=Object.keys(c),h=0;h<d.length;h++){var f=d[h];f==="headOfPipeline"||!c[f].on||c[f].on("log",dy.bind(o,f))}},zu=function(o,c){var d;if(o.length!==c.length)return!1;for(d=0;d<o.length;d++)if(o[d]!==c[d])return!1;return!0},oo=function(o,c,d,h,f,y){var E=d-c,k=h-c,I=f-d;return{start:{dts:o,pts:o+E},end:{dts:o+k,pts:o+I},prependedContentDuration:y,baseMediaDecodeTime:o}};pr=function(o,c){var d=[],h,f=0,y=0,E=1/0;c=c||{},h=c.firstSequenceNumber||0,pr.prototype.init.call(this),this.push=function(k){Ht.collectDtsInfo(o,k),o&&so.forEach(function(I){o[I]=k[I]}),d.push(k)},this.setEarliestDts=function(k){f=k},this.setVideoBaseMediaDecodeTime=function(k){E=k},this.setAudioAppendStart=function(k){y=k},this.flush=function(){var k,I,A,N,$,Q,H;if(d.length===0){this.trigger("done","AudioSegmentStream");return}k=Es.trimAdtsFramesByEarliestDts(d,o,f),o.baseMediaDecodeTime=Ht.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),H=Es.prefixWithSilence(o,k,y,E),o.samples=Es.generateSampleTable(k),A=hn.mdat(Es.concatenateFrameData(k)),d=[],I=hn.moof(h,[o]),N=new Uint8Array(I.byteLength+A.byteLength),h++,N.set(I),N.set(A,I.byteLength),Ht.clearDtsInfo(o),$=Math.ceil(cy*1024/o.samplerate),k.length&&(Q=k.length*$,this.trigger("segmentTimingInfo",oo(ws.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),k[0].dts,k[0].pts,k[0].dts+Q,k[0].pts+Q,H||0)),this.trigger("timingInfo",{start:k[0].pts,end:k[0].pts+Q})),this.trigger("data",{track:o,boxes:N}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Ht.clearDtsInfo(o),d=[],this.trigger("reset")}},pr.prototype=new Ss,mn=function(o,c){var d,h=[],f=[],y,E;c=c||{},d=c.firstSequenceNumber||0,mn.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(k){Ht.collectDtsInfo(o,k),k.nalUnitType==="seq_parameter_set_rbsp"&&!y&&(y=k.config,o.sps=[k.data],ao.forEach(function(I){o[I]=y[I]},this)),k.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=k.data,o.pps=[k.data]),h.push(k)},this.flush=function(){for(var k,I,A,N,$,Q,H=0,re,ae;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(k=pn.groupNalsIntoFrames(h),A=pn.groupFramesIntoGops(k),A[0][0].keyFrame||(I=this.getGopForFusion_(h[0],o),I?(H=I.duration,A.unshift(I),A.byteLength+=I.byteLength,A.nalCount+=I.nalCount,A.pts=I.pts,A.dts=I.dts,A.duration+=I.duration):A=pn.extendFirstKeyFrame(A)),f.length){var Qe;if(c.alignGopsAtEnd?Qe=this.alignGopsAtEnd_(A):Qe=this.alignGopsAtStart_(A),!Qe){this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Ht.clearDtsInfo(o),A=Qe}Ht.collectDtsInfo(o,A),o.samples=pn.generateSampleTable(A),$=hn.mdat(pn.concatenateNalData(A)),o.baseMediaDecodeTime=Ht.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",A.map(function(ut){return{pts:ut.pts,dts:ut.dts,byteLength:ut.byteLength}})),re=A[0],ae=A[A.length-1],this.trigger("segmentTimingInfo",oo(o.baseMediaDecodeTime,re.dts,re.pts,ae.dts+ae.duration,ae.pts+ae.duration,H)),this.trigger("timingInfo",{start:A[0].pts,end:A[A.length-1].pts+A[A.length-1].duration}),this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),N=hn.moof(d,[o]),Q=new Uint8Array(N.byteLength+$.byteLength),d++,Q.set(N),Q.set($,N.byteLength),this.trigger("data",{track:o,boxes:Q}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,f.length=0,this.trigger("reset")},this.resetStream_=function(){Ht.clearDtsInfo(o),y=void 0,E=void 0},this.getGopForFusion_=function(k){var I=45e3,A=1e4,N=1/0,$,Q,H,re,ae;for(ae=0;ae<this.gopCache_.length;ae++)re=this.gopCache_[ae],H=re.gop,!(!(o.pps&&zu(o.pps[0],re.pps[0]))||!(o.sps&&zu(o.sps[0],re.sps[0])))&&(H.dts<o.timelineStartInfo.dts||($=k.dts-H.dts-H.duration,$>=-A&&$<=I&&(!Q||N>$)&&(Q=re,N=$)));return Q?Q.gop:null},this.alignGopsAtStart_=function(k){var I,A,N,$,Q,H,re,ae;for(Q=k.byteLength,H=k.nalCount,re=k.duration,I=A=0;I<f.length&&A<k.length&&(N=f[I],$=k[A],N.pts!==$.pts);){if($.pts>N.pts){I++;continue}A++,Q-=$.byteLength,H-=$.nalCount,re-=$.duration}return A===0?k:A===k.length?null:(ae=k.slice(A),ae.byteLength=Q,ae.duration=re,ae.nalCount=H,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae)},this.alignGopsAtEnd_=function(k){var I,A,N,$,Q,H;for(I=f.length-1,A=k.length-1,Q=null,H=!1;I>=0&&A>=0;){if(N=f[I],$=k[A],N.pts===$.pts){H=!0;break}if(N.pts>$.pts){I--;continue}I===f.length-1&&(Q=A),A--}if(!H&&Q===null)return null;var re;if(H?re=A:re=Q,re===0)return k;var ae=k.slice(re),Qe=ae.reduce(function(ut,Jt){return ut.byteLength+=Jt.byteLength,ut.duration+=Jt.duration,ut.nalCount+=Jt.nalCount,ut},{byteLength:0,duration:0,nalCount:0});return ae.byteLength=Qe.byteLength,ae.duration=Qe.duration,ae.nalCount=Qe.nalCount,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae},this.alignGopsWith=function(k){f=k}},mn.prototype=new Ss,Gi=function(o,c){this.numberOfTracks=0,this.metadataStream=c,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Gi.prototype.init.call(this),this.push=function(d){if(d.content||d.text)return this.pendingCaptions.push(d);if(d.frames)return this.pendingMetadata.push(d);this.pendingTracks.push(d.track),this.pendingBytes+=d.boxes.byteLength,d.track.type==="video"&&(this.videoTrack=d.track,this.pendingBoxes.push(d.boxes)),d.track.type==="audio"&&(this.audioTrack=d.track,this.pendingBoxes.unshift(d.boxes))}},Gi.prototype=new Ss,Gi.prototype.flush=function(o){var c=0,d={captions:[],captionStreams:{},metadata:[],info:{}},h,f,y,E=0,k;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,ao.forEach(function(I){d.info[I]=this.videoTrack[I]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,so.forEach(function(I){d.info[I]=this.audioTrack[I]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?d.type=this.pendingTracks[0].type:d.type="combined",this.emittedTracks+=this.pendingTracks.length,y=hn.initSegment(this.pendingTracks),d.initSegment=new Uint8Array(y.byteLength),d.initSegment.set(y),d.data=new Uint8Array(this.pendingBytes),k=0;k<this.pendingBoxes.length;k++)d.data.set(this.pendingBoxes[k],c),c+=this.pendingBoxes[k].byteLength;for(k=0;k<this.pendingCaptions.length;k++)h=this.pendingCaptions[k],h.startTime=ws.metadataTsToSeconds(h.startPts,E,this.keepOriginalTimestamps),h.endTime=ws.metadataTsToSeconds(h.endPts,E,this.keepOriginalTimestamps),d.captionStreams[h.stream]=!0,d.captions.push(h);for(k=0;k<this.pendingMetadata.length;k++)f=this.pendingMetadata[k],f.cueTime=ws.metadataTsToSeconds(f.pts,E,this.keepOriginalTimestamps),d.metadata.push(f);for(d.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",d),k=0;k<d.captions.length;k++)h=d.captions[k],this.trigger("caption",h);for(k=0;k<d.metadata.length;k++)f=d.metadata[k],this.trigger("id3Frame",f)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Gi.prototype.setRemux=function(o){this.remuxTracks=o},ks=function(o){var c=this,d=!0,h,f;ks.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new pi.MetadataStream,y.aacStream=new ly,y.audioTimestampRolloverStream=new pi.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new pi.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Vu,y.coalesceStream=new Gi(o,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(E){y.aacStream.setTimestamp(E.timeStamp)}),y.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||y.audioSegmentStream||(f=f||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new pr(f,o),y.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),c.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Hu(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new pi.MetadataStream,y.packetStream=new pi.TransportPacketStream,y.parseStream=new pi.TransportParseStream,y.elementaryStream=new pi.ElementaryStream,y.timestampRolloverStream=new pi.TimestampRolloverStream,y.adtsStream=new Vu,y.h264Stream=new oy,y.captionStream=new pi.CaptionStream(o),y.coalesceStream=new Gi(o,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(E){var k;if(E.type==="metadata"){for(k=E.tracks.length;k--;)!h&&E.tracks[k].type==="video"?(h=E.tracks[k],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!f&&E.tracks[k].type==="audio"&&(f=E.tracks[k],f.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new mn(h,o),y.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(I){f&&!o.keepOriginalTimestamps&&(f.timelineStartInfo=I,y.audioSegmentStream.setEarliestDts(I.dts-c.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(I){f&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(I)}),y.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),f&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new pr(f,o),y.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!f,hasVideo:!!h})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,c.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),Hu(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),f&&(f.timelineStartInfo.dts=void 0,f.timelineStartInfo.pts=void 0,Ht.clearDtsInfo(f),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),h&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Ht.clearDtsInfo(h),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){f&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;o.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var E=this;return function(k){k.stream=y,E.trigger("log",k)}},this.push=function(y){if(d){var E=uy(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){d=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}},ks.prototype=new Ss;var hy={Transmuxer:ks,VideoSegmentStream:mn,AudioSegmentStream:pr,AUDIO_PROPERTIES:so,VIDEO_PROPERTIES:ao,generateSegmentTimingInfo:oo},py=function(o){return o>>>0},my=function(o){return("00"+o.toString(16)).slice(-2)},Cs={toUnsigned:py,toHexString:my},gy=function(o){var c="";return c+=String.fromCharCode(o[0]),c+=String.fromCharCode(o[1]),c+=String.fromCharCode(o[2]),c+=String.fromCharCode(o[3]),c},lo=gy,fy=Cs.toUnsigned,yy=lo,Wu=function(o,c){var d=[],h,f,y,E,k;if(!c.length)return null;for(h=0;h<o.byteLength;)f=fy(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3]),y=yy(o.subarray(h+4,h+8)),E=f>1?h+f:o.byteLength,y===c[0]&&(c.length===1?d.push(o.subarray(h+8,E)):(k=Wu(o.subarray(h+8,E),c.slice(1)),k.length&&(d=d.concat(k)))),h=E;return d},Is=Wu,_y=Cs.toUnsigned,by=s.getUint64,vy=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=by(o.subarray(4)):c.baseMediaDecodeTime=_y(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},uo=vy,Ty=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4)},h=d.flags[2]&1,f=d.flags[2]&2,y=d.flags[2]&8,E=d.flags[2]&16,k=d.flags[2]&32,I=d.flags[0]&65536,A=d.flags[0]&131072,N;return N=8,h&&(N+=4,d.baseDataOffset=c.getUint32(12),N+=4),f&&(d.sampleDescriptionIndex=c.getUint32(N),N+=4),y&&(d.defaultSampleDuration=c.getUint32(N),N+=4),E&&(d.defaultSampleSize=c.getUint32(N),N+=4),k&&(d.defaultSampleFlags=c.getUint32(N)),I&&(d.durationIsEmpty=!0),!h&&A&&(d.baseDataOffsetIsMoof=!0),d},co=Ty,Gu=s.getUint64,Sy=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),references:[],referenceId:c.getUint32(4),timescale:c.getUint32(8)},h=12;d.version===0?(d.earliestPresentationTime=c.getUint32(h),d.firstOffset=c.getUint32(h+4),h+=8):(d.earliestPresentationTime=Gu(o.subarray(h)),d.firstOffset=Gu(o.subarray(h+8)),h+=16),h+=2;var f=c.getUint16(h);for(h+=2;f>0;h+=12,f--)d.references.push({referenceType:(o[h]&128)>>>7,referencedSize:c.getUint32(h)&2147483647,subsegmentDuration:c.getUint32(h+4),startsWithSap:!!(o[h+8]&128),sapType:(o[h+8]&112)>>>4,sapDeltaTime:c.getUint32(h+8)&268435455});return d},Ey=Sy,wy=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},ky=wy,Xu=ky,Cy=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d=new DataView(o.buffer,o.byteOffset,o.byteLength),h=c.flags[2]&1,f=c.flags[2]&4,y=c.flags[1]&1,E=c.flags[1]&2,k=c.flags[1]&4,I=c.flags[1]&8,A=d.getUint32(4),N=8,$;for(h&&(c.dataOffset=d.getInt32(N),N+=4),f&&A&&($={flags:Xu(o.subarray(N,N+4))},N+=4,y&&($.duration=d.getUint32(N),N+=4),E&&($.size=d.getUint32(N),N+=4),I&&(c.version===1?$.compositionTimeOffset=d.getInt32(N):$.compositionTimeOffset=d.getUint32(N),N+=4),c.samples.push($),A--);A--;)$={},y&&($.duration=d.getUint32(N),N+=4),E&&($.size=d.getUint32(N),N+=4),k&&($.flags=Xu(o.subarray(N,N+4)),N+=4),I&&(c.version===1?$.compositionTimeOffset=d.getInt32(N):$.compositionTimeOffset=d.getUint32(N),N+=4),c.samples.push($);return c},Ku=Cy,Iy=s,Yu=Iy.getUint64,it,ho,Nt=function(o){return new Date(o*1e3-20828448e5)},gn=lo,Ay=Is,xy=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=[],h,f;for(h=0;h+4<o.length;h+=f){if(f=c.getUint32(h),h+=4,f<=0){d.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(o[h]&31){case 1:d.push("slice_layer_without_partitioning_rbsp");break;case 5:d.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:d.push("sei_rbsp");break;case 7:d.push("seq_parameter_set_rbsp");break;case 8:d.push("pic_parameter_set_rbsp");break;case 9:d.push("access_unit_delimiter_rbsp");break;default:d.push("UNKNOWN NAL - "+o[h]&31);break}}return d},xi={avc1:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{dataReferenceIndex:c.getUint16(6),width:c.getUint16(24),height:c.getUint16(26),horizresolution:c.getUint16(28)+c.getUint16(30)/16,vertresolution:c.getUint16(32)+c.getUint16(34)/16,frameCount:c.getUint16(40),depth:c.getUint16(74),config:it(o.subarray(78,o.byteLength))}},avcC:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={configurationVersion:o[0],avcProfileIndication:o[1],profileCompatibility:o[2],avcLevelIndication:o[3],lengthSizeMinusOne:o[4]&3,sps:[],pps:[]},h=o[5]&31,f,y,E,k;for(E=6,k=0;k<h;k++)y=c.getUint16(E),E+=2,d.sps.push(new Uint8Array(o.subarray(E,E+y))),E+=y;for(f=o[E],E++,k=0;k<f;k++)y=c.getUint16(E),E+=2,d.pps.push(new Uint8Array(o.subarray(E,E+y))),E+=y;return d},btrt:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{bufferSizeDB:c.getUint32(0),maxBitrate:c.getUint32(4),avgBitrate:c.getUint32(8)}},edts:function(o){return{boxes:it(o)}},elst:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),edits:[]},h=c.getUint32(4),f;for(f=8;h;h--)d.version===0?(d.edits.push({segmentDuration:c.getUint32(f),mediaTime:c.getInt32(f+4),mediaRate:c.getUint16(f+8)+c.getUint16(f+10)/(256*256)}),f+=12):(d.edits.push({segmentDuration:Yu(o.subarray(f)),mediaTime:Yu(o.subarray(f+8)),mediaRate:c.getUint16(f+16)+c.getUint16(f+18)/(256*256)}),f+=20);return d},esds:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),esId:o[6]<<8|o[7],streamPriority:o[8]&31,decoderConfig:{objectProfileIndication:o[11],streamType:o[12]>>>2&63,bufferSize:o[13]<<16|o[14]<<8|o[15],maxBitrate:o[16]<<24|o[17]<<16|o[18]<<8|o[19],avgBitrate:o[20]<<24|o[21]<<16|o[22]<<8|o[23],decoderConfigDescriptor:{tag:o[24],length:o[25],audioObjectType:o[26]>>>3&31,samplingFrequencyIndex:(o[26]&7)<<1|o[27]>>>7&1,channelConfiguration:o[27]>>>3&15}}}},ftyp:function(o){for(var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={majorBrand:gn(o.subarray(0,4)),minorVersion:c.getUint32(4),compatibleBrands:[]},h=8;h<o.byteLength;)d.compatibleBrands.push(gn(o.subarray(h,h+4))),h+=4;return d},dinf:function(o){return{boxes:it(o)}},dref:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),dataReferences:it(o.subarray(8))}},hdlr:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),handlerType:gn(o.subarray(8,12)),name:""},h=8;for(h=24;h<o.byteLength;h++){if(o[h]===0){h++;break}d.name+=String.fromCharCode(o[h])}return d.name=decodeURIComponent(escape(d.name)),d},mdat:function(o){return{byteLength:o.byteLength,nals:xy(o)}},mdhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h,f={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),language:""};return f.version===1?(d+=4,f.creationTime=Nt(c.getUint32(d)),d+=8,f.modificationTime=Nt(c.getUint32(d)),d+=4,f.timescale=c.getUint32(d),d+=8,f.duration=c.getUint32(d)):(f.creationTime=Nt(c.getUint32(d)),d+=4,f.modificationTime=Nt(c.getUint32(d)),d+=4,f.timescale=c.getUint32(d),d+=4,f.duration=c.getUint32(d)),d+=4,h=c.getUint16(d),f.language+=String.fromCharCode((h>>10)+96),f.language+=String.fromCharCode(((h&992)>>5)+96),f.language+=String.fromCharCode((h&31)+96),f},mdia:function(o){return{boxes:it(o)}},mfhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sequenceNumber:o[4]<<24|o[5]<<16|o[6]<<8|o[7]}},minf:function(o){return{boxes:it(o)}},mp4a:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={dataReferenceIndex:c.getUint16(6),channelcount:c.getUint16(16),samplesize:c.getUint16(18),samplerate:c.getUint16(24)+c.getUint16(26)/65536};return o.byteLength>28&&(d.streamDescriptor=it(o.subarray(28))[0]),d},moof:function(o){return{boxes:it(o)}},moov:function(o){return{boxes:it(o)}},mvex:function(o){return{boxes:it(o)}},mvhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=Nt(c.getUint32(d)),d+=8,h.modificationTime=Nt(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=8,h.duration=c.getUint32(d)):(h.creationTime=Nt(c.getUint32(d)),d+=4,h.modificationTime=Nt(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=4,h.duration=c.getUint32(d)),d+=4,h.rate=c.getUint16(d)+c.getUint16(d+2)/16,d+=4,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,d+=2*4,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,d+=6*4,h.nextTrackId=c.getUint32(d),h},pdin:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),rate:c.getUint32(4),initialDelay:c.getUint32(8)}},sdtp:function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d;for(d=4;d<o.byteLength;d++)c.samples.push({dependsOn:(o[d]&48)>>4,isDependedOn:(o[d]&12)>>2,hasRedundancy:o[d]&3});return c},sidx:Ey,smhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),balance:o[4]+o[5]/256}},stbl:function(o){return{boxes:it(o)}},ctts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),compositionOffsets:[]},h=c.getUint32(4),f;for(f=8;h;f+=8,h--)d.compositionOffsets.push({sampleCount:c.getUint32(f),sampleOffset:c[d.version===0?"getUint32":"getInt32"](f+4)});return d},stss:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),syncSamples:[]},h=c.getUint32(4),f;for(f=8;h;f+=4,h--)d.syncSamples.push(c.getUint32(f));return d},stco:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),chunkOffsets:[]},h=c.getUint32(4),f;for(f=8;h;f+=4,h--)d.chunkOffsets.push(c.getUint32(f));return d},stsc:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=c.getUint32(4),h={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleToChunks:[]},f;for(f=8;d;f+=12,d--)h.sampleToChunks.push({firstChunk:c.getUint32(f),samplesPerChunk:c.getUint32(f+4),sampleDescriptionIndex:c.getUint32(f+8)});return h},stsd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleDescriptions:it(o.subarray(8))}},stsz:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleSize:c.getUint32(4),entries:[]},h;for(h=12;h<o.byteLength;h+=4)d.entries.push(c.getUint32(h));return d},stts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),timeToSamples:[]},h=c.getUint32(4),f;for(f=8;h;f+=8,h--)d.timeToSamples.push({sampleCount:c.getUint32(f),sampleDelta:c.getUint32(f+4)});return d},styp:function(o){return xi.ftyp(o)},tfdt:uo,tfhd:co,tkhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=Nt(c.getUint32(d)),d+=8,h.modificationTime=Nt(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=8,h.duration=c.getUint32(d)):(h.creationTime=Nt(c.getUint32(d)),d+=4,h.modificationTime=Nt(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=4,h.duration=c.getUint32(d)),d+=4,d+=2*4,h.layer=c.getUint16(d),d+=2,h.alternateGroup=c.getUint16(d),d+=2,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,h.width=c.getUint16(d)+c.getUint16(d+2)/65536,d+=4,h.height=c.getUint16(d)+c.getUint16(d+2)/65536,h},traf:function(o){return{boxes:it(o)}},trak:function(o){return{boxes:it(o)}},trex:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4),defaultSampleDescriptionIndex:c.getUint32(8),defaultSampleDuration:c.getUint32(12),defaultSampleSize:c.getUint32(16),sampleDependsOn:o[20]&3,sampleIsDependedOn:(o[21]&192)>>6,sampleHasRedundancy:(o[21]&48)>>4,samplePaddingValue:(o[21]&14)>>1,sampleIsDifferenceSample:!!(o[21]&1),sampleDegradationPriority:c.getUint16(22)}},trun:Ku,"url ":function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4))}},vmhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),graphicsmode:c.getUint16(4),opcolor:new Uint16Array([c.getUint16(6),c.getUint16(8),c.getUint16(10)])}}};it=function(o){for(var c=0,d=[],h,f,y,E,k,I=new ArrayBuffer(o.length),A=new Uint8Array(I),N=0;N<o.length;++N)A[N]=o[N];for(h=new DataView(I);c<o.byteLength;)f=h.getUint32(c),y=gn(o.subarray(c+4,c+8)),E=f>1?c+f:o.byteLength,k=(xi[y]||function($){return{data:$}})(o.subarray(c+8,E)),k.size=f,k.type=y,d.push(k),c=E;return d},ho=function(o,c){var d;return c=c||0,d=new Array(c*2+1).join(" "),o.map(function(h,f){return d+h.type+`
|
|
200
200
|
`+Object.keys(h).filter(function(y){return y!=="type"&&y!=="boxes"}).map(function(y){var E=d+" "+y+": ",k=h[y];if(k instanceof Uint8Array||k instanceof Uint32Array){var I=Array.prototype.slice.call(new Uint8Array(k.buffer,k.byteOffset,k.byteLength)).map(function(A){return" "+("00"+A.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return I?I.length===1?E+"<"+I.join("").slice(1)+">":E+`<
|
|
201
201
|
`+I.map(function(A){return d+" "+A}).join(`
|
|
202
202
|
`)+`
|
|
203
203
|
`+d+" >":E+"<>"}return E+JSON.stringify(k,null,2).split(`
|
|
204
|
-
`).map(function(A,
|
|
204
|
+
`).map(function(A,N){return N===0?A:d+" "+A}).join(`
|
|
205
205
|
`)}).join(`
|
|
206
206
|
`)+(h.boxes?`
|
|
207
|
-
`+
|
|
208
|
-
`)};var Yu={inspect:Je,textify:co,parseType:dn,findBox:Ty,parseTraf:Ci.traf,parseTfdt:Ci.tfdt,parseHdlr:Ci.hdlr,parseTfhd:Ci.tfhd,parseTrun:Ci.trun,parseSidx:Ci.sidx},Ey=function(o){for(var c=0,d=String.fromCharCode(o[c]),h="";d!=="\0";)h+=d,c++,d=String.fromCharCode(o[c]);return h+=d,h},wy={uint8ToCString:Ey},Cs=wy.uint8ToCString,ky=s.getUint64,Cy=function(o){var c=4,d=o[0],h,f,y,E,k,I,A,R;if(d===0){h=Cs(o.subarray(c)),c+=h.length,f=Cs(o.subarray(c)),c+=f.length;var q=new DataView(o.buffer);y=q.getUint32(c),c+=4,k=q.getUint32(c),c+=4,I=q.getUint32(c),c+=4,A=q.getUint32(c),c+=4}else if(d===1){var q=new DataView(o.buffer);y=q.getUint32(c),c+=4,E=ky(o.subarray(c)),c+=8,I=q.getUint32(c),c+=4,A=q.getUint32(c),c+=4,h=Cs(o.subarray(c)),c+=h.length,f=Cs(o.subarray(c)),c+=f.length}R=new Uint8Array(o.subarray(c,o.byteLength));var Q={scheme_id_uri:h,value:f,timescale:y||1,presentation_time:E,presentation_time_delta:k,event_duration:I,id:A,message_data:R};return Ay(d,Q)?Q:void 0},Iy=function(o,c,d,h){return o||o===0?o/c:h+d/c},Ay=function(o,c){var d=c.scheme_id_uri!=="\0",h=o===0&&Qu(c.presentation_time_delta)&&d,f=o===1&&Qu(c.presentation_time)&&d;return!(o>1)&&h||f},Qu=function(o){return o!==void 0||o!==null},xy={parseEmsgBox:Cy,scaleTime:Iy},hn;typeof window<"u"?hn=window:typeof i<"u"?hn=i:typeof self<"u"?hn=self:hn={};var Ju=hn,Is=ws.toUnsigned,pn=ws.toHexString,je=ks,cr=oo,ho=xy,Ly=uo,Dy=Xu,Py=lo,Ry=s.getUint64,Zu,ec,tc,ic,rc,po,nc,go=Ju,Ny=Pu.parseId3Frames;Zu=function(o){var c={},d=je(o,["moov","trak"]);return d.reduce(function(h,f){var y,E,k,I,A;return y=je(f,["tkhd"])[0],!y||(E=y[0],k=E===0?12:20,I=Is(y[k]<<24|y[k+1]<<16|y[k+2]<<8|y[k+3]),A=je(f,["mdia","mdhd"])[0],!A)?null:(E=A[0],k=E===0?12:20,h[I]=Is(A[k]<<24|A[k+1]<<16|A[k+2]<<8|A[k+3]),h)},c)},ec=function(o,c){var d;d=je(c,["moof","traf"]);var h=d.reduce(function(f,y){var E=je(y,["tfhd"])[0],k=Is(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),I=o[k]||9e4,A=je(y,["tfdt"])[0],R=new DataView(A.buffer,A.byteOffset,A.byteLength),q;A[0]===1?q=Ry(A.subarray(4,12)):q=R.getUint32(4);let Q;return typeof q=="bigint"?Q=q/go.BigInt(I):typeof q=="number"&&!isNaN(q)&&(Q=q/I),Q<Number.MAX_SAFE_INTEGER&&(Q=Number(Q)),Q<f&&(f=Q),f},1/0);return typeof h=="bigint"||isFinite(h)?h:0},tc=function(o,c){var d=je(c,["moof","traf"]),h=0,f=0,y;if(d&&d.length){var E=je(d[0],["tfhd"])[0],k=je(d[0],["trun"])[0],I=je(d[0],["tfdt"])[0];if(E){var A=Ly(E);y=A.trackId}if(I){var R=Py(I);h=R.baseMediaDecodeTime}if(k){var q=Dy(k);q.samples&&q.samples.length&&(f=q.samples[0].compositionTimeOffset||0)}}var Q=o[y]||9e4;typeof h=="bigint"&&(f=go.BigInt(f),Q=go.BigInt(Q));var z=(h+f)/Q;return typeof z=="bigint"&&z<Number.MAX_SAFE_INTEGER&&(z=Number(z)),z},ic=function(o){var c=je(o,["moov","trak"]),d=[];return c.forEach(function(h){var f=je(h,["mdia","hdlr"]),y=je(h,["tkhd"]);f.forEach(function(E,k){var I=cr(E.subarray(8,12)),A=y[k],R,q,Q;I==="vide"&&(R=new DataView(A.buffer,A.byteOffset,A.byteLength),q=R.getUint8(0),Q=q===0?R.getUint32(12):R.getUint32(20),d.push(Q))})}),d},po=function(o){var c=o[0],d=c===0?12:20;return Is(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3])},rc=function(o){var c=je(o,["moov","trak"]),d=[];return c.forEach(function(h){var f={},y=je(h,["tkhd"])[0],E,k;y&&(E=new DataView(y.buffer,y.byteOffset,y.byteLength),k=E.getUint8(0),f.id=k===0?E.getUint32(12):E.getUint32(20));var I=je(h,["mdia","hdlr"])[0];if(I){var A=cr(I.subarray(8,12));A==="vide"?f.type="video":A==="soun"?f.type="audio":f.type=A}var R=je(h,["mdia","minf","stbl","stsd"])[0];if(R){var q=R.subarray(8);f.codec=cr(q.subarray(4,8));var Q=je(q,[f.codec])[0],z,te;Q&&(/^[asm]vc[1-9]$/i.test(f.codec)?(z=Q.subarray(78),te=cr(z.subarray(4,8)),te==="avcC"&&z.length>11?(f.codec+=".",f.codec+=pn(z[9]),f.codec+=pn(z[10]),f.codec+=pn(z[11])):f.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(f.codec)?(z=Q.subarray(28),te=cr(z.subarray(4,8)),te==="esds"&&z.length>20&&z[19]!==0?(f.codec+="."+pn(z[19]),f.codec+="."+pn(z[20]>>>2&63).replace(/^0/,"")):f.codec="mp4a.40.2"):f.codec=f.codec.toLowerCase())}var ae=je(h,["mdia","mdhd"])[0];ae&&(f.timescale=po(ae)),d.push(f)}),d},nc=function(o,c=0){var d=je(o,["emsg"]);return d.map(h=>{var f=ho.parseEmsgBox(new Uint8Array(h)),y=Ny(f.message_data);return{cueTime:ho.scaleTime(f.presentation_time,f.timescale,f.presentation_time_delta,c),duration:ho.scaleTime(f.event_duration,f.timescale),frames:y}})};var gn={findBox:je,parseType:cr,timescale:Zu,startTime:ec,compositionStartTime:tc,videoTrackIds:ic,tracks:rc,getTimescaleFromMediaHeader:po,getEmsgID3:nc};const{parseTrun:Oy}=Yu,{findBox:sc}=gn;var ac=Ju,Uy=function(o){var c=sc(o,["moof","traf"]),d=sc(o,["mdat"]),h=[];return d.forEach(function(f,y){var E=c[y];h.push({mdat:f,traf:E})}),h},My=function(o,c,d){var h=c,f=d.defaultSampleDuration||0,y=d.defaultSampleSize||0,E=d.trackId,k=[];return o.forEach(function(I){var A=Oy(I),R=A.samples;R.forEach(function(q){q.duration===void 0&&(q.duration=f),q.size===void 0&&(q.size=y),q.trackId=E,q.dts=h,q.compositionTimeOffset===void 0&&(q.compositionTimeOffset=0),typeof h=="bigint"?(q.pts=h+ac.BigInt(q.compositionTimeOffset),h+=ac.BigInt(q.duration)):(q.pts=h+q.compositionTimeOffset,h+=q.duration)}),k=k.concat(R)}),k},oc={getMdatTrafPairs:Uy,parseSamples:My},By=Iu.discardEmulationPreventionBytes,Fy=Au.CaptionStream,mo=ks,jy=lo,qy=uo,{getMdatTrafPairs:$y,parseSamples:Vy}=oc,Hy=function(o,c){for(var d=o,h=0;h<c.length;h++){var f=c[h];if(d<f.size)return f;d-=f.size}return null},zy=function(o,c,d){var h=new DataView(o.buffer,o.byteOffset,o.byteLength),f={logs:[],seiNals:[]},y,E,k,I;for(E=0;E+4<o.length;E+=k)if(k=h.getUint32(E),E+=4,!(k<=0))switch(o[E]&31){case 6:var A=o.subarray(E+1,E+1+k),R=Hy(E,c);if(y={nalUnitType:"sei_rbsp",size:k,data:A,escapedRBSP:By(A),trackId:d},R)y.pts=R.pts,y.dts=R.dts,I=R;else if(I)y.pts=I.pts,y.dts=I.dts;else{f.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+d+". See mux.js#223."});break}f.seiNals.push(y);break}return f},Wy=function(o,c){var d={},h=$y(o);return h.forEach(function(f){var y=f.mdat,E=f.traf,k=mo(E,["tfhd"]),I=qy(k[0]),A=I.trackId,R=mo(E,["tfdt"]),q=R.length>0?jy(R[0]).baseMediaDecodeTime:0,Q=mo(E,["trun"]),z,te;c===A&&Q.length>0&&(z=Vy(Q,q,I),te=zy(y,z,A),d[A]||(d[A]={seiNals:[],logs:[]}),d[A].seiNals=d[A].seiNals.concat(te.seiNals),d[A].logs=d[A].logs.concat(te.logs))}),d},Gy=function(o,c,d){var h;if(c===null)return null;h=Wy(o,c);var f=h[c]||{};return{seiNals:f.seiNals,logs:f.logs,timescale:d}},Xy=function(){var o=!1,c,d,h,f,y,E;this.isInitialized=function(){return o},this.init=function(k){c=new Fy,o=!0,E=k?k.isPartial:!1,c.on("data",function(I){I.startTime=I.startPts/f,I.endTime=I.endPts/f,y.captions.push(I),y.captionStreams[I.stream]=!0}),c.on("log",function(I){y.logs.push(I)})},this.isNewInit=function(k,I){return k&&k.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:h!==k[0]||f!==I[h]},this.parse=function(k,I,A){var R;if(this.isInitialized()){if(!I||!A)return null;if(this.isNewInit(I,A))h=I[0],f=A[h];else if(h===null||!f)return d.push(k),null}else return null;for(;d.length>0;){var q=d.shift();this.parse(q,I,A)}return R=Gy(k,h,f),R&&R.logs&&(y.logs=y.logs.concat(R.logs)),R===null||!R.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(R.seiNals),this.flushStream(),y)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(I){c.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;E?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){d=[],h=null,f=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Ky=Xy;const{parseTfdt:Yy}=Yu,Ii=ks,{getTimescaleFromMediaHeader:Qy}=gn,{parseSamples:Jy,getMdatTrafPairs:Zy}=oc;var lc=function(){let o=9e4;this.init=function(c){const d=Ii(c,["moov","trak","mdia","mdhd"])[0];d&&(o=Qy(d))},this.parseSegment=function(c){const d=[],h=Zy(c);let f=0;return h.forEach(function(y){const E=y.mdat,k=y.traf,I=Ii(k,["tfdt"])[0],A=Ii(k,["tfhd"])[0],R=Ii(k,["trun"]);if(I&&(f=Yy(I).baseMediaDecodeTime),R.length&&A){const q=Jy(R,f,A);let Q=0;q.forEach(function(z){const te="utf-8",ae=new TextDecoder(te),Ge=E.slice(Q,Q+z.size);if(Ii(Ge,["vtte"])[0]){Q+=z.size;return}Ii(Ge,["vttc"]).forEach(function(st){const Gt=Ii(st,["payl"])[0],mn=Ii(st,["sttg"])[0],Ls=z.pts/o,Ds=(z.pts+z.duration)/o;let zi,fn;if(Gt)try{zi=ae.decode(Gt)}catch(Ie){console.error(Ie)}if(mn)try{fn=ae.decode(mn)}catch(Ie){console.error(Ie)}z.duration&&zi&&d.push({cueText:zi,start:Ls,end:Ds,settings:fn})}),Q+=z.size})}}),d}},fo=ds,uc=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},As=function(o){return!!(o[1]&64)},xs=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},e_=function(o,c){var d=uc(o);return d===0?"pat":d===c?"pmt":c?"pes":null},t_=function(o){var c=As(o),d=4+xs(o);return c&&(d+=o[d]+1),(o[d+10]&31)<<8|o[d+11]},i_=function(o){var c={},d=As(o),h=4+xs(o);if(d&&(h+=o[h]+1),!!(o[h+5]&1)){var f,y,E;f=(o[h+1]&15)<<8|o[h+2],y=3+f-4,E=(o[h+10]&15)<<8|o[h+11];for(var k=12+E;k<y;){var I=h+k;c[(o[I+1]&31)<<8|o[I+2]]=o[I],k+=((o[I+3]&15)<<8|o[I+4])+5}return c}},r_=function(o,c){var d=uc(o),h=c[d];switch(h){case fo.H264_STREAM_TYPE:return"video";case fo.ADTS_STREAM_TYPE:return"audio";case fo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},n_=function(o){var c=As(o);if(!c)return null;var d=4+xs(o);if(d>=o.byteLength)return null;var h=null,f;return f=o[d+7],f&192&&(h={},h.pts=(o[d+9]&14)<<27|(o[d+10]&255)<<20|(o[d+11]&254)<<12|(o[d+12]&255)<<5|(o[d+13]&254)>>>3,h.pts*=4,h.pts+=(o[d+13]&6)>>>1,h.dts=h.pts,f&64&&(h.dts=(o[d+14]&14)<<27|(o[d+15]&255)<<20|(o[d+16]&254)<<12|(o[d+17]&255)<<5|(o[d+18]&254)>>>3,h.dts*=4,h.dts+=(o[d+18]&6)>>>1)),h},yo=function(o){switch(o){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},s_=function(o){for(var c=4+xs(o),d=o.subarray(c),h=0,f=0,y=!1,E;f<d.byteLength-3;f++)if(d[f+2]===1){h=f+5;break}for(;h<d.byteLength;)switch(d[h]){case 0:if(d[h-1]!==0){h+=2;break}else if(d[h-2]!==0){h++;break}f+3!==h-2&&(E=yo(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0));do h++;while(d[h]!==1&&h<d.length);f=h-2,h+=3;break;case 1:if(d[h-1]!==0||d[h-2]!==0){h+=3;break}E=yo(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0),f=h-2,h+=3;break;default:h+=3;break}return d=d.subarray(f),h-=f,f=0,d&&d.byteLength>3&&(E=yo(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},a_={parseType:e_,parsePat:t_,parsePmt:i_,parsePayloadUnitStartIndicator:As,parsePesType:r_,parsePesTime:n_,videoPacketContainsKeyFrame:s_},cc=ds,dr=Lu.handleRollover,ye={};ye.ts=a_,ye.aac=ro;var Hi=T.ONE_SECOND_IN_TS,nt=188,Wt=71,o_=function(o,c){for(var d=0,h=nt,f,y;h<o.byteLength;){if(o[d]===Wt&&o[h]===Wt){switch(f=o.subarray(d,h),y=ye.ts.parseType(f,c.pid),y){case"pat":c.pid=ye.ts.parsePat(f);break;case"pmt":var E=ye.ts.parsePmt(f);c.table=c.table||{},Object.keys(E).forEach(function(k){c.table[k]=E[k]});break}d+=nt,h+=nt;continue}d++,h++}},dc=function(o,c,d){for(var h=0,f=nt,y,E,k,I,A,R=!1;f<=o.byteLength;){if(o[h]===Wt&&(o[f]===Wt||f===o.byteLength)){switch(y=o.subarray(h,f),E=ye.ts.parseType(y,c.pid),E){case"pes":k=ye.ts.parsePesType(y,c.table),I=ye.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&I&&(A=ye.ts.parsePesTime(y),A&&(A.type="audio",d.audio.push(A),R=!0));break}if(R)break;h+=nt,f+=nt;continue}h++,f++}for(f=o.byteLength,h=f-nt,R=!1;h>=0;){if(o[h]===Wt&&(o[f]===Wt||f===o.byteLength)){switch(y=o.subarray(h,f),E=ye.ts.parseType(y,c.pid),E){case"pes":k=ye.ts.parsePesType(y,c.table),I=ye.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&I&&(A=ye.ts.parsePesTime(y),A&&(A.type="audio",d.audio.push(A),R=!0));break}if(R)break;h-=nt,f-=nt;continue}h--,f--}},l_=function(o,c,d){for(var h=0,f=nt,y,E,k,I,A,R,q,Q,z=!1,te={data:[],size:0};f<o.byteLength;){if(o[h]===Wt&&o[f]===Wt){switch(y=o.subarray(h,f),E=ye.ts.parseType(y,c.pid),E){case"pes":if(k=ye.ts.parsePesType(y,c.table),I=ye.ts.parsePayloadUnitStartIndicator(y),k==="video"&&(I&&!z&&(A=ye.ts.parsePesTime(y),A&&(A.type="video",d.video.push(A),z=!0)),!d.firstKeyFrame)){if(I&&te.size!==0){for(R=new Uint8Array(te.size),q=0;te.data.length;)Q=te.data.shift(),R.set(Q,q),q+=Q.byteLength;if(ye.ts.videoPacketContainsKeyFrame(R)){var ae=ye.ts.parsePesTime(R);ae?(d.firstKeyFrame=ae,d.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}te.size=0}te.data.push(y),te.size+=y.byteLength}break}if(z&&d.firstKeyFrame)break;h+=nt,f+=nt;continue}h++,f++}for(f=o.byteLength,h=f-nt,z=!1;h>=0;){if(o[h]===Wt&&o[f]===Wt){switch(y=o.subarray(h,f),E=ye.ts.parseType(y,c.pid),E){case"pes":k=ye.ts.parsePesType(y,c.table),I=ye.ts.parsePayloadUnitStartIndicator(y),k==="video"&&I&&(A=ye.ts.parsePesTime(y),A&&(A.type="video",d.video.push(A),z=!0));break}if(z)break;h-=nt,f-=nt;continue}h--,f--}},u_=function(o,c){if(o.audio&&o.audio.length){var d=c;(typeof d>"u"||isNaN(d))&&(d=o.audio[0].dts),o.audio.forEach(function(y){y.dts=dr(y.dts,d),y.pts=dr(y.pts,d),y.dtsTime=y.dts/Hi,y.ptsTime=y.pts/Hi})}if(o.video&&o.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=o.video[0].dts),o.video.forEach(function(y){y.dts=dr(y.dts,h),y.pts=dr(y.pts,h),y.dtsTime=y.dts/Hi,y.ptsTime=y.pts/Hi}),o.firstKeyFrame){var f=o.firstKeyFrame;f.dts=dr(f.dts,h),f.pts=dr(f.pts,h),f.dtsTime=f.dts/Hi,f.ptsTime=f.pts/Hi}}},c_=function(o){for(var c=!1,d=0,h=null,f=null,y=0,E=0,k;o.length-E>=3;){var I=ye.aac.parseType(o,E);switch(I){case"timed-metadata":if(o.length-E<10){c=!0;break}if(y=ye.aac.parseId3TagSize(o,E),y>o.length){c=!0;break}f===null&&(k=o.subarray(E,E+y),f=ye.aac.parseAacTimestamp(k)),E+=y;break;case"audio":if(o.length-E<7){c=!0;break}if(y=ye.aac.parseAdtsSize(o,E),y>o.length){c=!0;break}h===null&&(k=o.subarray(E,E+y),h=ye.aac.parseSampleRate(k)),d++,E+=y;break;default:E++;break}if(c)return null}if(h===null||f===null)return null;var A=Hi/h,R={audio:[{type:"audio",dts:f,pts:f},{type:"audio",dts:f+d*1024*A,pts:f+d*1024*A}]};return R},d_=function(o){var c={pid:null,table:null},d={};o_(o,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var f=c.table[h];switch(f){case cc.H264_STREAM_TYPE:d.video=[],l_(o,c,d),d.video.length===0&&delete d.video;break;case cc.ADTS_STREAM_TYPE:d.audio=[],dc(o,c,d),d.audio.length===0&&delete d.audio;break}}return d},h_=function(o,c){var d=ye.aac.isLikelyAacData(o),h;return d?h=c_(o):h=d_(o),!h||!h.audio&&!h.video?null:(u_(h,c),h)},p_={inspect:h_,parseAudioPes_:dc};const g_=function(o,c){c.on("data",function(d){const h=d.initSegment;d.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const f=d.data;d.data=f.buffer,o.postMessage({action:"data",segment:d,byteOffset:f.byteOffset,byteLength:f.byteLength},[d.data])}),c.on("done",function(d){o.postMessage({action:"done"})}),c.on("gopInfo",function(d){o.postMessage({action:"gopInfo",gopInfo:d})}),c.on("videoSegmentTimingInfo",function(d){const h={start:{decode:T.videoTsToSeconds(d.start.dts),presentation:T.videoTsToSeconds(d.start.pts)},end:{decode:T.videoTsToSeconds(d.end.dts),presentation:T.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:T.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=T.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(d){const h={start:{decode:T.videoTsToSeconds(d.start.dts),presentation:T.videoTsToSeconds(d.start.pts)},end:{decode:T.videoTsToSeconds(d.end.dts),presentation:T.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:T.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=T.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(d){o.postMessage({action:"id3Frame",id3Frame:d})}),c.on("caption",function(d){o.postMessage({action:"caption",caption:d})}),c.on("trackinfo",function(d){o.postMessage({action:"trackinfo",trackInfo:d})}),c.on("audioTimingInfo",function(d){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:T.videoTsToSeconds(d.start),end:T.videoTsToSeconds(d.end)}})}),c.on("videoTimingInfo",function(d){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:T.videoTsToSeconds(d.start),end:T.videoTsToSeconds(d.end)}})}),c.on("log",function(d){o.postMessage({action:"log",log:d})})};class hc{constructor(c,d){this.options=d||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new sy.Transmuxer(this.options),g_(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new Ky,this.captionParser.init());const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(d,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:d.buffer},[d.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new lc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(d)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new lc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(d);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:d.buffer},[d.buffer])}probeMp4StartTime({timescales:c,data:d}){const h=gn.startTime(c,d);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:d},[d.buffer])}probeMp4Tracks({data:c}){const d=gn.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:d,data:c},[c.buffer])}probeEmsgID3({data:c,offset:d}){const h=gn.getEmsgID3(c,d);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:d}){const h=typeof d=="number"&&!isNaN(d)?d*T.ONE_SECOND_IN_TS:void 0,f=p_.inspect(c,h);let y=null;f&&(y={hasVideo:f.video&&f.video.length===2||!1,hasAudio:f.audio&&f.audio.length===2||!1},y.hasVideo&&(y.videoStart=f.video[0].ptsTime),y.hasAudio&&(y.audioStart=f.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(d)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const d=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(T.secondsToVideoTs(d)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(T.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new hc(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new hc(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var XE=Dm(GE);const KE=(i,e,t)=>{const{type:r,initSegment:n,captions:s,captionStreams:a,metadata:l,videoFrameDtsTime:u,videoFramePtsTime:p}=i.data.segment;e.buffer.push({captions:s,captionStreams:a,metadata:l});const g=i.data.segment.boxes||{data:i.data.segment.data},b={type:r,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof u<"u"&&(b.videoFrameDtsTime=u),typeof p<"u"&&(b.videoFramePtsTime=p),t(b)},YE=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},QE=(i,e)=>{e.gopInfo=i.data.gopInfo},Nm=i=>{const{transmuxer:e,bytes:t,audioAppendStart:r,gopsToAlignWith:n,remux:s,onData:a,onTrackInfo:l,onAudioTimingInfo:u,onVideoTimingInfo:p,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:b,onId3:S,onCaptions:w,onDone:C,onEndedTimeline:v,onTransmuxerLog:D,isEndOfTimeline:L,segment:O,triggerSegmentEventFn:U}=i,F={buffer:[]};let N=L;const V=Y=>{e.currentTransmux===i&&(Y.data.action==="data"&&KE(Y,F,a),Y.data.action==="trackinfo"&&l(Y.data.trackInfo),Y.data.action==="gopInfo"&&QE(Y,F),Y.data.action==="audioTimingInfo"&&u(Y.data.audioTimingInfo),Y.data.action==="videoTimingInfo"&&p(Y.data.videoTimingInfo),Y.data.action==="videoSegmentTimingInfo"&&g(Y.data.videoSegmentTimingInfo),Y.data.action==="audioSegmentTimingInfo"&&b(Y.data.audioSegmentTimingInfo),Y.data.action==="id3Frame"&&S([Y.data.id3Frame],Y.data.id3Frame.dispatchType),Y.data.action==="caption"&&w(Y.data.caption),Y.data.action==="endedtimeline"&&(N=!1,v()),Y.data.action==="log"&&D(Y.data.log),Y.data.type==="transmuxed"&&(N||(e.onmessage=null,YE({transmuxedData:F,callback:C}),Om(e))))},J=()=>{const Y={message:"Received an error message from the transmuxer worker",metadata:{errorType:B.Error.StreamingFailedToTransmuxSegment,segmentInfo:Ki({segment:O})}};C(null,Y)};if(e.onmessage=V,e.onerror=J,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof s<"u"&&e.postMessage({action:"setRemux",remux:s}),t.byteLength){const Y=t instanceof ArrayBuffer?t:t.buffer,ie=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:O}),e.postMessage({action:"push",data:Y,byteOffset:ie,byteLength:t.byteLength},[Y])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Om=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():Nm(i.currentTransmux))},Yd=(i,e)=>{i.postMessage({action:e}),Om(i)},Um=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Yd(e,i);return}e.transmuxQueue.push(Yd.bind(null,e,i))},JE=i=>{Um("reset",i)},ZE=i=>{Um("endTimeline",i)},Mm=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,Nm(i);return}i.transmuxer.transmuxQueue.push(i)},ew=i=>{const e=new XE;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var jo={reset:JE,endTimeline:ZE,transmux:Mm,createTransmuxer:ew};const xr=function(i){const e=i.transmuxer,t=i.endAction||i.action,r=i.callback,n=Ve({},i,{endAction:null,transmuxer:null,callback:null}),s=a=>{a.data.action===t&&(e.removeEventListener("message",s),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),r(a.data))};if(e.addEventListener("message",s),i.data){const a=i.data instanceof ArrayBuffer;n.byteOffset=a?0:i.data.byteOffset,n.byteLength=i.data.byteLength;const l=[a?i.data:i.data.buffer];e.postMessage(n,l)}else e.postMessage(n)},ti={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Bm="wvtt",gl=i=>{i.forEach(e=>{e.abort()})},tw=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),iw=i=>{const e=i.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=i.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},wu=(i,e)=>{const{requestType:t}=e,r=ir({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:ti.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:ti.ABORTED,xhr:e,metadata:r}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:ti.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:ti.FAILURE,xhr:e,metadata:r}:null},Qd=(i,e,t,r)=>(n,s)=>{const a=s.response,l=wu(n,s);if(l)return t(l,i);if(a.byteLength!==16)return t({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:ti.FAILURE,xhr:s},i);const u=new DataView(a),p=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]);for(let b=0;b<e.length;b++)e[b].bytes=p;const g={uri:s.uri};return r({type:"segmentkeyloadcomplete",segment:i,keyInfo:g}),t(null,i)},rw=(i,e)=>{e===Bm&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},nw=(i,e,t)=>{e===Bm&&xr({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:r,mp4VttCues:n})=>{i.bytes=r,t(null,i,{mp4VttCues:n})}})},Fm=(i,e)=>{const t=Hl(i.map.bytes);if(t!=="mp4"){const r=i.map.resolvedUri||i.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${r}`,code:ti.FAILURE,metadata:{mediaType:n}})}xr({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:r,data:n})=>(i.map.bytes=n,r.forEach(function(s){i.map.tracks=i.map.tracks||{},!i.map.tracks[s.type]&&(i.map.tracks[s.type]=s,typeof s.id=="number"&&s.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[s.id]=s.timescale),s.type==="text"&&rw(i,s.codec))}),e(null))})},sw=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(r,n)=>{const s=wu(r,n);if(s)return e(s,i);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,Fm(i,function(l){if(l)return l.xhr=n,l.status=n.status,e(l,i);e(null,i)})},aw=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:r})=>(n,s)=>{const a=wu(n,s);if(a)return e(a,i);r({type:"segmentloaded",segment:i});const l=t==="arraybuffer"||!s.responseText?s.response:zE(s.responseText.substring(i.lastReachedChar||0));return i.stats=tw(s),i.key?i.encryptedBytes=new Uint8Array(l):i.bytes=new Uint8Array(l),e(null,i)},ow=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{const C=i.map&&i.map.tracks||{},v=!!(C.audio&&C.video);let D=r.bind(null,i,"audio","start");const L=r.bind(null,i,"audio","end");let O=r.bind(null,i,"video","start");const U=r.bind(null,i,"video","end"),F=()=>Mm({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:v,onData:N=>{N.type=N.type==="combined"?"video":N.type,g(i,N)},onTrackInfo:N=>{t&&(v&&(N.isMuxed=!0),t(i,N))},onAudioTimingInfo:N=>{D&&typeof N.start<"u"&&(D(N.start),D=null),L&&typeof N.end<"u"&&L(N.end)},onVideoTimingInfo:N=>{O&&typeof N.start<"u"&&(O(N.start),O=null),U&&typeof N.end<"u"&&U(N.end)},onVideoSegmentTimingInfo:N=>{const V={pts:{start:N.start.presentation,end:N.end.presentation},dts:{start:N.start.decode,end:N.end.decode}};w({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:V}),n(N)},onAudioSegmentTimingInfo:N=>{const V={pts:{start:N.start.pts,end:N.end.pts},dts:{start:N.start.dts,end:N.end.dts}};w({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:V}),s(N)},onId3:(N,V)=>{a(i,N,V)},onCaptions:N=>{l(i,[N])},isEndOfTimeline:u,onEndedTimeline:()=>{p()},onTransmuxerLog:S,onDone:(N,V)=>{b&&(N.type=N.type==="combined"?"video":N.type,w({type:"segmenttransmuxingcomplete",segment:i}),b(V,i,N))},segment:i,triggerSegmentEventFn:w});xr({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:N=>{i.bytes=e=N.data;const V=N.result;V&&(t(i,{hasAudio:V.hasAudio,hasVideo:V.hasVideo,isMuxed:v}),t=null),F()}})},jm=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{let C=new Uint8Array(e);if(x1(C)){i.isFmp4=!0;const{tracks:v}=i.map;if(v.text&&(!v.audio||!v.video)){g(i,{data:C,type:"text"}),nw(i,v.text.codec,b);return}const D={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(D.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(D.videoCodec=v.video.codec),v.video&&v.audio&&(D.isMuxed=!0),t(i,D);const L=(O,U)=>{g(i,{data:C,type:D.hasAudio&&!D.isMuxed?"audio":"video"}),U&&U.length&&a(i,U),O&&O.length&&l(i,O),b(null,i,{})};xr({action:"probeMp4StartTime",timescales:i.map.timescales,data:C,transmuxer:i.transmuxer,callback:({data:O,startTime:U})=>{e=O.buffer,i.bytes=C=O,D.hasAudio&&!D.isMuxed&&r(i,"audio","start",U),D.hasVideo&&r(i,"video","start",U),xr({action:"probeEmsgID3",data:C,transmuxer:i.transmuxer,offset:U,callback:({emsgData:F,id3Frames:N})=>{if(e=F.buffer,i.bytes=C=F,!v.video||!F.byteLength||!i.transmuxer){L(void 0,N);return}xr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:C,timescales:i.map.timescales,trackIds:[v.video.id],callback:V=>{e=V.data.buffer,i.bytes=C=V.data,V.logs.forEach(function(J){S(fe(J,{stream:"mp4CaptionParser"}))}),L(V.captions,N)}})}})}});return}if(!i.transmuxer){b(null,i,{});return}if(typeof i.container>"u"&&(i.container=Hl(C)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),b(null,i,{});return}ow({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})},qm=function({id:i,key:e,encryptedBytes:t,decryptionWorker:r,segment:n,doneFn:s},a){const l=p=>{if(p.data.source===i){r.removeEventListener("message",l);const g=p.data.decrypted;a(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};r.onerror=()=>{const p="An error occurred in the decryption worker",g=Ki({segment:n}),b={message:p,metadata:{error:new Error(p),errorType:B.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};s(b,n)},r.addEventListener("message",l);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(km({source:i,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},lw=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{w({type:"segmentdecryptionstart"}),qm({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:b},C=>{e.bytes=C,w({type:"segmentdecryptioncomplete",segment:e}),jm({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})})},uw=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{let C=0,v=!1;return(D,L)=>{if(!v){if(D)return v=!0,gl(i),b(D,L);if(C+=1,C===i.length){const O=function(){if(L.encryptedBytes)return lw({decryptionWorker:e,segment:L,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w});jm({segment:L,bytes:L.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g,doneFn:b,onTransmuxerLog:S,triggerSegmentEventFn:w})};if(L.endOfAllRequests=Date.now(),L.map&&L.map.encryptedBytes&&!L.map.bytes)return w({type:"segmentdecryptionstart",segment:L}),qm({decryptionWorker:e,id:L.requestId+"-init",encryptedBytes:L.map.encryptedBytes,key:L.map.key,segment:L,doneFn:b},U=>{L.map.bytes=U,w({type:"segmentdecryptioncomplete",segment:L}),Fm(L,F=>{if(F)return gl(i),b(F,L);O()})});O()}}}},cw=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},dw=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:g})=>b=>{if(!b.target.aborted)return i.stats=fe(i.stats,iw(b)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(b,i)},hw=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:r,abortFn:n,progressFn:s,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:b,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C,doneFn:v,onTransmuxerLog:D,triggerSegmentEventFn:L})=>{const O=[],U=uw({activeXhrs:O,decryptionWorker:t,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:b,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C,doneFn:v,onTransmuxerLog:D,triggerSegmentEventFn:L});if(r.key&&!r.key.bytes){const Y=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&Y.push(r.map.key);const ie=fe(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),pe=Qd(r,Y,U,L),le={uri:r.key.resolvedUri};L({type:"segmentkeyloadstart",segment:r,keyInfo:le});const ge=i(ie,pe);O.push(ge)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const le=fe(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ge=Qd(r,[r.map.key],U,L),ee={uri:r.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:r,keyInfo:ee});const ce=i(le,ge);O.push(ce)}const Y=fe(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:hl(r.map),requestType:"segment-media-initialization"}),ie=sw({segment:r,finishProcessingFn:U,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:r});const pe=i(Y,ie);O.push(pe)}const F=fe(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:hl(r),requestType:"segment"}),N=aw({segment:r,finishProcessingFn:U,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:r});const V=i(F,N);V.addEventListener("progress",dw({segment:r,progressFn:s,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:g,captionsFn:b,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C})),O.push(V);const J={};return O.forEach(Y=>{Y.addEventListener("loadend",cw({loadendState:J,abortFn:n}))}),()=>gl(O)},pw=Nt("CodecUtils"),gw=function(i){const e=i.attributes||{};if(e.CODECS)return Kt(e.CODECS)},$m=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},mw=(i,e)=>{if(!$m(i,e))return!0;const t=e.attributes||{},r=i.mediaGroups.AUDIO[t.AUDIO];for(const n in r)if(!r[n].uri&&!r[n].playlists)return!0;return!1},fa=function(i){const e={};return i.forEach(({mediaType:t,type:r,details:n})=>{e[t]=e[t]||[],e[t].push(wp(`${r}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){pw(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Jd=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},Un=function(i,e){const t=e.attributes||{},r=fa(gw(e)||[]);if($m(i,e)&&!r.audio&&!mw(i,e)){const n=fa(sT(i,t.AUDIO)||[]);n.audio&&(r.audio=n.audio)}return r},Bs=Nt("PlaylistSelector"),Zd=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},ya=function(i,e){if(!i)return"";const t=x.getComputedStyle(i);return t?t[e]:""},Lr=function(i,e){const t=i.slice();i.sort(function(r,n){const s=e(r,n);return s===0?t.indexOf(r)-t.indexOf(n):s})},ku=function(i,e){let t,r;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||x.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||x.Number.MAX_VALUE,t-r},fw=function(i,e){let t,r;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||x.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||x.Number.MAX_VALUE,t===r&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-r};let Vm=function(i,e,t,r,n,s){if(!i)return;const a={bandwidth:e,width:t,height:r,limitRenditionByPlayerDimensions:n};let l=i.playlists;_t.isAudioOnly(i)&&(l=s.getAudioTrackPlaylists_(),a.audioOnly=!0);let u=l.map(N=>{let V;const J=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.width,Y=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.height;return V=N.attributes&&N.attributes.BANDWIDTH,V=V||x.Number.MAX_VALUE,{bandwidth:V,width:J,height:Y,playlist:N}});Lr(u,(N,V)=>N.bandwidth-V.bandwidth),u=u.filter(N=>!_t.isIncompatible(N.playlist));let p=u.filter(N=>_t.isEnabled(N.playlist));p.length||(p=u.filter(N=>!_t.isDisabled(N.playlist)));const g=p.filter(N=>N.bandwidth*Xe.BANDWIDTH_VARIANCE<e);let b=g[g.length-1];const S=g.filter(N=>N.bandwidth===b.bandwidth)[0];if(n===!1){const N=S||p[0]||u[0];if(N&&N.playlist){let V="sortedPlaylistReps";return S&&(V="bandwidthBestRep"),p[0]&&(V="enabledPlaylistReps"),Bs(`choosing ${Zd(N)} using ${V} with options`,a),N.playlist}return Bs("could not choose a playlist with options",a),null}const w=g.filter(N=>N.width&&N.height);Lr(w,(N,V)=>N.width-V.width);const C=w.filter(N=>N.width===t&&N.height===r);b=C[C.length-1];const v=C.filter(N=>N.bandwidth===b.bandwidth)[0];let D,L,O;v||(D=w.filter(N=>N.width>t||N.height>r),L=D.filter(N=>N.width===D[0].width&&N.height===D[0].height),b=L[L.length-1],O=L.filter(N=>N.bandwidth===b.bandwidth)[0]);let U;if(s.leastPixelDiffSelector){const N=w.map(V=>(V.pixelDiff=Math.abs(V.width-t)+Math.abs(V.height-r),V));Lr(N,(V,J)=>V.pixelDiff===J.pixelDiff?J.bandwidth-V.bandwidth:V.pixelDiff-J.pixelDiff),U=N[0]}const F=U||O||v||S||p[0]||u[0];if(F&&F.playlist){let N="sortedPlaylistReps";return U?N="leastPixelDiffRep":O?N="resolutionPlusOneRep":v?N="resolutionBestRep":S?N="bandwidthBestRep":p[0]&&(N="enabledPlaylistReps"),Bs(`choosing ${Zd(F)} using ${N} with options`,a),F.playlist}return Bs("could not choose a playlist with options",a),null};const eh=function(){let i=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),Vm(this.playlists.main,this.systemBandwidth,parseInt(ya(this.tech_.el(),"width"),10)*i,parseInt(ya(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)},yw=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),Vm(this.playlists.main,e,parseInt(ya(this.tech_.el(),"width"),10)*r,parseInt(ya(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},_w=function(i){const{main:e,currentTime:t,bandwidth:r,duration:n,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:l,syncController:u}=i,p=e.playlists.filter(w=>!_t.isIncompatible(w));let g=p.filter(_t.isEnabled);g.length||(g=p.filter(w=>!_t.isDisabled(w)));const b=g.filter(_t.hasAttribute.bind(null,"BANDWIDTH")).map(w=>{const C=u.getSyncPoint(w,n,l,t)?1:2,v=_t.estimateSegmentRequestTime(s,r,w)*C-a;return{playlist:w,rebufferingImpact:v}}),S=b.filter(w=>w.rebufferingImpact<=0);return Lr(S,(w,C)=>ku(C.playlist,w.playlist)),S.length?S[0]:(Lr(b,(w,C)=>w.rebufferingImpact-C.rebufferingImpact),b[0]||null)},bw=function(){const i=this.playlists.main.playlists.filter(_t.isEnabled);return Lr(i,(e,t)=>ku(e,t)),i.filter(e=>!!Un(this.playlists.main,e).video)[0]||null},vw=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(r=>{t.set(r,e),e+=r.byteLength})),t};function Hm(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const Tw=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let r=t;/^cc708_/.test(t)&&(r="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(r);if(n)i[t]=n;else{const s=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,l=t,u=!1;const p=s[r];p&&(a=p.label,l=p.language,u=p.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:r,default:u,label:a,language:l},!1).track}}},Sw=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const r=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{const s=n.stream;n.content?n.content.forEach(a=>{const l=new r(n.startTime+t,n.endTime+t,a.text);l.line=a.line,l.align="left",l.position=a.position,l.positionAlign="line-left",i[s].addCue(l)}):i[s].addCue(new r(n.startTime+t,n.endTime+t,n.text))})},Ew=function(i){Object.defineProperties(i.frame,{id:{get(){return B.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return B.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return B.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},ww=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:r})=>{if(!e)return;const n=x.WebKitDataCue||x.VTTCue,s=i.metadataTrack_;if(!s||(e.forEach(g=>{const b=g.cueTime+t;typeof b!="number"||x.isNaN(b)||b<0||!(b<1/0)||!g.frames||!g.frames.length||g.frames.forEach(S=>{const w=new n(b,b,S.value||S.url||S.data||"");w.frame=S,w.value=S,Ew(w),s.addCue(w)})}),!s.cues||!s.cues.length))return;const a=s.cues,l=[];for(let g=0;g<a.length;g++)a[g]&&l.push(a[g]);const u=l.reduce((g,b)=>{const S=g[b.startTime]||[];return S.push(b),g[b.startTime]=S,g},{}),p=Object.keys(u).sort((g,b)=>Number(g)-Number(b));p.forEach((g,b)=>{const S=u[g],w=isFinite(r)?r:g,C=Number(p[b+1])||w;S.forEach(v=>{v.endTime=C})})},kw={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},Cw=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Iw=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const r=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{for(const s of Object.keys(n)){if(Cw.has(s))continue;const a=new r(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:kw[s],data:n[s]},(s==="scte35Out"||s==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},th=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,B.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},xn=function(i,e,t){let r,n;if(t&&t.cues)for(r=t.cues.length;r--;)n=t.cues[r],n.startTime>=i&&n.endTime<=e&&t.removeCue(n)},Aw=function(i){const e=i.cues;if(!e)return;const t={};for(let r=e.length-1;r>=0;r--){const n=e[r],s=`${n.startTime}-${n.endTime}-${n.text}`;t[s]?i.removeCue(n):t[s]=n}},xw=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const r=Math.ceil((e-t+3)*Yi.ONE_SECOND_IN_TS);let n;for(n=0;n<i.length&&!(i[n].pts>r);n++);return i.slice(n)},Lw=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const r=e[0].pts;let n=0;for(n;n<i.length&&!(i[n].pts>=r);n++);return i.slice(0,n).concat(e)},Dw=(i,e,t,r)=>{const n=Math.ceil((e-r)*Yi.ONE_SECOND_IN_TS),s=Math.ceil((t-r)*Yi.ONE_SECOND_IN_TS),a=i.slice();let l=i.length;for(;l--&&!(i[l].pts<=s););if(l===-1)return a;let u=l+1;for(;u--&&!(i[u].pts<=n););return u=Math.max(u,0),a.splice(u,l-u+1),a},Pw=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++){const s=t[n];if(s!==r[n]||i[s]!==e[s])return!1}return!0},Rw=function(i,e,t){e=e||[];const r=[];let n=0;for(let s=0;s<e.length;s++){const a=e[s];if(i===a.timeline&&(r.push(s),n+=a.duration,n>t))return s}return r.length===0?0:r[r.length-1]},En=1,Nw=500,ih=i=>typeof i=="number"&&isFinite(i),Fs=1/60,Ow=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,Uw=(i,e,t)=>{let r=e-Xe.BACK_BUFFER_LENGTH;i.length&&(r=Math.max(r,i.start(0)));const n=e-t;return Math.min(n,r)},br=i=>{const{startOfSegment:e,duration:t,segment:r,part:n,playlist:{mediaSequence:s,id:a,segments:l=[]},mediaIndex:u,partIndex:p,timeline:g}=i,b=l.length-1;let S="mediaIndex/partIndex increment";i.getMediaInfoForTime?S=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(S="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(S+=` with independent ${i.independent}`);const w=typeof p=="number",C=i.segment.uri?"segment":"pre-segment",v=w?um({preloadSegment:r})-1:0;return`${C} [${s+u}/${s+b}]`+(w?` part [${p}/${v}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(w?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${g}] selected by [${S}] playlist [${a}]`},rh=i=>`${i}TimingInfo`,Mw=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:r,overrideCheck:n})=>!n&&i===e?null:i<e?t:r.length?r.end(r.length-1):t,ml=({timelineChangeController:i,currentTimeline:e,segmentTimeline:t,loaderType:r,audioDisabled:n})=>{if(e===t)return!1;if(r==="audio"){const s=i.lastTimelineChange({type:"main"});return!s||s.to!==t}if(r==="main"&&n){const s=i.pendingTimelineChange({type:"audio"});return!(s&&s.to===t)}return!1},Bw=i=>{if(!i)return!1;const e=i.pendingTimelineChange({type:"audio"}),t=i.pendingTimelineChange({type:"main"}),r=e&&t,n=r&&e.to!==t.to;return!!(r&&e.from!==-1&&t.from!==-1&&n)},Fw=i=>{const e=i.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=i.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Di=i=>{const e=i.pendingSegment_;if(e&&ml({timelineChangeController:i.timelineChangeController_,currentTimeline:i.currentTimeline_,segmentTimeline:e.timeline,loaderType:i.loaderType_,audioDisabled:i.audioDisabled_})&&Bw(i.timelineChangeController_)){if(Fw(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},jw=i=>{let e=0;return["video","audio"].forEach(function(t){const r=i[`${t}TimingInfo`];if(!r)return;const{start:n,end:s}=r;let a;typeof n=="bigint"||typeof s=="bigint"?a=x.BigInt(s)-x.BigInt(n):typeof n=="number"&&typeof s=="number"&&(a=s-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},nh=({segmentDuration:i,maxDuration:e})=>i?Math.round(i)>e+Zt:!1,qw=(i,e)=>{if(e!=="hls")return null;const t=jw({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const r=i.playlist.targetDuration,n=nh({segmentDuration:t,maxDuration:r*2}),s=nh({segmentDuration:t,maxDuration:r}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${r}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||s?{severity:n?"warn":"info",message:a}:null},Ki=({type:i,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:r}};class fl extends B.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=Nt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Di(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ve({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Di(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ve({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Di(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Di(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return jo.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,x.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&jo.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return it();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:r,isMuxed:n}=e;if(r&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const r=ma(e);let n=this.initSegments_[r];return t&&!n&&e.bytes&&(this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const r=Cm(e);let n=this.keyCache_[r];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[r]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(n||e).resolvedUri};return n&&(s.bytes=n.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(r&&(r.id?s=r.id:r.uri&&(s=r.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
207
|
+
`+ho(h.boxes,c+1):"")}).join(`
|
|
208
|
+
`)};var Qu={inspect:it,textify:ho,parseType:gn,findBox:Ay,parseTraf:xi.traf,parseTfdt:xi.tfdt,parseHdlr:xi.hdlr,parseTfhd:xi.tfhd,parseTrun:xi.trun,parseSidx:xi.sidx},Ly=function(o){for(var c=0,d=String.fromCharCode(o[c]),h="";d!=="\0";)h+=d,c++,d=String.fromCharCode(o[c]);return h+=d,h},Dy={uint8ToCString:Ly},As=Dy.uint8ToCString,Py=s.getUint64,Ry=function(o){var c=4,d=o[0],h,f,y,E,k,I,A,N;if(d===0){h=As(o.subarray(c)),c+=h.length,f=As(o.subarray(c)),c+=f.length;var $=new DataView(o.buffer);y=$.getUint32(c),c+=4,k=$.getUint32(c),c+=4,I=$.getUint32(c),c+=4,A=$.getUint32(c),c+=4}else if(d===1){var $=new DataView(o.buffer);y=$.getUint32(c),c+=4,E=Py(o.subarray(c)),c+=8,I=$.getUint32(c),c+=4,A=$.getUint32(c),c+=4,h=As(o.subarray(c)),c+=h.length,f=As(o.subarray(c)),c+=f.length}N=new Uint8Array(o.subarray(c,o.byteLength));var Q={scheme_id_uri:h,value:f,timescale:y||1,presentation_time:E,presentation_time_delta:k,event_duration:I,id:A,message_data:N};return Oy(d,Q)?Q:void 0},Ny=function(o,c,d,h){return o||o===0?o/c:h+d/c},Oy=function(o,c){var d=c.scheme_id_uri!=="\0",h=o===0&&Ju(c.presentation_time_delta)&&d,f=o===1&&Ju(c.presentation_time)&&d;return!(o>1)&&h||f},Ju=function(o){return o!==void 0||o!==null},Uy={parseEmsgBox:Ry,scaleTime:Ny},fn;typeof window<"u"?fn=window:typeof i<"u"?fn=i:typeof self<"u"?fn=self:fn={};var Zu=fn,xs=Cs.toUnsigned,yn=Cs.toHexString,He=Is,mr=lo,po=Uy,My=co,By=Ku,Fy=uo,jy=s.getUint64,ec,tc,ic,rc,nc,mo,sc,go=Zu,$y=Ru.parseId3Frames;ec=function(o){var c={},d=He(o,["moov","trak"]);return d.reduce(function(h,f){var y,E,k,I,A;return y=He(f,["tkhd"])[0],!y||(E=y[0],k=E===0?12:20,I=xs(y[k]<<24|y[k+1]<<16|y[k+2]<<8|y[k+3]),A=He(f,["mdia","mdhd"])[0],!A)?null:(E=A[0],k=E===0?12:20,h[I]=xs(A[k]<<24|A[k+1]<<16|A[k+2]<<8|A[k+3]),h)},c)},tc=function(o,c){var d;d=He(c,["moof","traf"]);var h=d.reduce(function(f,y){var E=He(y,["tfhd"])[0],k=xs(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),I=o[k]||9e4,A=He(y,["tfdt"])[0],N=new DataView(A.buffer,A.byteOffset,A.byteLength),$;A[0]===1?$=jy(A.subarray(4,12)):$=N.getUint32(4);let Q;return typeof $=="bigint"?Q=$/go.BigInt(I):typeof $=="number"&&!isNaN($)&&(Q=$/I),Q<Number.MAX_SAFE_INTEGER&&(Q=Number(Q)),Q<f&&(f=Q),f},1/0);return typeof h=="bigint"||isFinite(h)?h:0},ic=function(o,c){var d=He(c,["moof","traf"]),h=0,f=0,y;if(d&&d.length){var E=He(d[0],["tfhd"])[0],k=He(d[0],["trun"])[0],I=He(d[0],["tfdt"])[0];if(E){var A=My(E);y=A.trackId}if(I){var N=Fy(I);h=N.baseMediaDecodeTime}if(k){var $=By(k);$.samples&&$.samples.length&&(f=$.samples[0].compositionTimeOffset||0)}}var Q=o[y]||9e4;typeof h=="bigint"&&(f=go.BigInt(f),Q=go.BigInt(Q));var H=(h+f)/Q;return typeof H=="bigint"&&H<Number.MAX_SAFE_INTEGER&&(H=Number(H)),H},rc=function(o){var c=He(o,["moov","trak"]),d=[];return c.forEach(function(h){var f=He(h,["mdia","hdlr"]),y=He(h,["tkhd"]);f.forEach(function(E,k){var I=mr(E.subarray(8,12)),A=y[k],N,$,Q;I==="vide"&&(N=new DataView(A.buffer,A.byteOffset,A.byteLength),$=N.getUint8(0),Q=$===0?N.getUint32(12):N.getUint32(20),d.push(Q))})}),d},mo=function(o){var c=o[0],d=c===0?12:20;return xs(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3])},nc=function(o){var c=He(o,["moov","trak"]),d=[];return c.forEach(function(h){var f={},y=He(h,["tkhd"])[0],E,k;y&&(E=new DataView(y.buffer,y.byteOffset,y.byteLength),k=E.getUint8(0),f.id=k===0?E.getUint32(12):E.getUint32(20));var I=He(h,["mdia","hdlr"])[0];if(I){var A=mr(I.subarray(8,12));A==="vide"?f.type="video":A==="soun"?f.type="audio":f.type=A}var N=He(h,["mdia","minf","stbl","stsd"])[0];if(N){var $=N.subarray(8);f.codec=mr($.subarray(4,8));var Q=He($,[f.codec])[0],H,re;Q&&(/^[asm]vc[1-9]$/i.test(f.codec)?(H=Q.subarray(78),re=mr(H.subarray(4,8)),re==="avcC"&&H.length>11?(f.codec+=".",f.codec+=yn(H[9]),f.codec+=yn(H[10]),f.codec+=yn(H[11])):f.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(f.codec)?(H=Q.subarray(28),re=mr(H.subarray(4,8)),re==="esds"&&H.length>20&&H[19]!==0?(f.codec+="."+yn(H[19]),f.codec+="."+yn(H[20]>>>2&63).replace(/^0/,"")):f.codec="mp4a.40.2"):f.codec=f.codec.toLowerCase())}var ae=He(h,["mdia","mdhd"])[0];ae&&(f.timescale=mo(ae)),d.push(f)}),d},sc=function(o,c=0){var d=He(o,["emsg"]);return d.map(h=>{var f=po.parseEmsgBox(new Uint8Array(h)),y=$y(f.message_data);return{cueTime:po.scaleTime(f.presentation_time,f.timescale,f.presentation_time_delta,c),duration:po.scaleTime(f.event_duration,f.timescale),frames:y}})};var _n={findBox:He,parseType:mr,timescale:ec,startTime:tc,compositionStartTime:ic,videoTrackIds:rc,tracks:nc,getTimescaleFromMediaHeader:mo,getEmsgID3:sc};const{parseTrun:qy}=Qu,{findBox:ac}=_n;var oc=Zu,Vy=function(o){var c=ac(o,["moof","traf"]),d=ac(o,["mdat"]),h=[];return d.forEach(function(f,y){var E=c[y];h.push({mdat:f,traf:E})}),h},Hy=function(o,c,d){var h=c,f=d.defaultSampleDuration||0,y=d.defaultSampleSize||0,E=d.trackId,k=[];return o.forEach(function(I){var A=qy(I),N=A.samples;N.forEach(function($){$.duration===void 0&&($.duration=f),$.size===void 0&&($.size=y),$.trackId=E,$.dts=h,$.compositionTimeOffset===void 0&&($.compositionTimeOffset=0),typeof h=="bigint"?($.pts=h+oc.BigInt($.compositionTimeOffset),h+=oc.BigInt($.duration)):($.pts=h+$.compositionTimeOffset,h+=$.duration)}),k=k.concat(N)}),k},lc={getMdatTrafPairs:Vy,parseSamples:Hy},zy=Au.discardEmulationPreventionBytes,Wy=xu.CaptionStream,fo=Is,Gy=uo,Xy=co,{getMdatTrafPairs:Ky,parseSamples:Yy}=lc,Qy=function(o,c){for(var d=o,h=0;h<c.length;h++){var f=c[h];if(d<f.size)return f;d-=f.size}return null},Jy=function(o,c,d){var h=new DataView(o.buffer,o.byteOffset,o.byteLength),f={logs:[],seiNals:[]},y,E,k,I;for(E=0;E+4<o.length;E+=k)if(k=h.getUint32(E),E+=4,!(k<=0))switch(o[E]&31){case 6:var A=o.subarray(E+1,E+1+k),N=Qy(E,c);if(y={nalUnitType:"sei_rbsp",size:k,data:A,escapedRBSP:zy(A),trackId:d},N)y.pts=N.pts,y.dts=N.dts,I=N;else if(I)y.pts=I.pts,y.dts=I.dts;else{f.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+d+". See mux.js#223."});break}f.seiNals.push(y);break}return f},Zy=function(o,c){var d={},h=Ky(o);return h.forEach(function(f){var y=f.mdat,E=f.traf,k=fo(E,["tfhd"]),I=Xy(k[0]),A=I.trackId,N=fo(E,["tfdt"]),$=N.length>0?Gy(N[0]).baseMediaDecodeTime:0,Q=fo(E,["trun"]),H,re;c===A&&Q.length>0&&(H=Yy(Q,$,I),re=Jy(y,H,A),d[A]||(d[A]={seiNals:[],logs:[]}),d[A].seiNals=d[A].seiNals.concat(re.seiNals),d[A].logs=d[A].logs.concat(re.logs))}),d},e_=function(o,c,d){var h;if(c===null)return null;h=Zy(o,c);var f=h[c]||{};return{seiNals:f.seiNals,logs:f.logs,timescale:d}},t_=function(){var o=!1,c,d,h,f,y,E;this.isInitialized=function(){return o},this.init=function(k){c=new Wy,o=!0,E=k?k.isPartial:!1,c.on("data",function(I){I.startTime=I.startPts/f,I.endTime=I.endPts/f,y.captions.push(I),y.captionStreams[I.stream]=!0}),c.on("log",function(I){y.logs.push(I)})},this.isNewInit=function(k,I){return k&&k.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:h!==k[0]||f!==I[h]},this.parse=function(k,I,A){var N;if(this.isInitialized()){if(!I||!A)return null;if(this.isNewInit(I,A))h=I[0],f=A[h];else if(h===null||!f)return d.push(k),null}else return null;for(;d.length>0;){var $=d.shift();this.parse($,I,A)}return N=e_(k,h,f),N&&N.logs&&(y.logs=y.logs.concat(N.logs)),N===null||!N.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(N.seiNals),this.flushStream(),y)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(I){c.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;E?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){d=[],h=null,f=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},i_=t_;const{parseTfdt:r_}=Qu,Li=Is,{getTimescaleFromMediaHeader:n_}=_n,{parseSamples:s_,getMdatTrafPairs:a_}=lc;var uc=function(){let o=9e4;this.init=function(c){const d=Li(c,["moov","trak","mdia","mdhd"])[0];d&&(o=n_(d))},this.parseSegment=function(c){const d=[],h=a_(c);let f=0;return h.forEach(function(y){const E=y.mdat,k=y.traf,I=Li(k,["tfdt"])[0],A=Li(k,["tfhd"])[0],N=Li(k,["trun"]);if(I&&(f=r_(I).baseMediaDecodeTime),N.length&&A){const $=s_(N,f,A);let Q=0;$.forEach(function(H){const re="utf-8",ae=new TextDecoder(re),Qe=E.slice(Q,Q+H.size);if(Li(Qe,["vtte"])[0]){Q+=H.size;return}Li(Qe,["vttc"]).forEach(function(ut){const Jt=Li(ut,["payl"])[0],bn=Li(ut,["sttg"])[0],Ps=H.pts/o,Rs=(H.pts+H.duration)/o;let Ki,vn;if(Jt)try{Ki=ae.decode(Jt)}catch(De){console.error(De)}if(bn)try{vn=ae.decode(bn)}catch(De){console.error(De)}H.duration&&Ki&&d.push({cueText:Ki,start:Ps,end:Rs,settings:vn})}),Q+=H.size})}}),d}},yo=ps,cc=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Ls=function(o){return!!(o[1]&64)},Ds=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},o_=function(o,c){var d=cc(o);return d===0?"pat":d===c?"pmt":c?"pes":null},l_=function(o){var c=Ls(o),d=4+Ds(o);return c&&(d+=o[d]+1),(o[d+10]&31)<<8|o[d+11]},u_=function(o){var c={},d=Ls(o),h=4+Ds(o);if(d&&(h+=o[h]+1),!!(o[h+5]&1)){var f,y,E;f=(o[h+1]&15)<<8|o[h+2],y=3+f-4,E=(o[h+10]&15)<<8|o[h+11];for(var k=12+E;k<y;){var I=h+k;c[(o[I+1]&31)<<8|o[I+2]]=o[I],k+=((o[I+3]&15)<<8|o[I+4])+5}return c}},c_=function(o,c){var d=cc(o),h=c[d];switch(h){case yo.H264_STREAM_TYPE:return"video";case yo.ADTS_STREAM_TYPE:return"audio";case yo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},d_=function(o){var c=Ls(o);if(!c)return null;var d=4+Ds(o);if(d>=o.byteLength)return null;var h=null,f;return f=o[d+7],f&192&&(h={},h.pts=(o[d+9]&14)<<27|(o[d+10]&255)<<20|(o[d+11]&254)<<12|(o[d+12]&255)<<5|(o[d+13]&254)>>>3,h.pts*=4,h.pts+=(o[d+13]&6)>>>1,h.dts=h.pts,f&64&&(h.dts=(o[d+14]&14)<<27|(o[d+15]&255)<<20|(o[d+16]&254)<<12|(o[d+17]&255)<<5|(o[d+18]&254)>>>3,h.dts*=4,h.dts+=(o[d+18]&6)>>>1)),h},_o=function(o){switch(o){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},h_=function(o){for(var c=4+Ds(o),d=o.subarray(c),h=0,f=0,y=!1,E;f<d.byteLength-3;f++)if(d[f+2]===1){h=f+5;break}for(;h<d.byteLength;)switch(d[h]){case 0:if(d[h-1]!==0){h+=2;break}else if(d[h-2]!==0){h++;break}f+3!==h-2&&(E=_o(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0));do h++;while(d[h]!==1&&h<d.length);f=h-2,h+=3;break;case 1:if(d[h-1]!==0||d[h-2]!==0){h+=3;break}E=_o(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0),f=h-2,h+=3;break;default:h+=3;break}return d=d.subarray(f),h-=f,f=0,d&&d.byteLength>3&&(E=_o(d[f+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},p_={parseType:o_,parsePat:l_,parsePmt:u_,parsePayloadUnitStartIndicator:Ls,parsePesType:c_,parsePesTime:d_,videoPacketContainsKeyFrame:h_},dc=ps,gr=Du.handleRollover,Te={};Te.ts=p_,Te.aac=no;var Xi=T.ONE_SECOND_IN_TS,lt=188,Qt=71,m_=function(o,c){for(var d=0,h=lt,f,y;h<o.byteLength;){if(o[d]===Qt&&o[h]===Qt){switch(f=o.subarray(d,h),y=Te.ts.parseType(f,c.pid),y){case"pat":c.pid=Te.ts.parsePat(f);break;case"pmt":var E=Te.ts.parsePmt(f);c.table=c.table||{},Object.keys(E).forEach(function(k){c.table[k]=E[k]});break}d+=lt,h+=lt;continue}d++,h++}},hc=function(o,c,d){for(var h=0,f=lt,y,E,k,I,A,N=!1;f<=o.byteLength;){if(o[h]===Qt&&(o[f]===Qt||f===o.byteLength)){switch(y=o.subarray(h,f),E=Te.ts.parseType(y,c.pid),E){case"pes":k=Te.ts.parsePesType(y,c.table),I=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&I&&(A=Te.ts.parsePesTime(y),A&&(A.type="audio",d.audio.push(A),N=!0));break}if(N)break;h+=lt,f+=lt;continue}h++,f++}for(f=o.byteLength,h=f-lt,N=!1;h>=0;){if(o[h]===Qt&&(o[f]===Qt||f===o.byteLength)){switch(y=o.subarray(h,f),E=Te.ts.parseType(y,c.pid),E){case"pes":k=Te.ts.parsePesType(y,c.table),I=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&I&&(A=Te.ts.parsePesTime(y),A&&(A.type="audio",d.audio.push(A),N=!0));break}if(N)break;h-=lt,f-=lt;continue}h--,f--}},g_=function(o,c,d){for(var h=0,f=lt,y,E,k,I,A,N,$,Q,H=!1,re={data:[],size:0};f<o.byteLength;){if(o[h]===Qt&&o[f]===Qt){switch(y=o.subarray(h,f),E=Te.ts.parseType(y,c.pid),E){case"pes":if(k=Te.ts.parsePesType(y,c.table),I=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&(I&&!H&&(A=Te.ts.parsePesTime(y),A&&(A.type="video",d.video.push(A),H=!0)),!d.firstKeyFrame)){if(I&&re.size!==0){for(N=new Uint8Array(re.size),$=0;re.data.length;)Q=re.data.shift(),N.set(Q,$),$+=Q.byteLength;if(Te.ts.videoPacketContainsKeyFrame(N)){var ae=Te.ts.parsePesTime(N);ae?(d.firstKeyFrame=ae,d.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}re.size=0}re.data.push(y),re.size+=y.byteLength}break}if(H&&d.firstKeyFrame)break;h+=lt,f+=lt;continue}h++,f++}for(f=o.byteLength,h=f-lt,H=!1;h>=0;){if(o[h]===Qt&&o[f]===Qt){switch(y=o.subarray(h,f),E=Te.ts.parseType(y,c.pid),E){case"pes":k=Te.ts.parsePesType(y,c.table),I=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&I&&(A=Te.ts.parsePesTime(y),A&&(A.type="video",d.video.push(A),H=!0));break}if(H)break;h-=lt,f-=lt;continue}h--,f--}},f_=function(o,c){if(o.audio&&o.audio.length){var d=c;(typeof d>"u"||isNaN(d))&&(d=o.audio[0].dts),o.audio.forEach(function(y){y.dts=gr(y.dts,d),y.pts=gr(y.pts,d),y.dtsTime=y.dts/Xi,y.ptsTime=y.pts/Xi})}if(o.video&&o.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=o.video[0].dts),o.video.forEach(function(y){y.dts=gr(y.dts,h),y.pts=gr(y.pts,h),y.dtsTime=y.dts/Xi,y.ptsTime=y.pts/Xi}),o.firstKeyFrame){var f=o.firstKeyFrame;f.dts=gr(f.dts,h),f.pts=gr(f.pts,h),f.dtsTime=f.dts/Xi,f.ptsTime=f.pts/Xi}}},y_=function(o){for(var c=!1,d=0,h=null,f=null,y=0,E=0,k;o.length-E>=3;){var I=Te.aac.parseType(o,E);switch(I){case"timed-metadata":if(o.length-E<10){c=!0;break}if(y=Te.aac.parseId3TagSize(o,E),y>o.length){c=!0;break}f===null&&(k=o.subarray(E,E+y),f=Te.aac.parseAacTimestamp(k)),E+=y;break;case"audio":if(o.length-E<7){c=!0;break}if(y=Te.aac.parseAdtsSize(o,E),y>o.length){c=!0;break}h===null&&(k=o.subarray(E,E+y),h=Te.aac.parseSampleRate(k)),d++,E+=y;break;default:E++;break}if(c)return null}if(h===null||f===null)return null;var A=Xi/h,N={audio:[{type:"audio",dts:f,pts:f},{type:"audio",dts:f+d*1024*A,pts:f+d*1024*A}]};return N},__=function(o){var c={pid:null,table:null},d={};m_(o,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var f=c.table[h];switch(f){case dc.H264_STREAM_TYPE:d.video=[],g_(o,c,d),d.video.length===0&&delete d.video;break;case dc.ADTS_STREAM_TYPE:d.audio=[],hc(o,c,d),d.audio.length===0&&delete d.audio;break}}return d},b_=function(o,c){var d=Te.aac.isLikelyAacData(o),h;return d?h=y_(o):h=__(o),!h||!h.audio&&!h.video?null:(f_(h,c),h)},v_={inspect:b_,parseAudioPes_:hc};const T_=function(o,c){c.on("data",function(d){const h=d.initSegment;d.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const f=d.data;d.data=f.buffer,o.postMessage({action:"data",segment:d,byteOffset:f.byteOffset,byteLength:f.byteLength},[d.data])}),c.on("done",function(d){o.postMessage({action:"done"})}),c.on("gopInfo",function(d){o.postMessage({action:"gopInfo",gopInfo:d})}),c.on("videoSegmentTimingInfo",function(d){const h={start:{decode:T.videoTsToSeconds(d.start.dts),presentation:T.videoTsToSeconds(d.start.pts)},end:{decode:T.videoTsToSeconds(d.end.dts),presentation:T.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:T.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=T.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(d){const h={start:{decode:T.videoTsToSeconds(d.start.dts),presentation:T.videoTsToSeconds(d.start.pts)},end:{decode:T.videoTsToSeconds(d.end.dts),presentation:T.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:T.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=T.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(d){o.postMessage({action:"id3Frame",id3Frame:d})}),c.on("caption",function(d){o.postMessage({action:"caption",caption:d})}),c.on("trackinfo",function(d){o.postMessage({action:"trackinfo",trackInfo:d})}),c.on("audioTimingInfo",function(d){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:T.videoTsToSeconds(d.start),end:T.videoTsToSeconds(d.end)}})}),c.on("videoTimingInfo",function(d){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:T.videoTsToSeconds(d.start),end:T.videoTsToSeconds(d.end)}})}),c.on("log",function(d){o.postMessage({action:"log",log:d})})};class pc{constructor(c,d){this.options=d||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new hy.Transmuxer(this.options),T_(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new i_,this.captionParser.init());const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(d,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:d.buffer},[d.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new uc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(d)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new uc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(d);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:d.buffer},[d.buffer])}probeMp4StartTime({timescales:c,data:d}){const h=_n.startTime(c,d);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:d},[d.buffer])}probeMp4Tracks({data:c}){const d=_n.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:d,data:c},[c.buffer])}probeEmsgID3({data:c,offset:d}){const h=_n.getEmsgID3(c,d);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:d}){const h=typeof d=="number"&&!isNaN(d)?d*T.ONE_SECOND_IN_TS:void 0,f=v_.inspect(c,h);let y=null;f&&(y={hasVideo:f.video&&f.video.length===2||!1,hasAudio:f.audio&&f.audio.length===2||!1},y.hasVideo&&(y.videoStart=f.video[0].ptsTime),y.hasAudio&&(y.audioStart=f.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(d)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const d=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(T.secondsToVideoTs(d)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(T.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new pc(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new pc(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var uw=Bg(lw);const cw=(i,e,t)=>{const{type:r,initSegment:n,captions:s,captionStreams:a,metadata:l,videoFrameDtsTime:u,videoFramePtsTime:p}=i.data.segment;e.buffer.push({captions:s,captionStreams:a,metadata:l});const m=i.data.segment.boxes||{data:i.data.segment.data},_={type:r,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof u<"u"&&(_.videoFrameDtsTime=u),typeof p<"u"&&(_.videoFramePtsTime=p),t(_)},dw=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},hw=(i,e)=>{e.gopInfo=i.data.gopInfo},$g=i=>{const{transmuxer:e,bytes:t,audioAppendStart:r,gopsToAlignWith:n,remux:s,onData:a,onTrackInfo:l,onAudioTimingInfo:u,onVideoTimingInfo:p,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:S,onCaptions:w,onDone:C,onEndedTimeline:v,onTransmuxerLog:L,isEndOfTimeline:D,segment:O,triggerSegmentEventFn:U}=i,F={buffer:[]};let R=D;const q=Y=>{e.currentTransmux===i&&(Y.data.action==="data"&&cw(Y,F,a),Y.data.action==="trackinfo"&&l(Y.data.trackInfo),Y.data.action==="gopInfo"&&hw(Y,F),Y.data.action==="audioTimingInfo"&&u(Y.data.audioTimingInfo),Y.data.action==="videoTimingInfo"&&p(Y.data.videoTimingInfo),Y.data.action==="videoSegmentTimingInfo"&&m(Y.data.videoSegmentTimingInfo),Y.data.action==="audioSegmentTimingInfo"&&_(Y.data.audioSegmentTimingInfo),Y.data.action==="id3Frame"&&S([Y.data.id3Frame],Y.data.id3Frame.dispatchType),Y.data.action==="caption"&&w(Y.data.caption),Y.data.action==="endedtimeline"&&(R=!1,v()),Y.data.action==="log"&&L(Y.data.log),Y.data.type==="transmuxed"&&(R||(e.onmessage=null,dw({transmuxedData:F,callback:C}),qg(e))))},J=()=>{const Y={message:"Received an error message from the transmuxer worker",metadata:{errorType:B.Error.StreamingFailedToTransmuxSegment,segmentInfo:Zi({segment:O})}};C(null,Y)};if(e.onmessage=q,e.onerror=J,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof s<"u"&&e.postMessage({action:"setRemux",remux:s}),t.byteLength){const Y=t instanceof ArrayBuffer?t:t.buffer,ie=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:O}),e.postMessage({action:"push",data:Y,byteOffset:ie,byteLength:t.byteLength},[Y])}D&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},qg=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():$g(i.currentTransmux))},Jd=(i,e)=>{i.postMessage({action:e}),qg(i)},Vg=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Jd(e,i);return}e.transmuxQueue.push(Jd.bind(null,e,i))},pw=i=>{Vg("reset",i)},mw=i=>{Vg("endTimeline",i)},Hg=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,$g(i);return}i.transmuxer.transmuxQueue.push(i)},gw=i=>{const e=new uw;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var $o={reset:pw,endTimeline:mw,transmux:Hg,createTransmuxer:gw};const Rr=function(i){const e=i.transmuxer,t=i.endAction||i.action,r=i.callback,n=Ge({},i,{endAction:null,transmuxer:null,callback:null}),s=a=>{a.data.action===t&&(e.removeEventListener("message",s),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),r(a.data))};if(e.addEventListener("message",s),i.data){const a=i.data instanceof ArrayBuffer;n.byteOffset=a?0:i.data.byteOffset,n.byteLength=i.data.byteLength;const l=[a?i.data:i.data.buffer];e.postMessage(n,l)}else e.postMessage(n)},ai={FAILURE:2,TIMEOUT:-101,ABORTED:-102},zg="wvtt",gl=i=>{i.forEach(e=>{e.abort()})},fw=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),yw=i=>{const e=i.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=i.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},ku=(i,e)=>{const{requestType:t}=e,r=ar({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:ai.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:ai.ABORTED,xhr:e,metadata:r}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:ai.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:ai.FAILURE,xhr:e,metadata:r}:null},Zd=(i,e,t,r)=>(n,s)=>{const a=s.response,l=ku(n,s);if(l)return t(l,i);if(a.byteLength!==16)return t({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:ai.FAILURE,xhr:s},i);const u=new DataView(a),p=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=p;const m={uri:s.uri};return r({type:"segmentkeyloadcomplete",segment:i,keyInfo:m}),t(null,i)},_w=(i,e)=>{e===zg&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},bw=(i,e,t)=>{e===zg&&Rr({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:r,mp4VttCues:n})=>{i.bytes=r,t(null,i,{mp4VttCues:n})}})},Wg=(i,e)=>{const t=zl(i.map.bytes);if(t!=="mp4"){const r=i.map.resolvedUri||i.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${r}`,code:ai.FAILURE,metadata:{mediaType:n}})}Rr({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:r,data:n})=>(i.map.bytes=n,r.forEach(function(s){i.map.tracks=i.map.tracks||{},!i.map.tracks[s.type]&&(i.map.tracks[s.type]=s,typeof s.id=="number"&&s.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[s.id]=s.timescale),s.type==="text"&&_w(i,s.codec))}),e(null))})},vw=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(r,n)=>{const s=ku(r,n);if(s)return e(s,i);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,Wg(i,function(l){if(l)return l.xhr=n,l.status=n.status,e(l,i);e(null,i)})},Tw=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:r})=>(n,s)=>{const a=ku(n,s);if(a)return e(a,i);r({type:"segmentloaded",segment:i});const l=t==="arraybuffer"||!s.responseText?s.response:aw(s.responseText.substring(i.lastReachedChar||0));return i.stats=fw(s),i.key?i.encryptedBytes=new Uint8Array(l):i.bytes=new Uint8Array(l),e(null,i)},Sw=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{const C=i.map&&i.map.tracks||{},v=!!(C.audio&&C.video);let L=r.bind(null,i,"audio","start");const D=r.bind(null,i,"audio","end");let O=r.bind(null,i,"video","start");const U=r.bind(null,i,"video","end"),F=()=>Hg({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:v,onData:R=>{R.type=R.type==="combined"?"video":R.type,m(i,R)},onTrackInfo:R=>{t&&(v&&(R.isMuxed=!0),t(i,R))},onAudioTimingInfo:R=>{L&&typeof R.start<"u"&&(L(R.start),L=null),D&&typeof R.end<"u"&&D(R.end)},onVideoTimingInfo:R=>{O&&typeof R.start<"u"&&(O(R.start),O=null),U&&typeof R.end<"u"&&U(R.end)},onVideoSegmentTimingInfo:R=>{const q={pts:{start:R.start.presentation,end:R.end.presentation},dts:{start:R.start.decode,end:R.end.decode}};w({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),n(R)},onAudioSegmentTimingInfo:R=>{const q={pts:{start:R.start.pts,end:R.end.pts},dts:{start:R.start.dts,end:R.end.dts}};w({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),s(R)},onId3:(R,q)=>{a(i,R,q)},onCaptions:R=>{l(i,[R])},isEndOfTimeline:u,onEndedTimeline:()=>{p()},onTransmuxerLog:S,onDone:(R,q)=>{_&&(R.type=R.type==="combined"?"video":R.type,w({type:"segmenttransmuxingcomplete",segment:i}),_(q,i,R))},segment:i,triggerSegmentEventFn:w});Rr({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:R=>{i.bytes=e=R.data;const q=R.result;q&&(t(i,{hasAudio:q.hasAudio,hasVideo:q.hasVideo,isMuxed:v}),t=null),F()}})},Gg=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{let C=new Uint8Array(e);if(H1(C)){i.isFmp4=!0;const{tracks:v}=i.map;if(v.text&&(!v.audio||!v.video)){m(i,{data:C,type:"text"}),bw(i,v.text.codec,_);return}const L={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(L.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(L.videoCodec=v.video.codec),v.video&&v.audio&&(L.isMuxed=!0),t(i,L);const D=(O,U)=>{m(i,{data:C,type:L.hasAudio&&!L.isMuxed?"audio":"video"}),U&&U.length&&a(i,U),O&&O.length&&l(i,O),_(null,i,{})};Rr({action:"probeMp4StartTime",timescales:i.map.timescales,data:C,transmuxer:i.transmuxer,callback:({data:O,startTime:U})=>{e=O.buffer,i.bytes=C=O,L.hasAudio&&!L.isMuxed&&r(i,"audio","start",U),L.hasVideo&&r(i,"video","start",U),Rr({action:"probeEmsgID3",data:C,transmuxer:i.transmuxer,offset:U,callback:({emsgData:F,id3Frames:R})=>{if(e=F.buffer,i.bytes=C=F,!v.video||!F.byteLength||!i.transmuxer){D(void 0,R);return}Rr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:C,timescales:i.map.timescales,trackIds:[v.video.id],callback:q=>{e=q.data.buffer,i.bytes=C=q.data,q.logs.forEach(function(J){S(_e(J,{stream:"mp4CaptionParser"}))}),D(q.captions,R)}})}})}});return}if(!i.transmuxer){_(null,i,{});return}if(typeof i.container>"u"&&(i.container=zl(C)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),_(null,i,{});return}Sw({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})},Xg=function({id:i,key:e,encryptedBytes:t,decryptionWorker:r,segment:n,doneFn:s},a){const l=p=>{if(p.data.source===i){r.removeEventListener("message",l);const m=p.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};r.onerror=()=>{const p="An error occurred in the decryption worker",m=Zi({segment:n}),_={message:p,metadata:{error:new Error(p),errorType:B.Error.StreamingFailedToDecryptSegment,segmentInfo:m,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};s(_,n)},r.addEventListener("message",l);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(Pg({source:i,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},Ew=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{w({type:"segmentdecryptionstart"}),Xg({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:_},C=>{e.bytes=C,w({type:"segmentdecryptioncomplete",segment:e}),Gg({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})})},ww=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})=>{let C=0,v=!1;return(L,D)=>{if(!v){if(L)return v=!0,gl(i),_(L,D);if(C+=1,C===i.length){const O=function(){if(D.encryptedBytes)return Ew({decryptionWorker:e,segment:D,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w});Gg({segment:D,bytes:D.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m,doneFn:_,onTransmuxerLog:S,triggerSegmentEventFn:w})};if(D.endOfAllRequests=Date.now(),D.map&&D.map.encryptedBytes&&!D.map.bytes)return w({type:"segmentdecryptionstart",segment:D}),Xg({decryptionWorker:e,id:D.requestId+"-init",encryptedBytes:D.map.encryptedBytes,key:D.map.key,segment:D,doneFn:_},U=>{D.map.bytes=U,w({type:"segmentdecryptioncomplete",segment:D}),Wg(D,F=>{if(F)return gl(i),_(F,D);O()})});O()}}}},kw=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},Cw=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:s,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:p,dataFn:m})=>_=>{if(!_.target.aborted)return i.stats=_e(i.stats,yw(_)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(_,i)},Iw=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:r,abortFn:n,progressFn:s,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:m,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:D})=>{const O=[],U=ww({activeXhrs:O,decryptionWorker:t,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:m,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:D});if(r.key&&!r.key.bytes){const Y=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&Y.push(r.map.key);const ie=_e(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),me=Zd(r,Y,U,D),oe={uri:r.key.resolvedUri};D({type:"segmentkeyloadstart",segment:r,keyInfo:oe});const ge=i(ie,me);O.push(ge)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const oe=_e(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ge=Zd(r,[r.map.key],U,D),ee={uri:r.map.key.resolvedUri};D({type:"segmentkeyloadstart",segment:r,keyInfo:ee});const ue=i(oe,ge);O.push(ue)}const Y=_e(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:pl(r.map),requestType:"segment-media-initialization"}),ie=vw({segment:r,finishProcessingFn:U,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:r});const me=i(Y,ie);O.push(me)}const F=_e(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:pl(r),requestType:"segment"}),R=Tw({segment:r,finishProcessingFn:U,responseType:F.responseType,triggerSegmentEventFn:D});D({type:"segmentloadstart",segment:r});const q=i(F,R);q.addEventListener("progress",Cw({segment:r,progressFn:s,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:p,id3Fn:m,captionsFn:_,isEndOfTimeline:S,endedTimelineFn:w,dataFn:C})),O.push(q);const J={};return O.forEach(Y=>{Y.addEventListener("loadend",kw({loadendState:J,abortFn:n}))}),()=>gl(O)},Aw=jt("CodecUtils"),xw=function(i){const e=i.attributes||{};if(e.CODECS)return ei(e.CODECS)},Kg=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},Lw=(i,e)=>{if(!Kg(i,e))return!0;const t=e.attributes||{},r=i.mediaGroups.AUDIO[t.AUDIO];for(const n in r)if(!r[n].uri&&!r[n].playlists)return!0;return!1},_a=function(i){const e={};return i.forEach(({mediaType:t,type:r,details:n})=>{e[t]=e[t]||[],e[t].push(Dp(`${r}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){Aw(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},eh=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},jn=function(i,e){const t=e.attributes||{},r=_a(xw(e)||[]);if(Kg(i,e)&&!r.audio&&!Lw(i,e)){const n=_a(vT(i,t.AUDIO)||[]);n.audio&&(r.audio=n.audio)}return r},js=jt("PlaylistSelector"),th=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},ba=function(i,e){if(!i)return"";const t=x.getComputedStyle(i);return t?t[e]:""},Nr=function(i,e){const t=i.slice();i.sort(function(r,n){const s=e(r,n);return s===0?t.indexOf(r)-t.indexOf(n):s})},Cu=function(i,e){let t,r;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||x.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||x.Number.MAX_VALUE,t-r},Dw=function(i,e){let t,r;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||x.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||x.Number.MAX_VALUE,t===r&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-r};let Yg=function(i,e,t,r,n,s){if(!i)return;const a={bandwidth:e,width:t,height:r,limitRenditionByPlayerDimensions:n};let l=i.playlists;Tt.isAudioOnly(i)&&(l=s.getAudioTrackPlaylists_(),a.audioOnly=!0);let u=l.map(R=>{let q;const J=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,Y=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return q=R.attributes&&R.attributes.BANDWIDTH,q=q||x.Number.MAX_VALUE,{bandwidth:q,width:J,height:Y,playlist:R}});Nr(u,(R,q)=>R.bandwidth-q.bandwidth),u=u.filter(R=>!Tt.isIncompatible(R.playlist));let p=u.filter(R=>Tt.isEnabled(R.playlist));p.length||(p=u.filter(R=>!Tt.isDisabled(R.playlist)));const m=p.filter(R=>R.bandwidth*Je.BANDWIDTH_VARIANCE<e);let _=m[m.length-1];const S=m.filter(R=>R.bandwidth===_.bandwidth)[0];if(n===!1){const R=S||p[0]||u[0];if(R&&R.playlist){let q="sortedPlaylistReps";return S&&(q="bandwidthBestRep"),p[0]&&(q="enabledPlaylistReps"),js(`choosing ${th(R)} using ${q} with options`,a),R.playlist}return js("could not choose a playlist with options",a),null}const w=m.filter(R=>R.width&&R.height);Nr(w,(R,q)=>R.width-q.width);const C=w.filter(R=>R.width===t&&R.height===r);_=C[C.length-1];const v=C.filter(R=>R.bandwidth===_.bandwidth)[0];let L,D,O;v||(L=w.filter(R=>R.width>t||R.height>r),D=L.filter(R=>R.width===L[0].width&&R.height===L[0].height),_=D[D.length-1],O=D.filter(R=>R.bandwidth===_.bandwidth)[0]);let U;if(s.leastPixelDiffSelector){const R=w.map(q=>(q.pixelDiff=Math.abs(q.width-t)+Math.abs(q.height-r),q));Nr(R,(q,J)=>q.pixelDiff===J.pixelDiff?J.bandwidth-q.bandwidth:q.pixelDiff-J.pixelDiff),U=R[0]}const F=U||O||v||S||p[0]||u[0];if(F&&F.playlist){let R="sortedPlaylistReps";return U?R="leastPixelDiffRep":O?R="resolutionPlusOneRep":v?R="resolutionBestRep":S?R="bandwidthBestRep":p[0]&&(R="enabledPlaylistReps"),js(`choosing ${th(F)} using ${R} with options`,a),F.playlist}return js("could not choose a playlist with options",a),null};const ih=function(){let i=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),Yg(this.playlists.main,this.systemBandwidth,parseInt(ba(this.tech_.el(),"width"),10)*i,parseInt(ba(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)},Pw=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&x.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),Yg(this.playlists.main,e,parseInt(ba(this.tech_.el(),"width"),10)*r,parseInt(ba(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},Rw=function(i){const{main:e,currentTime:t,bandwidth:r,duration:n,segmentDuration:s,timeUntilRebuffer:a,currentTimeline:l,syncController:u}=i,p=e.playlists.filter(w=>!Tt.isIncompatible(w));let m=p.filter(Tt.isEnabled);m.length||(m=p.filter(w=>!Tt.isDisabled(w)));const _=m.filter(Tt.hasAttribute.bind(null,"BANDWIDTH")).map(w=>{const C=u.getSyncPoint(w,n,l,t)?1:2,v=Tt.estimateSegmentRequestTime(s,r,w)*C-a;return{playlist:w,rebufferingImpact:v}}),S=_.filter(w=>w.rebufferingImpact<=0);return Nr(S,(w,C)=>Cu(C.playlist,w.playlist)),S.length?S[0]:(Nr(_,(w,C)=>w.rebufferingImpact-C.rebufferingImpact),_[0]||null)},Nw=function(){const i=this.playlists.main.playlists.filter(Tt.isEnabled);return Nr(i,(e,t)=>Cu(e,t)),i.filter(e=>!!jn(this.playlists.main,e).video)[0]||null},Ow=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(r=>{t.set(r,e),e+=r.byteLength})),t};function Qg(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const Uw=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let r=t;/^cc708_/.test(t)&&(r="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(r);if(n)i[t]=n;else{const s=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,l=t,u=!1;const p=s[r];p&&(a=p.label,l=p.language,u=p.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:r,default:u,label:a,language:l},!1).track}}},Mw=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const r=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{const s=n.stream;n.content?n.content.forEach(a=>{const l=new r(n.startTime+t,n.endTime+t,a.text);l.line=a.line,l.align="left",l.position=a.position,l.positionAlign="line-left",i[s].addCue(l)}):i[s].addCue(new r(n.startTime+t,n.endTime+t,n.text))})},Bw=function(i){Object.defineProperties(i.frame,{id:{get(){return B.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return B.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return B.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},Fw=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:r})=>{if(!e)return;const n=x.WebKitDataCue||x.VTTCue,s=i.metadataTrack_;if(!s||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||x.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(S=>{const w=new n(_,_,S.value||S.url||S.data||"");w.frame=S,w.value=S,Bw(w),s.addCue(w)})}),!s.cues||!s.cues.length))return;const a=s.cues,l=[];for(let m=0;m<a.length;m++)a[m]&&l.push(a[m]);const u=l.reduce((m,_)=>{const S=m[_.startTime]||[];return S.push(_),m[_.startTime]=S,m},{}),p=Object.keys(u).sort((m,_)=>Number(m)-Number(_));p.forEach((m,_)=>{const S=u[m],w=isFinite(r)?r:m,C=Number(p[_+1])||w;S.forEach(v=>{v.endTime=C})})},jw={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},$w=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),qw=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const r=x.WebKitDataCue||x.VTTCue;e.forEach(n=>{for(const s of Object.keys(n)){if($w.has(s))continue;const a=new r(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:jw[s],data:n[s]},(s==="scte35Out"||s==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},rh=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,B.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},Rn=function(i,e,t){let r,n;if(t&&t.cues)for(r=t.cues.length;r--;)n=t.cues[r],n.startTime>=i&&n.endTime<=e&&t.removeCue(n)},Vw=function(i){const e=i.cues;if(!e)return;const t={};for(let r=e.length-1;r>=0;r--){const n=e[r],s=`${n.startTime}-${n.endTime}-${n.text}`;t[s]?i.removeCue(n):t[s]=n}},Hw=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const r=Math.ceil((e-t+3)*er.ONE_SECOND_IN_TS);let n;for(n=0;n<i.length&&!(i[n].pts>r);n++);return i.slice(n)},zw=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const r=e[0].pts;let n=0;for(n;n<i.length&&!(i[n].pts>=r);n++);return i.slice(0,n).concat(e)},Ww=(i,e,t,r)=>{const n=Math.ceil((e-r)*er.ONE_SECOND_IN_TS),s=Math.ceil((t-r)*er.ONE_SECOND_IN_TS),a=i.slice();let l=i.length;for(;l--&&!(i[l].pts<=s););if(l===-1)return a;let u=l+1;for(;u--&&!(i[u].pts<=n););return u=Math.max(u,0),a.splice(u,l-u+1),a},Gw=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let n=0;n<t.length;n++){const s=t[n];if(s!==r[n]||i[s]!==e[s])return!1}return!0},Xw=function(i,e,t){e=e||[];const r=[];let n=0;for(let s=0;s<e.length;s++){const a=e[s];if(i===a.timeline&&(r.push(s),n+=a.duration,n>t))return s}return r.length===0?0:r[r.length-1]},In=1,Kw=500,nh=i=>typeof i=="number"&&isFinite(i),$s=1/60,Yw=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,Qw=(i,e,t)=>{let r=e-Je.BACK_BUFFER_LENGTH;i.length&&(r=Math.max(r,i.start(0)));const n=e-t;return Math.min(n,r)},Er=i=>{const{startOfSegment:e,duration:t,segment:r,part:n,playlist:{mediaSequence:s,id:a,segments:l=[]},mediaIndex:u,partIndex:p,timeline:m}=i,_=l.length-1;let S="mediaIndex/partIndex increment";i.getMediaInfoForTime?S=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(S="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(S+=` with independent ${i.independent}`);const w=typeof p=="number",C=i.segment.uri?"segment":"pre-segment",v=w?fg({preloadSegment:r})-1:0;return`${C} [${s+u}/${s+_}]`+(w?` part [${p}/${v}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(w?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${m}] selected by [${S}] playlist [${a}]`},sh=i=>`${i}TimingInfo`,Jw=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:r,overrideCheck:n})=>!n&&i===e?null:i<e?t:r.length?r.end(r.length-1):t,fl=({timelineChangeController:i,currentTimeline:e,segmentTimeline:t,loaderType:r,audioDisabled:n})=>{if(e===t)return!1;if(r==="audio"){const s=i.lastTimelineChange({type:"main"});return!s||s.to!==t}if(r==="main"&&n){const s=i.pendingTimelineChange({type:"audio"});return!(s&&s.to===t)}return!1},Zw=i=>{if(!i)return!1;const e=i.pendingTimelineChange({type:"audio"}),t=i.pendingTimelineChange({type:"main"}),r=e&&t,n=r&&e.to!==t.to;return!!(r&&e.from!==-1&&t.from!==-1&&n)},e2=i=>{const e=i.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=i.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Ni=i=>{const e=i.pendingSegment_;if(e&&fl({timelineChangeController:i.timelineChangeController_,currentTimeline:i.currentTimeline_,segmentTimeline:e.timeline,loaderType:i.loaderType_,audioDisabled:i.audioDisabled_})&&Zw(i.timelineChangeController_)){if(e2(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},t2=i=>{let e=0;return["video","audio"].forEach(function(t){const r=i[`${t}TimingInfo`];if(!r)return;const{start:n,end:s}=r;let a;typeof n=="bigint"||typeof s=="bigint"?a=x.BigInt(s)-x.BigInt(n):typeof n=="number"&&typeof s=="number"&&(a=s-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},ah=({segmentDuration:i,maxDuration:e})=>i?Math.round(i)>e+ni:!1,i2=(i,e)=>{if(e!=="hls")return null;const t=t2({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const r=i.playlist.targetDuration,n=ah({segmentDuration:t,maxDuration:r*2}),s=ah({segmentDuration:t,maxDuration:r}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${r}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||s?{severity:n?"warn":"info",message:a}:null},Zi=({type:i,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:r}};class yl extends B.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.logger_=jt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ni(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ge({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ni(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ge({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Ni(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ni(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return $o.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,x.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&$o.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return at();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:r,isMuxed:n}=e;if(r&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const r=ya(e);let n=this.initSegments_[r];return t&&!n&&e.bytes&&(this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const r=Rg(e);let n=this.keyCache_[r];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[r]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const s={resolvedUri:(n||e).resolvedUri};return n&&(s.bytes=n.bytes),s}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let s=null;if(r&&(r.id?s=r.id:r.uri&&(s=r.uri)),this.logger_(`playlist update [${s} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
209
209
|
currentTime: ${this.currentTime_()}
|
|
210
|
-
bufferedEnd: ${
|
|
211
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_
|
|
210
|
+
bufferedEnd: ${Fo(this.buffered_())}
|
|
211
|
+
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&$o.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,r=()=>{},n=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let s=1;const a=()=>{s--,s===0&&r()};(n||!this.audioDisabled_)&&(s++,this.sourceUpdater_.removeAudio(e,t,a)),(n||this.loaderType_==="main")&&(this.gopBuffer_=Ww(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,a));for(const l in this.inbandTextTracks_)Rn(e,t,this.inbandTextTracks_[l]);Rn(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=x.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&x.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=x.setTimeout(this.monitorBufferTick_.bind(this),Kw)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Zi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,r=this.partIndex){if(!t||!this.mediaSource_)return!1;const n=typeof e=="number"&&t.segments[e],s=e+1===t.segments.length,a=!n||!n.parts||r+1===n.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&s&&a}chooseNextRequest_(){const e=this.buffered_(),t=Fo(e)||0,r=Tu(e,this.currentTime_()),n=!this.hasPlayed_()&&r>=1,s=r>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||s)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(l.isSyncRequest)l.mediaIndex=Xw(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){const S=a[this.mediaIndex],w=typeof this.partIndex=="number"?this.partIndex:-1;l.startOfSegment=S.end?S.end:t,S.parts&&S.parts[w+1]?(l.mediaIndex=this.mediaIndex,l.partIndex=w+1):l.mediaIndex=this.mediaIndex+1}else{let S,w,C;const v=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
212
212
|
For TargetTime: ${v}.
|
|
213
213
|
CurrentTime: ${this.currentTime_()}
|
|
214
214
|
BufferedEnd: ${t}
|
|
215
215
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
216
|
-
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const D=this.getSyncInfoFromMediaSequenceSync_(v);if(!D){const L="No sync info found while using media sequence sync";return this.error({message:L,metadata:{errorType:B.Error.StreamingFailedToSelectNextSegment,error:new Error(L)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${D.start} --> ${D.end})`),S=D.segmentIndex,w=D.partIndex,C=D.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const D=_t.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});S=D.segmentIndex,w=D.partIndex,C=D.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,l.mediaIndex=S,l.startOfSegment=C,l.partIndex=w,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}const u=a[l.mediaIndex];let p=u&&typeof l.partIndex=="number"&&u.parts&&u.parts[l.partIndex];if(!u||typeof l.partIndex=="number"&&!p)return null;typeof l.partIndex!="number"&&u.parts&&(l.partIndex=0,p=u.parts[0]);const g=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&p&&!g&&!p.independent)if(l.partIndex===0){const S=a[l.mediaIndex-1],w=S.parts&&S.parts.length&&S.parts[S.parts.length-1];w&&w.independent&&(l.mediaIndex-=1,l.partIndex=S.parts.length-1,l.independent="previous segment")}else u.parts[l.partIndex-1].independent&&(l.partIndex-=1,l.independent="previous part");const b=this.mediaSource_&&this.mediaSource_.readyState==="ended";return l.mediaIndex>=a.length-1&&b&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(l))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const r=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!r)return null;if(!r.isAppended)return r;const n=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:r,mediaIndex:n,startOfSegment:s,isSyncRequest:a,partIndex:l,forceTimestampOffset:u,getMediaInfoForTime:p}=e,g=r.segments[n],b=typeof l=="number"&&g.parts[l],S={requestId:"segment-loader-"+Math.random(),uri:b&&b.resolvedUri||g.resolvedUri,mediaIndex:n,partIndex:b?l:null,isSyncRequest:a,startOfSegment:s,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:g.timeline,duration:b&&b.duration||g.duration,segment:g,part:b,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:t},w=typeof u<"u"?u:this.isPendingTimestampOffset_;S.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:g.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:w});const C=Bo(this.sourceUpdater_.audioBuffered());return typeof C=="number"&&(S.audioAppendStart=C-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(S.gopsToAlignWith=xw(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),S}timestampOffsetForSegment_(e){return Mw(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),r=e.bandwidth,n=this.pendingSegment_.duration,s=_t.estimateSegmentRequestTime(n,r,this.playlist_,e.bytesReceived),a=nE(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const l=_w({main:this.vhs_.playlists.main,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;const u=s-a-l.rebufferingImpact;let p=.5;a<=Zt&&(p=1),!(!l.playlist||l.playlist.uri===this.playlist_.uri||u<p)&&(this.bandwidth=l.playlist.attributes.BANDWIDTH*Xe.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${br(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:r,hasVideo:n}=t,s={segmentInfo:Ki({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:r,hasVideo:n}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:s}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},Pw(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():Di(this))))}handleTimingInfo_(e,t,r,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const s=this.pendingSegment_,a=rh(t);s[a]=s[a]||{},s[a][r]=n,this.logger_(`timinginfo: ${t} - ${r} - ${n}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Di(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(s=>{n[s.stream]=n[s.stream]||{startTime:1/0,captions:[],endTime:0};const a=n[s.stream];a.startTime=Math.min(a.startTime,s.startTime+r),a.endTime=Math.max(a.endTime,s.endTime+r),a.captions.push(s)}),Object.keys(n).forEach(s=>{const{startTime:a,endTime:l,captions:u}=n[s],p=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${l} for ${s}`),Tw(p,this.vhs_.tech_,s),xn(a,l,p[s]),Sw({captionArray:u,inbandTextTracks:p,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,r){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,r));return}this.addMetadataToTextTrack(r,t,this.duration_())}}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!ml({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:r,hasVideo:n,isMuxed:s}=t;return!(n&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||ml({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Di(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[rh(t.type)].start;else{const n=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&n&&n.hasVideo;let a;s&&(a=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:a,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,t.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==r.mediaIndex||n.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:r,playlist:n}){if(r){const s=ma(r);if(this.activeInitSegmentId_===s)return null;t=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=s}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r},n){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Qi(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Qi(a).join(", "));const l=s.length?s.start(0):0,u=s.length?s.end(s.length-1):0,p=a.length?a.start(0):0,g=a.length?a.end(a.length-1):0;if(u-l<=En&&g-p<=En){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${Qi(s).join(", ")}, video buffer: ${Qi(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:r}));const b=this.currentTime_()-En;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${b}`),this.remove(0,b,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${En}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=x.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},En*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:r},n){if(n){if(n.code===vm){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:B.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:r,data:n,bytes:s}){if(!s){const l=[n];let u=n.byteLength;r&&(l.unshift(r),u+=r.byteLength),s=vw({bytes:u,segments:l})}const a={segmentInfo:Ki({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,r){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,s=`${e}TimingInfo`;n[s]||(n[s]={}),n[s].transmuxerPrependedSeconds=r.prependedContentDuration||0,n[s].transmuxedPresentationStart=r.start.presentation,n[s].transmuxedDecodeStart=r.start.decode,n[s].transmuxedPresentationEnd=r.end.presentation,n[s].transmuxedDecodeEnd=r.end.decode,n[s].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,t){const{type:r,data:n}=t;if(!n||!n.byteLength||r==="audio"&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:r,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:s,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){Di(this),this.loadQueue_.push(()=>{const t=Ve({},e,{forceTimestampOffset:!0});Ve(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=r||n&&s;this.logger_(`Requesting
|
|
217
|
-
${
|
|
218
|
-
${br(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=hw({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:u,stream:p})=>{this.logger_(`${br(e)} logged from transmuxer stream ${p} as a ${u}: ${l}`)},triggerSegmentEventFn:({type:l,segment:u,keyInfo:p,trackInfo:g,timingInfo:b})=>{const S={segmentInfo:Ki({segment:u})};p&&(S.keyInfo=p),g&&(S.trackInfo=g),b&&(S.timingInfo=b),this.trigger({type:l,metadata:S})}})}trimBackBuffer_(e){const t=Uw(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,s=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:s},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<Fs){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Fs}`);return}const r={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:r}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,r){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,r));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===ti.ABORTED)return;if(this.pause(),e.code===ti.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,r.gopInfo&&(this.gopBuffer_=Lw(this.gopBuffer_,r.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:r,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:s,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const p=t.segments[r-1];return r===0||!p||typeof p.start>"u"||p.end!==n+s?n:l.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:n,isMuxed:s}=t,a=this.loaderType_==="main"&&n,l=!this.audioDisabled_&&r&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=Ow(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const l={segmentInfo:Ki({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:l})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=qw(e,this.sourceType_);if(t&&(t.severity==="warn"?B.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${br(e)}`);return}this.logger_(`Appended ${br(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const r=e.segment,n=e.part,s=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(s||a){this.logger_(`bad ${s?"segment":"part"} ${br(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<Fs){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Fs}`);return}const t=this.throughput.rate,r=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/r*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,r=t.start,n=t.end;if(!ih(r)||!ih(n))return;xn(r,n,this.segmentMetadataTrack_);const s=x.WebKitDataCue||x.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:r,end:n},l=JSON.stringify(a),u=new s(r,n,l);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function pi(){}const zm=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},$w=["video","audio"],yl=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},Vw=(i,e)=>{for(let t=0;t<e.length;t++){const r=e[t];if(r.type==="mediaSource")return null;if(r.type===i)return t}return null},Dr=(i,e)=>{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Dr("audio",e),Dr("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||yl(i,e))){if(r.type!==i){if(t=Vw(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,Dr(i,e);return}}},Wm=(i,e)=>{const t=e[`${i}Buffer`],r=zm(i);t&&(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},Yt=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,St={appendBuffer:(i,e,t)=>(r,n)=>{const s=n[`${r}Buffer`];if(Yt(n.mediaSource,s)){n.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{s.appendBuffer(i)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===vm?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),n.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const n=r[`${t}Buffer`];if(Yt(r.mediaSource,n)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{n.remove(i,e)}catch{r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];Yt(t.mediaSource,r)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){B.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){B.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(Yt(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){B.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=zm(i),n=Or(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const s=t.mediaSource.addSourceBuffer(n);s.addEventListener("updateend",t[`on${r}UpdateEnd_`]),s.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=s},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(Wm(i,e),!!Yt(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){B.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],n=Or(i);if(!Yt(t.mediaSource,r))return;const s=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===s)return;const l={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:l}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{r.changeType(n),t.codecs[e]=i}catch(u){l.errorType=B.Error.StreamingCodecsChangeError,l.error=u,u.metadata=l,t.error_=u,t.trigger("error"),B.log.warn(`Failed to changeType on ${e}Buffer`,u)}}},Et=({type:i,sourceUpdater:e,action:t,doneFn:r,name:n})=>{e.queue.push({type:i,action:t,doneFn:r,name:n}),Dr(i,e)},sh=(i,e)=>t=>{const r=e[`${i}Buffered`](),n=tE(r);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,n),e.queuePending[i]){const s=e.queuePending[i].doneFn;e.queuePending[i]=null,s&&s(e[`${i}Error_`])}Dr(i,e)};class Gm extends B.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Dr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Nt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=sh("video",this),this.onAudioUpdateEnd_=sh("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){Et({type:"mediaSource",sourceUpdater:this,action:St.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Et({type:e,sourceUpdater:this,action:St.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){B.log.error("removeSourceBuffer is not supported!");return}Et({type:"mediaSource",sourceUpdater:this,action:St.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!B.browser.IS_FIREFOX&&x.MediaSource&&x.MediaSource.prototype&&typeof x.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return x.SourceBuffer&&x.SourceBuffer.prototype&&typeof x.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){B.log.error("changeType is not supported!");return}Et({type:e,sourceUpdater:this,action:St.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:n,bytes:s}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${s.length} until video append`);return}const a=t;if(Et({type:n,sourceUpdater:this,action:St.appendBuffer(s,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return Yt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:it()}videoBuffered(){return Yt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:it()}buffered(){const e=Yt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Yt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():rE(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=pi){Et({type:"mediaSource",sourceUpdater:this,action:St.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=pi){typeof e!="string"&&(e=void 0),Et({type:"mediaSource",sourceUpdater:this,action:St.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=pi){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}Et({type:"audio",sourceUpdater:this,action:St.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=pi){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}Et({type:"video",sourceUpdater:this,action:St.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(yl("audio",this)||yl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(Et({type:"audio",sourceUpdater:this,action:St.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Et({type:"video",sourceUpdater:this,action:St.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Et({type:"audio",sourceUpdater:this,action:St.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Et({type:"video",sourceUpdater:this,action:St.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),$w.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Wm(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const ah=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),Hw=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},oh=new Uint8Array(`
|
|
216
|
+
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const L=this.getSyncInfoFromMediaSequenceSync_(v);if(!L){const D="No sync info found while using media sequence sync";return this.error({message:D,metadata:{errorType:B.Error.StreamingFailedToSelectNextSegment,error:new Error(D)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${L.start} --> ${L.end})`),S=L.segmentIndex,w=L.partIndex,C=L.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const L=Tt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});S=L.segmentIndex,w=L.partIndex,C=L.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,l.mediaIndex=S,l.startOfSegment=C,l.partIndex=w,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}const u=a[l.mediaIndex];let p=u&&typeof l.partIndex=="number"&&u.parts&&u.parts[l.partIndex];if(!u||typeof l.partIndex=="number"&&!p)return null;typeof l.partIndex!="number"&&u.parts&&(l.partIndex=0,p=u.parts[0]);const m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&p&&!m&&!p.independent)if(l.partIndex===0){const S=a[l.mediaIndex-1],w=S.parts&&S.parts.length&&S.parts[S.parts.length-1];w&&w.independent&&(l.mediaIndex-=1,l.partIndex=S.parts.length-1,l.independent="previous segment")}else u.parts[l.partIndex-1].independent&&(l.partIndex-=1,l.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return l.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(l))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const r=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!r)return null;if(!r.isAppended)return r;const n=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:r,mediaIndex:n,startOfSegment:s,isSyncRequest:a,partIndex:l,forceTimestampOffset:u,getMediaInfoForTime:p}=e,m=r.segments[n],_=typeof l=="number"&&m.parts[l],S={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:n,partIndex:_?l:null,isSyncRequest:a,startOfSegment:s,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:p,independent:t},w=typeof u<"u"?u:this.isPendingTimestampOffset_;S.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:s,buffered:this.buffered_(),overrideCheck:w});const C=Fo(this.sourceUpdater_.audioBuffered());return typeof C=="number"&&(S.audioAppendStart=C-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(S.gopsToAlignWith=Hw(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),S}timestampOffsetForSegment_(e){return Jw(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),r=e.bandwidth,n=this.pendingSegment_.duration,s=Tt.estimateSegmentRequestTime(n,r,this.playlist_,e.bytesReceived),a=bE(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const l=Rw({main:this.vhs_.playlists.main,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;const u=s-a-l.rebufferingImpact;let p=.5;a<=ni&&(p=1),!(!l.playlist||l.playlist.uri===this.playlist_.uri||u<p)&&(this.bandwidth=l.playlist.attributes.BANDWIDTH*Je.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Er(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:r,hasVideo:n}=t,s={segmentInfo:Zi({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:r,hasVideo:n}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:s}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},Gw(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ni(this))))}handleTimingInfo_(e,t,r,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const s=this.pendingSegment_,a=sh(t);s[a]=s[a]||{},s[a][r]=n,this.logger_(`timinginfo: ${t} - ${r} - ${n}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ni(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(s=>{n[s.stream]=n[s.stream]||{startTime:1/0,captions:[],endTime:0};const a=n[s.stream];a.startTime=Math.min(a.startTime,s.startTime+r),a.endTime=Math.max(a.endTime,s.endTime+r),a.captions.push(s)}),Object.keys(n).forEach(s=>{const{startTime:a,endTime:l,captions:u}=n[s],p=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${l} for ${s}`),Uw(p,this.vhs_.tech_,s),Rn(a,l,p[s]),Mw({captionArray:u,inbandTextTracks:p,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,r){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,r));return}this.addMetadataToTextTrack(r,t,this.duration_())}}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!fl({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:r,hasVideo:n,isMuxed:s}=t;return!(n&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!s&&!e.audioTimingInfo||fl({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){Ni(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[sh(t.type)].start;else{const n=this.getCurrentMediaInfo_(),s=this.loaderType_==="main"&&n&&n.hasVideo;let a;s&&(a=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:s,firstVideoFrameTimeForData:a,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,t.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==r.mediaIndex||n.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:r,playlist:n}){if(r){const s=ya(r);if(this.activeInitSegmentId_===s)return null;t=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=s}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r},n){const s=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+tr(s).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+tr(a).join(", "));const l=s.length?s.start(0):0,u=s.length?s.end(s.length-1):0,p=a.length?a.start(0):0,m=a.length?a.end(a.length-1):0;if(u-l<=In&&m-p<=In){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${tr(s).join(", ")}, video buffer: ${tr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:r}));const _=this.currentTime_()-In;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${In}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=x.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},In*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:r},n){if(n){if(n.code===Ig){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:B.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:r,data:n,bytes:s}){if(!s){const l=[n];let u=n.byteLength;r&&(l.unshift(r),u+=r.byteLength),s=Ow({bytes:u,segments:l})}const a={segmentInfo:Zi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:s},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:s}))}handleSegmentTimingInfo_(e,t,r){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,s=`${e}TimingInfo`;n[s]||(n[s]={}),n[s].transmuxerPrependedSeconds=r.prependedContentDuration||0,n[s].transmuxedPresentationStart=r.start.presentation,n[s].transmuxedDecodeStart=r.start.decode,n[s].transmuxedPresentationEnd=r.end.presentation,n[s].transmuxedDecodeEnd=r.end.decode,n[s].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,t){const{type:r,data:n}=t;if(!n||!n.byteLength||r==="audio"&&this.audioDisabled_)return;const s=this.getInitSegmentAndUpdateState_({type:r,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:s,data:n})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){Ni(this),this.loadQueue_.push(()=>{const t=Ge({},e,{forceTimestampOffset:!0});Ge(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,s=e.timeline!==this.currentTimeline_&&e.timeline>0,a=r||n&&s;this.logger_(`Requesting
|
|
217
|
+
${Qg(e.uri)}
|
|
218
|
+
${Er(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Iw({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:l,level:u,stream:p})=>{this.logger_(`${Er(e)} logged from transmuxer stream ${p} as a ${u}: ${l}`)},triggerSegmentEventFn:({type:l,segment:u,keyInfo:p,trackInfo:m,timingInfo:_})=>{const S={segmentInfo:Zi({segment:u})};p&&(S.keyInfo=p),m&&(S.trackInfo=m),_&&(S.timingInfo=_),this.trigger({type:l,metadata:S})}})}trimBackBuffer_(e){const t=Qw(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,s=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:s},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<$s){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${$s}`);return}const r={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:r}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,r){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,r));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===ai.ABORTED)return;if(this.pause(),e.code===ai.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,r.gopInfo&&(this.gopBuffer_=zw(this.gopBuffer_,r.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:r,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:s,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const p=t.segments[r-1];return r===0||!p||typeof p.start>"u"||p.end!==n+s?n:l.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:r,hasVideo:n,isMuxed:s}=t,a=this.loaderType_==="main"&&n,l=!this.audioDisabled_&&r&&!s;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=Yw(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const l={segmentInfo:Zi({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:l})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=i2(e,this.sourceType_);if(t&&(t.severity==="warn"?B.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${Er(e)}`);return}this.logger_(`Appended ${Er(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const r=e.segment,n=e.part,s=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(s||a){this.logger_(`bad ${s?"segment":"part"} ${Er(e)}`),this.resetEverything();return}this.mediaIndex!==null&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}recordThroughput_(e){if(e.duration<$s){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${$s}`);return}const t=this.throughput.rate,r=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/r*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,r=t.start,n=t.end;if(!nh(r)||!nh(n))return;Rn(r,n,this.segmentMetadataTrack_);const s=x.WebKitDataCue||x.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:r,end:n},l=JSON.stringify(a),u=new s(r,n,l);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function fi(){}const Jg=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},r2=["video","audio"],_l=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},n2=(i,e)=>{for(let t=0;t<e.length;t++){const r=e[t];if(r.type==="mediaSource")return null;if(r.type===i)return t}return null},Or=(i,e)=>{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Or("audio",e),Or("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||_l(i,e))){if(r.type!==i){if(t=n2(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,Or(i,e);return}}},Zg=(i,e)=>{const t=e[`${i}Buffer`],r=Jg(i);t&&(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},ti=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,It={appendBuffer:(i,e,t)=>(r,n)=>{const s=n[`${r}Buffer`];if(ti(n.mediaSource,s)){n.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{s.appendBuffer(i)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===Ig?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),n.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const n=r[`${t}Buffer`];if(ti(r.mediaSource,n)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{n.remove(i,e)}catch{r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];ti(t.mediaSource,r)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){B.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){B.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(ti(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){B.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=Jg(i),n=Fr(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const s=t.mediaSource.addSourceBuffer(n);s.addEventListener("updateend",t[`on${r}UpdateEnd_`]),s.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=s},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(Zg(i,e),!!ti(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){B.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],n=Fr(i);if(!ti(t.mediaSource,r))return;const s=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===s)return;const l={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:l}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{r.changeType(n),t.codecs[e]=i}catch(u){l.errorType=B.Error.StreamingCodecsChangeError,l.error=u,u.metadata=l,t.error_=u,t.trigger("error"),B.log.warn(`Failed to changeType on ${e}Buffer`,u)}}},At=({type:i,sourceUpdater:e,action:t,doneFn:r,name:n})=>{e.queue.push({type:i,action:t,doneFn:r,name:n}),Or(i,e)},oh=(i,e)=>t=>{const r=e[`${i}Buffered`](),n=fE(r);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,n),e.queuePending[i]){const s=e.queuePending[i].doneFn;e.queuePending[i]=null,s&&s(e[`${i}Error_`])}Or(i,e)};class ef extends B.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Or("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=jt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=oh("video",this),this.onAudioUpdateEnd_=oh("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){At({type:"mediaSource",sourceUpdater:this,action:It.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){At({type:e,sourceUpdater:this,action:It.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){B.log.error("removeSourceBuffer is not supported!");return}At({type:"mediaSource",sourceUpdater:this,action:It.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!B.browser.IS_FIREFOX&&x.MediaSource&&x.MediaSource.prototype&&typeof x.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return x.SourceBuffer&&x.SourceBuffer.prototype&&typeof x.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){B.log.error("changeType is not supported!");return}At({type:e,sourceUpdater:this,action:It.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:n,bytes:s}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${s.length} until video append`);return}const a=t;if(At({type:n,sourceUpdater:this,action:It.appendBuffer(s,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return ti(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:at()}videoBuffered(){return ti(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:at()}buffered(){const e=ti(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ti(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():_E(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=fi){At({type:"mediaSource",sourceUpdater:this,action:It.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=fi){typeof e!="string"&&(e=void 0),At({type:"mediaSource",sourceUpdater:this,action:It.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=fi){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}At({type:"audio",sourceUpdater:this,action:It.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=fi){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}At({type:"video",sourceUpdater:this,action:It.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(_l("audio",this)||_l("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(At({type:"audio",sourceUpdater:this,action:It.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(At({type:"video",sourceUpdater:this,action:It.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&At({type:"audio",sourceUpdater:this,action:It.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&At({type:"video",sourceUpdater:this,action:It.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),r2.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Zg(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const lh=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),s2=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},uh=new Uint8Array(`
|
|
219
219
|
|
|
220
|
-
`.split("").map(i=>i.charCodeAt(0)));class
|
|
221
|
-
`,a=r,l=t;this.start_=a,e.forEach((u,p)=>{const
|
|
222
|
-
`,
|
|
223
|
-
`,l++,a=S}),this.end_=a,this.storage_=n,this.diagnostics_=s}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const s=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<s;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class uh extends Xm{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const Yw=86400,qo=[{name:"VOD",run:(i,e,t,r,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,n,s)=>{const a=i.getMediaSequenceSync(s);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,n)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let s=null,a=null;const l=ol(e);n=n||0;for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=i.timelineToDatetimeMappings[b.timeline];if(!S||!b.dateTimeObject)continue;let w=b.dateTimeObject.getTime()/1e3+S;if(b.parts&&typeof g.partIndex=="number")for(let v=0;v<g.partIndex;v++)w+=b.parts[v].duration;const C=Math.abs(n-w);if(a!==null&&(C===0||a<C))break;a=C,s={time:w,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return s}},{name:"Segment",run:(i,e,t,r,n)=>{let s=null,a=null;n=n||0;const l=ol(e);for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),g=l[p],b=g.segment,S=g.part&&g.part.start||b&&b.start;if(b.timeline===r&&typeof S<"u"){const w=Math.abs(n-S);if(a!==null&&a<w)break;(!s||a===null||a>=w)&&(a=w,s={time:S,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return s}},{name:"Discontinuity",run:(i,e,t,r,n)=>{let s=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],p=e.discontinuitySequence+l+1,g=i.discontinuities[p];if(g){const b=Math.abs(n-g.time);if(a!==null&&a<b)break;(!s||a===null||a>=b)&&(a=b,s={time:g.time,segmentIndex:u,partIndex:null})}}}return s}},{name:"Playlist",run:(i,e,t,r,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Qw extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Xm,r=new uh(t),n=new uh(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:n},this.logger_=Nt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,n,s){if(t!==1/0)return qo.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,n,s);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:p}=l,{segmentIndex:g,time:b}=u;if(g<0)continue;const S=e.segments[g],w=b,C=w+S.duration;if(this.logger_(`Strategy: ${p}. Current time: ${n}. selected segment: ${g}. Time: [${w} -> ${C}]}`),n>=w&&n<C)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const n=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+On({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,n,s){const a=[];for(let l=0;l<qo.length;l++){const u=qo[l],p=u.run(this,e,t,r,n,s);p&&(p.strategy=u.name,a.push({strategy:u.name,syncPoint:p}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,r=e[a].syncPoint,s=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${s}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,t){const r=t.mediaSequence-e.mediaSequence;if(r>Yw){B.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let n=r-1;n>=0;n--){const s=e.segments[n];if(s&&typeof s.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:s.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const n=e.segment,s=e.part;let a=this.timelines[e.timeline],l,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,u=t.end+a.mapping;else if(a)l=t.start+a.mapping,u=t.end+a.mapping;else return!1;return s&&(s.start=l,s.end=u),(!n.start||l<n.start)&&(n.start=l),n.end=u,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let n=0;n<t.discontinuityStarts.length;n++){const s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=s-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let p;l<0?p=r.start-On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):p=r.end+On({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:p,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class Jw extends B.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){if(typeof t=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Zw=Pm(Rm(function(){var i=function(){function v(){this.listeners={}}var D=v.prototype;return D.on=function(L,O){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(O)},D.off=function(L,O){if(!this.listeners[L])return!1;var U=this.listeners[L].indexOf(O);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(U,1),U>-1},D.trigger=function(L){var O=this.listeners[L];if(O)if(arguments.length===2)for(var U=O.length,F=0;F<U;++F)O[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),V=O.length,J=0;J<V;++J)O[J].apply(this,N)},D.dispose=function(){this.listeners={}},D.pipe=function(L){this.on("data",function(O){L.push(O)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],D=v[0],L=v[1],O=D[4],U=L[4];let F,N,V;const J=[],Y=[];let ie,pe,le,ge,ee,ce;for(F=0;F<256;F++)Y[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=V=0;!O[N];N^=ie||1,V=Y[V]||1)for(ge=V^V<<1^V<<2^V<<3^V<<4,ge=ge>>8^ge&255^99,O[N]=ge,U[ge]=N,le=J[pe=J[ie=J[N]]],ce=le*16843009^pe*65537^ie*257^N*16843008,ee=J[ge]*257^ge*16843008,F=0;F<4;F++)D[F][N]=ee=ee<<24^ee>>>8,L[F][ge]=ce=ce<<24^ce>>>8;for(F=0;F<5;F++)D[F]=D[F].slice(0),L[F]=L[F].slice(0);return v};let r=null;class n{constructor(D){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let L,O,U;const F=this._tables[0][4],N=this._tables[1],V=D.length;let J=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const Y=D.slice(0),ie=[];for(this._key=[Y,ie],L=V;L<4*V+28;L++)U=Y[L-1],(L%V===0||V===8&&L%V===4)&&(U=F[U>>>24]<<24^F[U>>16&255]<<16^F[U>>8&255]<<8^F[U&255],L%V===0&&(U=U<<8^U>>>24^J<<24,J=J<<1^(J>>7)*283)),Y[L]=Y[L-V]^U;for(O=0;L;O++,L--)U=Y[O&3?L:L-4],L<=4||O<4?ie[O]=U:ie[O]=N[0][F[U>>>24]]^N[1][F[U>>16&255]]^N[2][F[U>>8&255]]^N[3][F[U&255]]}decrypt(D,L,O,U,F,N){const V=this._key[1];let J=D^V[0],Y=U^V[1],ie=O^V[2],pe=L^V[3],le,ge,ee;const ce=V.length/4-2;let ne,he=4;const we=this._tables[1],ze=we[0],dt=we[1],Ot=we[2],ht=we[3],Ut=we[4];for(ne=0;ne<ce;ne++)le=ze[J>>>24]^dt[Y>>16&255]^Ot[ie>>8&255]^ht[pe&255]^V[he],ge=ze[Y>>>24]^dt[ie>>16&255]^Ot[pe>>8&255]^ht[J&255]^V[he+1],ee=ze[ie>>>24]^dt[pe>>16&255]^Ot[J>>8&255]^ht[Y&255]^V[he+2],pe=ze[pe>>>24]^dt[J>>16&255]^Ot[Y>>8&255]^ht[ie&255]^V[he+3],he+=4,J=le,Y=ge,ie=ee;for(ne=0;ne<4;ne++)F[(3&-ne)+N]=Ut[J>>>24]<<24^Ut[Y>>16&255]<<16^Ut[ie>>8&255]<<8^Ut[pe&255]^V[he++],le=J,J=Y,Y=ie,ie=pe,pe=le}}class s extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(D){this.jobs.push(D),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,D,L){const O=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),U=new n(Array.prototype.slice.call(D)),F=new Uint8Array(v.byteLength),N=new Int32Array(F.buffer);let V,J,Y,ie,pe,le,ge,ee,ce;for(V=L[0],J=L[1],Y=L[2],ie=L[3],ce=0;ce<O.length;ce+=4)pe=a(O[ce]),le=a(O[ce+1]),ge=a(O[ce+2]),ee=a(O[ce+3]),U.decrypt(pe,le,ge,ee,N,ce),N[ce]=a(N[ce]^V),N[ce+1]=a(N[ce+1]^J),N[ce+2]=a(N[ce+2]^Y),N[ce+3]=a(N[ce+3]^ie),V=pe,J=le,Y=ge,ie=ee;return F};class u{constructor(D,L,O,U){const F=u.STEP,N=new Int32Array(D.buffer),V=new Uint8Array(D.byteLength);let J=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V)),J=F;J<N.length;J+=F)O=new Uint32Array([a(N[J-4]),a(N[J-3]),a(N[J-2]),a(N[J-1])]),this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,O,V));this.asyncStream_.push(function(){U(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(D,L,O,U){return function(){const F=l(D,L,O);U.set(F,D.byteOffset)}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ys<"u"?Ys:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof p<"u"?g=p:typeof self<"u"?g=self:g={};var b=g,S=function(v){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(v):v&&v.buffer instanceof ArrayBuffer},w=b.BigInt||Number;w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000"),function(){var v=new Uint16Array([65484]),D=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return D[0]===255?"big":D[0]===204?"little":"unknown"}();const C=function(v){const D={};return Object.keys(v).forEach(L=>{const O=v[L];S(O)?D[L]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:D[L]=O}),D};self.onmessage=function(v){const D=v.data,L=new Uint8Array(D.encrypted.bytes,D.encrypted.byteOffset,D.encrypted.byteLength),O=new Uint32Array(D.key.bytes,D.key.byteOffset,D.key.byteLength/4),U=new Uint32Array(D.iv.bytes,D.iv.byteOffset,D.iv.byteLength/4);new u(L,O,U,function(F,N){self.postMessage(C({source:D.source,decrypted:N}),[N.buffer])})}}));var e2=Dm(Zw);const t2=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Km=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},_l=(i,e)=>{e.activePlaylistLoader=i,i.load()},i2=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:n}}=e,s=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastGroup_;if(!(a&&u&&a.id===u.id)&&(n.lastGroup_=a,n.lastTrack_=s,Km(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),_l(a.playlistLoader,n)}},r2=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},n2=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:n},mediaTypes:{[i]:s}}=e,a=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,p=s.lastTrack_;if(!(p&&a&&p.id===a.id)&&(s.lastGroup_=l,s.lastTrack_=a,Km(r,s),!!l)){if(l.isMainPlaylist){if(!a||!p||a.id===p.id)return;const g=e.vhs.playlistController_,b=g.selectPlaylist();if(g.media()===b)return;s.logger_(`track change. Switching main audio from ${p.id} to ${a.id}`),t.pause(),n.resetEverything(),g.fastQualityChange_(b);return}if(i==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}r.setAudio(!0),n.setAudio(!1)}if(u===l.playlistLoader){_l(l.playlistLoader,s);return}r.track&&r.track(a),r.resetEverything(),_l(l.playlistLoader,s)}},_a={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,n=t.activeTrack(),s=t.activeGroup(),a=(s.filter(u=>u.default)[0]||s[0]).id,l=t.tracks[a];if(n===l){r({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},ch={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:n,segmentLoaders:{[i]:s}}=t;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,n),(!r.paused()||a.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:n,segmentLoaders:{[i]:s},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();s.playlist(l,n),s.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",_a[i](i,t))}},s2={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:n},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:p}},mainPlaylistLoader:g}=e,b=ts(g.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},b&&(a[i].main.default.playlists=g.main.playlists));for(const S in a[i]){l[S]||(l[S]=[]);for(const w in a[i][S]){let C=a[i][S][w],v;if(b?(p(`AUDIO group '${S}' label '${w}' is a main playlist`),C.isMainPlaylist=!0,v=null):r==="vhs-json"&&C.playlists?v=new Er(C.playlists[0],t,s):C.resolvedUri?v=new Er(C.resolvedUri,t,s):C.playlists&&r==="dash"?v=new pl(C.playlists[0],t,s,g):v=null,C=fe({id:w,playlistLoader:v},C),ch[i](i,C.playlistLoader,e),l[S].push(C),typeof u[w]>"u"){const D=new B.AudioTrack({id:w,kind:t2(C),enabled:!1,language:C.language,default:C.default,label:w});u[w]=D}}}n.on("error",_a[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:n,segmentLoaders:{[i]:s},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:p}},mainPlaylistLoader:g}=e;for(const b in l[i]){u[b]||(u[b]=[]);for(const S in l[i][b]){if(!r.options_.useForcedSubtitles&&l[i][b][S].forced)continue;let w=l[i][b][S],C;if(n==="hls")C=new Er(w.resolvedUri,r,a);else if(n==="dash"){if(!w.playlists.filter(v=>v.excludeUntil!==1/0).length)return;C=new pl(w.playlists[0],r,a,g)}else n==="vhs-json"&&(C=new Er(w.playlists?w.playlists[0]:w.resolvedUri,r,a));if(w=fe({id:S,playlistLoader:C},w),ch[i](i,w.playlistLoader,e),u[b].push(w),typeof p[S]>"u"){const v=t.addRemoteTextTrack({id:S,kind:"subtitles",default:w.default&&w.autoselect,language:w.language,label:S},!1).track;p[S]=v}}}s.on("error",_a[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:n,tracks:s}}}=e;for(const a in r[i]){n[a]||(n[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const p=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(p[g.instreamId]&&(g=fe(g,p[g.instreamId])),g.default===void 0&&delete g.default,n[a].push(fe({id:l},u)),typeof s[l]>"u"){const b=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;s[l]=b}}}}},Ym=(i,e)=>{for(let t=0;t<i.length;t++)if(Eu(e,i[t])||i[t].playlists&&Ym(i[t].playlists,e))return!0;return!1},a2=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:n}}}=e,s=r.media();if(!s)return null;let a=null;s.attributes[i]&&(a=n[s.attributes[i]]);const l=Object.keys(n);if(!a)if(i==="AUDIO"&&l.length>1&&ts(e.main))for(let u=0;u<l.length;u++){const p=n[l[u]];if(Ym(p,s)){a=p;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},o2={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},l2=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},u2=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{s2[p](p,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:n,segmentLoaders:{["AUDIO"]:s,main:a}}=i;["AUDIO","SUBTITLES"].forEach(p=>{e[p].activeGroup=a2(p,i),e[p].activeTrack=o2[p](p,i),e[p].onGroupChanged=i2(p,i),e[p].onGroupChanging=r2(p,i),e[p].onTrackChanged=n2(p,i),e[p].getActiveGroup=l2(p,i)});const l=e.AUDIO.activeGroup();if(l){const p=(l.filter(g=>g.default)[0]||l[0]).id;e.AUDIO.tracks[p].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",u),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const p in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[p])},c2=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:pi,activeTrack:pi,getActiveGroup:pi,onGroupChanged:pi,onTrackChanged:pi,lastTrack_:null,logger_:Nt(`MediaGroups[${e}]`)}}),i};class dh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=yt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class d2 extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new dh,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Nt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const r=t.serverUri||t.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=yt(e,r),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const r=e?t:this.getRequestURI(t);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(s,a)=>{if(s){if(a.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const p=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){const g={errorType:B.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new x.URL(e),r=new x.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(x.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new x.URL(e),r=this.getPathway(),n=this.getBandwidth_();if(r){const s=`_${this.manifestType_}_pathway`;t.searchParams.set(s,r)}if(n){const s=`_${this.manifestType_}_throughput`;t.searchParams.set(s,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=x.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){x.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new dh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(yt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const h2=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},p2=10;let Pi;const g2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],m2=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},f2=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:a,bufferBasedABR:l,log:u}){if(!r)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const p=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${p} as current playlist is not set`),!0;if(r.id===i.id)return!1;const g=!!Sr(e,t).length;if(!i.endList)return!g&&typeof i.partTargetDuration=="number"?(u(`not ${p} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${p} as current playlist is live`),!0);const b=vu(e,t),S=l?Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Xe.MAX_BUFFER_LOW_WATER_LINE;if(a<S)return u(`${p} as duration < max low water line (${a} < ${S})`),!0;const w=r.attributes.BANDWIDTH,C=i.attributes.BANDWIDTH;if(w<C&&(!l||b<s)){let v=`${p} as next bandwidth < current bandwidth (${w} < ${C})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${b} < ${s})`),u(v),!0}if((!l||w>C)&&b>=n){let v=`${p} as forwardBuffer >= bufferLowWaterLine (${b} >= ${n})`;return l&&(v+=` and next bandwidth > current bandwidth (${w} > ${C})`),u(v),!0}return u(`not ${p} as no switching criteria met`),!1};class y2 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=h2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:n,bandwidth:s,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:p,sourceType:g,cacheEncryptionKeys:b,bufferBasedABR:S,leastPixelDiffSelector:w,captionServices:C,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:D}=e;(D===null||typeof D>"u")&&(D=1/0),Pi=a,this.bufferBasedABR=!!S,this.leastPixelDiffSelector=!!w,this.withCredentials=r,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=D,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:D,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=c2(),v&&x.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new x.ManagedMediaSource,this.usingManagedMediaSource_=!0,B.log("Using ManagedMediaSource")):x.MediaSource&&(this.mediaSource=new x.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=it(),this.hasPlayed_=!1,this.syncController_=new Qw(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new e2,this.sourceUpdater_=new Gm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Jw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:C,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:b,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new pl(t,this.vhs_,fe(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Er(t,this.vhs_,fe(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new fl(fe(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new fl(fe(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Ww(fe(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function V(){n.off("vttjserror",J),F()}function J(){n.off("vttjsloaded",V),N()}n.one("vttjsloaded",V),n.one("vttjserror",J),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new d2(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),g2.forEach(F=>{this[F+"_"]=m2.bind(this,F)}),this.logger_=Nt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const n=this.media(),s=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(s&&s!==a){this.logger_(`switch media ${s} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],r=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(r&&n){const s=(r.length?r[0].playlists:r.playlists).filter(a=>a.attributes.serviceLocation===n);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=x.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(x.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,n=Object.keys(r);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||n.length&&r[n[0]];for(const u in l)if(l[u].default){s={label:u};break}}if(!s)return t;const a=[];for(const l in r)if(r[l][s.label]){const u=r[l][s.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let p=0;p<e.playlists.length;p++){const g=e.playlists[p];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===l&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),u2({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ll(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(Ve({},t))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let n=!0;const s=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Pi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(r.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),n=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return f2({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const r=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:p2}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.audioSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))}),this.subtitleSegmentLoader_.on(t,r=>{this.player_.trigger(Ve({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let n=r;if(e.start){const s=e.start.timeOffset;s<0?n=Math.max(r+s,t.start(0)):n=Math.min(r,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const r=Pi.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return r-n<=ei;const a=s.end(s.length-1);return a-n<=ei&&r-a<=ei}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,s=n.filter(Ga),a=s.length===1&&s[0]===e;if(n.length===1&&r!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const C=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(C),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(C)},v);return}let w=!1;n.forEach(C=>{if(C===e)return;const v=C.excludeUntil;typeof v<"u"&&v!==1/0&&(w=!0,delete C.excludeUntil)}),w&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const p=t.internal?this.logger_:B.log.warn,g=t.message?" "+t.message:"";p(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const b=u.targetDuration/2*1e3||5*1e3,S=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=b;return this.switchMedia_(u,"exclude",a||S)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],n=e==="all";(n||e==="main")&&r.push(this.mainPlaylistLoader_);const s=[];(n||e==="audio")&&s.push("AUDIO"),(n||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&r.push(l)}),r.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=Sr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Pi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,u=n.end;if(!isFinite(l)||!isFinite(u))return null;const p=Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),g=Math.max(0,u-p);return g<l?null:it([[l,g]])}const s=this.syncController_.getExpiredTime(r,this.duration());if(s===null)return null;const a=Pi.Playlist.seekable(r,s,Pi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),n=e.end(0),s=t.start(0),a=t.end(0);return s>n||r>a?e:it([[Math.max(r,s),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${om(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let r=Pi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const r in t)t[r].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=Un(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=r.video||e.main.videoCodec||oT),e.main.isMuxed&&(n.video+=`,${r.audio||e.main.audioCodec||ad}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||ad,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(p,g)=>p?Dn(g,this.usingManagedMediaSource_):ko(g),l={};let u;if(["video","audio"].forEach(function(p){if(n.hasOwnProperty(p)&&!a(e[p].isFmp4,n[p])){const g=e[p].isFmp4?"browser":"muxer";l[g]=l[g]||[],l[g].push(n[p]),p==="audio"&&(u=g)}}),s&&u&&t.attributes.AUDIO){const p=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===p&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${p} as ${u} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const p=Object.keys(l).reduce((g,b)=>(g&&(g+=", "),g+=`${b} does not support codec(s): "${l[b].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const p=[];if(["video","audio"].forEach(g=>{const b=(Kt(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,S=(Kt(n[g]||"")[0]||{}).type;b&&S&&b.toLowerCase()!==S.toLowerCase()&&p.push(`"${this.sourceUpdater_.codecs[g]}" -> "${n[g]}"`)}),p.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const n=e[r];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const s=Un(this.main,n),a=[];s.audio&&!ko(s.audio)&&!Dn(s.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${s.audio}`),s.video&&!ko(s.video)&&!Dn(s.video,this.usingManagedMediaSource_)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,n=fa(Kt(e)),s=Jd(n),a=n.video&&Kt(n.video)[0]||null,l=n.audio&&Kt(n.audio)[0]||null;Object.keys(r).forEach(u=>{const p=r[u];if(t.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;t.push(p.id);const g=[],b=Un(this.mainPlaylistLoader_.main,p),S=Jd(b);if(!(!b.audio&&!b.video)){if(S!==s&&g.push(`codec count "${S}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const w=b.video&&Kt(b.video)[0]||null,C=b.audio&&Kt(b.audio)[0]||null;w&&a&&w.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${w.type}" !== "${a.type}"`),C&&l&&C.type.toLowerCase()!==l.type.toLowerCase()&&g.push(`audio codec "${C.type}" !== "${l.type}"`)}g.length&&(p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),Xw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Xe.GOAL_BUFFER_LENGTH,r=Xe.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Xe.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Xe.BUFFER_LOW_WATER_LINE,r=Xe.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Xe.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?s:n)}bufferHighWaterLine(){return Xe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){th(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Iw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();th(this.inbandTextTracks_,e,this.tech_),ww({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(Ve({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),r=[];for(const n of e.playlists){const s=n.attributes.serviceLocation;if(s&&(r.push(s),!t.has(s)))return!0}return!!(!r.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,r=new Set;let n=!1;Object.keys(t).forEach(s=>{const a=t[s],l=this.pathwayAttribute_(a),u=l&&e!==l;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!u&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const p=!a.excludeUntil&&a.excludeUntil!==1/0;!r.has(a.id)&&u&&p&&(r.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const a=this.mediaTypes_[s];if(a.activePlaylistLoader){const l=a.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||r&&r.size){for(const[n,s]of t.entries())r.get(n)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(n));for(const[n,s]of r.entries()){const a=t.get(n);if(!a){e.filter(l=>l.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(l=>{this.mainPlaylistLoader_.addClonePathway(s,l)}),this.contentSteeringController_.addAvailablePathway(n);continue}this.equalPathwayClones_(a,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(n))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const s in r)if(r[s]!==n[s])return!1;for(const s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=this.mainPlaylistLoader_.getKeyIdSet(r);!n||!n.size||n.forEach(s=>{const a="usable",l=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===a,u=r.lastExcludeReason_===t&&r.excludeUntil===1/0;l?l&&u&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${s} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==t&&(r.excludeUntil=1/0,r.lastExcludeReason_=t,this.logger_(`excluding playlist ${r.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,s=r.excludeUntil===1/0&&r.lastExcludeReason_===t;n&&s&&(delete r.excludeUntil,B.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:Hw(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const _2=(i,e,t)=>r=>{const n=i.main.playlists[e],s=Su(n),a=Ga(n);if(typeof r>"u")return a;r?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return r!==a&&!s&&(r?(t(n),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class b2{constructor(e,t,r){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Un(n.main(),t),this.playlist=t,this.id=r,this.enabled=_2(e.playlists,t.id,s)}}const v2=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=ts(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Su(r)).map((r,n)=>new b2(i,r,r.id)):[]}},hh=["seeking","seeked","pause","playing","error"];class T2 extends B.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Nt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(g=>{u[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",u[g].reset),this.tech_.on(["seeked","seeking"],u[g].reset)});const p=g=>{["main","audio"].forEach(b=>{a[`${b}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off"))},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(hh,s),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(hh,s),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",u[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",u[g].reset),this.tech_.off(["seeked","seeking"],u[g].reset)}),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=x.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],n=r.buffered_(),s=sE(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,s){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Qi(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ei>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(it([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime(),r=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const w=e.start(0);n=w+(w===e.end(0)?0:ei)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${om(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const s=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),l=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,p=this.media(),g=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Zt)*2,b=[l,u];for(let w=0;w<b.length;w++)if(b[w]&&vu(b[w],t)<g)return!1;const S=Ms(a,t);return S.length===0?!1:(n=S.start(0)+ei,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Sr(t,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=Ms(n,t);return s.length>0?(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+ei;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||n)&&(s=e.end(e.length-1)+r.targetDuration*3),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:r}){if(!e)return;let n;if(e.length&&t.length){const s=Sr(e,r-3),a=Sr(e,r),l=Sr(t,r);l.length&&!a.length&&s.length&&(n={start:s.end(0),end:l.end(0)})}else Ms(e,r).length||(n=this.gapFromVideoUnderflow_(e,r));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),n=Ms(t,r);if(this.resetTimeUpdate_(),n.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+Zt);const s={gapInfo:{from:r,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=iE(e);for(let n=0;n<r.length;n++){const s=r.start(n),a=r.end(n);if(t-s<4&&t-s>2)return{start:s,end:a}}return null}}const S2={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},Qm=function(i,e){let t=0,r=0;const n=fe(S2,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){r&&i.currentTime(r)},a=function(g){g!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(g),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){B.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(i,a)},u=function(){i.off("loadedmetadata",s),i.off("error",l),i.off("dispose",u)},p=function(g){u(),Qm(i,g)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=p},E2=function(i){Qm(this,i)};var Jm="3.16.2",w2="7.1.0",k2="1.3.1",C2="7.2.0",I2="4.0.2";const Ne={PlaylistLoader:Er,Playlist:_t,utils:xE,STANDARD_PLAYLIST_SELECTOR:eh,INITIAL_PLAYLIST_SELECTOR:bw,lastBandwidthSelector:eh,movingAverageBandwidthSelector:yw,comparePlaylistBandwidth:ku,comparePlaylistResolution:fw,xhr:wm()};Object.keys(Xe).forEach(i=>{Object.defineProperty(Ne,i,{get(){return B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Xe[i]},set(e){if(B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Xe[i]=e}})});const Zm="videojs-vhs",ef=function(i,e){const t=e.media();let r=-1;for(let n=0;n<i.length;n++)if(i[n].id===t.id){r=n;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},A2=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),ef(i,e.playlists)};Ne.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const x2=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=fa(Kt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const n=Or(r.video),s=Or(r.audio),a={};for(const l in i)a[l]={},s&&(a[l].audioContentType=s),n&&(a[l].videoContentType=n),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof i[l]=="string"&&(a[l].url=i[l]);return fe(i,a)},L2=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const n=e.reduce((s,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(s[a]={pssh:l.pssh}),s},{});return Object.keys(n).length&&t.push(n),t},[]),D2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=L2(n,Object.keys(e)),a=[],l=[];return s.forEach(u=>{l.push(new Promise((p,g)=>{i.tech_.one("keysessioncreated",p)})),a.push(new Promise((p,g)=>{i.eme.initializeMediaKeys({keySystems:u},b=>{if(b){g(b);return}p()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},P2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=x2(e,t,r);return n?(i.currentSource().keySystems=n,n&&!i.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},tf=()=>{if(!x.localStorage)return null;const i=x.localStorage.getItem(Zm);if(!i)return null;try{return JSON.parse(i)}catch{return null}},R2=i=>{if(!x.localStorage)return!1;let e=tf();e=e?fe(e,i):i;try{x.localStorage.setItem(Zm,JSON.stringify(e))}catch{return!1}return e},N2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,rf=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},nf=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},sf=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},af=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};Ne.supportsNativeHls=function(){if(!G||!G.createElement)return!1;const i=G.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(i.canPlayType(e))}):!1}();Ne.supportsNativeDash=function(){return!G||!G.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(G.createElement("video").canPlayType("application/dash+xml"))}();Ne.supportsTypeNatively=i=>i==="hls"?Ne.supportsNativeHls:i==="dash"?Ne.supportsNativeDash:!1;Ne.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Ne.xhr.onRequest=function(i){rf(Ne.xhr,i)};Ne.xhr.onResponse=function(i){nf(Ne.xhr,i)};Ne.xhr.offRequest=function(i){sf(Ne.xhr,i)};Ne.xhr.offResponse=function(i){af(Ne.xhr,i)};const O2=B.getComponent("Component");class of extends O2{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Nt("VhsHandler"),t.options_&&t.options_.playerId){const n=B.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(G,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const s=G.fullscreenElement||G.webkitFullscreenElement||G.mozFullScreenElement||G.msFullscreenElement;s&&s.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=fe(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=tf();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Xe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Xe.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=N2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ne,this.options_.sourceType=Cp(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new y2(this.options_);const r=fe({liveRangeSafeTimeDelta:ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new T2(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const s=B.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),s.error(a)});const n=this.options_.bufferBasedABR?Ne.movingAverageBandwidthSelector(.55):Ne.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Ne.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&s>=l?s=Math.max(s,u):s=u}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){B.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Qi(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Qi(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&R2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{v2(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=x.URL.createObjectURL(this.playlistController_.mediaSource),(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),D2({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=P2({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{A2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{ef(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Jm,"mux.js":w2,"mpd-parser":k2,"m3u8-parser":C2,"aes-decrypter":I2}}version(){return this.constructor.version()}canChangeType(){return Gm.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&x.URL.revokeObjectURL&&(x.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return UE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return xm({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{rf(this.xhr,e)},this.xhr.onResponse=e=>{nf(this.xhr,e)},this.xhr.offRequest=e=>{sf(this.xhr,e)},this.xhr.offResponse=e=>{af(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,n=>{this.player_.trigger(Ve({},n))})}),t.forEach(r=>{this.playbackWatcher_.on(r,n=>{this.player_.trigger(Ve({},n))})})}}const ba={name:"videojs-http-streaming",VERSION:Jm,canHandleSource(i,e={}){const t=fe(B.options,e);return!t.vhs.experimentalUseMMS&&!Dn("avc1.4d400d,mp4a.40.2",!1)?!1:ba.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=fe(B.options,t);return e.vhs=new of(i,e,r),e.vhs.xhr=wm(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=Cp(i);if(!t)return"";const r=ba.getOverrideNative(e);return!Ne.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:r=t}=e;return r}},U2=()=>Dn("avc1.4d400d,mp4a.40.2",!0);U2()&&B.getTech("Html5").registerSourceHandler(ba,0);B.VhsHandler=of;B.VhsSourceHandler=ba;B.Vhs=Ne;B.use||B.registerComponent("Vhs",Ne);B.options.vhs=B.options.vhs||{};(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",E2);const M2=i=>{const e=Me.useRef();return Me.useEffect(()=>{if(!e.current&&i.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),i.current.appendChild(t),e.current=B(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},lf={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:i=>{},playMuted:!1,muted:!1,autoplay:!0},De=X.i(lf),ph=i=>{if(!i)return 0;const e=i.duration(),t=i.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},B2=(i,e)=>{const t=hb(i,e),r=M2(i),n=Me.useRef(),s=Me.useCallback(()=>{var p,g;const{adPosition:b,adCount:S}=De.get();if(r.current){if(b<S){const w=b+1,{ads:C,muted:v,autoplay:D}=t.get(),L=C[w-1];if(L){(p=n.current)==null||p.complete(),n.current=new rb(null,L.ad,L.creative),n.current.on("clickthrough",O=>{window.open(O,"_blank")}),De.setKey("adPosition",w),De.setKey("playMuted",v),De.setKey("skipDelay",L.creative.skipDelay||0),De.setKey("time",0),De.setKey("adAction",O=>{n.current&&n.current.click(null,{CLICKPOS:[O.clientX,O.clientY]})}),De.setKey("whyThisAd",L.creative.icons.find(O=>O.program==="GoogleWhyThisAd")||null),De.setKey("hasAdUrl",!!((g=L.creative.videoClickThroughURLTemplate)!=null&&g.url)),r.current.src(L.mediaFileUrl),De.setKey("playing",!0),b===0?(De.setKey("muted",v),De.setKey("autoplay",D),v&&r.current.muted(!0),D?r.current.play():(r.current.pause(),De.setKey("paused",!0))):r.current.play();return}}De.set(lf),r.current.pause(),r.current.src(void 0)}},[r,t]),a=Me.useCallback(()=>{if(!r.current)return;const p=r.current.muted();r.current.muted(!p),De.setKey("muted",!p),n.current&&n.current.setMuted(!p)},[r]),l=Me.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),n.current&&n.current.setPaused(!1)):(r.current.pause(),n.current&&n.current.setPaused(!0)))},[r]),u=Me.useCallback(()=>{r.current&&(n.current&&n.current.skip(),s())},[s,r]);return Me.useEffect(()=>{r.current&&(r.current.on("play",p=>{De.setKey("playing",!0),De.setKey("paused",!1),De.setKey("time",ph(p.target.player))}),r.current.on("ended",()=>{s()}),r.current.on("muted",p=>{console.log("muted",p),De.setKey("muted",p.target.player.muted())}),r.current.on("pause",()=>{De.setKey("paused",!0)}),r.current.on("click",function(p){p.target.tagName==="VIDEO"&&(De.get().autoplay||l())}),r.current.on("timeupdate",p=>{De.setKey("time",ph(p.target.player)),n.current&&n.current.setProgress(p.target.player.currentTime())}))},[l,s,r]),Me.useEffect(()=>t.subscribe(p=>{p&&(De.setKey("adCount",p.ads.length),De.setKey("adPosition",0),s())}),[t,r,s]),[De,a,l,u]},F2=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:n})=>{var s,a,l,u,p;const g=Me.useRef(null),[b,S,w,C]=B2(g,r==null?void 0:r.url),{time:v,adCount:D,adPosition:L,skipDelay:O,playing:U,paused:F,reset:N,muted:V,playMuted:J,autoplay:Y,whyThisAd:ie,hasAdUrl:pe,adAction:le}=X.useStore(b),ge=((s=i.sponsor)==null?void 0:s.logo)&&i.logoMode===de.PromotionLogoMode.CENTER;return W.jsxs(_h,{className:"PromoOverlay",children:[W.jsxs(bh,{children:[W.jsx(vh,{className:X.cx_default(!ge&&Th),children:W.jsx(Eh,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(F0,{children:[W.jsx(L0,{time:v,adCount:D,adPosition:L}),!!O&&U&&W.jsx(X.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{C()},duration:O,isPlaying:!F,skipIcon:!0}),n&&W.jsx(X.y,{className:"ClosePromoIcon",close:()=>{N(),e==null||e()}})]})]}),W.jsx(Sh,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsxs(B0,{ref:g,children:[ie&&W.jsx(P0,{whyThisAd:ie}),W.jsxs(R0,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[J&&W.jsx(O0,{className:X.cx_default(!V&&"muted"),onClick:()=>S()}),F&&!Y&&W.jsx(M0,{onClick:()=>w()})]})]})}),pe&&W.jsx(wh,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsx(kh,{as:"button",onClick:le,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((p=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:p.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},gh=i=>{var e,t,r,n,s,a,l,u,p,g,b,S,w,C,v,D,L,O,U,F,N,V,J,Y,ie,pe,le,ge,ee,ce;const{promotion:ne,open:he,advertisementPaused:we,togglePause:ze,controlVideo:dt,skipAutoClose:Ot,promotionId:ht,onClose:Ut,markAsViewed:Vt,externalAd:xe}=i,Fe=ne.type===de.PromotionType.INGAME_IAB11_LBAR||ne.type===de.PromotionType.INGAME_IAB11||ne.type===de.PromotionType.INGAME_IAB11_SIDEBAR,oi=((e=ne.sponsor)==null?void 0:e.logo)&&ne.logoMode===de.PromotionLogoMode.CENTER,Fi=!!((r=(t=ne.banner)==null?void 0:t.video)!=null&&r.url),li=ne.autoPlayVideo===de.AutoPlayVideo.ENABLED;if(Me.useEffect(()=>{ze==null||ze(Fi||li),he==null||he()},[]),Me.useEffect(()=>{ht&&ne.type&&Vt&&Vt()},[ht,ne.type,Vt]),Me.useEffect(()=>()=>{dt==null||dt({muted:!1})},[dt]),xe)return W.jsx(F2,{...i,externalAd:xe});let Ht=(n=ne.banner)==null?void 0:n.url;Ht&&Ht.indexOf("http")!==0&&(Ht=`https://${Ht}`);let Ti=!0;return Fi&&(!we||!li?Ti=!0:Ti=!1),W.jsxs(_h,{className:"PromoOverlay",children:[W.jsxs("div",{children:[W.jsxs(bh,{children:[W.jsxs(vh,{className:X.cx_default(!oi&&Th),children:[((s=ne.sponsor)==null?void 0:s.logo)&&ne.logoMode===de.PromotionLogoMode.LEFT&&W.jsx(fc,{className:"PromoSponsorLogo",src:(a=ne.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(E0,{style:{paddingLeft:(l=ne.sponsor)!=null&&l.logo&&ne.logoMode===de.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=ne.sponsor)==null?void 0:u.logo)&&ne.logoMode===de.PromotionLogoMode.LEFT&&W.jsx(b0,{children:(p=ne.sponsor)==null?void 0:p.name}),W.jsxs(w0,{className:"SponsorText",children:[W.jsx(Eh,{children:"AD"}),W.jsx(k0,{children:"SPONSORED"})]})]})]}),W.jsx(X.y,{className:"ClosePromoIcon",close:Ut,autoClose:(g=ne.closeTimer)==null?void 0:g.auto,duration:Ot?0:(b=ne.closeTimer)==null?void 0:b.seconds,isPlaying:Ti})]}),W.jsxs(Sh,{children:[oi&&W.jsx(fc,{className:T0,src:(S=ne.sponsor)==null?void 0:S.logo,alt:"promo"}),W.jsx(yc,{children:(C=(w=ne.banner)==null?void 0:w.video)!=null&&C.url?W.jsx(X.R$1,{source:(D=(v=ne.banner)==null?void 0:v.video)==null?void 0:D.url,poster:(O=(L=ne.banner)==null?void 0:L.video)==null?void 0:O.thumbnailUrl,aspectRatio:Fe?"1/1":"2/1",onPause:()=>{li&&(ze==null||ze(!0))},onPlay:()=>{X.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:ht,type:ne.type}}),ze==null||ze(!1)},controlVideo:dt,autoPlay:li}):(U=ne.banner)!=null&&U.imageUrl?W.jsx(v0,{style:Fe?{aspectRatio:"1/1"}:{},src:(F=ne.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Fe&&W.jsxs(yc,{children:[((N=ne.banner)==null?void 0:N.title)&&W.jsx(C0,{className:X.cx_default("AdvTitle",oi&&I0),children:(V=ne.banner)==null?void 0:V.title}),((J=ne.banner)==null?void 0:J.body)&&W.jsx(S0,{className:"AdvDescription",children:(Y=ne.banner)==null?void 0:Y.body})]})]})]}),ne.buttonType===de.PromotionButtonType.BASIC&&W.jsx(wh,{children:W.jsx(kh,{href:Ht,style:{backgroundColor:((pe=(ie=ne.banner)==null?void 0:ie.ctaButton)==null?void 0:pe.color)||"#009dc4",color:((ge=(le=ne.banner)==null?void 0:le.ctaButton)==null?void 0:ge.textColor)||"#fff"},"data-a":"button","data-promo-id":ht,"data-promo-type":ne.type,target:"_blank",children:(ce=(ee=ne.banner)==null?void 0:ee.ctaButton)==null?void 0:ce.label})})]})},j2=X.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),q2=({children:i,direction:e,style:t,className:r,hiding:n})=>W.jsx(bl,{direction:e,style:t,hiding:n,className:r,children:W.jsx(j2,{children:i})}),mh=i=>(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB21_LBAR,$2=i=>(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB11_SIDEBAR||(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB21_SIDEBAR,V2=i=>(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===de.PromotionType.INGAME_IAB21,H2=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:n="side-by-side",sidebar:s,isNotification:a,banner:l,markAsViewed:u,open:p,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})=>i.promotion?a&&i.notification?W.jsx(y0,{open:()=>p==null?void 0:p({fromNotification:!0}),notification:i.notification,promotionId:i.question.id}):!s&&!l&&(t||V2(i.promotion))?W.jsx(_0,{className:"PromoOverlayContainer",children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:p,skipAutoClose:r,externalAd:g,controlVideo:b,advertisementPaused:S,togglePause:w})}):s&&(t||mh(i.promotion)||$2(i.promotion))?W.jsx(q2,{className:"PromoSidebarContainer",direction:s,hiding:!1,children:W.jsx(gh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:g,onClose:e,open:p,controlVideo:b,skipAutoClose:r,advertisementPaused:S,togglePause:w})}):l&&mh(i.promotion)?W.jsx(O_,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l}):null:null,z2=X.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),W2=i=>{const e=i.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",r=e.getAttribute("data-promo-type")||de.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&X.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-a")==="banner"&&X.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},G2=({gamification:i,layoutMode:e,skipAutoClose:t,skipTypeCheck:r,sidebar:n,banner:s,notification:a,isMobileScreen:l,persistent:u,externalAd:p,controlVideo:g})=>{var b,S,w;const C=Me.useRef(null),v=X.useStore(i.advertisement.$store);X.b$1(C,{enabled:!!v.data,event:"click",listener:W2});const D=!s&&!n;if(v.data===void 0||!u&&v.isViewed)return null;const L=((w=(S=(b=v==null?void 0:v.data)==null?void 0:b.notification)==null?void 0:S.promotion)==null?void 0:w.mode)===de.NotificationPromotionMode.LOWER_THIRD;return W.jsx(z2,{ref:C,style:{height:D?"auto":"100%"},className:X.cx_default("SL-AdvertisementUIWrap",l&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:W.jsx(H2,{skipTypeCheck:r,sidebar:n,banner:s,advertisement:v.data,advertisementPaused:v.isPaused,togglePause:v.togglePause,close:v.close,externalAd:p?v.externalAd:void 0,markAsViewed:i.advertisement.markAsViewed,open:i.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:g})})},uf=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:n,skipTypeCheck:s,layoutMode:a,isMobileScreen:l,persistent:u,notification:p})=>{const g=X.useStore(i.featuresList.getStore()),[b,S]=Me.useState(!t);if(Me.useEffect(()=>{if(t){const C=document.createElement("script");C.async=!0,C.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(C),C.onload=()=>{S(!0)}}},[t]),e&&r)return W.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return W.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!g)return null;const w=i.getFeature(de.SdkOverlayType.GAMES);return!w||t&&!b?null:W.jsx(G2,{gamification:w,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,skipTypeCheck:s,skipAutoClose:n,externalAd:t,controlVideo:i.controlVideoPlayer})},X2=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:n,persistent:s,theme:a,notification:l,skipTypeCheck:u,externalAd:p})=>{const g=X.useStreamLayer(),b=X.useStreamLayerUI(),S=X.useStreamLayerTheme();return g?p&&!b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!p&&b.promotionExternalAd?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):e&&!b.promotionSidebar?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):t&&!b.promotionBanner?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):l&&!b.promotionNotification?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):!t&&!e&&!l&&!b.promotionOverlay?i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i}):W.jsxs("div",{className:"StreamLayerSDK",children:[W.jsx(X.h,{customTheme:a??S.theme,themeMode:S.themeMode,children:W.jsx(uf,{sdk:g,sidebar:e,banner:t,isMobileScreen:r,persistent:s,notification:l,skipTypeCheck:u,skipAutoClose:n,layoutMode:"side-by-side",externalAd:p})}),i!==void 0&&W.jsx(X.StreamLayerSDKEvent,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=X2;exports.StreamLayerSDKAdvertisementUI=uf;
|
|
220
|
+
`.split("").map(i=>i.charCodeAt(0)));class a2 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class o2 extends yl{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return at();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return at([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=ya(e);let n=this.initSegments_[r];if(t&&!n&&e.bytes){const s=uh.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(uh,e.bytes.byteLength),this.initSegments_[r]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return n||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Rn(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===ai.TIMEOUT&&this.handleTimeout_(),e.code===ai.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const n=this.pendingSegment_,s=r.mp4VttCues&&r.mp4VttCues.length;s&&(n.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(n.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=n.segment;if(a.map&&(a.map.bytes=t.map.bytes),n.bytes=t.bytes,typeof x.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(n)}catch(l){this.stopForError({message:l.message,metadata:{errorType:B.Error.StreamingVttParserError,error:l}});return}if(s||this.updateTimeMapping_(n,this.syncController_.timelines[n.timeline],this.playlist_),n.cues.length?n.timingInfo={start:n.cues[0].startTime,end:n.cues[n.cues.length-1].endTime}:n.timingInfo={start:n.startOfSegment,end:n.startOfSegment+n.duration},n.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}n.byteLength=n.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,n.cues.forEach(l=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new x.VTTCue(l.startTime,l.endTime,l.text):l)}),Vw(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const r=e&&e.type==="vtt",n=t&&t.type==="text";r&&n&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const n=r.start+t,s=r.end+t,a=new x.VTTCue(n,s,r.cueText);r.settings&&r.settings.split(" ").forEach(l=>{const u=l.split(":"),p=u[0],m=u[1];a[p]=isNaN(m)?m:Number(m)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof x.WebVTT!="function")throw new a2;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof x.TextDecoder=="function"?t=new x.TextDecoder("utf8"):(t=x.WebVTT.StringDecoder(),r=!0);const n=new x.WebVTT.Parser(x,x.vttjs,t);if(n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=a=>{e.timestampmap=a},n.onparsingerror=a=>{B.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=lh(a)),n.parse(a)}let s=e.bytes;r&&(s=lh(s)),n.parse(s),n.flush()}updateTimeMapping_(e,t,r){const n=e.segment;if(!t)return;if(!e.cues.length){n.empty=!0;return}const{MPEGTS:s,LOCAL:a}=e.timestampmap,l=s/er.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(u=>{const p=u.endTime-u.startTime,m=this.handleRollover_(u.startTime+l,t.time);u.startTime=Math.max(m,0),u.endTime=Math.max(m+p,0)}),!r.syncInfo){const u=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(u,p-n.duration)}}}handleRollover_(e,t){if(t===null)return e;let r=e*er.ONE_SECOND_IN_TS;const n=t*er.ONE_SECOND_IN_TS;let s;for(n<r?s=-8589934592:s=8589934592;Math.abs(r-n)>4294967296;)r+=s;return r/er.ONE_SECOND_IN_TS}}const l2=function(i,e){const t=i.cues;for(let r=0;r<t.length;r++){const n=t[r];if(e>=n.adStartTime&&e<=n.adEndTime)return n}return null},u2=function(i,e,t=0){if(!i.segments)return;let r=t,n;for(let s=0;s<i.segments.length;s++){const a=i.segments[s];if(n||(n=l2(e,r+a.duration/2)),n){if("cueIn"in a){n.endTime=r,n.adEndTime=r,r+=a.duration,n=null;continue}if(r<n.endTime){r+=a.duration;continue}n.endTime+=a.duration}else if("cueOut"in a&&(n=new x.VTTCue(r,r+a.duration,a.cueOut),n.adStartTime=r,n.adEndTime=r+parseFloat(a.cueOut),e.addCue(n)),"cueOutCont"in a){const[l,u]=a.cueOutCont.split("/").map(parseFloat);n=new x.VTTCue(r,r+a.duration,""),n.adStartTime=r-l,n.adEndTime=n.adStartTime+u,e.addCue(n)}r+=a.duration}};class ch{constructor({start:e,end:t,segmentIndex:r,partIndex:n=null,appended:s=!1}){this.start_=e,this.end_=t,this.segmentIndex_=r,this.partIndex_=n,this.appended_=s}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class c2{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class tf{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:r,segments:n}=e;if(this.isReliable_=this.isReliablePlaylist_(r,n),!!this.isReliable_)return this.updateStorage_(n,r,this.calculateBaseTime_(r,n,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const n of r)if(n.isInRange(e))return n}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,r){const n=new Map;let s=`
|
|
221
|
+
`,a=r,l=t;this.start_=a,e.forEach((u,p)=>{const m=this.storage_.get(l),_=a,S=_+u.duration,w=!!(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),C=new ch({start:_,end:S,appended:w,segmentIndex:p});u.syncInfo=C;let v=a;const L=(u.parts||[]).map((D,O)=>{const U=v,F=v+D.duration,R=!!(m&&m.partsSyncInfo&&m.partsSyncInfo[O]&&m.partsSyncInfo[O].isAppended),q=new ch({start:U,end:F,appended:R,segmentIndex:p,partIndex:O});return v=F,s+=`Media Sequence: ${l}.${O} | Range: ${U} --> ${F} | Appended: ${R}
|
|
222
|
+
`,D.syncInfo=q,q});n.set(l,new c2(C,L)),s+=`${Qg(u.resolvedUri)} | Media Sequence: ${l} | Range: ${_} --> ${S} | Appended: ${w}
|
|
223
|
+
`,l++,a=S}),this.end_=a,this.storage_=n,this.diagnostics_=s}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const s=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<s;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class dh extends tf{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const d2=86400,qo=[{name:"VOD",run:(i,e,t,r,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,n,s)=>{const a=i.getMediaSequenceSync(s);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,n)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let s=null,a=null;const l=ll(e);n=n||0;for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),m=l[p],_=m.segment,S=i.timelineToDatetimeMappings[_.timeline];if(!S||!_.dateTimeObject)continue;let w=_.dateTimeObject.getTime()/1e3+S;if(_.parts&&typeof m.partIndex=="number")for(let v=0;v<m.partIndex;v++)w+=_.parts[v].duration;const C=Math.abs(n-w);if(a!==null&&(C===0||a<C))break;a=C,s={time:w,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return s}},{name:"Segment",run:(i,e,t,r,n)=>{let s=null,a=null;n=n||0;const l=ll(e);for(let u=0;u<l.length;u++){const p=e.endList||n===0?u:l.length-(u+1),m=l[p],_=m.segment,S=m.part&&m.part.start||_&&_.start;if(_.timeline===r&&typeof S<"u"){const w=Math.abs(n-S);if(a!==null&&a<w)break;(!s||a===null||a>=w)&&(a=w,s={time:S,segmentIndex:m.segmentIndex,partIndex:m.partIndex})}}return s}},{name:"Discontinuity",run:(i,e,t,r,n)=>{let s=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],p=e.discontinuitySequence+l+1,m=i.discontinuities[p];if(m){const _=Math.abs(n-m.time);if(a!==null&&a<_)break;(!s||a===null||a>=_)&&(a=_,s={time:m.time,segmentIndex:u,partIndex:null})}}}return s}},{name:"Playlist",run:(i,e,t,r,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class h2 extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new tf,r=new dh(t),n=new dh(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:n},this.logger_=jt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,n,s){if(t!==1/0)return qo.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,n,s);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:p}=l,{segmentIndex:m,time:_}=u;if(m<0)continue;const S=e.segments[m],w=_,C=w+S.duration;if(this.logger_(`Strategy: ${p}. Current time: ${n}. selected segment: ${m}. Time: [${w} -> ${C}]}`),n>=w&&n<C)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const n=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+Fn({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,n,s){const a=[];for(let l=0;l<qo.length;l++){const u=qo[l],p=u.run(this,e,t,r,n,s);p&&(p.strategy=u.name,a.push({strategy:u.name,syncPoint:p}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),s=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,r=e[a].syncPoint,s=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${s}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,t){const r=t.mediaSequence-e.mediaSequence;if(r>d2){B.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let n=r-1;n>=0;n--){const s=e.segments[n];if(s&&typeof s.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:s.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const s=n.dateTimeObject;n.discontinuity&&t&&s&&(this.timelineToDatetimeMappings[n.timeline]=-(s.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const n=e.segment,s=e.part;let a=this.timelines[e.timeline],l,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,u=t.end+a.mapping;else if(a)l=t.start+a.mapping,u=t.end+a.mapping;else return!1;return s&&(s.start=l,s.end=u),(!n.start||l<n.start)&&(n.start=l),n.end=u,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let n=0;n<t.discontinuityStarts.length;n++){const s=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=s-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let p;l<0?p=r.start-Fn({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:s}):p=r.end+Fn({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:s}),this.discontinuities[a]={time:p,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class p2 extends B.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){if(typeof t=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const m2=Fg(jg(function(){var i=function(){function v(){this.listeners={}}var L=v.prototype;return L.on=function(D,O){this.listeners[D]||(this.listeners[D]=[]),this.listeners[D].push(O)},L.off=function(D,O){if(!this.listeners[D])return!1;var U=this.listeners[D].indexOf(O);return this.listeners[D]=this.listeners[D].slice(0),this.listeners[D].splice(U,1),U>-1},L.trigger=function(D){var O=this.listeners[D];if(O)if(arguments.length===2)for(var U=O.length,F=0;F<U;++F)O[F].call(this,arguments[1]);else for(var R=Array.prototype.slice.call(arguments,1),q=O.length,J=0;J<q;++J)O[J].apply(this,R)},L.dispose=function(){this.listeners={}},L.pipe=function(D){this.on("data",function(O){D.push(O)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],L=v[0],D=v[1],O=L[4],U=D[4];let F,R,q;const J=[],Y=[];let ie,me,oe,ge,ee,ue;for(F=0;F<256;F++)Y[(J[F]=F<<1^(F>>7)*283)^F]=F;for(R=q=0;!O[R];R^=ie||1,q=Y[q]||1)for(ge=q^q<<1^q<<2^q<<3^q<<4,ge=ge>>8^ge&255^99,O[R]=ge,U[ge]=R,oe=J[me=J[ie=J[R]]],ue=oe*16843009^me*65537^ie*257^R*16843008,ee=J[ge]*257^ge*16843008,F=0;F<4;F++)L[F][R]=ee=ee<<24^ee>>>8,D[F][ge]=ue=ue<<24^ue>>>8;for(F=0;F<5;F++)L[F]=L[F].slice(0),D[F]=D[F].slice(0);return v};let r=null;class n{constructor(L){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let D,O,U;const F=this._tables[0][4],R=this._tables[1],q=L.length;let J=1;if(q!==4&&q!==6&&q!==8)throw new Error("Invalid aes key size");const Y=L.slice(0),ie=[];for(this._key=[Y,ie],D=q;D<4*q+28;D++)U=Y[D-1],(D%q===0||q===8&&D%q===4)&&(U=F[U>>>24]<<24^F[U>>16&255]<<16^F[U>>8&255]<<8^F[U&255],D%q===0&&(U=U<<8^U>>>24^J<<24,J=J<<1^(J>>7)*283)),Y[D]=Y[D-q]^U;for(O=0;D;O++,D--)U=Y[O&3?D:D-4],D<=4||O<4?ie[O]=U:ie[O]=R[0][F[U>>>24]]^R[1][F[U>>16&255]]^R[2][F[U>>8&255]]^R[3][F[U&255]]}decrypt(L,D,O,U,F,R){const q=this._key[1];let J=L^q[0],Y=U^q[1],ie=O^q[2],me=D^q[3],oe,ge,ee;const ue=q.length/4-2;let te,de=4;const be=this._tables[1],je=be[0],Ye=be[1],ve=be[2],ye=be[3],kt=be[4];for(te=0;te<ue;te++)oe=je[J>>>24]^Ye[Y>>16&255]^ve[ie>>8&255]^ye[me&255]^q[de],ge=je[Y>>>24]^Ye[ie>>16&255]^ve[me>>8&255]^ye[J&255]^q[de+1],ee=je[ie>>>24]^Ye[me>>16&255]^ve[J>>8&255]^ye[Y&255]^q[de+2],me=je[me>>>24]^Ye[J>>16&255]^ve[Y>>8&255]^ye[ie&255]^q[de+3],de+=4,J=oe,Y=ge,ie=ee;for(te=0;te<4;te++)F[(3&-te)+R]=kt[J>>>24]<<24^kt[Y>>16&255]<<16^kt[ie>>8&255]<<8^kt[me&255]^q[de++],oe=J,J=Y,Y=ie,ie=me,me=oe}}class s extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(L){this.jobs.push(L),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,L,D){const O=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),U=new n(Array.prototype.slice.call(L)),F=new Uint8Array(v.byteLength),R=new Int32Array(F.buffer);let q,J,Y,ie,me,oe,ge,ee,ue;for(q=D[0],J=D[1],Y=D[2],ie=D[3],ue=0;ue<O.length;ue+=4)me=a(O[ue]),oe=a(O[ue+1]),ge=a(O[ue+2]),ee=a(O[ue+3]),U.decrypt(me,oe,ge,ee,R,ue),R[ue]=a(R[ue]^q),R[ue+1]=a(R[ue+1]^J),R[ue+2]=a(R[ue+2]^Y),R[ue+3]=a(R[ue+3]^ie),q=me,J=oe,Y=ge,ie=ee;return F};class u{constructor(L,D,O,U){const F=u.STEP,R=new Int32Array(L.buffer),q=new Uint8Array(L.byteLength);let J=0;for(this.asyncStream_=new s,this.asyncStream_.push(this.decryptChunk_(R.subarray(J,J+F),D,O,q)),J=F;J<R.length;J+=F)O=new Uint32Array([a(R[J-4]),a(R[J-3]),a(R[J-2]),a(R[J-1])]),this.asyncStream_.push(this.decryptChunk_(R.subarray(J,J+F),D,O,q));this.asyncStream_.push(function(){U(null,e(q))})}static get STEP(){return 32e3}decryptChunk_(L,D,O,U){return function(){const F=l(L,D,O);U.set(F,L.byteOffset)}}}var p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Js<"u"?Js:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof p<"u"?m=p:typeof self<"u"?m=self:m={};var _=m,S=function(v){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(v):v&&v.buffer instanceof ArrayBuffer},w=_.BigInt||Number;w("0x1"),w("0x100"),w("0x10000"),w("0x1000000"),w("0x100000000"),w("0x10000000000"),w("0x1000000000000"),w("0x100000000000000"),w("0x10000000000000000"),function(){var v=new Uint16Array([65484]),L=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return L[0]===255?"big":L[0]===204?"little":"unknown"}();const C=function(v){const L={};return Object.keys(v).forEach(D=>{const O=v[D];S(O)?L[D]={bytes:O.buffer,byteOffset:O.byteOffset,byteLength:O.byteLength}:L[D]=O}),L};self.onmessage=function(v){const L=v.data,D=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),O=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),U=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new u(D,O,U,function(F,R){self.postMessage(C({source:L.source,decrypted:R}),[R.buffer])})}}));var g2=Bg(m2);const f2=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},rf=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},bl=(i,e)=>{e.activePlaylistLoader=i,i.load()},y2=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:n}}=e,s=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,u=n.lastGroup_;if(!(a&&u&&a.id===u.id)&&(n.lastGroup_=a,n.lastTrack_=s,rf(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),bl(a.playlistLoader,n)}},_2=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},b2=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:n},mediaTypes:{[i]:s}}=e,a=s.activeTrack(),l=s.getActiveGroup(),u=s.activePlaylistLoader,p=s.lastTrack_;if(!(p&&a&&p.id===a.id)&&(s.lastGroup_=l,s.lastTrack_=a,rf(r,s),!!l)){if(l.isMainPlaylist){if(!a||!p||a.id===p.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;s.logger_(`track change. Switching main audio from ${p.id} to ${a.id}`),t.pause(),n.resetEverything(),m.fastQualityChange_(_);return}if(i==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}r.setAudio(!0),n.setAudio(!1)}if(u===l.playlistLoader){bl(l.playlistLoader,s);return}r.track&&r.track(a),r.resetEverything(),bl(l.playlistLoader,s)}},va={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,n=t.activeTrack(),s=t.activeGroup(),a=(s.filter(u=>u.default)[0]||s[0]).id,l=t.tracks[a];if(n===l){r({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},hh={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:n,segmentLoaders:{[i]:s}}=t;e.on("loadedmetadata",()=>{const a=e.media();s.playlist(a,n),(!r.paused()||a.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",va[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:n,segmentLoaders:{[i]:s},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();s.playlist(l,n),s.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&s.load()}),e.on("loadedplaylist",()=>{s.playlist(e.media(),n),r.paused()||s.load()}),e.on("error",va[i](i,t))}},v2={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:n},requestOptions:s,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:p}},mainPlaylistLoader:m}=e,_=ss(m.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},_&&(a[i].main.default.playlists=m.main.playlists));for(const S in a[i]){l[S]||(l[S]=[]);for(const w in a[i][S]){let C=a[i][S][w],v;if(_?(p(`AUDIO group '${S}' label '${w}' is a main playlist`),C.isMainPlaylist=!0,v=null):r==="vhs-json"&&C.playlists?v=new Ir(C.playlists[0],t,s):C.resolvedUri?v=new Ir(C.resolvedUri,t,s):C.playlists&&r==="dash"?v=new ml(C.playlists[0],t,s,m):v=null,C=_e({id:w,playlistLoader:v},C),hh[i](i,C.playlistLoader,e),l[S].push(C),typeof u[w]>"u"){const L=new B.AudioTrack({id:w,kind:f2(C),enabled:!1,language:C.language,default:C.default,label:w});u[w]=L}}}n.on("error",va[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:n,segmentLoaders:{[i]:s},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:p}},mainPlaylistLoader:m}=e;for(const _ in l[i]){u[_]||(u[_]=[]);for(const S in l[i][_]){if(!r.options_.useForcedSubtitles&&l[i][_][S].forced)continue;let w=l[i][_][S],C;if(n==="hls")C=new Ir(w.resolvedUri,r,a);else if(n==="dash"){if(!w.playlists.filter(v=>v.excludeUntil!==1/0).length)return;C=new ml(w.playlists[0],r,a,m)}else n==="vhs-json"&&(C=new Ir(w.playlists?w.playlists[0]:w.resolvedUri,r,a));if(w=_e({id:S,playlistLoader:C},w),hh[i](i,w.playlistLoader,e),u[_].push(w),typeof p[S]>"u"){const v=t.addRemoteTextTrack({id:S,kind:"subtitles",default:w.default&&w.autoselect,language:w.language,label:S},!1).track;p[S]=v}}}s.on("error",va[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:n,tracks:s}}}=e;for(const a in r[i]){n[a]||(n[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const p=t.options_.vhs&&t.options_.vhs.captionServices||{};let m={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(p[m.instreamId]&&(m=_e(m,p[m.instreamId])),m.default===void 0&&delete m.default,n[a].push(_e({id:l},u)),typeof s[l]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;s[l]=_}}}}},nf=(i,e)=>{for(let t=0;t<i.length;t++)if(wu(e,i[t])||i[t].playlists&&nf(i[t].playlists,e))return!0;return!1},T2=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:n}}}=e,s=r.media();if(!s)return null;let a=null;s.attributes[i]&&(a=n[s.attributes[i]]);const l=Object.keys(n);if(!a)if(i==="AUDIO"&&l.length>1&&ss(e.main))for(let u=0;u<l.length;u++){const p=n[l[u]];if(nf(p,s)){a=p;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},S2={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},E2=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},w2=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{v2[p](p,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:n,segmentLoaders:{["AUDIO"]:s,main:a}}=i;["AUDIO","SUBTITLES"].forEach(p=>{e[p].activeGroup=T2(p,i),e[p].activeTrack=S2[p](p,i),e[p].onGroupChanged=y2(p,i),e[p].onGroupChanging=_2(p,i),e[p].onTrackChanged=b2(p,i),e[p].getActiveGroup=E2(p,i)});const l=e.AUDIO.activeGroup();if(l){const p=(l.filter(m=>m.default)[0]||l[0]).id;e.AUDIO.tracks[p].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),s.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(p=>e[p].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",u),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const p in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[p])},k2=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:fi,activeTrack:fi,getActiveGroup:fi,onGroupChanged:fi,onTrackChanged:fi,lastTrack_:null,logger_:jt(`MediaGroups[${e}]`)}}),i};class ph{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=vt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class C2 extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new ph,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=jt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const r=t.serverUri||t.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=vt(e,r),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const r=e?t:this.getRequestURI(t);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(s,a)=>{if(s){if(a.status===410){this.logger_(`manifest request 410 ${s}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const p=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${s}.`),this.logger_(`content steering will retry in ${p} seconds.`),this.startTTLTimeout_(parseInt(p,10));return}this.logger_(`manifest failed to load ${s}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(p){const m={errorType:B.Error.StreamingContentSteeringParserError,error:p};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new x.URL(e),r=new x.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(x.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new x.URL(e),r=this.getPathway(),n=this.getBandwidth_();if(r){const s=`_${this.manifestType_}_pathway`;t.searchParams.set(s,r)}if(n){const s=`_${this.manifestType_}_throughput`;t.searchParams.set(s,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const t=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=x.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){x.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new ph}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(vt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const I2=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},A2=10;let Oi;const x2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],L2=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},D2=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:a,bufferBasedABR:l,log:u}){if(!r)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const p=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${p} as current playlist is not set`),!0;if(r.id===i.id)return!1;const m=!!Cr(e,t).length;if(!i.endList)return!m&&typeof i.partTargetDuration=="number"?(u(`not ${p} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${p} as current playlist is live`),!0);const _=Tu(e,t),S=l?Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Je.MAX_BUFFER_LOW_WATER_LINE;if(a<S)return u(`${p} as duration < max low water line (${a} < ${S})`),!0;const w=r.attributes.BANDWIDTH,C=i.attributes.BANDWIDTH;if(w<C&&(!l||_<s)){let v=`${p} as next bandwidth < current bandwidth (${w} < ${C})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${_} < ${s})`),u(v),!0}if((!l||w>C)&&_>=n){let v=`${p} as forwardBuffer >= bufferLowWaterLine (${_} >= ${n})`;return l&&(v+=` and next bandwidth > current bandwidth (${w} > ${C})`),u(v),!0}return u(`not ${p} as no switching criteria met`),!1};class P2 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=I2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:n,bandwidth:s,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:p,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:S,leastPixelDiffSelector:w,captionServices:C,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:L}=e;(L===null||typeof L>"u")&&(L=1/0),Oi=a,this.bufferBasedABR=!!S,this.leastPixelDiffSelector=!!w,this.withCredentials=r,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=p,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=k2(),v&&x.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new x.ManagedMediaSource,this.usingManagedMediaSource_=!0,B.log("Using ManagedMediaSource")):x.MediaSource&&(this.mediaSource=new x.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=at(),this.hasPlayed_=!1,this.syncController_=new h2(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new g2,this.sourceUpdater_=new ef(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new p2,this.keyStatusMap_=new Map;const D={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:C,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:s,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new ml(t,this.vhs_,_e(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ir(t,this.vhs_,_e(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new yl(_e(D,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new yl(_e(D,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new o2(_e(D,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,R)=>{function q(){n.off("vttjserror",J),F()}function J(){n.off("vttjsloaded",q),R()}n.one("vttjsloaded",q),n.one("vttjserror",J),n.addWebVttScript_()})}),e);const O=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new C2(this.vhs_.xhr,O),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),x2.forEach(F=>{this[F+"_"]=L2.bind(this,F)}),this.logger_=jt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const n=this.media(),s=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(s&&s!==a){this.logger_(`switch media ${s} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],r=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(r&&n){const s=(r.length?r[0].playlists:r.playlists).filter(a=>a.attributes.serviceLocation===n);s.length&&this.mediaTypes_[e].activePlaylistLoader.media(s[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=x.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(x.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,n=Object.keys(r);let s;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)s=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||n.length&&r[n[0]];for(const u in l)if(l[u].default){s={label:u};break}}if(!s)return t;const a=[];for(const l in r)if(r[l][s.label]){const u=r[l][s.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let p=0;p<e.playlists.length;p++){const m=e.playlists[p];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ul(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),w2({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ul(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(Ge({},t))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let n=!0;const s=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Oi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),s.length&&Object.keys(r.AUDIO[s[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),n=this.bufferLowWaterLine(),s=this.bufferHighWaterLine(),a=this.tech_.buffered();return D2({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:s,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const r=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:A2}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,r=>{this.player_.trigger(Ge({},r))}),this.audioSegmentLoader_.on(t,r=>{this.player_.trigger(Ge({},r))}),this.subtitleSegmentLoader_.on(t,r=>{this.player_.trigger(Ge({},r))})})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const r=t.end(0);let n=r;if(e.start){const s=e.start.timeOffset;s<0?n=Math.max(r+s,t.start(0)):n=Math.min(r,s)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const r=Oi.Playlist.playlistEnd(e,t),n=this.tech_.currentTime(),s=this.tech_.buffered();if(!s.length)return r-n<=si;const a=s.end(s.length-1);return a-n<=si&&r-a<=si}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,s=n.filter(Ka),a=s.length===1&&s[0]===e;if(n.length===1&&r!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const C=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(C),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(C)},v);return}let w=!1;n.forEach(C=>{if(C===e)return;const v=C.excludeUntil;typeof v<"u"&&v!==1/0&&(w=!0,delete C.excludeUntil)}),w&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const p=t.internal?this.logger_:B.log.warn,m=t.message?" "+t.message:"";p(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=u.targetDuration/2*1e3||5*1e3,S=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=_;return this.switchMedia_(u,"exclude",a||S)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],n=e==="all";(n||e==="main")&&r.push(this.mainPlaylistLoader_);const s=[];(n||e==="audio")&&s.push("AUDIO"),(n||e==="subtitle")&&(s.push("CLOSED-CAPTIONS"),s.push("SUBTITLES")),s.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&r.push(l)}),r.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=Cr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Oi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,u=n.end;if(!isFinite(l)||!isFinite(u))return null;const p=Oi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),m=Math.max(0,u-p);return m<l?null:at([[l,m]])}const s=this.syncController_.getExpiredTime(r,this.duration());if(s===null)return null;const a=Oi.Playlist.seekable(r,s,Oi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),n=e.end(0),s=t.start(0),a=t.end(0);return s>n||r>a?e:at([[Math.max(r,s),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${mg(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let r=Oi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const r in t)t[r].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=jn(this.main(),t),n={},s=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=r.video||e.main.videoCodec||ST),e.main.isMuxed&&(n.video+=`,${r.audio||e.main.audioCodec||ld}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||s)&&(n.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||ld,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(p,m)=>p?On(m,this.usingManagedMediaSource_):Co(m),l={};let u;if(["video","audio"].forEach(function(p){if(n.hasOwnProperty(p)&&!a(e[p].isFmp4,n[p])){const m=e[p].isFmp4?"browser":"muxer";l[m]=l[m]||[],l[m].push(n[p]),p==="audio"&&(u=m)}}),s&&u&&t.attributes.AUDIO){const p=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===p&&m!==t&&(m.excludeUntil=1/0)}),this.logger_(`excluding audio group ${p} as ${u} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const p=Object.keys(l).reduce((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${l[_].join(",")}"`,m),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:p},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const p=[];if(["video","audio"].forEach(m=>{const _=(ei(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,S=(ei(n[m]||"")[0]||{}).type;_&&S&&_.toLowerCase()!==S.toLowerCase()&&p.push(`"${this.sourceUpdater_.codecs[m]}" -> "${n[m]}"`)}),p.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${p.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const n=e[r];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const s=jn(this.main,n),a=[];s.audio&&!Co(s.audio)&&!On(s.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${s.audio}`),s.video&&!Co(s.video)&&!On(s.video,this.usingManagedMediaSource_)&&a.push(`video codec ${s.video}`),s.text&&s.text==="stpp.ttml.im1t"&&a.push(`text codec ${s.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,n=_a(ei(e)),s=eh(n),a=n.video&&ei(n.video)[0]||null,l=n.audio&&ei(n.audio)[0]||null;Object.keys(r).forEach(u=>{const p=r[u];if(t.indexOf(p.id)!==-1||p.excludeUntil===1/0)return;t.push(p.id);const m=[],_=jn(this.mainPlaylistLoader_.main,p),S=eh(_);if(!(!_.audio&&!_.video)){if(S!==s&&m.push(`codec count "${S}" !== "${s}"`),!this.sourceUpdater_.canChangeType()){const w=_.video&&ei(_.video)[0]||null,C=_.audio&&ei(_.audio)[0]||null;w&&a&&w.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${w.type}" !== "${a.type}"`),C&&l&&C.type.toLowerCase()!==l.type.toLowerCase()&&m.push(`audio codec "${C.type}" !== "${l.type}"`)}m.length&&(p.excludeUntil=1/0,this.logger_(`excluding ${p.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),u2(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Je.GOAL_BUFFER_LENGTH,r=Je.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Je.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Je.BUFFER_LOW_WATER_LINE,r=Je.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Je.MAX_BUFFER_LOW_WATER_LINE),s=Math.max(t,Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?s:n)}bufferHighWaterLine(){return Je.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){rh(this.inbandTextTracks_,"com.apple.streaming",this.tech_),qw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();rh(this.inbandTextTracks_,e,this.tech_),Fw({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(Ge({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),r=[];for(const n of e.playlists){const s=n.attributes.serviceLocation;if(s&&(r.push(s),!t.has(s)))return!0}return!!(!r.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,r=new Set;let n=!1;Object.keys(t).forEach(s=>{const a=t[s],l=this.pathwayAttribute_(a),u=l&&e!==l;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!u&&(delete a.excludeUntil,delete a.lastExcludeReason_,n=!0);const p=!a.excludeUntil&&a.excludeUntil!==1/0;!r.has(a.id)&&u&&p&&(r.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(s=>{const a=this.mediaTypes_[s];if(a.activePlaylistLoader){const l=a.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||r&&r.size){for(const[n,s]of t.entries())r.get(n)||(this.mainPlaylistLoader_.updateOrDeleteClone(s),this.contentSteeringController_.excludePathway(n));for(const[n,s]of r.entries()){const a=t.get(n);if(!a){e.filter(l=>l.attributes["PATHWAY-ID"]===s["BASE-ID"]).forEach(l=>{this.mainPlaylistLoader_.addClonePathway(s,l)}),this.contentSteeringController_.addAvailablePathway(n);continue}this.equalPathwayClones_(a,s)||(this.mainPlaylistLoader_.updateOrDeleteClone(s,!0),this.contentSteeringController_.addAvailablePathway(n))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const r=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const s in r)if(r[s]!==n[s])return!1;for(const s in n)if(r[s]!==n[s])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=this.mainPlaylistLoader_.getKeyIdSet(r);!n||!n.size||n.forEach(s=>{const a="usable",l=this.keyStatusMap_.has(s)&&this.keyStatusMap_.get(s)===a,u=r.lastExcludeReason_===t&&r.excludeUntil===1/0;l?l&&u&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${s} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==t&&(r.excludeUntil=1/0,r.lastExcludeReason_=t,this.logger_(`excluding playlist ${r.id} because the key ID ${s} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const n=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,s=r.excludeUntil===1/0&&r.lastExcludeReason_===t;n&&s&&(delete r.excludeUntil,B.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:s2(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const R2=(i,e,t)=>r=>{const n=i.main.playlists[e],s=Eu(n),a=Ka(n);if(typeof r>"u")return a;r?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return r!==a&&!s&&(r?(t(n),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class N2{constructor(e,t,r){const{playlistController_:n}=e,s=n.fastQualityChange_.bind(n);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=jn(n.main(),t),this.playlist=t,this.id=r,this.enabled=R2(e.playlists,t.id,s)}}const O2=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=ss(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Eu(r)).map((r,n)=>new N2(i,r,r.id)):[]}},mh=["seeking","seeked","pause","playing","error"];class U2 extends B.EventTarget{constructor(e){super(),this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=jt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),s=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(m=>{u[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",u[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",u[m].reset),this.tech_.on(["seeked","seeking"],u[m].reset)});const p=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),p("off"))},this.clearSeekingAppendCheck_=()=>p("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),p("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(mh,s),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(mh,s),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(m=>{a[`${m}SegmentLoader_`].off("appendsdone",u[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",u[m].reset),this.tech_.off(["seeked","seeking"],u[m].reset)}),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&x.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=x.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],n=r.buffered_(),s=vE(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,s){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:tr(n)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+si>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(at([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime(),r=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const w=e.start(0);n=w+(w===e.end(0)?0:si)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${mg(e)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const s=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),l=s.audioBuffer?s.audioBuffered():null,u=s.videoBuffer?s.videoBuffered():null,p=this.media(),m=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-ni)*2,_=[l,u];for(let w=0;w<_.length;w++)if(_[w]&&Tu(_[w],t)<m)return!1;const S=Fs(a,t);return S.length===0?!1:(n=S.start(0)+si,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${t}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Cr(t,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const s=Fs(n,t);return s.length>0?(this.logger_(`Stopped at ${t} and seeking to ${s.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,n=!1){if(!e.length)return!1;let s=e.end(e.length-1)+si;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||n)&&(s=e.end(e.length-1)+r.targetDuration*3),t>s}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:r}){if(!e)return;let n;if(e.length&&t.length){const s=Cr(e,r-3),a=Cr(e,r),l=Cr(t,r);l.length&&!a.length&&s.length&&(n={start:s.end(0),end:l.end(0)})}else Fs(e,r).length||(n=this.gapFromVideoUnderflow_(e,r));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),n=Fs(t,r);if(this.resetTimeUpdate_(),n.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+ni);const s={gapInfo:{from:r,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:s}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=yE(e);for(let n=0;n<r.length;n++){const s=r.start(n),a=r.end(n);if(t-s<4&&t-s>2)return{start:s,end:a}}return null}}const M2={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},sf=function(i,e){let t=0,r=0;const n=_e(M2,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const s=function(){r&&i.currentTime(r)},a=function(m){m!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",s),i.src(m),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){B.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(i,a)},u=function(){i.off("loadedmetadata",s),i.off("error",l),i.off("dispose",u)},p=function(m){u(),sf(i,m)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=p},B2=function(i){sf(this,i)};var af="3.16.2",F2="7.1.0",j2="1.3.1",$2="7.2.0",q2="4.0.2";const Be={PlaylistLoader:Ir,Playlist:Tt,utils:HE,STANDARD_PLAYLIST_SELECTOR:ih,INITIAL_PLAYLIST_SELECTOR:Nw,lastBandwidthSelector:ih,movingAverageBandwidthSelector:Pw,comparePlaylistBandwidth:Cu,comparePlaylistResolution:Dw,xhr:Dg()};Object.keys(Je).forEach(i=>{Object.defineProperty(Be,i,{get(){return B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Je[i]},set(e){if(B.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Je[i]=e}})});const of="videojs-vhs",lf=function(i,e){const t=e.media();let r=-1;for(let n=0;n<i.length;n++)if(i[n].id===t.id){r=n;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},V2=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),lf(i,e.playlists)};Be.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const H2=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=_a(ei(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const n=Fr(r.video),s=Fr(r.audio),a={};for(const l in i)a[l]={},s&&(a[l].audioContentType=s),n&&(a[l].videoContentType=n),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof i[l]=="string"&&(a[l].url=i[l]);return _e(i,a)},z2=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const n=e.reduce((s,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(s[a]={pssh:l.pssh}),s},{});return Object.keys(n).length&&t.push(n),t},[]),W2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=z2(n,Object.keys(e)),a=[],l=[];return s.forEach(u=>{l.push(new Promise((p,m)=>{i.tech_.one("keysessioncreated",p)})),a.push(new Promise((p,m)=>{i.eme.initializeMediaKeys({keySystems:u},_=>{if(_){m(_);return}p()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},G2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=H2(e,t,r);return n?(i.currentSource().keySystems=n,n&&!i.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},uf=()=>{if(!x.localStorage)return null;const i=x.localStorage.getItem(of);if(!i)return null;try{return JSON.parse(i)}catch{return null}},X2=i=>{if(!x.localStorage)return!1;let e=uf();e=e?_e(e,i):i;try{x.localStorage.setItem(of,JSON.stringify(e))}catch{return!1}return e},K2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,cf=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},df=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},hf=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},pf=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};Be.supportsNativeHls=function(){if(!X||!X.createElement)return!1;const i=X.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(i.canPlayType(e))}):!1}();Be.supportsNativeDash=function(){return!X||!X.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(X.createElement("video").canPlayType("application/dash+xml"))}();Be.supportsTypeNatively=i=>i==="hls"?Be.supportsNativeHls:i==="dash"?Be.supportsNativeDash:!1;Be.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Be.xhr.onRequest=function(i){cf(Be.xhr,i)};Be.xhr.onResponse=function(i){df(Be.xhr,i)};Be.xhr.offRequest=function(i){hf(Be.xhr,i)};Be.xhr.offResponse=function(i){pf(Be.xhr,i)};const Y2=B.getComponent("Component");class mf extends Y2{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=jt("VhsHandler"),t.options_&&t.options_.playerId){const n=B.getPlayer(t.options_.playerId);this.player_=n}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(X,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const s=X.fullscreenElement||X.webkitFullscreenElement||X.mozFullScreenElement||X.msFullscreenElement;s&&s.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=_e(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const r=uf();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Je.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Je.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=K2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Be,this.options_.sourceType=Rp(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new P2(this.options_);const r=_e({liveRangeSafeTimeDelta:si},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new U2(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const s=B.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),s.error(a)});const n=this.options_.bufferBasedABR?Be.movingAverageBandwidthSelector(.55):Be.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Be.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(s){this.playlistController_.selectPlaylist=s.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(s){this.playlistController_.mainSegmentLoader_.throughput.rate=s,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let s=this.playlistController_.mainSegmentLoader_.bandwidth;const a=x.navigator.connection||x.navigator.mozConnection||x.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&s>=l?s=Math.max(s,u):s=u}return s},set(s){this.playlistController_.mainSegmentLoader_.bandwidth=s,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const s=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(s+a))},set(){B.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>tr(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>tr(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&X2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{O2(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=x.URL.createObjectURL(this.playlistController_.mediaSource),(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),W2({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=G2({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{V2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{lf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":af,"mux.js":F2,"mpd-parser":j2,"m3u8-parser":$2,"aes-decrypter":q2}}version(){return this.constructor.version()}canChangeType(){return ef.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&x.URL.revokeObjectURL&&(x.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return QE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return Ug({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{cf(this.xhr,e)},this.xhr.onResponse=e=>{df(this.xhr,e)},this.xhr.offRequest=e=>{hf(this.xhr,e)},this.xhr.offResponse=e=>{pf(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,n=>{this.player_.trigger(Ge({},n))})}),t.forEach(r=>{this.playbackWatcher_.on(r,n=>{this.player_.trigger(Ge({},n))})})}}const Ta={name:"videojs-http-streaming",VERSION:af,canHandleSource(i,e={}){const t=_e(B.options,e);return!t.vhs.experimentalUseMMS&&!On("avc1.4d400d,mp4a.40.2",!1)?!1:Ta.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=_e(B.options,t);return e.vhs=new mf(i,e,r),e.vhs.xhr=Dg(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=Rp(i);if(!t)return"";const r=Ta.getOverrideNative(e);return!Be.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:r=t}=e;return r}},Q2=()=>On("avc1.4d400d,mp4a.40.2",!0);Q2()&&B.getTech("Html5").registerSourceHandler(Ta,0);B.VhsHandler=mf;B.VhsSourceHandler=Ta;B.Vhs=Be;B.use||B.registerComponent("Vhs",Be);B.options.vhs=B.options.vhs||{};(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",B2);const J2=i=>{const e=Me.useRef();return Me.useEffect(()=>{if(!e.current&&i.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),i.current.appendChild(t),e.current=B(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},gf={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:i=>{},playMuted:!1,muted:!1,autoplay:!0},Ne=G.i(gf),gh=i=>{if(!i)return 0;const e=i.duration(),t=i.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},Z2=(i,e)=>{const t=Ib(i,e),r=J2(i),n=Me.useRef(),s=Me.useCallback(()=>{var p,m;const{adPosition:_,adCount:S}=Ne.get();if(r.current){if(_<S){const w=_+1,{ads:C,muted:v,autoplay:L}=t.get(),D=C[w-1];if(D){(p=n.current)==null||p.complete(),n.current=new _b(null,D.ad,D.creative),n.current.on("clickthrough",O=>{window.open(O,"_blank")}),Ne.setKey("adPosition",w),Ne.setKey("playMuted",v),Ne.setKey("skipDelay",D.creative.skipDelay||0),Ne.setKey("time",0),Ne.setKey("adAction",O=>{n.current&&n.current.click(null,{CLICKPOS:[O.clientX,O.clientY]})}),Ne.setKey("whyThisAd",D.creative.icons.find(O=>O.program==="GoogleWhyThisAd")||null),Ne.setKey("hasAdUrl",!!((m=D.creative.videoClickThroughURLTemplate)!=null&&m.url)),r.current.src(D.mediaFileUrl),Ne.setKey("playing",!0),_===0?(Ne.setKey("muted",v),Ne.setKey("autoplay",L),v&&r.current.muted(!0),L?r.current.play():(r.current.pause(),Ne.setKey("paused",!0))):r.current.play();return}}Ne.set(gf),r.current.pause(),r.current.src(void 0)}},[r,t]),a=Me.useCallback(()=>{if(!r.current)return;const p=r.current.muted();r.current.muted(!p),Ne.setKey("muted",!p),n.current&&n.current.setMuted(!p)},[r]),l=Me.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),n.current&&n.current.setPaused(!1)):(r.current.pause(),n.current&&n.current.setPaused(!0)))},[r]),u=Me.useCallback(()=>{r.current&&(n.current&&n.current.skip(),s())},[s,r]);return Me.useEffect(()=>{r.current&&(r.current.on("play",p=>{Ne.setKey("playing",!0),Ne.setKey("paused",!1),Ne.setKey("time",gh(p.target.player))}),r.current.on("ended",()=>{s()}),r.current.on("muted",p=>{console.log("muted",p),Ne.setKey("muted",p.target.player.muted())}),r.current.on("pause",()=>{Ne.setKey("paused",!0)}),r.current.on("click",function(p){p.target.tagName==="VIDEO"&&(Ne.get().autoplay||l())}),r.current.on("timeupdate",p=>{Ne.setKey("time",gh(p.target.player)),n.current&&n.current.setProgress(p.target.player.currentTime())}))},[l,s,r]),Me.useEffect(()=>t.subscribe(p=>{p&&(Ne.setKey("adCount",p.ads.length),Ne.setKey("adPosition",0),s())}),[t,r,s]),[Ne,a,l,u,n]},ek=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:n})=>{var s,a,l,u,p;const m=Me.useRef(null),[_,S,w,C]=Z2(m,r==null?void 0:r.url),{time:v,adCount:L,adPosition:D,skipDelay:O,playing:U,paused:F,reset:R,muted:q,playMuted:J,autoplay:Y,whyThisAd:ie,hasAdUrl:me,adAction:oe}=G.useStore(_),ge=((s=i.sponsor)==null?void 0:s.logo)&&i.logoMode===ce.PromotionLogoMode.CENTER;return W.jsxs(kh,{className:"PromoOverlay",children:[W.jsxs(Ch,{children:[W.jsx(Ih,{className:G.cx_default(!ge&&Ah),children:W.jsx(Lh,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(eb,{children:[W.jsx(z0,{time:v,adCount:L,adPosition:D}),!!O&&U&&W.jsx(G.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{C()},duration:O,isPlaying:!F,skipIcon:!0}),n&&W.jsx(G.y$1,{className:"ClosePromoIcon",close:()=>{R(),e==null||e()}})]})]}),W.jsx(xh,{className:G.cx_default(Tc,U&&Sc,!U&&Ec),children:W.jsxs(Z0,{ref:m,children:[ie&&W.jsx(G0,{whyThisAd:ie}),W.jsxs(X0,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[J&&W.jsx(Y0,{className:G.cx_default(!q&&"muted"),onClick:()=>S()}),F&&!Y&&W.jsx(J0,{onClick:()=>w()})]})]})}),me&&W.jsx(Dh,{className:G.cx_default(Tc,U&&Sc,!U&&Ec),children:W.jsx(Ph,{as:"button",onClick:oe,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((p=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:p.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},fh=i=>{var e,t,r,n,s,a,l,u,p,m,_,S,w,C,v,L,D,O,U,F,R,q,J,Y,ie,me,oe,ge,ee,ue;const{promotion:te,open:de,advertisementPaused:be,togglePause:je,controlVideo:Ye,skipAutoClose:ve,promotionId:ye,onClose:kt,markAsViewed:Pt,externalAd:Ae,isEventFired:pe,fireEvent:$e,muted:cr}=i,wi=te.type===ce.PromotionType.INGAME_IAB11_LBAR||te.type===ce.PromotionType.INGAME_IAB11||te.type===ce.PromotionType.INGAME_IAB11_SIDEBAR,ki=((e=te.sponsor)==null?void 0:e.logo)&&te.logoMode===ce.PromotionLogoMode.CENTER,qi=!!((r=(t=te.banner)==null?void 0:t.video)!=null&&r.url),Ct=te.autoPlayVideo===ce.AutoPlayVideo.ENABLED,Ci=te.playVideoMuted===ce.PlayVideoMuted.ENABLED;if(Me.useEffect(()=>{je==null||je(qi||Ct),de==null||de()},[]),Me.useEffect(()=>{ye&&te.type&&Pt&&Pt()},[ye,te.type,Pt]),Me.useEffect(()=>()=>{Ye==null||Ye({muted:!1})},[Ye]),Ae)return W.jsx(ek,{...i,externalAd:Ae});let Kt=(n=te.banner)==null?void 0:n.url;Kt&&Kt.indexOf("http")!==0&&(Kt=`https://${Kt}`);let Vi=!0;return qi&&(!be||!Ct?Vi=!0:Vi=!1),W.jsxs(kh,{className:"PromoOverlay",children:[W.jsxs("div",{children:[W.jsxs(Ch,{children:[W.jsxs(Ih,{className:G.cx_default(!ki&&Ah),children:[((s=te.sponsor)==null?void 0:s.logo)&&te.logoMode===ce.PromotionLogoMode.LEFT&&W.jsx(_c,{className:"PromoSponsorLogo",src:(a=te.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(B0,{style:{paddingLeft:(l=te.sponsor)!=null&&l.logo&&te.logoMode===ce.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=te.sponsor)==null?void 0:u.logo)&&te.logoMode===ce.PromotionLogoMode.LEFT&&W.jsx(N0,{children:(p=te.sponsor)==null?void 0:p.name}),W.jsxs(F0,{className:"SponsorText",children:[W.jsx(Lh,{children:"AD"}),W.jsx(j0,{children:"SPONSORED"})]})]})]}),W.jsx(G.y$1,{className:"ClosePromoIcon",close:kt,autoClose:(m=te.closeTimer)==null?void 0:m.auto,duration:ve?0:(_=te.closeTimer)==null?void 0:_.seconds,isPlaying:Vi})]}),W.jsxs(xh,{children:[ki&&W.jsx(_c,{className:U0,src:(S=te.sponsor)==null?void 0:S.logo,alt:"promo"}),W.jsx(bc,{children:(C=(w=te.banner)==null?void 0:w.video)!=null&&C.url?W.jsx(G.Pe,{source:(L=(v=te.banner)==null?void 0:v.video)==null?void 0:L.url,poster:(O=(D=te.banner)==null?void 0:D.video)==null?void 0:O.thumbnailUrl,aspectRatio:wi?"1/1":"2/1",onRender:()=>{pe!=null&&pe("video-rendered")||(G.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:ye,type:te.type}}),$e==null||$e("video-rendered"))},onQuartile:$t=>{pe!=null&&pe(`video-quartile-${$t}`)||(G.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:ye,type:te.type,quartile:$t}}),$e==null||$e(`video-quartile-${$t}`))},onMute:$t=>{const qt=$t?"muted":"unmuted";pe!=null&&pe(qt)||(G.eventBus.emit("advertisement",{action:$t?"videoMuted":"videoUnmuted",payload:{id:ye,type:te.type}}),$e==null||$e(qt))},onPause:()=>{Ct&&(je==null||je(!0))},onReplay:()=>{pe!=null&&pe("replayed")||(G.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:ye,type:te.type}}),$e==null||$e("replayed"))},onPlay:()=>{pe!=null&&pe("played")||(G.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:ye,type:te.type}}),$e==null||$e("played")),je==null||je(!1),pe!=null&&pe("played")&&pe!=null&&pe("ended")&&!(pe!=null&&pe("replayed"))&&(G.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:ye,type:te.type}}),$e==null||$e("replayed"))},onEnd:()=>{pe!=null&&pe("ended")||(G.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:ye,type:te.type}}),$e==null||$e("ended"))},controlVideo:Ye,autoPlay:Ct,playMuted:Ci,muted:cr}):(U=te.banner)!=null&&U.imageUrl?W.jsx(O0,{style:wi?{aspectRatio:"1/1"}:{},src:(F=te.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!wi&&W.jsxs(bc,{children:[((R=te.banner)==null?void 0:R.title)&&W.jsx($0,{className:G.cx_default("AdvTitle",ki&&q0),children:(q=te.banner)==null?void 0:q.title}),((J=te.banner)==null?void 0:J.body)&&W.jsx(M0,{className:"AdvDescription",children:(Y=te.banner)==null?void 0:Y.body})]})]})]}),te.buttonType===ce.PromotionButtonType.BASIC&&W.jsx(Dh,{children:W.jsx(Ph,{href:Kt,style:{backgroundColor:((me=(ie=te.banner)==null?void 0:ie.ctaButton)==null?void 0:me.color)||"#009dc4",color:((ge=(oe=te.banner)==null?void 0:oe.ctaButton)==null?void 0:ge.textColor)||"#fff"},"data-a":"button","data-promo-id":ye,"data-promo-type":te.type,target:"_blank",children:(ue=(ee=te.banner)==null?void 0:ee.ctaButton)==null?void 0:ue.label})})]})},tk=G.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),ik=({children:i,direction:e,style:t,className:r,hiding:n})=>W.jsx(vl,{direction:e,style:t,hiding:n,className:r,children:W.jsx(tk,{children:i})}),yh=i=>(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB21_LBAR,rk=i=>(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB11_SIDEBAR||(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB21_SIDEBAR,nk=i=>(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===ce.PromotionType.INGAME_IAB21,sk=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:n="side-by-side",sidebar:s,isNotification:a,banner:l,markAsViewed:u,open:p,externalAd:m,controlVideo:_,advertisementPaused:S,togglePause:w,isEventFired:C,fireEvent:v,muted:L})=>i.promotion?a&&i.notification?W.jsx(P0,{open:()=>p==null?void 0:p({fromNotification:!0}),notification:i.notification,promotionId:i.question.id,close:e}):!s&&!l&&(t||nk(i.promotion))?W.jsx(R0,{className:"PromoOverlayContainer",children:W.jsx(fh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:p,skipAutoClose:r,externalAd:m,controlVideo:_,advertisementPaused:S,togglePause:w,isEventFired:C,fireEvent:v,muted:L})}):s&&(t||yh(i.promotion)||rk(i.promotion)||m)?W.jsx(ik,{className:"PromoSidebarContainer",direction:s,hiding:!1,children:W.jsx(fh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:m,onClose:e,open:p,controlVideo:_,skipAutoClose:r,advertisementPaused:S,togglePause:w,isEventFired:C,fireEvent:v,muted:L})}):l&&yh(i.promotion)?W.jsx(vh,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l,isEventFired:C,fireEvent:v}):null:null,_h=G.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),ak=i=>{const e=i.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",r=e.getAttribute("data-promo-type")||ce.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&G.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-a")==="banner"&&G.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},ok=({gamification:i,advertisement:e,layoutMode:t,skipAutoClose:r,skipTypeCheck:n,sidebar:s,banner:a,notification:l,isMobileScreen:u,persistent:p,containerId:m,externalAd:_,controlVideo:S,muted:w})=>{var C,v,L,D,O,U,F,R,q,J,Y,ie,me,oe,ge,ee,ue,te,de,be,je;const Ye=Me.useRef(null),ve=G.useStore(e.$store),ye=G.useStore(i.openedQuestion.$store);G.b(Ye,{enabled:!!ve.data,event:"click",listener:ak});const kt=((L=(v=(C=ve.data)==null?void 0:C.question)==null?void 0:v.backgroundImage)==null?void 0:L.landscapeUrl)||((O=(D=ve.data)==null?void 0:D.promotion)==null?void 0:O.backgroundImageLandscapeUrl),Pt=((R=(F=(U=ve.data)==null?void 0:U.question)==null?void 0:F.backgroundImage)==null?void 0:R.portraitUrl)||((J=(q=ve.data)==null?void 0:q.promotion)==null?void 0:J.backgroundImagePortraitUrl),Ae=G.y$2({containerId:m,landscapeUrl:kt,portraitUrl:Pt});if(((Y=ye==null?void 0:ye.attributes)==null?void 0:Y.adUnit)===ce.AdUnit.STANDART&&(oe=(me=(ie=ye==null?void 0:ye.attributes)==null?void 0:ie.adPromotion)==null?void 0:me.banner)!=null&&oe.imageUrl)return a?W.jsx(_h,{ref:Ye,style:{height:"100%"},className:G.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view"),children:W.jsx(q_,{cardId:ye.id,promotion:{...(ge=ye==null?void 0:ye.attributes)==null?void 0:ge.adPromotion,adUnit:(ee=ye==null?void 0:ye.attributes)==null?void 0:ee.adUnit}})}):null;const pe=!a&&!s;if(ve.data===void 0||!p&&ve.isViewed)return null;const $e=((de=(te=(ue=ve==null?void 0:ve.data)==null?void 0:ue.notification)==null?void 0:te.promotion)==null?void 0:de.mode)===ce.NotificationPromotionMode.LOWER_THIRD;return W.jsxs(_h,{ref:Ye,style:{height:pe?"auto":"100%"},className:G.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",$e&&"SL-AdvertisementUIWrap--lower-third"),children:[!l&&Ae,W.jsx(sk,{skipTypeCheck:n,sidebar:s,banner:a,advertisement:ve.data,advertisementPaused:!!ve.isPaused,togglePause:ve.togglePause,isEventFired:ve.isEventFired,toggleMute:ve.toggleMute,fireEvent:ve.fireEvent,close:ve.close,externalAd:_?ve.externalAd:void 0,markAsViewed:(be=i.advertisement)==null?void 0:be.markAsViewed,open:(je=i.advertisement)==null?void 0:je.open,layoutMode:t,isNotification:l,skipAutoClose:r,controlVideo:S,muted:w})]})},ff=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:n,skipTypeCheck:s,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,muted:m})=>{const _=G.useStore(i.featuresList.getStore()),[S,w]=Me.useState(!t),C=G.useStore(i.options);if(Me.useEffect(()=>{if(t){const L=document.createElement("script");L.async=!0,L.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(L),L.onload=()=>{w(!0)}}},[t]),e&&r)return W.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return W.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!_)return null;const v=i.getFeature(ce.SdkOverlayType.GAMES);return!v||t&&!S?null:W.jsx(ok,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,skipTypeCheck:s,skipAutoClose:n,externalAd:t,controlVideo:i.controlVideoPlayer,containerId:C.containerId,muted:m})},lk=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:n,persistent:s,theme:a,notification:l,skipTypeCheck:u,externalAd:p,muted:m=!1})=>{const _=G.useStreamLayer(),S=G.useStreamLayerUI(),w=G.useStreamLayerTheme();return _?p&&!S.promotionExternalAd?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):!p&&S.promotionExternalAd?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):e&&!S.promotionSidebar?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):t&&!S.promotionBanner?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):l&&!S.promotionNotification?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):!t&&!e&&!l&&!S.promotionOverlay&&!u?i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i}):W.jsxs("div",{className:"StreamLayerSDK",children:[W.jsx(G.h,{customTheme:a??w.theme,themeMode:w.themeMode,children:W.jsx(ff,{sdk:_,sidebar:e,banner:t,isMobileScreen:r,persistent:s,notification:l,skipTypeCheck:u,skipAutoClose:n,layoutMode:"side-by-side",externalAd:p,muted:m})}),i!==void 0&&W.jsx(G.StreamLayerSDKEvent,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=lk;exports.StreamLayerSDKAdvertisementUI=ff;
|