@streamlayer/react 1.14.0 → 1.14.2
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/cjs/advertisement.js +45 -45
- package/lib/cjs/bet-pack.js +1 -1
- package/lib/cjs/index2.js +5 -5
- 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 +13 -13
- package/lib/cjs/useStreamLayerApp2.js +7 -7
- package/lib/classic/cjs/advertisement.js +45 -45
- package/lib/classic/cjs/bet-pack.js +1 -1
- package/lib/classic/cjs/index2.js +5 -5
- package/lib/classic/cjs/masters2.js +3 -3
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/provider.js +13 -13
- package/lib/classic/cjs/useStreamLayerApp2.js +7 -7
- package/lib/classic/es/advertisement.js +37744 -39730
- package/lib/classic/es/bet-pack.js +1 -1
- package/lib/classic/es/index.js +1 -1
- package/lib/classic/es/index2.js +1023 -1014
- package/lib/classic/es/masters2.js +281 -287
- package/lib/classic/es/notification.js +40 -40
- package/lib/classic/es/points.js +5 -5
- package/lib/classic/es/provider.js +2406 -2387
- package/lib/classic/es/useStreamLayerApp2.js +1579 -1568
- package/lib/classic/style.css +1 -1
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +30 -30
- package/lib/dist/es/gamification-feature2.js +1 -1
- package/lib/dist/es/masters.js +5961 -5929
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +37744 -39730
- package/lib/es/bet-pack.js +1 -1
- package/lib/es/index.js +1 -1
- package/lib/es/index2.js +1023 -1014
- package/lib/es/masters2.js +281 -287
- package/lib/es/notification.js +40 -40
- package/lib/es/points.js +5 -5
- package/lib/es/provider.js +2404 -2385
- package/lib/es/useStreamLayerApp2.js +1579 -1568
- 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 X=require("react/jsx-runtime"),Ye=require("react"),Z=require("./provider.js"),ge=require("./useStreamLayerApp2.js"),kv=/^(?:[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 dp(s){return typeof s=="string"&&kv.test(s)}function eu(s){if(!dp(s))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(s.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(s.slice(9,13),16))>>>8,e&255,(e=parseInt(s.slice(14,18),16))>>>8,e&255,(e=parseInt(s.slice(19,23),16))>>>8,e&255,(e=parseInt(s.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function Cv(s){s=unescape(encodeURIComponent(s));const e=new Uint8Array(s.length);for(let t=0;t<s.length;++t)e[t]=s.charCodeAt(t);return e}const Iv="6ba7b810-9dad-11d1-80b4-00c04fd430c8",xv="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Lv(s,e,t,n,r,i){const a=typeof t=="string"?Cv(t):t,o=typeof n=="string"?eu(n):n;if(typeof n=="string"&&(n=eu(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(o),c.set(a,o.length),c=e(c),c[6]=c[6]&15|s,c[8]=c[8]&63|128,r){i=i||0;for(let h=0;h<16;++h)r[i+h]=c[h];return r}return ge.unsafeStringify(c)}function Pv(s,e,t,n){switch(s){case 0:return e&t^~e&n;case 1:return e^t^n;case 2:return e&t^e&n^t&n;case 3:return e^t^n}}function Xo(s,e){return s<<e|s>>>32-e}function Rv(s){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(s.length+1);n.set(s),n[s.length]=128,s=n;const r=s.length/4+2,i=Math.ceil(r/16),a=new Array(i);for(let o=0;o<i;++o){const c=new Uint32Array(16);for(let h=0;h<16;++h)c[h]=s[o*64+h*4]<<24|s[o*64+h*4+1]<<16|s[o*64+h*4+2]<<8|s[o*64+h*4+3];a[o]=c}a[i-1][14]=(s.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(s.length-1)*8&4294967295;for(let o=0;o<i;++o){const c=new Uint32Array(80);for(let w=0;w<16;++w)c[w]=a[o][w];for(let w=16;w<80;++w)c[w]=Xo(c[w-3]^c[w-8]^c[w-14]^c[w-16],1);let h=t[0],m=t[1],_=t[2],T=t[3],S=t[4];for(let w=0;w<80;++w){const b=Math.floor(w/20),R=Xo(h,5)+Pv(b,m,_,T)+S+e[b]+c[w]>>>0;S=T,T=_,_=Xo(m,30)>>>0,m=h,h=R}t[0]=t[0]+h>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+_>>>0,t[3]=t[3]+T>>>0,t[4]=t[4]+S>>>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 ba(s,e,t,n){return Lv(80,Rv,s,e,t,n)}ba.DNS=Iv;ba.URL=xv;const Dv=Z.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Nv="a1rlj479",Ov="s35f1di",Mv="sj4471g",Uv="b12050d8",Bv="b1d5ybek",Fv=s=>s==="left"||s==="right"?Ov:Uv,jv=s=>s==="left"||s==="right"?Mv:Bv,qv=s=>s==="left"?"avdxyl3":s==="right"?"a1bisd08":s==="top"?"a1u9y2aj":"a1qqaks",rc=({children:s,style:e,className:t,enabled:n=!0,hiding:r,direction:i="left",onAnimationEnd:a})=>X.jsx(Dv,{style:e,className:Z.cx_default(t,Nv,qv(i),n&&!r&&Fv(i),n&&r&&jv(i)),onAnimationEnd:a,children:s}),Vv=Z.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),$v=Z.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Hv=()=>Vv,Wv=Z.styled_default(Hv())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),zv=({promotion:s,promotionId:e,hiding:t,direction:n="bottom"})=>{var r,i;if(!((r=s.additionalBanner)!=null&&r.imageUrl))return null;let a=(i=s.additionalBanner)==null?void 0:i.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),X.jsx(rc,{direction:n,hiding:t,children:X.jsx($v,{className:"BannerContainer",children:X.jsx(Wv,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${s.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":s.type,"data-analytics":"banner",target:"_blank"})})})},Gv=Z.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Xv=Z.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Yv=Z.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Kv=Z.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),ic=Z.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Qv=()=>ic,Zv=Z.styled_default(Qv())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),Jv=Z.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),eb=Z.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),tb=Z.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),sb=Z.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),nb=Z.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),rb=Z.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),ib={[ge.NotificationPromotionImagePosition.BOTTOM]:ic,[ge.NotificationPromotionImagePosition.MIDDLE]:Zv},ab=({src:s,imagePosition:e})=>{const t=ib[e]||ic;return X.jsx(t,{children:X.jsx("img",{src:s,alt:""})})},ob=({notification:s,open:e})=>{if(!s||!s.promotion||s.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:n,image:r,promotion:i}=s,{sponsorLogo:a,sponsorLogoMode:o,imagePosition:c,ctaButton:h}=i;return X.jsxs(rb,{className:"SL_Lower_Third_Notification",onClick:e,children:[X.jsxs(Gv,{children:[X.jsx(ab,{src:r,imagePosition:c}),X.jsxs(Xv,{children:[t&&X.jsx(Yv,{children:t}),n&&X.jsx(Kv,{children:n})]})]}),X.jsxs(sb,{children:[o!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&X.jsxs(X.Fragment,{children:[X.jsx(tb,{children:X.jsx("img",{src:a,alt:t})}),X.jsx(nb,{})]}),X.jsxs(eb,{name:"promo-button",style:{color:h==null?void 0:h.textColor,backgroundColor:h==null?void 0:h.color},children:[(h==null?void 0:h.ctaIcon)&&(h==null?void 0:h.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&X.jsx(Jv,{src:h==null?void 0:h.ctaIcon,alt:"cta-icon"}),(h==null?void 0:h.label)||"Open"]})]})]})},lb=Z.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),cb=Z.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),db=Z.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),ub=Z.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),hb=Z.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Ka=Z.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),pb=()=>Ka,tu=Z.styled_default(pb())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),mb=()=>Ka,up=Z.styled_default(mb())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),fb=()=>up,gb=Z.styled_default(fb())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),yb=()=>Ka,_b=Z.styled_default(yb())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),vb=()=>Ka,bb=Z.styled_default(vb())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Tb=Z.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Ab=Z.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),Sb=()=>Z.u1,Eb=Z.styled_default(Sb())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),wb=Z.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),kb={[ge.NotificationPromotionImagePosition.UNSET]:tu,[ge.NotificationPromotionImagePosition.FIT]:tu,[ge.NotificationPromotionImagePosition.CENTERED]:up,[ge.NotificationPromotionImagePosition.BOTTOM]:gb,[ge.NotificationPromotionImagePosition.SOLID]:_b,[ge.NotificationPromotionImagePosition.MIDDLE]:bb},Cb=({src:s,imagePosition:e})=>{const t=kb[e];return X.jsx(t,{children:X.jsx("img",{src:s,alt:""})})},Ib=({notification:s,open:e,promotionId:t,hiding:n,direction:r="left"})=>{if(!s||!s.promotion||s.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(s.promotion.mode===ge.NotificationPromotionMode.LOWER_THIRD)return X.jsx(ob,{notification:s,open:e});const{title:i,body:a,image:o,promotion:c}=s,{sponsorLogo:h,sponsorLogoMode:m,imagePosition:_,ctaButton:T}=c;return X.jsx(rc,{className:"SL_Rich_Notification",direction:r,hiding:n,children:X.jsxs(cb,{onClick:e,children:[m!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&h&&X.jsx(wb,{children:X.jsx("img",{src:h,alt:i})}),X.jsxs(lb,{children:[X.jsx(Cb,{src:o,imagePosition:_}),X.jsxs(db,{children:[i&&X.jsx(ub,{children:i}),a&&X.jsx(hb,{children:a})]}),X.jsxs(Ab,{name:"promo-button",style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&X.jsx(Tb,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]}),X.jsx(Eb,{name:"chevronRight"})]})]})})},su=globalThis||void 0||self,xb=Z.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),hp=Z.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),pp=Z.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),mp=Z.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),fp="h10toh7",nu=Z.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),Lb=Z.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),gp=Z.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),Pb=Z.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),Rb="s1nmch9k",ru=Z.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),Db=Z.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),Nb=Z.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),Ob=Z.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),yp=Z.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),Mb=Z.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),_p=Z.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),vp=Z.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),Ub=Z.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),Bb="h17rwbtk",Fb=Z.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),iu=Z.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),jb=Z.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),qb=({time:s,adCount:e,adPosition:t})=>{const n=Math.floor(s/60),r=s-n*60;return n===0&&r===0&&e===t?null:X.jsxs(Fb,{children:[e>1&&X.jsxs(X.Fragment,{children:[X.jsxs(iu,{children:[t," of ",e]}),X.jsx(jb,{})]}),X.jsxs(iu,{children:[n,":",r<10?`0${r}`:r]})]})};var bp=s=>{throw TypeError(s)},Tp=(s,e,t)=>e.has(s)||bp("Cannot "+t),Ae=(s,e,t)=>(Tp(s,e,"read from private field"),t?t.call(s):e.get(s)),it=(s,e,t)=>e.has(s)?bp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),Ke=(s,e,t,n)=>(Tp(s,e,"write to private field"),e.set(s,t),t),Ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof su<"u"?su:typeof self<"u"?self:{};function or(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Vb(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function n(){return this instanceof n?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(s).forEach(function(n){var r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return s[n]}})}),t}const Aa=globalThis||void 0||self;var Vr;typeof window<"u"?Vr=window:typeof Ta<"u"?Vr=Ta:typeof self<"u"?Vr=self:Vr={};var Qa=Vr;const I=or(Qa),$b={},Hb=Object.freeze(Object.defineProperty({__proto__:null,default:$b},Symbol.toStringTag,{value:"Module"})),Wb=Vb(Hb);var au=typeof Ta<"u"?Ta:typeof window<"u"?window:{},zb=Wb,$r;typeof document<"u"?$r=document:($r=au["__GLOBAL_DOCUMENT_CACHE@4"],$r||($r=au["__GLOBAL_DOCUMENT_CACHE@4"]=zb));var Ap=$r;const Y=or(Ap);var ac={exports:{}},Sp={exports:{}};(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}return t},s.exports.__esModule=!0,s.exports.default=s.exports,e.apply(null,arguments)}s.exports=e,s.exports.__esModule=!0,s.exports.default=s.exports})(Sp);var Gb=Sp.exports,Xb=Kb,Yb=Object.prototype.toString;function Kb(s){if(!s)return!1;var e=Yb.call(s);return e==="[object Function]"||typeof s=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}function Qb(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t)return(t=t.call(s)).next.bind(t);if(Array.isArray(s)||(t=Zb(s))||e){t&&(s=t);var n=0;return function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zb(s,e){if(s){if(typeof s=="string")return ou(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ou(s,e)}}function ou(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}var Jb=function(){function s(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=s.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,n){this.typeToInterceptorsMap_.has(t)||this.typeToInterceptorsMap_.set(t,new Set);var r=this.typeToInterceptorsMap_.get(t);return r.has(n)?!1:(r.add(n),!0)},e.removeInterceptor=function(t,n){var r=this.typeToInterceptorsMap_.get(t);return r&&r.has(n)?(r.delete(n),!0):!1},e.clearInterceptorsByType=function(t){var n=this.typeToInterceptorsMap_.get(t);return n?(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,n){for(var r=this.getForType(t),i=Qb(r),a;!(a=i()).done;){var o=a.value;try{n=o(n)}catch{}}return n},s}(),e0=Jb,t0=function(){function s(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=s.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 n=t===void 0?{}:t,r=n.maxAttempts,i=n.delayFactor,a=n.fuzzFactor,o=n.initialDelay;return new s0({maxAttempts:r||this.maxAttempts_,delayFactor:i||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:o||this.initialDelay_})},s}(),s0=function(){function s(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=s.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(),n=this.getCurrentMaxPossibleDelay();return t+Math.random()*(n-t)},s}(),n0=t0,r0=Qa,i0=function(s,e){return e===void 0&&(e=!1),function(t,n,r){if(t){s(t);return}if(n.statusCode>=400&&n.statusCode<=599){var i=r;if(e)if(r0.TextDecoder){var a=a0(n.headers&&n.headers["content-type"]);try{i=new TextDecoder(a).decode(r)}catch{}}else i=String.fromCharCode.apply(null,new Uint8Array(r));s({cause:i});return}s(null,r)}};function a0(s){return s===void 0&&(s=""),s.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),r=n[0],i=n[1];return r.trim()==="charset"?i.trim():e},"utf-8")}var o0=i0,Ep=Qa,l0=Gb,c0=Xb,wp=e0,d0=n0;He.httpHandler=o0;He.requestInterceptorsStorage=new wp;He.responseInterceptorsStorage=new wp;He.retryManager=new d0;/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),qe=require("react"),X=require("./provider.js"),ge=require("./useStreamLayerApp2.js"),p_=/^(?:[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 mh(i){return typeof i=="string"&&p_.test(i)}function gc(i){if(!mh(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 g_(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 m_="6ba7b810-9dad-11d1-80b4-00c04fd430c8",f_="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function y_(i,e,t,r,n,s){const a=typeof t=="string"?g_(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 ge.unsafeStringify(u)}function __(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 b_(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,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 y_(80,b_,i,e,t,r)}Hs.DNS=m_;Hs.URL=f_;const v_=X.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),T_="a1rlj479",S_="s35f1di",E_="sj4471g",w_="b12050d8",k_="b1d5ybek",C_=i=>i==="left"||i==="right"?S_:w_,I_=i=>i==="left"||i==="right"?E_:k_,A_=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(v_,{style:e,className:X.cx_default(t,T_,A_(s),r&&!n&&C_(s),r&&n&&I_(s)),onAnimationEnd:a,children:i}),x_=X.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),L_=X.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),D_=()=>x_,P_=X.styled_default(D_())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),R_=({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(L_,{className:"BannerContainer",children:W.jsx(P_,{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-analytics":"banner",target:"_blank"})})})},N_=X.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),O_=X.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),U_=X.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),M_=X.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),vl=X.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),B_=()=>vl,F_=X.styled_default(B_())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),j_=X.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),q_=X.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),$_=X.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),V_=X.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),H_=X.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),z_=X.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),W_={[ge.NotificationPromotionImagePosition.BOTTOM]:vl,[ge.NotificationPromotionImagePosition.MIDDLE]:F_},G_=({src:i,imagePosition:e})=>{const t=W_[e]||vl;return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},X_=({notification:i,open:e})=>{if(!i||!i.promotion||i.enabled!==ge.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(z_,{className:"SL_Lower_Third_Notification",onClick:e,children:[W.jsxs(N_,{children:[W.jsx(G_,{src:n,imagePosition:u}),W.jsxs(O_,{children:[t&&W.jsx(U_,{children:t}),r&&W.jsx(M_,{children:r})]})]}),W.jsxs(V_,{children:[l!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx($_,{children:W.jsx("img",{src:a,alt:t})}),W.jsx(H_,{})]}),W.jsxs(q_,{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)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(j_,{src:p==null?void 0:p.ctaIcon,alt:"cta-icon"}),(p==null?void 0:p.label)||"Open"]})]})]})},K_=X.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Y_=X.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Q_=X.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),J_=X.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Z_=X.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),va=X.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),e0=()=>va,mc=X.styled_default(e0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),t0=()=>va,fh=X.styled_default(t0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),i0=()=>fh,r0=X.styled_default(i0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),n0=()=>va,s0=X.styled_default(n0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),a0=()=>va,o0=X.styled_default(a0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),l0=X.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),u0=X.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),c0=()=>X.k1,d0=X.styled_default(c0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),h0=X.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),p0={[ge.NotificationPromotionImagePosition.UNSET]:mc,[ge.NotificationPromotionImagePosition.FIT]:mc,[ge.NotificationPromotionImagePosition.CENTERED]:fh,[ge.NotificationPromotionImagePosition.BOTTOM]:r0,[ge.NotificationPromotionImagePosition.SOLID]:s0,[ge.NotificationPromotionImagePosition.MIDDLE]:o0},g0=({src:i,imagePosition:e})=>{const t=p0[e];return W.jsx(t,{children:W.jsx("img",{src:i,alt:""})})},m0=({notification:i,open:e,promotionId:t,hiding:r,direction:n="left"})=>{if(!i||!i.promotion||i.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===ge.NotificationPromotionMode.LOWER_THIRD)return W.jsx(X_,{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(Y_,{onClick:e,children:[g!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&p&&W.jsx(h0,{children:W.jsx("img",{src:p,alt:s})}),W.jsxs(K_,{children:[W.jsx(g0,{src:l,imagePosition:b}),W.jsxs(Q_,{children:[s&&W.jsx(J_,{children:s}),a&&W.jsx(Z_,{children:a})]}),W.jsxs(u0,{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)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(l0,{src:S==null?void 0:S.ctaIcon,alt:"cta-icon"}),(S==null?void 0:S.label)||"Open"]}),W.jsx(d0,{name:"chevronRight"})]})]})})},f0=X.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),yh=X.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),_h=X.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),bh=X.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),vh="h10toh7",fc=X.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),y0=X.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Th=X.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),_0=X.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),b0="s1nmch9k",yc=X.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),v0=X.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),T0=X.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),S0=X.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Sh=X.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),E0=X.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Eh=X.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),wh=X.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),w0=X.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),k0="h17rwbtk",C0=X.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),_c=X.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),I0=X.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),A0=({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(C0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(_c,{children:[t," of ",e]}),W.jsx(I0,{})]}),W.jsxs(_c,{children:[r,":",n<10?`0${n}`:n]})]})},x0=X.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),L0=({whyThisAd:i})=>!i.iconClickThroughURLTemplate||!i.staticResource?null:W.jsx(x0,{style:{width:i.width,height:i.height,[i.xPosition]:1,[i.yPosition]:1},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:W.jsx("img",{alt:"GoogleWhyThisAd",src:i.staticResource})}),D0=X.styled_default("button")({name:"MuteIcon",class:"m1xzooj9",propsAsIs:!1}),P0=X.styled_default("button")({name:"PlayIcon",class:"p1bo41vr",propsAsIs:!1}),R0=X.styled_default("div")({name:"Container",class:"c13efyu8",propsAsIs:!1}),N0=X.styled_default("div")({name:"ControlsContainer",class:"cladkgh",propsAsIs:!1}),bc="mjnga56",vc="m7qs1am",Tc="m12n261r",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 O0=["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=Ch(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=xh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const s in e)e[s]=Ah(e[s]);for(const s in n){const a=n[s];typeof a=="string"&&r.push(kh(a,e))}return r}function kh(i,e){const t=(i=wc(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(n=>O0.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 Ch(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(Ih(e[t],i))return!0;return!1}function Ih(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 Ah(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function xh(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:Ch,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:Ih,encodeURIComponentRFC3986:Ah,replaceUrlMacros:kh,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:xh,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 U0(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:U0,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 M0(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 B0(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 F0(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=Lh(t);r&&e.push(r)}),e}function Lh(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=Lh(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 j0(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 q0={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 $0(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:H0(s,e),type:"WRAPPER"};if(s.nodeName==="InLine")return{ad:V0(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 V0(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Dh(i,e)}function Dh(i,e){let t=[];e&&q0.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:j0(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=B0(C,p);break;case"NonLinearAds":v=F0(C,p);break;case"CompanionAds":v=M0(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 H0(i,e){const t=Dh(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 Ph=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 Rh=(i,e)=>{!i||!e||i<=0||e<=0||($o=($o*Rc+8*i/e)/++Rc)},z0={ERRORCODE:900,extensions:[]},Nc="VAST response version not supported";let W0=class extends Ph{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({},z0,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(),Rh(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=$0(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 G0={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 X0{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=G0,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,K0={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(()=>Ub).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 Y0=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||K0,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}),Rh(g==null||(t=g.details)===null||t===void 0?void 0:t.byteLength,b),g.error)throw new Error(g.error);return g.xml}},Q0=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 X0;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new Y0,this.vastParser=new W0({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))})}},J0=class extends Ph{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)}},Z0=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 Nh(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 eb(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=eb(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 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 Z0(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=Nh(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 ib{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=Nh(r,"Extension").map(n=>Sl(n));break}}}}const rb=(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")||ge.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=ge.v4(),sessionStorage.setItem("sl-ad-session-id",u)),mh(l)||(l=Hs(`https://${l}`,Hs.URL)),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.set("givn",p.getNonce()),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}catch(s){console.log("AdsManager could not be started",s);return}}},nb=new Q0,sb=i=>i.creatives.find(e=>e.mediaFiles),ab=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}),ob=(i,e)=>{const[t,r]=qe.useState(),n=qe.useRef(Date.now()),s=qe.useRef(Date.now());return qe.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=rb(i.current,e),l=Date.now();n.current=l,a().then(u=>{n.current===l&&r(u)}).catch(u=>{console.error(u)})},[i,e]),qe.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 ib(D).adBreaks.map(L=>L.adSource.adTagURI.uri)}else p=[l.toString()];const g=await Promise.all(p.map((w,C)=>nb.get(w).then(v=>{if(s.current===u){const D=v.ads.find(U=>U.creatives.length>0);if(!D)return;const L=sb(D),O=ab(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 lb(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 ub(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 Oh=El({HTML:"text/html",isHTML:function(i){return i===Oh.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Uh=El({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===Uh.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=ub;vi.find=lb;vi.freeze=El;vi.MIME_TYPE=Oh;vi.NAMESPACE=Uh;var Mh=vi,ii=Mh.find,Bn=Mh.NAMESPACE;function cb(i){return i!==""}function db(i){return i?i.split(/[\t\n\f\r ]+/).filter(cb):[]}function hb(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Uc(i){if(!i)return[];var e=db(i);return Object.keys(e.reduce(hb,{}))}function pb(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,Bh=Tt.CDATA_SECTION_NODE=4,Fh=Tt.ENTITY_REFERENCE_NODE=5,gb=Tt.ENTITY_NODE=6,jh=Tt.PROCESSING_INSTRUCTION_NODE=7,qh=Tt.COMMENT_NODE=8,$h=Tt.DOCUMENT_NODE=9,Vh=Tt.DOCUMENT_TYPE_NODE=10,fi=Tt.DOCUMENT_FRAGMENT_NODE=11,mb=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 Hh=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(ip(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 zh(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function Bc(i,e,t,r){if(r?e[zh(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var n=i.ownerDocument;n&&(r&&Xh(n,i,r),fb(n,i,t))}}function Fc(i,e,t){var r=zh(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&&(Xh(s,i,t),t.ownerElement=null)}}else throw new $e(Hh,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 Wh(){}Wh.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,Yh),e&&this.removeChild(e)},removeChild:function(i){return Kh(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 Gh(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 fb(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Bn.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Xh(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 Kh(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 yb(i){return i&&(i.nodeType===_e.DOCUMENT_NODE||i.nodeType===_e.DOCUMENT_FRAGMENT_NODE||i.nodeType===_e.ELEMENT_NODE)}function _b(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 bb(i,e,t){if(!yb(i))throw new $e(ft,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new $e(Hh,"child not in parent");if(!_b(e)||yi(e)&&i.nodeType!==_e.DOCUMENT_NODE)throw new $e(ft,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function vb(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 Yh(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){bb(i,e,t),i.nodeType===_e.DOCUMENT_NODE&&(r||vb)(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 Tb(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:$h,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),Kh(this,i)},replaceChild:function(i,e){Gs(this,i,e,Yh),i.ownerDocument=this,e&&this.removeChild(e),ri(i)&&(this.documentElement=i)},importNode:function(i,e){return tp(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(pb(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):Tb(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:qh};vt(Al,Gn);function xl(){}xl.prototype={nodeName:"#cdata-section",nodeType:Bh};vt(xl,Gn);function Ta(){}Ta.prototype.nodeType=Vh;vt(Ta,_e);function Qh(){}Qh.prototype.nodeType=mb;vt(Qh,_e);function Jh(){}Jh.prototype.nodeType=gb;vt(Jh,_e);function Ll(){}Ll.prototype.nodeType=Fh;vt(Ll,_e);function Sa(){}Sa.prototype.nodeName="#document-fragment";Sa.prototype.nodeType=fi;vt(Sa,_e);function Dl(){}Dl.prototype.nodeType=jh;vt(Dl,_e);function Zh(){}Zh.prototype.serializeToString=function(i,e,t){return ep.call(i,e,t)};_e.prototype.toString=ep;function ep(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,Gh),'"')}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 $h: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,Gh));case Bh:return e.push("<![CDATA[",i.data,"]]>");case qh:return e.push("<!--",i.data,"-->");case Vh: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 jh:return e.push("<?",i.target," ",i.data,"?>");case Fh:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function tp(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(tp(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 ip(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}}}),ip=function(e,t,r){e["$$"+t]=r}}}catch{}Mi.DocumentType=Ta;Mi.DOMException=$e;Mi.DOMImplementation=Wh;Mi.Element=rr;Mi.Node=_e;Mi.NodeList=gi;Mi.XMLSerializer=Zh;var Ea={},rp={};(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})(rp);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 np(){}np.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),sp(e,e={}),Sb(i,e,t,r,this.errorHandler),r.endDocument()}};function Sb(i,e,t,r,n){function s(de){if(de>65535){de-=65536;var we=55296+(de>>10),ze=56320+(de&1023);return String.fromCharCode(we,ze)}else return String.fromCharCode(de)}function a(de){var we=de.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:"+de),de)}function l(de){if(de>v){var we=i.substring(v,de).replace(/&#?\w+;/g,a);S&&u(v),r.characters(we,0,de-v),v=de}}function u(de,we){for(;de>=g&&(we=b.exec(i));)p=we.index,g=p+we[0].length,S.lineNumber++;S.columnNumber=de-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=Ib(i,D,r);break;case"!":S&&u(D),le=Cb(i,D,r,n);break;default:S&&u(D);var re=new ap,he=w[w.length-1].currentNSMap,le=Eb(i,D,re,he,a,n),pe=re.length;if(!re.closed&&kb(i,le,re.tagName,C)&&(re.closed=!0,t.nbsp||n.warning("unclosed xml attribute")),S&&pe){for(var ee=zc(S,{}),ce=0;ce<pe;ce++){var ne=re[ce];u(ne.offset),ne.locator=zc(S,{})}r.locator=ee,Wc(re,r,he)&&w.push(re),r.locator=S}else Wc(re,r,he)&&w.push(re);jn.isHTML(re.uri)&&!re.closed?le=wb(i,le,re.tagName,a,r):le++}}catch(de){if(de instanceof Nr)throw de;n.error("element parse error: "+de),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 Eb(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={},sp(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 wb(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 kb(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 sp(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function Cb(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=Ab(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 Ib(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 ap(){this.attributeNames={}}ap.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 Ab(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=np;Pl.ParseError=Nr;var xb=vi,Lb=Mi,Gc=rp,op=Pl,Db=Lb.DOMImplementation,Xc=xb.NAMESPACE,Pb=op.ParseError,Rb=op.XMLReader;function lp(i){return i.replace(/\r[\n\u0085]/g,`
|
|
3
|
+
`).replace(/[\r\u0085\u2028]/g,`
|
|
4
|
+
`)}function up(i){this.options=i||{locator:{}}}up.prototype.parseFromString=function(i,e){var t=this.options,r=new Rb,n=t.domBuilder||new Xn,s=t.errorHandler,a=t.locator,l=t.xmlns||{},u=/\/x?html?$/.test(e),p=u?Gc.HTML_ENTITIES:Gc.XML_ENTITIES;a&&n.setDocumentLocator(a),r.errorHandler=Nb(s,n,a),r.domBuilder=t.domBuilder||n,u&&(l[""]=Xc.HTML),l.xml=l.xml||Xc.XML;var g=t.normalizeLineEndings||lp;return i&&typeof i=="string"?r.parse(g(i),l,p):r.errorHandler.error("invalid doc source"),n.doc};function Nb(i,e,t){if(!i){if(e instanceof Xn)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+Wo(t))}||function(){}}return s("warning"),s("error"),s("fatalError"),r}function Xn(){this.cdata=!1}function mr(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}Xn.prototype={startDocument:function(){this.doc=new Db().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;Rs(this,s),this.currentElement=s,this.locator&&mr(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&&mr(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&&mr(this.locator,t),Rs(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=Kc.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&&mr(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=Kc.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&mr(this.locator,r),Rs(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&&mr(this.locator,n),Rs(this,n),this.doc.doctype=n}},warning:function(i){console.warn("[xmldom warning] "+i,Wo(this.locator))},error:function(i){console.error("[xmldom error] "+i,Wo(this.locator))},fatalError:function(i){throw new Pb(i,this.locator)}};function Wo(i){if(i)return`
|
|
5
|
+
@`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function Kc(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){Xn.prototype[i]=function(){return null}});function Rs(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}Ea.__DOMHandler=Xn;Ea.normalizeLineEndings=lp;Ea.DOMParser=up;var Rl=Ea.DOMParser;const Ob=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Rl},Symbol.toStringTag,{value:"Module"})),Ub=Object.freeze(Object.defineProperty({__proto__:null,D:Rl,i:Ob},Symbol.toStringTag,{value:"Module"}));var Ks=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Sc<"u"?Sc:typeof self<"u"?self:{};function Kn(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}function Mb(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 Ys=globalThis||void 0||self;var wn;typeof window<"u"?wn=window:typeof Ks<"u"?wn=Ks:typeof self<"u"?wn=self:wn={};var wa=wn;const x=Kn(wa),Bb={},Fb=Object.freeze(Object.defineProperty({__proto__:null,default:Bb},Symbol.toStringTag,{value:"Module"})),jb=Mb(Fb);var Yc=typeof Ks<"u"?Ks:typeof window<"u"?window:{},qb=jb,kn;typeof document<"u"?kn=document:(kn=Yc["__GLOBAL_DOCUMENT_CACHE@4"],kn||(kn=Yc["__GLOBAL_DOCUMENT_CACHE@4"]=qb));var cp=kn;const G=Kn(cp);var Nl={exports:{}},dp={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})(dp);var $b=dp.exports,Vb=zb,Hb=Object.prototype.toString;function zb(i){if(!i)return!1;var e=Hb.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 Wb(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=Gb(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 Gb(i,e){if(i){if(typeof i=="string")return Qc(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 Qc(i,e)}}function Qc(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 Xb=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=Wb(n),a;!(a=s()).done;){var l=a.value;try{r=l(r)}catch{}}return r},i}(),Kb=Xb,Yb=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 Qb({maxAttempts:n||this.maxAttempts_,delayFactor:s||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:l||this.initialDelay_})},i}(),Qb=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}(),Jb=Yb,Zb=wa,ev=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(Zb.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 iv=ev,hp=wa,rv=$b,nv=Vb,pp=Kb,sv=Jb;je.httpHandler=iv;je.requestInterceptorsStorage=new pp;je.responseInterceptorsStorage=new pp;je.retryManager=new sv;/**
|
|
3
7
|
* @license
|
|
4
8
|
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
5
9
|
* Copyright (c) 2014 David Björklund
|
|
6
10
|
* Available under the MIT license
|
|
7
11
|
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
8
|
-
*/var
|
|
9
|
-
`).forEach(function(t){var n=t.indexOf(":"),r=t.slice(0,n).trim().toLowerCase(),i=t.slice(n+1).trim();typeof e[r]>"u"?e[r]=i:Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]}),e};ac.exports=He;ac.exports.default=He;He.XMLHttpRequest=Ep.XMLHttpRequest||f0;He.XDomainRequest="withCredentials"in new He.XMLHttpRequest?He.XMLHttpRequest:Ep.XDomainRequest;h0(["get","put","post","patch","head","delete"],function(s){He[s==="delete"?"del":s]=function(e,t,n){return t=kp(e,t,n),t.method=s.toUpperCase(),oc(t)}});function h0(s,e){for(var t=0;t<s.length;t++)e(s[t])}function p0(s){for(var e in s)if(s.hasOwnProperty(e))return!1;return!0}function kp(s,e,t){var n=s;return c0(e)?(t=e,typeof s=="string"&&(n={uri:s})):n=l0({},e,{uri:s}),n.callback=t,n}function He(s,e,t){return e=kp(s,e,t),oc(e)}function oc(s){if(typeof s.callback>"u")throw new Error("callback argument missing");if(s.requestType&&He.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},t=He.requestInterceptorsStorage.execute(s.requestType,e);s.uri=t.uri,s.headers=t.headers,s.body=t.body,s.metadata=t.metadata,s.retry=t.retry,s.timeout=t.timeout}var n=!1,r=function(F,N,j){n||(n=!0,s.callback(F,N,j))};function i(){h.readyState===4&&!He.responseInterceptorsStorage.getIsEnabled()&&setTimeout(c,0)}function a(){var F=void 0;if(h.response?F=h.response:F=h.responseText||m0(h),L)try{F=JSON.parse(F)}catch{}return F}function o(F){if(clearTimeout(U),clearTimeout(s.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!_&&He.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=h,oc(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var N={headers:M.headers||{},body:M.body,responseUrl:h.responseURL,responseType:h.responseType},j=He.responseInterceptorsStorage.execute(s.requestType,N);M.body=j.body,M.headers=j.headers}return r(F,M)}function c(){if(!_){var F;clearTimeout(U),clearTimeout(s.retryTimeout),s.useXDR&&h.status===void 0?F=200:F=h.status===1223?204:h.status;var N=M,j=null;if(F!==0?(N={body:a(),statusCode:F,method:S,headers:{},url:T,rawRequest:h},h.getAllResponseHeaders&&(N.headers=u0(h.getAllResponseHeaders()))):j=new Error("Internal XMLHttpRequest Error"),s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var J={headers:N.headers||{},body:N.body,responseUrl:h.responseURL,responseType:h.responseType},K=He.responseInterceptorsStorage.execute(s.requestType,J);N.body=K.body,N.headers=K.headers}return r(j,N,N.body)}}var h=s.xhr||null;h||(s.cors||s.useXDR?h=new He.XDomainRequest:h=new He.XMLHttpRequest);var m,_,T=h.url=s.uri||s.url,S=h.method=s.method||"GET",w=s.body||s.data,b=h.headers=s.headers||{},R=!!s.sync,L=!1,U,M={body:void 0,headers:{},statusCode:0,method:S,url:T,rawRequest:h};if("json"in s&&s.json!==!1&&(L=!0,b.accept||b.Accept||(b.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(b["content-type"]||b["Content-Type"]||(b["Content-Type"]="application/json"),w=JSON.stringify(s.json===!0?w:s.json))),h.onreadystatechange=i,h.onload=c,h.onerror=o,h.onprogress=function(){},h.onabort=function(){_=!0,clearTimeout(s.retryTimeout)},h.ontimeout=o,h.open(S,T,!R,s.username,s.password),R||(h.withCredentials=!!s.withCredentials),!R&&s.timeout>0&&(U=setTimeout(function(){if(!_){_=!0,h.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",o(F)}},s.timeout)),h.setRequestHeader)for(m in b)b.hasOwnProperty(m)&&h.setRequestHeader(m,b[m]);else if(s.headers&&!p0(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(h.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(h),h.send(w||null),h}function m0(s){try{if(s.responseType==="document")return s.responseXML;var e=s.responseXML&&s.responseXML.documentElement.nodeName==="parsererror";if(s.responseType===""&&!e)return s.responseXML}catch{}return null}function f0(){}var g0=ac.exports;const Cp=or(g0);var Ip={exports:{}},lu=Ap,lc=Object.create||function(){function s(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return s.prototype=e,new s}}();function xt(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}xt.prototype=lc(Error.prototype);xt.prototype.constructor=xt;xt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function cc(s){function e(n,r,i,a){return(n|0)*3600+(r|0)*60+(i|0)+(a|0)/1e3}var t=s.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 Jr(){this.values=lc(null)}Jr.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,t){return t?this.has(s)?this.values[s]:e[t]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,t){for(var n=0;n<t.length;++n)if(e===t[n]){this.set(s,e);break}},integer:function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},percent:function(s,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(s,e),!0):!1}};function Hr(s,e,t,n){var r=n?s.split(n):[s];for(var i in r)if(typeof r[i]=="string"){var a=r[i].split(t);if(a.length===2){var o=a[0].trim(),c=a[1].trim();e(o,c)}}}function y0(s,e,t){var n=s;function r(){var o=cc(s);if(o===null)throw new xt(xt.Errors.BadTimeStamp,"Malformed timestamp: "+n);return s=s.replace(/^[^\sa-zA-Z-]+/,""),o}function i(o,c){var h=new Jr;Hr(o,function(m,_){switch(m){case"region":for(var T=t.length-1;T>=0;T--)if(t[T].id===_){h.set(m,t[T].region);break}break;case"vertical":h.alt(m,_,["rl","lr"]);break;case"line":var S=_.split(","),w=S[0];h.integer(m,w),h.percent(m,w)&&h.set("snapToLines",!1),h.alt(m,w,["auto"]),S.length===2&&h.alt("lineAlign",S[1],["start","center","end"]);break;case"position":S=_.split(","),h.percent(m,S[0]),S.length===2&&h.alt("positionAlign",S[1],["start","center","end"]);break;case"size":h.percent(m,_);break;case"align":h.alt(m,_,["start","center","end","left","right"]);break}},/:/,/\s/),c.region=h.get("region",null),c.vertical=h.get("vertical","");try{c.line=h.get("line","auto")}catch{}c.lineAlign=h.get("lineAlign","start"),c.snapToLines=h.get("snapToLines",!0),c.size=h.get("size",100);try{c.align=h.get("align","center")}catch{c.align=h.get("align","middle")}try{c.position=h.get("position","auto")}catch{c.position=h.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},c.align)}c.positionAlign=h.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},c.align)}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),s.substr(0,3)!=="-->")throw new xt(xt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);s=s.substr(3),a(),e.endTime=r(),a(),i(s,e)}var Yo=lu.createElement&&lu.createElement("textarea"),_0={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},cu={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)"},v0={v:"title",lang:"lang"},du={rt:"ruby"};function xp(s,e){function t(){if(!e)return null;function w(R){return e=e.substr(R.length),R}var b=e.match(/^([^<]*)(<[^>]*>?)?/);return w(b[1]?b[1]:b[2])}function n(w){return Yo.innerHTML=w,w=Yo.textContent,Yo.textContent="",w}function r(w,b){return!du[b.localName]||du[b.localName]===w.localName}function i(w,b){var R=_0[w];if(!R)return null;var L=s.document.createElement(R),U=v0[w];return U&&b&&(L[U]=b.trim()),L}for(var a=s.document.createElement("div"),o=a,c,h=[];(c=t())!==null;){if(c[0]==="<"){if(c[1]==="/"){h.length&&h[h.length-1]===c.substr(2).replace(">","")&&(h.pop(),o=o.parentNode);continue}var m=cc(c.substr(1,c.length-2)),_;if(m){_=s.document.createProcessingInstruction("timestamp",m),o.appendChild(_);continue}var T=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!T||(_=i(T[1],T[3]),!_)||!r(o,_))continue;if(T[2]){var S=T[2].split(".");S.forEach(function(w){var b=/^bg_/.test(w),R=b?w.slice(3):w;if(cu.hasOwnProperty(R)){var L=b?"background-color":"color",U=cu[R];_.style[L]=U}}),_.className=S.join(" ")}h.push(T[1]),o.appendChild(_),o=_;continue}o.appendChild(s.document.createTextNode(n(c)))}return a}var uu=[[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 b0(s){for(var e=0;e<uu.length;e++){var t=uu[e];if(s>=t[0]&&s<=t[1])return!0}return!1}function T0(s){var e=[],t="",n;if(!s||!s.childNodes)return"ltr";function r(o,c){for(var h=c.childNodes.length-1;h>=0;h--)o.push(c.childNodes[h])}function i(o){if(!o||!o.length)return null;var c=o.pop(),h=c.textContent||c.innerText;if(h){var m=h.match(/^.*(\n|\r)/);return m?(o.length=0,m[0]):h}if(c.tagName==="ruby")return i(o);if(c.childNodes)return r(o,c),i(o)}for(r(e,s);t=i(e);)for(var a=0;a<t.length;a++)if(n=t.charCodeAt(a),b0(n))return"rtl";return"ltr"}function A0(s){if(typeof s.line=="number"&&(s.snapToLines||s.line>=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,t=e.textTrackList,n=0,r=0;r<t.length&&t[r]!==e;r++)t[r].mode==="showing"&&n++;return++n*-1}function Za(){}Za.prototype.applyStyles=function(s,e){e=e||this.div;for(var t in s)s.hasOwnProperty(t)&&(e.style[t]=s[t])};Za.prototype.formatStyle=function(s,e){return s===0?0:s+e};function Sa(s,e,t){Za.call(this),this.cue=e,this.cueDiv=xp(s,e.text);var n={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(n,this.cueDiv),this.div=s.document.createElement("div"),n={direction:T0(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(n),this.div.appendChild(this.cueDiv);var r=0;switch(e.positionAlign){case"start":case"line-left":r=e.position;break;case"center":r=e.position-e.size/2;break;case"end":case"line-right":r=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(i){this.applyStyles({top:this.formatStyle(i.top,"px"),bottom:this.formatStyle(i.bottom,"px"),left:this.formatStyle(i.left,"px"),right:this.formatStyle(i.right,"px"),height:this.formatStyle(i.height,"px"),width:this.formatStyle(i.width,"px")})}}Sa.prototype=lc(Za.prototype);Sa.prototype.constructor=Sa;function yt(s){var e,t,n,r;if(s.div){t=s.div.offsetHeight,n=s.div.offsetWidth,r=s.div.offsetTop;var i=(i=s.div.childNodes)&&(i=i[0])&&i.getClientRects&&i.getClientRects();s=s.div.getBoundingClientRect(),e=i?Math.max(i[0]&&i[0].height||0,s.height/i.length):0}this.left=s.left,this.right=s.right,this.top=s.top||r,this.height=s.height||t,this.bottom=s.bottom||r+(s.height||t),this.width=s.width||n,this.lineHeight=e!==void 0?e:s.lineHeight}yt.prototype.move=function(s,e){switch(e=e!==void 0?e:this.lineHeight,s){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}};yt.prototype.overlaps=function(s){return this.left<s.right&&this.right>s.left&&this.top<s.bottom&&this.bottom>s.top};yt.prototype.overlapsAny=function(s){for(var e=0;e<s.length;e++)if(this.overlaps(s[e]))return!0;return!1};yt.prototype.within=function(s){return this.top>=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right};yt.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.left<s.left;case"-x":return this.right>s.right;case"+y":return this.top<s.top;case"-y":return this.bottom>s.bottom}};yt.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),t=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),n=e*t;return n/(this.height*this.width)};yt.prototype.toCSSCompatValues=function(s){return{top:this.top-s.top,bottom:s.bottom-this.bottom,left:this.left-s.left,right:s.right-this.right,height:this.height,width:this.width}};yt.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,t=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,n=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var r={left:s.left,right:s.right,top:s.top||n,height:s.height||e,bottom:s.bottom||n+(s.height||e),width:s.width||t};return r};function S0(s,e,t,n){function r(R,L){for(var U,M=new yt(R),F=1,N=0;N<L.length;N++){for(;R.overlapsOppositeAxis(t,L[N])||R.within(t)&&R.overlapsAny(n);)R.move(L[N]);if(R.within(t))return R;var j=R.intersectPercentage(t);F>j&&(U=new yt(R),F=j),R=new yt(M)}return U||M}var i=new yt(e),a=e.cue,o=A0(a),c=[];if(a.snapToLines){var h;switch(a.vertical){case"":c=["+y","-y"],h="height";break;case"rl":c=["+x","-x"],h="width";break;case"lr":c=["-x","+x"],h="width";break}var m=i.lineHeight,_=m*Math.round(o),T=t[h]+m,S=c[0];Math.abs(_)>T&&(_=_<0?-1:1,_*=Math.ceil(T/m)*m),o<0&&(_+=a.vertical===""?t.height:t.width,c=c.reverse()),i.move(S,_)}else{var w=i.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=w/2;break;case"end":o-=w;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}c=["+y","-x","+x","-y"],i=new yt(e)}var b=r(i,c);e.move(b.toCSSCompatValues(t))}function lr(){}lr.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}};lr.convertCueToDOMTree=function(s,e){return!s||!e?null:xp(s,e)};var E0=.05,w0="sans-serif",k0="1.5%";lr.processCues=function(s,e,t){if(!s||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var n=s.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=k0,t.appendChild(n);function r(m){for(var _=0;_<m.length;_++)if(m[_].hasBeenReset||!m[_].displayState)return!0;return!1}if(!r(e)){for(var i=0;i<e.length;i++)n.appendChild(e[i].displayState);return}var a=[],o=yt.getSimpleBoxPosition(n),c=Math.round(o.height*E0*100)/100,h={font:c+"px "+w0};(function(){for(var m,_,T=0;T<e.length;T++)_=e[T],m=new Sa(s,_,h),n.appendChild(m.div),S0(s,m,o,a),_.displayState=m.div,a.push(yt.getSimpleBoxPosition(m))})()};lr.Parser=function(s,e,t){t||(t=e,e={}),e||(e={}),this.window=s,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};lr.Parser.prototype={reportOrThrowError:function(s){if(s instanceof xt)this.onparsingerror&&this.onparsingerror(s);else throw s},parse:function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function t(){for(var m=e.buffer,_=0;_<m.length&&m[_]!=="\r"&&m[_]!==`
|
|
10
|
-
`;)++
|
|
11
|
-
`&&++
|
|
12
|
+
*/var av=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};Nl.exports=je;Nl.exports.default=je;je.XMLHttpRequest=hp.XMLHttpRequest||cv;je.XDomainRequest="withCredentials"in new je.XMLHttpRequest?je.XMLHttpRequest:hp.XDomainRequest;ov(["get","put","post","patch","head","delete"],function(i){je[i==="delete"?"del":i]=function(e,t,r){return t=gp(e,t,r),t.method=i.toUpperCase(),Ol(t)}});function ov(i,e){for(var t=0;t<i.length;t++)e(i[t])}function lv(i){for(var e in i)if(i.hasOwnProperty(e))return!1;return!0}function gp(i,e,t){var r=i;return nv(e)?(t=e,typeof i=="string"&&(r={uri:i})):r=rv({},e,{uri:i}),r.callback=t,r}function je(i,e,t){return e=gp(i,e,t),Ol(e)}function Ol(i){if(typeof i.callback>"u")throw new Error("callback argument missing");if(i.requestType&&je.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=je.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&&!je.responseInterceptorsStorage.getIsEnabled()&&setTimeout(u,0)}function a(){var F=void 0;if(p.response?F=p.response:F=p.responseText||uv(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&&je.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&&je.responseInterceptorsStorage.getIsEnabled()){var N={headers:U.headers||{},body:U.body,responseUrl:p.responseURL,responseType:p.responseType},V=je.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=av(p.getAllResponseHeaders()))):V=new Error("Internal XMLHttpRequest Error"),i.requestType&&je.responseInterceptorsStorage.getIsEnabled()){var J={headers:N.headers||{},body:N.body,responseUrl:p.responseURL,responseType:p.responseType},Y=je.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 je.XDomainRequest:p=new je.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&&!lv(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 uv(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 cv(){}var dv=Nl.exports;const mp=Kn(dv);var fp={exports:{}},Jc=cp,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 hv(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"),pv={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)"},gv={v:"title",lang:"lang"},ed={rt:"ruby"};function yp(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=pv[C];if(!D)return null;var L=i.document.createElement(D),O=gv[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 mv(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 fv(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),mv(r))return"rtl";return"ltr"}function yv(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=yp(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:fv(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 _v(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=yv(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:yp(i,e)};var bv=.05,vv="sans-serif",Tv="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=Tv,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*bv*100)/100,p={font:u+"px "+vv};(function(){for(var g,b,S=0;S<e.length;S++)b=e[S],g=new Qs(i,b,p),r.appendChild(g.div),_v(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
|
+
`;)++b;var S=g.substr(0,b);return g[b]==="\r"&&++b,g[b]===`
|
|
15
|
+
`&&++b,e.buffer=g.substr(b),S}function r(g){var b=new Ln;if(Cn(g,function(w,C){switch(w){case"id":b.set(w,C);break;case"width":b.percent(w,C);break;case"lines":b.integer(w,C);break;case"regionanchor":case"viewportanchor":var v=C.split(",");if(v.length!==2)break;var D=new Ln;if(D.percent("x",v[0]),D.percent("y",v[1]),!D.has("x")||!D.has("y"))break;b.set(w+"X",D.get("x")),b.set(w+"Y",D.get("y"));break;case"scroll":b.alt(w,C,["up"]);break}},/=/,/\s/),b.has("id")){var S=new(e.vttjs.VTTRegion||e.window.VTTRegion);S.width=b.get("width",100),S.lines=b.get("lines",3),S.regionAnchorX=b.get("regionanchorX",0),S.regionAnchorY=b.get("regionanchorY",100),S.viewportAnchorX=b.get("viewportanchorX",0),S.viewportAnchorY=b.get("viewportanchorY",100),S.scroll=b.get("scroll",""),e.onregion&&e.onregion(S),e.regionList.push({id:b.get("id"),region:S})}}function n(g){var b=new Ln;Cn(g,function(S,w){switch(S){case"MPEGT":b.integer(S+"S",w);break;case"LOCA":b.set(S+"L",Ml(w));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:b.get("MPEGTS"),LOCAL:b.get("LOCAL")})}function s(g){g.match(/X-TIMESTAMP-MAP/)?Cn(g,function(b,S){switch(b){case"X-TIMESTAMP-MAP":n(S);break}},/=/):Cn(g,function(b,S){switch(b){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 wt(wt.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{hv(a,e.cue,e.regionList)}catch(g){e.reportOrThrowError(g),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+=`
|
|
12
16
|
`),e.cue.text+=a.replace(/\u2028/g,`
|
|
13
17
|
`).replace(/u2029/g,`
|
|
14
|
-
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(
|
|
18
|
+
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(g){e.reportOrThrowError(g),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+=`
|
|
15
19
|
|
|
16
|
-
`,
|
|
20
|
+
`,i.parse()),i.state==="INITIAL")throw new wt(wt.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var Sv=zr,Ev="auto",wv={"":1,lr:1,rl:1},kv={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Cv(i){if(typeof i!="string")return!1;var e=wv[i.toLowerCase()];return e?i.toLowerCase():!1}function To(i){if(typeof i!="string")return!1;var e=kv[i.toLowerCase()];return e?i.toLowerCase():!1}function _p(i,e,t){this.hasBeenReset=!1;var r="",n=!1,s=i,a=e,l=t,u=null,p="",g=!0,b="auto",S="start",w="auto",C="auto",v=100,D="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(L){r=""+L}},pauseOnExit:{enumerable:!0,get:function(){return n},set:function(L){n=!!L}},startTime:{enumerable:!0,get:function(){return s},set:function(L){if(typeof L!="number")throw new TypeError("Start time must be set to a number.");s=L,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(L){if(typeof L!="number")throw new TypeError("End time must be set to a number.");a=L,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(L){l=""+L,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(L){u=L,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return p},set:function(L){var O=Cv(L);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 g},set:function(L){g=!!L,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return b},set:function(L){if(typeof L!="number"&&L!==Ev)throw new SyntaxError("Line: an invalid number or illegal string was specified.");b=L,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return S},set:function(L){var O=To(L);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(L){if(L<0||L>100)throw new Error("Position must be between 0 and 100.");w=L,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return C},set:function(L){var O=To(L);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(L){if(L<0||L>100)throw new Error("Size must be between 0 and 100.");v=L,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return D},set:function(L){var O=To(L);if(!O)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");D=O,this.hasBeenReset=!0}}}),this.displayState=void 0}_p.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Iv=_p,Av={"":!0,up:!0};function xv(i){if(typeof i!="string")return!1;var e=Av[i.toLowerCase()];return e?i.toLowerCase():!1}function vn(i){return typeof i=="number"&&i>=0&&i<=100}function Lv(){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(!vn(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(!vn(l))throw new Error("RegionAnchorX must be between 0 and 100.");r=l}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(l){if(!vn(l))throw new Error("RegionAnchorY must be between 0 and 100.");t=l}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(l){if(!vn(l))throw new Error("ViewportAnchorY must be between 0 and 100.");s=l}},viewportAnchorX:{enumerable:!0,get:function(){return n},set:function(l){if(!vn(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=xv(l);u===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=u}}})}var Dv=Lv,_i=wa,sr=fp.exports={WebVTT:Sv,VTTCue:Iv,VTTRegion:Dv};_i.vttjs=sr;_i.WebVTT=sr.WebVTT;var Pv=sr.VTTCue,Rv=sr.VTTRegion,Nv=_i.VTTCue,Ov=_i.VTTRegion;sr.shim=function(){_i.VTTCue=Pv,_i.VTTRegion=Rv};sr.restore=function(){_i.VTTCue=Nv,_i.VTTRegion=Ov};_i.VTTCue||sr.shim();var Uv=fp.exports;const id=Kn(Uv);function Ve(){return Ve=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},Ve.apply(null,arguments)}var rd="https://example.com",Ca=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||rd);var n=new URL(e,i);return r?n.href.slice(rd.length):t?n.href.slice(n.protocol.length):n.href},Bl=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}(),bp={},Ia={};Ia.byteLength=Fv;Ia.toByteArray=qv;Ia.fromByteArray=Hv;var Qt=[],Lt=[],Mv=typeof Uint8Array<"u"?Uint8Array:Array,So="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var fr=0,Bv=So.length;fr<Bv;++fr)Qt[fr]=So[fr],Lt[So.charCodeAt(fr)]=fr;Lt[45]=62;Lt[95]=63;function vp(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 Fv(i){var e=vp(i),t=e[0],r=e[1];return(t+r)*3/4-r}function jv(i,e,t){return(e+t)*3/4-t}function qv(i){var e,t=vp(i),r=t[0],n=t[1],s=new Mv(jv(i,r,n)),a=0,l=n>0?r-4:r,u;for(u=0;u<l;u+=4)e=Lt[i.charCodeAt(u)]<<18|Lt[i.charCodeAt(u+1)]<<12|Lt[i.charCodeAt(u+2)]<<6|Lt[i.charCodeAt(u+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=e&255;return n===2&&(e=Lt[i.charCodeAt(u)]<<2|Lt[i.charCodeAt(u+1)]>>4,s[a++]=e&255),n===1&&(e=Lt[i.charCodeAt(u)]<<10|Lt[i.charCodeAt(u+1)]<<4|Lt[i.charCodeAt(u+2)]>>2,s[a++]=e>>8&255,s[a++]=e&255),s}function $v(i){return Qt[i>>18&63]+Qt[i>>12&63]+Qt[i>>6&63]+Qt[i&63]}function Vv(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($v(r));return n.join("")}function Hv(i){for(var e,t=i.length,r=t%3,n=[],s=16383,a=0,l=t-r;a<l;a+=s)n.push(Vv(i,a,a+s>l?l:a+s));return r===1?(e=i[t-1],n.push(Qt[e>>2]+Qt[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(Qt[e>>10]+Qt[e>>4&63]+Qt[e<<2&63]+"=")),n.join("")}var Fl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Fl.read=function(i,e,t,r,n){var s,a,l=n*8-r-1,u=(1<<l)-1,p=u>>1,g=-7,b=t?n-1:0,S=t?-1:1,w=i[e+b];for(b+=S,s=w&(1<<-g)-1,w>>=-g,g+=l;g>0;s=s*256+i[e+b],b+=S,g-=8);for(a=s&(1<<-g)-1,s>>=-g,g+=r;g>0;a=a*256+i[e+b],b+=S,g-=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)};Fl.write=function(i,e,t,r,n,s){var a,l,u,p=s*8-n-1,g=(1<<p)-1,b=g>>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=g):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+b>=1?e+=S/u:e+=S*Math.pow(2,1-b),e*u>=2&&(a++,u/=2),a+b>=g?(l=0,a=g):a+b>=1?(l=(e*u-1)*Math.pow(2,n),a=a+b):(l=e*Math.pow(2,b-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};/*!
|
|
17
21
|
* The buffer module from node.js, for the browser.
|
|
18
22
|
*
|
|
19
23
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
20
24
|
* @license MIT
|
|
21
|
-
*/(function(s){const e=eo,t=uc,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=m,s.SlowBuffer=N,s.INSPECT_MAX_BYTES=50;const r=2147483647;s.kMaxLength=r;const{Uint8Array:i,ArrayBuffer:a,SharedArrayBuffer:o}=globalThis;m.TYPED_ARRAY_SUPPORT=c(),!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 c(){try{const f=new i(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,i.prototype),Object.setPrototypeOf(f,v),f.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 h(f){if(f>r)throw new RangeError('The value "'+f+'" is invalid for option "size"');const v=new i(f);return Object.setPrototypeOf(v,m.prototype),v}function m(f,v,A){if(typeof f=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(f)}return _(f,v,A)}m.poolSize=8192;function _(f,v,A){if(typeof f=="string")return b(f,v);if(a.isView(f))return L(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(vt(f,a)||f&&vt(f.buffer,a)||typeof o<"u"&&(vt(f,o)||f&&vt(f.buffer,o)))return U(f,v,A);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const D=f.valueOf&&f.valueOf();if(D!=null&&D!==f)return m.from(D,v,A);const B=M(f);if(B)return B;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return m.from(f[Symbol.toPrimitive]("string"),v,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}m.from=function(f,v,A){return _(f,v,A)},Object.setPrototypeOf(m.prototype,i.prototype),Object.setPrototypeOf(m,i);function T(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function S(f,v,A){return T(f),f<=0?h(f):v!==void 0?typeof A=="string"?h(f).fill(v,A):h(f).fill(v):h(f)}m.alloc=function(f,v,A){return S(f,v,A)};function w(f){return T(f),h(f<0?0:F(f)|0)}m.allocUnsafe=function(f){return w(f)},m.allocUnsafeSlow=function(f){return w(f)};function b(f,v){if((typeof v!="string"||v==="")&&(v="utf8"),!m.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const A=j(f,v)|0;let D=h(A);const B=D.write(f,v);return B!==A&&(D=D.slice(0,B)),D}function R(f){const v=f.length<0?0:F(f.length)|0,A=h(v);for(let D=0;D<v;D+=1)A[D]=f[D]&255;return A}function L(f){if(vt(f,i)){const v=new i(f);return U(v.buffer,v.byteOffset,v.byteLength)}return R(f)}function U(f,v,A){if(v<0||f.byteLength<v)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<v+(A||0))throw new RangeError('"length" is outside of buffer bounds');let D;return v===void 0&&A===void 0?D=new i(f):A===void 0?D=new i(f,v):D=new i(f,v,A),Object.setPrototypeOf(D,m.prototype),D}function M(f){if(m.isBuffer(f)){const v=F(f.length)|0,A=h(v);return A.length===0||f.copy(A,0,0,v),A}if(f.length!==void 0)return typeof f.length!="number"||Ys(f.length)?h(0):R(f);if(f.type==="Buffer"&&Array.isArray(f.data))return R(f.data)}function F(f){if(f>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return f|0}function N(f){return+f!=f&&(f=0),m.alloc(+f)}m.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==m.prototype},m.compare=function(f,v){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),vt(v,i)&&(v=m.from(v,v.offset,v.byteLength)),!m.isBuffer(f)||!m.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===v)return 0;let A=f.length,D=v.length;for(let B=0,H=Math.min(A,D);B<H;++B)if(f[B]!==v[B]){A=f[B],D=v[B];break}return A<D?-1:D<A?1:0},m.isEncoding=function(f){switch(String(f).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(f,v){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return m.alloc(0);let A;if(v===void 0)for(v=0,A=0;A<f.length;++A)v+=f[A].length;const D=m.allocUnsafe(v);let B=0;for(A=0;A<f.length;++A){let H=f[A];if(vt(H,i))B+H.length>D.length?(m.isBuffer(H)||(H=m.from(H)),H.copy(D,B)):i.prototype.set.call(D,H,B);else if(m.isBuffer(H))H.copy(D,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=H.length}return D};function j(f,v){if(m.isBuffer(f))return f.length;if(a.isView(f)||vt(f,a))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const A=f.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&A===0)return 0;let B=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return _e(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return ki(f).length;default:if(B)return D?-1:_e(f).length;v=(""+v).toLowerCase(),B=!0}}m.byteLength=j;function J(f,v,A){let D=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,v>>>=0,A<=v))return"";for(f||(f="utf8");;)switch(f){case"hex":return st(this,v,A);case"utf8":case"utf-8":return fe(this,v,A);case"ascii":return Oe(this,v,A);case"latin1":case"binary":return tt(this,v,A);case"base64":return G(this,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,v,A);default:if(D)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),D=!0}}m.prototype._isBuffer=!0;function K(f,v,A){const D=f[v];f[v]=f[A],f[A]=D}m.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let v=0;v<f;v+=2)K(this,v,v+1);return this},m.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let v=0;v<f;v+=4)K(this,v,v+3),K(this,v+1,v+2);return this},m.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let v=0;v<f;v+=8)K(this,v,v+7),K(this,v+1,v+6),K(this,v+2,v+5),K(this,v+3,v+4);return this},m.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?fe(this,0,f):J.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(f){if(!m.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:m.compare(this,f)===0},m.prototype.inspect=function(){let f="";const v=s.INSPECT_MAX_BYTES;return f=this.toString("hex",0,v).replace(/(.{2})/g,"$1 ").trim(),this.length>v&&(f+=" ... "),"<Buffer "+f+">"},n&&(m.prototype[n]=m.prototype.inspect),m.prototype.compare=function(f,v,A,D,B){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),!m.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(v===void 0&&(v=0),A===void 0&&(A=f?f.length:0),D===void 0&&(D=0),B===void 0&&(B=this.length),v<0||A>f.length||D<0||B>this.length)throw new RangeError("out of range index");if(D>=B&&v>=A)return 0;if(D>=B)return-1;if(v>=A)return 1;if(v>>>=0,A>>>=0,D>>>=0,B>>>=0,this===f)return 0;let H=B-D,Q=A-v;const ke=Math.min(H,Q),Xe=this.slice(D,B),xe=f.slice(v,A);for(let Ee=0;Ee<ke;++Ee)if(Xe[Ee]!==xe[Ee]){H=Xe[Ee],Q=xe[Ee];break}return H<Q?-1:Q<H?1:0};function ne(f,v,A,D,B){if(f.length===0)return-1;if(typeof A=="string"?(D=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Ys(A)&&(A=B?0:f.length-1),A<0&&(A=f.length+A),A>=f.length){if(B)return-1;A=f.length-1}else if(A<0)if(B)A=0;else return-1;if(typeof v=="string"&&(v=m.from(v,D)),m.isBuffer(v))return v.length===0?-1:he(f,v,A,D,B);if(typeof v=="number")return v=v&255,typeof i.prototype.indexOf=="function"?B?i.prototype.indexOf.call(f,v,A):i.prototype.lastIndexOf.call(f,v,A):he(f,[v],A,D,B);throw new TypeError("val must be string, number or Buffer")}function he(f,v,A,D,B){let H=1,Q=f.length,ke=v.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(f.length<2||v.length<2)return-1;H=2,Q/=2,ke/=2,A/=2}function Xe(Ee,qe){return H===1?Ee[qe]:Ee.readUInt16BE(qe*H)}let xe;if(B){let Ee=-1;for(xe=A;xe<Q;xe++)if(Xe(f,xe)===Xe(v,Ee===-1?0:xe-Ee)){if(Ee===-1&&(Ee=xe),xe-Ee+1===ke)return Ee*H}else Ee!==-1&&(xe-=xe-Ee),Ee=-1}else for(A+ke>Q&&(A=Q-ke),xe=A;xe>=0;xe--){let Ee=!0;for(let qe=0;qe<ke;qe++)if(Xe(f,xe+qe)!==Xe(v,qe)){Ee=!1;break}if(Ee)return xe}return-1}m.prototype.includes=function(f,v,A){return this.indexOf(f,v,A)!==-1},m.prototype.indexOf=function(f,v,A){return ne(this,f,v,A,!0)},m.prototype.lastIndexOf=function(f,v,A){return ne(this,f,v,A,!1)};function oe(f,v,A,D){A=Number(A)||0;const B=f.length-A;D?(D=Number(D),D>B&&(D=B)):D=B;const H=v.length;D>H/2&&(D=H/2);let Q;for(Q=0;Q<D;++Q){const ke=parseInt(v.substr(Q*2,2),16);if(Ys(ke))return Q;f[A+Q]=ke}return Q}function me(f,v,A,D){return Ls(_e(v,f.length-A),f,A,D)}function te(f,v,A,D){return Ls(ko(v),f,A,D)}function ue(f,v,A,D){return Ls(ki(v),f,A,D)}function z(f,v,A,D){return Ls(vr(v,f.length-A),f,A,D)}m.prototype.write=function(f,v,A,D){if(v===void 0)D="utf8",A=this.length,v=0;else if(A===void 0&&typeof v=="string")D=v,A=this.length,v=0;else if(isFinite(v))v=v>>>0,isFinite(A)?(A=A>>>0,D===void 0&&(D="utf8")):(D=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-v;if((A===void 0||A>B)&&(A=B),f.length>0&&(A<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");let H=!1;for(;;)switch(D){case"hex":return oe(this,f,v,A);case"utf8":case"utf-8":return me(this,f,v,A);case"ascii":case"latin1":case"binary":return te(this,f,v,A);case"base64":return ue(this,f,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,f,v,A);default:if(H)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),H=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function G(f,v,A){return v===0&&A===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(v,A))}function fe(f,v,A){A=Math.min(f.length,A);const D=[];let B=v;for(;B<A;){const H=f[B];let Q=null,ke=H>239?4:H>223?3:H>191?2:1;if(B+ke<=A){let Xe,xe,Ee,qe;switch(ke){case 1:H<128&&(Q=H);break;case 2:Xe=f[B+1],(Xe&192)===128&&(qe=(H&31)<<6|Xe&63,qe>127&&(Q=qe));break;case 3:Xe=f[B+1],xe=f[B+2],(Xe&192)===128&&(xe&192)===128&&(qe=(H&15)<<12|(Xe&63)<<6|xe&63,qe>2047&&(qe<55296||qe>57343)&&(Q=qe));break;case 4:Xe=f[B+1],xe=f[B+2],Ee=f[B+3],(Xe&192)===128&&(xe&192)===128&&(Ee&192)===128&&(qe=(H&15)<<18|(Xe&63)<<12|(xe&63)<<6|Ee&63,qe>65535&&qe<1114112&&(Q=qe))}}Q===null?(Q=65533,ke=1):Q>65535&&(Q-=65536,D.push(Q>>>10&1023|55296),Q=56320|Q&1023),D.push(Q),B+=ke}return Pe(D)}const ye=4096;function Pe(f){const v=f.length;if(v<=ye)return String.fromCharCode.apply(String,f);let A="",D=0;for(;D<v;)A+=String.fromCharCode.apply(String,f.slice(D,D+=ye));return A}function Oe(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]&127);return D}function tt(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]);return D}function st(f,v,A){const D=f.length;(!v||v<0)&&(v=0),(!A||A<0||A>D)&&(A=D);let B="";for(let H=v;H<A;++H)B+=bn[f[H]];return B}function ut(f,v,A){const D=f.slice(v,A);let B="";for(let H=0;H<D.length-1;H+=2)B+=String.fromCharCode(D[H]+D[H+1]*256);return B}m.prototype.slice=function(f,v){const A=this.length;f=~~f,v=v===void 0?A:~~v,f<0?(f+=A,f<0&&(f=0)):f>A&&(f=A),v<0?(v+=A,v<0&&(v=0)):v>A&&(v=A),v<f&&(v=f);const D=this.subarray(f,v);return Object.setPrototypeOf(D,m.prototype),D};function be(f,v,A){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+v>A)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return D},m.prototype.readUintBE=m.prototype.readUIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f+--v],B=1;for(;v>0&&(B*=256);)D+=this[f+--v]*B;return D},m.prototype.readUint8=m.prototype.readUInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]|this[f+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]<<8|this[f+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},m.prototype.readBigUInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,B=this[++f]+this[++f]*2**8+this[++f]*2**16+A*2**24;return BigInt(D)+(BigInt(B)<<BigInt(32))}),m.prototype.readBigUInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],B=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A;return(BigInt(D)<<BigInt(32))+BigInt(B)}),m.prototype.readIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return B*=128,D>=B&&(D-=Math.pow(2,8*v)),D},m.prototype.readIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=v,B=1,H=this[f+--D];for(;D>0&&(B*=256);)H+=this[f+--D]*B;return B*=128,H>=B&&(H-=Math.pow(2,8*v)),H},m.prototype.readInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},m.prototype.readInt16LE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f]|this[f+1]<<8;return A&32768?A|4294901760:A},m.prototype.readInt16BE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f+1]|this[f]<<8;return A&32768?A|4294901760:A},m.prototype.readInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},m.prototype.readInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},m.prototype.readBigInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(A<<24);return(BigInt(D)<<BigInt(32))+BigInt(v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),m.prototype.readBigInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=(v<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(D)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A)}),m.prototype.readFloatLE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!0,23,4)},m.prototype.readFloatBE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!1,23,4)},m.prototype.readDoubleLE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!0,52,8)},m.prototype.readDoubleBE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!1,52,8)};function Re(f,v,A,D,B,H){if(!m.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>B||v<H)throw new RangeError('"value" argument is out of bounds');if(A+D>f.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const Q=Math.pow(2,8*A)-1;Re(this,f,v,A,Q,0)}let B=1,H=0;for(this[v]=f&255;++H<A&&(B*=256);)this[v+H]=f/B&255;return v+A},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const Q=Math.pow(2,8*A)-1;Re(this,f,v,A,Q,0)}let B=A-1,H=1;for(this[v+B]=f&255;--B>=0&&(H*=256);)this[v+B]=f/H&255;return v+A},m.prototype.writeUint8=m.prototype.writeUInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,255,0),this[v]=f&255,v+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v+3]=f>>>24,this[v+2]=f>>>16,this[v+1]=f>>>8,this[v]=f&255,v+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4};function ps(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H;let Q=Number(v>>BigInt(32)&BigInt(4294967295));return f[A++]=Q,Q=Q>>8,f[A++]=Q,Q=Q>>8,f[A++]=Q,Q=Q>>8,f[A++]=Q,A}function Gs(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A+7]=H,H=H>>8,f[A+6]=H,H=H>>8,f[A+5]=H,H=H>>8,f[A+4]=H;let Q=Number(v>>BigInt(32)&BigInt(4294967295));return f[A+3]=Q,Q=Q>>8,f[A+2]=Q,Q=Q>>8,f[A+1]=Q,Q=Q>>8,f[A]=Q,A+8}m.prototype.writeBigUInt64LE=Dt(function(f,v=0){return ps(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=Dt(function(f,v=0){return Gs(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=0,H=1,Q=0;for(this[v]=f&255;++B<A&&(H*=256);)f<0&&Q===0&&this[v+B-1]!==0&&(Q=1),this[v+B]=(f/H>>0)-Q&255;return v+A},m.prototype.writeIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=A-1,H=1,Q=0;for(this[v+B]=f&255;--B>=0&&(H*=256);)f<0&&Q===0&&this[v+B+1]!==0&&(Q=1),this[v+B]=(f/H>>0)-Q&255;return v+A},m.prototype.writeInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,127,-128),f<0&&(f=255+f+1),this[v]=f&255,v+1},m.prototype.writeInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),this[v]=f&255,this[v+1]=f>>>8,this[v+2]=f>>>16,this[v+3]=f>>>24,v+4},m.prototype.writeInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4},m.prototype.writeBigInt64LE=Dt(function(f,v=0){return ps(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=Dt(function(f,v=0){return Gs(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ms(f,v,A,D,B,H){if(A+D>f.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function Gt(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,4),t.write(f,v,A,D,23,4),A+4}m.prototype.writeFloatLE=function(f,v,A){return Gt(this,f,v,!0,A)},m.prototype.writeFloatBE=function(f,v,A){return Gt(this,f,v,!1,A)};function Cs(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,8),t.write(f,v,A,D,52,8),A+8}m.prototype.writeDoubleLE=function(f,v,A){return Cs(this,f,v,!0,A)},m.prototype.writeDoubleBE=function(f,v,A){return Cs(this,f,v,!1,A)},m.prototype.copy=function(f,v,A,D){if(!m.isBuffer(f))throw new TypeError("argument should be a Buffer");if(A||(A=0),!D&&D!==0&&(D=this.length),v>=f.length&&(v=f.length),v||(v=0),D>0&&D<A&&(D=A),D===A||f.length===0||this.length===0)return 0;if(v<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),f.length-v<D-A&&(D=f.length-v+A);const B=D-A;return this===f&&typeof i.prototype.copyWithin=="function"?this.copyWithin(v,A,D):i.prototype.set.call(f,this.subarray(A,D),v),B},m.prototype.fill=function(f,v,A,D){if(typeof f=="string"){if(typeof v=="string"?(D=v,v=0,A=this.length):typeof A=="string"&&(D=A,A=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!m.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(f.length===1){const H=f.charCodeAt(0);(D==="utf8"&&H<128||D==="latin1")&&(f=H)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(v<0||this.length<v||this.length<A)throw new RangeError("Out of range index");if(A<=v)return this;v=v>>>0,A=A===void 0?this.length:A>>>0,f||(f=0);let B;if(typeof f=="number")for(B=v;B<A;++B)this[B]=f;else{const H=m.isBuffer(f)?f:m.from(f,D),Q=H.length;if(Q===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<A-v;++B)this[B+v]=H[B%Q]}return this};const Is={};function vn(f,v,A){Is[f]=class extends A{constructor(){super(),Object.defineProperty(this,"message",{value:v.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(D){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:D,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}vn("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),vn("ERR_INVALID_ARG_TYPE",function(f,v){return`The "${f}" argument must be of type number. Received type ${typeof v}`},TypeError),vn("ERR_OUT_OF_RANGE",function(f,v,A){let D=`The value of "${f}" is out of range.`,B=A;return Number.isInteger(A)&&Math.abs(A)>2**32?B=Ei(String(A)):typeof A=="bigint"&&(B=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(B=Ei(B)),B+="n"),D+=` It must be ${v}. Received ${B}`,D},RangeError);function Ei(f){let v="",A=f.length;const D=f[0]==="-"?1:0;for(;A>=D+4;A-=3)v=`_${f.slice(A-3,A)}${v}`;return`${f.slice(0,A)}${v}`}function wo(f,v,A){xs(v,"offset"),(f[v]===void 0||f[v+A]===void 0)&&Xs(v,f.length-(A+1))}function wi(f,v,A,D,B,H){if(f>A||f<v){const Q=typeof v=="bigint"?"n":"";let ke;throw v===0||v===BigInt(0)?ke=`>= 0${Q} and < 2${Q} ** ${(H+1)*8}${Q}`:ke=`>= -(2${Q} ** ${(H+1)*8-1}${Q}) and < 2 ** ${(H+1)*8-1}${Q}`,new Is.ERR_OUT_OF_RANGE("value",ke,f)}wo(D,B,H)}function xs(f,v){if(typeof f!="number")throw new Is.ERR_INVALID_ARG_TYPE(v,"number",f)}function Xs(f,v,A){throw Math.floor(f)!==f?(xs(f,A),new Is.ERR_OUT_OF_RANGE("offset","an integer",f)):v<0?new Is.ERR_BUFFER_OUT_OF_BOUNDS:new Is.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${v}`,f)}const Xt=/[^+/0-9A-Za-z-_]/g;function _r(f){if(f=f.split("=")[0],f=f.trim().replace(Xt,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function _e(f,v){v=v||1/0;let A;const D=f.length;let B=null;const H=[];for(let Q=0;Q<D;++Q){if(A=f.charCodeAt(Q),A>55295&&A<57344){if(!B){if(A>56319){(v-=3)>-1&&H.push(239,191,189);continue}else if(Q+1===D){(v-=3)>-1&&H.push(239,191,189);continue}B=A;continue}if(A<56320){(v-=3)>-1&&H.push(239,191,189),B=A;continue}A=(B-55296<<10|A-56320)+65536}else B&&(v-=3)>-1&&H.push(239,191,189);if(B=null,A<128){if((v-=1)<0)break;H.push(A)}else if(A<2048){if((v-=2)<0)break;H.push(A>>6|192,A&63|128)}else if(A<65536){if((v-=3)<0)break;H.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((v-=4)<0)break;H.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return H}function ko(f){const v=[];for(let A=0;A<f.length;++A)v.push(f.charCodeAt(A)&255);return v}function vr(f,v){let A,D,B;const H=[];for(let Q=0;Q<f.length&&!((v-=2)<0);++Q)A=f.charCodeAt(Q),D=A>>8,B=A%256,H.push(B),H.push(D);return H}function ki(f){return e.toByteArray(_r(f))}function Ls(f,v,A,D){let B;for(B=0;B<D&&!(B+A>=v.length||B>=f.length);++B)v[B+A]=f[B];return B}function vt(f,v){return f instanceof v||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===v.name}function Ys(f){return f!==f}const bn=function(){const f="0123456789abcdef",v=new Array(256);for(let A=0;A<16;++A){const D=A*16;for(let B=0;B<16;++B)v[D+B]=f[A]+f[B]}return v}();function Dt(f){return typeof BigInt>"u"?Ci:f}function Ci(){throw new Error("BigInt not supported")}})(Pp);const K0=Pp.Buffer;var Q0=function(s){return I.atob?I.atob(s):K0.from(s,"base64").toString("binary")};function Dp(s){for(var e=Q0(s),t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class Z0 extends dc{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
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 de(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 re(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:he(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):he(m,[_],T,P,M);throw new TypeError("val must be string, number or Buffer")}function he(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 re(this,m,_,T,!0)},g.prototype.lastIndexOf=function(m,_,T){return re(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 pe(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 pe(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 de(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 Be(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;Be(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;Be(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||Be(this,m,_,1,255,0),this[_]=m&255,_+1},g.prototype.writeUint16LE=g.prototype.writeUInt16LE=function(m,_,T){return m=+m,_=_>>>0,T||Be(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||Be(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||Be(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||Be(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);Be(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);Be(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||Be(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||Be(this,m,_,2,32767,-32768),this[_]=m&255,this[_+1]=m>>>8,_+2},g.prototype.writeInt16BE=function(m,_,T){return m=+m,_=_>>>0,T||Be(this,m,_,2,32767,-32768),this[_]=m>>>8,this[_+1]=m&255,_+2},g.prototype.writeInt32LE=function(m,_,T){return m=+m,_=_>>>0,T||Be(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||Be(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")}})(bp);const zv=bp.Buffer;var Wv=function(i){return x.atob?x.atob(i):zv.from(i,"base64").toString("binary")};function Tp(i){for(var e=Wv(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 Gv extends Bl{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
22
26
|
`);t>-1;t=this.buffer.indexOf(`
|
|
23
|
-
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const J0=" ",Zo=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},eT=function(){const s='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+s+")")},mt=function(s){const e={};if(!s)return e;const t=s.split(eT());let n=t.length,r;for(;n--;)t[n]!==""&&(r=/([^=]*)=(.*)/.exec(t[n]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e},mu=s=>{const e=s.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class tT extends dc{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,n;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,i)=>{const a=i(e);return a===e?r:r.concat([a])},[e]).forEach(r=>{for(let i=0;i<this.customParsers.length;i++)if(this.customParsers[i].call(this,r))return;if(r.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:r.slice(1)});return}if(r=r.replace("\r",""),t=/^#EXTM3U/.exec(r),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(r),t){n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),this.trigger("data",n);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(r),t){n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(r),t){n=ze(Zo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",n);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(r),t){n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(r),t){if(n={type:"tag",tagType:"map"},t[1]){const i=mt(t[1]);i.URI&&(n.uri=i.URI),i.BYTERANGE&&(n.byterange=Zo(i.BYTERANGE))}this.trigger("data",n);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"stream-inf"},t[1]&&(n.attributes=mt(t[1]),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=mu(n.attributes.RESOLUTION)),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(r),t){n={type:"tag",tagType:"media"},t[1]&&(n.attributes=mt(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-ENDLIST/.exec(r),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(r),t){n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(r),t){n={type:"tag",tagType:"key"},t[1]&&(n.attributes=mt(t[1]),n.attributes.IV&&(n.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),this.trigger("data",n);return}if(t=/^#EXT-X-START:(.*)$/.exec(r),t){n={type:"tag",tagType:"start"},t[1]&&(n.attributes=mt(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"skip"},n.attributes=mt(t[1]),n.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(n.attributes["SKIPPED-SEGMENTS"]=parseInt(n.attributes["SKIPPED-SEGMENTS"],10)),n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(n.attributes["RECENTLY-REMOVED-DATERANGES"]=n.attributes["RECENTLY-REMOVED-DATERANGES"].split(J0)),this.trigger("data",n);return}if(t=/^#EXT-X-PART:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part"},n.attributes=mt(t[1]),["DURATION"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["INDEPENDENT","GAP"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),n.attributes.hasOwnProperty("BYTERANGE")&&(n.attributes.byterange=Zo(n.attributes.BYTERANGE)),this.trigger("data",n);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"server-control"},n.attributes=mt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part-inf"},n.attributes=mt(t[1]),["PART-TARGET"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"preload-hint"},n.attributes=mt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(i){if(n.attributes.hasOwnProperty(i)){n.attributes[i]=parseInt(n.attributes[i],10);const a=i==="BYTERANGE-LENGTH"?"length":"offset";n.attributes.byterange=n.attributes.byterange||{},n.attributes.byterange[a]=n.attributes[i],delete n.attributes[i]}}),this.trigger("data",n);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"rendition-report"},n.attributes=mt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseInt(n.attributes[i],10))}),this.trigger("data",n);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"daterange"},n.attributes=mt(t[1]),["ID","CLASS"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=String(n.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=new Date(n.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=parseFloat(n.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=/YES/i.test(n.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=n.attributes[a].toString(16))});const i=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in n.attributes){if(!i.test(a))continue;const o=/[0-9A-Fa-f]{6}/g.test(n.attributes[a]),c=/^\d+(\.\d+)?$/.test(n.attributes[a]);n.attributes[a]=o?n.attributes[a].toString(16):c?parseFloat(n.attributes[a]):String(n.attributes[a])}this.trigger("data",n);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(r),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(r),t){n={type:"tag",tagType:"content-steering"},n.attributes=mt(t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"i-frame-playlist"},n.attributes=mt(t[1]),n.attributes.URI&&(n.uri=n.attributes.URI),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=mu(n.attributes.RESOLUTION)),n.attributes["AVERAGE-BANDWIDTH"]&&(n.attributes["AVERAGE-BANDWIDTH"]=parseInt(n.attributes["AVERAGE-BANDWIDTH"],10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),this.trigger("data",n);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(r),t){n={type:"tag",tagType:"define"},n.attributes=mt(t[1]),this.trigger("data",n);return}this.trigger("data",{type:"tag",data:r.slice(4)})})}}addParser({expression:e,customType:t,dataParser:n,segment:r}){typeof n!="function"&&(n=i=>i),this.customParsers.push(i=>{if(e.exec(i))return this.trigger("data",{type:"custom",data:n(i),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const n=r=>e.test(r)?t(r):r;this.tagMappers.push(n)}}const sT=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ns=function(s){const e={};return Object.keys(s).forEach(function(t){e[sT(t)]=s[t]}),e},Jo=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:n}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",i="holdBack",a="partHoldBack",o=t&&t*3,c=n&&n*2;t&&!e.hasOwnProperty(i)&&(e[i]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[i]<o&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[i]}) to targetDuration * 3 (${o})`}),e[i]=o),n&&!e.hasOwnProperty(a)&&(e[a]=n*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),n&&e[a]<c&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${c}).`}),e[a]=c)};class nT extends dc{constructor(e={}){super(),this.lineStream=new Z0,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,n=[];let r={},i,a,o=!1;const c=function(){},h={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let T=0,S=0;const w={};this.on("end",()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&a&&(r.key=a),!r.timeline&&typeof _=="number"&&(r.timeline=_),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(b){let R,L;if(t.manifest.definitions){for(const U in t.manifest.definitions)if(b.uri&&(b.uri=b.uri.replace(`{$${U}}`,t.manifest.definitions[U])),b.attributes)for(const M in b.attributes)typeof b.attributes[M]=="string"&&(b.attributes[M]=b.attributes[M].replace(`{$${U}}`,t.manifest.definitions[U]))}({tag(){({version(){b.version&&(this.manifest.version=b.version)},"allow-cache"(){this.manifest.allowCache=b.allowed,"allowed"in b||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const U={};"length"in b&&(r.byterange=U,U.length=b.length,"offset"in b||(b.offset=T)),"offset"in b&&(r.byterange=U,U.offset=b.offset),T=U.offset+U.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"})),b.title&&(r.title=b.title),b.duration>0&&(r.duration=b.duration),b.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key(){if(!b.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(b.attributes.METHOD==="NONE"){a=null;return}if(!b.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(b.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:b.attributes};return}if(b.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:b.attributes.URI};return}if(b.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(b.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(b.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),b.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(b.attributes.KEYID&&b.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:b.attributes.KEYFORMAT,keyId:b.attributes.KEYID.substring(2)},pssh:Dp(b.attributes.URI.split(",")[1])};return}b.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:b.attributes.METHOD||"AES-128",uri:b.attributes.URI},typeof b.attributes.IV<"u"&&(a.iv=b.attributes.IV)},"media-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+b.number});return}this.manifest.mediaSequence=b.number},"discontinuity-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+b.number});return}this.manifest.discontinuitySequence=b.number,_=b.number},"playlist-type"(){if(!/VOD|EVENT/.test(b.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+b.playlist});return}this.manifest.playlistType=b.playlistType},map(){i={},b.uri&&(i.uri=b.uri),b.byterange&&(i.byterange=b.byterange),a&&(i.key=a)},"stream-inf"(){if(this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||h,!b.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),ze(r.attributes,b.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,!(b.attributes&&b.attributes.TYPE&&b.attributes["GROUP-ID"]&&b.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const U=this.manifest.mediaGroups[b.attributes.TYPE];U[b.attributes["GROUP-ID"]]=U[b.attributes["GROUP-ID"]]||{},R=U[b.attributes["GROUP-ID"]],L={default:/yes/i.test(b.attributes.DEFAULT)},L.default?L.autoselect=!0:L.autoselect=/yes/i.test(b.attributes.AUTOSELECT),b.attributes.LANGUAGE&&(L.language=b.attributes.LANGUAGE),b.attributes.URI&&(L.uri=b.attributes.URI),b.attributes["INSTREAM-ID"]&&(L.instreamId=b.attributes["INSTREAM-ID"]),b.attributes.CHARACTERISTICS&&(L.characteristics=b.attributes.CHARACTERISTICS),b.attributes.FORCED&&(L.forced=/yes/i.test(b.attributes.FORCED)),R[b.attributes.NAME]=L},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=b.dateTimeString,this.manifest.dateTimeObject=b.dateTimeObject),r.dateTimeString=b.dateTimeString,r.dateTimeObject=b.dateTimeObject;const{lastProgramDateTime:U}=this;this.lastProgramDateTime=new Date(b.dateTimeString).getTime(),U===null&&this.manifest.segments.reduceRight((M,F)=>(F.programDateTime=M-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(b.duration)||b.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+b.duration});return}this.manifest.targetDuration=b.duration,Jo.call(this,this.manifest)},start(){if(!b.attributes||isNaN(b.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:b.attributes["TIME-OFFSET"],precise:b.attributes.PRECISE}},"cue-out"(){r.cueOut=b.data},"cue-out-cont"(){r.cueOutCont=b.data},"cue-in"(){r.cueIn=b.data},skip(){this.manifest.skip=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",b.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const U=this.manifest.segments.length,M=Ns(b.attributes);r.parts=r.parts||[],r.parts.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=S),S=M.byterange.offset+M.byterange.length);const F=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${U}`,b.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((N,j)=>{N.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${j} lacks required attribute(s): LAST-PART`})})},"server-control"(){const U=this.manifest.serverControl=Ns(b.attributes);U.hasOwnProperty("canBlockReload")||(U.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Jo.call(this,this.manifest),U.canSkipDateranges&&!U.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 U=this.manifest.segments.length,M=Ns(b.attributes),F=M.type&&M.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=F?S:0,F&&(S=M.byterange.offset+M.byterange.length)));const N=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${N} for segment #${U}`,b.attributes,["TYPE","URI"]),!!M.type)for(let j=0;j<r.preloadHints.length-1;j++){const J=r.preloadHints[j];J.type&&J.type===M.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${N} for segment #${U} has the same TYPE ${M.type} as preload hint #${j}`})}},"rendition-report"(){const U=Ns(b.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(U);const M=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];o&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${M}`,b.attributes,F)},"part-inf"(){this.manifest.partInf=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",b.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Jo.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ns(b.attributes));const U=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${U}`,b.attributes,["ID","START-DATE"]);const M=this.manifest.dateRanges[U];M.endDate&&M.startDate&&new Date(M.endDate)<new Date(M.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),M.duration&&M.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),M.plannedDuration&&M.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!M.endOnNext;if(F&&!M.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(M.duration||M.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),M.duration&&M.endDate){const N=M.startDate.getTime()+M.duration*1e3;this.manifest.dateRanges[U].endDate=new Date(N)}if(!w[M.id])w[M.id]=M;else{for(const j in w[M.id])if(M[j]&&JSON.stringify(w[M.id][j])!==JSON.stringify(M[j])){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(j=>j.id===M.id);this.manifest.dateRanges[N]=ze(this.manifest.dateRanges[N],M),w[M.id]=ze(w[M.id],M),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=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",b.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const U=(M,F)=>{if(M in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${M}`});return}this.manifest.definitions[M]=F};if("QUERYPARAM"in b.attributes){if("NAME"in b.attributes||"IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const M=this.params.get(b.attributes.QUERYPARAM);if(!M){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${b.attributes.QUERYPARAM}`});return}U(b.attributes.QUERYPARAM,decodeURIComponent(M));return}if("NAME"in b.attributes){if("IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in b.attributes)||typeof b.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${b.attributes.NAME}`});return}U(b.attributes.NAME,b.attributes.VALUE);return}if("IMPORT"in b.attributes){if(!this.mainDefinitions[b.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${b.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}U(b.attributes.IMPORT,this.mainDefinitions[b.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:b.attributes,uri:b.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",b.attributes,["BANDWIDTH","URI"])}}[b.tagType]||c).call(t)},uri(){r.uri=b.uri,n.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),a&&(r.key=a),r.timeline=_,i&&(r.map=i),S=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){b.segment?(r.custom=r.custom||{},r.custom[b.customType]=b.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[b.customType]=b.data)}})[b.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,n){const r=[];n.forEach(function(i){t.hasOwnProperty(i)||r.push(i)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
24
|
-
`),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 cn={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^/},rT=["video","audio","text"],fu=["Video","Audio","Text"],Np=function(s){return s&&s.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){var r=("00"+Number(t).toString(16)).slice(-2),i=("00"+Number(n).toString(16)).slice(-2);return"avc1."+r+"00"+i})},Zt=function(s){s===void 0&&(s="");var e=s.split(","),t=[];return e.forEach(function(n){n=n.trim();var r;rT.forEach(function(i){var a=cn[i].exec(n.toLowerCase());if(!(!a||a.length<=1)){r=i;var o=n.substring(0,a[1].length),c=n.replace(o,"");t.push({type:o,details:c,mediaType:i})}}),r||t.push({type:n,details:"",mediaType:"unknown"})}),t},iT=function(s,e){if(!s.mediaGroups.AUDIO||!e)return null;var t=s.mediaGroups.AUDIO[e];if(!t)return null;for(var n in t){var r=t[n];if(r.default&&r.playlists)return Zt(r.playlists[0].attributes.CODECS)}return null},Op=function(s){return s===void 0&&(s=""),cn.audio.test(s.trim().toLowerCase())},aT=function(s){return s===void 0&&(s=""),cn.text.test(s.trim().toLowerCase())},Xn=function(s){if(!(!s||typeof s!="string")){var e=s.toLowerCase().split(",").map(function(r){return Np(r.trim())}),t="video";e.length===1&&Op(e[0])?t="audio":e.length===1&&aT(e[0])&&(t="application");var n="mp4";return e.every(function(r){return cn.mp4.test(r)})?n="mp4":e.every(function(r){return cn.webm.test(r)})?n="webm":e.every(function(r){return cn.ogg.test(r)})&&(n="ogg"),t+"/"+n+';codecs="'+s+'"'}},ei=function(s,e){return s===void 0&&(s=""),e===void 0&&(e=!1),I.MediaSource&&I.MediaSource.isTypeSupported&&I.MediaSource.isTypeSupported(Xn(s))||e&&I.ManagedMediaSource&&I.ManagedMediaSource.isTypeSupported&&I.ManagedMediaSource.isTypeSupported(Xn(s))||!1},el=function(s){return s===void 0&&(s=""),s.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<fu.length;t++){var n=fu[t];if(cn["muxer"+n].test(e))return!0}return!1})},gu="mp4a.40.2",oT="avc1.4d400d",lT=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,cT=/^application\/dash\+xml/i,Mp=function(s){return lT.test(s)?"hls":cT.test(s)?"dash":s==="application/vnd.videojs.vhs+json"?"vhs-json":null},dT=function(s){return s.toString(2).length},uT=function(s){return Math.ceil(dT(s)/8)},Up=function(s){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer},hT=function(s){return Up(s)},ie=function(s){return s instanceof Uint8Array?s:(!Array.isArray(s)&&!hT(s)&&!(s instanceof ArrayBuffer)&&(typeof s!="number"||typeof s=="number"&&s!==s?s=0:s=[s]),new Uint8Array(s&&s.buffer||s,s&&s.byteOffset||0,s&&s.byteLength||0))},nt=I.BigInt||Number,Sl=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var pT=function(s,e){var t=e===void 0?{}:e,n=t.signed,r=n===void 0?!1:n,i=t.le,a=i===void 0?!1:i;s=ie(s);var o=a?"reduce":"reduceRight",c=s[o]?s[o]:Array.prototype[o],h=c.call(s,function(_,T,S){var w=a?S:Math.abs(S+1-s.length);return _+nt(T)*Sl[w]},nt(0));if(r){var m=Sl[s.length]/nt(2)-nt(1);h=nt(h),h>m&&(h-=m,h-=m,h-=nt(2))}return Number(h)},mT=function(s,e){var t={},n=t.le,r=n===void 0?!1:n;(typeof s!="bigint"&&typeof s!="number"||typeof s=="number"&&s!==s)&&(s=0),s=nt(s);for(var i=uT(s),a=new Uint8Array(new ArrayBuffer(i)),o=0;o<i;o++){var c=r?o:Math.abs(o+1-a.length);a[c]=Number(s/Sl[o]&nt(255)),s<0&&(a[c]=Math.abs(~a[c]),a[c]-=o===0?1:2)}return a},Bp=function(s,e){if(typeof s!="string"&&s&&typeof s.toString=="function"&&(s=s.toString()),typeof s!="string")return new Uint8Array;e||(s=unescape(encodeURIComponent(s)));for(var t=new Uint8Array(s.length),n=0;n<s.length;n++)t[n]=s.charCodeAt(n);return t},fT=function(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return ie(e[0]);var n=e.reduce(function(a,o,c){return a+(o.byteLength||o.length)},0),r=new Uint8Array(n),i=0;return e.forEach(function(a){a=ie(a),r.set(a,i),i+=a.byteLength}),r},Ue=function(s,e,t){var n=t===void 0?{}:t,r=n.offset,i=r===void 0?0:r,a=n.mask,o=a===void 0?[]:a;s=ie(s),e=ie(e);var c=e.every?e.every:Array.prototype.every;return e.length&&s.length-i>=e.length&&c.call(e,function(h,m){var _=o[m]?o[m]&s[i+m]:s[i+m];return h===_})},gT=function(s,e,t){e.forEach(function(n){for(var r in s.mediaGroups[n])for(var i in s.mediaGroups[n][r]){var a=s.mediaGroups[n][r][i];t(a,n,r,i)}})},Ws={},ks={};function yT(s,e,t){if(t===void 0&&(t=Array.prototype),s&&typeof t.find=="function")return t.find.call(s,e);for(var n=0;n<s.length;n++)if(Object.prototype.hasOwnProperty.call(s,n)){var r=s[n];if(e.call(void 0,r,n,s))return r}}function hc(s,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(s):s}function _T(s,e){if(s===null||typeof s!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=e[t]);return s}var Fp=hc({HTML:"text/html",isHTML:function(s){return s===Fp.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),jp=hc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(s){return s===jp.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ks.assign=_T;ks.find=yT;ks.freeze=hc;ks.MIME_TYPE=Fp;ks.NAMESPACE=jp;var qp=ks,is=qp.find,ai=qp.NAMESPACE;function vT(s){return s!==""}function bT(s){return s?s.split(/[\t\n\f\r ]+/).filter(vT):[]}function TT(s,e){return s.hasOwnProperty(e)||(s[e]=!0),s}function yu(s){if(!s)return[];var e=bT(s);return Object.keys(e.reduce(TT,{}))}function AT(s){return function(e){return s&&s.indexOf(e)!==-1}}function mi(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function wt(s,e){var t=s.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,mi(t,n),s.prototype=t=n}t.constructor!=s&&(typeof s!="function"&&console.error("unknown Class:"+s),t.constructor=s)}var kt={},$t=kt.ELEMENT_NODE=1,Yn=kt.ATTRIBUTE_NODE=2,Ea=kt.TEXT_NODE=3,Vp=kt.CDATA_SECTION_NODE=4,$p=kt.ENTITY_REFERENCE_NODE=5,ST=kt.ENTITY_NODE=6,Hp=kt.PROCESSING_INSTRUCTION_NODE=7,Wp=kt.COMMENT_NODE=8,zp=kt.DOCUMENT_NODE=9,Gp=kt.DOCUMENT_TYPE_NODE=10,Ss=kt.DOCUMENT_FRAGMENT_NODE=11,ET=kt.NOTATION_NODE=12,dt={},et={};dt.INDEX_SIZE_ERR=(et[1]="Index size error",1);dt.DOMSTRING_SIZE_ERR=(et[2]="DOMString size error",2);var At=dt.HIERARCHY_REQUEST_ERR=(et[3]="Hierarchy request error",3);dt.WRONG_DOCUMENT_ERR=(et[4]="Wrong document",4);dt.INVALID_CHARACTER_ERR=(et[5]="Invalid character",5);dt.NO_DATA_ALLOWED_ERR=(et[6]="No data allowed",6);dt.NO_MODIFICATION_ALLOWED_ERR=(et[7]="No modification allowed",7);var Xp=dt.NOT_FOUND_ERR=(et[8]="Not found",8);dt.NOT_SUPPORTED_ERR=(et[9]="Not supported",9);var _u=dt.INUSE_ATTRIBUTE_ERR=(et[10]="Attribute in use",10);dt.INVALID_STATE_ERR=(et[11]="Invalid state",11);dt.SYNTAX_ERR=(et[12]="Syntax error",12);dt.INVALID_MODIFICATION_ERR=(et[13]="Invalid modification",13);dt.NAMESPACE_ERR=(et[14]="Invalid namespace",14);dt.INVALID_ACCESS_ERR=(et[15]="Invalid access",15);function We(s,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,et[s]),this.message=et[s],Error.captureStackTrace&&Error.captureStackTrace(this,We);return t.code=s,e&&(this.message=this.message+": "+e),t}We.prototype=Error.prototype;mi(dt,We);function bs(){}bs.prototype={length:0,item:function(s){return s>=0&&s<this.length?this[s]:null},toString:function(s,e){for(var t=[],n=0;n<this.length;n++)On(this[n],t,s,e);return t.join("")},filter:function(s){return Array.prototype.filter.call(this,s)},indexOf:function(s){return Array.prototype.indexOf.call(this,s)}};function Kn(s,e){this._node=s,this._refresh=e,pc(this)}function pc(s){var e=s._node._inc||s._node.ownerDocument._inc;if(s._inc!==e){var t=s._refresh(s._node);if(am(s,"length",t.length),!s.$$length||t.length<s.$$length)for(var n=t.length;n in s;n++)Object.prototype.hasOwnProperty.call(s,n)&&delete s[n];mi(t,s),s._inc=e}}Kn.prototype.item=function(s){return pc(this),this[s]||null};wt(Kn,bs);function wa(){}function Yp(s,e){for(var t=s.length;t--;)if(s[t]===e)return t}function vu(s,e,t,n){if(n?e[Yp(e,n)]=t:e[e.length++]=t,s){t.ownerElement=s;var r=s.ownerDocument;r&&(n&&Zp(r,s,n),wT(r,s,t))}}function bu(s,e,t){var n=Yp(e,t);if(n>=0){for(var r=e.length-1;n<r;)e[n]=e[++n];if(e.length=r,s){var i=s.ownerDocument;i&&(Zp(i,s,t),t.ownerElement=null)}}else throw new We(Xp,new Error(s.tagName+"@"+t))}wa.prototype={length:0,item:bs.prototype.item,getNamedItem:function(s){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==s)return t}},setNamedItem:function(s){var e=s.ownerElement;if(e&&e!=this._ownerElement)throw new We(_u);var t=this.getNamedItem(s.nodeName);return vu(this._ownerElement,this,s,t),t},setNamedItemNS:function(s){var e=s.ownerElement,t;if(e&&e!=this._ownerElement)throw new We(_u);return t=this.getNamedItemNS(s.namespaceURI,s.localName),vu(this._ownerElement,this,s,t),t},removeNamedItem:function(s){var e=this.getNamedItem(s);return bu(this._ownerElement,this,e),e},removeNamedItemNS:function(s,e){var t=this.getNamedItemNS(s,e);return bu(this._ownerElement,this,t),t},getNamedItemNS:function(s,e){for(var t=this.length;t--;){var n=this[t];if(n.localName==e&&n.namespaceURI==s)return n}return null}};function Kp(){}Kp.prototype={hasFeature:function(s,e){return!0},createDocument:function(s,e,t){var n=new fi;if(n.implementation=this,n.childNodes=new bs,n.doctype=t||null,t&&n.appendChild(t),e){var r=n.createElementNS(s,e);n.appendChild(r)}return n},createDocumentType:function(s,e,t){var n=new to;return n.name=s,n.nodeName=s,n.publicId=e||"",n.systemId=t||"",n}};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(s,e){return ka(this,s,e)},replaceChild:function(s,e){ka(this,s,e,em),e&&this.removeChild(e)},removeChild:function(s){return Jp(this,s)},appendChild:function(s){return this.insertBefore(s,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(s){return El(this.ownerDocument||this,this,s)},normalize:function(){for(var s=this.firstChild;s;){var e=s.nextSibling;e&&e.nodeType==Ea&&s.nodeType==Ea?(this.removeChild(e),s.appendData(e.data)):(s.normalize(),s=e)}},isSupported:function(s,e){return this.ownerDocument.implementation.hasFeature(s,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(s){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===s)return n}e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s];e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function Qp(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||"&#"+s.charCodeAt()+";"}mi(kt,Se);mi(kt,Se.prototype);function oi(s,e){if(e(s))return!0;if(s=s.firstChild)do if(oi(s,e))return!0;while(s=s.nextSibling)}function fi(){this.ownerDocument=this}function wT(s,e,t){s&&s._inc++;var n=t.namespaceURI;n===ai.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Zp(s,e,t,n){s&&s._inc++;var r=t.namespaceURI;r===ai.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function mc(s,e,t){if(s&&s._inc){s._inc++;var n=e.childNodes;if(t)n[n.length++]=t;else{for(var r=e.firstChild,i=0;r;)n[i++]=r,r=r.nextSibling;n.length=i,delete n[n.length]}}}function Jp(s,e){var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:s.firstChild=n,n?n.previousSibling=t:s.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,mc(s.ownerDocument,s),e}function kT(s){return s&&(s.nodeType===Se.DOCUMENT_NODE||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.ELEMENT_NODE)}function CT(s){return s&&(as(s)||fc(s)||Es(s)||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.COMMENT_NODE||s.nodeType===Se.PROCESSING_INSTRUCTION_NODE)}function Es(s){return s&&s.nodeType===Se.DOCUMENT_TYPE_NODE}function as(s){return s&&s.nodeType===Se.ELEMENT_NODE}function fc(s){return s&&s.nodeType===Se.TEXT_NODE}function Tu(s,e){var t=s.childNodes||[];if(is(t,as)||Es(e))return!1;var n=is(t,Es);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function Au(s,e){var t=s.childNodes||[];function n(i){return as(i)&&i!==e}if(is(t,n))return!1;var r=is(t,Es);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function IT(s,e,t){if(!kT(s))throw new We(At,"Unexpected parent node type "+s.nodeType);if(t&&t.parentNode!==s)throw new We(Xp,"child not in parent");if(!CT(e)||Es(e)&&s.nodeType!==Se.DOCUMENT_NODE)throw new We(At,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function xT(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!Tu(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!Tu(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,Es))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element");if(!t&&a)throw new We(At,"Doctype can not be appended since element is present")}}function em(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!Au(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!Au(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,function(o){return Es(o)&&o!==t}))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element")}}function ka(s,e,t,n){IT(s,e,t),s.nodeType===Se.DOCUMENT_NODE&&(n||xT)(s,e,t);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===Ss){var i=e.firstChild;if(i==null)return e;var a=e.lastChild}else i=a=e;var o=t?t.previousSibling:s.lastChild;i.previousSibling=o,a.nextSibling=t,o?o.nextSibling=i:s.firstChild=i,t==null?s.lastChild=a:t.previousSibling=a;do i.parentNode=s;while(i!==a&&(i=i.nextSibling));return mc(s.ownerDocument||s,s),e.nodeType==Ss&&(e.firstChild=e.lastChild=null),e}function LT(s,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=s,e.previousSibling=s.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:s.firstChild=e,s.lastChild=e,mc(s.ownerDocument,s,e),e}fi.prototype={nodeName:"#document",nodeType:zp,doctype:null,documentElement:null,_inc:1,insertBefore:function(s,e){if(s.nodeType==Ss){for(var t=s.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return s}return ka(this,s,e),s.ownerDocument=this,this.documentElement===null&&s.nodeType===$t&&(this.documentElement=s),s},removeChild:function(s){return this.documentElement==s&&(this.documentElement=null),Jp(this,s)},replaceChild:function(s,e){ka(this,s,e,em),s.ownerDocument=this,e&&this.removeChild(e),as(s)&&(this.documentElement=s)},importNode:function(s,e){return im(this,s,e)},getElementById:function(s){var e=null;return oi(this.documentElement,function(t){if(t.nodeType==$t&&t.getAttribute("id")==s)return e=t,!0}),e},getElementsByClassName:function(s){var e=yu(s);return new Kn(this,function(t){var n=[];return e.length>0&&oi(t.documentElement,function(r){if(r!==t&&r.nodeType===$t){var i=r.getAttribute("class");if(i){var a=s===i;if(!a){var o=yu(i);a=e.every(AT(o))}a&&n.push(r)}}}),n})},createElement:function(s){var e=new mn;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new bs;var t=e.attributes=new wa;return t._ownerElement=e,e},createDocumentFragment:function(){var s=new so;return s.ownerDocument=this,s.childNodes=new bs,s},createTextNode:function(s){var e=new gc;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new yc;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new _c;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var t=new bc;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=s,t.nodeValue=t.data=e,t},createAttribute:function(s){var e=new Ca;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new vc;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var t=new mn,n=e.split(":"),r=t.attributes=new wa;return t.childNodes=new bs,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=s,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,r._ownerElement=t,t},createAttributeNS:function(s,e){var t=new Ca,n=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=s,t.specified=!0,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,t}};wt(fi,Se);function mn(){this._nsMap={}}mn.prototype={nodeType:$t,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var t=this.ownerDocument.createAttribute(s);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ss?this.insertBefore(s,null):LT(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);return t&&t.value||""},setAttributeNS:function(s,e,t){var n=this.ownerDocument.createAttributeNS(s,e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new Kn(this,function(e){var t=[];return oi(e,function(n){n!==e&&n.nodeType==$t&&(s==="*"||n.tagName==s)&&t.push(n)}),t})},getElementsByTagNameNS:function(s,e){return new Kn(this,function(t){var n=[];return oi(t,function(r){r!==t&&r.nodeType===$t&&(s==="*"||r.namespaceURI===s)&&(e==="*"||r.localName==e)&&n.push(r)}),n})}};fi.prototype.getElementsByTagName=mn.prototype.getElementsByTagName;fi.prototype.getElementsByTagNameNS=mn.prototype.getElementsByTagNameNS;wt(mn,Se);function Ca(){}Ca.prototype.nodeType=Yn;wt(Ca,Se);function gi(){}gi.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(et[At])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,t){var n=this.data.substring(0,s),r=this.data.substring(s+e);t=n+t+r,this.nodeValue=this.data=t,this.length=t.length}};wt(gi,Se);function gc(){}gc.prototype={nodeName:"#text",nodeType:Ea,splitText:function(s){var e=this.data,t=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};wt(gc,gi);function yc(){}yc.prototype={nodeName:"#comment",nodeType:Wp};wt(yc,gi);function _c(){}_c.prototype={nodeName:"#cdata-section",nodeType:Vp};wt(_c,gi);function to(){}to.prototype.nodeType=Gp;wt(to,Se);function tm(){}tm.prototype.nodeType=ET;wt(tm,Se);function sm(){}sm.prototype.nodeType=ST;wt(sm,Se);function vc(){}vc.prototype.nodeType=$p;wt(vc,Se);function so(){}so.prototype.nodeName="#document-fragment";so.prototype.nodeType=Ss;wt(so,Se);function bc(){}bc.prototype.nodeType=Hp;wt(bc,Se);function nm(){}nm.prototype.serializeToString=function(s,e,t){return rm.call(s,e,t)};Se.prototype.toString=rm;function rm(s,e){var t=[],n=this.nodeType==9&&this.documentElement||this,r=n.prefix,i=n.namespaceURI;if(i&&r==null){var r=n.lookupPrefix(i);if(r==null)var a=[{namespace:i,prefix:null}]}return On(this,t,s,e,a),t.join("")}function Su(s,e,t){var n=s.prefix||"",r=s.namespaceURI;if(!r||n==="xml"&&r===ai.XML||r===ai.XMLNS)return!1;for(var i=t.length;i--;){var a=t[i];if(a.prefix===n)return a.namespace!==r}return!0}function tl(s,e,t){s.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Qp),'"')}function On(s,e,t,n,r){if(r||(r=[]),n)if(s=n(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case $t:var i=s.attributes,a=i.length,o=s.firstChild,c=s.tagName;t=ai.isHTML(s.namespaceURI)||t;var h=c;if(!t&&!s.prefix&&s.namespaceURI){for(var m,_=0;_<i.length;_++)if(i.item(_).name==="xmlns"){m=i.item(_).value;break}if(!m)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.prefix===""&&S.namespace===s.namespaceURI){m=S.namespace;break}}if(m!==s.namespaceURI)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.namespace===s.namespaceURI){S.prefix&&(h=S.prefix+":"+c);break}}}e.push("<",h);for(var w=0;w<a;w++){var b=i.item(w);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var w=0;w<a;w++){var b=i.item(w);if(Su(b,t,r)){var R=b.prefix||"",L=b.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}On(b,e,t,n,r)}if(c===h&&Su(s,t,r)){var R=s.prefix||"",L=s.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}if(o||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(e.push(">"),t&&/^script$/i.test(c))for(;o;)o.data?e.push(o.data):On(o,e,t,n,r.slice()),o=o.nextSibling;else for(;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;e.push("</",h,">")}else e.push("/>");return;case zp:case Ss:for(var o=s.firstChild;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;return;case Yn:return tl(e,s.name,s.value);case Ea:return e.push(s.data.replace(/[<&>]/g,Qp));case Vp:return e.push("<![CDATA[",s.data,"]]>");case Wp:return e.push("<!--",s.data,"-->");case Gp:var U=s.publicId,M=s.systemId;if(e.push("<!DOCTYPE ",s.name),U)e.push(" PUBLIC ",U),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var F=s.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case Hp:return e.push("<?",s.target," ",s.data,"?>");case $p:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function im(s,e,t){var n;switch(e.nodeType){case $t:n=e.cloneNode(!1),n.ownerDocument=s;case Ss:break;case Yn:t=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=s,n.parentNode=null,t)for(var r=e.firstChild;r;)n.appendChild(im(s,r,t)),r=r.nextSibling;return n}function El(s,e,t){var n=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];typeof i!="object"&&i!=n[r]&&(n[r]=i)}switch(e.childNodes&&(n.childNodes=new bs),n.ownerDocument=s,n.nodeType){case $t:var a=e.attributes,o=n.attributes=new wa,c=a.length;o._ownerElement=n;for(var h=0;h<c;h++)n.setAttributeNode(El(s,a.item(h),!0));break;case Yn:t=!0}if(t)for(var m=e.firstChild;m;)n.appendChild(El(s,m,t)),m=m.nextSibling;return n}function am(s,e,t){s[e]=t}try{if(Object.defineProperty){let s=function(e){switch(e.nodeType){case $t:case Ss:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(s(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Kn.prototype,"length",{get:function(){return pc(this),this.$$length}}),Object.defineProperty(Se.prototype,"textContent",{get:function(){return s(this)},set:function(e){switch(this.nodeType){case $t:case Ss: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}}}),am=function(e,t,n){e["$$"+t]=n}}}catch{}Ws.DocumentType=to;Ws.DOMException=We;Ws.DOMImplementation=Kp;Ws.Element=mn;Ws.Node=Se;Ws.NodeList=bs;Ws.XMLSerializer=nm;var no={},om={};(function(s){var e=ks.freeze;s.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),s.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:`
|
|
25
|
-
`,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:""}),s.entityMap=s.HTML_ENTITIES})(om);var Tc={},li=ks.NAMESPACE,wl=/[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]/,Eu=new RegExp("[\\-\\.0-9"+wl.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),wu=new RegExp("^"+wl.source+Eu.source+"*(?::"+wl.source+Eu.source+"*)?$"),Mr=0,Os=1,kn=2,Ur=3,Cn=4,In=5,Br=6,ea=7;function Qn(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}Qn.prototype=new Error;Qn.prototype.name=Qn.name;function lm(){}lm.prototype={parse:function(s,e,t){var n=this.domBuilder;n.startDocument(),cm(e,e={}),PT(s,e,t,n,this.errorHandler),n.endDocument()}};function PT(s,e,t,n,r){function i(G){if(G>65535){G-=65536;var fe=55296+(G>>10),ye=56320+(G&1023);return String.fromCharCode(fe,ye)}else return String.fromCharCode(G)}function a(G){var fe=G.slice(1,-1);return Object.hasOwnProperty.call(t,fe)?t[fe]:fe.charAt(0)==="#"?i(parseInt(fe.substr(1).replace("x","0x"))):(r.error("entity not found:"+G),G)}function o(G){if(G>b){var fe=s.substring(b,G).replace(/&#?\w+;/g,a);T&&c(b),n.characters(fe,0,G-b),b=G}}function c(G,fe){for(;G>=m&&(fe=_.exec(s));)h=fe.index,m=h+fe[0].length,T.lineNumber++;T.columnNumber=G-h+1}for(var h=0,m=0,_=/.*(?:\r\n?|\n)|.*$/g,T=n.locator,S=[{currentNSMap:e}],w={},b=0;;){try{var R=s.indexOf("<",b);if(R<0){if(!s.substr(b).match(/^\s*$/)){var L=n.doc,U=L.createTextNode(s.substr(b));L.appendChild(U),n.currentElement=U}return}switch(R>b&&o(R),s.charAt(R+1)){case"/":var oe=s.indexOf(">",R+3),M=s.substring(R+2,oe).replace(/[ \t\n\r]+$/g,""),F=S.pop();oe<0?(M=s.substring(R+2).replace(/[\s<].*/,""),r.error("end tag name: "+M+" is not complete:"+F.tagName),oe=R+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),r.error("end tag name: "+M+" maybe not complete"),oe=R+1+M.length);var N=F.localNSMap,j=F.tagName==M,J=j||F.tagName&&F.tagName.toLowerCase()==M.toLowerCase();if(J){if(n.endElement(F.uri,F.localName,M),N)for(var K in N)Object.prototype.hasOwnProperty.call(N,K)&&n.endPrefixMapping(K);j||r.fatalError("end tag name: "+M+" is not match the current start tagName:"+F.tagName)}else S.push(F);oe++;break;case"?":T&&c(R),oe=MT(s,R,n);break;case"!":T&&c(R),oe=OT(s,R,n,r);break;default:T&&c(R);var ne=new dm,he=S[S.length-1].currentNSMap,oe=RT(s,R,ne,he,a,r),me=ne.length;if(!ne.closed&&NT(s,oe,ne.tagName,w)&&(ne.closed=!0,t.nbsp||r.warning("unclosed xml attribute")),T&&me){for(var te=ku(T,{}),ue=0;ue<me;ue++){var z=ne[ue];c(z.offset),z.locator=ku(T,{})}n.locator=te,Cu(ne,n,he)&&S.push(ne),n.locator=T}else Cu(ne,n,he)&&S.push(ne);li.isHTML(ne.uri)&&!ne.closed?oe=DT(s,oe,ne.tagName,a,n):oe++}}catch(G){if(G instanceof Qn)throw G;r.error("element parse error: "+G),oe=-1}oe>b?b=oe:o(Math.max(R,b)+1)}}function ku(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function RT(s,e,t,n,r,i){function a(T,S,w){t.attributeNames.hasOwnProperty(T)&&i.fatalError("Attribute "+T+" redefined"),t.addValue(T,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),w)}for(var o,c,h=++e,m=Mr;;){var _=s.charAt(h);switch(_){case"=":if(m===Os)o=s.slice(e,h),m=Ur;else if(m===kn)m=Ur;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(m===Ur||m===Os)if(m===Os&&(i.warning('attribute value must after "="'),o=s.slice(e,h)),e=h+1,h=s.indexOf(_,e),h>0)c=s.slice(e,h),a(o,c,e-1),m=In;else throw new Error("attribute value no end '"+_+"' match");else if(m==Cn)c=s.slice(e,h),a(o,c,e),i.warning('attribute "'+o+'" missed start quot('+_+")!!"),e=h+1,m=In;else throw new Error('attribute value must after "="');break;case"/":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:m=ea,t.closed=!0;case Cn:case Os:break;case kn:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),m==Mr&&t.setTagName(s.slice(e,h)),h;case">":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:break;case Cn:case Os:c=s.slice(e,h),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case kn:m===kn&&(c=o),m==Cn?(i.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):((!li.isHTML(n[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case Ur:throw new Error("attribute value missed!!")}return h;case"":_=" ";default:if(_<=" ")switch(m){case Mr:t.setTagName(s.slice(e,h)),m=Br;break;case Os:o=s.slice(e,h),m=kn;break;case Cn:var c=s.slice(e,h);i.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case In:m=Br;break}else switch(m){case kn:t.tagName,(!li.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,m=Os;break;case In:i.warning('attribute space is required"'+o+'"!!');case Br:m=Os,e=h;break;case Ur:m=Cn,e=h;break;case ea:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function Cu(s,e,t){for(var n=s.tagName,r=null,i=s.length;i--;){var a=s[i],o=a.qName,c=a.value,T=o.indexOf(":");if(T>0)var h=a.prefix=o.slice(0,T),m=o.slice(T+1),_=h==="xmlns"&&m;else m=o,h=null,_=o==="xmlns"&&"";a.localName=m,_!==!1&&(r==null&&(r={},cm(t,t={})),t[_]=r[_]=c,a.uri=li.XMLNS,e.startPrefixMapping(_,c))}for(var i=s.length;i--;){a=s[i];var h=a.prefix;h&&(h==="xml"&&(a.uri=li.XML),h!=="xmlns"&&(a.uri=t[h||""]))}var T=n.indexOf(":");T>0?(h=s.prefix=n.slice(0,T),m=s.localName=n.slice(T+1)):(h=null,m=s.localName=n);var S=s.uri=t[h||""];if(e.startElement(S,m,n,s),s.closed){if(e.endElement(S,m,n),r)for(h in r)Object.prototype.hasOwnProperty.call(r,h)&&e.endPrefixMapping(h)}else return s.currentNSMap=t,s.localNSMap=r,!0}function DT(s,e,t,n,r){if(/^(?:script|textarea)$/i.test(t)){var i=s.indexOf("</"+t+">",e),a=s.substring(e+1,i);if(/[&<]/.test(a))return/^script$/i.test(t)?(r.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),i)}return e+1}function NT(s,e,t,n){var r=n[t];return r==null&&(r=s.lastIndexOf("</"+t+">"),r<e&&(r=s.lastIndexOf("</"+t)),n[t]=r),r<e}function cm(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function OT(s,e,t,n){var r=s.charAt(e+2);switch(r){case"-":if(s.charAt(e+3)==="-"){var i=s.indexOf("-->",e+4);return i>e?(t.comment(s,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var i=s.indexOf("]]>",e+9);return t.startCDATA(),t.characters(s,e+9,i-e-9),t.endCDATA(),i+3}var a=UT(s,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var c=a[1][0],h=!1,m=!1;o>3&&(/^public$/i.test(a[2][0])?(h=a[3][0],m=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(m=a[3][0]));var _=a[o-1];return t.startDTD(c,h,m),t.endDTD(),_.index+_[0].length}}return-1}function MT(s,e,t){var n=s.indexOf("?>",e);if(n){var r=s.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,t.processingInstruction(r[1],r[2]),n+2):-1}return-1}function dm(){this.attributeNames={}}dm.prototype={setTagName:function(s){if(!wu.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,t){if(!wu.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:t}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function UT(s,e){var t,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(s);t=r.exec(s);)if(n.push(t),t[1])return n}Tc.XMLReader=lm;Tc.ParseError=Qn;var BT=ks,FT=Ws,Iu=om,um=Tc,jT=FT.DOMImplementation,xu=BT.NAMESPACE,qT=um.ParseError,VT=um.XMLReader;function hm(s){return s.replace(/\r[\n\u0085]/g,`
|
|
26
|
-
`).replace(/[\r\u0085\u2028]/g,`
|
|
27
|
-
`)}function pm(s){this.options=s||{locator:{}}}pm.prototype.parseFromString=function(s,e){var t=this.options,n=new VT,r=t.domBuilder||new yi,i=t.errorHandler,a=t.locator,o=t.xmlns||{},c=/\/x?html?$/.test(e),h=c?Iu.HTML_ENTITIES:Iu.XML_ENTITIES;a&&r.setDocumentLocator(a),n.errorHandler=$T(i,r,a),n.domBuilder=t.domBuilder||r,c&&(o[""]=xu.HTML),o.xml=o.xml||xu.XML;var m=t.normalizeLineEndings||hm;return s&&typeof s=="string"?n.parse(m(s),o,h):n.errorHandler.error("invalid doc source"),r.doc};function $T(s,e,t){if(!s){if(e instanceof yi)return e;s=e}var n={},r=s instanceof Function;t=t||{};function i(a){var o=s[a];!o&&r&&(o=s.length==2?function(c){s(a,c)}:s),n[a]=o&&function(c){o("[xmldom "+a+"] "+c+kl(t))}||function(){}}return i("warning"),i("error"),i("fatalError"),n}function yi(){this.cdata=!1}function xn(s,e){e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber}yi.prototype={startDocument:function(){this.doc=new jT().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(s,e,t,n){var r=this.doc,i=r.createElementNS(s,t||e),a=n.length;ta(this,i),this.currentElement=i,this.locator&&xn(this.locator,i);for(var o=0;o<a;o++){var s=n.getURI(o),c=n.getValue(o),t=n.getQName(o),h=r.createAttributeNS(s,t);this.locator&&xn(n.getLocator(o),h),h.value=h.nodeValue=c,i.setAttributeNode(h)}},endElement:function(s,e,t){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(s,e){},endPrefixMapping:function(s){},processingInstruction:function(s,e){var t=this.doc.createProcessingInstruction(s,e);this.locator&&xn(this.locator,t),ta(this,t)},ignorableWhitespace:function(s,e,t){},characters:function(s,e,t){if(s=Lu.apply(this,arguments),s){if(this.cdata)var n=this.doc.createCDATASection(s);else var n=this.doc.createTextNode(s);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(s)&&this.doc.appendChild(n),this.locator&&xn(this.locator,n)}},skippedEntity:function(s){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(s){(this.locator=s)&&(s.lineNumber=0)},comment:function(s,e,t){s=Lu.apply(this,arguments);var n=this.doc.createComment(s);this.locator&&xn(this.locator,n),ta(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(s,e,t){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(s,e,t);this.locator&&xn(this.locator,r),ta(this,r),this.doc.doctype=r}},warning:function(s){console.warn("[xmldom warning] "+s,kl(this.locator))},error:function(s){console.error("[xmldom error] "+s,kl(this.locator))},fatalError:function(s){throw new qT(s,this.locator)}};function kl(s){if(s)return`
|
|
28
|
-
@`+(s.systemId||"")+"#[line:"+s.lineNumber+",col:"+s.columnNumber+"]"}function Lu(s,e,t){return typeof s=="string"?s.substr(e,t):s.length>=e+t||e?new java.lang.String(s,e,t)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){yi.prototype[s]=function(){return null}});function ta(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}no.__DOMHandler=yi;no.normalizeLineEndings=hm;no.DOMParser=pm;var mm=no.DOMParser;const HT=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:mm},Symbol.toStringTag,{value:"Module"}));/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const Pu=s=>!!s&&typeof s=="object",Je=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(n=>{Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):Pu(e[n])&&Pu(t[n])?e[n]=Je(e[n],t[n]):e[n]=t[n]}),e),{}),fm=s=>Object.keys(s).map(e=>s[e]),WT=(s,e)=>{const t=[];for(let n=s;n<e;n++)t.push(n);return t},Zn=s=>s.reduce((e,t)=>e.concat(t),[]),gm=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},zT=(s,e)=>s.reduce((t,n,r)=>(n[e]&&t.push(r),t),[]),GT=(s,e)=>fm(s.reduce((t,n)=>(n.forEach(r=>{t[e(r)]=r}),t),{}));var Jn={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 ci=({baseUrl:s="",source:e="",range:t="",indexRange:n=""})=>{const r={uri:e,resolvedUri:Ja(s||"",e)};if(t||n){const i=(t||n).split("-");let a=I.BigInt?I.BigInt(i[0]):parseInt(i[0],10),o=I.BigInt?I.BigInt(i[1]):parseInt(i[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o));let c;typeof o=="bigint"||typeof a=="bigint"?c=I.BigInt(o)-I.BigInt(a)+I.BigInt(1):c=o-a+1,typeof c=="bigint"&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),r.byterange={length:c,offset:a}}return r},XT=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},Ru=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),YT={static(s){const{duration:e,timescale:t=1,sourceDuration:n,periodDuration:r}=s,i=Ru(s.endNumber),a=e/t;return typeof i=="number"?{start:0,end:i}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:n/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:n,timescale:r=1,duration:i,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:c=1/0}=s,h=Ru(s.endNumber),m=(e+t)/1e3,_=n+a,T=m+o-_,S=Math.ceil(T*r/i),w=Math.floor((m-_-c)*r/i),b=Math.floor((m-_)*r/i);return{start:Math.max(0,w),end:typeof h=="number"?h:Math.min(S,b)}}},KT=s=>e=>{const{duration:t,timescale:n=1,periodStart:r,startNumber:i=1}=s;return{number:i+e,duration:t/n,timeline:r,time:e*t}},Ac=s=>{const{type:e,duration:t,timescale:n=1,periodDuration:r,sourceDuration:i}=s,{start:a,end:o}=YT[e](s),c=WT(a,o).map(KT(s));if(e==="static"){const h=c.length-1,m=typeof r=="number"?r:i;c[h].duration=m-t/n*h}return c},ym=s=>{const{baseUrl:e,initialization:t={},sourceDuration:n,indexRange:r="",periodStart:i,presentationTime:a,number:o=0,duration:c}=s;if(!e)throw new Error(Jn.NO_BASE_URL);const h=ci({baseUrl:e,source:t.sourceURL,range:t.range}),m=ci({baseUrl:e,source:e,indexRange:r});if(m.map=h,c){const _=Ac(s);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else n&&(m.duration=n,m.timeline=i);return m.presentationTime=a||i,m.number=o,[m]},Sc=(s,e,t)=>{const n=s.sidx.map?s.sidx.map:null,r=s.sidx.duration,i=s.timeline||0,a=s.sidx.byterange,o=a.offset+a.length,c=e.timescale,h=e.references.filter(R=>R.referenceType!==1),m=[],_=s.endList?"static":"dynamic",T=s.sidx.timeline;let S=T,w=s.mediaSequence||0,b;typeof e.firstOffset=="bigint"?b=I.BigInt(o)+e.firstOffset:b=o+e.firstOffset;for(let R=0;R<h.length;R++){const L=e.references[R],U=L.referencedSize,M=L.subsegmentDuration;let F;typeof b=="bigint"?F=b+I.BigInt(U)-I.BigInt(1):F=b+U-1;const N=`${b}-${F}`,j=ym({baseUrl:t,timescale:c,timeline:i,periodStart:T,presentationTime:S,number:w,duration:M,sourceDuration:r,indexRange:N,type:_})[0];n&&(j.map=n),m.push(j),typeof b=="bigint"?b+=I.BigInt(U):b+=U,S+=M/c,w++}return s.segments=m,s},QT=["AUDIO","SUBTITLES"],ZT=1/60,_m=s=>GT(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),JT=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Du=s=>{let e=[];return gT(s,QT,(t,n,r,i)=>{e=e.concat(t.playlists||[])}),e},Nu=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,n)=>{t.number=s.mediaSequence+n})},e1=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(n=>{n.discontinuitySequence=t.findIndex(function({timeline:o}){return o===n.timeline});const r=JT(s,n.attributes.NAME);if(!r||n.sidx)return;const i=n.segments[0],a=r.segments.findIndex(function(o){return Math.abs(o.presentationTime-i.presentationTime)<ZT});if(a===-1){Nu({playlist:n,mediaSequence:r.mediaSequence+r.segments.length}),n.segments[0].discontinuity=!0,n.discontinuityStarts.unshift(0),(!r.segments.length&&n.timeline>r.timeline||r.segments.length&&n.timeline>r.segments[r.segments.length-1].timeline)&&n.discontinuitySequence--;return}r.segments[a].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),Nu({playlist:n,mediaSequence:r.segments[a].number})})},t1=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Du(s)),n=e.playlists.concat(Du(e));return e.timelineStarts=_m([s.timelineStarts,e.timelineStarts]),e1({oldPlaylists:t,newPlaylists:n,timelineStarts:e.timelineStarts}),e},ro=s=>s&&s.uri+"-"+XT(s.byterange),sl=s=>{const e=s.reduce(function(n,r){return n[r.attributes.baseUrl]||(n[r.attributes.baseUrl]=[]),n[r.attributes.baseUrl].push(r),n},{});let t=[];return Object.values(e).forEach(n=>{const r=fm(n.reduce((i,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return i[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),i[o].segments.push(...a.segments)),a.attributes.contentProtection&&(i[o].attributes.contentProtection=a.attributes.contentProtection)):(i[o]=a,i[o].attributes.timelineStarts=[]),i[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),i},{}));t=t.concat(r)}),t.map(n=>(n.discontinuityStarts=zT(n.segments||[],"discontinuity"),n))},Ec=(s,e)=>{const t=ro(s.sidx),n=t&&e[t]&&e[t].sidx;return n&&Sc(s,n,s.sidx.resolvedUri),s},s1=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Ec(s[t],e);return s},n1=({attributes:s,segments:e,sidx:t,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:i},a)=>{const o={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:r,discontinuityStarts:i,timelineStarts:s.timelineStarts,mediaSequence:n,segments:e};return s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},r1=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:n,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const i={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(i.CODECS=s.codecs);const a={attributes:i,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:n,discontinuitySequence:r,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},i1=(s,e={},t=!1)=>{let n;const r=s.reduce((i,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let h=a.attributes.label||"main";if(c&&!a.attributes.label){const _=o?` (${o})`:"";h=`${a.attributes.lang}${_}`}i[h]||(i[h]={language:c,autoselect:!0,default:o==="main",playlists:[],uri:""});const m=Ec(n1(a,t),e);return i[h].playlists.push(m),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),i},{});if(!n){const i=Object.keys(r)[0];r[i].default=!0}return r},a1=(s,e={})=>s.reduce((t,n)=>{const r=n.attributes.label||n.attributes.lang||"text",i=n.attributes.lang||"und";return t[r]||(t[r]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(Ec(r1(n),e)),t},{}),o1=s=>s.reduce((e,t)=>(t&&t.forEach(n=>{const{channel:r,language:i}=n;e[i]={autoselect:!1,default:!1,instreamId:r,language:i},n.hasOwnProperty("aspectRatio")&&(e[i].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[i].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[i]["3D"]=n["3D"])}),e),{}),l1=({attributes:s,segments:e,sidx:t,discontinuityStarts:n})=>{const r={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:n,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(r.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(r.contentProtection=s.contentProtection),s.serviceLocation&&(r.attributes.serviceLocation=s.serviceLocation),t&&(r.sidx=t),r},c1=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",d1=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",u1=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",h1=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:n}){return n===t.timeline}),t.segments&&t.segments.forEach((n,r)=>{n.number=r})})},Ou=s=>s?Object.keys(s).reduce((e,t)=>{const n=s[t];return e.concat(n.playlists)},[]):[],p1=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:n={},previousManifest:r,eventStream:i})=>{if(!s.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=s[0].attributes,m=sl(s.filter(c1)).map(l1),_=sl(s.filter(d1)),T=sl(s.filter(u1)),S=s.map(F=>F.attributes.captionServices).filter(Boolean),w={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:s1(m,n)};h>=0&&(w.minimumUpdatePeriod=h*1e3),e&&(w.locations=e),t&&(w.contentSteering=t),o==="dynamic"&&(w.suggestedPresentationDelay=c),i&&i.length>0&&(w.eventStream=i);const b=w.playlists.length===0,R=_.length?i1(_,n,b):null,L=T.length?a1(T,n):null,U=m.concat(Ou(R),Ou(L)),M=U.map(({timelineStarts:F})=>F);return w.timelineStarts=_m(M),h1(U,w.timelineStarts),R&&(w.mediaGroups.AUDIO.audio=R),L&&(w.mediaGroups.SUBTITLES.subs=L),S.length&&(w.mediaGroups["CLOSED-CAPTIONS"].cc=o1(S)),r?t1({oldManifest:r,newManifest:w}):w},m1=(s,e,t)=>{const{NOW:n,clientOffset:r,availabilityStartTime:i,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:c=0}=s,h=(n+r)/1e3,m=i+o,_=h+c-m;return Math.ceil((_*a-e)/t)},vm=(s,e)=>{const{type:t,minimumUpdatePeriod:n=0,media:r="",sourceDuration:i,timescale:a=1,startNumber:o=1,periodStart:c}=s,h=[];let m=-1;for(let _=0;_<e.length;_++){const T=e[_],S=T.d,w=T.r||0,b=T.t||0;m<0&&(m=b),b&&b>m&&(m=b);let R;if(w<0){const M=_+1;M===e.length?t==="dynamic"&&n>0&&r.indexOf("$Number$")>0?R=m1(s,m,S):R=(i*a-m)/S:R=(e[M].t-m)/S}else R=w+1;const L=o+h.length+R;let U=o+h.length;for(;U<L;)h.push({number:U,duration:S/a,time:m,timeline:c}),m+=S,U++}return h},f1=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,g1=s=>(e,t,n,r)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const i=""+s[t];return t==="RepresentationID"||(n?r=parseInt(r,10):r=1,i.length>=r)?i:`${new Array(r-i.length+1).join("0")}${i}`},Mu=(s,e)=>s.replace(f1,g1(e)),y1=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Ac(s):vm(s,e),_1=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=s,r=ci({baseUrl:s.baseUrl,source:Mu(n.sourceURL,t),range:n.range});return y1(s,e).map(i=>{t.Number=i.number,t.Time=i.time;const a=Mu(s.media||"",t),o=s.timescale||1,c=s.presentationTimeOffset||0,h=s.periodStart+(i.time-c)/o;return{uri:a,timeline:i.timeline,duration:i.duration,resolvedUri:Ja(s.baseUrl||"",a),map:r,number:i.number,presentationTime:h}})},v1=(s,e)=>{const{baseUrl:t,initialization:n={}}=s,r=ci({baseUrl:t,source:n.sourceURL,range:n.range}),i=ci({baseUrl:t,source:e.media,range:e.mediaRange});return i.map=r,i},b1=(s,e)=>{const{duration:t,segmentUrls:n=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(Jn.SEGMENT_TIME_UNSPECIFIED);const i=n.map(o=>v1(s,o));let a;return t&&(a=Ac(s)),e&&(a=vm(s,e)),a.map((o,c)=>{if(i[c]){const h=i[c],m=s.timescale||1,_=s.presentationTimeOffset||0;return h.timeline=o.timeline,h.duration=o.duration,h.number=o.number,h.presentationTime=r+(o.time-_)/m,h}}).filter(o=>o)},T1=({attributes:s,segmentInfo:e})=>{let t,n;e.template?(n=_1,t=Je(s,e.template)):e.base?(n=ym,t=Je(s,e.base)):e.list&&(n=b1,t=Je(s,e.list));const r={attributes:s};if(!n)return r;const i=n(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else i.length?t.duration=i.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return r.attributes=t,r.segments=i,e.base&&t.indexRange&&(r.sidx=i[0],r.segments=[]),r},A1=s=>s.map(T1),Be=(s,e)=>gm(s.childNodes).filter(({tagName:t})=>t===e),_i=s=>s.textContent.trim(),S1=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Ln=s=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!e)return 0;const[t,n,r,i,a,o]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(n||0)*2592e3+parseFloat(r||0)*86400+parseFloat(i||0)*3600+parseFloat(a||0)*60+parseFloat(o||0)},E1=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Uu={mediaPresentationDuration(s){return Ln(s)},availabilityStartTime(s){return E1(s)/1e3},minimumUpdatePeriod(s){return Ln(s)},suggestedPresentationDelay(s){return Ln(s)},type(s){return s},timeShiftBufferDepth(s){return Ln(s)},start(s){return Ln(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return S1(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Ln(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Ge=s=>s&&s.attributes?gm(s.attributes).reduce((e,t)=>{const n=Uu[t.name]||Uu.DEFAULT;return e[t.name]=n(t.value),e},{}):{},w1={"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"},io=(s,e)=>e.length?Zn(s.map(function(t){return e.map(function(n){const r=_i(n),i=Ja(t.baseUrl,r),a=Je(Ge(n),{baseUrl:i});return i!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,wc=s=>{const e=Be(s,"SegmentTemplate")[0],t=Be(s,"SegmentList")[0],n=t&&Be(t,"SegmentURL").map(_=>Je({tag:"SegmentURL"},Ge(_))),r=Be(s,"SegmentBase")[0],i=t||e,a=i&&Be(i,"SegmentTimeline")[0],o=t||r||e,c=o&&Be(o,"Initialization")[0],h=e&&Ge(e);h&&c?h.initialization=c&&Ge(c):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});const m={template:h,segmentTimeline:a&&Be(a,"S").map(_=>Ge(_)),list:t&&Je(Ge(t),{segmentUrls:n,initialization:Ge(c)}),base:r&&Je(Ge(r),{initialization:Ge(c)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},k1=(s,e,t)=>n=>{const r=Be(n,"BaseURL"),i=io(e,r),a=Je(s,Ge(n)),o=wc(n);return i.map(c=>({segmentInfo:Je(t,o),attributes:Je(a,c)}))},C1=s=>s.reduce((e,t)=>{const n=Ge(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const r=w1[n.schemeIdUri];if(r){e[r]={attributes:n};const i=Be(t,"cenc:pssh")[0];if(i){const a=_i(i);e[r].pssh=a&&Dp(a)}}return e},{}),I1=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{let t,n;return n=e,/^CC\d=/.test(e)?[t,n]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[n,r=""]=e.split("=");t.channel=n,t.language=e,r.split(",").forEach(i=>{const[a,o]=i.split(":");a==="lang"?t.language=o:a==="er"?t.easyReader=Number(o):a==="war"?t.aspectRatio=Number(o):a==="3D"&&(t["3D"]=Number(o))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},x1=s=>Zn(Be(s.node,"EventStream").map(e=>{const t=Ge(e),n=t.schemeIdUri;return Be(e,"Event").map(r=>{const i=Ge(r),a=i.presentationTime||0,o=t.timescale||1,c=i.duration||0,h=a/o+s.attributes.start;return{schemeIdUri:n,value:t.value,id:i.id,start:h,end:h+c/o,messageData:_i(r)||i.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),L1=(s,e,t)=>n=>{const r=Ge(n),i=io(e,Be(n,"BaseURL")),a=Be(n,"Role")[0],o={role:Ge(a)};let c=Je(s,r,o);const h=Be(n,"Accessibility")[0],m=I1(Ge(h));m&&(c=Je(c,{captionServices:m}));const _=Be(n,"Label")[0];if(_&&_.childNodes.length){const R=_.childNodes[0].nodeValue.trim();c=Je(c,{label:R})}const T=C1(Be(n,"ContentProtection"));Object.keys(T).length&&(c=Je(c,{contentProtection:T}));const S=wc(n),w=Be(n,"Representation"),b=Je(t,S);return Zn(w.map(k1(c,i,b)))},P1=(s,e)=>(t,n)=>{const r=io(e,Be(t.node,"BaseURL")),i=Je(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(i.periodDuration=t.attributes.duration);const a=Be(t.node,"AdaptationSet"),o=wc(t.node);return Zn(a.map(L1(i,r,o)))},R1=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const t=Je({serverURL:_i(s[0])},Ge(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},D1=({attributes:s,priorPeriodAttributes:e,mpdType:t})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,N1=(s,e={})=>{const{manifestUri:t="",NOW:n=Date.now(),clientOffset:r=0,eventHandler:i=function(){}}=e,a=Be(s,"Period");if(!a.length)throw new Error(Jn.INVALID_NUMBER_OF_PERIOD);const o=Be(s,"Location"),c=Ge(s),h=io([{baseUrl:t}],Be(s,"BaseURL")),m=Be(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=n,c.clientOffset=r,o.length&&(c.locations=o.map(_i));const _=[];return a.forEach((T,S)=>{const w=Ge(T),b=_[S-1];w.start=D1({attributes:w,priorPeriodAttributes:b?b.attributes:null,mpdType:c.type}),_.push({node:T,attributes:w})}),{locations:c.locations,contentSteeringInfo:R1(m,i),representationInfo:Zn(_.map(P1(c,h))),eventStream:Zn(_.map(x1))}},bm=s=>{if(s==="")throw new Error(Jn.DASH_EMPTY_MANIFEST);const e=new mm;let t,n;try{t=e.parseFromString(s,"application/xml"),n=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Jn.DASH_INVALID_XML);return n},O1=s=>{const e=Be(s,"UTCTiming")[0];if(!e)return null;const t=Ge(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(Jn.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},M1=(s,e={})=>{const t=N1(bm(s),e),n=A1(t.representationInfo);return p1({dashPlaylists:n,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},U1=s=>O1(bm(s));var Tm=Math.pow(2,32),B1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*Tm+e.getUint32(4)},F1={getUint64:B1,MAX_UINT32:Tm},Bu=F1.getUint64,j1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t={version:s[0],flags:new Uint8Array(s.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;t.version===0?(t.earliestPresentationTime=e.getUint32(n),t.firstOffset=e.getUint32(n+4),n+=8):(t.earliestPresentationTime=Bu(s.subarray(n)),t.firstOffset=Bu(s.subarray(n+8)),n+=16),n+=2;var r=e.getUint16(n);for(n+=2;r>0;n+=12,r--)t.references.push({referenceType:(s[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(s[n+8]&128),sapType:(s[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return t},q1=j1;const V1=or(q1);var $1=ie([73,68,51]),H1=function(s,e){e===void 0&&(e=0),s=ie(s);var t=s[e+5],n=s[e+6]<<21|s[e+7]<<14|s[e+8]<<7|s[e+9],r=(t&16)>>4;return r?n+20:n+10},Wr=function s(e,t){return t===void 0&&(t=0),e=ie(e),e.length-t<10||!Ue(e,$1,{offset:t})?t:(t+=H1(e,t),s(e,t))},Fu=function(s){return typeof s=="string"?Bp(s):s},W1=function(s){return Array.isArray(s)?s.map(function(e){return Fu(e)}):[Fu(s)]},z1=function s(e,t,n){n===void 0&&(n=!1),t=W1(t),e=ie(e);var r=[];if(!t.length)return r;for(var i=0;i<e.length;){var a=(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])>>>0,o=e.subarray(i+4,i+8);if(a===0)break;var c=i+a;if(c>e.length){if(n)break;c=e.length}var h=e.subarray(i+8,c);Ue(o,t[0])&&(t.length===1?r.push(h):r.push.apply(r,s(h,t.slice(1),n))),i=c}return r},sa={EBML:ie([26,69,223,163]),DocType:ie([66,130]),Segment:ie([24,83,128,103]),SegmentInfo:ie([21,73,169,102]),Tracks:ie([22,84,174,107]),Track:ie([174]),TrackNumber:ie([215]),DefaultDuration:ie([35,227,131]),TrackEntry:ie([174]),TrackType:ie([131]),FlagDefault:ie([136]),CodecID:ie([134]),CodecPrivate:ie([99,162]),VideoTrack:ie([224]),AudioTrack:ie([225]),Cluster:ie([31,67,182,117]),Timestamp:ie([231]),TimestampScale:ie([42,215,177]),BlockGroup:ie([160]),BlockDuration:ie([155]),Block:ie([161]),SimpleBlock:ie([163])},Cl=[128,64,32,16,8,4,2,1],G1=function(s){for(var e=1,t=0;t<Cl.length&&!(s&Cl[t]);t++)e++;return e},Ia=function(s,e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1);var r=G1(s[e]),i=s.subarray(e,e+r);return t&&(i=Array.prototype.slice.call(s,e,e+r),i[0]^=Cl[r-1]),{length:r,value:pT(i,{signed:n}),bytes:i}},ju=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?mT(e):e},X1=function(s){return Array.isArray(s)?s.map(function(e){return ju(e)}):[ju(s)]},Y1=function s(e,t,n){if(n>=t.length)return t.length;var r=Ia(t,n,!1);if(Ue(e.bytes,r.bytes))return n;var i=Ia(t,n+r.length);return s(e,t,n+i.length+i.value+r.length)},qu=function s(e,t){t=X1(t),e=ie(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var i=Ia(e,r,!1),a=Ia(e,r+i.length),o=r+i.length+a.length;a.value===127&&(a.value=Y1(i,e,o),a.value!==e.length&&(a.value-=o));var c=o+a.value>e.length?e.length:o+a.value,h=e.subarray(o,c);Ue(t[0],i.bytes)&&(t.length===1?n.push(h):n=n.concat(s(h,t.slice(1))));var m=i.length+a.length+h.length;r+=m}return n},K1=ie([0,0,0,1]),Q1=ie([0,0,1]),Z1=ie([0,0,3]),J1=function(s){for(var e=[],t=1;t<s.length-2;)Ue(s.subarray(t,t+3),Z1)&&(e.push(t+2),t++),t++;if(e.length===0)return s;var n=s.length-e.length,r=new Uint8Array(n),i=0;for(t=0;t<n;i++,t++)i===e[0]&&(i++,e.shift()),r[t]=s[i];return r},Am=function(s,e,t,n){s=ie(s),t=[].concat(t);for(var r=0,i,a=0;r<s.length&&(a<n||i);){var o=void 0;if(Ue(s.subarray(r),K1)?o=4:Ue(s.subarray(r),Q1)&&(o=3),!o){r++;continue}if(a++,i)return J1(s.subarray(i,r));var c=void 0;e==="h264"?c=s[r+o]&31:e==="h265"&&(c=s[r+o]>>1&63),t.indexOf(c)!==-1&&(i=r+o),r+=o+(e==="h264"?1:2)}return s.subarray(0,0)},eA=function(s,e,t){return Am(s,"h264",e,t)},tA=function(s,e,t){return Am(s,"h265",e,t)},ft={webm:ie([119,101,98,109]),matroska:ie([109,97,116,114,111,115,107,97]),flac:ie([102,76,97,67]),ogg:ie([79,103,103,83]),ac3:ie([11,119]),riff:ie([82,73,70,70]),avi:ie([65,86,73]),wav:ie([87,65,86,69]),"3gp":ie([102,116,121,112,51,103]),mp4:ie([102,116,121,112]),fmp4:ie([115,116,121,112]),mov:ie([102,116,121,112,113,116]),moov:ie([109,111,111,118]),moof:ie([109,111,111,102])},er={aac:function(s){var e=Wr(s);return Ue(s,[255,16],{offset:e,mask:[255,22]})},mp3:function(s){var e=Wr(s);return Ue(s,[255,2],{offset:e,mask:[255,6]})},webm:function(s){var e=qu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.webm)},mkv:function(s){var e=qu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.matroska)},mp4:function(s){if(er["3gp"](s)||er.mov(s))return!1;if(Ue(s,ft.mp4,{offset:4})||Ue(s,ft.fmp4,{offset:4})||Ue(s,ft.moof,{offset:4})||Ue(s,ft.moov,{offset:4}))return!0},mov:function(s){return Ue(s,ft.mov,{offset:4})},"3gp":function(s){return Ue(s,ft["3gp"],{offset:4})},ac3:function(s){var e=Wr(s);return Ue(s,ft.ac3,{offset:e})},ts:function(s){if(s.length<189&&s.length>=1)return s[0]===71;for(var e=0;e+188<s.length&&e<188;){if(s[e]===71&&s[e+188]===71)return!0;e+=1}return!1},flac:function(s){var e=Wr(s);return Ue(s,ft.flac,{offset:e})},ogg:function(s){return Ue(s,ft.ogg)},avi:function(s){return Ue(s,ft.riff)&&Ue(s,ft.avi,{offset:8})},wav:function(s){return Ue(s,ft.riff)&&Ue(s,ft.wav,{offset:8})},h264:function(s){return eA(s,7,3).length},h265:function(s){return tA(s,[32,33],3).length}},Il=Object.keys(er).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Il.forEach(function(s){var e=er[s];er[s]=function(t){return e(ie(t))}});var sA=er,kc=function(s){s=ie(s);for(var e=0;e<Il.length;e++){var t=Il[e];if(sA[t](s))return t}return""},nA=function(s){return z1(s,["moof"]).length>0},Cc=9e4,Ic,xc,ao,Lc,Sm,Em,wm;Ic=function(s){return s*Cc};xc=function(s,e){return s*e};ao=function(s){return s/Cc};Lc=function(s,e){return s/e};Sm=function(s,e){return Ic(Lc(s,e))};Em=function(s,e){return xc(ao(s),e)};wm=function(s,e,t){return ao(t?s:s-e)};var on={ONE_SECOND_IN_TS:Cc,secondsToVideoTs:Ic,secondsToAudioTs:xc,videoTsToSeconds:ao,audioTsToSeconds:Lc,audioTsToVideoTs:Sm,videoTsToAudioTs:Em,metadataTsToSeconds:wm},xl="8.21.0";const _s={},$s=function(s,e){return _s[s]=_s[s]||[],e&&(_s[s]=_s[s].concat(e)),_s[s]},rA=function(s,e){$s(s,e)},km=function(s,e){const t=$s(s).indexOf(e);return t<=-1?!1:(_s[s]=_s[s].slice(),_s[s].splice(t,1),!0)},iA=function(s,e){$s(s,[].concat(e).map(t=>{const n=(...r)=>(km(s,n),t(...r));return n}))},xa={prefixed:!0},la=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Vu=la[0];let zr;for(let s=0;s<la.length;s++)if(la[s][1]in Y){zr=la[s];break}if(zr){for(let s=0;s<zr.length;s++)xa[Vu[s]]=zr[s];xa.prefixed=zr[0]!==Vu[0]}let Tt=[];const aA=(s,e,t)=>(n,r,i)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let c=s;if(n!=="log"&&i.unshift(n.toUpperCase()+":"),t&&(c=`%c${s}`,i.unshift(t)),i.unshift(c+":"),Tt){Tt.push([].concat(i));const m=Tt.length-1e3;Tt.splice(0,m>0?m:0)}if(!I.console)return;let h=I.console[n];!h&&n==="debug"&&(h=I.console.info||I.console.log),!(!h||!a||!o.test(n))&&h[Array.isArray(i)?"apply":"call"](I.console,i)};function Ll(s,e=":",t=""){let n="info",r;function i(...a){r("log",n,a)}return r=aA(s,i,t),i.createLogger=(a,o,c)=>{const h=o!==void 0?o:e,m=c!==void 0?c:t,_=`${s} ${h} ${a}`;return Ll(_,h,m)},i.createNewLogger=(a,o,c)=>Ll(a,o,c),i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},i.level=a=>{if(typeof a=="string"){if(!i.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},i.history=()=>Tt?[].concat(Tt):[],i.history.filter=a=>(Tt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),i.history.clear=()=>{Tt&&(Tt.length=0)},i.history.disable=()=>{Tt!==null&&(Tt.length=0,Tt=null)},i.history.enable=()=>{Tt===null&&(Tt=[])},i.error=(...a)=>r("error",n,a),i.warn=(...a)=>r("warn",n,a),i.debug=(...a)=>r("debug",n,a),i}const pe=Ll("VIDEOJS"),Cm=pe.createLogger,oA=Object.prototype.toString,Im=function(s){return os(s)?Object.keys(s):[]};function Fn(s,e){Im(s).forEach(t=>e(s[t],t))}function xm(s,e,t=0){return Im(s).reduce((n,r)=>e(n,s[r],r),t)}function os(s){return!!s&&typeof s=="object"}function tr(s){return os(s)&&oA.call(s)==="[object Object]"&&s.constructor===Object}function we(...s){const e={};return s.forEach(t=>{t&&Fn(t,(n,r)=>{if(!tr(n)){e[r]=n;return}tr(e[r])||(e[r]={}),e[r]=we(e[r],n)})}),e}function Lm(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const n=s[t];e.push(n)}return e}function oo(s,e,t,n=!0){const r=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),i={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return n&&(i.set=r),Object.defineProperty(s,e,i)}var lA=Object.freeze({__proto__:null,each:Fn,reduce:xm,isObject:os,isPlain:tr,merge:we,values:Lm,defineLazyProperty:oo});let Pc=!1,Pm=null,Wt=!1,Rm,Dm=!1,jn=!1,qn=!1,ls=!1,Rc=null,lo=null;const cA=!!(I.cast&&I.cast.framework&&I.cast.framework.CastReceiverContext);let Nm=null,La=!1,co=!1,Pa=!1,uo=!1,Ra=!1,Da=!1,Na=!1;const di=!!(cr()&&("ontouchstart"in I||I.navigator.maxTouchPoints||I.DocumentTouch&&I.document instanceof I.DocumentTouch)),Ms=I.navigator&&I.navigator.userAgentData;Ms&&Ms.platform&&Ms.brands&&(Wt=Ms.platform==="Android",jn=!!Ms.brands.find(s=>s.brand==="Microsoft Edge"),qn=!!Ms.brands.find(s=>s.brand==="Chromium"),ls=!jn&&qn,Rc=lo=(Ms.brands.find(s=>s.brand==="Chromium")||{}).version||null,co=Ms.platform==="Windows");if(!qn){const s=I.navigator&&I.navigator.userAgent||"";Pc=/iPod/i.test(s),Pm=function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Wt=/Android/i.test(s),Rm=function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Dm=/Firefox/i.test(s),jn=/Edg/i.test(s),qn=/Chrome/i.test(s)||/CriOS/i.test(s),ls=!jn&&qn,Rc=lo=function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Nm=function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t}(),Ra=/Tizen/i.test(s),Da=/Web0S/i.test(s),Na=Ra||Da,La=/Safari/i.test(s)&&!ls&&!Wt&&!jn&&!Na,co=/Windows/i.test(s),Pa=/iPad/i.test(s)||La&&di&&!/iPhone/i.test(s),uo=/iPhone/i.test(s)&&!Pa}const at=uo||Pa||Pc,ho=(La||at)&&!ls;var Om=Object.freeze({__proto__:null,get IS_IPOD(){return Pc},get IOS_VERSION(){return Pm},get IS_ANDROID(){return Wt},get ANDROID_VERSION(){return Rm},get IS_FIREFOX(){return Dm},get IS_EDGE(){return jn},get IS_CHROMIUM(){return qn},get IS_CHROME(){return ls},get CHROMIUM_VERSION(){return Rc},get CHROME_VERSION(){return lo},IS_CHROMECAST_RECEIVER:cA,get IE_VERSION(){return Nm},get IS_SAFARI(){return La},get IS_WINDOWS(){return co},get IS_IPAD(){return Pa},get IS_IPHONE(){return uo},get IS_TIZEN(){return Ra},get IS_WEBOS(){return Da},get IS_SMART_TV(){return Na},TOUCH_ENABLED:di,IS_IOS:at,IS_ANY_SAFARI:ho});function $u(s){return typeof s=="string"&&!!s.trim()}function dA(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function cr(){return Y===I.document}function dr(s){return os(s)&&s.nodeType===1}function Mm(){try{return I.parent!==I.self}catch{return!0}}function Um(s){return function(e,t){if(!$u(e))return Y[s](null);$u(t)&&(t=Y.querySelector(t));const n=dr(t)?t:Y;return n[s]&&n[s](e)}}function ae(s="div",e={},t={},n){const r=Y.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(i){const a=e[i];i==="textContent"?zs(r,a):(r[i]!==a||i==="tabIndex")&&(r[i]=a)}),Object.getOwnPropertyNames(t).forEach(function(i){r.setAttribute(i,t[i])}),n&&Dc(r,n),r}function zs(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function Pl(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function ti(s,e){return dA(e),s.classList.contains(e)}function dn(s,...e){return s.classList.add(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s}function po(s,...e){return s?(s.classList.remove(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s):(pe.warn("removeClass was called with an element that doesn't exist"),null)}function Bm(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(n=>s.classList.toggle(n,t)),s}function Fm(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const n=e[t];n===null||typeof n>"u"||n===!1?s.removeAttribute(t):s.setAttribute(t,n===!0?"":n)})}function js(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const n=s.attributes;for(let r=n.length-1;r>=0;r--){const i=n[r].name;let a=n[r].value;t.includes(i)&&(a=a!==null),e[i]=a}}return e}function jm(s,e){return s.getAttribute(e)}function sr(s,e,t){s.setAttribute(e,t)}function mo(s,e){s.removeAttribute(e)}function qm(){Y.body.focus(),Y.onselectstart=function(){return!1}}function Vm(){Y.onselectstart=function(){return!0}}function nr(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t.height||(t.height=parseFloat(rr(s,"height"))),t.width||(t.width=parseFloat(rr(s,"width"))),t}}function ui(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let n=0,r=0;for(;s.offsetParent&&s!==Y[xa.fullscreenElement];)n+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:n,top:r,width:e,height:t}}function fo(s,e){const t={x:0,y:0};if(at){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=rr(m,"transform");if(/^matrix/.test(_)){const T=_.slice(7,-1).split(/,\s/).map(Number);t.x+=T[4],t.y+=T[5]}else if(/^matrix3d/.test(_)){const T=_.slice(9,-1).split(/,\s/).map(Number);t.x+=T[12],t.y+=T[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&I.WebKitCSSMatrix){const T=I.getComputedStyle(m.assignedSlot.parentElement).transform,S=new I.WebKitCSSMatrix(T);t.x+=S.m41,t.y+=S.m42}m=m.parentNode||m.host}}const n={},r=ui(e.target),i=ui(s),a=i.width,o=i.height;let c=e.offsetY-(i.top-r.top),h=e.offsetX-(i.left-r.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-i.left,c=e.changedTouches[0].pageY+i.top,at&&(h-=t.x,c-=t.y)),n.y=1-Math.max(0,Math.min(1,c/o)),n.x=Math.max(0,Math.min(1,h/a)),n}function $m(s){return os(s)&&s.nodeType===3}function go(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Hm(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),dr(e)||$m(e))return e;if(typeof e=="string"&&/\S/.test(e))return Y.createTextNode(e)}).filter(e=>e)}function Dc(s,e){return Hm(e).forEach(t=>s.appendChild(t)),s}function Wm(s,e){return Dc(go(s),e)}function hi(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const Hs=Um("querySelector"),zm=Um("querySelectorAll");function rr(s,e){if(!s||!e)return"";if(typeof I.getComputedStyle=="function"){let t;try{t=I.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Gm(s){[...Y.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),n=Y.createElement("style");n.textContent=t,s.document.head.appendChild(n)}catch{const t=Y.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,s.document.head.appendChild(t)}})}var Xm=Object.freeze({__proto__:null,isReal:cr,isEl:dr,isInFrame:Mm,createEl:ae,textContent:zs,prependTo:Pl,hasClass:ti,addClass:dn,removeClass:po,toggleClass:Bm,setAttributes:Fm,getAttributes:js,getAttribute:jm,setAttribute:sr,removeAttribute:mo,blockTextSelection:qm,unblockTextSelection:Vm,getBoundingClientRect:nr,findPosition:ui,getPointerPosition:fo,isTextNode:$m,emptyEl:go,normalizeContent:Hm,appendContent:Dc,insertContent:Wm,isSingleLeftClick:hi,$:Hs,$$:zm,computedStyle:rr,copyStyleSheetsToWindow:Gm});let Ym=!1,Rl;const uA=function(){if(Rl.options.autoSetup===!1)return;const s=Array.prototype.slice.call(Y.getElementsByTagName("video")),e=Array.prototype.slice.call(Y.getElementsByTagName("audio")),t=Array.prototype.slice.call(Y.getElementsByTagName("video-js")),n=s.concat(e,t);if(n&&n.length>0)for(let r=0,i=n.length;r<i;r++){const a=n[r];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Rl(a);else{Dl(1);break}}else Ym||Dl(1)};function Dl(s,e){cr()&&(e&&(Rl=e),I.setTimeout(uA,s))}function Nl(){Ym=!0,I.removeEventListener("load",Nl)}cr()&&(Y.readyState==="complete"?Nl():I.addEventListener("load",Nl));const Km=function(s){const e=Y.createElement("style");return e.className=s,e},Qm=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var _t=new WeakMap;const hA=3;let pA=hA;function Bt(){return pA++}function Hu(s,e){if(!_t.has(s))return;const t=_t.get(s);t.handlers[e].length===0&&(delete t.handlers[e],s.removeEventListener?s.removeEventListener(e,t.dispatcher,!1):s.detachEvent&&s.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&&_t.delete(s)}function Nc(s,e,t,n){t.forEach(function(r){s(e,r,n)})}function yo(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const n=s||I.event;s={};const r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const i in n)r.includes(i)||i==="returnValue"&&n.preventDefault||(s[i]=n[i]);if(s.target||(s.target=s.srcElement||Y),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){n.preventDefault&&n.preventDefault(),s.returnValue=!1,n.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),s.cancelBubble=!0,n.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const i=Y.documentElement,a=Y.body;s.pageX=s.clientX+(i&&i.scrollLeft||a&&a.scrollLeft||0)-(i&&i.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(i&&i.scrollTop||a&&a.scrollTop||0)-(i&&i.clientTop||a&&a.clientTop||0)}s.which=s.charCode||s.keyCode,s.button!==null&&s.button!==void 0&&(s.button=s.button&1?0:s.button&4?1:s.button&2?2:0)}return s.fixed_=!0,s}let na;const mA=function(){if(typeof na!="boolean"){na=!1;try{const s=Object.defineProperty({},"passive",{get(){na=!0}});I.addEventListener("test",null,s),I.removeEventListener("test",null,s)}catch{}}return na},fA=["touchstart","touchmove"];function Lt(s,e,t){if(Array.isArray(e))return Nc(Lt,s,e,t);_t.has(s)||_t.set(s,{});const n=_t.get(s);if(n.handlers||(n.handlers={}),n.handlers[e]||(n.handlers[e]=[]),t.guid||(t.guid=Bt()),n.handlers[e].push(t),n.dispatcher||(n.disabled=!1,n.dispatcher=function(r,i){if(n.disabled)return;r=yo(r);const a=n.handlers[r.type];if(a){const o=a.slice(0);for(let c=0,h=o.length;c<h&&!r.isImmediatePropagationStopped();c++)try{o[c].call(s,r,i)}catch(m){pe.error(m)}}}),n.handlers[e].length===1)if(s.addEventListener){let r=!1;mA()&&fA.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,n.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,n.dispatcher)}function ot(s,e,t){if(!_t.has(s))return;const n=_t.get(s);if(!n.handlers)return;if(Array.isArray(e))return Nc(ot,s,e,t);const r=function(a,o){n.handlers[o]=[],Hu(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(s,a);return}const i=n.handlers[e];if(i){if(!t){r(s,e);return}if(t.guid)for(let a=0;a<i.length;a++)i[a].guid===t.guid&&i.splice(a--,1);Hu(s,e)}}function ur(s,e,t){const n=_t.has(s)?_t.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=yo(e),n.dispatcher&&n.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)ur.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){_t.has(e.target)||_t.set(e.target,{});const i=_t.get(e.target);e.target[e.type]&&(i.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),i.disabled=!1)}return!e.defaultPrevented}function _o(s,e,t){if(Array.isArray(e))return Nc(_o,s,e,t);const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}function Oc(s,e,t){const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}var gA=Object.freeze({__proto__:null,fixEvent:yo,on:Lt,off:ot,trigger:ur,one:_o,any:Oc});const Ft=30,Le=function(s,e,t){e.guid||(e.guid=Bt());const n=e.bind(s);return n.guid=t?t+"_"+e.guid:e.guid,n},cs=function(s,e){let t=I.performance.now();return function(...n){const r=I.performance.now();r-t>=e&&(s(...n),t=r)}},Zm=function(s,e,t,n=I){let r;const i=()=>{n.clearTimeout(r),r=null},a=function(){const o=this,c=arguments;let h=function(){r=null,h=null,t||s.apply(o,c)};!r&&t&&s.apply(o,c),n.clearTimeout(r),r=n.setTimeout(h,e)};return a.cancel=i,a};var yA=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Le,throttle:cs,debounce:Zm});let Fr;class Pt{on(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Lt(this,e,t),this.addEventListener=n}off(e,t){ot(this,e,t)}one(e,t){const n=this.addEventListener;this.addEventListener=()=>{},_o(this,e,t),this.addEventListener=n}any(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Oc(this,e,t),this.addEventListener=n}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=yo(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ur(this,e)}queueTrigger(e){Fr||(Fr=new Map);const t=e.type||e;let n=Fr.get(this);n||(n=new Map,Fr.set(this,n));const r=n.get(t);n.delete(t),I.clearTimeout(r);const i=I.setTimeout(()=>{n.delete(t),n.size===0&&(n=null,Fr.delete(this)),this.trigger(e)},0);n.set(t,i)}}Pt.prototype.allowedEvents_={};Pt.prototype.addEventListener=Pt.prototype.on;Pt.prototype.removeEventListener=Pt.prototype.off;Pt.prototype.dispatchEvent=Pt.prototype.trigger;const vo=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,Ts=s=>s instanceof Pt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),_A=(s,e)=>{Ts(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},Ol=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,Oa=(s,e,t)=>{if(!s||!s.nodeName&&!Ts(s))throw new Error(`Invalid target for ${vo(e)}#${t}; must be a DOM node or evented object.`)},Jm=(s,e,t)=>{if(!Ol(s))throw new Error(`Invalid event type for ${vo(e)}#${t}; must be a non-empty string or array.`)},ef=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${vo(e)}#${t}; must be a function.`)},nl=(s,e,t)=>{const n=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,i,a;return n?(r=s.eventBusEl_,e.length>=3&&e.shift(),[i,a]=e):(r=e[0],i=e[1],a=e[2]),Oa(r,s,t),Jm(i,s,t),ef(a,s,t),a=Le(s,a),{isTargetingSelf:n,target:r,type:i,listener:a}},tn=(s,e,t,n)=>{Oa(s,s,e),s.nodeName?gA[e](s,t,n):s[e](t,n)},vA={on(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"on");if(tn(t,"on",n,r),!e){const i=()=>this.off(t,n,r);i.guid=r.guid;const a=()=>this.off("dispose",i);a.guid=r.guid,tn(this,"on","dispose",i),tn(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"one");if(e)tn(t,"one",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"one",n,i)}},any(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"any");if(e)tn(t,"any",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"any",n,i)}},off(s,e,t){if(!s||Ol(s))ot(this.eventBusEl_,s,e);else{const n=s,r=e;Oa(n,this,"off"),Jm(r,this,"off"),ef(t,this,"off"),t=Le(this,t),this.off("dispose",t),n.nodeName?(ot(n,r,t),ot(n,"dispose",t)):Ts(n)&&(n.off(r,t),n.off("dispose",t))}},trigger(s,e){Oa(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!Ol(t))throw new Error(`Invalid event type for ${vo(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ur(this.eventBusEl_,s,e)}};function Mc(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=ae("span",{className:"vjs-event-bus"});return Object.assign(s,vA),s.eventedCallbacks&&s.eventedCallbacks.forEach(n=>{n()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(n){n&&_t.has(n)&&_t.delete(n)}),I.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const bA={state:{},setState(s){typeof s=="function"&&(s=s());let e;return Fn(s,(t,n)=>{this.state[n]!==t&&(e=e||{},e[n]={from:this.state[n],to:t}),this.state[n]=t}),e&&Ts(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function tf(s,e){return Object.assign(s,bA),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&Ts(s)&&s.on("statechanged",s.handleStateChanged),s}const si=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},Ve=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},sf=function(s,e){return Ve(s)===Ve(e)};var TA=Object.freeze({__proto__:null,toLowerCase:si,toTitleCase:Ve,titleCaseEquals:sf});class ${constructor(e,t,n){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 r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_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(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&(Mc(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),tf(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(n),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,n){return ae(e,t,n)}localize(e,t,n=e){const r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),a=i&&i[r],o=r&&r.split("-")[0],c=i&&i[o];let h=n;return a&&a[e]?h=a[e]:c&&c[e]&&(h=c[e]),t&&(h=h.replace(/\{(\d+)\}/g,function(m,_){const T=t[_-1];let S=T;return typeof T>"u"&&(S=m),S})),h}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((n,r)=>n.concat(r),[]);let t=this;for(let n=0;n<e.length;n++)if(t=t.getChild(e[n]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const n="http://www.w3.org/2000/svg",r=ae("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),i=Y.createElementNS(n,"svg");i.setAttributeNS(null,"viewBox","0 0 512 512");const a=Y.createElementNS(n,"use");return i.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),r.appendChild(i),this.iconIsSet_?t.replaceChild(r,t.querySelector(".vjs-icon-placeholder")):t.appendChild(r),this.iconIsSet_=!0,r}addChild(e,t={},n=this.children_.length){let r,i;if(typeof e=="string"){i=Ve(e);const a=t.componentClass||i;t.name=i;const o=$.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;r=new o(this.player_||this,t)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,typeof r.id=="function"&&(this.childIndex_[r.id()]=r),i=i||r.name&&Ve(r.name()),i&&(this.childNameIndex_[i]=r,this.childNameIndex_[si(i)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[n+1]&&(this.children_[n+1].el_?a=this.children_[n+1].el_:dr(this.children_[n+1])&&(a=this.children_[n+1])),this.contentEl().insertBefore(r.el(),a)}return r}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let r=this.children_.length-1;r>=0;r--)if(this.children_[r]===e){t=!0,this.children_.splice(r,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Ve(e.name())]=null,this.childNameIndex_[si(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,n=a=>{const o=a.name;let c=a.opts;if(t[o]!==void 0&&(c=t[o]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const h=this.addChild(o,c);h&&(this[o]=h)};let r;const i=$.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,c;return typeof a=="string"?(o=a,c=e[o]||this.options_[o]||{}):(o=a.name,c=a),{name:o,opts:c}}).filter(a=>{const o=$.getComponent(a.opts.componentClass||Ve(a.name));return o&&!i.isTech(o)}).forEach(n)}}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 Hs(e,t||this.contentEl())}$$(e,t){return zm(e,t||this.contentEl())}hasClass(e){return ti(this.el_,e)}addClass(...e){dn(this.el_,...e)}removeClass(...e){po(this.el_,...e)}toggleClass(e,t){Bm(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 jm(this.el_,e)}setAttribute(e,t){sr(this.el_,e,t)}removeAttribute(e){mo(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,n){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",n||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],i=r.indexOf("px");return parseInt(i!==-1?r.slice(0,i):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=rr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const n=`offset${Ve(e)}`;t=this.el_[n]}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},n={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:n}}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 n=10,r=200;let i;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=I.performance.now(),i=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)i=!1;else if(t){const c=o.touches[0].pageX-t.pageX,h=o.touches[0].pageY-t.pageY;Math.sqrt(c*c+h*h)>n&&(i=!1)}});const a=function(){i=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,i===!0&&I.performance.now()-e<r&&(o.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 n=function(r){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",n),this.on("touchcancel",n)}setTimeout(e,t){var n;return e=Le(this,e),this.clearTimersOnDispose_(),n=I.setTimeout(()=>{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),I.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const n=I.setInterval(e,t);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),I.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=I.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 n=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),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),I.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((n,r)=>this[t](r))}),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(i){const a=I.getComputedStyle(i,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function n(i){return!(!t(i.parentElement)||!t(i)||i.style.opacity==="0"||I.getComputedStyle(i).height==="0px"||I.getComputedStyle(i).width==="0px")}function r(i){if(i.offsetWidth+i.offsetHeight+i.getBoundingClientRect().height+i.getBoundingClientRect().width===0)return!1;const a={x:i.getBoundingClientRect().left+i.offsetWidth/2,y:i.getBoundingClientRect().top+i.offsetHeight/2};if(a.x<0||a.x>(Y.documentElement.clientWidth||I.innerWidth)||a.y<0||a.y>(Y.documentElement.clientHeight||I.innerHeight))return!1;let o=Y.elementFromPoint(a.x,a.y);for(;o;){if(o===i)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&n(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 n=$.getComponent("Tech"),r=n&&n.isTech(t),i=$===t||$.prototype.isPrototypeOf(t.prototype);if(r||!i){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Ve(e),$.components_||($.components_={});const a=$.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,c=Object.keys(o);if(o&&c.length>0&&c.map(h=>o[h]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return $.components_[e]=t,$.components_[si(e)]=t,t}static getComponent(e){if(!(!e||!$.components_))return $.components_[e]}}$.registerComponent("Component",$);function AA(s,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Wu(s,e,t,n){return AA(s,n,t.length-1),t[n][e]}function rl(s){let e;return s===void 0||s.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:s.length,start:Wu.bind(null,"start",0,s),end:Wu.bind(null,"end",1,s)},I.Symbol&&I.Symbol.iterator&&(e[I.Symbol.iterator]=()=>(s||[]).values()),e}function Ht(s,e){return Array.isArray(s)?rl(s):s===void 0||e===void 0?rl():rl([[s,e]])}const nf=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),n=Math.floor(s/60%60),r=Math.floor(s/3600);const i=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(r=n=t="-"),r=r>0||a>0?r+":":"",n=((r||i>=10)&&n<10?"0"+n:n)+":",t=t<10?"0"+t:t,r+n+t};let Uc=nf;function rf(s){Uc=s}function af(){Uc=nf}function fn(s,e=s){return Uc(s,e)}var SA=Object.freeze({__proto__:null,createTimeRanges:Ht,createTimeRange:Ht,setFormatTime:rf,resetFormatTime:af,formatTime:fn});function of(s,e){let t=0,n,r;if(!e)return 0;(!s||!s.length)&&(s=Ht(0,0));for(let i=0;i<s.length;i++)n=s.start(i),r=s.end(i),r>e&&(r=e),t+=r-n;return t/e}function je(s){if(s instanceof je)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:os(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=je.defaultMessages[this.code]||"")}je.prototype.code=0;je.prototype.message="";je.prototype.status=null;je.prototype.metadata=null;je.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];je.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."};je.MEDIA_ERR_CUSTOM=0;je.prototype.MEDIA_ERR_CUSTOM=0;je.MEDIA_ERR_ABORTED=1;je.prototype.MEDIA_ERR_ABORTED=1;je.MEDIA_ERR_NETWORK=2;je.prototype.MEDIA_ERR_NETWORK=2;je.MEDIA_ERR_DECODE=3;je.prototype.MEDIA_ERR_DECODE=3;je.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.MEDIA_ERR_ENCRYPTED=5;je.prototype.MEDIA_ERR_ENCRYPTED=5;function ni(s){return s!=null&&typeof s.then=="function"}function ts(s){ni(s)&&s.then(null,e=>{})}const Ml=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,n)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},EA=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=Ml(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(Ml))},wA=function(s,e){return s.forEach(function(t){const n=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>n.addCue(r))}),e.textTracks()};var zu={textTracksToJson:EA,jsonToTextTracks:wA,trackToJson_:Ml};const il="vjs-modal-dialog";class hr extends ${constructor(e,t){super(e,t),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=ae("div",{className:`${il}-content`},{role:"document"}),this.descEl_=ae("p",{className:`${il}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),zs(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`${il} 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 n=this.getChild("closeButton");if(t&&!n){const r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),n=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Wm(t,e),this.trigger("modalfill"),r?n.insertBefore(t,r):n.appendChild(t);const i=this.getChild("closeButton");i&&n.appendChild(i.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),go(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=Y.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_(),n=this.el_.querySelector(":focus");let r;for(let i=0;i<t.length;i++)if(n===t[i]){r=i;break}Y.activeElement===this.el_&&(r=0),e.shiftKey&&r===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&r===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof I.HTMLAnchorElement||t instanceof I.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof I.HTMLInputElement||t instanceof I.HTMLSelectElement||t instanceof I.HTMLTextAreaElement||t instanceof I.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof I.HTMLIFrameElement||t instanceof I.HTMLObjectElement||t instanceof I.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}hr.prototype.options_={pauseOnOpen:!0,temporary:!0};$.registerComponent("ModalDialog",hr);class ir extends Pt{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})},Ts(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let n=0,r=this.length;n<r;n++)if(this[n]===e){t=this[n],t.off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}ir.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in ir.prototype.allowedEvents_)ir.prototype["on"+s]=null;const al=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class kA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){al(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&al(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,al(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 ol=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].selected=!1)};class CA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){ol(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&&ol(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,ol(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 lf extends ir{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 IA{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,n=e.length;t<n;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 n=0,r=this.trackElements_.length;n<r;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t}removeTrackElement_(e){for(let t=0,n=this.trackElements_.length;t<n;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 Ma{constructor(e){Ma.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let n=0;const r=e.length;this.cues_=e,this.length_=e.length;const i=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<r)for(n=t;n<r;n++)i.call(this,n)}getCueById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}const xA={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},LA={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},PA={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Gu={disabled:"disabled",hidden:"hidden",showing:"showing"};class Bc extends Pt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Bt(),kind:e.kind||"",language:e.language||""};let n=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return n},set(r){r!==n&&(n=r,this.trigger("labelchange"))}})}}const Fc=function(s){return new URL(s,Y.baseURI)},cf=function(s){return new URL(s,Y.baseURI).href},jc=function(s){if(typeof s=="string"){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(s);if(e)return e.pop().toLowerCase()}return""},bo=function(s,e=I.location){return Fc(s).origin!==e.origin};var RA=Object.freeze({__proto__:null,parseUrl:Fc,getAbsoluteURL:cf,getFileExtension:jc,isCrossOrigin:bo});const Xu=function(s,e){const t=new I.WebVTT.Parser(I,I.vttjs,I.WebVTT.StringDecoder()),n=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){n.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),n.length>0&&(I.console&&I.console.groupCollapsed&&I.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(r=>pe.error(r)),I.console&&I.console.groupEnd&&I.console.groupEnd()),t.flush()},Yu=function(s,e){const t={uri:s},n=bo(s);n&&(t.cors=n);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Cp(t,Le(this,function(i,a,o){if(i)return pe.error(i,a);e.loaded_=!0,typeof I.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){pe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Xu(o,e)}):Xu(o,e)}))};class vi extends Bc{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=we(e,{kind:PA[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=Gu[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(n="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const i=new Ma(this.cues_),a=new Ma(this.activeCues_);let o=!1;this.timeupdateHandler=Le(this,function(h={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return n},set(h){Gu[h]&&n!==h&&(n=h,!this.preload_&&n!=="disabled"&&this.cues.length===0&&Yu(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const h=this.tech_.currentTime(),m=[];for(let _=0,T=this.cues.length;_<T;_++){const S=this.cues[_];S.startTime<=h&&S.endTime>=h&&m.push(S)}if(o=!1,m.length!==this.activeCues_.length)o=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(o=!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")&&Yu(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 I.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const r in e)r in t||(t[r]=e[r]);t.id=e.id,t.originalCue_=e}const n=this.tech_.textTracks();for(let r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}vi.prototype.allowedEvents_={cuechange:"cuechange"};class df extends Bc{constructor(e={}){const t=we(e,{kind:LA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"enabled",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class uf extends Bc{constructor(e={}){const t=we(e,{kind:xA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"selected",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class ws extends Pt{constructor(e={}){super();let t;const n=new vi(e);this.kind=n.kind,this.src=n.src,this.srclang=n.language,this.label=n.label,this.default=n.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return n}}}),t=ws.NONE,n.addEventListener("loadeddata",()=>{t=ws.LOADED,this.trigger({type:"load",target:this})})}}ws.prototype.allowedEvents_={load:"load"};ws.NONE=0;ws.LOADING=1;ws.LOADED=2;ws.ERROR=3;const Ut={audio:{ListClass:kA,TrackClass:df,capitalName:"Audio"},video:{ListClass:CA,TrackClass:uf,capitalName:"Video"},text:{ListClass:lf,TrackClass:vi,capitalName:"Text"}};Object.keys(Ut).forEach(function(s){Ut[s].getterName=`${s}Tracks`,Ut[s].privateName=`${s}Tracks_`});const ar={remoteText:{ListClass:lf,TrackClass:vi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:IA,TrackClass:ws,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gt=Object.assign({},Ut,ar);ar.names=Object.keys(ar);Ut.names=Object.keys(Ut);gt.names=[].concat(ar.names).concat(Ut.names);function DA(s,e,t,n,r={}){const i=s.textTracks();r.kind=e,t&&(r.label=t),n&&(r.language=n),r.tech=s;const a=new gt.text.TrackClass(r);return i.addTrack(a),a}class de extends ${constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),gt.names.forEach(n=>{const r=gt[n];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}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 gt.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 Ht(0,0)}bufferedPercent(){return of(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(Ut.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const n=this[`${t}Tracks`]()||[];let r=n.length;for(;r--;){const i=n[r];t==="text"&&this.removeRemoteTextTrack(i),n.removeTrack(i)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const n=e[t];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new je(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ht(0,0):Ht()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ut.names.forEach(e=>{const t=Ut[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!I.WebVTT)if(Y.body.contains(this.el())){if(!this.options_["vtt.js"]&&tr(hu)&&Object.keys(hu).length>0){this.trigger("vttjsloaded");return}const e=Y.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}),I.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),n=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);t.on("addtrack",n),t.on("removetrack",r),this.addWebVttScript_();const i=()=>this.trigger("texttrackchange"),a=()=>{i();for(let o=0;o<e.length;o++){const c=e[o];c.removeEventListener("cuechange",i),c.mode==="showing"&&c.addEventListener("cuechange",i)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",n),t.off("removetrack",r),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",i)})}addTextTrack(e,t,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return DA(this,e,t,n)}createRemoteTextTrack(e){const t=we(e,{tech:this});return new ar.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const n=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(n.track)),n}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 de.canPlayType(e.type)}static isTech(e){return e.prototype instanceof de||e instanceof de||e===de}static registerTech(e,t){if(de.techs_||(de.techs_={}),!de.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!de.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!de.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ve(e),de.techs_[e]=t,de.techs_[si(e)]=t,e!=="Tech"&&de.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(de.techs_&&de.techs_[e])return de.techs_[e];if(e=Ve(e),I&&I.videojs&&I.videojs[e])return pe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),I.videojs[e]}}}gt.names.forEach(function(s){const e=gt[s];de.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});de.prototype.featuresVolumeControl=!0;de.prototype.featuresMuteControl=!0;de.prototype.featuresFullscreenResize=!1;de.prototype.featuresPlaybackRate=!1;de.prototype.featuresProgressEvents=!1;de.prototype.featuresSourceset=!1;de.prototype.featuresTimeupdateEvents=!1;de.prototype.featuresNativeTextTracks=!1;de.prototype.featuresVideoFrameCallback=!1;de.withSourceHandlers=function(s){s.registerSourceHandler=function(e,t){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),t===void 0&&(t=n.length),n.splice(t,0,e)},s.canPlayType=function(e){const t=s.sourceHandlers||[];let n;for(let r=0;r<t.length;r++)if(n=t[r].canPlayType(e),n)return n;return""},s.selectSourceHandler=function(e,t){const n=s.sourceHandlers||[];let r;for(let i=0;i<n.length;i++)if(r=n[i].canHandleSource(e,t),r)return n[i];return null},s.canPlaySource=function(e,t){const n=s.selectSourceHandler(e,t);return n?n.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)})},s.prototype),s.prototype.setSource=function(e){let t=s.selectSourceHandler(e,this.options_);t||(s.nativeSourceHandler?t=s.nativeSourceHandler:pe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==s.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.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",de);de.registerTech("Tech",de);de.defaultTechOrder_=[];const un={},Ua={},Ba={};function NA(s,e){un[s]=un[s]||[],un[s].push(e)}function OA(s,e,t){s.setTimeout(()=>sn(e,un[e.type],t,s),1)}function MA(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function UA(s,e,t){return s.reduceRight(qc(t),e[t]())}function BA(s,e,t,n){return e[t](s.reduce(qc(t),n))}function Ku(s,e,t,n=null){const r="call"+Ve(t),i=s.reduce(qc(r),n),a=i===Ba,o=a?null:e[t](i);return qA(s,t,o,a),o}const FA={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},jA={setCurrentTime:1,setMuted:1,setVolume:1},Qu={play:1,pause:1};function qc(s){return(e,t)=>e===Ba?Ba:t[s]?t[s](e):e}function qA(s,e,t,n){for(let r=s.length-1;r>=0;r--){const i=s[r];i[e]&&i[e](n,t)}}function VA(s){Ua.hasOwnProperty(s.id())&&delete Ua[s.id()]}function $A(s,e){const t=Ua[s.id()];let n=null;if(t==null)return n=e(s),Ua[s.id()]=[[e,n]],n;for(let r=0;r<t.length;r++){const[i,a]=t[r];i===e&&(n=a)}return n===null&&(n=e(s),t.push([e,n])),n}function sn(s={},e=[],t,n,r=[],i=!1){const[a,...o]=e;if(typeof a=="string")sn(s,un[a],t,n,r,i);else if(a){const c=$A(n,a);if(!c.setSource)return r.push(c),sn(s,o,t,n,r,i);c.setSource(Object.assign({},s),function(h,m){if(h)return sn(s,o,t,n,r,i);r.push(c),sn(m,s.type===m.type?o:un[m.type],t,n,r,i)})}else o.length?sn(s,o,t,n,r,i):i?t(s,r):sn(s,un["*"],t,n,r,!0)}const HA={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"},Fa=function(s=""){const e=jc(s);return HA[e.toLowerCase()]||""},WA=(s,e)=>{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(r=>r.src===e);if(t.length)return t[0].type;const n=s.$$("source");for(let r=0;r<n.length;r++){const i=n[r];if(i.type&&i.src&&i.src===e)return i.type}return Fa(e)},hf=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=hf(t),Array.isArray(t)?e=e.concat(t):os(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Zu({src:s})]:os(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Zu(s)]:s=[];return s};function Zu(s){if(!s.type){const e=Fa(s.src);e&&(s.type=e)}return s}var zA=`<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 Xv=" ",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},Kv=function(){const i='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+i+")")},at=function(i){const e={};if(!i)return e;const t=i.split(Kv());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 Yv 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(Xv)),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 Qv=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),xi=function(i){const e={};return Object.keys(i).forEach(function(t){e[Qv(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 Jv extends Bl{constructor(e={}){super(),this.lineStream=new Gv,this.parseStream=new Yv,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:Tp(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^/},Zv=["video","audio","text"],sd=["Video","Audio","Text"],Sp=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;Zv.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},eT=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},Ep=function(i){return i===void 0&&(i=""),Ji.audio.test(i.trim().toLowerCase())},tT=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 Sp(n.trim())}),t="video";e.length===1&&Ep(e[0])?t="audio":e.length===1&&tT(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",iT="avc1.4d400d",rT=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,nT=/^application\/dash\+xml/i,wp=function(i){return rT.test(i)?"hls":nT.test(i)?"dash":i==="application/vnd.videojs.vhs+json"?"vhs-json":null},sT=function(i){return i.toString(2).length},aT=function(i){return Math.ceil(sT(i)/8)},kp=function(i){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(i):i&&i.buffer instanceof ArrayBuffer},oT=function(i){return kp(i)},ie=function(i){return i instanceof Uint8Array?i:(!Array.isArray(i)&&!oT(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 lT=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=ie(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)},uT=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=aT(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},Cp=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},cT=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 ie(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=ie(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=ie(i),e=ie(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})},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 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),{}),Ip=i=>Object.keys(i).map(e=>i[e]),hT=(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),[]),Ap=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},pT=(i,e)=>i.reduce((t,r,n)=>(r[e]&&t.push(n),t),[]),gT=(i,e)=>Ip(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},mT=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),fT={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)}}},yT=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}=fT[e](i),u=hT(a,l).map(yT(i));if(e==="static"){const p=u.length-1,g=typeof n=="number"?n:s;u[p].duration=g-t/r*p}return u},xp=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=xp({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},_T=["AUDIO","SUBTITLES"],bT=1/60,Lp=i=>gT(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),vT=(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 dT(i,_T,(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})},TT=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:l}){return l===r.timeline});const n=vT(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)<bT});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})})},ST=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(ud(i)),r=e.playlists.concat(ud(e));return e.timelineStarts=Lp([i.timelineStarts,e.timelineStarts]),TT({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},Aa=i=>i&&i.uri+"-"+mT(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=Ip(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=pT(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},ET=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=$l(i[t],e);return i},wT=({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},kT=({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},CT=(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(wT(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},IT=(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(kT(r),e)),t},{}),AT=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),{}),xT=({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},LT=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",DT=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",PT=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",RT=(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)},[]):[],NT=({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(LT)).map(xT),b=Co(i.filter(DT)),S=Co(i.filter(PT)),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:ET(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?CT(b,r,v):null,L=S.length?IT(S,r):null,O=g.concat(dd(D),dd(L)),U=O.map(({timelineStarts:F})=>F);return C.timelineStarts=Lp(U),RT(O,C.timelineStarts),D&&(C.mediaGroups.AUDIO.audio=D),L&&(C.mediaGroups.SUBTITLES.subs=L),w.length&&(C.mediaGroups["CLOSED-CAPTIONS"].cc=AT(w)),n?ST({oldManifest:n,newManifest:C}):C},OT=(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)},Dp=(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=OT(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},UT=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,MT=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(UT,MT(e)),BT=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?jl(i):Dp(i,e),FT=(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 BT(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}})},jT=(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},qT=(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=>jT(i,l));let a;return t&&(a=jl(i)),e&&(a=Dp(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)},$T=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=FT,t=Ke(i,e.template)):e.base?(r=xp,t=Ke(i,e.base)):e.list&&(r=qT,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},VT=i=>i.map($T),Re=(i,e)=>Ap(i.childNodes).filter(({tagName:t})=>t===e),Yn=i=>i.textContent.trim(),HT=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)},zT=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 zT(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 HT(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?Ap(i.attributes).reduce((e,t)=>{const r=pd[t.name]||pd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},WT={"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},GT=(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)}))},XT=i=>i.reduce((e,t)=>{const r=He(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const n=WT[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&&Tp(a)}}return e},{}),KT=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})},YT=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}})})),QT=(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=KT(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=XT(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(GT(u,s,v)))},JT=(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(QT(s,n,l)))},ZT=(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},e1=({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=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=e1({attributes:C,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),b.push({node:S,attributes:C})}),{locations:u.locations,contentSteeringInfo:ZT(g,s),representationInfo:Ur(b.map(JT(u,p))),eventStream:Ur(b.map(YT))}},Pp=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},i1=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},r1=(i,e={})=>{const t=t1(Pp(i),e),r=VT(t.representationInfo);return NT({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},n1=i=>i1(Pp(i));var Rp=Math.pow(2,32),s1=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)*Rp+e.getUint32(4)},a1={getUint64:s1,MAX_UINT32:Rp},gd=a1.getUint64,o1=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},l1=o1;const u1=Kn(l1);var c1=ie([73,68,51]),d1=function(i,e){e===void 0&&(e=0),i=ie(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=ie(e),e.length-t<10||!Pe(e,c1,{offset:t})?t:(t+=d1(e,t),i(e,t))},md=function(i){return typeof i=="string"?Cp(i):i},h1=function(i){return Array.isArray(i)?i.map(function(e){return md(e)}):[md(i)]},p1=function i(e,t,r){r===void 0&&(r=!1),t=h1(t),e=ie(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:ie([26,69,223,163]),DocType:ie([66,130]),Segment:ie([24,83,128,103]),SegmentInfo:ie([21,73,169,102]),Tracks:ie([22,84,174,107]),Track:ie([174]),TrackNumber:ie([215]),DefaultDuration:ie([35,227,131]),TrackEntry:ie([174]),TrackType:ie([131]),FlagDefault:ie([136]),CodecID:ie([134]),CodecPrivate:ie([99,162]),VideoTrack:ie([224]),AudioTrack:ie([225]),Cluster:ie([31,67,182,117]),Timestamp:ie([231]),TimestampScale:ie([42,215,177]),BlockGroup:ie([160]),BlockDuration:ie([155]),Block:ie([161]),SimpleBlock:ie([163])},Xo=[128,64,32,16,8,4,2,1],g1=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=g1(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:lT(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"?uT(e):e},m1=function(i){return Array.isArray(i)?i.map(function(e){return fd(e)}):[fd(i)]},f1=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=m1(t),e=ie(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=f1(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},y1=ie([0,0,0,1]),_1=ie([0,0,1]),b1=ie([0,0,3]),v1=function(i){for(var e=[],t=1;t<i.length-2;)Pe(i.subarray(t,t+3),b1)&&(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},Np=function(i,e,t,r){i=ie(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),y1)?l=4:Pe(i.subarray(n),_1)&&(l=3),!l){n++;continue}if(a++,s)return v1(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)},T1=function(i,e,t){return Np(i,"h264",e,t)},S1=function(i,e,t){return Np(i,"h265",e,t)},ot={webm:ie([119,101,98,109]),matroska:ie([109,97,116,114,111,115,107,97]),flac:ie([102,76,97,67]),ogg:ie([79,103,103,83]),ac3:ie([11,119]),riff:ie([82,73,70,70]),avi:ie([65,86,73]),wav:ie([87,65,86,69]),"3gp":ie([102,116,121,112,51,103]),mp4:ie([102,116,121,112]),fmp4:ie([115,116,121,112]),mov:ie([102,116,121,112,113,116]),moov:ie([109,111,111,118]),moof:ie([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 T1(i,7,3).length},h265:function(i){return S1(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(ie(t))}});var E1=Br,Hl=function(i){i=ie(i);for(var e=0;e<Ko.length;e++){var t=Ko[e];if(E1[t](i))return t}return""},w1=function(i){return p1(i,["moof"]).length>0},zl=9e4,Wl,Gl,La,Xl,Op,Up,Mp;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};Op=function(i,e){return Wl(Xl(i,e))};Up=function(i,e){return Gl(La(i),e)};Mp=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:Op,videoTsToAudioTs:Up,metadataTsToSeconds:Mp},Yo="8.21.0";const hi={},Oi=function(i,e){return hi[i]=hi[i]||[],e&&(hi[i]=hi[i].concat(e)),hi[i]},k1=function(i,e){Oi(i,e)},Bp=function(i,e){const t=Oi(i).indexOf(e);return t<=-1?!1:(hi[i]=hi[i].slice(),hi[i].splice(t,1),!0)},C1=function(i,e){Oi(i,[].concat(e).map(t=>{const r=(...n)=>(Bp(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 I1=(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=I1(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"),Fp=ue.createLogger,A1=Object.prototype.toString,jp=function(i){return ni(i)?Object.keys(i):[]};function wr(i,e){jp(i).forEach(t=>e(i[t],t))}function qp(i,e,t=0){return jp(i).reduce((r,n)=>e(r,i[n],n),t)}function ni(i){return!!i&&typeof i=="object"}function Fr(i){return ni(i)&&A1.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 $p(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 x1=Object.freeze({__proto__:null,each:wr,reduce:qp,isObject:ni,isPlain:Fr,merge:ve,values:$p,defineLazyProperty:Da});let Kl=!1,Vp=null,qt=!1,Hp,zp=!1,kr=!1,Cr=!1,si=!1,Yl=null,Pa=null;const L1=!!(x.cast&&x.cast.framework&&x.cast.framework.CastReceiverContext);let Wp=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),Vp=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),qt=/Android/i.test(i),Hp=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}(),zp=/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}(),Wp=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 Gp=Object.freeze({__proto__:null,get IS_IPOD(){return Kl},get IOS_VERSION(){return Vp},get IS_ANDROID(){return qt},get ANDROID_VERSION(){return Hp},get IS_FIREFOX(){return zp},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:L1,get IE_VERSION(){return Wp},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 D1(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 Xp(){try{return x.parent!==x.self}catch{return!0}}function Kp(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 D1(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 Yp(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 Qp(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 Jp(i,e){return i.getAttribute(e)}function jr(i,e,t){i.setAttribute(e,t)}function Ma(i,e){i.removeAttribute(e)}function Zp(){G.body.focus(),G.onselectstart=function(){return!1}}function eg(){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 tg(i){return ni(i)&&i.nodeType===3}function Fa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function ig(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Gr(e)||tg(e))return e;if(typeof e=="string"&&/\S/.test(e))return G.createTextNode(e)}).filter(e=>e)}function Ql(i,e){return ig(e).forEach(t=>i.appendChild(t)),i}function rg(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=Kp("querySelector"),ng=Kp("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 sg(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 ag=Object.freeze({__proto__:null,isReal:Wr,isEl:Gr,isInFrame:Xp,createEl:se,textContent:Bi,prependTo:Jo,hasClass:Pn,addClass:Zi,removeClass:Ua,toggleClass:Yp,setAttributes:Qp,getAttributes:Ri,getAttribute:Jp,setAttribute:jr,removeAttribute:Ma,blockTextSelection:Zp,unblockTextSelection:eg,getBoundingClientRect:qr,findPosition:Vn,getPointerPosition:Ba,isTextNode:tg,emptyEl:Fa,normalizeContent:ig,appendContent:Ql,insertContent:rg,isSingleLeftClick:Hn,$:Ui,$$:ng,computedStyle:$r,copyStyleSheetsToWindow:sg});let og=!1,Zo;const P1=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 og||el(1)};function el(i,e){Wr()&&(e&&(Zo=e),x.setTimeout(P1,i))}function tl(){og=!0,x.removeEventListener("load",tl)}Wr()&&(G.readyState==="complete"?tl():x.addEventListener("load",tl));const lg=function(i){const e=G.createElement("style");return e.className=i,e},ug=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var ct=new WeakMap;const R1=3;let N1=R1;function Pt(){return N1++}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 O1=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},U1=["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;O1()&&U1.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 M1=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)}},cg=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 B1=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Rt,bind_:Ce,throttle:ai,debounce:cg});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"),F1=(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.`)},dg=(i,e,t)=>{if(!il(i))throw new Error(`Invalid event type for ${$a(e)}#${t}; must be a non-empty string or array.`)},hg=(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),dg(s,i,t),hg(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?M1[e](i,t,r):i[e](t,r)},j1={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"),dg(n,this,"off"),hg(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,j1),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 q1={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 pg(i,e){return Object.assign(i,q1),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())},Me=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},gg=function(i,e){return Me(i)===Me(e)};var $1=Object.freeze({__proto__:null,toLowerCase:Rn,toTitleCase:Me,titleCaseEquals:gg});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)),pg(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=Me(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&&Me(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_[Me(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||Me(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 ng(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){Yp(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 Jp(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"+Me(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${Me(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=Me(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 V1(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 V1(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 mg=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=mg;function fg(i){tu=i}function yg(){tu=mg}function nr(i,e=i){return tu(i,e)}var H1=Object.freeze({__proto__:null,createTimeRanges:jt,createTimeRange:jt,setFormatTime:fg,resetFormatTime:yg,formatTime:nr});function _g(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}})})},z1=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))},W1=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:z1,jsonToTextTracks:W1,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(),rg(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 G1 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 X1 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 bg 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 K1{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 Y1={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Q1={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},J1={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)},vg=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 Z1=Object.freeze({__proto__:null,parseUrl:ru,getAbsoluteURL:vg,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),mp(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:J1[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 Tg extends iu{constructor(e={}){const t=ve(e,{kind:Q1[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 Sg extends iu{constructor(e={}){const t=ve(e,{kind:Y1[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:G1,TrackClass:Tg,capitalName:"Audio"},video:{ListClass:X1,TrackClass:Sg,capitalName:"Video"},text:{ListClass:bg,TrackClass:Qn,capitalName:"Text"}};Object.keys(Dt).forEach(function(i){Dt[i].getterName=`${i}Tracks`,Dt[i].privateName=`${i}Tracks_`});const Hr={remoteText:{ListClass:bg,TrackClass:Qn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:K1,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 eS(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 _g(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 eS(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=Me(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=Me(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 tS(i,e){er[i]=er[i]||[],er[i].push(e)}function iS(i,e,t){i.setTimeout(()=>Xi(e,er[e.type],t,i),1)}function rS(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function nS(i,e,t){return i.reduceRight(su(t),e[t]())}function sS(i,e,t,r){return e[t](i.reduce(su(t),r))}function Cd(i,e,t,r=null){const n="call"+Me(t),s=i.reduce(su(n),r),a=s===la,l=a?null:e[t](s);return lS(i,t,l,a),l}const aS={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},oS={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 lS(i,e,t,r){for(let n=i.length-1;n>=0;n--){const s=i[n];s[e]&&s[e](r,t)}}function uS(i){oa.hasOwnProperty(i.id())&&delete oa[i.id()]}function cS(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=cS(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 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"},ua=function(i=""){const e=nu(i);return dS[e.toLowerCase()]||""},hS=(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)},Eg=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=Eg(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 pS=`<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,19 +167,19 @@ 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 Ju=Ra?10009:Da?461:8,Pn={codes:{play:415,pause:19,ff:417,rw:412,back:Ju},names:{415:"play",19:"pause",417:"ff",412:"rw",[Ju]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},eh=5;class GA extends Pt{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 n=t.key.substring(5).toLowerCase();this.move(n)}else if(Pn.isEventKey(t,"play")||Pn.isEventKey(t,"pause")||Pn.isEventKey(t,"ff")||Pn.isEventKey(t,"rw")){t.preventDefault();const n=Pn.getEventName(t);this.performMediaAction_(n)}else Pn.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()+eh);break;case"rw":this.userSeek_(this.player_.currentTime()-eh);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 n=null;const r=this.getCurrentComponent(e.target);t&&(n=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!n||!t)&&(r&&r.name()==="CloseButton"?this.refocusComponent():(this.pause(),r&&r.el()&&(this.lastFocusedComponent_=r)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function n(r){for(const i of r)i.hasOwnProperty("el_")&&i.getIsFocusable()&&i.getIsAvailableToBeFocused(i.el())&&t.push(i),i.hasOwnProperty("children_")&&i.children_.length>0&&n(i.children_)}return e.children_.forEach(r=>{if(r.hasOwnProperty("el_"))if(r.getIsFocusable&&r.getIsAvailableToBeFocused&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())){t.push(r);return}else r.hasOwnProperty("children_")&&r.children_.length>0?n(r.children_):r.hasOwnProperty("items")&&r.items.length>0?n(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const i=r.el_.querySelector(".vjs-errors-ok-button-container");i&&i.querySelectorAll("button").forEach((a,o)=>{t.push({name:()=>"ModalButton"+(o+1),el:()=>a,getPositions:()=>{const c=a.getBoundingClientRect(),h={x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left},m={x:c.left+c.width/2,y:c.top+c.height/2,width:0,height:0,top:c.top+c.height/2,right:c.left+c.width/2,bottom:c.top+c.height/2,left:c.left+c.width/2};return{boundingClientRect:h,center:m}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:c=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(let r=0;r<n.children.length;r++){const i=n.children[r],a=t(i);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 n of this.focusableComponents)if(n.el()===t)return n}}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 n=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(n.boundingClientRect,a.getPositions().boundingClientRect,e)),i=this.findBestCandidate_(n.center,r,e);i?this.focus(i):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,n){let r=1/0,i=null;for(const a of t){const o=a.getPositions().center,c=this.calculateDistance_(e,o,n);c<r&&(r=c,i=a)}return i}isInDirection_(e,t,n){switch(n){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,n){const r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);let a;switch(n){case"right":case"left":a=r+i*100;break;case"up":a=i*2+r*.5;break;case"down":a=i*5+r;break;default:a=r+i}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class XA extends ${constructor(e,t,n){const r=we({createEl:!1},t);if(super(e,r,n),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let i=0,a=t.playerOptions.techOrder;i<a.length;i++){const o=Ve(a[i]);let c=de.getTech(o);if(o||(c=$.getComponent(o)),c&&c.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}$.registerComponent("MediaLoader",XA);class To extends ${constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=n=>this.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",t={},n={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&pe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;const r=ae(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=ae("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 n=this.localize(e);this.controlText_=e,zs(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",n)}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",To);class Ul extends To{constructor(e,t){super(e,t),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return ae("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(ae("picture",{className:"vjs-poster",tabIndex:-1},{},ae("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()?ts(this.player_.play()):this.player_.pause())}}Ul.prototype.crossorigin=Ul.prototype.crossOrigin;$.registerComponent("PosterImage",Ul);const Ot="#222",th="#ccc",YA={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 ll(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; 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 Qt(s,e,t){try{s.style[e]=t}catch{return}}function sh(s){return s?`${s}px`:""}class KA extends ${constructor(e,t,n){super(e,t,n);const r=a=>this.updateDisplay(a),i=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",r),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",i),e.on("playerresize",i);const a=I.screen.orientation||I,o=I.screen.orientation?"change":"orientationchange";a.addEventListener(o,i),e.on("dispose",()=>a.removeEventListener(o,i));const c=this.options_.playerOptions.tracks||[];for(let h=0;h<c.length;h++)this.player_.addRemoteTextTrack(c[h],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),n=this.player_.cache_.selectedLanguage;let r,i,a;for(let o=0;o<t.length;o++){const c=t[o];n&&n.enabled&&n.language&&n.language===c.language&&c.kind in e?c.kind===n.kind?a=c:a||(a=c):n&&!n.enabled?(a=null,r=null,i=null):c.default&&(c.kind==="descriptions"&&!r?r=c:c.kind in e&&!i&&(i=c))}a?a.mode="showing":i?i.mode="showing":r&&(r.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 I.WebVTT=="function"&&I.WebVTT.processCues(I,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const c=e[o];c.mode==="showing"&&a.push(c)}this.updateForTrack(a);return}let n=null,r=null,i=e.length;for(;i--;){const a=e[i];a.mode==="showing"&&(a.kind==="descriptions"?n=a:r=a)}if(r?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):n&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(n)),!I.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,h=this.player_.el_.getBoundingClientRect().height;a.style="",Qt(a,"position","relative"),Qt(a,"height",h-c+"px"),Qt(a,"top","unset"),Na?Qt(a,"bottom",h+"px"):Qt(a,"bottom","0px"),o.length>0&&o.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()||!I.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),n=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let i=0,a=0;Math.abs(n-r)>.1&&(n>r?i=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),Qt(this.el_,"insetInline",sh(i)),Qt(this.el_,"insetBlock",sh(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),n=e.activeCues;let r=n.length;for(;r--;){const i=n[r];if(!i)continue;const a=i.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Qt(a.firstChild,"color",ll(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Qt(a.firstChild,"backgroundColor",ll(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Qt(a,"backgroundColor",ll(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 ${th}, 0 1px ${th}, -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 o=I.parseFloat(a.style.fontSize);a.style.fontSize=o*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=YA[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof I.WebVTT!="function"||e.every(n=>!n.activeCues))return;const t=[];for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i)t.push(r.activeCues[i])}I.WebVTT.processCues(I,t,this.el_);for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i){const a=r.activeCues[i].displayState;dn(a,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language?r.language:n)),r.language&&sr(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}$.registerComponent("TextTrackDisplay",KA);class QA extends ${createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),n=ae("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),r=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(n),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}$.registerComponent("LoadingSpinner",QA);class lt extends To{createEl(e,t={},n={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n);const r=ae(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const n=this.constructor.name;return pe.warn(`Adding an actionable (user controllable) child to a Button (${n}) 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",lt);class pf extends lt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",n=>this.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){ts(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const i=()=>r.focus();ni(t)?t.then(i,()=>{}):this.setTimeout(i,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}pf.prototype.controlText_="Play Video";$.registerComponent("BigPlayButton",pf);class ZA extends lt{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",ZA);class mf extends lt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),t.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ts(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))}}mf.prototype.controlText_="Play";$.registerComponent("PlayToggle",mf);class pr extends ${constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],n=>this.update(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=ae("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(n),this.contentEl_=ae("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=fn(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,pe.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_=Y.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}pr.prototype.labelText_="Time";pr.prototype.controlText_="Time";$.registerComponent("TimeDisplay",pr);class Vc extends pr{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)}}Vc.prototype.labelText_="Current Time";Vc.prototype.controlText_="Current Time";$.registerComponent("CurrentTimeDisplay",Vc);class $c extends pr{constructor(e,t){super(e,t);const n=r=>this.updateContent(r);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}$c.prototype.labelText_="Duration";$c.prototype.controlText_="Duration";$.registerComponent("DurationDisplay",$c);class JA extends ${createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return t.appendChild(n),e.appendChild(t),e}}$.registerComponent("TimeDivider",JA);class Hc extends pr{constructor(e,t){super(e,t),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(ae("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)}}Hc.prototype.labelText_="Remaining Time";Hc.prototype.controlText_="Remaining Time";$.registerComponent("RemainingTimeDisplay",Hc);class eS extends ${constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=ae("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(ae("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(Y.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",eS);class ff extends lt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),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_=ae("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()}}ff.prototype.controlText_="Seek to live, currently playing live";$.registerComponent("SeekToLive",ff);function bi(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var tS=Object.freeze({__proto__:null,clamp:bi});class Wc extends ${constructor(e,t){super(e,t),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),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={},n={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,t,n)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ls&&e.preventDefault(),qm(),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;Vm(),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(bi(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=fo(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,n=t&&t.enabled,r=t&&t.horizontalSeek;n?r&&e.key==="ArrowLeft"||!r&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r&&e.key==="ArrowRight"||!r&&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",Wc);const cl=(s,e)=>bi(s/e*100,0,100).toFixed(2)+"%";class sS extends ${constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=ae("span",{className:"vjs-control-text"}),n=ae("span",{textContent:this.localize("Loaded")}),r=Y.createTextNode(": ");return this.percentageEl_=ae("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(n),t.appendChild(r),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,n=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),a=this.partEls_,o=cl(i,r);this.percent_!==o&&(this.el_.style.width=o,zs(this.percentageEl_,o),this.percent_=o);for(let c=0;c<n.length;c++){const h=n.start(c),m=n.end(c);let _=a[c];_||(_=this.el_.appendChild(ae()),a[c]=_),!(_.dataset.start===h&&_.dataset.end===m)&&(_.dataset.start=h,_.dataset.end=m,_.style.left=cl(h,i),_.style.width=cl(m-h,i))}for(let c=a.length;c>n.length;c--)this.el_.removeChild(a[c-1]);a.length=n.length})}}$.registerComponent("LoadProgressBar",sS);class nS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,n){const r=ui(this.el_),i=nr(this.player_.el()),a=e.width*t;if(!i||!r)return;let o=e.left-i.left+a,c=e.width-a+(i.right-e.right);c||(c=e.width-a,o=a);let h=r.width/2;o<h?h+=h-o:c<h&&(h=c),h<0?h=0:h>r.width&&(h=r.width),h=Math.round(h),this.el_.style.right=`-${h}px`,this.write(n)}write(e){zs(this.el_,e)}updateTime(e,t,n,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let i;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),c=o-t*o;i=(c<1?"":"-")+fn(c,o)}else i=fn(n,a);this.update(e,t,i),r&&r()})}}$.registerComponent("TimeTooltip",nS);class zc extends ${constructor(e,t){super(e,t),this.setIcon("circle"),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const n=this.getChild("timeTooltip");if(!n)return;const r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}zc.prototype.options_={children:[]};!at&&!Wt&&zc.prototype.options_.children.push("timeTooltip");$.registerComponent("PlayProgressBar",zc);class gf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,()=>{this.el_.style.left=`${e.width*t}px`})}}gf.prototype.options_={children:["timeTooltip"]};$.registerComponent("MouseTimeDisplay",gf);const ra=5,nh=12;class Ao extends Wc{constructor(e,t){t=we(Ao.prototype.options_,t),t.children=[...t.children];const n=e.options_.disableSeekWhileScrubbingOnMobile&&(at||Wt);(!at&&!Wt||n)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=n,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=cs(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 Y&&"visibilityState"in Y&&this.on(Y,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){Y.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(Y.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let i=this.player_.duration();r&&r.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==n||this.duration_!==i)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[fn(n,i),fn(i,i)],"{1} of {2}")),this.currentTime_=n,this.duration_=i),this.bar&&this.bar.update(nr(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 n=this.player_.liveTracker;return n&&n.isLive()?(t=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){hi(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!hi(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const r=this.calculateDistance(e),i=this.player_.liveTracker;if(!i||!i.isLive())n=r*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(r>=.99){i.seekToLiveEdge();return}const a=i.seekableStart(),o=i.liveCurrentTime();if(n=a+r*i.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=n:this.userSeek_(n),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?ts(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+ra)}stepBack(){this.userSeek_(this.player_.currentTime()-ra)}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 n=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-ra*nh)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+ra*nh)):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 Y&&"visibilityState"in Y&&this.off(Y,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ao.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};$.registerComponent("SeekBar",Ao);class yf extends ${constructor(e,t){super(e,t),this.handleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.throttledHandleMouseSeek=cs(Le(this,this.handleMouseSeek),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const n=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!n&&!r)return;const i=t.el(),a=ui(i);let o=fo(i,e).x;o=bi(o,0,1),r&&r.update(a,o),n&&n.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&&ts(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,n=this.getChild("seekBar");n&&n.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()}}yf.prototype.options_={children:["seekBar"]};$.registerComponent("ProgressControl",yf);class _f extends lt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),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(){Y.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in I?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 Y.exitPictureInPicture=="function"&&super.show()}}_f.prototype.controlText_="Picture-in-Picture";$.registerComponent("PictureInPictureToggle",_f);class vf extends lt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),Y[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()}}vf.prototype.controlText_="Fullscreen";$.registerComponent("FullscreenToggle",vf);const rS=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class iS 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",iS);class aS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,n,r){if(!n){const i=nr(this.el_),a=nr(this.player_.el()),o=e.width*t;if(!a||!i)return;const c=e.left-a.left+o,h=e.width-o+(a.right-e.right);let m=i.width/2;c<m?m+=m-c:h<m&&(m=h),m<0?m=0:m>i.width&&(m=i.width),this.el_.style.right=`-${m}px`}this.write(`${r}%`)}write(e){zs(this.el_,e)}updateVolume(e,t,n,r,i){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,n,r.toFixed(0)),i&&i()})}}$.registerComponent("VolumeLevelTooltip",aS);class bf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,n){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,()=>{n?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}bf.prototype.options_={children:["volumeLevelTooltip"]};$.registerComponent("MouseVolumeLevelDisplay",bf);class So extends Wc{constructor(e,t){super(e,t),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),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){hi(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const n=this.el(),r=nr(n),i=this.vertical();let a=fo(n,e);a=i?a.y:a.x,a=bi(a,0,1),t.update(r,a,i)}hi(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)})}}So.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!at&&!Wt&&So.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");So.prototype.playerEvent="volumechange";$.registerComponent("VolumeBar",So);class Tf extends ${constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||tr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),rS(this,e),this.throttledHandleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),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)}}Tf.prototype.options_={children:["volumeBar"]};$.registerComponent("VolumeControl",Tf);const oS=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class Af extends lt{constructor(e,t){super(e,t),oS(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),n=this.player_.lastVolume_();if(t===0){const r=n<.1?.1:n;this.player_.volume(r),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"),at&&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),po(this.el_,[0,1,2,3].reduce((n,r)=>n+`${r?" ":""}vjs-vol-${r}`,"")),dn(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Af.prototype.controlText_="Mute";$.registerComponent("MuteToggle",Af);class Sf extends ${constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||tr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),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(Y,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ot(Y,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Sf.prototype.options_={children:["muteToggle","volumeControl"]};$.registerComponent("VolumePanel",Sf);class Ef extends lt{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(),n=this.player_.liveTracker,r=n&&n.isLive()?n.seekableEnd():this.player_.duration();let i;t+this.skipTime<=r?i=t+this.skipTime:i=r,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Ef.prototype.controlText_="Skip Forward";$.registerComponent("SkipForward",Ef);class wf extends lt{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(),n=this.player_.liveTracker,r=n&&n.isLive()&&n.seekableStart();let i;r&&t-this.skipTime<=r?i=r:t>=this.skipTime?i=t-this.skipTime:i=0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}wf.prototype.controlText_="Skip Backward";$.registerComponent("SkipBackward",wf);class kf extends ${constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}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_=ae(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(n){n.preventDefault(),n.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||Y.activeElement;if(!this.children().some(n=>n.el()===t)){const n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const n=t.filter(r=>r.el()===e.target)[0];if(!n)return;n.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",kf);class Gc extends ${constructor(e,t={}){super(e,t),this.menuButton_=new lt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const n=lt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=i=>this.handleClick(i);this.handleMenuKeyUp_=i=>this.handleMenuKeyUp(i),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",i=>this.handleKeyDown(i)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Lt(Y,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",i=>this.handleMouseLeave(i)),this.on("keydown",i=>this.handleSubmenuKeyDown(i))}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 kf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=ae("li",{className:"vjs-menu-title",textContent:Ve(this.options_.title),tabIndex:-1}),n=new $(this.player_,{el:t});e.addItem(n)}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=lt.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"),ot(Y,"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"),at&&Mm())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",Gc);class Xc extends Gc{constructor(e,t){const n=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!n)return;const r=Le(this,this.update);n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),n.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r),n.removeEventListener("labelchange",r)})}}$.registerComponent("TrackButton",Xc);class Ti extends To{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,n){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),n),i=ae("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(i):r.replaceChild(i,r.querySelector(".vjs-icon-placeholder")),r}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",Ti);class Ai extends Ti{constructor(e,t){const n=t.track,r=e.textTracks();t.label=n.label||n.language||"Unknown",t.selected=n.mode==="showing",super(e,t),this.track=n,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const i=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],i),r.addEventListener("change",i),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],i),r.removeEventListener("change",i),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof I.Event!="object")try{o=new I.Event("change")}catch{}o||(o=Y.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let r=0;r<n.length;r++){const i=n[r];this.kinds.indexOf(i.kind)!==-1&&(i===t?i.mode!=="showing"&&(i.mode="showing"):i.mode!=="disabled"&&(i.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",Ai);class Cf extends Ai{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 n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}$.registerComponent("OffTextTrackMenuItem",Cf);class mr extends Xc{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ai){let n;this.label_&&(n=`${this.label_} off`),e.push(new Cf(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i<r.length;i++){const a=r[i];if(this.kinds_.indexOf(a.kind)>-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}$.registerComponent("TextTrackButton",mr);class If extends Ti{constructor(e,t){const n=t.track,r=t.cue,i=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=i&&i<r.endTime,super(e,t),this.track=n,this.cue=r}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}$.registerComponent("ChaptersTrackMenuItem",If);class Yc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.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 n=e[t];if(n.kind===this.kind_)return n}}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 n=0,r=t.length;n<r;n++){const i=t[n],a=new If(this.player_,{track:this.track_,cue:i});e.push(a)}return e}}Yc.prototype.kind_="chapters";Yc.prototype.controlText_="Chapters";$.registerComponent("ChaptersButton",Yc);class Kc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("audio-description");const r=e.textTracks(),i=Le(this,this.handleTracksChange);r.addEventListener("change",i),this.on("dispose",function(){r.removeEventListener("change",i)})}handleTracksChange(e){const t=this.player().textTracks();let n=!1;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(a.kind!==this.kind_&&a.mode==="showing"){n=!0;break}}n?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Kc.prototype.kind_="descriptions";Kc.prototype.controlText_="Descriptions";$.registerComponent("DescriptionsButton",Kc);class Qc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Qc.prototype.kind_="subtitles";Qc.prototype.controlText_="Subtitles";$.registerComponent("SubtitlesButton",Qc);class Zc extends Ai{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",Zc);class Jc extends mr{constructor(e,t,n){super(e,t,n),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 Zc(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Jc.prototype.kind_="captions";Jc.prototype.controlText_="Captions";$.registerComponent("CaptionsButton",Jc);class xf extends Ai{createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):i.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(ae("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}$.registerComponent("SubsCapsMenuItem",xf);class ed extends mr{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 Zc(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,xf),e}}ed.prototype.kinds_=["captions","subtitles"];ed.prototype.controlText_="Subtitles";$.registerComponent("SubsCapsButton",ed);class Lf extends Ti{constructor(e,t){const n=t.track,r=e.audioTracks();t.label=n.label||n.language||"Unknown",t.selected=n.enabled,super(e,t),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const i=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",i),this.on("dispose",()=>{r.removeEventListener("change",i)})}createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(i.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(ae("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let n=0;n<t.length;n++){const r=t[n];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}$.registerComponent("AudioTrackMenuItem",Lf);class Pf extends Xc{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 n=0;n<t.length;n++){const r=t[n];e.push(new Lf(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}Pf.prototype.controlText_="Audio Track";$.registerComponent("AudioTrackButton",Pf);class td extends Ti{constructor(e,t){const n=t.rate,r=parseFloat(n,10);t.label=n,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=n,this.rate=r,this.on(e,"ratechange",i=>this.update(i))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}td.prototype.contentElType="button";$.registerComponent("PlaybackRateMenuItem",td);class Rf extends Gc{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=ae("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 n=e.length-1;n>=0;n--)t.push(new td(this.player(),{rate:e[n]+"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")}}Rf.prototype.controlText_="Playback Rate";$.registerComponent("PlaybackRateMenuButton",Rf);class Df extends ${buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},n={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,n)}}$.registerComponent("Spacer",Df);class lS extends Df{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}$.registerComponent("CustomControlSpacer",lS);class Nf extends ${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Nf.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};$.registerComponent("ControlBar",Nf);class Of extends hr{constructor(e,t){super(e,t),this.on(e,"error",n=>{this.open(n)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Of.prototype.options_=Object.assign({},hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});$.registerComponent("ErrorDisplay",Of);class Mf 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(),ae("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,""),n=ae("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),n}))}}$.registerComponent("TextTrackSelect",Mf);class hn extends ${constructor(e,t={}){super(e,t);const n=ae("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(n);const r=this.options_.selects;for(const i of r){const a=this.options_.selectConfigs[i],o=a.className,c=a.id.replace("%s",this.options_.id_);let h=null;const m=`vjs_select_${Bt()}`;if(this.options_.type==="colors"){h=ae("span",{className:o});const T=ae("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});T.setAttribute("for",m),h.appendChild(T)}const _=new Mf(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:c});this.addChild(_),this.options_.type==="colors"&&(h.appendChild(_.el()),this.el().appendChild(h))}}createEl(){return ae("fieldset",{className:this.options_.className})}}$.registerComponent("TextTrackFieldset",hn);class Uf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-text-legend-${n}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const i=new hn(e,{id_:n,legendId:`captions-background-${n}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(i);const a=new hn(e,{id_:n,legendId:`captions-window-${n}`,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 ae("div",{className:"vjs-track-settings-colors"})}}$.registerComponent("TextTrackSettingsColors",Uf);class Bf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-font-size-${n}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const i=new hn(e,{id_:n,legendId:`captions-edge-style-${n}`,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(i);const a=new hn(e,{id_:n,legendId:`captions-font-family-${n}`,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 ae("div",{className:"vjs-track-settings-font"})}}$.registerComponent("TextTrackSettingsFont",Bf);class Ff extends ${constructor(e,t={}){super(e,t);const n=this.localize("restore all settings to the default values"),r=new lt(e,{controlText:n,className:"vjs-default-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Reset"),this.addChild(r);const i=new lt(e,{controlText:n,className:"vjs-done-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return ae("div",{className:"vjs-track-settings-controls"})}}$.registerComponent("TrackSettingsControls",Ff);const dl="vjs-text-track-settings",rh=["#000","Black"],ih=["#00F","Blue"],ah=["#0FF","Cyan"],oh=["#0F0","Green"],lh=["#F0F","Magenta"],ch=["#F00","Red"],dh=["#FFF","White"],uh=["#FF0","Yellow"],ul=["1","Opaque"],hl=["0.5","Semi-Transparent"],hh=["0","Transparent"],qs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rh,dh,ch,oh,ih,uh,lh,ah],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ul,hl,hh],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[dh,rh,ch,oh,ih,uh,lh,ah],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:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ul,hl],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:[hh,hl,ul],className:"vjs-window-opacity vjs-opacity"}};qs.windowColor.options=qs.backgroundColor.options;function jf(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function cS(s,e){const t=s.options[s.options.selectedIndex].value;return jf(t,e)}function dS(s,e,t){if(e){for(let n=0;n<s.options.length;n++)if(jf(s.options[n].value,t)===e){s.selectedIndex=n;break}}}class uS extends hr{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=ae("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 Uf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const n=new Bf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(n);const r=new Ff(e);this.addChild(r)}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()}),Fn(qs,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 xm(qs,(e,t,n)=>{const r=cS(this.$(t.selector),t.parser);return r!==void 0&&(e[n]=r),e},{})}setValues(e){Fn(qs,(t,n)=>{dS(this.$(t.selector),e[n],t.parser)})}setDefaults(){Fn(qs,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(I.localStorage.getItem(dl))}catch(t){pe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?I.localStorage.setItem(dl,JSON.stringify(e)):I.localStorage.removeItem(dl)}catch(t){pe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}$.registerComponent("TextTrackSettings",uS);class hS extends ${constructor(e,t){let n=t.ResizeObserver||I.ResizeObserver;t.ResizeObserver===null&&(n=!1);const r=we({createEl:!n,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||I.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Zm(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const i=this.debouncedHandler_;let a=this.unloadListener_=function(){ot(this,"resize",i),ot(this,"unload",a),a=null};Lt(this.el_.contentWindow,"unload",a),Lt(this.el_.contentWindow,"resize",i)},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",hS);const pS={trackingThreshold:20,liveTolerance:15};class mS extends ${constructor(e,t){const n=we(pS,t,{createEl:!1});super(e,n),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(I.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),i=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-i)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===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 n=e?e.length:0;for(;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let n=e?e.length:0;for(;n--;)t.push(e.start(n));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",mS);class fS extends ${constructor(e,t){super(e,t),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:ae("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Bt()}`}),description:ae("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Bt()}`})},ae("div",{className:"vjs-title-bar"},{},Lm(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const i=this.state[r],a=this.els[r],o=n[r];go(a),i&&zs(a,i),t&&(t.removeAttribute(o),i&&t.setAttribute(o,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",fS);const gS={initialDisplay:4e3,position:[],takeFocus:!1};class yS extends lt{constructor(e,t){t=we(gS,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],n=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=ae("button",{},{type:"button",class:this.buildCSSClass()},ae("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",yS);const Bl=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),n=[];let r="";if(!t.length)return!1;for(let i=0;i<t.length;i++){const a=t[i].src;a&&n.indexOf(a)===-1&&n.push(a)}return n.length?(n.length===1&&(r=n[0]),s.triggerSourceset(r),!0):!1},_S=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=Y.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=Y.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",I.Element.prototype.appendChild.call(this,t),this.innerHTML}}),qf=(s,e)=>{let t={};for(let n=0;n<s.length&&(t=Object.getOwnPropertyDescriptor(s[n],e),!(t&&t.set&&t.get));n++);return t.enumerable=!0,t.configurable=!0,t},vS=s=>qf([s.el(),I.HTMLMediaElement.prototype,I.Element.prototype,_S],"innerHTML"),ph=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},n=vS(s),r=i=>(...a)=>{const o=i.apply(e,a);return Bl(s),o};["append","appendChild","insertAdjacentHTML"].forEach(i=>{e[i]&&(t[i]=e[i],e[i]=r(t[i]))}),Object.defineProperty(e,"innerHTML",we(n,{set:r(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(i=>{e[i]=t[i]}),Object.defineProperty(e,"innerHTML",n)},s.one("sourceset",e.resetSourceWatch_)},bS=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?cf(I.Element.prototype.getAttribute.call(this,"src")):""},set(s){return I.Element.prototype.setAttribute.call(this,"src",s),s}}),TS=s=>qf([s.el(),I.HTMLMediaElement.prototype,bS],"src"),AS=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=TS(s),n=e.setAttribute,r=e.load;Object.defineProperty(e,"src",we(t,{set:i=>{const a=t.set.call(e,i);return s.triggerSourceset(e.src),a}})),e.setAttribute=(i,a)=>{const o=n.call(e,i,a);return/src/i.test(i)&&s.triggerSourceset(e.src),o},e.load=()=>{const i=r.call(e);return Bl(s)||(s.triggerSourceset(""),ph(s)),i},e.currentSrc?s.triggerSourceset(e.currentSrc):Bl(s)||ph(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=n,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class se extends de{constructor(e,t){super(e,t);const n=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const i=this.el_.childNodes;let a=i.length;const o=[];for(;a--;){const c=i[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!r&&!this.el_.hasAttribute("crossorigin")&&bo(c.src)&&(r=!0)):o.push(c))}for(let c=0;c<o.length;c++)this.el_.removeChild(o[c])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&r&&pe.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_(),(di||uo)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),se.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){AS(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const n=()=>{t=[];for(let i=0;i<e.length;i++){const a=e[i];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};n(),e.addEventListener("change",n),this.on("dispose",()=>e.removeEventListener("change",n));const r=()=>{for(let i=0;i<t.length;i++){const a=t[i];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",n),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(r=>{this.el()[`${n}Tracks`].removeEventListener(r,this[`${n}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Ut[e],n=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!n||!n.addEventListener)return;const i={change:o=>{const c={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(c),e==="text"&&this[ar.remoteText.getterName]().trigger(c)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let c=0;c<r.length;c++){let h=!1;for(let m=0;m<n.length;m++)if(n[m]===r[c]){h=!0;break}h||o.push(r[c])}for(;o.length;)r.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=i,Object.keys(i).forEach(o=>{const c=i[o];n.addEventListener(o,c),this.on("dispose",h=>n.removeEventListener(o,c))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Ut.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),se.disposeMediaElement(e),e=n}else{e=Y.createElement("video");const n=this.options_.tag&&js(this.options_.tag),r=we({},n);(!di||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Fm(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&sr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let n=0;n<t.length;n++){const r=t[n],i=this.options_[r];typeof i<"u"&&(i?sr(e,r,r):mo(e,r),e[r]=i)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let n=!1;const r=function(){n=!0};this.on("loadstart",r);const i=function(){n||this.trigger("loadstart")};this.on("loadedmetadata",i),this.ready(function(){this.off("loadstart",r),this.off("loadedmetadata",i),n||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(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ho?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){pe(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Wt&&ls&&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)ts(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 pe.error("Invalid source URL."),!1;const n={src:e};t&&(n.type=t);const r=ae("source",{},n);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return pe.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const n of t)if(n.src===e)return this.el_.removeChild(n),!0;return pe.warn(`No matching source element found with src: ${e}`),!1}reset(){se.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):super.addTextTrack(e,t,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=Y.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 n=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let n=t.length;for(;n--;)(e===t[n]||e===t[n].track)&&this.el().removeChild(t[n])}}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),I.performance&&(e.creationTime=I.performance.now()),e}}oo(se,"TEST_VID",function(){if(!cr())return;const s=Y.createElement("video"),e=Y.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});se.isSupported=function(){try{se.TEST_VID.volume=.5}catch{return!1}return!!(se.TEST_VID&&se.TEST_VID.canPlayType)};se.canPlayType=function(s){return se.TEST_VID.canPlayType(s)};se.canPlaySource=function(s,e){return se.canPlayType(s.type)};se.canControlVolume=function(){try{const s=se.TEST_VID.volume;se.TEST_VID.volume=s/2+.1;const e=s!==se.TEST_VID.volume;return e&&at?(I.setTimeout(()=>{se&&se.prototype&&(se.prototype.featuresVolumeControl=s!==se.TEST_VID.volume)}),!1):e}catch{return!1}};se.canMuteVolume=function(){try{const s=se.TEST_VID.muted;return se.TEST_VID.muted=!s,se.TEST_VID.muted?sr(se.TEST_VID,"muted","muted"):mo(se.TEST_VID,"muted","muted"),s!==se.TEST_VID.muted}catch{return!1}};se.canControlPlaybackRate=function(){if(Wt&&ls&&lo<58)return!1;try{const s=se.TEST_VID.playbackRate;return se.TEST_VID.playbackRate=s/2+.1,s!==se.TEST_VID.playbackRate}catch{return!1}};se.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(Y.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(Y.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(Y.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(Y.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};se.supportsNativeTextTracks=function(){return ho||at&&ls};se.supportsNativeVideoTracks=function(){return!!(se.TEST_VID&&se.TEST_VID.videoTracks)};se.supportsNativeAudioTracks=function(){return!!(se.TEST_VID&&se.TEST_VID.audioTracks)};se.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([s,e]){oo(se.prototype,s,()=>se[e](),!0)});se.prototype.featuresVolumeControl=se.canControlVolume();se.prototype.movingMediaElementInDOM=!at;se.prototype.featuresFullscreenResize=!0;se.prototype.featuresProgressEvents=!0;se.prototype.featuresTimeupdateEvents=!0;se.prototype.featuresVideoFrameCallback=!!(se.TEST_VID&&se.TEST_VID.requestVideoFrameCallback);se.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&function(){try{s.load()}catch{}}()}};se.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&function(){try{s.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){se.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){se.prototype["set"+Ve(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){se.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){se.prototype["set"+Ve(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){se.prototype[s]=function(){return this.el_[s]()}});de.withSourceHandlers(se);se.nativeSourceHandler={};se.nativeSourceHandler.canPlayType=function(s){try{return se.TEST_VID.canPlayType(s)}catch{return""}};se.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return se.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=jc(s.src);return se.nativeSourceHandler.canPlayType(`video/${t}`)}return""};se.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};se.nativeSourceHandler.dispose=function(){};se.registerSourceHandler(se.nativeSourceHandler);de.registerTech("Html5",se);const Vf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],pl={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Fl=["tiny","xsmall","small","medium","large","xlarge","huge"],ca={};Fl.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;ca[s]=`vjs-layout-${e}`});const SS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ne extends ${constructor(e,t,n){if(e.id=e.id||t.id||`vjs_video_${Bt()}`,t=Object.assign(Ne.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,n),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=Cm(this.id_),this.fsApi_=xa,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&&js(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ne.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(),Mc(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Lt(Y,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=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=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new I.DOMParser().parseFromString(zA,"image/svg+xml");if(a.querySelector("parsererror"))pe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const o=a.documentElement;o.style.display="none",this.el_.appendChild(o),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 GA(this),this.addClass("vjs-spatial-navigation-enabled")),di&&this.addClass("vjs-touch-enabled"),at||this.addClass("vjs-workinghover"),Ne.players[this.id_]=this;const i=xl.split(".")[0];this.addClass(`vjs-v${i}`),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"),ot(Y,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ot(Y,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ne.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),VA(this),gt.names.forEach(e=>{const t=gt[e],n=this[t.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";n?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const i=js(e);if(r){for(t=this.el_=e,e=this.tag=Y.createElement("video");t.children.length;)e.appendChild(t.firstChild);ti(t,"video-js")||dn(t,"video-js"),t.appendChild(e),n=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),i.tabindex="-1",ls&&co&&(e.setAttribute("role","application"),i.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in i&&delete i.width,"height"in i&&delete i.height,Object.getOwnPropertyNames(i).forEach(function(c){r&&c==="class"||t.setAttribute(c,i[c]),r&&e.setAttribute(c,i[c])}),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(c=>Om[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),I.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Km("vjs-styles-dimensions");const c=Hs(".vjs-styles-defaults"),h=Hs("head");h.insertBefore(this.styleEl_,c?c.nextSibling:h.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 o=e.getElementsByTagName("a");for(let c=0;c<o.length;c++){const h=o.item(c);dn(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!n&&e.parentNode.insertBefore(t,e),Pl(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"){pe.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 n=e+"_";if(t===void 0)return this[n]||0;if(t===""||t==="auto"){this[n]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){pe.error(`Improper value "${t}" supplied for for ${e}`);return}this[n]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ts(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),_A(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(I.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,h=this.tech_&&this.tech_.el();h&&(o>=0&&(h.width=o),c>=0&&(h.height=c));return}let e,t,n,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const i=n.split(":"),a=i[1]/i[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())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),Qm(this.styleEl_,`
|
|
172
|
-
.${
|
|
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 gS 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 mS 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=Me(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",mS);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",fS={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 yS 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=fS[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",yS);class _S 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",_S);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 wg 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}}wg.prototype.controlText_="Play Video";$.registerComponent("BigPlayButton",wg);class bS 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",bS);class kg 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))}}kg.prototype.controlText_="Play";$.registerComponent("PlayToggle",kg);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 vS 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",vS);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 TS 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",TS);class Cg 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()}}Cg.prototype.controlText_="Seek to live, currently playing live";$.registerComponent("SeekToLive",Cg);function Jn(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var SS=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(),Zp(),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;eg(),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 ES 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",ES);class wS 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",wS);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 Ig 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`})}}Ig.prototype.options_={children:["timeTooltip"]};$.registerComponent("MouseTimeDisplay",Ig);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 Ag 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()}}Ag.prototype.options_={children:["seekBar"]};$.registerComponent("ProgressControl",Ag);class xg 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()}}xg.prototype.controlText_="Picture-in-Picture";$.registerComponent("PictureInPictureToggle",xg);class Lg 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()}}Lg.prototype.controlText_="Fullscreen";$.registerComponent("FullscreenToggle",Lg);const kS=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 CS 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",CS);class IS 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",IS);class Dg 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`})}}Dg.prototype.options_={children:["volumeLevelTooltip"]};$.registerComponent("MouseVolumeLevelDisplay",Dg);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 Pg 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),kS(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)}}Pg.prototype.options_={children:["volumeBar"]};$.registerComponent("VolumeControl",Pg);const AS=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 Rg extends tt{constructor(e,t){super(e,t),AS(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)}}Rg.prototype.controlText_="Mute";$.registerComponent("MuteToggle",Rg);class Ng 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()}}Ng.prototype.options_={children:["muteToggle","volumeControl"]};$.registerComponent("VolumePanel",Ng);class Og 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]))}}Og.prototype.controlText_="Skip Forward";$.registerComponent("SkipForward",Og);class Ug 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]))}}Ug.prototype.controlText_="Skip Backward";$.registerComponent("SkipBackward",Ug);class Mg 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",Mg);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 Mg(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=se("li",{className:"vjs-menu-title",textContent:Me(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&&Xp())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 Bg 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",Bg);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 Bg(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 Fg 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",Fg);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(Me(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 Fg(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 jg 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",jg);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(Me(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,jg),e}}_u.prototype.kinds_=["captions","subtitles"];_u.prototype.controlText_="Subtitles";$.registerComponent("SubsCapsButton",_u);class qg 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",qg);class $g 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 qg(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}$g.prototype.controlText_="Audio Track";$.registerComponent("AudioTrackButton",$g);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 Vg 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")}}Vg.prototype.controlText_="Playback Rate";$.registerComponent("PlaybackRateMenuButton",Vg);class Hg 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",Hg);class xS extends Hg{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}$.registerComponent("CustomControlSpacer",xS);class zg extends ${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}zg.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};$.registerComponent("ControlBar",zg);class Wg 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):""}}Wg.prototype.options_=Object.assign({},Kr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});$.registerComponent("ErrorDisplay",Wg);class Gg 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",Gg);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 Gg(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 Xg 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",Xg);class Kg 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",Kg);class Yg 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",Yg);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 Qg(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function LS(i,e){const t=i.options[i.options.selectedIndex].value;return Qg(t,e)}function DS(i,e,t){if(e){for(let r=0;r<i.options.length;r++)if(Qg(i.options[r].value,t)===e){i.selectedIndex=r;break}}}class PS 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 Xg(e,{textTrackComponentid:this.id_,selectConfigs:Ni,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const r=new Kg(e,{textTrackComponentid:this.id_,selectConfigs:Ni,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(r);const n=new Yg(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 qp(Ni,(e,t,r)=>{const n=LS(this.$(t.selector),t.parser);return n!==void 0&&(e[r]=n),e},{})}setValues(e){wr(Ni,(t,r)=>{DS(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",PS);class RS 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_=cg(()=>{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",RS);const NS={trackingThreshold:20,liveTolerance:15};class OS extends ${constructor(e,t){const r=ve(NS,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",OS);class US 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"},{},$p(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",US);const MS={initialDisplay:4e3,position:[],takeFocus:!1};class BS extends tt{constructor(e,t){t=ve(MS,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",BS);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},FS=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}}),Jg=(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},jS=i=>Jg([i.el(),x.HTMLMediaElement.prototype,x.Element.prototype,FS],"innerHTML"),Vd=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=jS(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_)},qS=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?vg(x.Element.prototype.getAttribute.call(this,"src")):""},set(i){return x.Element.prototype.setAttribute.call(this,"src",i),i}}),$S=i=>Jg([i.el(),x.HTMLMediaElement.prototype,qS],"src"),VS=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=$S(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_(){VS(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,Qp(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"+Me(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"+Me(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 Zg=["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 HS={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=Fp(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(pS,"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 gS(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),uS(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=>Gp[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),x.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=lg("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),F1(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),ug(this.styleEl_,`
|
|
172
|
+
.${n} {
|
|
173
173
|
width: ${e}px;
|
|
174
174
|
height: ${t}px;
|
|
175
175
|
}
|
|
176
176
|
|
|
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
|
|
180
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=Me(e),n=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(oe.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};lt.names.forEach(u=>{const p=lt[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=oe.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(Ce(this,this.handleTechReady_),!0),Sd.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Zg.forEach(u=>{this.on(this.tech_,u,p=>this[`handleTech${Me(u)}_`](p))}),Object.keys(Mo).forEach(u=>{this.on(this.tech_,u,p=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Mo[u]}_`].bind(this),event:p});return}this[`handleTech${Mo[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)&&Jo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){lt.names.forEach(e=>{const t=lt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Sd.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&&ue.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":xl}}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 r=this.muted();this.muted(!0);const i=()=>{this.muted(r)};this.playTerminatedQueue_.push(i);const a=this.play();if(ni(a))return a.catch(o=>{throw i(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),ni(n)&&(n=n.catch(t))):e==="muted"&&!this.muted()?n=t():n=this.play(),!!ni(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,n="";typeof t!="string"&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=WA(this,t)),this.cache_.source=we({},e,{src:t,type:n});const r=this.cache_.sources.filter(c=>c.src&&c.src===t),i=[],a=this.$$("source"),o=[];for(let c=0;c<a.length;c++){const h=js(a[c]);i.push(h),h.src&&h.src===t&&o.push(h.src)}o.length&&!r.length?this.cache_.sources=i:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=i=>this.updateSourceCaches_(i);const n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],i=>{if(i.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()?ts(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()&&!Y.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 n=this.el();let r=Y[this.fsApi_.fullscreenElement]===n;!r&&n.matches&&(r=n.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}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 jA)return BA(this.middleware_,this.tech_,e,t);if(e in Qu)return Ku(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(n){throw pe(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in FA)return UA(this.middleware_,this.tech_,e);if(e in Qu)return Ku(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(pe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(pe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(pe(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=ts){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),n=!!(ho||at);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=i=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&n&&this.load();return}const r=this.techGet_("play");n&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}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(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ht(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=Ht(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ht(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 of(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let n=e.end(e.length-1);return n>t&&(n=t),n}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((n,r)=>{function i(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){i(),n()}function o(h,m){i(),r(m)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const c=t.requestFullscreenHelper_(e);c&&(c.then(i,i),c.then(n,r))})}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 n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,n)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",i)}function i(){r(),t()}function a(c,h){r(),n(h)}e.one("fullscreenchange",i),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(t,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=Y[this.fsApi_.exitFullscreen]();return e&&ts(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=Y.documentElement.style.overflow,Lt(Y,"keydown",this.boundFullWindowOnEscKey_),Y.documentElement.style.overflow="hidden",dn(Y.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,ot(Y,"keydown",this.boundFullWindowOnEscKey_),Y.documentElement.style.overflow=this.docOrigOverflow,po(Y.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&&I.documentPictureInPicture){const e=Y.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(ae("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),I.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Gm(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",n=>{const r=n.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in Y&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(I.documentPictureInPicture&&I.documentPictureInPicture.window)return I.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in Y)return Y.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();return n.isContentEditable?!0:r==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(n.type)===-1:["textarea"].indexOf(r)!==-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:n=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:i=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=$.getComponent("FullscreenToggle");Y[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),$.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),$.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let n=0,r=this.options_.techOrder;n<r.length;n++){const i=r[n];let a=de.getTech(i);if(a||(a=$.getComponent(i)),!a){pe.error(`The "${i}" 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(o=>[o,de.getTech(o)]).filter(([o,c])=>c?c.isSupported():(pe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,c,h){let m;return o.some(_=>c.some(T=>{if(m=h(_,T),m)return!0})),m};let r;const i=o=>(c,h)=>o(h,c),a=([o,c],h)=>{if(c.canPlaySource(h,this.options_[o.toLowerCase()]))return{source:h,tech:o}};return this.options_.sourceOrder?r=n(e,t,i(a)):r=n(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=hf(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),OA(this,n[0],(r,i)=>{if(this.middleware_=i,t||(this.cache_.sources=n),this.updateSourceCaches_(r),this.src_(r)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}MA(i,this.tech_)}),n.length>1){const r=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},i=()=>{this.off("error",r)};this.one("error",r),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",i)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?sf(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();ts(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}),Ts(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:n,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:i}=n||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.updateContent(),i&&(i.update(),i.loadProgressBar&&i.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($s("beforeerror").forEach(t=>{const n=t(this,e);if(!(os(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),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 je(e),this.addClass("vjs-error"),pe.error(`(CODE:${this.error_.code} ${je.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),$s("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,n;const r=Le(this,this.reportUserActivity),i=function(_){(_.screenX!==t||_.screenY!==n)&&(t=_.screenX,n=_.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(_){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",i),this.on("mouseup",o),this.on("mouseleave",o);const c=this.getChild("controlBar");c&&!at&&!Wt&&(c.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let h;const m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(h);const _=this.options_.inactivityTimeout;_<=0||(h=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"),n=t&&t.currentHeight();e.forEach(r=>{r!==t&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=n,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(n),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,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}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(),Ts(this)&&this.trigger("languagechange"))}languages(){return we(Ne.prototype.options_.languages,this.languages_)}toJSON(){const e=we(this.options_),t=e.tracks;e.tracks=[];for(let n=0;n<t.length;n++){let r=t[n];r=we(r),r.player=void 0,e.tracks[n]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const n=new hr(this,t);return this.addChild(n),n.on("dispose",()=>{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let n=0;n<Fl.length;n++){const r=Fl[n],i=this.breakpoints_[r];if(t<=i){if(e===r)return;e&&this.removeClass(ca[e]),this.addClass(ca[r]),this.breakpoint_=r;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({},SS,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 ca[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const n=this.crossOrigin();this.reset(),this.cache_.media=we(e);const{artist:r,artwork:i,description:a,poster:o,src:c,textTracks:h,title:m}=this.cache_.media;!i&&o&&(this.cache_.media.artwork=[{src:o,type:Fa(o)}]),n&&this.crossOrigin(n),c&&this.src(c),o&&this.poster(o),Array.isArray(h)&&h.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:m,description:a||r||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),n=Array.prototype.map.call(this.remoteTextTracks(),i=>({kind:i.kind,label:i.label,language:i.language,src:i.src})),r={src:t,textTracks:n};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Fa(r.poster)}]),r}return we(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},n=js(e),r=n["data-setup"];if(ti(e,"vjs-fill")&&(n.fill=!0),ti(e,"vjs-fluid")&&(n.fluid=!0),r!==null)try{Object.assign(n,JSON.parse(r||"{}"))}catch(i){pe.error("data-setup",i)}if(Object.assign(t,n),e.hasChildNodes()){const i=e.childNodes;for(let a=0,o=i.length;a<o;a++){const c=i[a],h=c.nodeName.toLowerCase();h==="source"?t.sources.push(js(c)):h==="track"&&t.tracks.push(js(c))}}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"))}}gt.names.forEach(function(s){const e=gt[s];Ne.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ne.prototype.crossorigin=Ne.prototype.crossOrigin;Ne.players={};const jr=I.navigator;Ne.prototype.options_={techOrder:de.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:jr&&(jr.languages&&jr.languages[0]||jr.userLanguage||jr.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};Vf.forEach(function(s){Ne.prototype[`handleTech${Ve(s)}_`]=function(){return this.trigger(s)}});$.registerComponent("Player",Ne);const ja="plugin",Vn="activePlugins_",Mn={},qa=s=>Mn.hasOwnProperty(s),da=s=>qa(s)?Mn[s]:void 0,$f=(s,e)=>{s[Vn]=s[Vn]||{},s[Vn][e]=!0},Va=(s,e,t)=>{const n=(t?"before":"")+"pluginsetup";s.trigger(n,e),s.trigger(n+":"+e.name,e)},ES=function(s,e){const t=function(){Va(this,{name:s,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return $f(this,s),Va(this,{name:s,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t},mh=(s,e)=>(e.prototype.name=s,function(...t){Va(this,{name:s,plugin:e,instance:null},!0);const n=new e(this,...t);return this[s]=()=>n,Va(this,n.getEventHash()),n});let ds=class ua{constructor(e){if(this.constructor===ua)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Mc(this),delete this.trigger,tf(this,this.constructor.defaultState),$f(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 ur(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[Vn][e]=!1,this.player=this.state=null,t[e]=mh(e,Mn[e])}static isBasic(e){const t=typeof e=="string"?da(e):e;return typeof t=="function"&&!ua.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(qa(e))pe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ne.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 Mn[e]=t,e!==ja&&(ua.isBasic(t)?Ne.prototype[e]=ES(e,t):Ne.prototype[e]=mh(e,t)),t}static deregisterPlugin(e){if(e===ja)throw new Error("Cannot de-register base plugin.");qa(e)&&(delete Mn[e],delete Ne.prototype[e])}static getPlugins(e=Object.keys(Mn)){let t;return e.forEach(n=>{const r=da(n);r&&(t=t||{},t[n]=r)}),t}static getPluginVersion(e){const t=da(e);return t&&t.VERSION||""}};ds.getPlugin=da;ds.BASE_PLUGIN_NAME=ja;ds.registerPlugin(ja,ds);Ne.prototype.usingPlugin=function(s){return!!this[Vn]&&this[Vn][s]===!0};Ne.prototype.hasPlugin=function(s){return!!qa(s)};function wS(s,e){let t=!1;return function(...n){return t||pe.warn(s),t=!0,e.apply(this,n)}}function zt(s,e,t,n){return wS(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,n)}var kS={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 Hf=s=>s.indexOf("#")===0?s.slice(1):s;function P(s,e,t){let n=P.getPlayer(s);if(n)return e&&pe.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&n.ready(t),n;const r=typeof s=="string"?Hs("#"+Hf(s)):s;if(!dr(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const i="getRootNode"in r&&r.getRootNode()instanceof I.ShadowRoot?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!i.contains(r))&&pe.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),$s("beforesetup").forEach(o=>{const c=o(r,we(e));if(!os(c)||Array.isArray(c)){pe.error("please return an object in beforesetup hooks");return}e=we(e,c)});const a=$.getComponent("Player");return n=new a(r,e,t),$s("setup").forEach(o=>o(n)),n}P.hooks_=_s;P.hooks=$s;P.hook=rA;P.hookOnce=iA;P.removeHook=km;if(I.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&cr()){let s=Hs(".vjs-styles-defaults");if(!s){s=Km("vjs-styles-defaults");const e=Hs("head");e&&e.insertBefore(s,e.firstChild),Qm(s,`
|
|
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=hS(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 oS)return sS(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 aS)return nS(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 _g(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=>(sg(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=Eg(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]),iS(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}rS(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?gg(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({},HS,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};Zg.forEach(function(i){Ae.prototype[`handleTech${Me(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,em=(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)},zS=function(i,e){const t=function(){ha(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return em(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,pg(this,this.constructor.defaultState),em(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]=zS(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 WS(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 WS(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}var GS={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 tm=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("#"+tm(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=k1;B.hookOnce=C1;B.removeHook=Bp;if(x.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Wr()){let i=Ui(".vjs-styles-defaults");if(!i){i=lg("vjs-styles-defaults");const e=Ui("head");e&&e.insertBefore(i,e.firstChild),ug(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
|
-
`)}}
|
|
192
|
-
`;for(let t=0;t<
|
|
193
|
-
`}return e}const ss=1/30,ns=ss*3,Gf=function(s,e){const t=[];let n;if(s&&s.length)for(n=0;n<s.length;n++)e(s.start(n),s.end(n))&&t.push([s.start(n),s.end(n)]);return ct(t)},Un=function(s,e){return Gf(s,function(t,n){return t-ns<=e&&n+ns>=e})},ia=function(s,e){return Gf(s,function(t){return t-ss>=e})},LS=function(s){if(s.length<2)return ct();const e=[];for(let t=1;t<s.length;t++){const n=s.end(t-1),r=s.start(t);e.push([n,r])}return ct(e)},PS=function(s,e){let t=null,n=null,r=0;const i=[],a=[];if(!s||!s.length||!e||!e.length)return ct();let o=s.length;for(;o--;)i.push({time:s.start(o),type:"start"}),i.push({time:s.end(o),type:"end"});for(o=e.length;o--;)i.push({time:e.start(o),type:"start"}),i.push({time:e.end(o),type:"end"});for(i.sort(function(c,h){return c.time-h.time}),o=0;o<i.length;o++)i[o].type==="start"?(r++,r===2&&(t=i[o].time)):i[o].type==="end"&&(r--,r===1&&(n=i[o].time)),t!==null&&n!==null&&(a.push([t,n]),t=null,n=null);return ct(a)},Xf=s=>{const e=[];if(!s||!s.length)return"";for(let t=0;t<s.length;t++)e.push(s.start(t)+" => "+s.end(t));return e.join(", ")},RS=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},ln=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},DS=function(s,e){if(s===e)return!1;if(!s&&e||!e&&s||s.length!==e.length)return!0;for(let t=0;t<s.length;t++)if(s.start(t)!==e.start(t)||s.end(t)!==e.end(t))return!0;return!1},ml=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},sd=function(s,e){let t=0;if(!s||!s.length)return t;for(let n=0;n<s.length;n++){const r=s.start(n),i=s.end(n);if(!(e>i)){if(e>r&&e<=i){t+=i-e;continue}t+=i-r}}return t},nd=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(n){t+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(t+=s.partTargetDuration)}),t},jl=s=>(s.segments||[]).reduce((e,t,n)=>(t.parts?t.parts.forEach(function(r,i){e.push({duration:r.duration,segmentIndex:n,partIndex:i,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e),[]),Yf=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Kf=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let n=(t||[]).reduce((r,i)=>r+(i.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},Qf=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Yf(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},NS=function(s,e){let t=0,n=e-s.mediaSequence,r=s.segments[n];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;n--;){if(r=s.segments[n],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=nd(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},OS=function(s,e){let t=0,n,r=e-s.mediaSequence;for(;r<s.segments.length;r++){if(n=s.segments[r],typeof n.start<"u")return{result:n.start-t,precise:!0};if(t+=nd(s,n),typeof n.end<"u")return{result:n.end-t,precise:!0}}return{result:-1,precise:!1}},Zf=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const n=NS(s,e);if(n.precise)return n.result;const r=OS(s,e);return r.precise?r.result:n.result+t},Jf=function(s,e,t){if(!s)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return I.Infinity}return Zf(s,e,t)},ri=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:n}){let r=0;if(t>n&&([t,n]=[n,t]),t<0){for(let i=t;i<Math.min(0,n);i++)r+=s;t=0}for(let i=t;i<n;i++)r+=e[i].duration;return r},eg=function(s,e,t,n){if(!s||!s.segments)return null;if(s.endList)return Jf(s);if(e===null)return null;e=e||0;let r=Zf(s,s.mediaSequence+s.segments.length,e);return t&&(n=typeof n=="number"?n:Qf(null,s),r-=n),Math.max(0,r)},MS=function(s,e,t){const n=e||0;let r=eg(s,e,!0,t);return r===null?ct():(r<n&&(r=n),ct(n,r))},US=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:n,startTime:r,exactManifestTimings:i}){let a=e-r;const o=jl(s);let c=0;for(let h=0;h<o.length;h++){const m=o[h];if(t===m.segmentIndex&&!(typeof n=="number"&&typeof m.partIndex=="number"&&n!==m.partIndex)){c=h;break}}if(a<0){if(c>0)for(let h=c-1;h>=0;h--){const m=o[h];if(a+=m.duration,i){if(a<0)continue}else if(a+ss<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r-ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(c<0){for(let h=c;h<0;h++)if(a-=s.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};c=0}for(let h=c;h<o.length;h++){const m=o[h];a-=m.duration;const _=m.duration>ss,T=a===0,S=_&&a+ss>=0;if(!((T||S)&&h!==o.length-1)){if(i){if(a>0)continue}else if(a-ss>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r+ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},tg=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},rd=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Eo=function(s){const e=tg(s);return!s.disabled&&!e},BS=function(s){return s.disabled},FS=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},sg=function(s,e){return e.attributes&&e.attributes[s]},jS=function(s,e,t,n=0){return sg("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-n*8)/e:NaN},ql=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(n=>Eo(n)?(n.attributes.BANDWIDTH||0)<t:!1).length===0},id=(s,e)=>!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),fh=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let n=!1;for(const r in t){for(const i in t[r])if(n=e(t[r][i]),n)break;if(n)break}return!!n},Si=s=>{if(!s||!s.playlists||!s.playlists.length)return fh(s,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],n=t.attributes&&t.attributes.CODECS;if(!(n&&n.split(",").every(r=>Op(r))||fh(s,r=>id(t,r))))return!1}return!0};var Et={liveEdgeDelay:Qf,duration:Jf,seekable:MS,getMediaInfoForTime:US,isEnabled:Eo,isDisabled:BS,isExcluded:tg,isIncompatible:rd,playlistEnd:eg,isAes:FS,hasAttribute:sg,estimateSegmentRequestTime:jS,isLowestEnabledRendition:ql,isAudioOnly:Si,playlistMatch:id,segmentDurationWithParts:nd};const{log:ng}=P,$n=(s,e)=>`${s}-${e}`,rg=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,qS=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:n=[],customTagMappers:r=[],llhls:i})=>{const a=new nT;s&&a.on("warn",s),e&&a.on("info",e),n.forEach(h=>a.addParser(h)),r.forEach(h=>a.addTagMapper(h)),a.push(t),a.end();const o=a.manifest;if(i||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(h){o.hasOwnProperty(h)&&delete o[h]}),o.segments&&o.segments.forEach(function(h){["parts","preloadHints"].forEach(function(m){h.hasOwnProperty(m)&&delete h[m]})})),!o.targetDuration){let h=10;o.segments&&o.segments.length&&(h=o.segments.reduce((m,_)=>Math.max(m,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${h}`}),o.targetDuration=h}const c=Yf(o);if(c.length&&!o.partTargetDuration){const h=c.reduce((m,_)=>Math.max(m,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${h}`}),ng.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.")),o.partTargetDuration=h}return o},fr=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const n in s.mediaGroups[t])for(const r in s.mediaGroups[t][n]){const i=s.mediaGroups[t][n][r];e(i,t,n,r)}})},ig=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},VS=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];ig({playlist:t,id:$n(e,t.uri)}),t.resolvedUri=St(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||ng.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},$S=s=>{fr(s,e=>{e.uri&&(e.resolvedUri=St(s.uri,e.uri))})},HS=(s,e)=>{const t=$n(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:I.location.href,resolvedUri:I.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return n.playlists[t]=n.playlists[0],n.playlists[e]=n.playlists[0],n},ag=(s,e,t=rg)=>{s.uri=e;for(let r=0;r<s.playlists.length;r++)if(!s.playlists[r].uri){const i=`placeholder-uri-${r}`;s.playlists[r].uri=i}const n=Si(s);fr(s,(r,i,a,o)=>{if(!r.playlists||!r.playlists.length){if(n&&i==="AUDIO"&&!r.uri)for(let c=0;c<s.playlists.length;c++){const h=s.playlists[c];if(h.attributes&&h.attributes.AUDIO&&h.attributes.AUDIO===a)return}r.playlists=[ze({},r)]}r.playlists.forEach(function(c,h){const m=t(i,a,o,c),_=$n(h,m);c.uri?c.resolvedUri=c.resolvedUri||St(s.uri,c.uri):(c.uri=h===0?m:_,c.resolvedUri=c.uri),c.id=c.id||_,c.attributes=c.attributes||{},s.playlists[c.id]=c,s.playlists[c.uri]=c})}),VS(s),$S(s)};class gh{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,n=t.startDate.getTime();this.trimProcessedDateRanges_(n),this.pendingDateRanges_=e.reduce((r,i)=>(r.set(i.id,i),r),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((n,r)=>{if(!this.processedDateRanges_.has(r)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),t.push(n),!!n.class))if(e[n.class]){const i=e[n.class].push(n);n.classListIndex=i-1}else e[n.class]=[n],n.classListIndex=0});for(const n of t){const r=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&r[n.classListIndex+1]?n.endTime=r[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,n)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(n)})}}const og=22,pn=({requestType:s,request:e,error:t,parseFailure:n})=>{const r=e.status<200||e.status>299,i=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},o=r&&!i||n;if(t&&i)a.error=ze({},t),a.errorType=P.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=P.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=P.Error.NetworkRequestTimeout;else if(o){const c=n?P.Error.NetworkBodyParserFailed:P.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},{EventTarget:WS}=P,zS=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let r=e.mediaSequence+e.segments.length;if(n){const i=n.parts||[],a=Kf(e)-1;a>-1&&a!==i.length-1&&(t._HLS_part=a),(a>-1||i.length)&&r--}t._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const n=new I.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&n.searchParams.set(r,t[r])}),s=n.toString()}return s},GS=(s,e)=>{if(!s)return e;const t=ve(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let n=0;n<e.parts.length;n++)s.parts&&s.parts[n]&&(t.parts[n]=ve(s.parts[n],e.parts[n]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},XS=(s,e,t)=>{const n=s.slice(),r=e.slice();t=t||0;const i=[];let a;for(let o=0;o<r.length;o++){const c=n[o+t],h=r[o];c?(a=c.map||a,i.push(GS(c,h))):(a&&!h.map&&(h.map=a),i.push(h))}return i},lg=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=St(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=St(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=St(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=St(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))})},cg=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let n=0;n<t.preloadHints.length;n++)if(t.preloadHints[n].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},dg=(s,e)=>s===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,Vl=(s,e,t=dg)=>{const n=ve(s,{}),r=n.playlists[e.id];if(!r||t(r,e))return null;e.segments=cg(e);const i=ve(r,e);if(i.preloadSegment&&!e.preloadSegment&&delete i.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}i.segments=XS(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}i.segments.forEach(a=>{lg(a,i.resolvedUri)});for(let a=0;a<n.playlists.length;a++)n.playlists[a].id===e.id&&(n.playlists[a]=i);return n.playlists[e.id]=i,n.playlists[e.uri]=i,fr(s,(a,o,c,h)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=i)}),n},$l=(s,e)=>{const t=s.segments||[],n=t[t.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],i=r&&r.duration||n&&n.duration;return e&&i?i*1e3:(s.partTargetDuration||s.targetDuration||10)*500},yh=(s,e,t)=>{if(!s)return;const n=[];return s.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:i,RESOLUTION:a,CODECS:o}=r.attributes;n.push({id:r.id,bandwidth:i,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:n}};class Bn extends WS{constructor(e,t,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=jt("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const i=t.options_;this.customTagParsers=i&&i.customTagParsers||[],this.customTagMappers=i&&i.customTagMappers||[],this.llhls=i&&i.llhls,this.dateRangesStorage_=new gh,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=St(this.main.uri,e.uri);this.llhls&&(t=zS(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,r)=>{if(this.request){if(n)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,n){const{uri:r,id:i}=t;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[i],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:pn({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return qS({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(n){this.error=n,this.error.metadata={errorType:P.Error.StreamingHlsPlaylistParserError,error:n}}}haveMetadata({playlistString:e,playlistObject:t,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const i={playlistInfo:{type:"media",uri:n}};this.trigger({type:"playlistparsestart",metadata:i});const a=t||this.parseManifest_({url:n,manifestString:e});a.lastRequest=Date.now(),ig({playlist:a,uri:n,id:r});const o=Vl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_($l(this.media(),!!o)),i.parsedPlaylist=yh(this.main.playlists,i.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:i}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),I.clearTimeout(this.mediaUpdateTimeout),I.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new gh,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(I.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=I.setTimeout(this.media.bind(this,e,!1),o);return}const n=this.state,r=!this.media_||e.id!==this.media_.id,i=this.main.playlists[e.id];if(i&&i.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,r&&(this.trigger("mediachanging"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_($l(e,!0)),!r)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"},(o,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Ha(e.resolvedUri,c),o)return this.playlistRequestError(this.request,e,n);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(I.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&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const n=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=I.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=I.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,n)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:n.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:n.responseText,code:2,metadata:pn({requestType:n.requestType,request:n,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Ha(this.src,n),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:n.responseText,url:this.src});e.parsedPlaylist=yh(r.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(r)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,ag(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=cg(n),n.segments.forEach(r=>{lg(r,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||I.location.href;this.main=HS(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const n=this.main,r=e.ID;let i=n.playlists.length;for(;i--;){const a=n.playlists[i];if(a.attributes["PATHWAY-ID"]===r){const o=a.resolvedUri,c=a.id;if(t){const h=this.createCloneURI_(a.resolvedUri,e),m=$n(r,h),_=this.createCloneAttributes_(r,a.attributes),T=this.createClonePlaylist_(a,m,e,_);n.playlists[i]=T,n.playlists[m]=T,n.playlists[h]=T}else n.playlists.splice(i,1);delete n.playlists[c],delete n.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const n=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!n.mediaGroups[i]||!n.mediaGroups[i][r])){for(const a in n.mediaGroups[i])if(a===r){for(const o in n.mediaGroups[i][a])n.mediaGroups[i][a][o].playlists.forEach((c,h)=>{const m=n.playlists[c.id],_=m.id,T=m.resolvedUri;delete n.playlists[_],delete n.playlists[T]});delete n.mediaGroups[i][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const n=this.main,r=n.playlists.length,i=this.createCloneURI_(t.resolvedUri,e),a=$n(e.ID,i),o=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,o);n.playlists[r]=c,n.playlists[a]=c,n.playlists[i]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,n=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!r.mediaGroups[i]||r.mediaGroups[i][t]))for(const a in r.mediaGroups[i]){if(a===n)r.mediaGroups[i][t]={};else continue;for(const o in r.mediaGroups[i][a]){const c=r.mediaGroups[i][a][o];r.mediaGroups[i][t][o]=ze({},c);const h=r.mediaGroups[i][t][o],m=this.createCloneURI_(c.resolvedUri,e);h.resolvedUri=m,h.uri=m,h.playlists=[],c.playlists.forEach((_,T)=>{const S=r.playlists[_.id],w=rg(i,t,o),b=$n(t,w);if(S&&!r.playlists[b]){const R=this.createClonePlaylist_(S,b,e),L=R.resolvedUri;r.playlists[b]=R,r.playlists[L]=R}h.playlists[T]=this.createClonePlaylist_(_,b,e)})}}})}createClonePlaylist_(e,t,n,r){const i=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:i,uri:i,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),ve(e,a)}createCloneURI_(e,t){const n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const i of Object.keys(r))n.searchParams.set(i,r[i]);return n.href}createCloneAttributes_(e,t){const n={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(n[r]=e)}),n}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes.keyId;r&&t.add(r.toLowerCase())}return t}}}const Hl=function(s,e,t,n){const r=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&r&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=r.byteLength||r.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(r||s.responseText)))),n(e,s)},YS=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(n=>{t=n(t)}),t},KS=(s,e,t,n)=>{!s||!s.size||s.forEach(r=>{r(e,t,n)})},ug=function(){const s=function e(t,n){t=ve({timeout:45e3},t);const r=e.beforeRequest||P.Vhs.xhr.beforeRequest,i=e._requestCallbackSet||P.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||P.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(P.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(r));const o=P.Vhs.xhr.original===!0?P.xhr:P.Vhs.xhr,c=YS(i,t);i.delete(r);const h=o(c||t,function(_,T){return KS(a,h,_,T),Hl(h,_,T,n)}),m=h.abort;return h.abort=function(){return h.aborted=!0,m.apply(h,arguments)},h.uri=t.uri,h.requestType=t.requestType,h.requestTime=Date.now(),h};return s.original=!0,s},QS=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Wl=function(s){const e={};return s.byterange&&(e.Range=QS(s.byterange)),e},ZS=function(s,e){return s.start(e)+"-"+s.end(e)},JS=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},eE=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},hg=function(s){const e={};return Object.keys(s).forEach(t=>{const n=s[t];Up(n)?e[t]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[t]=n}),e},Wa=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},pg=function(s){return s.resolvedUri},mg=s=>{const e=Array.prototype.slice.call(s),t=16;let n="",r,i;for(let a=0;a<e.length/t;a++)r=e.slice(a*t,a*t+t).map(JS).join(""),i=e.slice(a*t,a*t+t).map(eE).join(""),n+=r+" "+i+`
|
|
194
|
-
`;return n},tE=({bytes:s})=>mg(s),sE=s=>{let e="",t;for(t=0;t<s.length;t++)e+=ZS(s,t)+" ";return e};var nE=Object.freeze({__proto__:null,createTransferableMessage:hg,initSegmentId:Wa,segmentKeyId:pg,hexDump:mg,tagDump:tE,textRanges:sE});const fg=.25,rE=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},iE=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,aE=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(t<new Date(n.dateTimeObject))return null;for(let c=0;c<e.segments.length-1;c++){n=e.segments[c];const h=new Date(e.segments[c+1].dateTimeObject);if(t<h)break}const r=e.segments[e.segments.length-1],i=r.dateTimeObject,a=r.videoTimingInfo?iE(r.videoTimingInfo):r.duration+r.duration*fg,o=new Date(i.getTime()+a*1e3);return t>o?null:(t>new Date(i)&&(n=r),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Et.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},oE=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,n;for(let i=0;i<e.segments.length&&(n=e.segments[i],t=n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:t+n.duration,!(s<=t));i++);const r=e.segments[e.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<s)return null;if(s>t){if(s>t+r.duration*fg)return null;n=r}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:t-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},lE=(s,e)=>{let t,n;try{t=new Date(s),n=new Date(e)}catch{}const r=t.getTime();return(n.getTime()-r)/1e3},cE=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e<s.segments.length;e++)if(!s.segments[e].dateTimeObject)return!1;return!0},dE=({playlist:s,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const n=oE(e,s);if(!n)return t({message:"valid programTime was not found"});if(n.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:e},i=rE(e,n.segment);return i&&(r.programDateTime=i.toISOString()),t(null,r)},gg=({programTime:s,playlist:e,retryCount:t=2,seekTo:n,pauseAfterSeek:r=!0,tech:i,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!i.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!cE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=aE(s,e);if(!o)return a({message:`${s} was not found in the stream`});const c=o.segment,h=lE(c.dateTimeObject,s);if(o.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});n(o.estimatedStart+h),i.one("seeked",()=>{gg({programTime:s,playlist:e,retryCount:t-1,seekTo:n,pauseAfterSeek:r,tech:i,callback:a})});return}const m=c.start+h,_=()=>a(null,i.currentTime());i.one("seeked",_),r&&i.pause(),n(m)},fl=(s,e)=>{if(s.readyState===4)return e()},uE=(s,e,t,n)=>{let r=[],i,a=!1;const o=function(m,_,T,S){return _.abort(),a=!0,t(m,_,T,S)},c=function(m,_){if(a)return;if(m)return m.metadata=pn({requestType:n,request:_,error:m}),o(m,_,"",r);const T=_.responseText.substring(r&&r.byteLength||0,_.responseText.length);if(r=fT(r,Bp(T,!0)),i=i||Wr(r),r.length<10||i&&r.length<i+2)return fl(_,()=>o(m,_,"",r));const S=kc(r);return S==="ts"&&r.length<188?fl(_,()=>o(m,_,"",r)):!S&&r.length<376?fl(_,()=>o(m,_,"",r)):o(null,_,S,r)},h=e({uri:s,beforeSend(m){m.overrideMimeType("text/plain; charset=x-user-defined"),m.addEventListener("progress",function({total:_,loaded:T}){return Hl(m,null,{statusCode:m.status},c)})}},function(m,_){return Hl(h,m,_,c)});return h},{EventTarget:hE}=P,_h=function(s,e){if(!dg(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length)||!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t<s.segments.length;t++){const n=s.segments[t],r=e.segments[t];if(n.uri!==r.uri)return!1;if(!n.byterange&&!r.byterange)continue;const i=n.byterange,a=r.byterange;if(i&&!a||!i&&a||i.offset!==a.offset||i.length!==a.length)return!1}return!0},pE=(s,e,t,n)=>{const r=n.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},mE=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:n,previousManifest:r})=>{const i=M1(s,{manifestUri:e,clientOffset:t,sidxMapping:n,previousManifest:r});return ag(i,e,pE),i},fE=(s,e)=>{fr(s,(t,n,r,i)=>{(!e.mediaGroups[n][r]||!(i in e.mediaGroups[n][r]))&&delete s.mediaGroups[n][r][i]})},gE=(s,e,t)=>{let n=!0,r=ve(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let i=0;i<e.playlists.length;i++){const a=e.playlists[i];if(a.sidx){const c=ro(a.sidx);t&&t[c]&&t[c].sidx&&Sc(a,t[c].sidx,a.sidx.resolvedUri)}const o=Vl(r,a,_h);o&&(r=o,n=!1)}return fr(e,(i,a,o,c)=>{if(i.playlists&&i.playlists.length){const h=i.playlists[0].id,m=Vl(r,i.playlists[0],_h);m&&(r=m,c in r.mediaGroups[a][o]||(r.mediaGroups[a][o][c]=i),r.mediaGroups[a][o][c].playlists[0]=r.playlists[h],n=!1)}}),fE(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(n=!1),n?null:r},yE=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,vh=(s,e)=>{const t={};for(const n in s){const r=s[n].sidx;if(r){const i=ro(r);if(!e[i])break;const a=e[i].sidxInfo;yE(a,r)&&(t[i]=e[i])}}return t},_E=(s,e)=>{let t=vh(s.playlists,e);return fr(s,(n,r,i,a)=>{if(n.playlists&&n.playlists.length){const o=n.playlists;t=ve(t,vh(o,e))}}),t};class zl extends hE{constructor(e,t,n={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:i=!1}=n;if(this.vhs_=t,this.withCredentials=i,this.addMetadataToTextTrack=n.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,n){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},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,t,n){const r=e.sidx&&ro(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.setTimeout(()=>n(!1),0);return}const i=Ha(e.sidx.resolvedUri),a=(c,h)=>{if(this.requestErrored_(c,h,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=h;let T;try{T=V1(ie(h.response).subarray(8))}catch(S){S.metadata=pn({requestType:_,request:h,parseFailure:!0}),this.requestErrored_(S,h,t);return}return m[r]={sidxInfo:e.sidx,sidx:T},Sc(e,T,e.sidx.resolvedUri),n(!0)},o="dash-sidx";this.request=uE(i,this.vhs_.xhr,(c,h,m,_)=>{if(c)return a(c,h);if(!m||m!=="mp4"){const w=m||"unknown";return a({status:h.status,message:`Unsupported ${w} container type for sidx segment at URL: ${i}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},h)}const{offset:T,length:S}=e.sidx.byterange;if(_.length>=S+T)return a(c,{response:_.subarray(T,T+S),status:h.status,uri:h.uri});this.request=this.vhs_.xhr({uri:i,responseType:"arraybuffer",requestType:"dash-sidx",headers:Wl({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},I.clearTimeout(this.minimumUpdatePeriodTimeout_),I.clearTimeout(this.mediaRequest_),I.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 n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,r=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,I.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(),I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(I.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const n=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>this.load(),n);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_){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.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"},(n,r)=>{if(n){const{requestType:a}=r;n.metadata=pn({requestType:a,request:r,error:n})}if(this.requestErrored_(n,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const i=r.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?this.mainLoaded_=Date.parse(r.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Ha(this.mainPlaylistLoader_.srcUrl,r),i){this.handleMain_(),this.syncClientServerClock_(()=>e(r,i));return}return e(r,i)})}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:St(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(n,r)=>{if(!this.request)return;if(n){const{requestType:a}=r;return this.error.metadata=pn({requestType:a,request:r,error:n}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let i;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?i=this.mainLoaded_:i=Date.parse(r.responseHeaders.date):i=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=i-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let n;try{n=mE({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(i){this.error=i,this.error.metadata={errorType:P.Error.StreamingDashManifestParserError,error:i},this.trigger("error")}e&&(n=gE(e,n,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=n||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||n&&n.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(n),n){const{duration:i,endList:a}=n,o=[];n.playlists.forEach(h=>{o.push({id:h.id,bandwidth:h.attributes.BANDWIDTH,resolution:h.attributes.RESOLUTION,codecs:h.attributes.CODECS})});const c={duration:i,isLive:!a,renditions:o};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!n}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(I.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_=I.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_=_E(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{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,n=!this.media_||this.media_!==t[e];if(n?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=I.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},$l(this.media(),!!n)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var Ze={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 vE=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t<s.length;t++)e[t]=s.charCodeAt(t);return e.buffer},yg=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},bE=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(s),URL.createObjectURL(e.getBlob())}},_g=function(s){return function(){const e=bE(s),t=yg(new Worker(e));t.objURL=e;const n=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),n.call(this)},t}},vg=function(s){return`var browserWorkerPolyFill = ${yg.toString()};
|
|
191
|
+
`)}}el(1,B);B.VERSION=Yo;B.options=Ae.prototype.options_;B.getPlayers=()=>Ae.players;B.getPlayer=i=>{const e=Ae.players;let t;if(typeof i=="string"){const r=tm(i),n=e[r];if(n)return n;t=Ui("#"+r)}else t=i;if(Gr(t)){const{player:r,playerId:n}=t;if(r||e[n])return r||e[n]}};B.getAllPlayers=()=>Object.keys(Ae.players).map(i=>Ae.players[i]).filter(Boolean);B.players=Ae.players;B.getComponent=$.getComponent;B.registerComponent=(i,e)=>(oe.isTech(e)&&ue.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),$.registerComponent.call($,i,e));B.getTech=oe.getTech;B.registerTech=oe.registerTech;B.use=tS;Object.defineProperty(B,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(B.middleware,"TERMINATOR",{value:la,writeable:!1,enumerable:!0});B.browser=Gp;B.obj=x1;B.mergeOptions=$t(9,"videojs.mergeOptions","videojs.obj.merge",ve);B.defineLazyProperty=$t(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Da);B.bind=$t(9,"videojs.bind","native Function.prototype.bind",Ce);B.registerPlugin=bt.registerPlugin;B.deregisterPlugin=bt.deregisterPlugin;B.plugin=(i,e)=>(ue.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),bt.registerPlugin(i,e));B.getPlugins=bt.getPlugins;B.getPlugin=bt.getPlugin;B.getPluginVersion=bt.getPluginVersion;B.addLanguage=function(i,e){return i=(""+i).toLowerCase(),B.options.languages=ve(B.options.languages,{[i]:e}),B.options.languages[i]};B.log=ue;B.createLogger=Fp;B.time=H1;B.createTimeRange=$t(9,"videojs.createTimeRange","videojs.time.createTimeRanges",jt);B.createTimeRanges=$t(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",jt);B.formatTime=$t(9,"videojs.formatTime","videojs.time.formatTime",nr);B.setFormatTime=$t(9,"videojs.setFormatTime","videojs.time.setFormatTime",fg);B.resetFormatTime=$t(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",yg);B.parseUrl=$t(9,"videojs.parseUrl","videojs.url.parseUrl",ru);B.isCrossOrigin=$t(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Va);B.EventTarget=Ct;B.any=Zl;B.on=kt;B.one=qa;B.off=et;B.trigger=Xr;B.xhr=mp;B.TextTrack=Qn;B.AudioTrack=Tg;B.VideoTrack=Sg;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{B[i]=function(){return ue.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),ag[i].apply(null,arguments)}});B.computedStyle=$t(9,"videojs.computedStyle","videojs.dom.computedStyle",$r);B.dom=ag;B.fn=B1;B.num=SS;B.str=$1;B.url=Z1;B.Error=GS;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class XS{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 pa 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 XS(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}}pa.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const i in pa.prototype.allowedEvents_)pa.prototype["on"+i]=null;var im="4.1.0";const KS=function(i,e){const t=i.qualityLevels,r=new pa,n=function(){r.dispose(),i.qualityLevels=t,i.off("dispose",n)};return i.on("dispose",n),i.qualityLevels=()=>r,i.qualityLevels.VERSION=im,r},rm=function(i){return KS(this,B.obj.merge({},i))};B.registerPlugin("qualityLevels",rm);rm.VERSION=im;/*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */const yt=Ca,ga=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,Nt=i=>B.log.debug?B.log.debug.bind(B,"VHS:",`${i} >`):function(){};function fe(...i){const e=B.obj||B;return(e.merge||e.mergeOptions).apply(e,i)}function it(...i){const e=B.time||B;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function YS(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
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,nm=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 nm(i,function(t,r){return t-ei<=e&&r+ei>=e})},Ms=function(i,e){return nm(i,function(t){return t-Zt>=e})},QS=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)},JS=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)},sm=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(", ")},ZS=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},eE=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),[]),am=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},om=({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},lm=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=am(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+=Tu(i,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},iE=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}},um=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=iE(i,e);return n.precise?n.result:r.result+t},cm=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 um(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},dm=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return cm(i);if(e===null)return null;e=e||0;let n=um(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:lm(null,i),n-=r),Math.max(0,n)},rE=function(i,e,t){const r=e||0;let n=dm(i,e,!0,t);return n===null?it():(n<r&&(n=r),it(r,n))},nE=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}},hm=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Su=function(i){return i.excludeUntil&&i.excludeUntil===1/0},Ga=function(i){const e=hm(i);return!i.disabled&&!e},sE=function(i){return i.disabled},aE=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},pm=function(i,e){return e.attributes&&e.attributes[i]},oE=function(i,e,t,r=0){return pm("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=>Ep(n))||zd(i,n=>Eu(t,n))))return!1}return!0};var _t={liveEdgeDelay:lm,duration:cm,seekable:rE,getMediaInfoForTime:nE,isEnabled:Ga,isDisabled:sE,isExcluded:hm,isIncompatible:Su,playlistEnd:dm,isAes:aE,hasAttribute:pm,estimateSegmentRequestTime:oE,isLowestEnabledRendition:ll,isAudioOnly:ts,playlistMatch:Eu,segmentDurationWithParts:Tu};const{log:gm}=B,Ar=(i,e)=>`${i}-${e}`,mm=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,lE=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:n=[],llhls:s})=>{const a=new Jv;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=am(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}`}),gm.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)}})},fm=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},uE=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];fm({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||gm.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},cE=i=>{Jr(i,e=>{e.uri&&(e.resolvedUri=yt(i.uri,e.uri))})},dE=(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},ym=(i,e,t=mm)=>{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})}),uE(i),cE(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 _m=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:hE}=B,pE=(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=om(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},gE=(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},mE=(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(gE(u,p))):(a&&!p.map&&(p.map=a),s.push(p))}return s},bm=(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))})},vm=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},Tm=(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=Tm)=>{const r=fe(i,{}),n=r.playlists[e.id];if(!n||t(n,e))return null;e.segments=vm(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=mE(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}s.segments.forEach(a=>{bm(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 hE{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=pE(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 lE({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(),fm({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,ym(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=vm(r),r.segments.forEach(n=>{bm(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),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=mm(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)},fE=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},yE=(i,e,t,r)=>{!i||!i.size||i.forEach(n=>{n(e,t,r)})},Sm=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=fE(s,t);s.delete(n);const p=l(u||t,function(b,S){return yE(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},_E=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=_E(i.byterange)),e},bE=function(i,e){return i.start(e)+"-"+i.end(e)},vE=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},TE=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},Em=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];kp(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(",")},wm=function(i){return i.resolvedUri},km=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(vE).join(""),s=e.slice(a*t,a*t+t).map(TE).join(""),r+=n+" "+s+`
|
|
194
|
+
`;return r},SE=({bytes:i})=>km(i),EE=i=>{let e="",t;for(t=0;t<i.length;t++)e+=bE(i,t)+" ";return e};var wE=Object.freeze({__proto__:null,createTransferableMessage:Em,initSegmentId:ma,segmentKeyId:wm,hexDump:km,tagDump:SE,textRanges:EE});const Cm=.25,kE=(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)},CE=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,IE=(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?CE(n.videoTimingInfo):n.duration+n.duration*Cm,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"})},AE=(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*Cm)return null;r=n}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},xE=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const n=t.getTime();return(r.getTime()-n)/1e3},LE=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},DE=({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=AE(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=kE(e,r.segment);return s&&(n.programDateTime=s.toISOString()),t(null,n)},Im=({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(!LE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=IE(i,e);if(!l)return a({message:`${i} was not found in the stream`});const u=l.segment,p=xE(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",()=>{Im({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()},PE=(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=cT(n,Cp(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:RE}=B,Xd=function(i,e){if(!Tm(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},NE=(i,e,t,r)=>{const n=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${n}`},OE=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:n})=>{const s=r1(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:n});return ym(s,e,NE),s},UE=(i,e)=>{Jr(i,(t,r,n,s)=>{(!e.mediaGroups[r][n]||!(s in e.mediaGroups[r][n]))&&delete i.mediaGroups[r][n][s]})},ME=(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)}}),UE(n,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:n},BE=(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;BE(a,n)&&(t[s]=e[s])}}return t},FE=(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 RE{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=u1(ie(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=PE(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=n1(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=OE({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=ME(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_=FE(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 jE=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},Am=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},qE=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())}},xm=function(i){return function(){const e=qE(i),t=Am(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}},Lm=function(i){return`var browserWorkerPolyFill = ${Am.toString()};
|
|
195
195
|
browserWorkerPolyFill(self);
|
|
196
|
-
`+s},bg=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},TE=vg(bg(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},e=function(){this.init=function(){var l={};this.on=function(d,u){l[d]||(l[d]=[]),l[d]=l[d].concat(u)},this.off=function(d,u){var p;return l[d]?(p=l[d].indexOf(u),l[d]=l[d].slice(),l[d].splice(p,1),p>-1):!1},this.trigger=function(d){var u,p,g,y;if(u=l[d],!!u)if(arguments.length===2)for(g=u.length,p=0;p<g;++p)u[p].call(this,arguments[1]);else{for(y=[],p=arguments.length,p=1;p<arguments.length;++p)y.push(arguments[p]);for(g=u.length,p=0;p<g;++p)u[p].apply(this,y)}},this.dispose=function(){l={}}}};e.prototype.pipe=function(l){return this.on("data",function(d){l.push(d)}),this.on("done",function(d){l.flush(d)}),this.on("partialdone",function(d){l.partialFlush(d)}),this.on("endedtimeline",function(d){l.endTimeline(d)}),this.on("reset",function(d){l.reset(d)}),l},e.prototype.push=function(l){this.trigger("data",l)},e.prototype.flush=function(l){this.trigger("done",l)},e.prototype.partialFlush=function(l){this.trigger("partialdone",l)},e.prototype.endTimeline=function(l){this.trigger("endedtimeline",l)},e.prototype.reset=function(l){this.trigger("reset",l)};var t=e,n=Math.pow(2,32),r=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u;return d.getBigUint64?(u=d.getBigUint64(0),u<Number.MAX_SAFE_INTEGER?Number(u):u):d.getUint32(0)*n+d.getUint32(4)},i={getUint64:r,MAX_UINT32:n},a=i.MAX_UINT32,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,K,ne,he,oe,me,te,ue,z,G,fe,ye,Pe,Oe,tt,st,ut,be,Re,ps;(function(){var l;if(te={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(l in te)te.hasOwnProperty(l)&&(te[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);ue=new Uint8Array([105,115,111,109]),G=new Uint8Array([97,118,99,49]),z=new Uint8Array([0,0,0,1]),fe=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]),ye=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]),Pe={video:fe,audio:ye},st=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),tt=new Uint8Array([0,0,0,0,0,0,0,0]),ut=new Uint8Array([0,0,0,0,0,0,0,0]),be=ut,Re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ps=ut,Oe=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var d=[],u=0,p,g,y;for(p=1;p<arguments.length;p++)d.push(arguments[p]);for(p=d.length;p--;)u+=d[p].byteLength;for(g=new Uint8Array(u+8),y=new DataView(g.buffer,g.byteOffset,g.byteLength),y.setUint32(0,g.byteLength),g.set(l,4),p=0,u=8;p<d.length;p++)g.set(d[p],u),u+=d[p].byteLength;return g},c=function(){return o(te.dinf,o(te.dref,st))},h=function(l){return o(te.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,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},m=function(){return o(te.ftyp,ue,z,ue,G)},j=function(l){return o(te.hdlr,Pe[l])},_=function(l){return o(te.mdat,l)},N=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(d[12]=l.samplerate>>>24&255,d[13]=l.samplerate>>>16&255,d[14]=l.samplerate>>>8&255,d[15]=l.samplerate&255),o(te.mdhd,d)},F=function(l){return o(te.mdia,N(l),j(l.type),S(l))},T=function(l){return o(te.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},S=function(l){return o(te.minf,l.type==="video"?o(te.vmhd,Oe):o(te.smhd,tt),c(),K(l))},w=function(l,d){for(var u=[],p=d.length;p--;)u[p]=he(d[p]);return o.apply(null,[te.moof,T(l)].concat(u))},b=function(l){for(var d=l.length,u=[];d--;)u[d]=U(l[d]);return o.apply(null,[te.moov,L(4294967295)].concat(u).concat(R(l)))},R=function(l){for(var d=l.length,u=[];d--;)u[d]=oe(l[d]);return o.apply(null,[te.mvex].concat(u))},L=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&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 o(te.mvhd,d)},J=function(l){var d=l.samples||[],u=new Uint8Array(4+d.length),p,g;for(g=0;g<d.length;g++)p=d[g].flags,u[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return o(te.sdtp,u)},K=function(l){return o(te.stbl,ne(l),o(te.stts,ps),o(te.stsc,be),o(te.stsz,Re),o(te.stco,ut))},function(){var l,d;ne=function(u){return o(te.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),u.type==="video"?l(u):d(u))},l=function(u){var p=u.sps||[],g=u.pps||[],y=[],E=[],k,C;for(k=0;k<p.length;k++)y.push((p[k].byteLength&65280)>>>8),y.push(p[k].byteLength&255),y=y.concat(Array.prototype.slice.call(p[k]));for(k=0;k<g.length;k++)E.push((g[k].byteLength&65280)>>>8),E.push(g[k].byteLength&255),E=E.concat(Array.prototype.slice.call(g[k]));if(C=[te.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,(u.width&65280)>>8,u.width&255,(u.height&65280)>>8,u.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]),o(te.avcC,new Uint8Array([1,u.profileIdc,u.profileCompatibility,u.levelIdc,255].concat([p.length],y,[g.length],E))),o(te.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],u.sarRatio){var x=u.sarRatio[0],O=u.sarRatio[1];C.push(o(te.pasp,new Uint8Array([(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255,(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255])))}return o.apply(null,C)},d=function(u){return o(te.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(u.channelcount&65280)>>8,u.channelcount&255,(u.samplesize&65280)>>8,u.samplesize&255,0,0,0,0,(u.samplerate&65280)>>8,u.samplerate&255,0,0]),h(u))}}(),M=function(l){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.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,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(te.tkhd,d)},he=function(l){var d,u,p,g,y,E,k;return d=o(te.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(l.baseMediaDecodeTime/a),k=Math.floor(l.baseMediaDecodeTime%a),u=o(te.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,l.type==="audio"?(p=me(l,y),o(te.traf,d,u,p)):(g=J(l),p=me(l,g.length+y),o(te.traf,d,u,p,g))},U=function(l){return l.duration=l.duration||4294967295,o(te.trak,M(l),F(l))},oe=function(l){var d=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(d[d.length-1]=0),o(te.trex,d)},function(){var l,d,u;u=function(p,g){var y=0,E=0,k=0,C=0;return p.length&&(p[0].duration!==void 0&&(y=1),p[0].size!==void 0&&(E=2),p[0].flags!==void 0&&(k=4),p[0].compositionTimeOffset!==void 0&&(C=8)),[0,0,y|E|k|C,1,(p.length&4278190080)>>>24,(p.length&16711680)>>>16,(p.length&65280)>>>8,p.length&255,(g&4278190080)>>>24,(g&16711680)>>>16,(g&65280)>>>8,g&255]},d=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+16*C.length,k=u(C,g),E=new Uint8Array(k.length+C.length*16),E.set(k),y=k.length,O=0;O<C.length;O++)x=C[O],E[y++]=(x.duration&4278190080)>>>24,E[y++]=(x.duration&16711680)>>>16,E[y++]=(x.duration&65280)>>>8,E[y++]=x.duration&255,E[y++]=(x.size&4278190080)>>>24,E[y++]=(x.size&16711680)>>>16,E[y++]=(x.size&65280)>>>8,E[y++]=x.size&255,E[y++]=x.flags.isLeading<<2|x.flags.dependsOn,E[y++]=x.flags.isDependedOn<<6|x.flags.hasRedundancy<<4|x.flags.paddingValue<<1|x.flags.isNonSyncSample,E[y++]=x.flags.degradationPriority&61440,E[y++]=x.flags.degradationPriority&15,E[y++]=(x.compositionTimeOffset&4278190080)>>>24,E[y++]=(x.compositionTimeOffset&16711680)>>>16,E[y++]=(x.compositionTimeOffset&65280)>>>8,E[y++]=x.compositionTimeOffset&255;return o(te.trun,E)},l=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+8*C.length,k=u(C,g),y=new Uint8Array(k.length+C.length*8),y.set(k),E=k.length,O=0;O<C.length;O++)x=C[O],y[E++]=(x.duration&4278190080)>>>24,y[E++]=(x.duration&16711680)>>>16,y[E++]=(x.duration&65280)>>>8,y[E++]=x.duration&255,y[E++]=(x.size&4278190080)>>>24,y[E++]=(x.size&16711680)>>>16,y[E++]=(x.size&65280)>>>8,y[E++]=x.size&255;return o(te.trun,y)},me=function(p,g){return p.type==="audio"?l(p,g):d(p,g)}}();var Gs={ftyp:m,mdat:_,moof:w,moov:b,initSegment:function(l){var d=m(),u=b(l),p;return p=new Uint8Array(d.byteLength+u.byteLength),p.set(d),p.set(u,d.byteLength),p}},ms=function(l){var d,u,p=[],g=[];for(g.byteLength=0,g.nalCount=0,g.duration=0,p.byteLength=0,d=0;d<l.length;d++)u=l[d],u.nalUnitType==="access_unit_delimiter_rbsp"?(p.length&&(p.duration=u.dts-p.dts,g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p)),p=[u],p.byteLength=u.data.byteLength,p.pts=u.pts,p.dts=u.dts):(u.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(p.keyFrame=!0),p.duration=u.dts-p.dts,p.byteLength+=u.data.byteLength,p.push(u));return g.length&&(!p.duration||p.duration<=0)&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p),g},Gt=function(l){var d,u,p=[],g=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=l[0].pts,p.dts=l[0].dts,g.byteLength=0,g.nalCount=0,g.duration=0,g.pts=l[0].pts,g.dts=l[0].dts,d=0;d<l.length;d++)u=l[d],u.keyFrame?(p.length&&(g.push(p),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration),p=[u],p.nalCount=u.length,p.byteLength=u.byteLength,p.pts=u.pts,p.dts=u.dts,p.duration=u.duration):(p.duration+=u.duration,p.nalCount+=u.length,p.byteLength+=u.byteLength,p.push(u));return g.length&&p.duration<=0&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration,g.push(p),g},Cs=function(l){var d;return!l[0][0].keyFrame&&l.length>1&&(d=l.shift(),l.byteLength-=d.byteLength,l.nalCount-=d.nalCount,l[0][0].dts=d.dts,l[0][0].pts=d.pts,l[0][0].duration+=d.duration),l},Is=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},vn=function(l,d){var u=Is();return u.dataOffset=d,u.compositionTimeOffset=l.pts-l.dts,u.duration=l.duration,u.size=4*l.length,u.size+=l.byteLength,l.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),u},Ei=function(l,d){var u,p,g,y,E,k=d||0,C=[];for(u=0;u<l.length;u++)for(y=l[u],p=0;p<y.length;p++)E=y[p],g=vn(E,k),k+=g.size,C.push(g);return C},wo=function(l){var d,u,p,g,y,E,k=0,C=l.byteLength,x=l.nalCount,O=C+4*x,V=new Uint8Array(O),ee=new DataView(V.buffer);for(d=0;d<l.length;d++)for(g=l[d],u=0;u<g.length;u++)for(y=g[u],p=0;p<y.length;p++)E=y[p],ee.setUint32(k,E.data.byteLength),k+=4,V.set(E.data,k),k+=E.data.byteLength;return V},wi=function(l,d){var u,p=d||0,g=[];return u=vn(l,p),g.push(u),g},xs=function(l){var d,u,p=0,g=l.byteLength,y=l.length,E=g+4*y,k=new Uint8Array(E),C=new DataView(k.buffer);for(d=0;d<l.length;d++)u=l[d],C.setUint32(p,u.data.byteLength),p+=4,k.set(u.data,p),p+=u.data.byteLength;return k},Xs={groupNalsIntoFrames:ms,groupFramesIntoGops:Gt,extendFirstKeyFrame:Cs,generateSampleTable:Ei,concatenateNalData:wo,generateSampleTableForFrame:wi,concatenateNalDataForFrame:xs},Xt=[33,16,5,32,164,27],_r=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],_e=function(l){for(var d=[];l--;)d.push(0);return d},ko=function(l){return Object.keys(l).reduce(function(d,u){return d[u]=new Uint8Array(l[u].reduce(function(p,g){return p.concat(g)},[])),d},{})},vr,ki=function(){if(!vr){var l={96e3:[Xt,[227,64],_e(154),[56]],88200:[Xt,[231],_e(170),[56]],64e3:[Xt,[248,192],_e(240),[56]],48e3:[Xt,[255,192],_e(268),[55,148,128],_e(54),[112]],44100:[Xt,[255,192],_e(268),[55,163,128],_e(84),[112]],32e3:[Xt,[255,192],_e(268),[55,234],_e(226),[112]],24e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,112],_e(126),[224]],16e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,255],_e(269),[223,108],_e(195),[1,192]],12e3:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,253,128],_e(259),[56]],11025:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,255,192],_e(268),[55,175,128],_e(108),[112]],8e3:[_r,_e(268),[3,121,16],_e(47),[7]]};vr=ko(l)}return vr},Ls=9e4,vt,Ys,bn,Dt,Ci,f,v;vt=function(l){return l*Ls},Ys=function(l,d){return l*d},bn=function(l){return l/Ls},Dt=function(l,d){return l/d},Ci=function(l,d){return vt(Dt(l,d))},f=function(l,d){return Ys(bn(l),d)},v=function(l,d,u){return bn(u?l:l-d)};var A={ONE_SECOND_IN_TS:Ls,secondsToVideoTs:vt,secondsToAudioTs:Ys,videoTsToSeconds:bn,audioTsToSeconds:Dt,audioTsToVideoTs:Ci,videoTsToAudioTs:f,metadataTsToSeconds:v},D=ki,B=A,H=function(l){var d,u,p=0;for(d=0;d<l.length;d++)u=l[d],p+=u.data.byteLength;return p},Q=function(l,d,u,p){var g,y=0,E=0,k=0,C=0,x,O,V;if(d.length&&(g=B.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),y=Math.ceil(B.ONE_SECOND_IN_TS/(l.samplerate/1024)),u&&p&&(E=g-Math.max(u,p),k=Math.floor(E/y),C=k*y),!(k<1||C>B.ONE_SECOND_IN_TS/2))){for(x=D()[l.samplerate],x||(x=d[0].data),O=0;O<k;O++)V=d[0],d.splice(0,0,{data:x,dts:V.dts-y,pts:V.pts-y});return l.baseMediaDecodeTime-=Math.floor(B.videoTsToAudioTs(C,l.samplerate)),C}},ke=function(l,d,u){return d.minSegmentDts>=u?l:(d.minSegmentDts=1/0,l.filter(function(p){return p.dts>=u?(d.minSegmentDts=Math.min(d.minSegmentDts,p.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},Xe=function(l){var d,u,p=[];for(d=0;d<l.length;d++)u=l[d],p.push({size:u.data.byteLength,duration:1024});return p},xe=function(l){var d,u,p=0,g=new Uint8Array(H(l));for(d=0;d<l.length;d++)u=l[d],g.set(u.data,p),p+=u.data.byteLength;return g},Ee={prefixWithSilence:Q,trimAdtsFramesByEarliestDts:ke,generateSampleTable:Xe,concatenateFrameData:xe},qe=A.ONE_SECOND_IN_TS,Ty=function(l,d){typeof d.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=d.pts),l.minSegmentPts===void 0?l.minSegmentPts=d.pts:l.minSegmentPts=Math.min(l.minSegmentPts,d.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=d.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,d.pts)),typeof d.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=d.dts),l.minSegmentDts===void 0?l.minSegmentDts=d.dts:l.minSegmentDts=Math.min(l.minSegmentDts,d.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=d.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,d.dts))},Ay=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},Sy=function(l,d){var u,p,g=l.minSegmentDts;return d||(g-=l.timelineStartInfo.dts),u=l.timelineStartInfo.baseMediaDecodeTime,u+=g,u=Math.max(0,u),l.type==="audio"&&(p=l.samplerate/qe,u*=p,u=Math.floor(u)),u},Ey={clearDtsInfo:Ay,calculateTrackBaseMediaDecodeTime:Sy,collectDtsInfo:Ty},hd=4,wy=128,ky=function(l){for(var d=0,u={payloadType:-1,payloadSize:0},p=0,g=0;d<l.byteLength&&l[d]!==wy;){for(;l[d]===255;)p+=255,d++;for(p+=l[d++];l[d]===255;)g+=255,d++;if(g+=l[d++],!u.payload&&p===hd){var y=String.fromCharCode(l[d+3],l[d+4],l[d+5],l[d+6]);if(y==="GA94"){u.payloadType=p,u.payloadSize=g,u.payload=l.subarray(d,d+g);break}else u.payload=void 0}d+=g,p=0,g=0}return u},Cy=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!==49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},Iy=function(l,d){var u=[],p,g,y,E;if(!(d[0]&64))return u;for(g=d[0]&31,p=0;p<g;p++)y=p*3,E={type:d[y+2]&3,pts:l},d[y+2]&4&&(E.ccData=d[y+3]<<8|d[y+4],u.push(E));return u},xy=function(l){for(var d=l.byteLength,u=[],p=1,g,y;p<d-2;)l[p]===0&&l[p+1]===0&&l[p+2]===3?(u.push(p+2),p+=2):p++;if(u.length===0)return l;g=d-u.length,y=new Uint8Array(g);var E=0;for(p=0;p<g;E++,p++)E===u[0]&&(E++,u.shift()),y[p]=l[E];return y},pd={parseSei:ky,parseUserData:Cy,parseCaptionPackets:Iy,discardEmulationPreventionBytes:xy,USER_DATA_REGISTERED_ITU_T_T35:hd},Co=t,Ii=pd,bt=function(l){l=l||{},bt.prototype.init.call(this),this.parse708captions_=typeof l.parse708captions=="boolean"?l.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Me(0,0),new Me(0,1),new Me(1,0),new Me(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ce({captionServices:l.captionServices})),this.reset(),this.ccStreams_.forEach(function(d){d.on("data",this.trigger.bind(this,"data")),d.on("partialdone",this.trigger.bind(this,"partialdone")),d.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")))};bt.prototype=new Co,bt.prototype.push=function(l){var d,u,p;if(l.nalUnitType==="sei_rbsp"&&(d=Ii.parseSei(l.escapedRBSP),!!d.payload&&d.payloadType===Ii.USER_DATA_REGISTERED_ITU_T_T35&&(u=Ii.parseUserData(d),!!u))){if(l.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}p=Ii.parseCaptionPackets(l.pts,u),this.captionPackets_=this.captionPackets_.concat(p),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},bt.prototype.flushCCStreams=function(l){this.ccStreams_.forEach(function(d){return l==="flush"?d.flush():d.partialFlush()},this)},bt.prototype.flushStream=function(l){if(!this.captionPackets_.length){this.flushCCStreams(l);return}this.captionPackets_.forEach(function(d,u){d.presortIndex=u}),this.captionPackets_.sort(function(d,u){return d.pts===u.pts?d.presortIndex-u.presortIndex:d.pts-u.pts}),this.captionPackets_.forEach(function(d){d.type<2?this.dispatchCea608Packet(d):this.dispatchCea708Packet(d)},this),this.captionPackets_.length=0,this.flushCCStreams(l)},bt.prototype.flush=function(){return this.flushStream("flush")},bt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},bt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},bt.prototype.dispatchCea608Packet=function(l){this.setsTextOrXDSActive(l)?this.activeCea608Channel_[l.type]=null:this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},bt.prototype.setsChannel1Active=function(l){return(l.ccData&30720)===4096},bt.prototype.setsChannel2Active=function(l){return(l.ccData&30720)===6144},bt.prototype.setsTextOrXDSActive=function(l){return(l.ccData&28928)===256||(l.ccData&30974)===4138||(l.ccData&30974)===6186},bt.prototype.dispatchCea708Packet=function(l){this.parse708captions_&&this.cc708Stream_.push(l)};var Ly={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},Py=function(l){var d=Ly[l]||l;return l&4096&&l===d?"":String.fromCharCode(d)},xi=function(l){return 32<=l&&l<=127||160<=l&&l<=255},fs=function(l){this.windowNum=l,this.reset()};fs.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},fs.prototype.getText=function(){return this.rows.join(`
|
|
197
|
-
`)},
|
|
196
|
+
`+i},Dm=function(i){return i.toString().replace(/^function.+?{/,"").slice(0,-1)},$E=Lm(Dm(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,re,he,le,pe,ee,ce,ne,de,we,ze,dt,Ot,ht,Ut,Vt,xe,Be,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]),de=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,Be=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,de)},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]=he(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,re(o),l(ee.stts,oi),l(ee.stsc,xe),l(ee.stsz,Be),l(ee.stco,Vt))},function(){var o,c;re=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)},he=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=pe(o,y),l(ee.traf,c,d,h)):(f=J(o),h=pe(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)},pe=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,lf=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))},uf=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},cf=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},df={clearDtsInfo:uf,calculateTrackBaseMediaDecodeTime:cf,collectDtsInfo:lf},Cu=4,hf=128,pf=function(o){for(var c=0,d={payloadType:-1,payloadSize:0},h=0,f=0;c<o.byteLength&&o[c]!==hf;){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},gf=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)},mf=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},ff=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:pf,parseUserData:gf,parseCaptionPackets:mf,discardEmulationPreventionBytes:ff,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 yf={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},_f=function(o){var c=yf[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
|
+
`)},ui.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},ui.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--},ui.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},ui.prototype.addText=function(o){this.rows[this.rowIdx]+=o},ui.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var ls=function(o,c,d){this.serviceNum=o,this.text="",this.currentWindow=new ui(-1),this.windows=[],this.stream=d,typeof c=="string"&&this.createTextDecoder(c)};ls.prototype.init=function(o,c){this.startPts=o;for(var d=0;d<8;d++)this.windows[d]=new ui(d),typeof c=="function"&&(this.windows[d].beforeRowOverflow=c)},ls.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},ls.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 Se=function(o){o=o||{},Se.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))}};Se.prototype=new Ya,Se.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.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)},Se.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)},Se.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],os(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++},Se.prototype.extendedCommands=function(o,c){var d=this.current708Packet.data,h=d[++o];return os(h)&&(o=this.handleText(o,c,{isExtended:!0})),o},Se.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Se.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 ls(o,f,d),this.services[o].init(this.getPts(c),function(y){d.flushDisplayed(y,d.services[o])}),this.services[o]},Se.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,R,q;function Q(z){return z.map(te=>("0"+(te&255).toString(16)).slice(-2)).join("")}if(f?(q=[k,I],o++):q=[k],c.textDecoder_&&!h)R=c.textDecoder_.decode(new Uint8Array(q));else if(f){const z=Q(q);R=String.fromCharCode(parseInt(z,16))}else R=_f(E|k);return A.pendingNewLine&&!A.isEmpty()&&A.newLine(this.getPts(o)),A.pendingNewLine=!1,A.addText(R),o},Se.prototype.multiByteCharacter=function(o,c){var d=this.current708Packet.data,h=d[o+1],f=d[o+2];return os(h)&&os(f)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},Se.prototype.setCurrentWindow=function(o,c){var d=this.current708Packet.data,h=d[o],f=h&7;return c.setCurrentWindow(f),o},Se.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},Se.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},Se.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(d),d.startPts=l},Ce.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},Ce.prototype.displayWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=1);return l},Ce.prototype.hideWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=0);return l},Ce.prototype.toggleWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible^=1);return l},Ce.prototype.clearWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].clearText();return l},Ce.prototype.deleteWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].reset();return l},Ce.prototype.setPenAttributes=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penAttr;return p=u[++l],g.textTag=(p&240)>>4,g.offset=(p&12)>>2,g.penSize=p&3,p=u[++l],g.italics=(p&128)>>7,g.underline=(p&64)>>6,g.edgeType=(p&56)>>3,g.fontStyle=p&7,l},Ce.prototype.setPenColor=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penColor;return p=u[++l],g.fgOpacity=(p&192)>>6,g.fgRed=(p&48)>>4,g.fgGreen=(p&12)>>2,g.fgBlue=p&3,p=u[++l],g.bgOpacity=(p&192)>>6,g.bgRed=(p&48)>>4,g.bgGreen=(p&12)>>2,g.bgBlue=p&3,p=u[++l],g.edgeRed=(p&48)>>4,g.edgeGreen=(p&12)>>2,g.edgeBlue=p&3,l},Ce.prototype.setPenLocation=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,p=u[++l],g.row=p&15,p=u[++l],g.column=p&63,l},Ce.prototype.reset=function(l,d){var u=this.getPts(l);return this.flushDisplayed(u,d),this.initService(d.serviceNum,l)};var Ry={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},Pi=function(l){return l===null?"":(l=Ry[l]||l,String.fromCharCode(l))},Ri=14,Dy=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ks=function(){for(var l=[],d=Ri+1;d--;)l.push({text:"",indent:0,offset:0});return l},Me=function(l,d){Me.prototype.init.call(this),this.field_=l||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(u){var p,g,y,E,k;if(p=u.ccData&32639,p===this.lastControlCode_){this.lastControlCode_=null;return}if((p&61440)===4096?this.lastControlCode_=p:p!==this.PADDING_&&(this.lastControlCode_=null),y=p>>>8,E=p&255,p!==this.PADDING_)if(p===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(p===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(u.pts),this.flushDisplayed(u.pts),g=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=g,this.startPts_=u.pts;else if(p===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(u.pts);else if(p===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(u.pts);else if(p===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(u.pts);else if(p===this.CARRIAGE_RETURN_)this.clearFormatting(u.pts),this.flushDisplayed(u.pts),this.shiftRowsUp_(),this.startPts_=u.pts;else if(p===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(p===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(u.pts),this.displayed_=Ks();else if(p===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ks();else if(p===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(u.pts),this.displayed_=Ks()),this.mode_="paintOn",this.startPts_=u.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,k=Pi(y|E),this[this.mode_](u.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=Pi(y|E),this[this.mode_](u.pts,k),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(u.pts),this[this.mode_](u.pts," "),this.column_++,(E&14)===14&&this.addFormatting(u.pts,["i"]),(E&1)===1&&this.addFormatting(u.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const x=E&3;this.nonDisplayed_[this.row_].offset=x,this.column_+=x}else if(this.isPAC(y,E)){var C=Dy.indexOf(p&7968);if(this.mode_==="rollUp"&&(C-this.rollUpRows_+1<0&&(C=this.rollUpRows_-1),this.setRollUp(u.pts,C)),C!==this.row_&&C>=0&&C<=14&&(this.clearFormatting(u.pts),this.row_=C),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(u.pts,["u"]),(p&16)===16){const x=(p&14)>>1;this.column_=x*4,this.nonDisplayed_[this.row_].indent+=x}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(u.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),k=Pi(y),k+=Pi(E),this[this.mode_](u.pts,k),this.column_+=k.length)}};Me.prototype=new Co,Me.prototype.flushDisplayed=function(l){const d=p=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+p+"."})},u=[];this.displayed_.forEach((p,g)=>{if(p&&p.text&&p.text.length){try{p.text=p.text.trim()}catch{d(g)}p.text.length&&u.push({text:p.text,line:g+1,position:10+Math.min(70,p.indent*10)+p.offset*2.5})}else p==null&&d(g)}),u.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:u,stream:this.name_})},Me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ks(),this.nonDisplayed_=Ks(),this.lastControlCode_=null,this.column_=0,this.row_=Ri,this.rollUpRows_=2,this.formatting_=[]},Me.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},Me.prototype.isSpecialCharacter=function(l,d){return l===this.EXT_&&d>=48&&d<=63},Me.prototype.isExtCharacter=function(l,d){return(l===this.EXT_+1||l===this.EXT_+2)&&d>=32&&d<=63},Me.prototype.isMidRowCode=function(l,d){return l===this.EXT_&&d>=32&&d<=47},Me.prototype.isOffsetControlCode=function(l,d){return l===this.OFFSET_&&d>=33&&d<=35},Me.prototype.isPAC=function(l,d){return l>=this.BASE_&&l<this.BASE_+8&&d>=64&&d<=127},Me.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},Me.prototype.isNormalChar=function(l){return l>=32&&l<=127},Me.prototype.setRollUp=function(l,d){if(this.mode_!=="rollUp"&&(this.row_=Ri,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=Ks(),this.displayed_=Ks()),d!==void 0&&d!==this.row_)for(var u=0;u<this.rollUpRows_;u++)this.displayed_[d-u]=this.displayed_[this.row_-u],this.displayed_[this.row_-u]={text:"",indent:0,offset:0};d===void 0&&(d=this.row_),this.topRow_=d-this.rollUpRows_+1},Me.prototype.addFormatting=function(l,d){this.formatting_=this.formatting_.concat(d);var u=d.reduce(function(p,g){return p+"<"+g+">"},"");this[this.mode_](l,u)},Me.prototype.clearFormatting=function(l){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(u,p){return u+"</"+p+">"},"");this.formatting_=[],this[this.mode_](l,d)}},Me.prototype.popOn=function(l,d){var u=this.nonDisplayed_[this.row_].text;u+=d,this.nonDisplayed_[this.row_].text=u},Me.prototype.rollUp=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u},Me.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.row_+1;l<Ri+1;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Me.prototype.paintOn=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u};var md={CaptionStream:bt,Cea608Stream:Me,Cea708Stream:Ce},Di={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ny=t,Oy=8589934592,My=4294967296,fd="shared",Io=function(l,d){var u=1;for(l>d&&(u=-1);Math.abs(d-l)>My;)l+=u*Oy;return l},xo=function(l){var d,u;xo.prototype.init.call(this),this.type_=l||fd,this.push=function(p){if(p.type==="metadata"){this.trigger("data",p);return}this.type_!==fd&&p.type!==this.type_||(u===void 0&&(u=p.dts),p.dts=Io(p.dts,u),p.pts=Io(p.pts,u),d=p.dts,this.trigger("data",p))},this.flush=function(){u=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){u=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};xo.prototype=new Ny;var gd={TimestampRolloverStream:xo,handleRollover:Io},Uy=(l,d,u)=>{if(!l)return-1;for(var p=u;p<l.length;p++)if(l[p]===d)return p;return-1},By={typedArrayIndexOf:Uy},Ni=By.typedArrayIndexOf,Oi={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},yd=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},br=function(l,d,u){return decodeURIComponent(yd(l,d,u))},Tr=function(l,d,u){return unescape(yd(l,d,u))},Ar=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Sr={APIC:function(l){var d=1,u,p,g="-->";l.data[0]===Oi.Utf8&&(u=Ni(l.data,0,d),!(u<0)&&(l.mimeType=Tr(l.data,d,u),d=u+1,l.pictureType=l.data[d],d++,p=Ni(l.data,0,d),!(p<0)&&(l.description=br(l.data,d,p),d=p+1,l.mimeType===g?l.url=Tr(l.data,d,l.data.length):l.pictureData=l.data.subarray(d,l.data.length))))},"T*":function(l){l.data[0]===Oi.Utf8&&(l.value=br(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.value=br(l.data,d+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Tr(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.url=Tr(l.data,d+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var d;for(d=0;d<l.data.length;d++)if(l.data[d]===0){l.owner=Tr(l.data,0,d);break}l.privateData=l.data.subarray(d+1),l.data=l.privateData}},Fy=function(l){var d,u,p=10,g=0,y=[];if(!(l.length<10||l[0]!==73||l[1]!==68||l[2]!==51)){g=Ar(l.subarray(6,10)),g+=10;var E=l[5]&64;E&&(p+=4,p+=Ar(l.subarray(10,14)),g-=Ar(l.subarray(16,20)));do{if(d=Ar(l.subarray(p+4,p+8)),d<1)break;u=String.fromCharCode(l[p],l[p+1],l[p+2],l[p+3]);var k={id:u,data:l.subarray(p+10,p+d+10)};k.key=k.id,Sr[k.id]?Sr[k.id](k):k.id[0]==="T"?Sr["T*"](k):k.id[0]==="W"&&Sr["W*"](k),y.push(k),p+=10,p+=d}while(p<g);return y}},_d={parseId3Frames:Fy,parseSyncSafeInteger:Ar,frameParsers:Sr},jy=t,qy=Di,Ps=_d,Mi;Mi=function(l){var d={descriptor:l&&l.descriptor},u=0,p=[],g=0,y;if(Mi.prototype.init.call(this),this.dispatchType=qy.METADATA_STREAM_TYPE.toString(16),d.descriptor)for(y=0;y<d.descriptor.length;y++)this.dispatchType+=("00"+d.descriptor[y].toString(16)).slice(-2);this.push=function(E){var k,C,x,O,V,ee;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(g=0,p.length=0),p.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(p.push(E),g+=E.data.byteLength,p.length===1&&(u=Ps.parseSyncSafeInteger(E.data.subarray(6,10)),u+=10),!(g<u)){for(k={data:new Uint8Array(u),frames:[],pts:p[0].pts,dts:p[0].dts},V=0;V<u;)k.data.set(p[0].data.subarray(0,u-V),V),V+=p[0].data.byteLength,g-=p[0].data.byteLength,p.shift();C=10,k.data[5]&64&&(C+=4,C+=Ps.parseSyncSafeInteger(k.data.subarray(10,14)),u-=Ps.parseSyncSafeInteger(k.data.subarray(16,20)));do{if(x=Ps.parseSyncSafeInteger(k.data.subarray(C+4,C+8)),x<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(ee=String.fromCharCode(k.data[C],k.data[C+1],k.data[C+2],k.data[C+3]),O={id:ee,data:k.data.subarray(C+10,C+x+10)},O.key=O.id,Ps.frameParsers[O.id]?Ps.frameParsers[O.id](O):O.id[0]==="T"?Ps.frameParsers["T*"](O):O.id[0]==="W"&&Ps.frameParsers["W*"](O),O.owner==="com.apple.streaming.transportStreamTimestamp"){var W=O.data,re=(W[3]&1)<<30|W[4]<<22|W[5]<<14|W[6]<<6|W[7]>>>2;re*=4,re+=W[7]&3,O.timeStamp=re,k.pts===void 0&&k.dts===void 0&&(k.pts=O.timeStamp,k.dts=O.timeStamp),this.trigger("timestamp",O)}k.frames.push(O),C+=10,C+=x}while(C<u);this.trigger("data",k)}}}},Mi.prototype=new jy;var Vy=Mi,Lo=t,Po=md,qt=Di,$y=gd.TimestampRolloverStream,Ui,Er,Bi,Tn=188,Ro=71;Ui=function(){var l=new Uint8Array(Tn),d=0;Ui.prototype.init.call(this),this.push=function(u){var p=0,g=Tn,y;for(d?(y=new Uint8Array(u.byteLength+d),y.set(l.subarray(0,d)),y.set(u,d),d=0):y=u;g<y.byteLength;){if(y[p]===Ro&&y[g]===Ro){this.trigger("data",y.subarray(p,g)),p+=Tn,g+=Tn;continue}p++,g++}p<y.byteLength&&(l.set(y.subarray(p),0),d=y.byteLength-p)},this.flush=function(){d===Tn&&l[0]===Ro&&(this.trigger("data",l),d=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){d=0,this.trigger("reset")}},Ui.prototype=new Lo,Er=function(){var l,d,u,p;Er.prototype.init.call(this),p=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(g,y){var E=0;y.payloadUnitStartIndicator&&(E+=g[E]+1),y.type==="pat"?d(g.subarray(E),y):u(g.subarray(E),y)},d=function(g,y){y.section_number=g[7],y.last_section_number=g[8],p.pmtPid=(g[10]&31)<<8|g[11],y.pmtPid=p.pmtPid},u=function(g,y){var E,k,C,x;if(g[5]&1){for(p.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(g[1]&15)<<8|g[2],k=3+E-4,C=(g[10]&15)<<8|g[11],x=12+C;x<k;){var O=g[x],V=(g[x+1]&31)<<8|g[x+2];O===qt.H264_STREAM_TYPE&&p.programMapTable.video===null?p.programMapTable.video=V:O===qt.ADTS_STREAM_TYPE&&p.programMapTable.audio===null?p.programMapTable.audio=V:O===qt.METADATA_STREAM_TYPE&&(p.programMapTable["timed-metadata"][V]=O),x+=((g[x+3]&15)<<8|g[x+4])+5}y.programMapTable=p.programMapTable}},this.push=function(g){var y={},E=4;if(y.payloadUnitStartIndicator=!!(g[1]&64),y.pid=g[1]&31,y.pid<<=8,y.pid|=g[2],(g[3]&48)>>>4>1&&(E+=g[E]+1),y.pid===0)y.type="pat",l(g.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",l(g.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([g,E,y]):this.processPes_(g,E,y)},this.processPes_=function(g,y,E){E.pid===this.programMapTable.video?E.streamType=qt.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=qt.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=g.subarray(y),this.trigger("data",E)}},Er.prototype=new Lo,Er.STREAM_TYPES={h264:27,adts:15},Bi=function(){var l=this,d=!1,u={data:[],size:0},p={data:[],size:0},g={data:[],size:0},y,E=function(C,x){var O;const V=C[0]<<16|C[1]<<8|C[2];x.data=new Uint8Array,V===1&&(x.packetLength=6+(C[4]<<8|C[5]),x.dataAlignmentIndicator=(C[6]&4)!==0,O=C[7],O&192&&(x.pts=(C[9]&14)<<27|(C[10]&255)<<20|(C[11]&254)<<12|(C[12]&255)<<5|(C[13]&254)>>>3,x.pts*=4,x.pts+=(C[13]&6)>>>1,x.dts=x.pts,O&64&&(x.dts=(C[14]&14)<<27|(C[15]&255)<<20|(C[16]&254)<<12|(C[17]&255)<<5|(C[18]&254)>>>3,x.dts*=4,x.dts+=(C[18]&6)>>>1)),x.data=C.subarray(9+C[8]))},k=function(C,x,O){var V=new Uint8Array(C.size),ee={type:x},W=0,re=0,le=!1,Qe;if(!(!C.data.length||C.size<9)){for(ee.trackId=C.data[0].pid,W=0;W<C.data.length;W++)Qe=C.data[W],V.set(Qe.data,re),re+=Qe.data.byteLength;E(V,ee),le=x==="video"||ee.packetLength<=C.size,(O||le)&&(C.size=0,C.data.length=0),le&&l.trigger("data",ee)}};Bi.prototype.init.call(this),this.push=function(C){({pat:function(){},pes:function(){var x,O;switch(C.streamType){case qt.H264_STREAM_TYPE:x=u,O="video";break;case qt.ADTS_STREAM_TYPE:x=p,O="audio";break;case qt.METADATA_STREAM_TYPE:x=g,O="timed-metadata";break;default:return}C.payloadUnitStartIndicator&&k(x,O,!0),x.data.push(C),x.size+=C.data.byteLength},pmt:function(){var x={type:"metadata",tracks:[]};y=C.programMapTable,y.video!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),d=!0,l.trigger("data",x)}})[C.type]()},this.reset=function(){u.size=0,u.data.length=0,p.size=0,p.data.length=0,this.trigger("reset")},this.flushStreams_=function(){k(u,"video"),k(p,"audio"),k(g,"timed-metadata")},this.flush=function(){if(!d&&y){var C={type:"metadata",tracks:[]};y.video!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),l.trigger("data",C)}d=!1,this.flushStreams_(),this.trigger("done")}},Bi.prototype=new Lo;var vd={PAT_PID:0,MP2T_PACKET_LENGTH:Tn,TransportPacketStream:Ui,TransportParseStream:Er,ElementaryStream:Bi,TimestampRolloverStream:$y,CaptionStream:Po.CaptionStream,Cea608Stream:Po.Cea608Stream,Cea708Stream:Po.Cea708Stream,MetadataStream:Vy};for(var Do in qt)qt.hasOwnProperty(Do)&&(vd[Do]=qt[Do]);var Hy=vd,Wy=t,zy=A.ONE_SECOND_IN_TS,Fi,bd=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Fi=function(l){var d,u=0;Fi.prototype.init.call(this),this.skipWarn_=function(p,g){this.trigger("log",{level:"warn",message:`adts skiping bytes ${p} to ${g} in frame ${u} outside syncword`})},this.push=function(p){var g=0,y,E,k,C,x;if(l||(u=0),p.type==="audio"){d&&d.length?(k=d,d=new Uint8Array(k.byteLength+p.data.byteLength),d.set(k),d.set(p.data,k.byteLength)):d=p.data;for(var O;g+7<d.length;){if(d[g]!==255||(d[g+1]&246)!==240){typeof O!="number"&&(O=g),g++;continue}if(typeof O=="number"&&(this.skipWarn_(O,g),O=null),E=(~d[g+1]&1)*2,y=(d[g+3]&3)<<11|d[g+4]<<3|(d[g+5]&224)>>5,C=((d[g+6]&3)+1)*1024,x=C*zy/bd[(d[g+2]&60)>>>2],d.byteLength-g<y)break;this.trigger("data",{pts:p.pts+u*x,dts:p.dts+u*x,sampleCount:C,audioobjecttype:(d[g+2]>>>6&3)+1,channelcount:(d[g+2]&1)<<2|(d[g+3]&192)>>>6,samplerate:bd[(d[g+2]&60)>>>2],samplingfrequencyindex:(d[g+2]&60)>>>2,samplesize:16,data:d.subarray(g+7+E,g+y)}),u++,g+=y}typeof O=="number"&&(this.skipWarn_(O,g),O=null),d=d.subarray(g)}},this.flush=function(){u=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},Fi.prototype=new Wy;var Gy=Fi,Td;Td=function(l){var d=l.byteLength,u=0,p=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+p},this.loadWord=function(){var g=l.byteLength-d,y=new Uint8Array(4),E=Math.min(4,d);if(E===0)throw new Error("no bytes available");y.set(l.subarray(g,g+E)),u=new DataView(y.buffer).getUint32(0),p=E*8,d-=E},this.skipBits=function(g){var y;p>g?(u<<=g,p-=g):(g-=p,y=Math.floor(g/8),g-=y*8,d-=y,this.loadWord(),u<<=g,p-=g)},this.readBits=function(g){var y=Math.min(p,g),E=u>>>32-y;return p-=y,p>0?u<<=y:d>0&&this.loadWord(),y=g-y,y>0?E<<y|this.readBits(y):E},this.skipLeadingZeros=function(){var g;for(g=0;g<p;++g)if(u&2147483648>>>g)return u<<=g,p-=g,g;return this.loadWord(),g+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var g=this.skipLeadingZeros();return this.readBits(g+1)-1},this.readExpGolomb=function(){var g=this.readUnsignedExpGolomb();return 1&g?1+g>>>1:-1*(g>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Xy=Td,Ad=t,Yy=Xy,ji,wr,Sd;wr=function(){var l=0,d,u;wr.prototype.init.call(this),this.push=function(p){var g;u?(g=new Uint8Array(u.byteLength+p.data.byteLength),g.set(u),g.set(p.data,u.byteLength),u=g):u=p.data;for(var y=u.byteLength;l<y-3;l++)if(u[l+2]===1){d=l+5;break}for(;d<y;)switch(u[d]){case 0:if(u[d-1]!==0){d+=2;break}else if(u[d-2]!==0){d++;break}l+3!==d-2&&this.trigger("data",u.subarray(l+3,d-2));do d++;while(u[d]!==1&&d<y);l=d-2,d+=3;break;case 1:if(u[d-1]!==0||u[d-2]!==0){d+=3;break}this.trigger("data",u.subarray(l+3,d-2)),l=d-2,d+=3;break;default:d+=3;break}u=u.subarray(l),d-=l,l=0},this.reset=function(){u=null,l=0,this.trigger("reset")},this.flush=function(){u&&u.byteLength>3&&this.trigger("data",u.subarray(l+3)),u=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},wr.prototype=new Ad,Sd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ji=function(){var l=new wr,d,u,p,g,y,E,k;ji.prototype.init.call(this),d=this,this.push=function(C){C.type==="video"&&(u=C.trackId,p=C.pts,g=C.dts,l.push(C))},l.on("data",function(C){var x={trackId:u,pts:p,dts:g,data:C,nalUnitTypeCode:C[0]&31};switch(x.nalUnitTypeCode){case 5:x.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:x.nalUnitType="sei_rbsp",x.escapedRBSP=y(C.subarray(1));break;case 7:x.nalUnitType="seq_parameter_set_rbsp",x.escapedRBSP=y(C.subarray(1)),x.config=E(x.escapedRBSP);break;case 8:x.nalUnitType="pic_parameter_set_rbsp";break;case 9:x.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",x)}),l.on("done",function(){d.trigger("done")}),l.on("partialdone",function(){d.trigger("partialdone")}),l.on("reset",function(){d.trigger("reset")}),l.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},k=function(C,x){var O=8,V=8,ee,W;for(ee=0;ee<C;ee++)V!==0&&(W=x.readExpGolomb(),V=(O+W+256)%256),O=V===0?O:V},y=function(C){for(var x=C.byteLength,O=[],V=1,ee,W;V<x-2;)C[V]===0&&C[V+1]===0&&C[V+2]===3?(O.push(V+2),V+=2):V++;if(O.length===0)return C;ee=x-O.length,W=new Uint8Array(ee);var re=0;for(V=0;V<ee;re++,V++)re===O[0]&&(re++,O.shift()),W[V]=C[re];return W},E=function(C){var x=0,O=0,V=0,ee=0,W,re,le,Qe,pt,Kt,Dr,Zi,Ji,Js,Nr,De=[1,1],Jd,en;if(W=new Yy(C),re=W.readUnsignedByte(),Qe=W.readUnsignedByte(),le=W.readUnsignedByte(),W.skipUnsignedExpGolomb(),Sd[re]&&(pt=W.readUnsignedExpGolomb(),pt===3&&W.skipBits(1),W.skipUnsignedExpGolomb(),W.skipUnsignedExpGolomb(),W.skipBits(1),W.readBoolean()))for(Nr=pt!==3?8:12,en=0;en<Nr;en++)W.readBoolean()&&(en<6?k(16,W):k(64,W));if(W.skipUnsignedExpGolomb(),Kt=W.readUnsignedExpGolomb(),Kt===0)W.readUnsignedExpGolomb();else if(Kt===1)for(W.skipBits(1),W.skipExpGolomb(),W.skipExpGolomb(),Dr=W.readUnsignedExpGolomb(),en=0;en<Dr;en++)W.skipExpGolomb();if(W.skipUnsignedExpGolomb(),W.skipBits(1),Zi=W.readUnsignedExpGolomb(),Ji=W.readUnsignedExpGolomb(),Js=W.readBits(1),Js===0&&W.skipBits(1),W.skipBits(1),W.readBoolean()&&(x=W.readUnsignedExpGolomb(),O=W.readUnsignedExpGolomb(),V=W.readUnsignedExpGolomb(),ee=W.readUnsignedExpGolomb()),W.readBoolean()&&W.readBoolean()){switch(Jd=W.readUnsignedByte(),Jd){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=[W.readUnsignedByte()<<8|W.readUnsignedByte(),W.readUnsignedByte()<<8|W.readUnsignedByte()];break}}De&&De[0]/De[1]}return{profileIdc:re,levelIdc:le,profileCompatibility:Qe,width:(Zi+1)*16-x*2-O*2,height:(2-Js)*(Ji+1)*16-V*2-ee*2,sarRatio:De}}},ji.prototype=new Ad;var Ky={H264Stream:ji,NalByteStream:wr},Qy=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ed=function(l,d){var u=l[d+6]<<21|l[d+7]<<14|l[d+8]<<7|l[d+9],p=l[d+5],g=(p&16)>>4;return u=u>=0?u:0,g?u+20:u+10},wd=function(l,d){return l.length-d<10||l[d]!==73||l[d+1]!==68||l[d+2]!==51?d:(d+=Ed(l,d),wd(l,d))},Zy=function(l){var d=wd(l,0);return l.length>=d+2&&(l[d]&255)===255&&(l[d+1]&240)===240&&(l[d+1]&22)===16},kd=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Jy=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},e_=function(l,d,u){return unescape(Jy(l,d,u))},t_=function(l,d){var u=(l[d+5]&224)>>5,p=l[d+4]<<3,g=l[d+3]&6144;return g|p|u},s_=function(l,d){return l[d]===73&&l[d+1]===68&&l[d+2]===51?"timed-metadata":l[d]&!0&&(l[d+1]&240)===240?"audio":null},n_=function(l){for(var d=0;d+5<l.length;){if(l[d]!==255||(l[d+1]&246)!==240){d++;continue}return Qy[(l[d+2]&60)>>>2]}return null},r_=function(l){var d,u,p,g;d=10,l[5]&64&&(d+=4,d+=kd(l.subarray(10,14)));do{if(u=kd(l.subarray(d+4,d+8)),u<1)return null;if(g=String.fromCharCode(l[d],l[d+1],l[d+2],l[d+3]),g==="PRIV"){p=l.subarray(d+10,d+u+10);for(var y=0;y<p.byteLength;y++)if(p[y]===0){var E=e_(p,0,y);if(E==="com.apple.streaming.transportStreamTimestamp"){var k=p.subarray(y+1),C=(k[3]&1)<<30|k[4]<<22|k[5]<<14|k[6]<<6|k[7]>>>2;return C*=4,C+=k[7]&3,C}break}}d+=10,d+=u}while(d<l.byteLength);return null},No={isLikelyAacData:Zy,parseId3TagSize:Ed,parseAdtsSize:t_,parseType:s_,parseSampleRate:n_,parseAacTimestamp:r_},i_=t,Cd=No,qi;qi=function(){var l=new Uint8Array,d=0;qi.prototype.init.call(this),this.setTimestamp=function(u){d=u},this.push=function(u){var p=0,g=0,y,E,k,C;for(l.length?(C=l.length,l=new Uint8Array(u.byteLength+C),l.set(l.subarray(0,C)),l.set(u,C)):l=u;l.length-g>=3;){if(l[g]===73&&l[g+1]===68&&l[g+2]===51){if(l.length-g<10||(p=Cd.parseId3TagSize(l,g),g+p>l.length))break;E={type:"timed-metadata",data:l.subarray(g,g+p)},this.trigger("data",E),g+=p;continue}else if((l[g]&255)===255&&(l[g+1]&240)===240){if(l.length-g<7||(p=Cd.parseAdtsSize(l,g),g+p>l.length))break;k={type:"audio",data:l.subarray(g,g+p),pts:d,dts:d},this.trigger("data",k),g+=p;continue}g++}y=l.length-g,y>0?l=l.subarray(g):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},qi.prototype=new i_;var a_=qi,o_=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],l_=o_,c_=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],d_=c_,Vi=t,kr=Gs,Cr=Xs,$i=Ee,Vt=Ey,gs=Hy,Hi=A,Id=Gy,u_=Ky.H264Stream,h_=a_,p_=No.isLikelyAacData,m_=A.ONE_SECOND_IN_TS,Oo=l_,Mo=d_,Ir,An,Wi,Qs,f_=function(l,d){d.stream=l,this.trigger("log",d)},xd=function(l,d){for(var u=Object.keys(d),p=0;p<u.length;p++){var g=u[p];g==="headOfPipeline"||!d[g].on||d[g].on("log",f_.bind(l,g))}},Ld=function(l,d){var u;if(l.length!==d.length)return!1;for(u=0;u<l.length;u++)if(l[u]!==d[u])return!1;return!0},Uo=function(l,d,u,p,g,y){var E=u-d,k=p-d,C=g-u;return{start:{dts:l,pts:l+E},end:{dts:l+k,pts:l+C},prependedContentDuration:y,baseMediaDecodeTime:l}};An=function(l,d){var u=[],p,g=0,y=0,E=1/0;d=d||{},p=d.firstSequenceNumber||0,An.prototype.init.call(this),this.push=function(k){Vt.collectDtsInfo(l,k),l&&Oo.forEach(function(C){l[C]=k[C]}),u.push(k)},this.setEarliestDts=function(k){g=k},this.setVideoBaseMediaDecodeTime=function(k){E=k},this.setAudioAppendStart=function(k){y=k},this.flush=function(){var k,C,x,O,V,ee,W;if(u.length===0){this.trigger("done","AudioSegmentStream");return}k=$i.trimAdtsFramesByEarliestDts(u,l,g),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),W=$i.prefixWithSilence(l,k,y,E),l.samples=$i.generateSampleTable(k),x=kr.mdat($i.concatenateFrameData(k)),u=[],C=kr.moof(p,[l]),O=new Uint8Array(C.byteLength+x.byteLength),p++,O.set(C),O.set(x,C.byteLength),Vt.clearDtsInfo(l),V=Math.ceil(m_*1024/l.samplerate),k.length&&(ee=k.length*V,this.trigger("segmentTimingInfo",Uo(Hi.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),k[0].dts,k[0].pts,k[0].dts+ee,k[0].pts+ee,W||0)),this.trigger("timingInfo",{start:k[0].pts,end:k[0].pts+ee})),this.trigger("data",{track:l,boxes:O}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Vt.clearDtsInfo(l),u=[],this.trigger("reset")}},An.prototype=new Vi,Ir=function(l,d){var u,p=[],g=[],y,E;d=d||{},u=d.firstSequenceNumber||0,Ir.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(k){Vt.collectDtsInfo(l,k),k.nalUnitType==="seq_parameter_set_rbsp"&&!y&&(y=k.config,l.sps=[k.data],Mo.forEach(function(C){l[C]=y[C]},this)),k.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=k.data,l.pps=[k.data]),p.push(k)},this.flush=function(){for(var k,C,x,O,V,ee,W=0,re,le;p.length&&p[0].nalUnitType!=="access_unit_delimiter_rbsp";)p.shift();if(p.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(k=Cr.groupNalsIntoFrames(p),x=Cr.groupFramesIntoGops(k),x[0][0].keyFrame||(C=this.getGopForFusion_(p[0],l),C?(W=C.duration,x.unshift(C),x.byteLength+=C.byteLength,x.nalCount+=C.nalCount,x.pts=C.pts,x.dts=C.dts,x.duration+=C.duration):x=Cr.extendFirstKeyFrame(x)),g.length){var Qe;if(d.alignGopsAtEnd?Qe=this.alignGopsAtEnd_(x):Qe=this.alignGopsAtStart_(x),!Qe){this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Vt.clearDtsInfo(l),x=Qe}Vt.collectDtsInfo(l,x),l.samples=Cr.generateSampleTable(x),V=kr.mdat(Cr.concatenateNalData(x)),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),this.trigger("processedGopsInfo",x.map(function(pt){return{pts:pt.pts,dts:pt.dts,byteLength:pt.byteLength}})),re=x[0],le=x[x.length-1],this.trigger("segmentTimingInfo",Uo(l.baseMediaDecodeTime,re.dts,re.pts,le.dts+le.duration,le.pts+le.duration,W)),this.trigger("timingInfo",{start:x[0].pts,end:x[x.length-1].pts+x[x.length-1].duration}),this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),O=kr.moof(u,[l]),ee=new Uint8Array(O.byteLength+V.byteLength),u++,ee.set(O),ee.set(V,O.byteLength),this.trigger("data",{track:l,boxes:ee}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),p=[],this.gopCache_.length=0,g.length=0,this.trigger("reset")},this.resetStream_=function(){Vt.clearDtsInfo(l),y=void 0,E=void 0},this.getGopForFusion_=function(k){var C=45e3,x=1e4,O=1/0,V,ee,W,re,le;for(le=0;le<this.gopCache_.length;le++)re=this.gopCache_[le],W=re.gop,!(!(l.pps&&Ld(l.pps[0],re.pps[0]))||!(l.sps&&Ld(l.sps[0],re.sps[0])))&&(W.dts<l.timelineStartInfo.dts||(V=k.dts-W.dts-W.duration,V>=-x&&V<=C&&(!ee||O>V)&&(ee=re,O=V)));return ee?ee.gop:null},this.alignGopsAtStart_=function(k){var C,x,O,V,ee,W,re,le;for(ee=k.byteLength,W=k.nalCount,re=k.duration,C=x=0;C<g.length&&x<k.length&&(O=g[C],V=k[x],O.pts!==V.pts);){if(V.pts>O.pts){C++;continue}x++,ee-=V.byteLength,W-=V.nalCount,re-=V.duration}return x===0?k:x===k.length?null:(le=k.slice(x),le.byteLength=ee,le.duration=re,le.nalCount=W,le.pts=le[0].pts,le.dts=le[0].dts,le)},this.alignGopsAtEnd_=function(k){var C,x,O,V,ee,W;for(C=g.length-1,x=k.length-1,ee=null,W=!1;C>=0&&x>=0;){if(O=g[C],V=k[x],O.pts===V.pts){W=!0;break}if(O.pts>V.pts){C--;continue}C===g.length-1&&(ee=x),x--}if(!W&&ee===null)return null;var re;if(W?re=x:re=ee,re===0)return k;var le=k.slice(re),Qe=le.reduce(function(pt,Kt){return pt.byteLength+=Kt.byteLength,pt.duration+=Kt.duration,pt.nalCount+=Kt.nalCount,pt},{byteLength:0,duration:0,nalCount:0});return le.byteLength=Qe.byteLength,le.duration=Qe.duration,le.nalCount=Qe.nalCount,le.pts=le[0].pts,le.dts=le[0].dts,le},this.alignGopsWith=function(k){g=k}},Ir.prototype=new Vi,Qs=function(l,d){this.numberOfTracks=0,this.metadataStream=d,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Qs.prototype.init.call(this),this.push=function(u){if(u.content||u.text)return this.pendingCaptions.push(u);if(u.frames)return this.pendingMetadata.push(u);this.pendingTracks.push(u.track),this.pendingBytes+=u.boxes.byteLength,u.track.type==="video"&&(this.videoTrack=u.track,this.pendingBoxes.push(u.boxes)),u.track.type==="audio"&&(this.audioTrack=u.track,this.pendingBoxes.unshift(u.boxes))}},Qs.prototype=new Vi,Qs.prototype.flush=function(l){var d=0,u={captions:[],captionStreams:{},metadata:[],info:{}},p,g,y,E=0,k;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="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,Mo.forEach(function(C){u.info[C]=this.videoTrack[C]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,Oo.forEach(function(C){u.info[C]=this.audioTrack[C]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?u.type=this.pendingTracks[0].type:u.type="combined",this.emittedTracks+=this.pendingTracks.length,y=kr.initSegment(this.pendingTracks),u.initSegment=new Uint8Array(y.byteLength),u.initSegment.set(y),u.data=new Uint8Array(this.pendingBytes),k=0;k<this.pendingBoxes.length;k++)u.data.set(this.pendingBoxes[k],d),d+=this.pendingBoxes[k].byteLength;for(k=0;k<this.pendingCaptions.length;k++)p=this.pendingCaptions[k],p.startTime=Hi.metadataTsToSeconds(p.startPts,E,this.keepOriginalTimestamps),p.endTime=Hi.metadataTsToSeconds(p.endPts,E,this.keepOriginalTimestamps),u.captionStreams[p.stream]=!0,u.captions.push(p);for(k=0;k<this.pendingMetadata.length;k++)g=this.pendingMetadata[k],g.cueTime=Hi.metadataTsToSeconds(g.pts,E,this.keepOriginalTimestamps),u.metadata.push(g);for(u.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",u),k=0;k<u.captions.length;k++)p=u.captions[k],this.trigger("caption",p);for(k=0;k<u.metadata.length;k++)g=u.metadata[k],this.trigger("id3Frame",g)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Qs.prototype.setRemux=function(l){this.remuxTracks=l},Wi=function(l){var d=this,u=!0,p,g;Wi.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new gs.MetadataStream,y.aacStream=new h_,y.audioTimestampRolloverStream=new gs.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new gs.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Id,y.coalesceStream=new Qs(l,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||(g=g||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new gs.MetadataStream,y.packetStream=new gs.TransportPacketStream,y.parseStream=new gs.TransportParseStream,y.elementaryStream=new gs.ElementaryStream,y.timestampRolloverStream=new gs.TimestampRolloverStream,y.adtsStream=new Id,y.h264Stream=new u_,y.captionStream=new gs.CaptionStream(l),y.coalesceStream=new Qs(l,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--;)!p&&E.tracks[k].type==="video"?(p=E.tracks[k],p.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!g&&E.tracks[k].type==="audio"&&(g=E.tracks[k],g.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);p&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new Ir(p,l),y.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(C){g&&!l.keepOriginalTimestamps&&(g.timelineStartInfo=C,y.audioSegmentStream.setEarliestDts(C.dts-d.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(C){g&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(C)}),y.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),g&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,d.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),g&&(g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(g),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),p&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(p),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){g&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;l.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){p&&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(u){var E=p_(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),u=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){u=!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()}},Wi.prototype=new Vi;var g_={Transmuxer:Wi,VideoSegmentStream:Ir,AudioSegmentStream:An,AUDIO_PROPERTIES:Oo,VIDEO_PROPERTIES:Mo,generateSegmentTimingInfo:Uo},y_=function(l){return l>>>0},__=function(l){return("00"+l.toString(16)).slice(-2)},zi={toUnsigned:y_,toHexString:__},v_=function(l){var d="";return d+=String.fromCharCode(l[0]),d+=String.fromCharCode(l[1]),d+=String.fromCharCode(l[2]),d+=String.fromCharCode(l[3]),d},Bo=v_,b_=zi.toUnsigned,T_=Bo,Pd=function(l,d){var u=[],p,g,y,E,k;if(!d.length)return null;for(p=0;p<l.byteLength;)g=b_(l[p]<<24|l[p+1]<<16|l[p+2]<<8|l[p+3]),y=T_(l.subarray(p+4,p+8)),E=g>1?p+g:l.byteLength,y===d[0]&&(d.length===1?u.push(l.subarray(p+8,E)):(k=Pd(l.subarray(p+8,E),d.slice(1)),k.length&&(u=u.concat(k)))),p=E;return u},Gi=Pd,A_=zi.toUnsigned,S_=i.getUint64,E_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=S_(l.subarray(4)):d.baseMediaDecodeTime=A_(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),d},Fo=E_,w_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4)},p=u.flags[2]&1,g=u.flags[2]&2,y=u.flags[2]&8,E=u.flags[2]&16,k=u.flags[2]&32,C=u.flags[0]&65536,x=u.flags[0]&131072,O;return O=8,p&&(O+=4,u.baseDataOffset=d.getUint32(12),O+=4),g&&(u.sampleDescriptionIndex=d.getUint32(O),O+=4),y&&(u.defaultSampleDuration=d.getUint32(O),O+=4),E&&(u.defaultSampleSize=d.getUint32(O),O+=4),k&&(u.defaultSampleFlags=d.getUint32(O)),C&&(u.durationIsEmpty=!0),!p&&x&&(u.baseDataOffsetIsMoof=!0),u},jo=w_,Rd=i.getUint64,k_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),references:[],referenceId:d.getUint32(4),timescale:d.getUint32(8)},p=12;u.version===0?(u.earliestPresentationTime=d.getUint32(p),u.firstOffset=d.getUint32(p+4),p+=8):(u.earliestPresentationTime=Rd(l.subarray(p)),u.firstOffset=Rd(l.subarray(p+8)),p+=16),p+=2;var g=d.getUint16(p);for(p+=2;g>0;p+=12,g--)u.references.push({referenceType:(l[p]&128)>>>7,referencedSize:d.getUint32(p)&2147483647,subsegmentDuration:d.getUint32(p+4),startsWithSap:!!(l[p+8]&128),sapType:(l[p+8]&112)>>>4,sapDeltaTime:d.getUint32(p+8)&268435455});return u},C_=k_,I_=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},x_=I_,Dd=x_,L_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u=new DataView(l.buffer,l.byteOffset,l.byteLength),p=d.flags[2]&1,g=d.flags[2]&4,y=d.flags[1]&1,E=d.flags[1]&2,k=d.flags[1]&4,C=d.flags[1]&8,x=u.getUint32(4),O=8,V;for(p&&(d.dataOffset=u.getInt32(O),O+=4),g&&x&&(V={flags:Dd(l.subarray(O,O+4))},O+=4,y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V),x--);x--;)V={},y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),k&&(V.flags=Dd(l.subarray(O,O+4)),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V);return d},Nd=L_,P_=i,Od=P_.getUint64,rt,qo,Nt=function(l){return new Date(l*1e3-20828448e5)},xr=Bo,R_=Gi,D_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=[],p,g;for(p=0;p+4<l.length;p+=g){if(g=d.getUint32(p),p+=4,g<=0){u.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(l[p]&31){case 1:u.push("slice_layer_without_partitioning_rbsp");break;case 5:u.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:u.push("sei_rbsp");break;case 7:u.push("seq_parameter_set_rbsp");break;case 8:u.push("pic_parameter_set_rbsp");break;case 9:u.push("access_unit_delimiter_rbsp");break;default:u.push("UNKNOWN NAL - "+l[p]&31);break}}return u},Rs={avc1:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{dataReferenceIndex:d.getUint16(6),width:d.getUint16(24),height:d.getUint16(26),horizresolution:d.getUint16(28)+d.getUint16(30)/16,vertresolution:d.getUint16(32)+d.getUint16(34)/16,frameCount:d.getUint16(40),depth:d.getUint16(74),config:rt(l.subarray(78,l.byteLength))}},avcC:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={configurationVersion:l[0],avcProfileIndication:l[1],profileCompatibility:l[2],avcLevelIndication:l[3],lengthSizeMinusOne:l[4]&3,sps:[],pps:[]},p=l[5]&31,g,y,E,k;for(E=6,k=0;k<p;k++)y=d.getUint16(E),E+=2,u.sps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;for(g=l[E],E++,k=0;k<g;k++)y=d.getUint16(E),E+=2,u.pps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;return u},btrt:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{bufferSizeDB:d.getUint32(0),maxBitrate:d.getUint32(4),avgBitrate:d.getUint32(8)}},edts:function(l){return{boxes:rt(l)}},elst:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),edits:[]},p=d.getUint32(4),g;for(g=8;p;p--)u.version===0?(u.edits.push({segmentDuration:d.getUint32(g),mediaTime:d.getInt32(g+4),mediaRate:d.getUint16(g+8)+d.getUint16(g+10)/(256*256)}),g+=12):(u.edits.push({segmentDuration:Od(l.subarray(g)),mediaTime:Od(l.subarray(g+8)),mediaRate:d.getUint16(g+16)+d.getUint16(g+18)/(256*256)}),g+=20);return u},esds:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),esId:l[6]<<8|l[7],streamPriority:l[8]&31,decoderConfig:{objectProfileIndication:l[11],streamType:l[12]>>>2&63,bufferSize:l[13]<<16|l[14]<<8|l[15],maxBitrate:l[16]<<24|l[17]<<16|l[18]<<8|l[19],avgBitrate:l[20]<<24|l[21]<<16|l[22]<<8|l[23],decoderConfigDescriptor:{tag:l[24],length:l[25],audioObjectType:l[26]>>>3&31,samplingFrequencyIndex:(l[26]&7)<<1|l[27]>>>7&1,channelConfiguration:l[27]>>>3&15}}}},ftyp:function(l){for(var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={majorBrand:xr(l.subarray(0,4)),minorVersion:d.getUint32(4),compatibleBrands:[]},p=8;p<l.byteLength;)u.compatibleBrands.push(xr(l.subarray(p,p+4))),p+=4;return u},dinf:function(l){return{boxes:rt(l)}},dref:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),dataReferences:rt(l.subarray(8))}},hdlr:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),handlerType:xr(l.subarray(8,12)),name:""},p=8;for(p=24;p<l.byteLength;p++){if(l[p]===0){p++;break}u.name+=String.fromCharCode(l[p])}return u.name=decodeURIComponent(escape(u.name)),u},mdat:function(l){return{byteLength:l.byteLength,nals:D_(l)}},mdhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p,g={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),language:""};return g.version===1?(u+=4,g.creationTime=Nt(d.getUint32(u)),u+=8,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=8,g.duration=d.getUint32(u)):(g.creationTime=Nt(d.getUint32(u)),u+=4,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=4,g.duration=d.getUint32(u)),u+=4,p=d.getUint16(u),g.language+=String.fromCharCode((p>>10)+96),g.language+=String.fromCharCode(((p&992)>>5)+96),g.language+=String.fromCharCode((p&31)+96),g},mdia:function(l){return{boxes:rt(l)}},mfhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sequenceNumber:l[4]<<24|l[5]<<16|l[6]<<8|l[7]}},minf:function(l){return{boxes:rt(l)}},mp4a:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={dataReferenceIndex:d.getUint16(6),channelcount:d.getUint16(16),samplesize:d.getUint16(18),samplerate:d.getUint16(24)+d.getUint16(26)/65536};return l.byteLength>28&&(u.streamDescriptor=rt(l.subarray(28))[0]),u},moof:function(l){return{boxes:rt(l)}},moov:function(l){return{boxes:rt(l)}},mvex:function(l){return{boxes:rt(l)}},mvhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=4,p.duration=d.getUint32(u)),u+=4,p.rate=d.getUint16(u)+d.getUint16(u+2)/16,u+=4,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,u+=2*4,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,u+=6*4,p.nextTrackId=d.getUint32(u),p},pdin:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),rate:d.getUint32(4),initialDelay:d.getUint32(8)}},sdtp:function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u;for(u=4;u<l.byteLength;u++)d.samples.push({dependsOn:(l[u]&48)>>4,isDependedOn:(l[u]&12)>>2,hasRedundancy:l[u]&3});return d},sidx:C_,smhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),balance:l[4]+l[5]/256}},stbl:function(l){return{boxes:rt(l)}},ctts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),compositionOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.compositionOffsets.push({sampleCount:d.getUint32(g),sampleOffset:d[u.version===0?"getUint32":"getInt32"](g+4)});return u},stss:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),syncSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.syncSamples.push(d.getUint32(g));return u},stco:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),chunkOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.chunkOffsets.push(d.getUint32(g));return u},stsc:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=d.getUint32(4),p={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleToChunks:[]},g;for(g=8;u;g+=12,u--)p.sampleToChunks.push({firstChunk:d.getUint32(g),samplesPerChunk:d.getUint32(g+4),sampleDescriptionIndex:d.getUint32(g+8)});return p},stsd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleDescriptions:rt(l.subarray(8))}},stsz:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleSize:d.getUint32(4),entries:[]},p;for(p=12;p<l.byteLength;p+=4)u.entries.push(d.getUint32(p));return u},stts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),timeToSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.timeToSamples.push({sampleCount:d.getUint32(g),sampleDelta:d.getUint32(g+4)});return u},styp:function(l){return Rs.ftyp(l)},tfdt:Fo,tfhd:jo,tkhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=4,p.duration=d.getUint32(u)),u+=4,u+=2*4,p.layer=d.getUint16(u),u+=2,p.alternateGroup=d.getUint16(u),u+=2,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,p.width=d.getUint16(u)+d.getUint16(u+2)/65536,u+=4,p.height=d.getUint16(u)+d.getUint16(u+2)/65536,p},traf:function(l){return{boxes:rt(l)}},trak:function(l){return{boxes:rt(l)}},trex:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4),defaultSampleDescriptionIndex:d.getUint32(8),defaultSampleDuration:d.getUint32(12),defaultSampleSize:d.getUint32(16),sampleDependsOn:l[20]&3,sampleIsDependedOn:(l[21]&192)>>6,sampleHasRedundancy:(l[21]&48)>>4,samplePaddingValue:(l[21]&14)>>1,sampleIsDifferenceSample:!!(l[21]&1),sampleDegradationPriority:d.getUint16(22)}},trun:Nd,"url ":function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4))}},vmhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),graphicsmode:d.getUint16(4),opcolor:new Uint16Array([d.getUint16(6),d.getUint16(8),d.getUint16(10)])}}};rt=function(l){for(var d=0,u=[],p,g,y,E,k,C=new ArrayBuffer(l.length),x=new Uint8Array(C),O=0;O<l.length;++O)x[O]=l[O];for(p=new DataView(C);d<l.byteLength;)g=p.getUint32(d),y=xr(l.subarray(d+4,d+8)),E=g>1?d+g:l.byteLength,k=(Rs[y]||function(V){return{data:V}})(l.subarray(d+8,E)),k.size=g,k.type=y,u.push(k),d=E;return u},qo=function(l,d){var u;return d=d||0,u=new Array(d*2+1).join(" "),l.map(function(p,g){return u+p.type+`
|
|
200
|
-
`+Object.keys(
|
|
201
|
-
`+
|
|
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 bf={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=bf[o]||o,String.fromCharCode(o))},cs=14,vf=[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=vf.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},Tf=t,Sf=8589934592,Ef=4294967296,xu="shared",Qa=function(o,c){var d=1;for(o>c&&(d=-1);Math.abs(c-o)>Ef;)o+=d*Sf;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 Tf;var Lu={TimestampRolloverStream:Ja,handleRollover:Qa},wf=(o,c,d)=>{if(!o)return-1;for(var h=d;h<o.length;h++)if(o[h]===c)return h;return-1},kf={typedArrayIndexOf:wf},hs=kf.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}},Cf=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:Cf,parseSyncSafeInteger:nn,frameParsers:sn},If=t,Af=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=Af.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 If;var xf=gs,Za=t,eo=Au,Mt=ds,Lf=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:Lf,CaptionStream:eo.CaptionStream,Cea608Stream:eo.Cea608Stream,Cea708Stream:eo.Cea708Stream,MetadataStream:xf};for(var io in Mt)Mt.hasOwnProperty(io)&&(Ru[io]=Mt[io]);var Df=Ru,Pf=t,Rf=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*Rf/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 Pf;var Nf=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 Of=Ou,Uu=t,Uf=Of,_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 Uf(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 Mf={H264Stream:_s,NalByteStream:on},Bf=[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))},Ff=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]},jf=function(o,c,d){var h,f="";for(h=c;h<d;h++)f+="%"+("00"+o[h].toString(16)).slice(-2);return f},qf=function(o,c,d){return unescape(jf(o,c,d))},$f=function(o,c){var d=(o[c+5]&224)>>5,h=o[c+4]<<3,f=o[c+3]&6144;return f|h|d},Vf=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},Hf=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return Bf[(o[c+2]&60)>>>2]}return null},zf=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=qf(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:Ff,parseId3TagSize:Bu,parseAdtsSize:$f,parseType:Vf,parseSampleRate:Hf,parseAacTimestamp:zf},Wf=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 Wf;var Gf=bs,Xf=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Kf=Xf,Yf=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Qf=Yf,vs=t,ln=Fi,un=ji,Ts=be,Bt=df,ci=Df,Ss=T,$u=Nf,Jf=Mf.H264Stream,Zf=Gf,ey=ro.isLikelyAacData,ty=T.ONE_SECOND_IN_TS,no=Kf,so=Qf,cn,ur,Es,Vi,iy=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",iy.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(ty*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 Zf,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 Jf,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=ey(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 ry={Transmuxer:Es,VideoSegmentStream:cn,AudioSegmentStream:ur,AUDIO_PROPERTIES:no,VIDEO_PROPERTIES:so,generateSegmentTimingInfo:ao},ny=function(o){return o>>>0},sy=function(o){return("00"+o.toString(16)).slice(-2)},ws={toUnsigned:ny,toHexString:sy},ay=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=ay,oy=ws.toUnsigned,ly=oo,zu=function(o,c){var d=[],h,f,y,E,k;if(!c.length)return null;for(h=0;h<o.byteLength;)f=oy(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3]),y=ly(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,uy=ws.toUnsigned,cy=s.getUint64,dy=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=cy(o.subarray(4)):c.baseMediaDecodeTime=uy(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},lo=dy,hy=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=hy,Wu=s.getUint64,py=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},gy=py,my=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]}},fy=my,Gu=fy,yy=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=yy,_y=s,Ku=_y.getUint64,Je,co,At=function(o){return new Date(o*1e3-20828448e5)},dn=oo,by=ks,vy=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:vy(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:gy,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+`
|
|
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
|
+
`+I.map(function(A){return d+" "+A}).join(`
|
|
202
202
|
`)+`
|
|
203
|
-
`+
|
|
204
|
-
`).map(function(
|
|
203
|
+
`+d+" >":E+"<>"}return E+JSON.stringify(k,null,2).split(`
|
|
204
|
+
`).map(function(A,R){return R===0?A:d+" "+A}).join(`
|
|
205
205
|
`)}).join(`
|
|
206
|
-
`)+(
|
|
207
|
-
`+
|
|
208
|
-
`)};var Md={inspect:rt,textify:qo,parseType:xr,findBox:R_,parseTraf:Rs.traf,parseTfdt:Rs.tfdt,parseHdlr:Rs.hdlr,parseTfhd:Rs.tfhd,parseTrun:Rs.trun,parseSidx:Rs.sidx},N_=function(l){for(var d=0,u=String.fromCharCode(l[d]),p="";u!=="\0";)p+=u,d++,u=String.fromCharCode(l[d]);return p+=u,p},O_={uint8ToCString:N_},Xi=O_.uint8ToCString,M_=i.getUint64,U_=function(l){var d=4,u=l[0],p,g,y,E,k,C,x,O;if(u===0){p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length;var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,k=V.getUint32(d),d+=4,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4}else if(u===1){var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,E=M_(l.subarray(d)),d+=8,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4,p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length}O=new Uint8Array(l.subarray(d,l.byteLength));var ee={scheme_id_uri:p,value:g,timescale:y||1,presentation_time:E,presentation_time_delta:k,event_duration:C,id:x,message_data:O};return F_(u,ee)?ee:void 0},B_=function(l,d,u,p){return l||l===0?l/d:p+u/d},F_=function(l,d){var u=d.scheme_id_uri!=="\0",p=l===0&&Ud(d.presentation_time_delta)&&u,g=l===1&&Ud(d.presentation_time)&&u;return!(l>1)&&p||g},Ud=function(l){return l!==void 0||l!==null},j_={parseEmsgBox:U_,scaleTime:B_},Lr;typeof window<"u"?Lr=window:typeof s<"u"?Lr=s:typeof self<"u"?Lr=self:Lr={};var Bd=Lr,Yi=zi.toUnsigned,Pr=zi.toHexString,$e=Gi,Sn=Bo,Vo=j_,q_=jo,V_=Nd,$_=Fo,H_=i.getUint64,Fd,jd,qd,Vd,$d,$o,Hd,Ho=Bd,W_=_d.parseId3Frames;Fd=function(l){var d={},u=$e(l,["moov","trak"]);return u.reduce(function(p,g){var y,E,k,C,x;return y=$e(g,["tkhd"])[0],!y||(E=y[0],k=E===0?12:20,C=Yi(y[k]<<24|y[k+1]<<16|y[k+2]<<8|y[k+3]),x=$e(g,["mdia","mdhd"])[0],!x)?null:(E=x[0],k=E===0?12:20,p[C]=Yi(x[k]<<24|x[k+1]<<16|x[k+2]<<8|x[k+3]),p)},d)},jd=function(l,d){var u;u=$e(d,["moof","traf"]);var p=u.reduce(function(g,y){var E=$e(y,["tfhd"])[0],k=Yi(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),C=l[k]||9e4,x=$e(y,["tfdt"])[0],O=new DataView(x.buffer,x.byteOffset,x.byteLength),V;x[0]===1?V=H_(x.subarray(4,12)):V=O.getUint32(4);let ee;return typeof V=="bigint"?ee=V/Ho.BigInt(C):typeof V=="number"&&!isNaN(V)&&(ee=V/C),ee<Number.MAX_SAFE_INTEGER&&(ee=Number(ee)),ee<g&&(g=ee),g},1/0);return typeof p=="bigint"||isFinite(p)?p:0},qd=function(l,d){var u=$e(d,["moof","traf"]),p=0,g=0,y;if(u&&u.length){var E=$e(u[0],["tfhd"])[0],k=$e(u[0],["trun"])[0],C=$e(u[0],["tfdt"])[0];if(E){var x=q_(E);y=x.trackId}if(C){var O=$_(C);p=O.baseMediaDecodeTime}if(k){var V=V_(k);V.samples&&V.samples.length&&(g=V.samples[0].compositionTimeOffset||0)}}var ee=l[y]||9e4;typeof p=="bigint"&&(g=Ho.BigInt(g),ee=Ho.BigInt(ee));var W=(p+g)/ee;return typeof W=="bigint"&&W<Number.MAX_SAFE_INTEGER&&(W=Number(W)),W},Vd=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g=$e(p,["mdia","hdlr"]),y=$e(p,["tkhd"]);g.forEach(function(E,k){var C=Sn(E.subarray(8,12)),x=y[k],O,V,ee;C==="vide"&&(O=new DataView(x.buffer,x.byteOffset,x.byteLength),V=O.getUint8(0),ee=V===0?O.getUint32(12):O.getUint32(20),u.push(ee))})}),u},$o=function(l){var d=l[0],u=d===0?12:20;return Yi(l[u]<<24|l[u+1]<<16|l[u+2]<<8|l[u+3])},$d=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g={},y=$e(p,["tkhd"])[0],E,k;y&&(E=new DataView(y.buffer,y.byteOffset,y.byteLength),k=E.getUint8(0),g.id=k===0?E.getUint32(12):E.getUint32(20));var C=$e(p,["mdia","hdlr"])[0];if(C){var x=Sn(C.subarray(8,12));x==="vide"?g.type="video":x==="soun"?g.type="audio":g.type=x}var O=$e(p,["mdia","minf","stbl","stsd"])[0];if(O){var V=O.subarray(8);g.codec=Sn(V.subarray(4,8));var ee=$e(V,[g.codec])[0],W,re;ee&&(/^[asm]vc[1-9]$/i.test(g.codec)?(W=ee.subarray(78),re=Sn(W.subarray(4,8)),re==="avcC"&&W.length>11?(g.codec+=".",g.codec+=Pr(W[9]),g.codec+=Pr(W[10]),g.codec+=Pr(W[11])):g.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(g.codec)?(W=ee.subarray(28),re=Sn(W.subarray(4,8)),re==="esds"&&W.length>20&&W[19]!==0?(g.codec+="."+Pr(W[19]),g.codec+="."+Pr(W[20]>>>2&63).replace(/^0/,"")):g.codec="mp4a.40.2"):g.codec=g.codec.toLowerCase())}var le=$e(p,["mdia","mdhd"])[0];le&&(g.timescale=$o(le)),u.push(g)}),u},Hd=function(l,d=0){var u=$e(l,["emsg"]);return u.map(p=>{var g=Vo.parseEmsgBox(new Uint8Array(p)),y=W_(g.message_data);return{cueTime:Vo.scaleTime(g.presentation_time,g.timescale,g.presentation_time_delta,d),duration:Vo.scaleTime(g.event_duration,g.timescale),frames:y}})};var Rr={findBox:$e,parseType:Sn,timescale:Fd,startTime:jd,compositionStartTime:qd,videoTrackIds:Vd,tracks:$d,getTimescaleFromMediaHeader:$o,getEmsgID3:Hd};const{parseTrun:z_}=Md,{findBox:Wd}=Rr;var zd=Bd,G_=function(l){var d=Wd(l,["moof","traf"]),u=Wd(l,["mdat"]),p=[];return u.forEach(function(g,y){var E=d[y];p.push({mdat:g,traf:E})}),p},X_=function(l,d,u){var p=d,g=u.defaultSampleDuration||0,y=u.defaultSampleSize||0,E=u.trackId,k=[];return l.forEach(function(C){var x=z_(C),O=x.samples;O.forEach(function(V){V.duration===void 0&&(V.duration=g),V.size===void 0&&(V.size=y),V.trackId=E,V.dts=p,V.compositionTimeOffset===void 0&&(V.compositionTimeOffset=0),typeof p=="bigint"?(V.pts=p+zd.BigInt(V.compositionTimeOffset),p+=zd.BigInt(V.duration)):(V.pts=p+V.compositionTimeOffset,p+=V.duration)}),k=k.concat(O)}),k},Gd={getMdatTrafPairs:G_,parseSamples:X_},Y_=pd.discardEmulationPreventionBytes,K_=md.CaptionStream,Wo=Gi,Q_=Fo,Z_=jo,{getMdatTrafPairs:J_,parseSamples:ev}=Gd,tv=function(l,d){for(var u=l,p=0;p<d.length;p++){var g=d[p];if(u<g.size)return g;u-=g.size}return null},sv=function(l,d,u){var p=new DataView(l.buffer,l.byteOffset,l.byteLength),g={logs:[],seiNals:[]},y,E,k,C;for(E=0;E+4<l.length;E+=k)if(k=p.getUint32(E),E+=4,!(k<=0))switch(l[E]&31){case 6:var x=l.subarray(E+1,E+1+k),O=tv(E,d);if(y={nalUnitType:"sei_rbsp",size:k,data:x,escapedRBSP:Y_(x),trackId:u},O)y.pts=O.pts,y.dts=O.dts,C=O;else if(C)y.pts=C.pts,y.dts=C.dts;else{g.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+u+". See mux.js#223."});break}g.seiNals.push(y);break}return g},nv=function(l,d){var u={},p=J_(l);return p.forEach(function(g){var y=g.mdat,E=g.traf,k=Wo(E,["tfhd"]),C=Z_(k[0]),x=C.trackId,O=Wo(E,["tfdt"]),V=O.length>0?Q_(O[0]).baseMediaDecodeTime:0,ee=Wo(E,["trun"]),W,re;d===x&&ee.length>0&&(W=ev(ee,V,C),re=sv(y,W,x),u[x]||(u[x]={seiNals:[],logs:[]}),u[x].seiNals=u[x].seiNals.concat(re.seiNals),u[x].logs=u[x].logs.concat(re.logs))}),u},rv=function(l,d,u){var p;if(d===null)return null;p=nv(l,d);var g=p[d]||{};return{seiNals:g.seiNals,logs:g.logs,timescale:u}},iv=function(){var l=!1,d,u,p,g,y,E;this.isInitialized=function(){return l},this.init=function(k){d=new K_,l=!0,E=k?k.isPartial:!1,d.on("data",function(C){C.startTime=C.startPts/g,C.endTime=C.endPts/g,y.captions.push(C),y.captionStreams[C.stream]=!0}),d.on("log",function(C){y.logs.push(C)})},this.isNewInit=function(k,C){return k&&k.length===0||C&&typeof C=="object"&&Object.keys(C).length===0?!1:p!==k[0]||g!==C[p]},this.parse=function(k,C,x){var O;if(this.isInitialized()){if(!C||!x)return null;if(this.isNewInit(C,x))p=C[0],g=x[p];else if(p===null||!g)return u.push(k),null}else return null;for(;u.length>0;){var V=u.shift();this.parse(V,C,x)}return O=rv(k,p,g),O&&O.logs&&(y.logs=y.logs.concat(O.logs)),O===null||!O.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(O.seiNals),this.flushStream(),y)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(C){d.push(C)})},this.flushStream=function(){if(!this.isInitialized())return null;E?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){u=[],p=null,g=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},av=iv;const{parseTfdt:ov}=Md,Ds=Gi,{getTimescaleFromMediaHeader:lv}=Rr,{parseSamples:cv,getMdatTrafPairs:dv}=Gd;var Xd=function(){let l=9e4;this.init=function(d){const u=Ds(d,["moov","trak","mdia","mdhd"])[0];u&&(l=lv(u))},this.parseSegment=function(d){const u=[],p=dv(d);let g=0;return p.forEach(function(y){const E=y.mdat,k=y.traf,C=Ds(k,["tfdt"])[0],x=Ds(k,["tfhd"])[0],O=Ds(k,["trun"]);if(C&&(g=ov(C).baseMediaDecodeTime),O.length&&x){const V=cv(O,g,x);let ee=0;V.forEach(function(W){const re="utf-8",le=new TextDecoder(re),Qe=E.slice(ee,ee+W.size);if(Ds(Qe,["vtte"])[0]){ee+=W.size;return}Ds(Qe,["vttc"]).forEach(function(pt){const Kt=Ds(pt,["payl"])[0],Dr=Ds(pt,["sttg"])[0],Zi=W.pts/l,Ji=(W.pts+W.duration)/l;let Js,Nr;if(Kt)try{Js=le.decode(Kt)}catch(De){console.error(De)}if(Dr)try{Nr=le.decode(Dr)}catch(De){console.error(De)}W.duration&&Js&&u.push({cueText:Js,start:Zi,end:Ji,settings:Nr})}),ee+=W.size})}}),u}},zo=Di,Yd=function(l){var d=l[1]&31;return d<<=8,d|=l[2],d},Ki=function(l){return!!(l[1]&64)},Qi=function(l){var d=0;return(l[3]&48)>>>4>1&&(d+=l[4]+1),d},uv=function(l,d){var u=Yd(l);return u===0?"pat":u===d?"pmt":d?"pes":null},hv=function(l){var d=Ki(l),u=4+Qi(l);return d&&(u+=l[u]+1),(l[u+10]&31)<<8|l[u+11]},pv=function(l){var d={},u=Ki(l),p=4+Qi(l);if(u&&(p+=l[p]+1),!!(l[p+5]&1)){var g,y,E;g=(l[p+1]&15)<<8|l[p+2],y=3+g-4,E=(l[p+10]&15)<<8|l[p+11];for(var k=12+E;k<y;){var C=p+k;d[(l[C+1]&31)<<8|l[C+2]]=l[C],k+=((l[C+3]&15)<<8|l[C+4])+5}return d}},mv=function(l,d){var u=Yd(l),p=d[u];switch(p){case zo.H264_STREAM_TYPE:return"video";case zo.ADTS_STREAM_TYPE:return"audio";case zo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},fv=function(l){var d=Ki(l);if(!d)return null;var u=4+Qi(l);if(u>=l.byteLength)return null;var p=null,g;return g=l[u+7],g&192&&(p={},p.pts=(l[u+9]&14)<<27|(l[u+10]&255)<<20|(l[u+11]&254)<<12|(l[u+12]&255)<<5|(l[u+13]&254)>>>3,p.pts*=4,p.pts+=(l[u+13]&6)>>>1,p.dts=p.pts,g&64&&(p.dts=(l[u+14]&14)<<27|(l[u+15]&255)<<20|(l[u+16]&254)<<12|(l[u+17]&255)<<5|(l[u+18]&254)>>>3,p.dts*=4,p.dts+=(l[u+18]&6)>>>1)),p},Go=function(l){switch(l){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}},gv=function(l){for(var d=4+Qi(l),u=l.subarray(d),p=0,g=0,y=!1,E;g<u.byteLength-3;g++)if(u[g+2]===1){p=g+5;break}for(;p<u.byteLength;)switch(u[p]){case 0:if(u[p-1]!==0){p+=2;break}else if(u[p-2]!==0){p++;break}g+3!==p-2&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0));do p++;while(u[p]!==1&&p<u.length);g=p-2,p+=3;break;case 1:if(u[p-1]!==0||u[p-2]!==0){p+=3;break}E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0),g=p-2,p+=3;break;default:p+=3;break}return u=u.subarray(g),p-=g,g=0,u&&u.byteLength>3&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},yv={parseType:uv,parsePat:hv,parsePmt:pv,parsePayloadUnitStartIndicator:Ki,parsePesType:mv,parsePesTime:fv,videoPacketContainsKeyFrame:gv},Kd=Di,En=gd.handleRollover,Te={};Te.ts=yv,Te.aac=No;var Zs=A.ONE_SECOND_IN_TS,ht=188,Yt=71,_v=function(l,d){for(var u=0,p=ht,g,y;p<l.byteLength;){if(l[u]===Yt&&l[p]===Yt){switch(g=l.subarray(u,p),y=Te.ts.parseType(g,d.pid),y){case"pat":d.pid=Te.ts.parsePat(g);break;case"pmt":var E=Te.ts.parsePmt(g);d.table=d.table||{},Object.keys(E).forEach(function(k){d.table[k]=E[k]});break}u+=ht,p+=ht;continue}u++,p++}},Qd=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O=!1;g<=l.byteLength;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,O=!1;p>=0;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p-=ht,g-=ht;continue}p--,g--}},vv=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O,V,ee,W=!1,re={data:[],size:0};g<l.byteLength;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":if(k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&(C&&!W&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0)),!u.firstKeyFrame)){if(C&&re.size!==0){for(O=new Uint8Array(re.size),V=0;re.data.length;)ee=re.data.shift(),O.set(ee,V),V+=ee.byteLength;if(Te.ts.videoPacketContainsKeyFrame(O)){var le=Te.ts.parsePesTime(O);le?(u.firstKeyFrame=le,u.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(W&&u.firstKeyFrame)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,W=!1;p>=0;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0));break}if(W)break;p-=ht,g-=ht;continue}p--,g--}},bv=function(l,d){if(l.audio&&l.audio.length){var u=d;(typeof u>"u"||isNaN(u))&&(u=l.audio[0].dts),l.audio.forEach(function(y){y.dts=En(y.dts,u),y.pts=En(y.pts,u),y.dtsTime=y.dts/Zs,y.ptsTime=y.pts/Zs})}if(l.video&&l.video.length){var p=d;if((typeof p>"u"||isNaN(p))&&(p=l.video[0].dts),l.video.forEach(function(y){y.dts=En(y.dts,p),y.pts=En(y.pts,p),y.dtsTime=y.dts/Zs,y.ptsTime=y.pts/Zs}),l.firstKeyFrame){var g=l.firstKeyFrame;g.dts=En(g.dts,p),g.pts=En(g.pts,p),g.dtsTime=g.dts/Zs,g.ptsTime=g.pts/Zs}}},Tv=function(l){for(var d=!1,u=0,p=null,g=null,y=0,E=0,k;l.length-E>=3;){var C=Te.aac.parseType(l,E);switch(C){case"timed-metadata":if(l.length-E<10){d=!0;break}if(y=Te.aac.parseId3TagSize(l,E),y>l.length){d=!0;break}g===null&&(k=l.subarray(E,E+y),g=Te.aac.parseAacTimestamp(k)),E+=y;break;case"audio":if(l.length-E<7){d=!0;break}if(y=Te.aac.parseAdtsSize(l,E),y>l.length){d=!0;break}p===null&&(k=l.subarray(E,E+y),p=Te.aac.parseSampleRate(k)),u++,E+=y;break;default:E++;break}if(d)return null}if(p===null||g===null)return null;var x=Zs/p,O={audio:[{type:"audio",dts:g,pts:g},{type:"audio",dts:g+u*1024*x,pts:g+u*1024*x}]};return O},Av=function(l){var d={pid:null,table:null},u={};_v(l,d);for(var p in d.table)if(d.table.hasOwnProperty(p)){var g=d.table[p];switch(g){case Kd.H264_STREAM_TYPE:u.video=[],vv(l,d,u),u.video.length===0&&delete u.video;break;case Kd.ADTS_STREAM_TYPE:u.audio=[],Qd(l,d,u),u.audio.length===0&&delete u.audio;break}}return u},Sv=function(l,d){var u=Te.aac.isLikelyAacData(l),p;return u?p=Tv(l):p=Av(l),!p||!p.audio&&!p.video?null:(bv(p,d),p)},Ev={inspect:Sv,parseAudioPes_:Qd};const wv=function(l,d){d.on("data",function(u){const p=u.initSegment;u.initSegment={data:p.buffer,byteOffset:p.byteOffset,byteLength:p.byteLength};const g=u.data;u.data=g.buffer,l.postMessage({action:"data",segment:u,byteOffset:g.byteOffset,byteLength:g.byteLength},[u.data])}),d.on("done",function(u){l.postMessage({action:"done"})}),d.on("gopInfo",function(u){l.postMessage({action:"gopInfo",gopInfo:u})}),d.on("videoSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:p})}),d.on("audioSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:p})}),d.on("id3Frame",function(u){l.postMessage({action:"id3Frame",id3Frame:u})}),d.on("caption",function(u){l.postMessage({action:"caption",caption:u})}),d.on("trackinfo",function(u){l.postMessage({action:"trackinfo",trackInfo:u})}),d.on("audioTimingInfo",function(u){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("videoTimingInfo",function(u){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("log",function(u){l.postMessage({action:"log",log:u})})};class Zd{constructor(d,u){this.options=u||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new g_.Transmuxer(this.options),wv(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new av,this.captionParser.init());const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.captionParser.parse(u,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:p&&p.captions||[],logs:p&&p.logs||[],data:u.buffer},[u.buffer])}initMp4WebVttParser(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.webVttParser.init(u)}getMp4WebVttText(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.webVttParser.parseSegment(u);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:p||[],data:u.buffer},[u.buffer])}probeMp4StartTime({timescales:d,data:u}){const p=Rr.startTime(d,u);this.self.postMessage({action:"probeMp4StartTime",startTime:p,data:u},[u.buffer])}probeMp4Tracks({data:d}){const u=Rr.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:u,data:d},[d.buffer])}probeEmsgID3({data:d,offset:u}){const p=Rr.getEmsgID3(d,u);this.self.postMessage({action:"probeEmsgID3",id3Frames:p,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:u}){const p=typeof u=="number"&&!isNaN(u)?u*A.ONE_SECOND_IN_TS:void 0,g=Ev.inspect(d,p);let y=null;g&&(y={hasVideo:g.video&&g.video.length===2||!1,hasAudio:g.audio&&g.audio.length===2||!1},y.hasVideo&&(y.videoStart=g.video[0].ptsTime),y.hasAudio&&(y.audioStart=g.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(u)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const u=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(A.secondsToVideoTs(u)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(A.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new Zd(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new Zd(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var AE=_g(TE);const SE=(s,e,t)=>{const{type:n,initSegment:r,captions:i,captionStreams:a,metadata:o,videoFrameDtsTime:c,videoFramePtsTime:h}=s.data.segment;e.buffer.push({captions:i,captionStreams:a,metadata:o});const m=s.data.segment.boxes||{data:s.data.segment.data},_={type:n,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof c<"u"&&(_.videoFrameDtsTime=c),typeof h<"u"&&(_.videoFramePtsTime=h),t(_)},EE=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},wE=(s,e)=>{e.gopInfo=s.data.gopInfo},Tg=s=>{const{transmuxer:e,bytes:t,audioAppendStart:n,gopsToAlignWith:r,remux:i,onData:a,onTrackInfo:o,onAudioTimingInfo:c,onVideoTimingInfo:h,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:T,onCaptions:S,onDone:w,onEndedTimeline:b,onTransmuxerLog:R,isEndOfTimeline:L,segment:U,triggerSegmentEventFn:M}=s,F={buffer:[]};let N=L;const j=K=>{e.currentTransmux===s&&(K.data.action==="data"&&SE(K,F,a),K.data.action==="trackinfo"&&o(K.data.trackInfo),K.data.action==="gopInfo"&&wE(K,F),K.data.action==="audioTimingInfo"&&c(K.data.audioTimingInfo),K.data.action==="videoTimingInfo"&&h(K.data.videoTimingInfo),K.data.action==="videoSegmentTimingInfo"&&m(K.data.videoSegmentTimingInfo),K.data.action==="audioSegmentTimingInfo"&&_(K.data.audioSegmentTimingInfo),K.data.action==="id3Frame"&&T([K.data.id3Frame],K.data.id3Frame.dispatchType),K.data.action==="caption"&&S(K.data.caption),K.data.action==="endedtimeline"&&(N=!1,b()),K.data.action==="log"&&R(K.data.log),K.data.type==="transmuxed"&&(N||(e.onmessage=null,EE({transmuxedData:F,callback:w}),Ag(e))))},J=()=>{const K={message:"Received an error message from the transmuxer worker",metadata:{errorType:P.Error.StreamingFailedToTransmuxSegment,segmentInfo:rn({segment:U})}};w(null,K)};if(e.onmessage=j,e.onerror=J,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof i<"u"&&e.postMessage({action:"setRemux",remux:i}),t.byteLength){const K=t instanceof ArrayBuffer?t:t.buffer,ne=t instanceof ArrayBuffer?0:t.byteOffset;M({type:"segmenttransmuxingstart",segment:U}),e.postMessage({action:"push",data:K,byteOffset:ne,byteLength:t.byteLength},[K])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Ag=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():Tg(s.currentTransmux))},bh=(s,e)=>{s.postMessage({action:e}),Ag(s)},Sg=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,bh(e,s);return}e.transmuxQueue.push(bh.bind(null,e,s))},kE=s=>{Sg("reset",s)},CE=s=>{Sg("endTimeline",s)},Eg=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,Tg(s);return}s.transmuxer.transmuxQueue.push(s)},IE=s=>{const e=new AE;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:s}),e};var gl={reset:kE,endTimeline:CE,transmux:Eg,createTransmuxer:IE};const Hn=function(s){const e=s.transmuxer,t=s.endAction||s.action,n=s.callback,r=ze({},s,{endAction:null,transmuxer:null,callback:null}),i=a=>{a.data.action===t&&(e.removeEventListener("message",i),a.data.data&&(a.data.data=new Uint8Array(a.data.data,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),n(a.data))};if(e.addEventListener("message",i),s.data){const a=s.data instanceof ArrayBuffer;r.byteOffset=a?0:s.data.byteOffset,r.byteLength=s.data.byteLength;const o=[a?s.data:s.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},rs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},wg="wvtt",Gl=s=>{s.forEach(e=>{e.abort()})},xE=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),LE=s=>{const e=s.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=s.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},ad=(s,e)=>{const{requestType:t}=e,n=pn({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:rs.TIMEOUT,xhr:e,metadata:n}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:rs.ABORTED,xhr:e,metadata:n}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:null},Th=(s,e,t,n)=>(r,i)=>{const a=i.response,o=ad(r,i);if(o)return t(o,s);if(a.byteLength!==16)return t({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:rs.FAILURE,xhr:i},s);const c=new DataView(a),h=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=h;const m={uri:i.uri};return n({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},PE=(s,e)=>{e===wg&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},RE=(s,e,t)=>{e===wg&&Hn({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:n,mp4VttCues:r})=>{s.bytes=n,t(null,s,{mp4VttCues:r})}})},kg=(s,e)=>{const t=kc(s.map.bytes);if(t!=="mp4"){const n=s.map.resolvedUri||s.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${n}`,code:rs.FAILURE,metadata:{mediaType:r}})}Hn({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:n,data:r})=>(s.map.bytes=r,n.forEach(function(i){s.map.tracks=s.map.tracks||{},!s.map.tracks[i.type]&&(s.map.tracks[i.type]=i,typeof i.id=="number"&&i.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[i.id]=i.timescale),i.type==="text"&&PE(s,i.codec))}),e(null))})},DE=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(n,r)=>{const i=ad(n,r);if(i)return e(i,s);const a=new Uint8Array(r.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,kg(s,function(o){if(o)return o.xhr=r,o.status=r.status,e(o,s);e(null,s)})},NE=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:n})=>(r,i)=>{const a=ad(r,i);if(a)return e(a,s);n({type:"segmentloaded",segment:s});const o=t==="arraybuffer"||!i.responseText?i.response:vE(i.responseText.substring(s.lastReachedChar||0));return s.stats=xE(i),s.key?s.encryptedBytes=new Uint8Array(o):s.bytes=new Uint8Array(o),e(null,s)},OE=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{const w=s.map&&s.map.tracks||{},b=!!(w.audio&&w.video);let R=n.bind(null,s,"audio","start");const L=n.bind(null,s,"audio","end");let U=n.bind(null,s,"video","start");const M=n.bind(null,s,"video","end"),F=()=>Eg({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:b,onData:N=>{N.type=N.type==="combined"?"video":N.type,m(s,N)},onTrackInfo:N=>{t&&(b&&(N.isMuxed=!0),t(s,N))},onAudioTimingInfo:N=>{R&&typeof N.start<"u"&&(R(N.start),R=null),L&&typeof N.end<"u"&&L(N.end)},onVideoTimingInfo:N=>{U&&typeof N.start<"u"&&(U(N.start),U=null),M&&typeof N.end<"u"&&M(N.end)},onVideoSegmentTimingInfo:N=>{const j={pts:{start:N.start.presentation,end:N.end.presentation},dts:{start:N.start.decode,end:N.end.decode}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(N)},onAudioSegmentTimingInfo:N=>{const j={pts:{start:N.start.pts,end:N.end.pts},dts:{start:N.start.dts,end:N.end.dts}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),i(N)},onId3:(N,j)=>{a(s,N,j)},onCaptions:N=>{o(s,[N])},isEndOfTimeline:c,onEndedTimeline:()=>{h()},onTransmuxerLog:T,onDone:(N,j)=>{_&&(N.type=N.type==="combined"?"video":N.type,S({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,N))},segment:s,triggerSegmentEventFn:S});Hn({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:N=>{s.bytes=e=N.data;const j=N.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:b}),t=null),F()}})},Cg=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=new Uint8Array(e);if(nA(w)){s.isFmp4=!0;const{tracks:b}=s.map;if(b.text&&(!b.audio||!b.video)){m(s,{data:w,type:"text"}),RE(s,b.text.codec,_);return}const R={isFmp4:!0,hasVideo:!!b.video,hasAudio:!!b.audio};b.audio&&b.audio.codec&&b.audio.codec!=="enca"&&(R.audioCodec=b.audio.codec),b.video&&b.video.codec&&b.video.codec!=="encv"&&(R.videoCodec=b.video.codec),b.video&&b.audio&&(R.isMuxed=!0),t(s,R);const L=(U,M)=>{m(s,{data:w,type:R.hasAudio&&!R.isMuxed?"audio":"video"}),M&&M.length&&a(s,M),U&&U.length&&o(s,U),_(null,s,{})};Hn({action:"probeMp4StartTime",timescales:s.map.timescales,data:w,transmuxer:s.transmuxer,callback:({data:U,startTime:M})=>{e=U.buffer,s.bytes=w=U,R.hasAudio&&!R.isMuxed&&n(s,"audio","start",M),R.hasVideo&&n(s,"video","start",M),Hn({action:"probeEmsgID3",data:w,transmuxer:s.transmuxer,offset:M,callback:({emsgData:F,id3Frames:N})=>{if(e=F.buffer,s.bytes=w=F,!b.video||!F.byteLength||!s.transmuxer){L(void 0,N);return}Hn({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:w,timescales:s.map.timescales,trackIds:[b.video.id],callback:j=>{e=j.data.buffer,s.bytes=w=j.data,j.logs.forEach(function(J){T(ve(J,{stream:"mp4CaptionParser"}))}),L(j.captions,N)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=kc(w)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}OE({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})},Ig=function({id:s,key:e,encryptedBytes:t,decryptionWorker:n,segment:r,doneFn:i},a){const o=h=>{if(h.data.source===s){n.removeEventListener("message",o);const m=h.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};n.onerror=()=>{const h="An error occurred in the decryption worker",m=rn({segment:r}),_={message:h,metadata:{error:new Error(h),errorType:P.Error.StreamingFailedToDecryptSegment,segmentInfo:m,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};i(_,r)},n.addEventListener("message",o);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(hg({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},ME=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{S({type:"segmentdecryptionstart"}),Ig({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},w=>{e.bytes=w,S({type:"segmentdecryptioncomplete",segment:e}),Cg({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})})},UE=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=0,b=!1;return(R,L)=>{if(!b){if(R)return b=!0,Gl(s),_(R,L);if(w+=1,w===s.length){const U=function(){if(L.encryptedBytes)return ME({decryptionWorker:e,segment:L,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S});Cg({segment:L,bytes:L.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})};if(L.endOfAllRequests=Date.now(),L.map&&L.map.encryptedBytes&&!L.map.bytes)return S({type:"segmentdecryptionstart",segment:L}),Ig({decryptionWorker:e,id:L.requestId+"-init",encryptedBytes:L.map.encryptedBytes,key:L.map.key,segment:L,doneFn:_},M=>{L.map.bytes=M,S({type:"segmentdecryptioncomplete",segment:L}),kg(L,F=>{if(F)return Gl(s),_(F,L);U()})});U()}}}},BE=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},FE=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m})=>_=>{if(!_.target.aborted)return s.stats=ve(s.stats,LE(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},jE=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:n,abortFn:r,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L})=>{const U=[],M=UE({activeXhrs:U,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L});if(n.key&&!n.key.bytes){const K=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&K.push(n.map.key);const ne=ve(e,{uri:n.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),he=Th(n,K,M,L),oe={uri:n.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:oe});const me=s(ne,he);U.push(me)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const oe=ve(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),me=Th(n,[n.map.key],M,L),te={uri:n.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:te});const ue=s(oe,me);U.push(ue)}const K=ve(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Wl(n.map),requestType:"segment-media-initialization"}),ne=DE({segment:n,finishProcessingFn:M,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const he=s(K,ne);U.push(he)}const F=ve(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Wl(n),requestType:"segment"}),N=NE({segment:n,finishProcessingFn:M,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const j=s(F,N);j.addEventListener("progress",FE({segment:n,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w})),U.push(j);const J={};return U.forEach(K=>{K.addEventListener("loadend",BE({loadendState:J,abortFn:r}))}),()=>Gl(U)},qE=jt("CodecUtils"),VE=function(s){const e=s.attributes||{};if(e.CODECS)return Zt(e.CODECS)},xg=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},$E=(s,e)=>{if(!xg(s,e))return!0;const t=e.attributes||{},n=s.mediaGroups.AUDIO[t.AUDIO];for(const r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1},za=function(s){const e={};return s.forEach(({mediaType:t,type:n,details:r})=>{e[t]=e[t]||[],e[t].push(Np(`${n}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){qE(`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},Ah=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},ii=function(s,e){const t=e.attributes||{},n=za(VE(e)||[]);if(xg(s,e)&&!n.audio&&!$E(s,e)){const r=za(iT(s,t.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},aa=jt("PlaylistSelector"),Sh=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},Ga=function(s,e){if(!s)return"";const t=I.getComputedStyle(s);return t?t[e]:""},Wn=function(s,e){const t=s.slice();s.sort(function(n,r){const i=e(n,r);return i===0?t.indexOf(n)-t.indexOf(r):i})},od=function(s,e){let t,n;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||I.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||I.Number.MAX_VALUE,t-n},HE=function(s,e){let t,n;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||I.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||I.Number.MAX_VALUE,t===n&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-n};let Lg=function(s,e,t,n,r,i){if(!s)return;const a={bandwidth:e,width:t,height:n,limitRenditionByPlayerDimensions:r};let o=s.playlists;Et.isAudioOnly(s)&&(o=i.getAudioTrackPlaylists_(),a.audioOnly=!0);let c=o.map(N=>{let j;const J=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.width,K=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.height;return j=N.attributes&&N.attributes.BANDWIDTH,j=j||I.Number.MAX_VALUE,{bandwidth:j,width:J,height:K,playlist:N}});Wn(c,(N,j)=>N.bandwidth-j.bandwidth),c=c.filter(N=>!Et.isIncompatible(N.playlist));let h=c.filter(N=>Et.isEnabled(N.playlist));h.length||(h=c.filter(N=>!Et.isDisabled(N.playlist)));const m=h.filter(N=>N.bandwidth*Ze.BANDWIDTH_VARIANCE<e);let _=m[m.length-1];const T=m.filter(N=>N.bandwidth===_.bandwidth)[0];if(r===!1){const N=T||h[0]||c[0];if(N&&N.playlist){let j="sortedPlaylistReps";return T&&(j="bandwidthBestRep"),h[0]&&(j="enabledPlaylistReps"),aa(`choosing ${Sh(N)} using ${j} with options`,a),N.playlist}return aa("could not choose a playlist with options",a),null}const S=m.filter(N=>N.width&&N.height);Wn(S,(N,j)=>N.width-j.width);const w=S.filter(N=>N.width===t&&N.height===n);_=w[w.length-1];const b=w.filter(N=>N.bandwidth===_.bandwidth)[0];let R,L,U;b||(R=S.filter(N=>N.width>t||N.height>n),L=R.filter(N=>N.width===R[0].width&&N.height===R[0].height),_=L[L.length-1],U=L.filter(N=>N.bandwidth===_.bandwidth)[0]);let M;if(i.leastPixelDiffSelector){const N=S.map(j=>(j.pixelDiff=Math.abs(j.width-t)+Math.abs(j.height-n),j));Wn(N,(j,J)=>j.pixelDiff===J.pixelDiff?J.bandwidth-j.bandwidth:j.pixelDiff-J.pixelDiff),M=N[0]}const F=M||U||b||T||h[0]||c[0];if(F&&F.playlist){let N="sortedPlaylistReps";return M?N="leastPixelDiffRep":U?N="resolutionPlusOneRep":b?N="resolutionBestRep":T?N="bandwidthBestRep":h[0]&&(N="enabledPlaylistReps"),aa(`choosing ${Sh(F)} using ${N} with options`,a),F.playlist}return aa("could not choose a playlist with options",a),null};const Eh=function(){let s=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),Lg(this.playlists.main,this.systemBandwidth,parseInt(Ga(this.tech_.el(),"width"),10)*s,parseInt(Ga(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)},WE=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let n=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),Lg(this.playlists.main,e,parseInt(Ga(this.tech_.el(),"width"),10)*n,parseInt(Ga(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},zE=function(s){const{main:e,currentTime:t,bandwidth:n,duration:r,segmentDuration:i,timeUntilRebuffer:a,currentTimeline:o,syncController:c}=s,h=e.playlists.filter(S=>!Et.isIncompatible(S));let m=h.filter(Et.isEnabled);m.length||(m=h.filter(S=>!Et.isDisabled(S)));const _=m.filter(Et.hasAttribute.bind(null,"BANDWIDTH")).map(S=>{const w=c.getSyncPoint(S,r,o,t)?1:2,b=Et.estimateSegmentRequestTime(i,n,S)*w-a;return{playlist:S,rebufferingImpact:b}}),T=_.filter(S=>S.rebufferingImpact<=0);return Wn(T,(S,w)=>od(w.playlist,S.playlist)),T.length?T[0]:(Wn(_,(S,w)=>S.rebufferingImpact-w.rebufferingImpact),_[0]||null)},GE=function(){const s=this.playlists.main.playlists.filter(Et.isEnabled);return Wn(s,(e,t)=>od(e,t)),s.filter(e=>!!ii(this.playlists.main,e).video)[0]||null},XE=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(n=>{t.set(n,e),e+=n.byteLength})),t};function Pg(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const YE=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let n=t;/^cc708_/.test(t)&&(n="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(n);if(r)s[t]=r;else{const i=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,c=!1;const h=i[n];h&&(a=h.label,o=h.language,c=h.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:n,default:c,label:a,language:o},!1).track}}},KE=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{const i=r.stream;r.content?r.content.forEach(a=>{const o=new n(r.startTime+t,r.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",s[i].addCue(o)}):s[i].addCue(new n(r.startTime+t,r.endTime+t,r.text))})},QE=function(s){Object.defineProperties(s.frame,{id:{get(){return P.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return P.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return P.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},ZE=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:n})=>{if(!e)return;const r=I.WebKitDataCue||I.VTTCue,i=s.metadataTrack_;if(!i||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||I.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(T=>{const S=new r(_,_,T.value||T.url||T.data||"");S.frame=T,S.value=T,QE(S),i.addCue(S)})}),!i.cues||!i.cues.length))return;const a=i.cues,o=[];for(let m=0;m<a.length;m++)a[m]&&o.push(a[m]);const c=o.reduce((m,_)=>{const T=m[_.startTime]||[];return T.push(_),m[_.startTime]=T,m},{}),h=Object.keys(c).sort((m,_)=>Number(m)-Number(_));h.forEach((m,_)=>{const T=c[m],S=isFinite(n)?n:m,w=Number(h[_+1])||S;T.forEach(b=>{b.endTime=w})})},JE={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"},ew=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),tw=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{for(const i of Object.keys(r)){if(ew.has(i))continue;const a=new n(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:JE[i],data:r[i]},(i==="scte35Out"||i==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},wh=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,P.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Gr=function(s,e,t){let n,r;if(t&&t.cues)for(n=t.cues.length;n--;)r=t.cues[n],r.startTime>=s&&r.endTime<=e&&t.removeCue(r)},sw=function(s){const e=s.cues;if(!e)return;const t={};for(let n=e.length-1;n>=0;n--){const r=e[n],i=`${r.startTime}-${r.endTime}-${r.text}`;t[i]?s.removeCue(r):t[i]=r}},nw=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const n=Math.ceil((e-t+3)*on.ONE_SECOND_IN_TS);let r;for(r=0;r<s.length&&!(s[r].pts>n);r++);return s.slice(r)},rw=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const n=e[0].pts;let r=0;for(r;r<s.length&&!(s[r].pts>=n);r++);return s.slice(0,r).concat(e)},iw=(s,e,t,n)=>{const r=Math.ceil((e-n)*on.ONE_SECOND_IN_TS),i=Math.ceil((t-n)*on.ONE_SECOND_IN_TS),a=s.slice();let o=s.length;for(;o--&&!(s[o].pts<=i););if(o===-1)return a;let c=o+1;for(;c--&&!(s[c].pts<=r););return c=Math.max(c,0),a.splice(c,o-c+1),a},aw=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),n=Object.keys(e).sort();if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const i=t[r];if(i!==n[r]||s[i]!==e[i])return!1}return!0},ow=function(s,e,t){e=e||[];const n=[];let r=0;for(let i=0;i<e.length;i++){const a=e[i];if(s===a.timeline&&(n.push(i),r+=a.duration,r>t))return i}return n.length===0?0:n[n.length-1]},qr=1,lw=500,kh=s=>typeof s=="number"&&isFinite(s),oa=1/60,cw=(s,e,t)=>s!=="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,dw=(s,e,t)=>{let n=e-Ze.BACK_BUFFER_LENGTH;s.length&&(n=Math.max(n,s.start(0)));const r=e-t;return Math.min(r,n)},Rn=s=>{const{startOfSegment:e,duration:t,segment:n,part:r,playlist:{mediaSequence:i,id:a,segments:o=[]},mediaIndex:c,partIndex:h,timeline:m}=s,_=o.length-1;let T="mediaIndex/partIndex increment";s.getMediaInfoForTime?T=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(T="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(T+=` with independent ${s.independent}`);const S=typeof h=="number",w=s.segment.uri?"segment":"pre-segment",b=S?Kf({preloadSegment:n})-1:0;return`${w} [${i+c}/${i+_}]`+(S?` part [${h}/${b}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(S?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${m}] selected by [${T}] playlist [${a}]`},Ch=s=>`${s}TimingInfo`,uw=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:n,overrideCheck:r})=>!r&&s===e?null:s<e?t:n.length?n.end(n.length-1):t,Xl=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:n,audioDisabled:r})=>{if(e===t)return!1;if(n==="audio"){const i=s.lastTimelineChange({type:"main"});return!i||i.to!==t}if(n==="main"&&r){const i=s.pendingTimelineChange({type:"audio"});return!(i&&i.to===t)}return!1},hw=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),n=e&&t,r=n&&e.to!==t.to;return!!(n&&e.from!==-1&&t.from!==-1&&r)},pw=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Us=s=>{const e=s.pendingSegment_;if(e&&Xl({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&hw(s.timelineChangeController_)){if(pw(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},mw=s=>{let e=0;return["video","audio"].forEach(function(t){const n=s[`${t}TimingInfo`];if(!n)return;const{start:r,end:i}=n;let a;typeof r=="bigint"||typeof i=="bigint"?a=I.BigInt(i)-I.BigInt(r):typeof r=="number"&&typeof i=="number"&&(a=i-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},Ih=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+ss:!1,fw=(s,e)=>{if(e!=="hls")return null;const t=mw({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const n=s.playlist.targetDuration,r=Ih({segmentDuration:t,maxDuration:n*2}),i=Ih({segmentDuration:t,maxDuration:n}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${n}. 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 r||i?{severity:r?"warn":"info",message:a}:null},rn=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),n=!!(e.map&&!e.map.bytes),r=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:r,duration:e.duration,isEncrypted:t,isMediaInitialization:n}};class Yl extends P.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(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.sourceUpdater_.on("codecschange",n=>{this.trigger(ze({type:"codecschange"},n))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",n=>{this.trigger(ze({type:"timelinechange"},n)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Us(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return gl.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_&&I.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,I.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_&&gl.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ct();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:n,isMuxed:r}=e;if(n&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const n=Wa(e);let r=this.initSegments_[n];return t&&!r&&e.bytes&&(this.initSegments_[n]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,t=!1){if(!e)return null;const n=pg(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const i={resolvedUri:(r||e).resolvedUri};return r&&(i.bytes=r.bytes),i}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 n=this.playlist_,r=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 i=null;if(n&&(n.id?i=n.id:n.uri&&(i=n.uri)),this.logger_(`playlist update [${i} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
206
|
+
`)+(h.boxes?`
|
|
207
|
+
`+co(h.boxes,c+1):"")}).join(`
|
|
208
|
+
`)};var Yu={inspect:Je,textify:co,parseType:dn,findBox:by,parseTraf:Ci.traf,parseTfdt:Ci.tfdt,parseHdlr:Ci.hdlr,parseTfhd:Ci.tfhd,parseTrun:Ci.trun,parseSidx:Ci.sidx},Ty=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},Sy={uint8ToCString:Ty},Cs=Sy.uint8ToCString,Ey=s.getUint64,wy=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=Ey(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 Cy(d,Q)?Q:void 0},ky=function(o,c,d,h){return o||o===0?o/c:h+d/c},Cy=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},Iy={parseEmsgBox:wy,scaleTime:ky},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,Fe=ks,cr=oo,ho=Iy,Ay=uo,xy=Xu,Ly=lo,Dy=s.getUint64,Zu,ec,tc,ic,rc,po,nc,go=Ju,Py=Pu.parseId3Frames;Zu=function(o){var c={},d=Fe(o,["moov","trak"]);return d.reduce(function(h,f){var y,E,k,I,A;return y=Fe(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=Fe(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=Fe(c,["moof","traf"]);var h=d.reduce(function(f,y){var E=Fe(y,["tfhd"])[0],k=Is(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),I=o[k]||9e4,A=Fe(y,["tfdt"])[0],R=new DataView(A.buffer,A.byteOffset,A.byteLength),q;A[0]===1?q=Dy(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=Fe(c,["moof","traf"]),h=0,f=0,y;if(d&&d.length){var E=Fe(d[0],["tfhd"])[0],k=Fe(d[0],["trun"])[0],I=Fe(d[0],["tfdt"])[0];if(E){var A=Ay(E);y=A.trackId}if(I){var R=Ly(I);h=R.baseMediaDecodeTime}if(k){var q=xy(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=Fe(o,["moov","trak"]),d=[];return c.forEach(function(h){var f=Fe(h,["mdia","hdlr"]),y=Fe(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=Fe(o,["moov","trak"]),d=[];return c.forEach(function(h){var f={},y=Fe(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=Fe(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=Fe(h,["mdia","minf","stbl","stsd"])[0];if(R){var q=R.subarray(8);f.codec=cr(q.subarray(4,8));var Q=Fe(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=Fe(h,["mdia","mdhd"])[0];ae&&(f.timescale=po(ae)),d.push(f)}),d},nc=function(o,c=0){var d=Fe(o,["emsg"]);return d.map(h=>{var f=ho.parseEmsgBox(new Uint8Array(h)),y=Py(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:Fe,parseType:cr,timescale:Zu,startTime:ec,compositionStartTime:tc,videoTrackIds:ic,tracks:rc,getTimescaleFromMediaHeader:po,getEmsgID3:nc};const{parseTrun:Ry}=Yu,{findBox:sc}=gn;var ac=Ju,Ny=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},Oy=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=Ry(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:Ny,parseSamples:Oy},Uy=Iu.discardEmulationPreventionBytes,My=Au.CaptionStream,mo=ks,By=lo,Fy=uo,{getMdatTrafPairs:jy,parseSamples:qy}=oc,$y=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},Vy=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=$y(E,c);if(y={nalUnitType:"sei_rbsp",size:k,data:A,escapedRBSP:Uy(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},Hy=function(o,c){var d={},h=jy(o);return h.forEach(function(f){var y=f.mdat,E=f.traf,k=mo(E,["tfhd"]),I=Fy(k[0]),A=I.trackId,R=mo(E,["tfdt"]),q=R.length>0?By(R[0]).baseMediaDecodeTime:0,Q=mo(E,["trun"]),z,te;c===A&&Q.length>0&&(z=qy(Q,q,I),te=Vy(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},zy=function(o,c,d){var h;if(c===null)return null;h=Hy(o,c);var f=h[c]||{};return{seiNals:f.seiNals,logs:f.logs,timescale:d}},Wy=function(){var o=!1,c,d,h,f,y,E;this.isInitialized=function(){return o},this.init=function(k){c=new My,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=zy(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()},Gy=Wy;const{parseTfdt:Xy}=Yu,Ii=ks,{getTimescaleFromMediaHeader:Ky}=gn,{parseSamples:Yy,getMdatTrafPairs:Qy}=oc;var lc=function(){let o=9e4;this.init=function(c){const d=Ii(c,["moov","trak","mdia","mdhd"])[0];d&&(o=Ky(d))},this.parseSegment=function(c){const d=[],h=Qy(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=Xy(I).baseMediaDecodeTime),R.length&&A){const q=Yy(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},Jy=function(o,c){var d=uc(o);return d===0?"pat":d===c?"pmt":c?"pes":null},Zy=function(o){var c=As(o),d=4+xs(o);return c&&(d+=o[d]+1),(o[d+10]&31)<<8|o[d+11]},e_=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}},t_=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}},i_=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}},r_=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},n_={parseType:Jy,parsePat:Zy,parsePmt:e_,parsePayloadUnitStartIndicator:As,parsePesType:t_,parsePesTime:i_,videoPacketContainsKeyFrame:r_},cc=ds,dr=Lu.handleRollover,ye={};ye.ts=n_,ye.aac=ro;var Hi=T.ONE_SECOND_IN_TS,nt=188,Wt=71,s_=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--}},a_=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--}},o_=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}}},l_=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},u_=function(o){var c={pid:null,table:null},d={};s_(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=[],a_(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},c_=function(o,c){var d=ye.aac.isLikelyAacData(o),h;return d?h=l_(o):h=u_(o),!h||!h.audio&&!h.video?null:(o_(h,c),h)},d_={inspect:c_,parseAudioPes_:dc};const h_=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 ry.Transmuxer(this.options),h_(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new Gy,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=d_.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 VE=xm($E);const HE=(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)},zE=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},WE=(i,e)=>{e.gopInfo=i.data.gopInfo},Pm=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"&&HE(Y,F,a),Y.data.action==="trackinfo"&&l(Y.data.trackInfo),Y.data.action==="gopInfo"&&WE(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,zE({transmuxedData:F,callback:C}),Rm(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,re=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:O}),e.postMessage({action:"push",data:Y,byteOffset:re,byteLength:t.byteLength},[Y])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Rm=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():Pm(i.currentTransmux))},Yd=(i,e)=>{i.postMessage({action:e}),Rm(i)},Nm=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Yd(e,i);return}e.transmuxQueue.push(Yd.bind(null,e,i))},GE=i=>{Nm("reset",i)},XE=i=>{Nm("endTimeline",i)},Om=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,Pm(i);return}i.transmuxer.transmuxQueue.push(i)},KE=i=>{const e=new VE;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:GE,endTimeline:XE,transmux:Om,createTransmuxer:KE};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},Um="wvtt",gl=i=>{i.forEach(e=>{e.abort()})},YE=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),QE=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)},JE=(i,e)=>{e===Um&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},ZE=(i,e,t)=>{e===Um&&xr({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:r,mp4VttCues:n})=>{i.bytes=r,t(null,i,{mp4VttCues:n})}})},Mm=(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"&&JE(i,s.codec))}),e(null))})},ew=({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,Mm(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=wu(n,s);if(a)return e(a,i);r({type:"segmentloaded",segment:i});const l=t==="arraybuffer"||!s.responseText?s.response:jE(s.responseText.substring(i.lastReachedChar||0));return i.stats=YE(s),i.key?i.encryptedBytes=new Uint8Array(l):i.bytes=new Uint8Array(l),e(null,i)},iw=({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=()=>Om({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()}})},Bm=({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(w1(C)){i.isFmp4=!0;const{tracks:v}=i.map;if(v.text&&(!v.audio||!v.video)){g(i,{data:C,type:"text"}),ZE(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}iw({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})},Fm=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(Em({source:i,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},rw=({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"}),Fm({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:b},C=>{e.bytes=C,w({type:"segmentdecryptioncomplete",segment:e}),Bm({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})})},nw=({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 rw({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});Bm({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}),Fm({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}),Mm(L,F=>{if(F)return gl(i),b(F,L);O()})});O()}}}},sw=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},aw=({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,QE(b)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(b,i)},ow=({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=nw({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 re=fe(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),he=Qd(r,Y,U,L),le={uri:r.key.resolvedUri};L({type:"segmentkeyloadstart",segment:r,keyInfo:le});const pe=i(re,he);O.push(pe)}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"}),pe=Qd(r,[r.map.key],U,L),ee={uri:r.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:r,keyInfo:ee});const ce=i(le,pe);O.push(ce)}const Y=fe(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:hl(r.map),requestType:"segment-media-initialization"}),re=ew({segment:r,finishProcessingFn:U,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:r});const he=i(Y,re);O.push(he)}const F=fe(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:hl(r),requestType:"segment"}),N=tw({segment:r,finishProcessingFn:U,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:r});const V=i(F,N);V.addEventListener("progress",aw({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",sw({loadendState:J,abortFn:n}))}),()=>gl(O)},lw=Nt("CodecUtils"),uw=function(i){const e=i.attributes||{};if(e.CODECS)return Kt(e.CODECS)},jm=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},cw=(i,e)=>{if(!jm(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(Sp(`${r}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){lw(`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(uw(e)||[]);if(jm(i,e)&&!r.audio&&!cw(i,e)){const n=fa(eT(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},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 qm=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),qm(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_)},hw=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),qm(this.playlists.main,e,parseInt(ya(this.tech_.el(),"width"),10)*r,parseInt(ya(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},pw=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)},gw=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},mw=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 $m(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const fw=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}}},yw=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))})},_w=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}}})},bw=({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,_w(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})})},vw={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"},Tw=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Sw=({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(Tw.has(s))continue;const a=new r(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:vw[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)},Ew=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}},ww=(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)},kw=(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)},Cw=(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},Iw=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},Aw=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,xw=500,ih=i=>typeof i=="number"&&isFinite(i),Fs=1/60,Lw=(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,Dw=(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?om({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`,Pw=({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},Rw=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)},Nw=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_})&&Rw(i.timelineChangeController_)){if(Nw(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},Ow=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,Uw=(i,e)=>{if(e!=="hls")return null;const t=Ow({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=wm(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(!
|
|
212
|
-
For TargetTime: ${
|
|
210
|
+
bufferedEnd: ${Bo(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_&&jo.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_=Cw(this.gopBuffer_,e,t,this.timeMapping_),s++,this.sourceUpdater_.removeVideo(e,t,a));for(const l in this.inbandTextTracks_)xn(e,t,this.inbandTextTracks_[l]);xn(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),xw)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Ki({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=Bo(e)||0,r=vu(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=Aw(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
|
+
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 R=this.getSyncInfoFromMediaSequenceSync_(b);if(!R){const L="No sync info found while using media sequence sync";return this.error({message:L,metadata:{errorType:P.Error.StreamingFailedToSelectNextSegment,error:new Error(L)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${R.start} --> ${R.end})`),T=R.segmentIndex,S=R.partIndex,w=R.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const R=Et.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:b,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});T=R.segmentIndex,S=R.partIndex,w=R.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${b}`:`currentTime ${b}`,o.mediaIndex=T,o.startOfSegment=w,o.partIndex=S,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const c=a[o.mediaIndex];let h=c&&typeof o.partIndex=="number"&&c.parts&&c.parts[o.partIndex];if(!c||typeof o.partIndex=="number"&&!h)return null;typeof o.partIndex!="number"&&c.parts&&(o.partIndex=0,h=c.parts[0]);const m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&h&&!m&&!h.independent)if(o.partIndex===0){const T=a[o.mediaIndex-1],S=T.parts&&T.parts.length&&T.parts[T.parts.length-1];S&&S.independent&&(o.mediaIndex-=1,o.partIndex=T.parts.length-1,o.independent="previous segment")}else c.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}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 n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;const r=this.mediaSequenceSync_.getSyncInfoForTime(n.end);return r?(r.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),r):null}generateSegmentInfo_(e){const{independent:t,playlist:n,mediaIndex:r,startOfSegment:i,isSyncRequest:a,partIndex:o,forceTimestampOffset:c,getMediaInfoForTime:h}=e,m=n.segments[r],_=typeof o=="number"&&m.parts[o],T={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:_?o:null,isSyncRequest:a,startOfSegment:i,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:h,independent:t},S=typeof c<"u"?c:this.isPendingTimestampOffset_;T.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:i,buffered:this.buffered_(),overrideCheck:S});const w=ml(this.sourceUpdater_.audioBuffered());return typeof w=="number"&&(T.audioAppendStart=w-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(T.gopsToAlignWith=nw(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),T}timestampOffsetForSegment_(e){return uw(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_(),n=e.bandwidth,r=this.pendingSegment_.duration,i=Et.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),a=RS(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(i<=a)return;const o=zE({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=i-a-o.rebufferingImpact;let h=.5;a<=ss&&(h=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c<h)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*Ze.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Rn(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:n,hasVideo:r}=t,i={segmentInfo:rn({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:n,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:i}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},aw(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_():Us(this))))}handleTimingInfo_(e,t,n,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const i=this.pendingSegment_,a=Ch(t);i[a]=i[a]||{},i[a][n]=r,this.logger_(`timinginfo: ${t} - ${n} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(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 n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(i=>{r[i.stream]=r[i.stream]||{startTime:1/0,captions:[],endTime:0};const a=r[i.stream];a.startTime=Math.min(a.startTime,i.startTime+n),a.endTime=Math.max(a.endTime,i.endTime+n),a.captions.push(i)}),Object.keys(r).forEach(i=>{const{startTime:a,endTime:o,captions:c}=r[i],h=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${o} for ${i}`),YE(h,this.vhs_.tech_,i),Gr(a,o,h[i]),KE({captionArray:c,inbandTextTracks:h,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n));return}this.addMetadataToTextTrack(n,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_()?!Xl({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:n,hasVideo:r,isMuxed:i}=t;return!(r&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!i&&!e.audioTimingInfo||Xl({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_()){Us(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Ch(t.type)].start;else{const r=this.getCurrentMediaInfo_(),i=this.loaderType_==="main"&&r&&r.hasVideo;let a;i&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:i,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,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:n,playlist:r}){if(n){const i=Wa(n);if(this.activeInitSegmentId_===i)return null;t=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=i}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n},r){const i=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();i.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ln(i).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ln(a).join(", "));const o=i.length?i.start(0):0,c=i.length?i.end(i.length-1):0,h=a.length?a.start(0):0,m=a.length?a.end(a.length-1):0;if(c-o<=qr&&m-h<=qr){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${ln(i).join(", ")}, video buffer: ${ln(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:n}));const _=this.currentTime_()-qr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${qr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=I.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},qr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:n},r){if(r){if(r.code===og){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:P.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:n,data:r,bytes:i}){if(!i){const o=[r];let c=r.byteLength;n&&(o.unshift(n),c+=n.byteLength),i=XE({bytes:c,segments:o})}const a={segmentInfo:rn({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:i},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:i}))}handleSegmentTimingInfo_(e,t,n){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,i=`${e}TimingInfo`;r[i]||(r[i]={}),r[i].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[i].transmuxedPresentationStart=n.start.presentation,r[i].transmuxedDecodeStart=n.start.decode,r[i].transmuxedPresentationEnd=n.end.presentation,r[i].transmuxedDecodeEnd=n.end.decode,r[i].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,t){const{type:n,data:r}=t;if(!r||!r.byteLength||n==="audio"&&this.audioDisabled_)return;const i=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:i,data:r})}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_()){Us(this),this.loadQueue_.push(()=>{const t=ze({},e,{forceTimestampOffset:!0});ze(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),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,i=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||r&&i;this.logger_(`Requesting
|
|
217
|
-
${
|
|
218
|
-
${Rn(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=jE({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:o,level:c,stream:h})=>{this.logger_(`${Rn(e)} logged from transmuxer stream ${h} as a ${c}: ${o}`)},triggerSegmentEventFn:({type:o,segment:c,keyInfo:h,trackInfo:m,timingInfo:_})=>{const T={segmentInfo:rn({segment:c})};h&&(T.keyInfo=h),m&&(T.trackInfo=m),_&&(T.timingInfo=_),this.trigger({type:o,metadata:T})}})}trimBackBuffer_(e){const t=dw(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,n=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,i=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.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:r,isMediaInitialization:i},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}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<oa){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${oa}`);return}const n={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:n}),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,n){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));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===rs.ABORTED)return;if(this.pause(),e.code===rs.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),r.endOfAllRequests=t.endOfAllRequests,n.gopInfo&&(this.gopBuffer_=rw(this.gopBuffer_,n.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(r)}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:n,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:i,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:c}){if(typeof e<"u")return e;if(!a)return c.start;const h=t.segments[n-1];return n===0||!h||typeof h.start>"u"||h.end!==r+i?r:o.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:n,hasVideo:r,isMuxed:i}=t,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&n&&!i;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++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&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=cw(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:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const o={segmentInfo:rn({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:o})}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=fw(e,this.sourceType_);if(t&&(t.severity==="warn"?P.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 ${Rn(e)}`);return}this.logger_(`Appended ${Rn(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 n=e.segment,r=e.part,i=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(i||a){this.logger_(`bad ${i?"segment":"part"} ${Rn(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<oa){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${oa}`);return}const t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,n=t.start,r=t.end;if(!kh(n)||!kh(r))return;Gr(n,r,this.segmentMetadataTrack_);const i=I.WebKitDataCue||I.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:n,end:r},o=JSON.stringify(a),c=new i(n,r,o);c.value=a,this.segmentMetadataTrack_.addCue(c)}}function vs(){}const Rg=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},gw=["video","audio"],Kl=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},yw=(s,e)=>{for(let t=0;t<e.length;t++){const n=e[t];if(n.type==="mediaSource")return null;if(n.type===s)return t}return null},zn=(s,e)=>{if(e.queue.length===0)return;let t=0,n=e.queue[t];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),zn("audio",e),zn("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Kl(s,e))){if(n.type!==s){if(t=yw(s,e.queue),t===null)return;n=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=n,n.action(s,e),!n.doneFn){e.queuePending[s]=null,zn(s,e);return}}},Dg=(s,e)=>{const t=e[`${s}Buffer`],n=Rg(s);t&&(t.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),t.removeEventListener("error",e[`on${n}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Jt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Ct={appendBuffer:(s,e,t)=>(n,r)=>{const i=r[`${n}Buffer`];if(Jt(r.mediaSource,i)){r.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${n}Buffer`);try{i.appendBuffer(s)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===og?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,t(a)}}},remove:(s,e)=>(t,n)=>{const r=n[`${t}Buffer`];if(Jt(n.mediaSource,r)){n.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{r.remove(s,e)}catch{n.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const n=t[`${e}Buffer`];Jt(t.mediaSource,n)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),n.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){P.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){P.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Jt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(n){P.log.warn(`Failed to abort on ${s}Buffer`,n)}}},addSourceBuffer:(s,e)=>t=>{const n=Rg(s),r=Xn(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const i=t.mediaSource.addSourceBuffer(r);i.addEventListener("updateend",t[`on${n}UpdateEnd_`]),i.addEventListener("error",t[`on${n}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=i},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(Dg(s,e),!!Jt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(n){P.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,n)}}},changeType:s=>(e,t)=>{const n=t[`${e}Buffer`],r=Xn(s);if(!Jt(t.mediaSource,n))return;const i=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===i)return;const o={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:o}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{n.changeType(r),t.codecs[e]=s}catch(c){o.errorType=P.Error.StreamingCodecsChangeError,o.error=c,c.metadata=o,t.error_=c,t.trigger("error"),P.log.warn(`Failed to changeType on ${e}Buffer`,c)}}},It=({type:s,sourceUpdater:e,action:t,doneFn:n,name:r})=>{e.queue.push({type:s,action:t,doneFn:n,name:r}),zn(s,e)},xh=(s,e)=>t=>{const n=e[`${s}Buffered`](),r=xS(n);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,r),e.queuePending[s]){const i=e.queuePending[s].doneFn;e.queuePending[s]=null,i&&i(e[`${s}Error_`])}zn(s,e)};class Ng extends P.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>zn("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_=xh("video",this),this.onAudioUpdateEnd_=xh("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){It({type:"mediaSource",sourceUpdater:this,action:Ct.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){It({type:e,sourceUpdater:this,action:Ct.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){P.log.error("removeSourceBuffer is not supported!");return}It({type:"mediaSource",sourceUpdater:this,action:Ct.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!P.browser.IS_FIREFOX&&I.MediaSource&&I.MediaSource.prototype&&typeof I.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return I.SourceBuffer&&I.SourceBuffer.prototype&&typeof I.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){P.log.error("changeType is not supported!");return}It({type:e,sourceUpdater:this,action:Ct.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 n=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,n);this.canChangeType()&&this.changeType(t,n)})}appendBuffer(e,t){const{segmentInfo:n,type:r,bytes:i}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${i.length} until video append`);return}const a=t;if(It({type:r,sourceUpdater:this,action:Ct.appendBuffer(i,n||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return Jt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ct()}videoBuffered(){return Jt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ct()}buffered(){const e=Jt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Jt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():PS(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=vs){It({type:"mediaSource",sourceUpdater:this,action:Ct.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=vs){typeof e!="string"&&(e=void 0),It({type:"mediaSource",sourceUpdater:this,action:Ct.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,n=vs){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}It({type:"audio",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}removeVideo(e,t,n=vs){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}It({type:"video",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}updating(){return!!(Kl("audio",this)||Kl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(It({type:"audio",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(It({type:"video",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&It({type:"audio",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&It({type:"video",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),gw.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Dg(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Lh=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),_w=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Ph=new Uint8Array(`
|
|
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=ww(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),S}timestampOffsetForSegment_(e){return Pw(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=ZS(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(s<=a)return;const l=pw({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||{},Iw(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}`),fw(p,this.vhs_.tech_,s),xn(a,l,p[s]),yw({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===_m){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=mw({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
|
+
${$m(e.uri)}
|
|
218
|
+
${br(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=ow({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=Dw(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_=kw(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=Lw(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=Uw(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 Vm=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},Mw=["video","audio"],yl=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},Bw=(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=Bw(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}}},Hm=(i,e)=>{const t=e[`${i}Buffer`],r=Vm(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===_m?"(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=Vm(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(Hm(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=YS(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 zm 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():JS(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"),Mw.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Hm(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))),Fw=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},oh=new Uint8Array(`
|
|
219
219
|
|
|
220
|
-
`.split("").map(
|
|
221
|
-
`,a=
|
|
222
|
-
`,L.syncInfo=
|
|
223
|
-
`,o++,a=T}),this.end_=a,this.storage_=r,this.diagnostics_=i}calculateBaseTime_(e,t,n){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const r=Math.min(...this.storage_.keys());if(e<r){const i=r-e;let a=this.storage_.get(r).segmentSyncInfo.start;for(let o=0;o<i;o++){const c=t[o];a-=c.duration}return a}return n}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Dh extends Og{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,n){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,n)}}const Ew=86400,yl=[{name:"VOD",run:(s,e,t,n,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,n,r,i)=>{const a=s.getMediaSequenceSync(i);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,n,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let i=null,a=null;const o=jl(e);r=r||0;for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=s.timelineToDatetimeMappings[_.timeline];if(!T||!_.dateTimeObject)continue;let S=_.dateTimeObject.getTime()/1e3+T;if(_.parts&&typeof m.partIndex=="number")for(let b=0;b<m.partIndex;b++)S+=_.parts[b].duration;const w=Math.abs(r-S);if(a!==null&&(w===0||a<w))break;a=w,i={time:S,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return i}},{name:"Segment",run:(s,e,t,n,r)=>{let i=null,a=null;r=r||0;const o=jl(e);for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=m.part&&m.part.start||_&&_.start;if(_.timeline===n&&typeof T<"u"){const S=Math.abs(r-T);if(a!==null&&a<S)break;(!i||a===null||a>=S)&&(a=S,i={time:T,segmentIndex:m.segmentIndex,partIndex:m.partIndex})}}return i}},{name:"Discontinuity",run:(s,e,t,n,r)=>{let i=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const c=e.discontinuityStarts[o],h=e.discontinuitySequence+o+1,m=s.discontinuities[h];if(m){const _=Math.abs(r-m.time);if(a!==null&&a<_)break;(!i||a===null||a>=_)&&(a=_,i={time:m.time,segmentIndex:c,partIndex:null})}}}return i}},{name:"Playlist",run:(s,e,t,n,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class ww extends P.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Og,n=new Dh(t),r=new Dh(t);this.mediaSequenceStorage_={main:t,audio:n,vtt:r},this.logger_=jt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,n,r,i){if(t!==1/0)return yl.find(({name:o})=>o==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,n,r,i);if(!a.length)return null;for(const o of a){const{syncPoint:c,strategy:h}=o,{segmentIndex:m,time:_}=c;if(m<0)continue;const T=e.segments[m],S=_,w=S+T.duration;if(this.logger_(`Strategy: ${h}. Current time: ${r}. selected segment: ${m}. Time: [${S} -> ${w}]}`),r>=S&&r<w)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(a,{key:"time",value:r})}getExpiredTime(e,t){if(!e||!e.segments)return null;const n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;const r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+ri({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,n,r,i){const a=[];for(let o=0;o<yl.length;o++){const c=yl[o],h=c.run(this,e,t,n,r,i);h&&(h.strategy=c.name,a.push({strategy:c.name,syncPoint:h}))}return a}selectSyncPoint_(e,t){let n=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),i=e[0].strategy;for(let a=1;a<e.length;a++){const o=Math.abs(e[a].syncPoint[t.key]-t.value);o<r&&(r=o,n=e[a].syncPoint,i=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${i}]: [time:${n.time}, segmentIndex:${n.segmentIndex}`+(typeof n.partIndex=="number"?`,partIndex:${n.partIndex}`:"")+"]"),n}saveExpiredSegmentInfo(e,t){const n=t.mediaSequence-e.mediaSequence;if(n>Ew){P.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let r=n-1;r>=0;r--){const i=e.segments[r];if(i&&typeof i.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.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],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const i=r.dateTimeObject;r.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[r.timeline]=-(i.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,n){const r=e.segment,i=e.part;let a=this.timelines[e.timeline],o,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,c=t.end+a.mapping;else if(a)o=t.start+a.mapping,c=t.end+a.mapping;else return!1;return i&&(i.start=o,i.end=c),(!r.start||o<r.start)&&(r.start=o),r.end=c,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let r=0;r<t.discontinuityStarts.length;r++){const i=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,o=i-e.mediaIndex,c=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>c){let h;o<0?h=n.start-ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:i}):h=n.end+ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:i}),this.discontinuities[a]={time:h,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class kw extends P.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:n}){return typeof t=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:n}){if(typeof t=="number"&&typeof n=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:n},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:n}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Cw=vg(bg(function(){var s=function(){function b(){this.listeners={}}var R=b.prototype;return R.on=function(L,U){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(U)},R.off=function(L,U){if(!this.listeners[L])return!1;var M=this.listeners[L].indexOf(U);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(M,1),M>-1},R.trigger=function(L){var U=this.listeners[L];if(U)if(arguments.length===2)for(var M=U.length,F=0;F<M;++F)U[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),j=U.length,J=0;J<j;++J)U[J].apply(this,N)},R.dispose=function(){this.listeners={}},R.pipe=function(L){this.on("data",function(U){L.push(U)})},b}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(b){return b.subarray(0,b.byteLength-b[b.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const b=[[[],[],[],[],[]],[[],[],[],[],[]]],R=b[0],L=b[1],U=R[4],M=L[4];let F,N,j;const J=[],K=[];let ne,he,oe,me,te,ue;for(F=0;F<256;F++)K[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=j=0;!U[N];N^=ne||1,j=K[j]||1)for(me=j^j<<1^j<<2^j<<3^j<<4,me=me>>8^me&255^99,U[N]=me,M[me]=N,oe=J[he=J[ne=J[N]]],ue=oe*16843009^he*65537^ne*257^N*16843008,te=J[me]*257^me*16843008,F=0;F<4;F++)R[F][N]=te=te<<24^te>>>8,L[F][me]=ue=ue<<24^ue>>>8;for(F=0;F<5;F++)R[F]=R[F].slice(0),L[F]=L[F].slice(0);return b};let n=null;class r{constructor(R){n||(n=t()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let L,U,M;const F=this._tables[0][4],N=this._tables[1],j=R.length;let J=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const K=R.slice(0),ne=[];for(this._key=[K,ne],L=j;L<4*j+28;L++)M=K[L-1],(L%j===0||j===8&&L%j===4)&&(M=F[M>>>24]<<24^F[M>>16&255]<<16^F[M>>8&255]<<8^F[M&255],L%j===0&&(M=M<<8^M>>>24^J<<24,J=J<<1^(J>>7)*283)),K[L]=K[L-j]^M;for(U=0;L;U++,L--)M=K[U&3?L:L-4],L<=4||U<4?ne[U]=M:ne[U]=N[0][F[M>>>24]]^N[1][F[M>>16&255]]^N[2][F[M>>8&255]]^N[3][F[M&255]]}decrypt(R,L,U,M,F,N){const j=this._key[1];let J=R^j[0],K=M^j[1],ne=U^j[2],he=L^j[3],oe,me,te;const ue=j.length/4-2;let z,G=4;const fe=this._tables[1],ye=fe[0],Pe=fe[1],Oe=fe[2],tt=fe[3],st=fe[4];for(z=0;z<ue;z++)oe=ye[J>>>24]^Pe[K>>16&255]^Oe[ne>>8&255]^tt[he&255]^j[G],me=ye[K>>>24]^Pe[ne>>16&255]^Oe[he>>8&255]^tt[J&255]^j[G+1],te=ye[ne>>>24]^Pe[he>>16&255]^Oe[J>>8&255]^tt[K&255]^j[G+2],he=ye[he>>>24]^Pe[J>>16&255]^Oe[K>>8&255]^tt[ne&255]^j[G+3],G+=4,J=oe,K=me,ne=te;for(z=0;z<4;z++)F[(3&-z)+N]=st[J>>>24]<<24^st[K>>16&255]<<16^st[ne>>8&255]<<8^st[he&255]^j[G++],oe=J,J=K,K=ne,ne=he,he=oe}}class i extends s{constructor(){super(s),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(R){this.jobs.push(R),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(b){return b<<24|(b&65280)<<8|(b&16711680)>>8|b>>>24},o=function(b,R,L){const U=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>2),M=new r(Array.prototype.slice.call(R)),F=new Uint8Array(b.byteLength),N=new Int32Array(F.buffer);let j,J,K,ne,he,oe,me,te,ue;for(j=L[0],J=L[1],K=L[2],ne=L[3],ue=0;ue<U.length;ue+=4)he=a(U[ue]),oe=a(U[ue+1]),me=a(U[ue+2]),te=a(U[ue+3]),M.decrypt(he,oe,me,te,N,ue),N[ue]=a(N[ue]^j),N[ue+1]=a(N[ue+1]^J),N[ue+2]=a(N[ue+2]^K),N[ue+3]=a(N[ue+3]^ne),j=he,J=oe,K=me,ne=te;return F};class c{constructor(R,L,U,M){const F=c.STEP,N=new Int32Array(R.buffer),j=new Uint8Array(R.byteLength);let J=0;for(this.asyncStream_=new i,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,U,j)),J=F;J<N.length;J+=F)U=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,U,j));this.asyncStream_.push(function(){M(null,e(j))})}static get STEP(){return 32e3}decryptChunk_(R,L,U,M){return function(){const F=o(R,L,U);M.set(F,R.byteOffset)}}}var h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof h<"u"?m=h:typeof self<"u"?m=self:m={};var _=m,T=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},S=_.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),function(){var b=new Uint16Array([65484]),R=new Uint8Array(b.buffer,b.byteOffset,b.byteLength);return R[0]===255?"big":R[0]===204?"little":"unknown"}();const w=function(b){const R={};return Object.keys(b).forEach(L=>{const U=b[L];T(U)?R[L]={bytes:U.buffer,byteOffset:U.byteOffset,byteLength:U.byteLength}:R[L]=U}),R};self.onmessage=function(b){const R=b.data,L=new Uint8Array(R.encrypted.bytes,R.encrypted.byteOffset,R.encrypted.byteLength),U=new Uint32Array(R.key.bytes,R.key.byteOffset,R.key.byteLength/4),M=new Uint32Array(R.iv.bytes,R.iv.byteOffset,R.iv.byteLength/4);new c(L,U,M,function(F,N){self.postMessage(w({source:R.source,decrypted:N}),[N.buffer])})}}));var Iw=_g(Cw);const xw=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Mg=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Ql=(s,e)=>{e.activePlaylistLoader=s,s.load()},Lw=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:n},mediaTypes:{[s]:r}}=e,i=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,c=r.lastGroup_;if(!(a&&c&&a.id===c.id)&&(r.lastGroup_=a,r.lastTrack_=i,Mg(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}t.resyncLoader(),Ql(a.playlistLoader,r)}},Pw=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:n}}=e;n.lastGroup_=null,t.abort(),t.pause()},Rw=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:n,main:r},mediaTypes:{[s]:i}}=e,a=i.activeTrack(),o=i.getActiveGroup(),c=i.activePlaylistLoader,h=i.lastTrack_;if(!(h&&a&&h.id===a.id)&&(i.lastGroup_=o,i.lastTrack_=a,Mg(n,i),!!o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;i.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),t.pause(),r.resetEverything(),m.fastQualityChange_(_);return}if(s==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}n.setAudio(!0),r.setAudio(!1)}if(c===o.playlistLoader){Ql(o.playlistLoader,i);return}n.track&&n.track(a),n.resetEverything(),Ql(o.playlistLoader,i)}},Xa={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:n}=e,r=t.activeTrack(),i=t.activeGroup(),a=(i.filter(c=>c.default)[0]||i[0]).id,o=t.tracks[a];if(r===o){n({error:{message:"Problem encountered loading the default audio track."}});return}P.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===o;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;P.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=t.activeTrack();n&&(n.mode="disabled"),t.onTrackChanged()}},Nh={AUDIO:(s,e,t)=>{if(!e)return;const{tech:n,requestOptions:r,segmentLoaders:{[s]:i}}=t;e.on("loadedmetadata",()=>{const a=e.media();i.playlist(a,r),(!n.paused()||a.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:n,requestOptions:r,segmentLoaders:{[s]:i},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();i.playlist(o,r),i.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))}},Dw={AUDIO:(s,e)=>{const{vhs:t,sourceType:n,segmentLoaders:{[s]:r},requestOptions:i,main:{mediaGroups:a},mediaTypes:{[s]:{groups:o,tracks:c,logger_:h}},mainPlaylistLoader:m}=e,_=Si(m.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=m.main.playlists));for(const T in a[s]){o[T]||(o[T]=[]);for(const S in a[s][T]){let w=a[s][T][S],b;if(_?(h(`AUDIO group '${T}' label '${S}' is a main playlist`),w.isMainPlaylist=!0,b=null):n==="vhs-json"&&w.playlists?b=new Bn(w.playlists[0],t,i):w.resolvedUri?b=new Bn(w.resolvedUri,t,i):w.playlists&&n==="dash"?b=new zl(w.playlists[0],t,i,m):b=null,w=ve({id:S,playlistLoader:b},w),Nh[s](s,w.playlistLoader,e),o[T].push(w),typeof c[S]>"u"){const R=new P.AudioTrack({id:S,kind:xw(w),enabled:!1,language:w.language,default:w.default,label:S});c[S]=R}}}r.on("error",Xa[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:n,sourceType:r,segmentLoaders:{[s]:i},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[s]:{groups:c,tracks:h}},mainPlaylistLoader:m}=e;for(const _ in o[s]){c[_]||(c[_]=[]);for(const T in o[s][_]){if(!n.options_.useForcedSubtitles&&o[s][_][T].forced)continue;let S=o[s][_][T],w;if(r==="hls")w=new Bn(S.resolvedUri,n,a);else if(r==="dash"){if(!S.playlists.filter(b=>b.excludeUntil!==1/0).length)return;w=new zl(S.playlists[0],n,a,m)}else r==="vhs-json"&&(w=new Bn(S.playlists?S.playlists[0]:S.resolvedUri,n,a));if(S=ve({id:T,playlistLoader:w},S),Nh[s](s,S.playlistLoader,e),c[_].push(S),typeof h[T]>"u"){const b=t.addRemoteTextTrack({id:T,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:T},!1).track;h[T]=b}}}i.on("error",Xa[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:n},mediaTypes:{[s]:{groups:r,tracks:i}}}=e;for(const a in n[s]){r[a]||(r[a]=[]);for(const o in n[s][a]){const c=n[s][a][o];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const h=t.options_.vhs&&t.options_.vhs.captionServices||{};let m={label:o,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(h[m.instreamId]&&(m=ve(m,h[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(ve({id:o},c)),typeof i[o]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;i[o]=_}}}}},Ug=(s,e)=>{for(let t=0;t<s.length;t++)if(id(e,s[t])||s[t].playlists&&Ug(s[t].playlists,e))return!0;return!1},Nw=(s,e)=>t=>{const{mainPlaylistLoader:n,mediaTypes:{[s]:{groups:r}}}=e,i=n.media();if(!i)return null;let a=null;i.attributes[s]&&(a=r[i.attributes[s]]);const o=Object.keys(r);if(!a)if(s==="AUDIO"&&o.length>1&&Si(e.main))for(let c=0;c<o.length;c++){const h=r[o[c]];if(Ug(h,i)){a=h;break}}else r.main?a=r.main:o.length===1&&(a=r[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},Ow={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].enabled)return t[n];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].mode==="showing"||t[n].mode==="hidden")return t[n];return null}},Mw=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},Uw=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(h=>{Dw[h](h,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:n,vhs:r,segmentLoaders:{["AUDIO"]:i,main:a}}=s;["AUDIO","SUBTITLES"].forEach(h=>{e[h].activeGroup=Nw(h,s),e[h].activeTrack=Ow[h](h,s),e[h].onGroupChanged=Lw(h,s),e[h].onGroupChanging=Pw(h,s),e[h].onTrackChanged=Rw(h,s),e[h].getActiveGroup=Mw(h,s)});const o=e.AUDIO.activeGroup();if(o){const h=(o.filter(m=>m.default)[0]||o[0]).id;e.AUDIO.tracks[h].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),i.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",c),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{n.audioTracks().removeEventListener("change",c),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const h in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[h])},Bw=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:vs,activeTrack:vs,getActiveGroup:vs,onGroupChanged:vs,onTrackChanged:vs,lastTrack_:null,logger_:jt(`MediaGroups[${e}]`)}}),s};class Oh{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_=St(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 Fw extends P.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Oh,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 n=t.serverUri||t.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=St(e,n),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 n=e?t:this.getRequestURI(t);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:n}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:n,requestType:"content-steering-manifest"},(i,a)=>{if(i){if(a.status===410){this.logger_(`manifest request 410 ${i}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(a.status===429){const h=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${i}.`),this.logger_(`content steering will retry in ${h} seconds.`),this.startTTLTimeout_(parseInt(h,10));return}this.logger_(`manifest failed to load ${i}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let o;try{o=JSON.parse(this.request_.responseText)}catch(h){const m={errorType:P.Error.StreamingContentSteeringParserError,error:h};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(o);const c={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new I.URL(e),n=new I.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const t=JSON.parse(I.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new I.URL(e),n=this.getPathway(),r=this.getBandwidth_();if(n){const i=`_${this.manifestType_}_pathway`;t.searchParams.set(i,n)}if(r){const i=`_${this.manifestType_}_throughput`;t.searchParams.set(i,r)}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=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;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=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!t(r))return r}const n=this.setSteeringParams_(e);return t(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=I.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){I.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 Oh}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&&(St(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const jw=(s,e)=>{let t=null;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,n)},e)}},qw=10;let Bs;const Vw=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],$w=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},Hw=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:i,duration:a,bufferBasedABR:o,log:c}){if(!n)return P.log.warn("We received no playlist to switch to. Please check your stream."),!1;const h=`allowing switch ${s&&s.id||"null"} -> ${n.id}`;if(!s)return c(`${h} as current playlist is not set`),!0;if(n.id===s.id)return!1;const m=!!Un(e,t).length;if(!s.endList)return!m&&typeof s.partTargetDuration=="number"?(c(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${h} as current playlist is live`),!0);const _=sd(e,t),T=o?Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ze.MAX_BUFFER_LOW_WATER_LINE;if(a<T)return c(`${h} as duration < max low water line (${a} < ${T})`),!0;const S=n.attributes.BANDWIDTH,w=s.attributes.BANDWIDTH;if(S<w&&(!o||_<i)){let b=`${h} as next bandwidth < current bandwidth (${S} < ${w})`;return o&&(b+=` and forwardBuffer < bufferHighWaterLine (${_} < ${i})`),c(b),!0}if((!o||S>w)&&_>=r){let b=`${h} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return o&&(b+=` and next bandwidth > current bandwidth (${S} > ${w})`),c(b),!0}return c(`not ${h} as no switching criteria met`),!1};class Ww extends P.EventTarget{constructor(e){super(),this.fastQualityChange_=jw(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:n,tech:r,bandwidth:i,externVhs:a,useCueTags:o,playlistExclusionDuration:c,enableLowInitialPlaylist:h,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:T,leastPixelDiffSelector:S,captionServices:w,experimentalUseMMS:b}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:R}=e;(R===null||typeof R>"u")&&(R=1/0),Bs=a,this.bufferBasedABR=!!T,this.leastPixelDiffSelector=!!S,this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=o,this.playlistExclusionDuration=c,this.maxPlaylistRetries=R,this.enableLowInitialPlaylist=h,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:R,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Bw(),b&&I.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new I.ManagedMediaSource,this.usingManagedMediaSource_=!0,P.log("Using ManagedMediaSource")):I.MediaSource&&(this.mediaSource=new I.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_=ct(),this.hasPlayed_=!1,this.syncController_=new ww(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Iw,this.sourceUpdater_=new Ng(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new kw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:w,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:i,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 zl(t,this.vhs_,ve(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Bn(t,this.vhs_,ve(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Yl(ve(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Yl(ve(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new bw(ve(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function j(){r.off("vttjserror",J),F()}function J(){r.off("vttjsloaded",j),N()}r.one("vttjsloaded",j),r.one("vttjserror",J),r.addWebVttScript_()})}),e);const U=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new Fw(this.vhs_.xhr,U),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Vw.forEach(F=>{this[F+"_"]=$w.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 M=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(M,()=>{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,n){const r=this.media(),i=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(i&&i!==a){this.logger_(`switch media ${i} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],n=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(n&&r){const i=(n.length?n[0].playlists:n.playlists).filter(a=>a.attributes.serviceLocation===r);i.length&&this.mediaTypes_[e].activePlaylistLoader.media(i[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I.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 n=e.mediaGroups.AUDIO,r=Object.keys(n);let i;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||r.length&&n[r[0]];for(const c in o)if(o[c].default){i={label:c};break}}if(!i)return t;const a=[];for(const o in n)if(n[o][i.label]){const c=n[o][i.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let h=0;h<e.playlists.length;h++){const m=e.playlists[h];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===o&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ql(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()),Uw({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;ql(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(ze({},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 n=e.mediaGroups||{};let r=!0;const i=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Bs.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),i.length&&Object.keys(n.AUDIO[i[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_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),i=this.bufferHighWaterLine(),a=this.tech_.buffered();return Hw({buffered:a,currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:i,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 n=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),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:qw}))});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,n=>{this.player_.trigger(ze({},n))}),this.audioSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))}),this.subtitleSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))})})}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 n=t.end(0);let r=n;if(e.start){const i=e.start.timeOffset;i<0?r=Math.max(n+i,t.start(0)):r=Math.min(n,i)}this.trigger("firstplay"),this.tech_.setCurrentTime(r)}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 n=Bs.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),i=this.tech_.buffered();if(!i.length)return n-r<=ns;const a=i.end(i.length-1);return a-r<=ns&&n-a<=ns}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,i=r.filter(Eo),a=i.length===1&&i[0]===e;if(r.length===1&&n!==1/0)return P.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 w=this.pathwayAttribute_(e),b=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(w),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(w)},b);return}let S=!1;r.forEach(w=>{if(w===e)return;const b=w.excludeUntil;typeof b<"u"&&b!==1/0&&(S=!0,delete w.excludeUntil)}),S&&(P.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const h=t.internal?this.logger_:P.log.warn,m=t.message?" "+t.message:"";h(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=c.targetDuration/2*1e3||5*1e3,T=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=_;return this.switchMedia_(c,"exclude",a||T)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const n=[],r=e==="all";(r||e==="main")&&n.push(this.mainPlaylistLoader_);const i=[];(r||e==="audio")&&i.push("AUDIO"),(r||e==="subtitle")&&(i.push("CLOSED-CAPTIONS"),i.push("SUBTITLES")),i.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=Un(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:Bs.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const n=e.media();if(!n)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const o=r.start,c=r.end;if(!isFinite(o)||!isFinite(c))return null;const h=Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n),m=Math.max(0,c-h);return m<o?null:ct([[o,m]])}const i=this.syncController_.getExpiredTime(n,this.duration());if(i===null)return null;const a=Bs.Playlist.seekable(n,i,Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const n=e.start(0),r=e.end(0),i=t.start(0),a=t.end(0);return i>r||n>a?e:ct([[Math.max(n,i),Math.min(r,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 n=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||n&&n.length&&this.seekable_.length&&n.start(0)===this.seekable_.start(0)&&n.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Xf(this.seekable_)}]`);const r={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:r}),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 r=this.seekable();if(!r.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<r.end(r.length-1))&&this.sourceUpdater_.setDuration(r.end(r.length-1));return}const t=this.tech_.buffered();let n=Bs.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(n=Math.max(n,t.end(t.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}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 n in t)t[n].forEach(r=>{r.playlistLoader&&r.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_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=ii(this.main(),t),r={},i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=n.video||e.main.videoCodec||oT),e.main.isMuxed&&(r.video+=`,${n.audio||e.main.audioCodec||gu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||i)&&(r.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||gu,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(h,m)=>h?ei(m,this.usingManagedMediaSource_):el(m),o={};let c;if(["video","audio"].forEach(function(h){if(r.hasOwnProperty(h)&&!a(e[h].isFmp4,r[h])){const m=e[h].isFmp4?"browser":"muxer";o[m]=o[m]||[],o[m].push(r[h]),h==="audio"&&(c=m)}}),i&&c&&t.attributes.AUDIO){const h=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===h&&m!==t&&(m.excludeUntil=1/0)}),this.logger_(`excluding audio group ${h} as ${c} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const h=Object.keys(o).reduce((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${o[_].join(",")}"`,m),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:h},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const h=[];if(["video","audio"].forEach(m=>{const _=(Zt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,T=(Zt(r[m]||"")[0]||{}).type;_&&T&&_.toLowerCase()!==T.toLowerCase()&&h.push(`"${this.sourceUpdater_.codecs[m]}" -> "${r[m]}"`)}),h.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${h.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}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(n=>{const r=e[n];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const i=ii(this.main,r),a=[];i.audio&&!el(i.audio)&&!ei(i.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${i.audio}`),i.video&&!el(i.video)&&!ei(i.video,this.usingManagedMediaSource_)&&a.push(`video codec ${i.video}`),i.text&&i.text==="stpp.ttml.im1t"&&a.push(`text codec ${i.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],n=this.main().playlists,r=za(Zt(e)),i=Ah(r),a=r.video&&Zt(r.video)[0]||null,o=r.audio&&Zt(r.audio)[0]||null;Object.keys(n).forEach(c=>{const h=n[c];if(t.indexOf(h.id)!==-1||h.excludeUntil===1/0)return;t.push(h.id);const m=[],_=ii(this.mainPlaylistLoader_.main,h),T=Ah(_);if(!(!_.audio&&!_.video)){if(T!==i&&m.push(`codec count "${T}" !== "${i}"`),!this.sourceUpdater_.canChangeType()){const S=_.video&&Zt(_.video)[0]||null,w=_.audio&&Zt(_.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${S.type}" !== "${a.type}"`),w&&o&&w.type.toLowerCase()!==o.type.toLowerCase()&&m.push(`audio codec "${w.type}" !== "${o.type}"`)}m.length&&(h.excludeUntil=1/0,this.logger_(`excluding ${h.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const n=this.seekable();n.length&&(t=n.start(0)),Aw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Ze.GOAL_BUFFER_LENGTH,n=Ze.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Ze.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Ze.BUFFER_LOW_WATER_LINE,n=Ze.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Ze.MAX_BUFFER_LOW_WATER_LINE),i=Math.max(t,Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?i:r)}bufferHighWaterLine(){return Ze.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){wh(this.inbandTextTracks_,"com.apple.streaming",this.tech_),tw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,n){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();wh(this.inbandTextTracks_,e,this.tech_),ZE({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:n})}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(ze({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),n=[];for(const r of e.playlists){const i=r.attributes.serviceLocation;if(i&&(n.push(i),!t.has(i)))return!0}return!!(!n.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,n=new Set;let r=!1;Object.keys(t).forEach(i=>{const a=t[i],o=this.pathwayAttribute_(a),c=o&&e!==o;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!c&&(delete a.excludeUntil,delete a.lastExcludeReason_,r=!0);const h=!a.excludeUntil&&a.excludeUntil!==1/0;!n.has(a.id)&&c&&h&&(n.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(i=>{const a=this.mediaTypes_[i];if(a.activePlaylistLoader){const o=a.activePlaylistLoader.media_;o&&o.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||n&&n.size){for(const[r,i]of t.entries())n.get(r)||(this.mainPlaylistLoader_.updateOrDeleteClone(i),this.contentSteeringController_.excludePathway(r));for(const[r,i]of n.entries()){const a=t.get(r);if(!a){e.filter(o=>o.attributes["PATHWAY-ID"]===i["BASE-ID"]).forEach(o=>{this.mainPlaylistLoader_.addClonePathway(i,o)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(a,i)||(this.mainPlaylistLoader_.updateOrDeleteClone(i,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}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 n=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const i in n)if(n[i]!==r[i])return!1;for(const i in r)if(n[i]!==r[i])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(n=>{const r=this.mainPlaylistLoader_.getKeyIdSet(n);!r||!r.size||r.forEach(i=>{const a="usable",o=this.keyStatusMap_.has(i)&&this.keyStatusMap_.get(i)===a,c=n.lastExcludeReason_===t&&n.excludeUntil===1/0;o?o&&c&&(delete n.excludeUntil,delete n.lastExcludeReason_,this.logger_(`enabling playlist ${n.id} because key ID ${i} is ${a}`)):(n.excludeUntil!==1/0&&n.lastExcludeReason_!==t&&(n.excludeUntil=1/0,n.lastExcludeReason_=t,this.logger_(`excluding playlist ${n.id} because the key ID ${i} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(n=>{const r=n&&n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height<720,i=n.excludeUntil===1/0&&n.lastExcludeReason_===t;r&&i&&(delete n.excludeUntil,P.log.warn(`enabling non-HD playlist ${n.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:_w(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,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 zw=(s,e,t)=>n=>{const r=s.main.playlists[e],i=rd(r),a=Eo(r);if(typeof n>"u")return a;n?delete r.disabled:r.disabled=!0;const o={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return n!==a&&!i&&(n?(t(r),s.trigger({type:"renditionenabled",metadata:o})):s.trigger({type:"renditiondisabled",metadata:o})),n};class Gw{constructor(e,t,n){const{playlistController_:r}=e,i=r.fastQualityChange_.bind(r);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=ii(r.main(),t),this.playlist=t,this.id=n,this.enabled=zw(e.playlists,t.id,i)}}const Xw=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Si(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(n=>!rd(n)).map((n,r)=>new Gw(s,n,n.id)):[]}},Mh=["seeking","seeked","pause","playing","error"];class Yw extends P.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_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),i=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],c={};o.forEach(m=>{c[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",c[m].reset),this.tech_.on(["seeked","seeking"],c[m].reset)});const h=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),h("off"))},this.clearSeekingAppendCheck_=()=>h("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),h("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Mh,i),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Mh,i),this.tech_.off("canplay",n),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(m=>{a[`${m}SegmentLoader_`].off("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",c[m].reset),this.tech_.off(["seeked","seeking"],c[m].reset)}),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I.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_,n=t[`${e}SegmentLoader_`],r=n.buffered_(),i=DS(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,i){const a={bufferedRanges:r};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:n.playlist_&&n.playlist_.id,buffered:ln(r)}),!(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+ns>=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(ct([this.lastRecordedTime,e]));const n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),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(),n=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const S=e.start(0);r=S+(S===e.end(0)?0:ns)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Xf(e)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const i=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),o=i.audioBuffer?i.audioBuffered():null,c=i.videoBuffer?i.videoBuffered():null,h=this.media(),m=h.partTargetDuration?h.partTargetDuration:(h.targetDuration-ss)*2,_=[o,c];for(let S=0;S<_.length;S++)if(_[S]&&sd(_[S],t)<m)return!1;const T=ia(a,t);return T.length===0?!1:(r=T.start(0)+ns,this.logger_(`Buffered region starts (${T.start(0)}) just beyond seek point (${t}). Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),n=Un(t,e);if(n.length&&e+3<=n.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${n.start(0)} -> ${n.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 n=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const i=ia(r,t);return i.length>0?(this.logger_(`Stopped at ${t} and seeking to ${i.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,n,r=!1){if(!e.length)return!1;let i=e.end(e.length-1)+ns;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||r)&&(i=e.end(e.length-1)+n.targetDuration*3),t>i}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:n}){if(!e)return;let r;if(e.length&&t.length){const i=Un(e,n-3),a=Un(e,n),o=Un(t,n);o.length&&!a.length&&i.length&&(r={start:i.end(0),end:o.end(0)})}else ia(e,n).length||(r=this.gapFromVideoUnderflow_(e,n));return r?(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${n}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),n=this.tech_.currentTime(),r=ia(t,n);if(this.resetTimeUpdate_(),r.length===0||n!==e)return;this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+ss);const i={gapInfo:{from:n,to:r.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:i}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const n=LS(e);for(let r=0;r<n.length;r++){const i=n.start(r),a=n.end(r);if(t-i<4&&t-i>2)return{start:i,end:a}}return null}}const Kw={errorInterval:30,getSource(s){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(e)}},Bg=function(s,e){let t=0,n=0;const r=ve(Kw,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const i=function(){n&&s.currentTime(n)},a=function(m){m!=null&&(n=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",i),s.src(m),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},o=function(){if(Date.now()-t<r.errorInterval*1e3){s.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!r.getSource||typeof r.getSource!="function"){P.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),r.getSource.call(s,a)},c=function(){s.off("loadedmetadata",i),s.off("error",o),s.off("dispose",c)},h=function(m){c(),Bg(s,m)};s.on("error",o),s.on("dispose",c),s.reloadSourceOnError=h},Qw=function(s){Bg(this,s)};var Fg="3.16.2",Zw="7.1.0",Jw="1.3.1",ek="7.2.0",tk="4.0.2";const Fe={PlaylistLoader:Bn,Playlist:Et,utils:nE,STANDARD_PLAYLIST_SELECTOR:Eh,INITIAL_PLAYLIST_SELECTOR:GE,lastBandwidthSelector:Eh,movingAverageBandwidthSelector:WE,comparePlaylistBandwidth:od,comparePlaylistResolution:HE,xhr:ug()};Object.keys(Ze).forEach(s=>{Object.defineProperty(Fe,s,{get(){return P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Ze[s]},set(e){if(P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){P.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Ze[s]=e}})});const jg="videojs-vhs",qg=function(s,e){const t=e.media();let n=-1;for(let r=0;r<s.length;r++)if(s[r].id===t.id){n=r;break}s.selectedIndex_=n,s.trigger({selectedIndex:n,type:"change"})},sk=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),qg(s,e.playlists)};Fe.canPlaySource=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const nk=(s,e,t)=>{if(!s)return s;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=za(Zt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(n.audio=t.attributes.CODECS);const r=Xn(n.video),i=Xn(n.audio),a={};for(const o in s)a[o]={},i&&(a[o].audioContentType=i),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof s[o]=="string"&&(a[o].url=s[o]);return ve(s,a)},rk=(s,e)=>s.reduce((t,n)=>{if(!n.contentProtection)return t;const r=e.reduce((i,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(i[a]={pssh:o.pssh}),i},{});return Object.keys(r).length&&t.push(r),t},[]),ik=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:n})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?n.concat([t]):n,i=rk(r,Object.keys(e)),a=[],o=[];return i.forEach(c=>{o.push(new Promise((h,m)=>{s.tech_.one("keysessioncreated",h)})),a.push(new Promise((h,m)=>{s.eme.initializeMediaKeys({keySystems:c},_=>{if(_){m(_);return}h()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},ak=({player:s,sourceKeySystems:e,media:t,audioMedia:n})=>{const r=nk(e,t,n);return r?(s.currentSource().keySystems=r,r&&!s.eme?(P.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Vg=()=>{if(!I.localStorage)return null;const s=I.localStorage.getItem(jg);if(!s)return null;try{return JSON.parse(s)}catch{return null}},ok=s=>{if(!I.localStorage)return!1;let e=Vg();e=e?ve(e,s):s;try{I.localStorage.setItem(jg,JSON.stringify(e))}catch{return!1}return e},lk=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,$g=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Hg=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Wg=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},zg=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Fe.supportsNativeHls=function(){if(!Y||!Y.createElement)return!1;const s=Y.createElement("video");return P.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(s.canPlayType(e))}):!1}();Fe.supportsNativeDash=function(){return!Y||!Y.createElement||!P.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(Y.createElement("video").canPlayType("application/dash+xml"))}();Fe.supportsTypeNatively=s=>s==="hls"?Fe.supportsNativeHls:s==="dash"?Fe.supportsNativeDash:!1;Fe.isSupported=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Fe.xhr.onRequest=function(s){$g(Fe.xhr,s)};Fe.xhr.onResponse=function(s){Hg(Fe.xhr,s)};Fe.xhr.offRequest=function(s){Wg(Fe.xhr,s)};Fe.xhr.offResponse=function(s){zg(Fe.xhr,s)};const ck=P.getComponent("Component");class Gg extends ck{constructor(e,t,n){if(super(t,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=jt("VhsHandler"),t.options_&&t.options_.playerId){const r=P.getPlayer(t.options_.playerId);this.player_=r}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(Y,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const i=Y.fullscreenElement||Y.webkitFullscreenElement||Y.mozFullScreenElement||Y.msFullscreenElement;i&&i.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_=ve(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 n=Vg();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ze.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ze.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(n=>{typeof this.source_[n]<"u"&&(this.options_[n]=this.source_[n])}),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=lk(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Fe,this.options_.sourceType=Mp(t),this.options_.seekTo=i=>{this.tech_.setCurrentTime(i)},this.options_.player_=this.player_,this.playlistController_=new Ww(this.options_);const n=ve({liveRangeSafeTimeDelta:ns},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Yw(n),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const i=P.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}),i.error(a)});const r=this.options_.bufferBasedABR?Fe.movingAverageBandwidthSelector(.55):Fe.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Fe.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(i){this.playlistController_.selectPlaylist=i.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(i){this.playlistController_.mainSegmentLoader_.throughput.rate=i,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let i=this.playlistController_.mainSegmentLoader_.bandwidth;const a=I.navigator.connection||I.navigator.mozConnection||I.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=o&&i>=o?i=Math.max(i,c):i=c}return i},set(i){this.playlistController_.mainSegmentLoader_.bandwidth=i,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const i=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(i+a))},set(){P.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:()=>ln(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:()=>ln(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&&ok({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Xw(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_=I.URL.createObjectURL(this.playlistController_.mediaSource),(P.browser.IS_ANY_SAFARI||P.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"),ik({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=ak({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{this.playlistController_.updatePlaylistByKeyStatus(n.keyId,n.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=P.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{sk(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{qg(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Fg,"mux.js":Zw,"mpd-parser":Jw,"m3u8-parser":ek,"aes-decrypter":tk}}version(){return this.constructor.version()}canChangeType(){return Ng.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_&&I.URL.revokeObjectURL&&(I.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return dE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,n=!0,r=2){return gg({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{$g(this.xhr,e)},this.xhr.onResponse=e=>{Hg(this.xhr,e)},this.xhr.offRequest=e=>{Wg(this.xhr,e)},this.xhr.offResponse=e=>{zg(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(n=>{this.playlistController_.on(n,r=>{this.player_.trigger(ze({},r))})}),t.forEach(n=>{this.playbackWatcher_.on(n,r=>{this.player_.trigger(ze({},r))})})}}const Ya={name:"videojs-http-streaming",VERSION:Fg,canHandleSource(s,e={}){const t=ve(P.options,e);return!t.vhs.experimentalUseMMS&&!ei("avc1.4d400d,mp4a.40.2",!1)?!1:Ya.canPlayType(s.type,t)},handleSource(s,e,t={}){const n=ve(P.options,t);return e.vhs=new Gg(s,e,n),e.vhs.xhr=ug(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=Mp(s);if(!t)return"";const n=Ya.getOverrideNative(e);return!Fe.supportsTypeNatively(t)||n?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(P.browser.IS_ANY_SAFARI||P.browser.IS_IOS),{overrideNative:n=t}=e;return n}},dk=()=>ei("avc1.4d400d,mp4a.40.2",!0);dk()&&P.getTech("Html5").registerSourceHandler(Ya,0);P.VhsHandler=Gg;P.VhsSourceHandler=Ya;P.Vhs=Fe;P.use||P.registerComponent("Vhs",Fe);P.options.vhs=P.options.vhs||{};(!P.getPlugin||!P.getPlugin("reloadSourceOnError"))&&P.registerPlugin("reloadSourceOnError",Qw);const uk=(s,e)=>{const t=goog.pal,n=new t.ConsentSettings;n.allowStorage=!1;const r=new t.NonceLoader(n);return async()=>{try{const i=new URL(e),a=new t.NonceRequest;let o=localStorage.getItem("sl-device-id")||ge.v4(),c=sessionStorage.getItem("sl-ad-session-id");c||(c=ge.v4(),sessionStorage.setItem("sl-ad-session-id",c)),dp(o)||(o=ba(`https://${o}`,ba.URL)),a.adWillAutoPlay=i.searchParams.get("vpa")==="auto",a.adWillPlayMuted=i.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=i.searchParams.get("description_url")||"",a.iconsSupported=!0,a.sessionId=o,a.supportedApiFrameworks="2,7,9",a.videoHeight=s.clientHeight,a.videoWidth=s.clientWidth;const h=await r.loadNonceManager(a);return i.searchParams.set("givn",h.getNonce()),i.searchParams.get("is_lat")==="[placeholder]"&&i.searchParams.set("is_lat","1"),i.searchParams.get("rdid")==="[placeholder]"&&i.searchParams.set("rdid",o),i.searchParams.get("correlator")==="[placeholder]"&&i.searchParams.set("correlator",c),i}catch(i){console.log("AdsManager could not be started",i);return}}};/*! @name videojs-contrib-ads @version 7.5.2 @license Apache-2.0 */var Xg="7.5.2";function hk(s){return{disableNextSnapshotRestore:!1,_contentEnding:!1,_contentHasEnded:!1,_hasThereBeenALoadStartDuringPlayerLife:!1,_hasThereBeenALoadedData:!1,_hasThereBeenALoadedMetaData:!1,_inLinearAdMode:!1,_shouldBlockPlay:!1,_playBlocked:!1,_playRequested:!1,_error:null,adType:null,VERSION:Xg,reset:function(){s.ads.disableNextSnapshotRestore=!1,s.ads._contentEnding=!1,s.ads._contentHasEnded=!1,s.ads.snapshot=null,s.ads.adType=null,s.ads._hasThereBeenALoadedData=!1,s.ads._hasThereBeenALoadedMetaData=!1,s.ads._cancelledPlay=!1,s.ads._shouldBlockPlay=!1,s.ads._playBlocked=!1,s.ads.nopreroll_=!1,s.ads.nopostroll_=!1,s.ads._playRequested=!1,s.ads._error=null},startLinearAdMode:function(){s.ads._state.startLinearAdMode()},endLinearAdMode:function(){s.ads._state.endLinearAdMode()},skipLinearAdMode:function(){s.ads._state.skipLinearAdMode()},stitchedAds:function(e){return e!==void 0&&(P.log.warn("Using player.ads.stitchedAds() as a setter is deprecated, it should be set as an option upon initialization of contrib-ads."),this.settings.stitchedAds=!!e),this.settings.stitchedAds},videoElementRecycled:function(){if(s.ads.shouldPlayContentBehindAd(s))return!1;if(!this.snapshot)throw new Error("You cannot use videoElementRecycled while there is no snapshot.");var e=s.tech_.src()!==this.snapshot.src,t=s.currentSrc()!==this.snapshot.currentSrc;return e||t},isLive:function(e){return e===void 0&&(e=s),typeof e.ads.settings.contentIsLive=="boolean"?e.ads.settings.contentIsLive:e.duration()===1/0?!0:P.browser.IOS_VERSION==="8"&&e.duration()===0},shouldPlayContentBehindAd:function(e){if(e===void 0&&(e=s),e)return e.ads.settings.liveCuePoints?!P.browser.IS_IOS&&!P.browser.IS_ANDROID&&e.duration()===1/0:!1;throw new Error("shouldPlayContentBehindAd requires a player as a param")},shouldTakeSnapshots:function(e){return e===void 0&&(e=s),!this.shouldPlayContentBehindAd(e)&&!this.stitchedAds()},isInAdMode:function(){return this._state.isAdState()},isWaitingForAdBreak:function(){return this._state.isWaitingForAdBreak()},isContentResuming:function(){return this._state.isContentResuming()},isAdPlaying:function(){return this._state.inAdBreak()},inAdBreak:function(){return this._state.inAdBreak()},removeNativePoster:function(){var e=s.$(".vjs-tech");e&&e.removeAttribute("poster")},debug:function(){if(this.settings.debug){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length===1&&typeof t[0]=="string"?P.log("ADS: "+t[0]):P.log.apply(P,["ADS:"].concat(t))}},error:function(e){if(e===void 0)return this._error||null;if(e===null||!e.errorType){this._error=null;return}this._error=e,P.log.error("An error with Ads occured. Type: "+e.errorType+"."),s.trigger({type:"vjsadserror",error:this._error})}}}var Yg=function(s,e){e.isImmediatePropagationStopped=function(){return!0},e.cancelBubble=!0,e.isPropagationStopped=function(){return!0}},us=function(s,e,t){Yg(s,t),s.trigger({type:e+t.type,originalEvent:t})},pk=function(s,e){s.ads.isInAdMode()&&(s.ads.isContentResuming()?s.ads._contentEnding&&us(s,"content",e):us(s,"ad",e))},mk=function(s,e){s.ads.isInAdMode()?s.ads.isContentResuming()?(Yg(s,e),s.trigger("resumeended")):us(s,"ad",e):!s.ads._contentHasEnded&&!s.ads.stitchedAds()&&(us(s,"content",e),s.trigger("readyforpostroll"))},fk=function(s,e){if(!(e.type==="loadstart"&&!s.ads._hasThereBeenALoadStartDuringPlayerLife||e.type==="loadeddata"&&!s.ads._hasThereBeenALoadedData||e.type==="loadedmetadata"&&!s.ads._hasThereBeenALoadedMetaData))if(s.ads.inAdBreak())us(s,"ad",e);else{if(s.currentSrc()!==s.ads.contentSrc)return;us(s,"content",e)}},gk=function(s,e){s.ads.inAdBreak()?us(s,"ad",e):s.ads.isContentResuming()&&us(s,"content",e)};function yk(s){s.type==="playing"?pk(this,s):s.type==="ended"?mk(this,s):s.type==="loadstart"||s.type==="loadeddata"||s.type==="loadedmetadata"?fk(this,s):s.type==="play"?gk(this,s):this.ads.isInAdMode()&&(this.ads.isContentResuming()?us(this,"content",s):us(this,"ad",s))}function _k(s){s.ads.contentSrc=s.currentSrc(),s.ads._seenInitialLoadstart=!1;var e=function(){if(!s.ads.inAdBreak()){var t=s.currentSrc();t!==s.ads.contentSrc&&(s.ads._seenInitialLoadstart&&s.trigger({type:"contentchanged"}),s.trigger({type:"contentupdate",oldValue:s.ads.contentSrc,newValue:t}),s.ads.contentSrc=t),s.ads._seenInitialLoadstart=!0}};s.on("loadstart",e)}function Zl(){return Zl=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Zl.apply(this,arguments)}function Rt(s,e){s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Jl(s,e)}function Jl(s,e){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Jl(s,e)}var Kg={},vk=function(s){if(P.dom.isInFrame()&&typeof I.__tcfapi!="function"){for(var e=I,t,n={};e;){try{if(e.frames.__tcfapiLocator){t=e;break}}catch{}if(e===I.top)break;e=e.parent}if(!t)return;I.__tcfapi=function(r,i,a,o){var c=Math.random()+"",h={__tcfapiCall:{command:r,parameter:o,version:i,callId:c}};n[c]=a,t.postMessage(h,"*")},I.addEventListener("message",function(r){var i={};try{i=typeof r.data=="string"?JSON.parse(r.data):r.data}catch{}var a=i.__tcfapiReturn;a&&typeof n[a.callId]=="function"&&(n[a.callId](a.returnValue,a.success),n[a.callId]=null)},!1)}},Uh=function(){vk(),typeof I.__tcfapi=="function"&&I.__tcfapi("addEventListener",2,function(s,e){e&&(Kg=s)})},bk=function(s){for(var e=s.parent;e!==s.top;){try{if(e.frames&&e.frames.__uspapiLocator)return e}catch{}e=e.parent}try{if(s.top.frames&&s.top.frames.__uspapiLocator)return s.top}catch{}return null},ec="",Tk=function(){return ec},Bh=function(s,e){if(e===void 0&&(e=I),e.__uspapi)e.__uspapi("getUSPData",1,function(a,o){var c=o?a.uspString:null;ec=c,s(c)});else{var t=bk(e);if(!t){s(null);return}var n=Math.random().toString(36).substring(2),r={__uspapiCall:{command:"getUSPData",version:1,callId:n}},i=function a(o){if(o&&o.data&&o.data.__uspapiReturn&&o.data.__uspapiReturn.callId===n){e.removeEventListener("message",a,!1);var c=o.data.__uspapiReturn,h=c.returnValue,m=c.success,_=m?h.uspString:null;ec=_,s(_)}};e.addEventListener("message",i,!1),t.postMessage(r,"*")}},yn={AdsBeforePrerollError:"ads-before-preroll-error",AdsPrerollError:"ads-preroll-error",AdsMidrollError:"ads-midroll-error",AdsPostrollError:"ads-postroll-error",AdsMacroReplacementFailed:"ads-macro-replacement-failed",AdsResumeContentFailed:"ads-resume-content-failed"},Fh=function(s,e){return e?encodeURIComponent(s):s},Ak=function(s,e,t){if(s&&s[t])for(var n=s[t],r=Object.keys(n),i=0;i<r.length;i++){var a="{mediainfo."+t+"."+r[i]+"}";e[a]=n[r[i]]}},Sk=function(s,e){var t={};return["description","tags","reference_id","ad_keys"].forEach(function(n){s&&s[n]?t["{mediainfo."+n+"}"]=s[n]:e["{mediainfo."+n+"}"]?t["{mediainfo."+n+"}"]=e["{mediainfo."+n+"}"]:t["{mediainfo."+n+"}"]=""}),["custom_fields","customFields"].forEach(function(n){Ak(s,t,n)}),t},Ek=function(s){var e={},t=s.replace(/{([^}=]+)=([^}]*)}/g,function(n,r,i){return e["{"+r+"}"]=i,"{"+r+"}"});return{defaults:e,modifiedString:t}},wk=function(s){return{"{player.id}":s.options_["data-player"]||s.id_,"{player.height}":s.currentHeight(),"{player.width}":s.currentWidth(),"{player.heightInt}":Math.round(s.currentHeight()),"{player.widthInt}":Math.round(s.currentWidth()),"{player.autoplay}":s.autoplay()?1:0,"{player.muted}":s.muted()?1:0,"{player.language}":s.language()||"","{mediainfo.id}":s.mediainfo?s.mediainfo.id:"","{mediainfo.name}":s.mediainfo?s.mediainfo.name:"","{mediainfo.duration}":s.mediainfo?s.mediainfo.duration:"","{player.duration}":s.duration(),"{player.durationInt}":Math.round(s.duration()),"{player.live}":s.duration()===1/0?1:0,"{player.pageUrl}":P.dom.isInFrame()?Y.referrer:I.location.href,"{playlistinfo.id}":s.playlistinfo?s.playlistinfo.id:"","{playlistinfo.name}":s.playlistinfo?s.playlistinfo.name:"","{timestamp}":new Date().getTime(),"{document.referrer}":Y.referrer,"{window.location.href}":I.location.href,"{random}":Math.floor(Math.random()*1e12)}},kk=function(s){var e={};return Object.keys(s).forEach(function(t){e["{tcf."+t+"}"]=s[t]}),e["{tcf.gdprAppliesInt}"]=s.gdprApplies?1:0,e},Ck=function(){return{"{usp.uspString}":Tk()}},Ik=function(s,e,t){var n=new RegExp("{pageVariable\\.([^}]+)}","g"),r={},i=(s.match(n)||[]).concat(Object.keys(t).filter(function(a){return n.test(a)&&s.includes(t[a])}));if(i)return i.forEach(function(a){for(var o=a,c=a.slice(14,-1),h=c.split("."),m=I,_,T=0;T<h.length;T++)if(T===h.length-1)_=m[h[T]];else if(m=m[h[T]],typeof m>"u")break;var S=typeof _;_===null?r[o]="null":_===void 0?e[o]?r[o]=e[o]:(P.log.warn('Page variable "'+c+'" not found'),r[o]=""):S!=="string"&&S!=="number"&&S!=="boolean"?(P.log.warn('Page variable "'+c+'" is not a supported type'),r[o]=""):r[o]=_}),r},jh=function(s,e,t,n,r){n===void 0&&(n={});for(var i in e){var a=n.hasOwnProperty(i)?n[i]:i;if(a.startsWith("r:"))try{var o=new RegExp(a.slice(2),"g");s=s.replace(o,Fh(e[i],t))}catch(c){r.ads.error({errorType:yn.AdsMacroReplacementFailed,macro:i,error:c}),P.log.warn('Unable to replace macro with regex "'+a+'". The provided regex may be invalid.')}else s=s.split(a).join(Fh(e[i],t))}return s};function xk(s,e,t){e===void 0&&(e=!1),t===void 0&&(t={});var n=t.disableDefaultMacros||!1,r=t.macroNameOverrides||{};delete t.disableDefaultMacros,delete t.macroNameOverrides;var i=t;if(n)return jh(s,i,e,r);var a=Ek(s),o=a.defaults,c=a.modifiedString;s=c,Zl(i,wk(this),Sk(this.mediainfo,o),kk(Kg),Ck(),Ik(s,o,r)),s=jh(s,i,e,r,this);for(var h in o)s=s.replace(h,o[h]);return s}var _n={};_n.processMetadataTracks=function(s,e){for(var t=s.textTracks(),n=function(i){i.kind==="metadata"&&(s.ads.cueTextTracks.setMetadataTrackMode(i),e(s,i))},r=0;r<t.length;r++)n(t[r]);t.addEventListener("addtrack",function(i){n(i.track)})};_n.setMetadataTrackMode=function(s){};_n.getSupportedAdCue=function(s,e){return e};_n.isSupportedAdCue=function(s,e){return!0};_n.getCueId=function(s,e){return e.id};var Lk=function(s,e){return e!==void 0&&s.ads.includedCues[e]},Pk=function(s,e){e!==void 0&&e!==""&&(s.ads.includedCues[e]=!0)};_n.processAdTrack=function(s,e,t,n){s.ads.includedCues={};for(var r=0;r<e.length;r++){var i=e[r],a=this.getSupportedAdCue(s,i);if(!this.isSupportedAdCue(s,i)){P.log.warn("Skipping as this is not a supported ad cue.",i);return}var o=this.getCueId(s,i),c=i.startTime;if(Lk(s,o)){P.log("Skipping ad already seen with ID "+o);return}n&&n(s,a,o,c),t(s,a,o,c),Pk(s,o)}};function Rk(s,e){e&&P.log("Using cancelContentPlay to block content playback"),s.on("play",Dk)}function Dk(){this.ads._shouldBlockPlay!==!1&&(this.paused()||(this.ads.debug("Playback was canceled by cancelContentPlay"),this.pause()),this.ads._cancelledPlay=!0)}var gr={},an=P;gr.isMiddlewareMediatorSupported=function(){return an.browser.IS_IOS||an.browser.IS_ANDROID?!1:!!(an.use&&an.middleware&&an.middleware.TERMINATOR)};gr.playMiddleware=function(s){return{setSource:function(e,t){t(null,e)},callPlay:function(){if(s.ads&&s.ads._shouldBlockPlay===!0)return s.ads.debug("Using playMiddleware to block content playback"),s.ads._playBlocked=!0,an.middleware.TERMINATOR},play:function(e,t){s.ads&&s.ads._playBlocked&&e?(s.ads.debug("Play call to Tech was terminated."),s.trigger("play"),s.addClass("vjs-has-started"),s.ads._playBlocked=!1):t&&t.catch&&t.catch(function(n){n.name==="NotAllowedError"&&!P.browser.IS_SAFARI&&s.trigger("pause")})}}};gr.testHook=function(s){an=s};var Nk=gr.playMiddleware,Ok=gr.isMiddlewareMediatorSupported,Mk=function(){if(P.getPlugin)return!!P.getPlugin("ads");var s=P.getComponent("Player");return!!(s&&s.prototype.ads)};function Uk(s){if(Mk())return!1;var e=P.registerPlugin||P.plugin;return e("ads",s),Ok()&&!P.usingContribAdsMiddleware_&&(P.use("*",Nk),P.usingContribAdsMiddleware_=!0,P.log.debug("Play middleware has been registered with videojs")),!0}var Bk={src:"data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAxJtZGF03ABMYXZjNjEuMy4xMDAAQiAIwRg4AAACrgYF//+q3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2NCByMzEwOCAzMWUxOWY5IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMyAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAAn//71sXwKaunqigzoMi7hlyTJrrYi4m0AwABFxzcqWKGahTaoBcQAAMWK4AlcFlIICBeldSEQBGCMHAAABVNtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAIgABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAACQXRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAIgAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAABQAAAAPAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAACIAAAAAAAEAAAAAAbltZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAADwAAAACAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAFkbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAADAc3RzZAAAAAAAAAABAAAAsGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABQADwAEgAAABIAAAAAAAAAAEUTGF2YzYxLjMuMTAwIGxpYngyNjQAAAAAAAAAAAAAAAAY//8AAAA2YXZjQwFkAA3/4QAZZ2QADazZQUH7ARAAAAMAEAAAAwPA8UKZYAEABmjr48siwP34+AAAAAAQcGFzcAAAAAEAAAABAAAAFGJ0cnQAAAAAAALAEAACwBAAAAAYc3R0cwAAAAAAAAABAAAAAQAAAgAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAC7wAAAAEAAAAUc3RjbwAAAAAAAAABAAAARQAAAj10cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAABgAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAAXAAAEAAABAAAAAAG1bWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAAACABVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAABYG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAAB+c3RzZAAAAAAAAAABAAAAbm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAH0AAAAEisFgICABRIQVuUABoCAgAECAAAAFGJ0cnQAAAAAAAH0AAAAEisAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAAVAAAABgAAABhzdGNvAAAAAAAAAAIAAAAwAAADNAAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAAACAAAAAQAAAGF1ZHRhAAAAWW1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALGlsc3QAAAAkqXRvbwAAABxkYXRhAAAAAQAAAABMYXZmNjEuMS4xMDA=",type:"video/mp4"},ce=function(){function s(){}return s.getState=function(e){if(e&&s.states_&&s.states_[e])return s.states_[e]},s.registerState=function(e,t){if(typeof e!="string"||!e)throw new Error('Illegal state name, "'+e+'"; must be a non-empty string.');return s.states_||(s.states_={}),s.states_[e]=t,t},s}(),ld=function(){s._getName=function(){return"Anonymous State"};function s(t){this.player=t}var e=s.prototype;return e.transitionTo=function(t){var n=this.player;this.cleanup(n);var r=new t(n);n.ads._state=r,n.ads.debug(this.constructor._getName()+" -> "+r.constructor._getName());for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];r.init.apply(r,[n].concat(a))},e.init=function(){},e.cleanup=function(){},e.onPlay=function(){},e.onPlaying=function(){},e.onEnded=function(){},e.onAdEnded=function(){},e.onAdsReady=function(){P.log.warn("Unexpected adsready event")},e.onAdsError=function(){},e.onAdsCanceled=function(){},e.onAdTimeout=function(){},e.onAdStarted=function(){},e.onAdSkipped=function(){},e.onContentChanged=function(){},e.onContentResumed=function(){},e.onReadyForPostroll=function(){P.log.warn("Unexpected readyforpostroll event")},e.onNoPreroll=function(){},e.onNoPostroll=function(){},e.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.endLinearAdMode=function(){P.log.warn("Unexpected endLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.skipLinearAdMode=function(){P.log.warn("Unexpected skipLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.isAdState=function(){throw new Error("isAdState unimplemented for "+this.constructor._getName())},e.isWaitingForAdBreak=function(){return!1},e.isContentResuming=function(){return!1},e.inAdBreak=function(){return!1},e.handleEvent=function(t){var n=this.player;t==="play"?this.onPlay(n):t==="adsready"?this.onAdsReady(n):t==="adserror"?this.onAdsError(n):t==="adscanceled"?this.onAdsCanceled(n):t==="adtimeout"?this.onAdTimeout(n):t==="ads-ad-started"?this.onAdStarted(n):t==="ads-ad-skipped"?this.onAdSkipped(n):t==="contentchanged"?this.onContentChanged(n):t==="contentresumed"?this.onContentResumed(n):t==="readyforpostroll"?this.onReadyForPostroll(n):t==="playing"?this.onPlaying(n):t==="ended"?this.onEnded(n):t==="nopreroll"?this.onNoPreroll(n):t==="nopostroll"?this.onNoPostroll(n):t==="adended"&&this.onAdEnded(n)},s}();ce.registerState("State",ld);var Fk=function(s){Rt(e,s);function e(n){var r;return r=s.call(this,n)||this,r.contentResuming=!1,r.waitingForAdBreak=!1,r}var t=e.prototype;return t.isAdState=function(){return!0},t.onPlaying=function(){var n=ce.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.onContentResumed=function(){var n=ce.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.isWaitingForAdBreak=function(){return this.waitingForAdBreak},t.isContentResuming=function(){return this.contentResuming},t.inAdBreak=function(){return this.player.ads._inLinearAdMode===!0},e}(ld);ce.registerState("AdState",Fk);var jk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}var t=e.prototype;return t.isAdState=function(){return!1},t.onContentChanged=function(n){var r=ce.getState("BeforePreroll"),i=ce.getState("Preroll");n.ads.debug("Received contentchanged event (ContentState)"),n.paused()?this.transitionTo(r):(this.transitionTo(i,!1),n.pause(),n.ads._pausedOnContentupdate=!0)},e}(ld);ce.registerState("ContentState",jk);var qk=ce.getState("ContentState"),Vk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"AdsDone"};var t=e.prototype;return t.init=function(n){n.ads._contentHasEnded=!0,n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (AdsDone)")},e}(qk);ce.registerState("AdsDone",Vk);var _l;function $k(s){var e;P.browser.IS_IOS&&s.ads.isLive(s)&&s.seekable().length>0?e=s.currentTime()-s.seekable().end(0):e=s.currentTime();var t=s.$(".vjs-tech"),n=s.textTracks?s.textTracks():[],r=[],i={ended:s.ended(),currentSrc:s.currentSrc(),sources:s.currentSources(),src:s.tech_.src(),currentTime:e,type:s.currentType()};t&&(i.style=t.getAttribute("style"));for(var a=0;a<n.length;a++){var o=n[a];r.push({track:o,mode:o.mode}),o.mode="disabled"}return i.suppressedTracks=r,i}function Hk(s,e){var t=s.ads.snapshot;if(e===void 0&&(e=function(){}),s.ads.disableNextSnapshotRestore===!0){s.ads.disableNextSnapshotRestore=!1,delete s.ads.snapshot,e();return}var n=s.$(".vjs-tech"),r=20,i=t.suppressedTracks,a,o=function(){for(var _=0;_<i.length;_++)a=i[_],a.track.mode=a.mode},c=function(){var _;if(P.browser.IS_IOS&&s.ads.isLive(s)){if(t.currentTime<0&&(s.seekable().length>0?_=s.seekable().end(0)+t.currentTime:_=s.currentTime(),s.currentTime(_)),s.paused()){var T=s.play();T&&T.catch&&T.catch(function(w){P.log.warn("Play promise rejected in IOS snapshot resume",w)})}}else if(t.ended)s.currentTime(s.duration());else{s.currentTime(t.currentTime);var S=s.play();S&&S.catch&&S.catch(function(w){P.log.warn("Play promise rejected in snapshot resume",w)})}s.ads.shouldRemoveAutoplay_&&(s.autoplay(!1),s.ads.shouldRemoveAutoplay_=!1)},h=function _(){if(s.off("contentcanplay",_),_l&&s.clearTimeout(_l),n=s.el().querySelector(".vjs-tech"),n.readyState>1||n.seekable===void 0||n.seekable.length>0)return c();if(r--)s.setTimeout(_,50);else try{c()}catch(T){s.ads.error({errorType:yn.AdsResumeContentFailed,error:T}),P.log.warn("Failed to resume the content after an advertisement",T)}};if("style"in t&&n.setAttribute("style",t.style||""),s.ads.videoElementRecycled())s.one("resumeended",function(){delete s.ads.snapshot,e()}),s.one("contentloadedmetadata",o),P.browser.IS_IOS&&!s.autoplay()&&typeof s.techCall_=="function"&&(s.techCall_("setAutoplay",!0),s.ads.shouldRemoveAutoplay_=!0),s.src(t.sources),s.one("contentcanplay",h),_l=s.setTimeout(h,2e3);else{if(o(),!s.ended()){var m=s.play();m&&m.catch&&m.catch(function(_){P.log.warn("Play promise rejected in snapshot restore",_)})}delete s.ads.snapshot,e()}}function Wk(s){s.ads.debug("Starting ad break"),s.ads._inLinearAdMode=!0,s.trigger("adstart"),s.ads.shouldTakeSnapshots()&&(s.ads.snapshot=$k(s)),s.ads.shouldPlayContentBehindAd(s)&&!s.ads.settings.stitchedAds&&(s.ads.preAdVolume_=s.volume(),s.volume(0)),s.addClass("vjs-ad-playing"),s.hasClass("vjs-live")&&s.removeClass("vjs-live"),s.ads.removeNativePoster(),s.ads.preAdPlaybackRate_=s.playbackRate(),s.playbackRate(1),s.controlBar&&s.controlBar.playbackRateMenuButton&&s.controlBar.playbackRateMenuButton.playbackRateSupported&&!s.controlBar.playbackRateMenuButton.hasClass("vjs-hidden")?(s.controlBar.playbackRateMenuButton.hide(),s.ads.showPlaybackMenuOnAdEnd_=!0):s.ads.showPlaybackMenuOnAdEnd_=!1}function zk(s,e){s.ads.debug("Ending ad break"),e===void 0&&(e=function(){}),s.ads.adType=null,s.ads._inLinearAdMode=!1,s.trigger("adend"),s.removeClass("vjs-ad-playing"),s.ads.isLive(s)&&s.addClass("vjs-live"),s.ads.shouldTakeSnapshots()?Hk(s,e):(s.ads.preAdVolume_&&s.volume(s.ads.preAdVolume_),e()),s.playbackRate(s.ads.preAdPlaybackRate_),s.ads.showPlaybackMenuOnAdEnd_&&s.controlBar.playbackRateMenuButton.show()}var hs={start:Wk,end:zk},Gk=ce.getState("AdState"),Xk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Preroll"};var t=e.prototype;return t.init=function(n,r,i){if(this.waitingForAdBreak=!0,n.addClass("vjs-ad-loading"),i||n.ads.nopreroll_)return this.resumeAfterNoPreroll(n);var a=n.ads.settings.timeout;typeof n.ads.settings.prerollTimeout=="number"&&(a=n.ads.settings.prerollTimeout),this._timeout=n.setTimeout(function(){n.trigger("adtimeout")},a),r?this.handleAdsReady():this.adsReady=!1},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.handleAdsReady=function(){this.adsReady=!0,this.readyForPreroll()},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.noPreroll=function(){var n=this;this.afterLoadStart(function(){n.player.ads.debug("Skipping prerolls due to nopreroll event (Preroll)"),n.resumeAfterNoPreroll(n.player)})},t.readyForPreroll=function(){var n=this.player;this.afterLoadStart(function(){n.ads.debug("Triggered readyforpreroll event (Preroll)"),n.trigger("readyforpreroll")})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (Preroll)"),this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.onAdsError=function(n){var r=this;P.log("adserror (Preroll)"),n.ads.error({errorType:yn.AdsPrerollError}),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&!this.isContentResuming()?(this.clearTimeout(n),n.ads.adType="preroll",this.waitingForAdBreak=!1,hs.start(n),n.ads._shouldBlockPlay=!1):P.log.warn("Unexpected startLinearAdMode invocation (Preroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(n.removeClass("vjs-ad-loading"),n.addClass("vjs-ad-content-resuming"),this.contentResuming=!0,hs.end(n))},t.skipLinearAdMode=function(){var n=this,r=this.player;r.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (Preroll)"),n.resumeAfterNoPreroll(r)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (Preroll)"),r.resumeAfterNoPreroll(n)})},t.onNoPreroll=function(n){n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected nopreroll event (Preroll)"):this.noPreroll()},t.resumeAfterNoPreroll=function(n){if(this.contentResuming=!0,n.ads._shouldBlockPlay=!1,this.cleanupPartial(n),n.ads._playRequested||n.ads._pausedOnContentupdate)if(n.paused()){n.ads.debug("resumeAfterNoPreroll: attempting to resume playback (Preroll)");var r=n.play();r&&r.then&&r.then(null,function(i){})}else n.ads.debug("resumeAfterNoPreroll: already playing (Preroll)"),n.trigger("play"),n.trigger("playing")},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving Preroll state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},e}(Gk);ce.registerState("Preroll",Xk);var Yk=ce.getState("ContentState"),Kk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"BeforePreroll"};var t=e.prototype;return t.init=function(n){this.adsReady=!1,this.shouldResumeToContent=!1,n.ads._shouldBlockPlay=n.ads.settings.allowVjsAutoplay?!n.autoplay():!0},t.onAdsReady=function(n){n.ads.debug("Received adsready event (BeforePreroll)"),this.adsReady=!0},t.onPlay=function(n){var r=ce.getState("Preroll");n.ads.debug("Received play event (BeforePreroll)"),this.transitionTo(r,this.adsReady,this.shouldResumeToContent)},t.onAdsCanceled=function(n){n.ads.debug("adscanceled (BeforePreroll)"),this.shouldResumeToContent=!0},t.onAdsError=function(){this.player.ads.debug("adserror (BeforePreroll)"),this.player.ads.error({errorType:yn.AdsBeforePrerollError}),this.shouldResumeToContent=!0},t.onNoPreroll=function(){this.player.ads.debug("Skipping prerolls due to nopreroll event (BeforePreroll)"),this.shouldResumeToContent=!0},t.skipLinearAdMode=function(){var n=this.player;n.trigger("adskip"),n.ads.debug("skipLinearAdMode (BeforePreroll)"),this.shouldResumeToContent=!0},t.onContentChanged=function(){this.init(this.player)},e}(Yk);ce.registerState("BeforePreroll",Kk);var Qk=ce.getState("AdState"),Zk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Midroll"};var t=e.prototype;return t.init=function(n){n.ads.adType="midroll",hs.start(n),n.addClass("vjs-ad-loading")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(this.contentResuming=!0,n.addClass("vjs-ad-content-resuming"),n.removeClass("vjs-ad-loading"),hs.end(n))},t.onAdsError=function(n){n.ads.error({errorType:yn.AdsMidrollError}),this.inAdBreak()&&n.ads.endLinearAdMode()},t.cleanup=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming")},e}(Qk);ce.registerState("Midroll",Zk);var Jk=ce.getState("AdState"),eC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Postroll"};var t=e.prototype;return t.init=function(n){if(this.waitingForAdBreak=!0,n.ads._contentEnding=!0,n.ads.nopostroll_){this.resumeContent(n);var r=ce.getState("AdsDone");this.transitionTo(r)}else{n.addClass("vjs-ad-loading");var i=n.ads.settings.timeout;typeof n.ads.settings.postrollTimeout=="number"&&(i=n.ads.settings.postrollTimeout),this._postrollTimeout=n.setTimeout(function(){n.trigger("adtimeout")},i)}},t.startLinearAdMode=function(){var n=this.player;!n.ads.inAdBreak()&&!this.isContentResuming()?(n.ads.adType="postroll",n.clearTimeout(this._postrollTimeout),this.waitingForAdBreak=!1,hs.start(n)):P.log.warn("Unexpected startLinearAdMode invocation (Postroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this,r=this.player,i=ce.getState("AdsDone");this.inAdBreak()&&(r.removeClass("vjs-ad-loading"),this.resumeContent(r),hs.end(r,function(){n.transitionTo(i)}))},t.skipLinearAdMode=function(){var n=this.player;n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):(n.ads.debug("Postroll abort (skipLinearAdMode)"),n.trigger("adskip"),this.abort(n))},t.onAdTimeout=function(n){n.ads.debug("Postroll abort (adtimeout)"),this.abort(n)},t.onAdsError=function(n){n.ads.debug("Postroll abort (adserror)"),n.ads.error({errorType:yn.AdsPostrollError}),n.ads.inAdBreak()?n.ads.endLinearAdMode():this.abort(n)},t.onContentChanged=function(n){if(this.isContentResuming()){var r=ce.getState("BeforePreroll");this.transitionTo(r)}else if(!this.inAdBreak()){var i=ce.getState("Preroll");this.transitionTo(i)}},t.onNoPostroll=function(n){!this.isContentResuming()&&!this.inAdBreak()?this.abort(n):P.log.warn("Unexpected nopostroll event (Postroll)")},t.resumeContent=function(n){this.contentResuming=!0,n.addClass("vjs-ad-content-resuming")},t.abort=function(n){var r=ce.getState("AdsDone");this.resumeContent(n),n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.cleanup=function(n){n.removeClass("vjs-ad-content-resuming"),n.clearTimeout(this._postrollTimeout),n.ads._contentEnding=!1},e}(Jk);ce.registerState("Postroll",eC);var tC=ce.getState("ContentState"),sC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"ContentPlayback"};var t=e.prototype;return t.init=function(n){n.ads._shouldBlockPlay=!1},t.onAdsReady=function(n){n.ads.debug("Received adsready event (ContentPlayback)"),n.ads.nopreroll_||(n.ads.debug("Triggered readyforpreroll event (ContentPlayback)"),n.trigger("readyforpreroll"))},t.onReadyForPostroll=function(n){var r=ce.getState("Postroll");n.ads.debug("Received readyforpostroll event"),this.transitionTo(r)},t.startLinearAdMode=function(){var n=ce.getState("Midroll");this.transitionTo(n)},e}(tC);ce.registerState("ContentPlayback",sC);var nC=ce.getState("ContentState"),rC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedContentPlayback"};var t=e.prototype;return t.init=function(){this.player.ads._shouldBlockPlay=!1},t.onContentChanged=function(){this.player.ads.debug("Received contentchanged event ("+this.constructor._getName()+")")},t.startLinearAdMode=function(){var n=ce.getState("StitchedAdRoll");this.transitionTo(n)},e}(nC);ce.registerState("StitchedContentPlayback",rC);var iC=ce.getState("AdState"),aC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedAdRoll"};var t=e.prototype;return t.init=function(){this.waitingForAdBreak=!1,this.contentResuming=!1,this.player.ads.adType="stitched",hs.start(this.player)},t.onPlaying=function(){},t.onContentResumed=function(){},t.onAdEnded=function(){this.endLinearAdMode(),this.player.trigger("ended")},t.endLinearAdMode=function(){var n=ce.getState("StitchedContentPlayback");hs.end(this.player),this.transitionTo(n)},e}(iC);ce.registerState("StitchedAdRoll",aC);var oC=ce.getState("AdState"),lC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPending"};var t=e.prototype;return t.init=function(n){this.adsReady=!1},t.onPlay=function(n){var r=ce.getState("OutstreamPlayback");n.ads.debug("Received play event (OutstreamPending)"),this.transitionTo(r,this.adsReady)},t.onAdsReady=function(n){n.ads.debug("Received adsready event (OutstreamPending)"),this.adsReady=!0},t.onAdsError=function(){this.player.ads.debug("adserror (OutstreamPending)"),this.adsReady=!1},e}(oC);ce.registerState("OutstreamPending",lC);var cC=ce.getState("AdState"),dC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPlayback"};var t=e.prototype;return t.init=function(n,r){n.addClass("vjs-ad-loading"),r?this.handleAdsReady():this.abort(n)},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.abort=function(n){var r=ce.getState("OutstreamDone");n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.handleAdsReady=function(){this.adsReady=!0,this.readyForOutstreamPlayback()},t.readyForOutstreamPlayback=function(){var n=this.player;this.afterLoadStart(function(){n.trigger("readyforoutstream")})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&hs.start(n)},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving OutstreamPlayback state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.onAdsError=function(n){var r=this;P.log("adserror (OutstreamPlayback)"),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.abort(n)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (OutstreamPlayback)"),r.abort(n)})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (OutstreamPlaybac)"),this.afterLoadStart(function(){r.abort(n)})},t.endLinearAdMode=function(){var n=this;if(this.inAdBreak()){this.player.removeClass("vjs-ad-loading");var r=ce.getState("OutstreamDone");hs.end(this.player,function(){n.transitionTo(r)})}},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.skipLinearAdMode=function(){var n=this,r=this.player,i=ce.getState("OutstreamDone");this.inAdBreak()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (OutstreamPlayback)"),n.transitionTo(i)})},e}(cC);ce.registerState("OutstreamPlayback",dC);var uC=ce.getState("AdState"),hC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamDone"};var t=e.prototype;return t.init=function(n){n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (OutstreamDone)")},e}(uC);ce.registerState("OutstreamDone",hC);var pC=gr.isMiddlewareMediatorSupported,mC=P.getTech("Html5").Events,fC={timeout:5e3,prerollTimeout:void 0,postrollTimeout:void 0,debug:!1,stitchedAds:!1,contentIsLive:void 0,liveCuePoints:!0,allowVjsAutoplay:P.options.normalizeAutoplay||!1},cd=function(s){var e=this,t=P.obj.merge(fC,s),n=[];mC.concat(["firstplay","loadedalldata"]).forEach(function(a){n.indexOf(a)===-1&&n.push(a)}),e.on(n,yk),pC()||Rk(e,t.debug),e.setTimeout(function(){!e.ads._hasThereBeenALoadStartDuringPlayerLife&&e.src()!==""&&P.log.error("videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html")},5e3),e.on("ended",function(){e.hasClass("vjs-has-started")||e.addClass("vjs-has-started")}),e.on("contenttimeupdate",function(){e.removeClass("vjs-waiting")}),e.on(["addurationchange","adcanplay"],function(){if(!e.ads.settings.stitchedAds&&!e.hasStarted()&&!(e.ads.snapshot&&e.currentSrc()===e.ads.snapshot.currentSrc)&&e.ads.inAdBreak()){var a=e.play();a&&a.catch&&a.catch(function(o){P.log.warn("Play promise rejected when playing ad",o)})}}),e.on("nopreroll",function(){e.ads.debug("Received nopreroll event"),e.ads.nopreroll_=!0}),e.on("nopostroll",function(){e.ads.debug("Received nopostroll event"),e.ads.nopostroll_=!0}),e.on("playing",function(){e.ads._cancelledPlay=!1,e.ads._pausedOnContentupdate=!1}),e.on("play",function(){e.ads._playRequested=!0}),e.one("loadstart",function(){e.ads._hasThereBeenALoadStartDuringPlayerLife=!0}),e.on("loadeddata",function(){e.ads._hasThereBeenALoadedData=!0}),e.on("loadedmetadata",function(){e.ads._hasThereBeenALoadedMetaData=!0}),e.ads=hk(e),e.ads.settings=t,t.stitchedAds=!!t.stitchedAds,t.playerMode==="outstream"?(e.src(Bk),e.ads._state=new(ce.getState("OutstreamPending"))(e)):t.stitchedAds?e.ads._state=new(ce.getState("StitchedContentPlayback"))(e):e.ads._state=new(ce.getState("BeforePreroll"))(e),e.ads._state.init(e),e.ads.cueTextTracks=_n,e.ads.adMacroReplacement=xk.bind(e),_k(e),e.on("contentchanged",e.ads.reset);var r=function(){return!e.ads.shouldPlayContentBehindAd(e)&&e.ads.inAdBreak()&&e.tech_.featuresNativeTextTracks&&P.browser.IS_IOS&&!Array.isArray(e.textTracks())},i=function(){var a=e.textTracks();if(r())for(var o=0;o<a.length;o++){var c=a[o];c.mode==="showing"&&(c.mode="disabled")}};e.ready(function(){e.textTracks().addEventListener("change",i)}),e.on(["play","playing","ended","adsready","adscanceled","adskip","adserror","adtimeout","adended","ads-ad-started","ads-ad-skipped","contentchanged","dispose","contentresumed","readyforpostroll","nopreroll","nopostroll"],function(a){e.ads._state.handleEvent(a.type)}),e.on("dispose",function(){e.ads.reset(),e.textTracks().removeEventListener("change",i)}),Uh(),Bh(function(){}),e.ads.listenToTcf=Uh,e.ads.updateUsPrivacyString=function(a){return Bh(a)}};cd.Error=yn;cd.VERSION=Xg;Uk(cd);function dd(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,adId:s.adId||null,sequence:s.sequence||null,apiFramework:s.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const gC=["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 qh(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=[],r=Zg(s);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=ty(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const i in e)e[i]=ey(e[i]);for(const i in r){const a=r[i];typeof a=="string"&&n.push(Qg(a,e))}return n}function Qg(s,e){const t=(s=Vh(s,e)).match(/[^[\]]+(?=])/g);if(!t)return s;let n=t.filter(r=>gC.indexOf(r)>-1);return n.length===0?s:(n=n.reduce((r,i)=>(r[i]=-1,r),{}),Vh(s,n))}function Vh(s,e){let t=s;for(const n in e){const r=e[n];t=t.replace(new RegExp("(?:\\[|%%)(".concat(n,")(?:\\]|%%)"),"g"),r)}return t}function Zg(s){return Array.isArray(s)?s.map(e=>e&&e.hasOwnProperty("url")?e.url:e):s}function $h(s){return/^(https?:\/\/|\/\/)/.test(s)}function Hh(s,e){for(let t=0;t<e.length;t++)if(Jg(e[t],s))return!0;return!1}function Jg(s,e){if(s&&e){const t=Object.getOwnPropertyNames(s),n=Object.getOwnPropertyNames(e);return t.length===n.length&&s.id===e.id&&s.url===e.url}return!1}function ey(s){return encodeURIComponent(s).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function ty(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return s.toString().padStart(e,"0")}const Ie={track:function(s,e,t){qh(s,e,t).forEach(n=>{typeof window<"u"&&window!==null&&(new Image().src=n)})},resolveURLTemplates:qh,extractURLsFromTemplates:Zg,filterUrlTemplates:function(s){return s.reduce((e,t)=>{const n=t.url||t;return $h(n)?e.validUrls.push(n):e.invalidUrls.push(n),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Hh,isTemplateObjectEqual:Jg,encodeURIComponentRFC3986:ey,replaceUrlMacros:Qg,isNumeric:function(s){return!isNaN(parseFloat(s))&&isFinite(s)},flatten:function s(e){return e.reduce((t,n)=>t.concat(Array.isArray(n)?s(n):n),[])},joinArrayOfUniqueTemplateObjs:function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(s)?s:[],n=Array.isArray(e)?e:[];return t.concat(n).reduce((r,i)=>(Hh(i,r)||r.push(i),r),[])},isValidTimeValue:function(s){return Number.isFinite(s)&&s>=-2},addLeadingZeros:ty,isValidUrl:$h,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(s){return typeof s!="object"?s:JSON.stringify(s)}};function Wh(s){return["true","TRUE","True","1"].includes(s)}function yC(s){if(s==null)return-1;if(Ie.isNumeric(s))return parseInt(s);const e=s.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let n=parseInt(t[0]);t.length===2&&(n+=parseFloat("0.".concat(t[1])));const r=parseInt(60*e[1]),i=parseInt(60*e[0]*60);return isNaN(i)||isNaN(r)||isNaN(n)||r>3600||n>60?-1:i+r+n}const q={childByName:function(s,e){return Array.from(s.childNodes).find(t=>t.nodeName===e)},childrenByName:function(s,e){return Array.from(s.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(s,e){if(!e)return s;if(s.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(s)}if(!s.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(s)}return s},parseBoolean:Wh,parseNodeText:function(s){return s&&(s.textContent||s.text||"").trim()},copyNodeAttribute:function(s,e,t){const n=e.getAttribute(s);n&&t.setAttribute(s,n)},parseAttributes:function(s){return Array.from(s.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:yC,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>!parseInt(s.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>parseInt(s.sequence,10)).sort((s,e)=>s.sequence-e.sequence)},assignAttributes:function(s,e){s&&Array.from(s).forEach(t=>{let{nodeName:n,nodeValue:r}=t;if(n&&r&&e.hasOwnProperty(n)){let i=r;typeof e[n]=="boolean"&&(i=Wh(i)),e[n]=i}})},mergeWrapperAdData:function(s,e){var t;s.errorURLTemplates=e.errorURLTemplates.concat(s.errorURLTemplates),s.impressionURLTemplates=e.impressionURLTemplates.concat(s.impressionURLTemplates),s.extensions=e.extensions.concat(s.extensions),e.viewableImpression.length>0&&(s.viewableImpression=[...s.viewableImpression,...e.viewableImpression]),s.followAdditionalWrappers=e.followAdditionalWrappers,s.allowMultipleAds=e.allowMultipleAds,s.fallbackOnNoAd=e.fallbackOnNoAd;const n=(e.creatives||[]).filter(o=>o&&o.type==="companion"),r=n.reduce((o,c)=>((c.variations||[]).forEach(h=>{(h.companionClickTrackingURLTemplates||[]).forEach(m=>{Ie.containsTemplateObject(m,o)||o.push(m)})}),o),[]);s.creatives=n.concat(s.creatives);const i=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(s.creatives.forEach(o=>{if(e.trackingEvents&&e.trackingEvents[o.type])for(const c in e.trackingEvents[o.type]){const h=e.trackingEvents[o.type][c];Array.isArray(o.trackingEvents[c])||(o.trackingEvents[c]=[]),o.trackingEvents[c]=o.trackingEvents[c].concat(h)}o.type==="linear"&&(i&&(o.videoClickTrackingURLTemplates=o.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(o.videoCustomClickURLTemplates=o.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||o.videoClickThroughURLTemplate!==null&&o.videoClickThroughURLTemplate!==void 0||(o.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),o.type==="companion"&&r.length&&(o.variations||[]).forEach(c=>{c.companionClickTrackingURLTemplates=Ie.joinArrayOfUniqueTemplateObjs(c.companionClickTrackingURLTemplates,r)})}),e.adVerifications&&(s.adVerifications=s.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(s.blockedAdCategories=s.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const o=e.creatives.filter(c=>{var h;return((h=c.icons)===null||h===void 0?void 0:h.length)&&!c.mediaFiles.length});o.length&&(s.creatives=s.creatives.concat(o))}}};function _C(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"companion",required:null,variations:[]}}(e);return t.required=s.getAttribute("required")||null,t.variations=q.childrenByName(s,"Companion").map(n=>{const r=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:o.id||null,adType:"companionAd",width:o.width||0,height:o.height||0,assetWidth:o.assetWidth||null,assetHeight:o.assetHeight||null,expandedWidth:o.expandedWidth||null,expandedHeight:o.expandedHeight||null,apiFramework:o.apiFramework||null,adSlotId:o.adSlotId||null,pxratio:o.pxratio||"1",renderingMode:o.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(q.parseAttributes(n));r.htmlResources=q.childrenByName(n,"HTMLResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.iframeResources=q.childrenByName(n,"IFrameResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.staticResources=q.childrenByName(n,"StaticResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat({url:h,creativeType:c.getAttribute("creativeType")||null}):o},[]),r.altText=q.parseNodeText(q.childByName(n,"AltText"))||null;const i=q.childByName(n,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(o=>{const c=o.getAttribute("event"),h=q.parseNodeText(o);c&&h&&(Array.isArray(r.trackingEvents[c])||(r.trackingEvents[c]=[]),r.trackingEvents[c].push(h))}),r.companionClickTrackingURLTemplates=q.childrenByName(n,"CompanionClickTracking").map(o=>({id:o.getAttribute("id")||null,url:q.parseNodeText(o)})),r.companionClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"CompanionClickThrough"))||null;const a=q.childByName(n,"AdParameters");return a&&(r.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),r}),t}function vC(s,e){let t;const n=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:h,adId:m,sequence:_,apiFramework:T}=dd(c);return{id:h,adId:m,sequence:_,apiFramework:T,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);n.duration=q.parseDuration(q.parseNodeText(q.childByName(s,"Duration")));const r=s.getAttribute("skipoffset");if(r==null)n.skipDelay=null;else if(r.charAt(r.length-1)==="%"&&n.duration!==-1){const c=parseInt(r,10);n.skipDelay=n.duration*(c/100)}else n.skipDelay=q.parseDuration(r);const i=q.childByName(s,"VideoClicks");if(i){const c=q.childByName(i,"ClickThrough");n.videoClickThroughURLTemplate=c?{id:c.getAttribute("id")||null,url:q.parseNodeText(c)}:null,q.childrenByName(i,"ClickTracking").forEach(h=>{n.videoClickTrackingURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})}),q.childrenByName(i,"CustomClick").forEach(h=>{n.videoCustomClickURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})})}const a=q.childByName(s,"AdParameters");a&&(n.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),q.childrenByName(s,"TrackingEvents").forEach(c=>{q.childrenByName(c,"Tracking").forEach(h=>{let m=h.getAttribute("event");const _=q.parseNodeText(h);if(m&&_){if(m==="progress"){if(t=h.getAttribute("offset"),!t)return;m=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(q.parseDuration(t))}Array.isArray(n.trackingEvents[m])||(n.trackingEvents[m]=[]),n.trackingEvents[m].push(_)}})}),q.childrenByName(s,"MediaFiles").forEach(c=>{q.childrenByName(c,"MediaFile").forEach(S=>{n.mediaFiles.push(function(w){const b={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};b.id=w.getAttribute("id"),b.fileURL=q.parseNodeText(w),b.deliveryType=w.getAttribute("delivery"),b.codec=w.getAttribute("codec"),b.mimeType=w.getAttribute("type"),b.mediaType=w.getAttribute("mediaType")||"2D",b.apiFramework=w.getAttribute("apiFramework"),b.fileSize=parseInt(w.getAttribute("fileSize")||0),b.bitrate=parseInt(w.getAttribute("bitrate")||0),b.minBitrate=parseInt(w.getAttribute("minBitrate")||0),b.maxBitrate=parseInt(w.getAttribute("maxBitrate")||0),b.width=parseInt(w.getAttribute("width")||0),b.height=parseInt(w.getAttribute("height")||0);const R=w.getAttribute("scalable");R&&typeof R=="string"&&(b.scalable=q.parseBoolean(R));const L=w.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(b.maintainAspectRatio=q.parseBoolean(L)),b}(S))});const h=q.childByName(c,"InteractiveCreativeFile");h&&(n.interactiveCreativeFile=function(S){const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,apiFramework:b.apiFramework||null,variableDuration:q.parseBoolean(b.variableDuration),fileURL:null}}(q.parseAttributes(S));return w.fileURL=q.parseNodeText(S),w}(h));const m=q.childByName(c,"ClosedCaptionFiles");m&&q.childrenByName(m,"ClosedCaptionFile").forEach(S=>{const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,language:b.language||null,fileURL:null}}(q.parseAttributes(S));w.fileURL=q.parseNodeText(S),n.closedCaptionFiles.push(w)});const _=q.childByName(c,"Mezzanine"),T=function(S,w){const b={};let R=!1;return w.forEach(L=>{S&&S.getAttribute(L)?b[L]=S.getAttribute(L):R=!0}),R?null:b}(_,["delivery","type","width","height"]);if(T){const S={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};S.id=_.getAttribute("id"),S.fileURL=q.parseNodeText(_),S.delivery=T.delivery,S.codec=_.getAttribute("codec"),S.type=T.type,S.width=parseInt(T.width,10),S.height=parseInt(T.height,10),S.fileSize=parseInt(_.getAttribute("fileSize"),10),S.mediaType=_.getAttribute("mediaType")||"2D",n.mezzanine=S}});const o=q.childByName(s,"Icons");return o&&q.childrenByName(o,"Icon").forEach(c=>{n.icons.push(function(h){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=h.getAttribute("program"),m.height=parseInt(h.getAttribute("height")||0),m.width=parseInt(h.getAttribute("width")||0),m.xPosition=function(T){return["left","right"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("xPosition")),m.yPosition=function(T){return["top","bottom"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("yPosition")),m.apiFramework=h.getAttribute("apiFramework"),m.pxratio=h.getAttribute("pxratio")||"1",m.offset=q.parseDuration(h.getAttribute("offset")),m.duration=q.parseDuration(h.getAttribute("duration")),q.childrenByName(h,"HTMLResource").forEach(T=>{m.type=T.getAttribute("creativeType")||"text/html",m.htmlResource=q.parseNodeText(T)}),q.childrenByName(h,"IFrameResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.iframeResource=q.parseNodeText(T)}),q.childrenByName(h,"StaticResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.staticResource=q.parseNodeText(T)});const _=q.childByName(h,"IconClicks");if(_){m.iconClickThroughURLTemplate=q.parseNodeText(q.childByName(_,"IconClickThrough")),q.childrenByName(_,"IconClickTracking").forEach(S=>{m.iconClickTrackingURLTemplates.push({id:S.getAttribute("id")||null,url:q.parseNodeText(S)})});const T=q.childByName(_,"IconClickFallbackImages");T&&q.childrenByName(T,"IconClickFallbackImage").forEach(S=>{m.iconClickFallbackImages.push({url:q.parseNodeText(S)||null,width:S.getAttribute("width")||null,height:S.getAttribute("height")||null})})}return m.iconViewTrackingURLTemplate=q.parseNodeText(q.childByName(h,"IconViewTracking")),m}(c))}),n}function bC(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return q.childrenByName(s,"TrackingEvents").forEach(n=>{let r,i;q.childrenByName(n,"Tracking").forEach(a=>{r=a.getAttribute("event"),i=q.parseNodeText(a),r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))})}),q.childrenByName(s,"NonLinear").forEach(n=>{const r={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};r.id=n.getAttribute("id")||null,r.width=n.getAttribute("width"),r.height=n.getAttribute("height"),r.expandedWidth=n.getAttribute("expandedWidth"),r.expandedHeight=n.getAttribute("expandedHeight"),r.scalable=q.parseBoolean(n.getAttribute("scalable")),r.maintainAspectRatio=q.parseBoolean(n.getAttribute("maintainAspectRatio")),r.minSuggestedDuration=q.parseDuration(n.getAttribute("minSuggestedDuration")),r.apiFramework=n.getAttribute("apiFramework"),q.childrenByName(n,"HTMLResource").forEach(a=>{r.type=a.getAttribute("creativeType")||"text/html",r.htmlResource=q.parseNodeText(a)}),q.childrenByName(n,"IFrameResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.iframeResource=q.parseNodeText(a)}),q.childrenByName(n,"StaticResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.staticResource=q.parseNodeText(a)});const i=q.childByName(n,"AdParameters");i&&(r.adParameters={value:q.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),r.nonlinearClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"NonLinearClickThrough")),q.childrenByName(n,"NonLinearClickTracking").forEach(a=>{r.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:q.parseNodeText(a)})}),t.variations.push(r)}),t}function zh(s){const e=[];return s.forEach(t=>{const n=sy(t);n&&e.push(n)}),e}function sy(s){if(s.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=s.attributes,n=s.childNodes;if(e.name=s.nodeName,s.attributes){for(const i in t)if(t.hasOwnProperty(i)){const a=t[i];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const i in n)if(n.hasOwnProperty(i)){const a=sy(n[i]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const i=q.parseNodeText(s);i!==""&&(e.value=i),e.children=[]}return(r=e).value===null&&Object.keys(r.attributes).length===0&&r.children.length===0?null:e;var r}function TC(s){return s.getAttribute("AdID")||s.getAttribute("adID")||s.getAttribute("adId")||null}const ha={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 Gh(s,e){if(!ha[s.nodeName]||!ha[s.nodeName].attributes)return;const t=ha[s.nodeName].attributes.filter(n=>!s.getAttribute(n));t.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,attributes:t},e)}function Xh(s,e,t){const n=ha[s.nodeName],r=!t&&s.nodeName!=="Wrapper";if(!(!n||r)){if(n.subElements){const i=n.subElements.filter(a=>!q.childByName(s,a));i.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,subElements:i},e)}!t||!n.oneOfinLineResources||n.oneOfinLineResources.some(i=>q.childByName(s,i))||pi({name:s.nodeName,parentName:s.parentNode.nodeName,oneOfResources:n.oneOfinLineResources},e)}}function Yh(s){return s.children&&s.children.length!==0}function pi(s,e){let{name:t,parentName:n,attributes:r,subElements:i,oneOfResources:a}=s,o="Element '".concat(t,"'");o+=r?" missing required attribute(s) '".concat(r.join(", "),"' "):i?" missing required sub element(s) '".concat(i.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:o,parentElement:n,specVersion:4.1})}const AC={verifyRequiredValues:function s(e,t,n){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(n=!0),Gh(e,t),Yh(e)){Xh(e,t,n);for(let r=0;r<e.children.length;r++)s(e.children[r],t,n)}else q.parseNodeText(e).length===0&&pi({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Yh,emitMissingValueWarning:pi,verifyRequiredAttributes:Gh,verifyRequiredSubElements:Xh};function SC(s,e){let{allowMultipleAds:t,followAdditionalWrappers:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=Array.from(s.childNodes).filter(i=>{const a=i.nodeName.toLowerCase();return a==="inline"||n!==!1&&a==="wrapper"});for(const i of r){if(q.copyNodeAttribute("id",s,i),q.copyNodeAttribute("sequence",s,i),q.copyNodeAttribute("adType",s,i),i.nodeName==="Wrapper")return{ad:wC(i,e),type:"WRAPPER"};if(i.nodeName==="InLine")return{ad:EC(i,e,{allowMultipleAds:t}),type:"INLINE"};const a=i.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(i.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function EC(s,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&s.getAttribute("sequence")?null:ny(s,e)}function ny(s,e){let t=[];e&&AC.verifyRequiredValues(s,e);const n=Array.from(s.childNodes),r=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,sequence:i.sequence||null,adType:i.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}}(q.parseAttributes(s));return n.forEach(i=>{switch(i.nodeName){case"Error":r.errorURLTemplates.push(q.parseNodeText(i));break;case"Impression":r.impressionURLTemplates.push({id:i.getAttribute("id")||null,url:q.parseNodeText(i)});break;case"Creatives":r.creatives=function(a){const o=[];return a.forEach(c=>{const h={id:c.getAttribute("id")||null,adId:TC(c),sequence:c.getAttribute("sequence")||null,apiFramework:c.getAttribute("apiFramework")||null},m=[];let _;q.childrenByName(c,"UniversalAdId").forEach(S=>{const w={idRegistry:S.getAttribute("idRegistry")||"unknown",value:q.parseNodeText(S)};m.push(w)});const T=q.childByName(c,"CreativeExtensions");T&&(_=zh(q.childrenByName(T,"CreativeExtension")));for(const S in c.childNodes){const w=c.childNodes[S];let b;switch(w.nodeName){case"Linear":b=vC(w,h);break;case"NonLinearAds":b=bC(w,h);break;case"CompanionAds":b=_C(w,h)}b&&(m&&(b.universalAdIds=m),_&&(b.creativeExtensions=_),o.push(b))}}),o}(q.childrenByName(i,"Creative"));break;case"Extensions":{const a=q.childrenByName(i,"Extension");r.extensions=zh(a),r.adVerifications.length||(t=function(o){let c=null,h=[];return o.some(m=>c=q.childByName(m,"AdVerifications")),c&&(h=Kh(q.childrenByName(c,"Verification"))),h}(a));break}case"AdVerifications":r.adVerifications=Kh(q.childrenByName(i,"Verification"));break;case"AdSystem":r.system={value:q.parseNodeText(i),version:i.getAttribute("version")||null};break;case"AdTitle":r.title=q.parseNodeText(i);break;case"AdServingId":r.adServingId=q.parseNodeText(i);break;case"Category":r.categories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)});break;case"Expires":r.expires=parseInt(q.parseNodeText(i),10);break;case"ViewableImpression":r.viewableImpression.push(function(a){const o=(c,h)=>{const m=q.parseNodeText(h);return m&&c.push(m),c};return{id:a.getAttribute("id")||null,viewable:q.childrenByName(a,"Viewable").reduce(o,[]),notViewable:q.childrenByName(a,"NotViewable").reduce(o,[]),viewUndetermined:q.childrenByName(a,"ViewUndetermined").reduce(o,[])}}(i));break;case"Description":r.description=q.parseNodeText(i);break;case"Advertiser":r.advertiser={id:i.getAttribute("id")||null,value:q.parseNodeText(i)};break;case"Pricing":r.pricing={value:q.parseNodeText(i),model:i.getAttribute("model")||null,currency:i.getAttribute("currency")||null};break;case"Survey":r.survey={value:q.parseNodeText(i),type:i.getAttribute("type")||null};break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)})}}),t.length&&(r.adVerifications=r.adVerifications.concat(t)),r}function wC(s,e){const t=ny(s,e),n=s.getAttribute("followAdditionalWrappers"),r=s.getAttribute("allowMultipleAds"),i=s.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!n||q.parseBoolean(n),t.allowMultipleAds=!!r&&q.parseBoolean(r),t.fallbackOnNoAd=i?q.parseBoolean(i):null;let a=q.childByName(s,"VASTAdTagURI");if(a?t.nextWrapperURL=q.parseNodeText(a):(a=q.childByName(s,"VASTAdTagURL"),a&&(t.nextWrapperURL=q.parseNodeText(q.childByName(a,"URL")))),t.creatives.forEach(o=>{if(["linear","nonlinear"].includes(o.type)){if(o.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[o.type]||(t.trackingEvents[o.type]={});for(const c in o.trackingEvents){const h=o.trackingEvents[c];Array.isArray(t.trackingEvents[o.type][c])||(t.trackingEvents[o.type][c]=[]),h.forEach(m=>{t.trackingEvents[o.type][c].push(m)})}}o.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),o.videoClickTrackingURLTemplates.forEach(c=>{t.videoClickTrackingURLTemplates.push(c)})),o.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=o.videoClickThroughURLTemplate),o.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),o.videoCustomClickURLTemplates.forEach(c=>{t.videoCustomClickURLTemplates.push(c)}))}}),t.nextWrapperURL)return t}function Kh(s){const e=[];return s.forEach(t=>{const n={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},r=Array.from(t.childNodes);q.assignAttributes(t.attributes,n),r.forEach(a=>{let{nodeName:o,textContent:c,attributes:h}=a;switch(o){case"JavaScriptResource":case"ExecutableResource":n.resource=c.trim(),q.assignAttributes(h,n);break;case"VerificationParameters":n.parameters=c.trim()}});const i=q.childByName(t,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(a=>{const o=a.getAttribute("event"),c=q.parseNodeText(a);o&&c&&(Array.isArray(n.trackingEvents[o])||(n.trackingEvents[o]=[]),n.trackingEvents[o].push(c))}),e.push(n)}),e}class ry{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(n,r,i){const a={fired:!1,wrapFn:void 0};function o(){a.fired||(n.off(r,a.wrapFn),a.fired=!0,i.bind(n)(...arguments))}return a.wrapFn=o,o}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(n=>n.event!==e||n.handler!==t),this}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=!1;return this._handlers.forEach(a=>{a.event==="*"&&(i=!0,a.handler(e,...n)),a.event===e&&(i=!0,a.handler(...n))}),i}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,n)=>(n.event===e&&t.push(n.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Qh=0,tc=0;const iy=(s,e)=>{!s||!e||s<=0||e<=0||(tc=(tc*Qh+8*s/e)/++Qh)},kC={ERRORCODE:900,extensions:[]},Zh="VAST response version not supported";class ay extends ry{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 n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];this.emit("VAST-error",Object.assign({},kC,t,...r)),Ie.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return tc}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(),iy(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(n=>this.buildVASTResponse(n))}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(n=>this.buildVASTResponse(n))}buildVASTResponse(e){const t=function(n){let{ads:r,errorURLTemplates:i,version:a}=n;return{ads:r||[],errorURLTemplates:i||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:n=!1,url:r=null,wrapperDepth:i=0,allowMultipleAds:a,followAdditionalWrappers:o}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var c;this.emit("VAST-ad-parsed",{type:"ERROR",url:r,wrapperDepth:i});const T=(e==null||(c=e.documentElement)===null||c===void 0?void 0:c.nodeName)==="VideoAdServingTemplate";throw new Error(T?Zh:"Invalid VAST XMLDocument")}const h=[],m=e.documentElement.childNodes,_=e.documentElement.getAttribute("version");n&&_&&(this.vastVersion=_);for(const T in m){const S=m[T];if(S.nodeName==="Error"){const w=q.parseNodeText(S);n?this.rootErrorURLTemplates.push(w):this.errorURLTemplates.push(w)}else if(S.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&h.length>1)break;const w=SC(S,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:o});w.ad?(h.push(w.ad),this.emit("VAST-ad-parsed",{type:w.type,url:r,wrapperDepth:i,adIndex:h.length-1,vastVersion:_})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}parse(e){let{url:t=null,resolveAll:n=!0,wrapperSequence:r=null,previousUrl:i=null,wrapperDepth:a=0,isRootVAST:o=!1,followAdditionalWrappers:c,allowMultipleAds:h}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&o&&(h=!0);try{m=this.parseVastXml(e,{isRootVAST:o,url:t,wrapperDepth:a,allowMultipleAds:h,followAdditionalWrappers:c})}catch(_){return Promise.reject(_)}if(m.length===1&&r!=null&&(m[0].sequence=r),n===!1){const _=q.getSortedAdPods(m),T=q.getStandAloneAds(m);_.length?m=_:T.length&&(m=[T.shift()]),this.remainingAds=T}return this.resolveAds(m,{wrapperDepth:a,previousUrl:i,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:n,url:r}=arguments.length>1?arguments[1]:void 0;const i=[];return n=r,e.forEach(a=>{const o=this.resolveWrappers(a,t,n);i.push(o)}),Promise.all(i).then(a=>Ie.flatten(a))}resolveWrappers(e,t,n){const r={...e};return new Promise(i=>{var a;if(t++,!r.nextWrapperURL)return delete r.nextWrapperURL,i(r);if(!this.fetcher)return r.VASTAdTagURI=r.nextWrapperURL,delete r.nextWrapperURL,i(r);if(t>=this.maxWrapperDepth)return r.errorCode=302,delete r.nextWrapperURL,i(r);r.nextWrapperURL=q.resolveVastAdTagURI(r.nextWrapperURL,n);const o=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:r.allowMultipleAds,c=r.sequence;this.fetcher.fetchVAST({url:r.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(h=>this.parse(h,{url:r.nextWrapperURL,previousUrl:n,wrapperSequence:c,wrapperDepth:t,followAdditionalWrappers:r.followAdditionalWrappers,allowMultipleAds:o}).then(m=>{if(delete r.nextWrapperURL,m.length===0)return r.creatives=[],i(r);m.forEach(_=>{_&&q.mergeWrapperAdData(_,r)}),i(m)})).catch(h=>{r.errorCode=h.message===Zh?102:301,r.errorMessage=h.message,i(r)})})}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 n=e.ads[t],r=!n.creatives.some(i=>{var a;return((a=i.mediaFiles)===null||a===void 0?void 0:a.length)>0});!n.errorCode&&!r||n.VASTAdTagURI||(this.trackVastError(n.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:n.errorCode||303},{ERRORMESSAGE:n.errorMessage||""},{extensions:n.extensions},{system:n.system}),e.ads.splice(t,1))}}}let ys=null;const CC={data:{},length:0,getItem(s){return this.data[s]},setItem(s,e){this.data[s]=e,this.length=Object.keys(this.data).length},removeItem(s){delete this.data[s],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class IC{constructor(){this.storage=this.initStorage()}initStorage(){if(ys)return ys;try{ys=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{ys=null}return ys&&!this.isStorageDisabled(ys)||(ys=CC,ys.clear()),ys}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 sc=12e4,xC={get:async function(s,e){try{const t=new AbortController,n=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||sc," ms (408)"))},e.timeout||sc),r=await fetch(s,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(n)}),i=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,")")}(r);return i?{error:new Error(i),statusCode:r.status}:async function(a){const o=await a.text();let c;return c=Ie.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>HT)).DOMParser,{xml:c.parseFromString(o,"text/xml"),details:{byteLength:o.length,statusCode:a.status,rawXml:o}}}(r)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};class LC{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||xC,this.fetchingOptions={timeout:e.timeout||sc,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:n,maxWrapperDepth:r,emitter:i,wrapperDepth:a=0,previousUrl:o=null,wrapperAd:c=null}=e;const h=Date.now();this.URLTemplateFilters.forEach(T=>{n=T(n)}),i("VAST-resolving",{url:n,previousUrl:o,wrapperDepth:a,maxWrapperDepth:r,timeout:this.fetchingOptions.timeout,wrapperAd:c});const m=await this.urlHandler.get(n,this.fetchingOptions),_=Math.round(Date.now()-h);if(i("VAST-resolved",{url:n,previousUrl:o,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}),iy(m==null||(t=m.details)===null||t===void 0?void 0:t.byteLength,_),m.error)throw new Error(m.error);return m.xml}}class PC{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new IC;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new LC,this.vastParser=new ay({fetcher:this.fetcher}),this.storage=n,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 n=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<n?(this.totalCalls=1,this.totalCallsTimeout=n+36e5):this.totalCalls++,new Promise((r,i)=>{if(this.cappingFreeLunch>=this.totalCalls)return i(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=n-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return i(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(o=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(o,t).then(c=>{const h=this.vastParser.buildVASTResponse(c);r(h)}))).catch(o=>i(o))})}}class Jh extends ry{constructor(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=n,this.variation=r,this.muted=i,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 o=this.creative.trackingEvents[a];this.trackingEvents[a]=o.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]:{},n=!(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 r=this.skipDelay||-1;if(r===-1||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let o=this.lastPercentage;o<i;o++)a.push("progress-".concat(o+1,"%"));a.push("progress-".concat(e));for(const o in this.quartiles)this.isQuartileReached(o,this.quartiles[o],e)&&(a.push(o),this._alreadyTriggeredQuartiles[o]=!0);this.lastPercentage=i}a.forEach(o=>{this.track(o,{macros:t,once:n})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,n){let r=!1;return t<=n&&!this._alreadyTriggeredQuartiles[e]&&(r=!0),r}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 n=this.ad.adVerifications.find(i=>i.vendor===e);if(!n)throw new Error("No associated verification element found for vendor: ".concat(e));const r=n.trackingEvents;if(r&&r.verificationNotExecuted){const i=r.verificationNotExecuted;this.trackURLs(i,t),this.emit("verificationNotExecuted",{trackingURLTemplates:i})}}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 n=this.clickThroughURLTemplate||e,r={...t};if(n){this.progress&&(r.ADPLAYHEAD=this.progressFormatted());const i=Ie.resolveURLTemplates([n],r)[0];this.emit("clickthrough",i)}}trackProgressEvents(e,t,n){const r=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(i=>{let[a]=i;return a.startsWith("progress-")}).map(i=>{let[a,o]=i;return{name:a,time:parseFloat(a.split("-")[1]),urls:o}}).filter(i=>{let{time:a}=i;return a<=r&&a>this.progress}).forEach(i=>{let{name:a,urls:o}=i;!n&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:o}),this.trackURLs(o,t),n?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:n=!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,n);const r=this.trackingEvents[e],i=this.emitAlwaysEvents.indexOf(e)>-1;r?(this.emit(e,{trackingURLTemplates:r}),this.trackURLs(r,t)):i&&this.emit(e,null),n&&(delete this.trackingEvents[e],i&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:i,invalidUrls:a}=Ie.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const o={...n};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map(c=>c.idRegistry.concat(" ",c.value)).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map(c=>c.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(c=>c.value).join(","))),Ie.track(i,o,r)}convertToTimecode(e){if(!Ie.isValidTimeValue(e))return"";const t=1e3*e,n=Math.floor(t/36e5),r=Math.floor(t/6e4%60),i=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ie.addLeadingZeros(n,2),":").concat(Ie.addLeadingZeros(r,2),":").concat(Ie.addLeadingZeros(i,2),".").concat(Ie.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var pa,ma;class RC extends P.EventTarget{constructor(e,t){super(),it(this,pa,()=>{const n=this.skipDelay,r=this.player;n>0&&(r.duration()||this.duration)>=n&&(this.skipButtonElement&&(this.skipButtonElement.style.display="block"),this.options.displayRemainingTime&&(this.remainingTimeElement.style.display="block"),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement&&this.remainingTimePlayElement.classList.remove("vjs-hidden"),this.remainingTimeMuteElement&&this.remainingTimeMuteElement.classList.remove("vjs-hidden")),r.on("adtimeupdate",Ae(this,ma))),r.loadingSpinner.el().style.display="none"}),it(this,ma,()=>{this.player.loadingSpinner.el().style.display="none";const n=Math.ceil(this.skipDelay-this.player.currentTime());if(this.options.displayRemainingTime){const r=Math.ceil(this.player.remainingTime());this.remainingTimeElement.innerHTML=this.options.messages.remainingTime.replace("{seconds}",r)}this.skipButtonElement&&(n>0?(DC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skipCountdown.replace("{seconds}",n)):(NC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skip))}),this.player=e,this.options=t,this.duration=0,this.skipDelay=0,this.originalState={controlsEnabled:e.controls(),seekEnabled:e.controlBar.progressControl.enabled()}}setUp(){const e=this.player,t=this.options,n=()=>{e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable()},r=()=>{const c=this.blocker=window.document.createElement("div");c.className="vast-blocker",c.onclick=()=>{if(e.paused())return e.play(),!1;this.trigger("click")},e.el().insertBefore(c,e.controlBar.el())},i=()=>{const c=this.skipButtonElement=window.document.createElement("div");c.className="vast-skip-button",c.style.display="none",e.el().appendChild(c),e.one("adplay",Ae(this,pa)),c.onclick=h=>{if((" "+c.className+" ").indexOf(" enabled ")>=0&&this.trigger("skip"),window.Event.prototype.stopPropagation!==void 0)h.stopPropagation();else return!1}},a=()=>{if(!t.displayRemainingTime)return;const c=this.remainingTimeElement=window.document.createElement("div");c.className="vast-remaining-time",c.style.display="none",e.el().appendChild(c)},o=c=>{if(!t.displayRemainingTimeIcons)return;const h={play:{className:"vjs-icon-play vast-remaining-time-icon-play",action:L=>L.paused()?L.play():L.pause(),toggleClasses:["vjs-icon-pause","vjs-icon-play"],events:["adplay","adpause"],initialState:L=>L.paused()?"vjs-icon-play":"vjs-icon-pause"},mute:{className:"vast-remaining-time-icon-mute",action:L=>L.muted(!L.muted()),toggleClasses:["vjs-icon-volume-high","vjs-icon-volume-mute"],events:["advolumechange"],initialState:L=>L.muted()?"vjs-icon-volume-mute":"vjs-icon-volume-high"}},{className:m,action:_,toggleClasses:T,events:S,initialState:w}=h[c],b=e.addChild("button",{className:`vjs-visible-text vjs-button vast-remaining-time-icon ${m}`,clickHandler:(function(){_(this.player)}).bind(this)});b.removeClass("vjs-control"),b.addClass(w(e));const R=()=>{T.forEach(L=>b.toggleClass(L))};this[`remainingTime${c.charAt(0).toUpperCase()+c.slice(1)}Element`]=b.el(),S.forEach(L=>e.on(L,R))};n(),r(),a(),t.displaySkipBtn&&i(),t.autoplay||o("play"),t.muted&&o("mute")}tearDown(){const e=this.player,t=this.originalState;this.duration=0,this.skipDelay=0,e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable(),this.blocker.parentElement.removeChild(this.blocker),this.skipButtonElement&&this.skipButtonElement.parentElement.removeChild(this.skipButtonElement),this.options.displayRemainingTime&&this.remainingTimeElement.parentElement.removeChild(this.remainingTimeElement),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement.parentElement.removeChild(this.remainingTimePlayElement),this.remainingTimeMuteElement.parentElement.removeChild(this.remainingTimeMuteElement)),e.off("adtimeupdate",Ae(this,ma)),e.off("adplay",Ae(this,pa))}}pa=new WeakMap,ma=new WeakMap;function oy(s){return s&&(" "+s.className+" ").indexOf(" enabled ")>-1}function DC(s){s&&oy(s)&&(s.className=s.className.replace(" enabled ",""))}function NC(s){s&&!oy(s)&&(s.className+=" enabled ")}function ly(s,e=null){let t;return function(){return s&&(t=s.apply(e||this,arguments),s=null),t}}function cy(s){return s.type==="linear"&&s.mediaFiles.length}function ep(s){return s.type==="companion"}function OC(s){return JSON.parse(JSON.stringify(s))}function MC(s,e=null){let t=null;if(typeof s=="string")if(s.includes("%"))e!=null&&(t=s.replace("%","")/100*e);else if(s.includes(":")){const[n,r,i]=s.split(":").slice(-3);t=parseInt(n||0,10)*3600+parseInt(r||0,10)*60+parseInt(i||0,10)}else t=parseInt(s);return t==null&&(t=Number(s)),isNaN(t)?null:t}var Xr,fa,Yr;class UC{constructor(e,t){it(this,Xr),it(this,fa),it(this,Yr),Ke(this,Xr,e),Ke(this,fa,t),Ke(this,Yr,!1)}get linearCreative(){return Ae(this,Xr).creative}get linearAdTracker(){return Ae(this,Xr)}get companionTracker(){return Ae(this,fa)}get skipAfterDuration(){return Ae(this,Yr)}set skipAfterDuration(e){Ke(this,Yr,e)}hasVideoMedia(){return this.linearCreative.mediaFiles.some(e=>e&&e.apiFramework==null)}}Xr=new WeakMap,fa=new WeakMap,Yr=new WeakMap;var Dn,ga,Nn,Kr,ya;class BC{constructor(e,t,n,r){it(this,Dn),it(this,ga),it(this,Nn),it(this,Kr),it(this,ya,i=>{const a=o=>{const c=new Jh(Ae(this,Dn),o,o.creatives.find(cy),o.creatives.find(ep));c.on("clickthrough",tp);let h=null;const m=o.creatives.find(ep);if(m){const _=Ae(this,Nn),T=m.variations.filter(S=>S.staticResource).filter(S=>S.type.indexOf("image")===0).find(S=>parseInt(S.width,10)<=_.companion.maxWidth&&parseInt(S.height,10)<=_.companion.maxHeight);T&&(h=new Jh(Ae(this,Dn),o,m,T),h.on("clickthrough",tp))}return new UC(c,h)};return i.map(a)}),Ke(this,Dn,e),Ke(this,ga,t),Ke(this,Kr,n),Ke(this,Nn,r)}loadAds(e={}){return new Promise((t,n)=>{const{url:r,xml:i}=e,a=(Array.isArray(r)?r:[r]).filter(c=>c!=null);let o;if(a.length)o=Promise.resolve([]),a.forEach(c=>{o=o.then(h=>h==null||h.length===0?this.loadAdsWithUrl(c):h).catch(h=>[])});else if(i!=null)o=this.loadAdsWithXml(i);else throw new Error("xml or url must be set");o.then(t).catch(n)})}loadAdsWithXml(e){return new Promise((t,n)=>{let r;if(e.constructor===window.XMLDocument)r=e;else if(e.constructor===String)r=new window.DOMParser().parseFromString(e,"application/xml");else throw new Error("xml config option must be a String or XMLDocument");Ae(this,ga).parseVAST(r).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}loadAdsWithUrl(e){return new Promise((t,n)=>{Ae(this,Dn).get(e,{withCredentials:Ae(this,Nn).withCredentials,wrapperLimit:Ae(this,Nn).wrapperLimit}).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}}Dn=new WeakMap,ga=new WeakMap,Nn=new WeakMap,Kr=new WeakMap,ya=new WeakMap;function tp(s){window.open(s,"_blank")}class FC{selectAds(e){if(!e.ads||e.ads.length===0)throw new Error("no ads found in VAST");const t=e.ads.filter(r=>r.creatives.some(cy));if(!t.length)throw new Error("no linear ads found in VAST");const n=t.filter(r=>r.sequence);return n.length?n.sort((r,i)=>r.sequence-i.sequence):t.filter(r=>!n.includes(r)).slice(0,1)}}function dy(){}function jC(s,e){return s?null:new Error(e)}var nc={};function uy(s){var e=nc[s];e&&(clearTimeout(e),delete nc[s])}function qC(s,e,t){var n,r;return r=setTimeout(function(){e=dy,delete r[n],t()},s),n=function(){e.apply(this,arguments)&&uy(n)},nc[n]=r,n}function VC(s,e,t){var n=document.createElement(e);return t&&(n.id=t),s.appendChild(n),n}function $C(s,e,t){var n=hy(s,null,t.zIndex);if(fy(n,my(e,t)))return n}function hy(s,e,t){var n=document.createElement("iframe");return n.src=e||"about:blank",n.marginWidth="0",n.marginHeight="0",n.frameBorder="0",n.width="100%",n.height="100%",py(n),t&&(n.style.zIndex=t),n.setAttribute("SCROLLING","NO"),s.innerHTML="",s.appendChild(n),n}function py(s){s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.margin="0px",s.style.padding="0px",s.style.border="none",s.style.width="100%",s.style.height="100%"}function my(s,e){return Object.keys(e).forEach(function(t){var n=typeof n=="object"?JSON.stringify(e[t]):e[t];s=s.replace(new RegExp("{{"+t+"}}","g"),n)}),s}function fy(s,e){var t=s.contentWindow&&s.contentWindow.document;return t?(t.write(e),!0):!1}function HC(s,e){return Object.keys(e).forEach(function(t){s[t]=e[t]}),s}function WC(s){var e=-1;return function(){return s+"_"+ ++e}}var gy={noop:dy,validate:jC,clearCallbackTimeout:uy,callbackTimeout:qC,createElementInEl:VC,createIframeWithContent:$C,createIframe:hy,setFullSizeStyle:py,simpleTemplate:my,setIframeContent:fy,extend:HC,unique:WC},vl,sp;function zC(){if(sp)return vl;sp=1;var s=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"],e=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"],t=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"],n=["setAdVolume"];function r(o,c,h){}r.prototype.handshakeVersion=function(o,c){},r.prototype.initAd=function(o,c,h,m,_,T,S){},r.prototype.startAd=function(o){},r.prototype.stopAd=function(o){},r.prototype.skipAd=function(o){},r.prototype.resizeAd=function(o,c,h,m){},r.prototype.pauseAd=function(o){},r.prototype.resumeAd=function(o){},r.prototype.expandAd=function(o){},r.prototype.collapseAd=function(o){},r.prototype.subscribe=function(o,c,h){},r.prototype.unsubscribe=function(o,c){},r.prototype.getAdLinear=function(o){},r.prototype.getAdWidth=function(o){},r.prototype.getAdHeight=function(o){},r.prototype.getAdExpanded=function(o){},r.prototype.getAdSkippableState=function(o){},r.prototype.getAdRemainingTime=function(o){},r.prototype.getAdDuration=function(o){},r.prototype.getAdVolume=function(o){},r.prototype.getAdCompanions=function(o){},r.prototype.getAdIcons=function(o){},r.prototype.setAdVolume=function(o,c){},a(r,"METHODS",s),a(r,"GETTERS",t),a(r,"SETTERS",n),a(r,"EVENTS",e);var i=s.filter(function(o){return["skipAd"].indexOf(o)===-1});a(r,"checkVPAIDInterface",function(o){var c=i.every(function(h){return typeof o[h]=="function"});return c}),vl=r;function a(o,c,h){Object.defineProperty(o,c,{writable:!1,configurable:!1,value:h})}return vl}var bl,np;function GC(){if(np)return bl;np=1;function s(){this._subscribers={}}return s.prototype.subscribe=function(e,t,n){this.isHandlerAttached(e,t)||this.get(t).push({handler:e,context:n,eventName:t})},s.prototype.unsubscribe=function(e,t){this._subscribers[t]=this.get(t).filter(function(n){return e!==n.handler})},s.prototype.unsubscribeAll=function(){this._subscribers={}},s.prototype.trigger=function(e,t){var n=this,r=this.get(e).concat(this.get("*"));r.forEach(function(i){setTimeout(function(){n.isHandlerAttached(i.handler,i.eventName)&&i.handler.call(i.context,t)},0)})},s.prototype.triggerSync=function(e,t){var n=this.get(e).concat(this.get("*"));n.forEach(function(r){r.handler.call(r.context,t)})},s.prototype.get=function(e){return this._subscribers[e]||(this._subscribers[e]=[]),this._subscribers[e]},s.prototype.isHandlerAttached=function(e,t){return this.get(t).some(function(n){return e===n.handler})},bl=s,bl}var Tl,rp;function XC(){if(rp)return Tl;rp=1;var s=zC(),e=GC(),t=s.checkVPAIDInterface,n=gy;s.METHODS;var r="AdError",i="AdClickThru",a=s.EVENTS.filter(function(T){return T!=i});function o(T,S,w,b){this._isValid=t(T),this._isValid&&(this._creative=T,this._el=S,this._videoEl=w,this._iframe=b,this._subscribers=new e,n.setFullSizeStyle(S),c.call(this))}o.prototype=Object.create(s.prototype),o.prototype.isValidVPAIDAd=function(){return this._isValid},s.METHODS.forEach(function(T){var S=["subscribe","unsubscribe","initAd"];S.indexOf(T)===-1&&(o.prototype[T]=function(){var w=s.prototype[T].length,b=Array.prototype.slice.call(arguments),R=w===b.length?b.pop():void 0;setTimeout((function(){var L,U=null;try{L=this._creative[T].apply(this._creative,b)}catch(M){U=M}_(R,this._subscribers,U,L)}).bind(this),0)})}),o.prototype.initAd=function(T,S,w,b,R,L,U){R=R||{},L=n.extend({slot:this._el,videoSlot:this._videoEl},L||{}),setTimeout((function(){var M;try{this._creative.initAd(T,S,w,b,R,L)}catch(F){M=F}_(U,this._subscribers,M)}).bind(this),0)},o.prototype.subscribe=function(T,S,w){this._subscribers.subscribe(S,T,w)},o.prototype.unsubscribe=function(T,S){this._subscribers.unsubscribe(S,T)},o.prototype.on=o.prototype.subscribe,o.prototype.off=o.prototype.unsubscribe,s.GETTERS.forEach(function(T){o.prototype[T]=function(S){setTimeout((function(){var w,b=null;try{w=this._creative[T]()}catch(R){b=R}_(S,this._subscribers,b,w)}).bind(this),0)}}),o.prototype.setAdVolume=function(T,S){setTimeout((function(){var w,b=null;try{this._creative.setAdVolume(T),w=this._creative.getAdVolume()}catch(R){b=R}b||(b=n.validate(w===T,"failed to apply volume: "+T)),_(S,this._subscribers,b,w)}).bind(this),0)},o.prototype._destroy=function(){this.stopAd(),this._subscribers.unsubscribeAll()};function c(){if(a.forEach((function(w){this._creative.subscribe(m.bind(this,w),w)}).bind(this)),this._creative.subscribe(h.bind(this),i),this._videoEl){var T=this._iframe.contentDocument.documentElement,S=this._videoEl;T.addEventListener("click",function(w){w.target===T&&S.click()})}}function h(T,S,w){this._subscribers.triggerSync(i,{url:T,id:S,playerHandles:w})}function m(T){this._subscribers.trigger(T,Array.prototype.slice(arguments,1))}function _(T,S,w,b){T?T(w,b):w&&S.trigger(r,w)}return Tl=o,Tl}var Vs=gy,YC=Vs.unique("vpaidIframe"),KC=XC(),QC=`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"></head><body style="margin:0;padding:0"><div class="ad-element"></div><script type="text/javascript" src="{{iframeURL_JS}}"><\/script><script type="text/javascript">window.parent.postMessage('{"event": "ready", "id": "{{iframeID}}"}', '{{origin}}');<\/script></body></html>`,ZC="AdStopped";function yr(s,e,t,n){t=t||{},this._id=YC(),this._destroyed=!1,this._frameContainer=Vs.createElementInEl(s,"div"),this._videoEl=e,this._vpaidOptions=n||{timeout:1e4},this._templateConfig={template:t.template||QC,extraOptions:t.extraOptions||{}}}yr.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,ud.call(this))};yr.prototype.isDestroyed=function(){return this._destroyed};yr.prototype.loadAdUnit=function(s,e){s2.call(this),ud.call(this);var t=this,n=Vs.createIframeWithContent(this._frameContainer,this._templateConfig.template,Vs.extend({iframeURL_JS:s,iframeID:this.getID(),origin:ip()},this._templateConfig.extraOptions));this._frame=n,this._onLoad=Vs.callbackTimeout(this._vpaidOptions.timeout,r.bind(this),i.bind(this)),window.addEventListener("message",this._onLoad);function r(a){if(a.origin===ip()){var o=JSON.parse(a.data);if(o.id===t.getID()){var c,h,m;if(t._frame.contentWindow?(m=t._frame.contentWindow.getVPAIDAd,h=Vs.validate(typeof m=="function","the ad didn't return a function to create an ad")):h="the iframe is not anymore in the DOM tree",!h){var _=t._frame.contentWindow.document.querySelector(".ad-element");c=new KC(m(),_,t._videoEl,t._frame),c.subscribe(ZC,e2.bind(t)),h=Vs.validate(c.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}return t._adUnit=c,_y.call(t),e(h,h?null:c),!0}}}function i(){e("timeout",null)}};yr.prototype.unloadAdUnit=function(){ud.call(this)};yr.prototype.getID=function(){return this._id};function JC(s){var e=this[s];e&&(e.remove(),delete this[s])}function e2(){yy.call(this),delete this._adUnit}function ud(){yy.call(this),t2.call(this)}function yy(){JC.call(this,"_frame"),_y.call(this)}function _y(){this._onLoad&&(window.removeEventListener("message",this._onLoad),Vs.clearCallbackTimeout(this._onLoad),delete this._onLoad)}function t2(){this._adUnit&&(this._adUnit.stopAd(),delete this._adUnit)}function s2(){if(this._destroyed)throw new Error("VPAIDHTML5Client already destroyed!")}function ip(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}var n2=yr;const r2=or(n2);function Gn(s){if(s){console.log("vastTracker",{...s});const e=s.ad,t=s.creative;return{mediaFiles:t.mediaFiles.map(n=>Object.assign({},n)),adSequenceId:e.sequence,adId:e.id,creativeAdId:t.id,skippable:s.skippable,skipDelay:s.skipDelay,hasAdUrl:!!t.videoClickThroughURLTemplate.url}}}const i2=["application/x-javascript","text/javascript","application/javascript"];var nn,Fs,Qr,_a,va,Zr;class a2{constructor(e,t){it(this,nn),it(this,Fs),it(this,Qr),it(this,_a),it(this,va),it(this,Zr),Ke(this,_a,e),Ke(this,va,t),Ke(this,Zr,new P.EventTarget)}handle(e){return Ke(this,Fs,!1),Ke(this,Qr,!1),Ke(this,nn,!1),new Promise((t,n)=>{const r=Ae(this,va),i=Ae(this,_a);let a=null;const o=(T,S)=>{if(T){n(T);return}const w=()=>{R(),t(),i.trigger("vpaid.AdStopped"),i.trigger({type:"vast.adEnd",vast:Gn(e)})};S.subscribe("AdStopped",w);const b=N=>{if(S&&!Ae(this,nn)){S.unsubscribe("AdStopped",w);const j=()=>{Ke(this,nn,!0),R(),n(N),i.trigger("vpaid.AdStopped")};Al(S,"AdStopped",j,j),S.stopAd()}else Ke(this,nn,!0),n(N)};if(Ae(this,Zr).on("forceStopAd",b),Ae(this,Fs)){b("Received cancel signal from player");return}function R(){i.controlBar.show(),i.off("playerresize",F),_.destroy(),a&&(a.parentElement.removeChild(a),a=null)}const L=(N,j)=>{var J;if(N){log.console(N),b("Error on VPAID handshake");return}const K={AdParameters:c.adParameters||"",Duration:c.duration||30,SkipTime:r.skip,ClickURL:((J=c.videoClickThroughURLTemplate)==null?void 0:J.url)||"about:blank",All:c,Options:r},ne={};Al(S,"AdLoaded",U,b);const he=i.isFullscreen()?"fullscreen":"normal";S.subscribe("AdError",oe=>{e.error({ERRORCODE:901}),Ke(this,nn,!0),R(),n(`Fatal VPAID Error: ${typeof oe=="object"?JSON.stringify(oe):oe}`),i.trigger({type:"vpaid.AdError",error:oe})}),S.initAd(i.currentWidth(),i.currentHeight(),he,-1,K,ne)},U=()=>{if(Ae(this,Fs)){b("Received cancel signal");return}S.subscribe("AdSkipped",()=>{e.skip(),i.trigger("vpaid.AdSkipped"),i.trigger({type:"vast.adSkip",vast:Gn(e)})}),S.subscribe("AdVolumeChange",()=>{const j=i.volume();S.getAdVolume((J,K)=>{J||(K===0&&j>0?e.setMuted(!0):K>0&&j===0&&e.setMuted(!1),i.volume(K),i.trigger("vpaid.AdVolumeChange"))})}),S.subscribe("AdImpression",()=>{e.trackImpression(),i.trigger("vpaid.AdImpression")}),S.subscribe("AdClickThru",({url:j,id:J,playerHandles:K})=>{K||e.once("clickthrough",ne=>{window.open(ne,"_blank")}),e.click(j),i.trigger("vpaid.AdClickThru")}),S.subscribe("AdVideoFirstQuartile",()=>{e.track("firstQuartile"),i.trigger("vpaid.AdVideoFirstQuartile")}),S.subscribe("AdVideoMidpoint",()=>{e.track("midpoint"),i.trigger("vpaid.AdVideoMidpoint")}),S.subscribe("AdVideoThirdQuartile",()=>{e.track("thirdQuartile"),i.trigger("vpaid.AdVideoThirdQuartile")}),S.subscribe("AdVideoComplete",()=>{e.track("complete"),i.trigger("vpaid.AdVideoComplete")}),S.subscribe("AdUserAcceptInvitation",()=>{e.acceptInvitation(),i.trigger("vpaid.AdUserAcceptInvitation")}),S.subscribe("AdUserMinimize",()=>{e.minimize(),i.trigger("vpaid.AdUserMinimize")}),S.subscribe("AdUserClose",()=>{e.close(),i.trigger("vpaid.AdUserClose")}),S.subscribe("AdPaused",()=>{e.setPaused(!0),i.trigger("vpaid.AdPaused")}),S.subscribe("AdPlaying",()=>{e.setPaused(!1),i.trigger("vpaid.AdPlaying")}),S.getAdLinear(vy((j,J)=>{if(Ae(this,Fs)){b("Received cancel signal");return}j?b(j):J?N():b("Non-linear not supported")},()=>{b("Unable to get mode of operation: linear or non-linear")}));const N=()=>{i.controlBar.hide();const j=ly(M);Al(S,"AdStarted",j,b),S.startAd()}},M=()=>{Ae(this,Fs)?b("Received cancel signal"):(Ke(this,Qr,!0),e.track("start"),i.on("playerresize",F),i.trigger("ads-ad-started"),i.trigger({type:"vast.adStart",vast:Gn(e)}))},F=()=>{S.resizeAd(i.currentWidth(),i.currentHeight(),i.isFullscreen()?"fullscreen":"normal")};S.handshakeVersion("2.0",L)},c=e.creative,h=c.mediaFiles.find(T=>T.apiFramework==="VPAID"&&l2(T));if(!h)throw new Error("Invalid VPAID media file: only JavaScript is supported");a=c2(r),i.el().insertBefore(a,i.controlBar.el());const m=o2(i,r),_=new r2(a,m,{});_.loadAdUnit(h.fileURL,o)})}cancel(){Ke(this,Fs,!0),Ae(this,Qr)&&Ae(this,Zr).trigger("forceStopAd")}}nn=new WeakMap,Fs=new WeakMap,Qr=new WeakMap,_a=new WeakMap,va=new WeakMap,Zr=new WeakMap;function o2(s,e){const t=e.vpaid.videoInstance;let n;return t==="none"?n=null:(t!=="same"&&console.log(`${t} is an invalid videoInstance value. Defaulting to 'same'.`),n=s.tech({kindaKnowWhatImDoing:!0}).el(),n==null&&console.log("Unable to find the video element for VPAID.")),n}function l2(s){return i2.indexOf(s.mimeType.trim())>-1}function c2(s){const e=s.vpaid.containerClass,t=document.createElement("div");return e&&t.classList.add(e),t}function vy(s,e=null){const t=setTimeout(()=>{s=()=>{},e&&e()},1e4);return function(){clearTimeout(t),s.apply(null,arguments)}}function Al(s,e,t,n){const r=vy(t,()=>{n&&n(new Error(`Timeout while waiting for ${e} event.`))});s.subscribe(e,r)}const d2=P.getPlugin("plugin"),u2=Object.freeze({seekEnabled:!1,controlsEnabled:!1,wrapperLimit:10,withCredentials:!0,skip:0,autoplay:!0,muted:!1,displaySkipBtn:!0,displayRemainingTime:!1,displayRemainingTimeIcons:!1,messages:{skip:"Skip",skipCountdown:"Skip in {seconds}...",remainingTime:"This ad will end in {seconds}"},vpaid:{containerClass:"vjs-vpaid-container",videoInstance:"none"},companion:{elementId:null,maxWidth:0,maxHeight:0},honorSkipOffset:!1});class h2 extends d2{constructor(e,t){super(e),typeof e.ads=="function"&&e.ads({debug:!0,stitchedAds:!0,liveCuePoints:!1}),t=(parseInt(P.VERSION,10)>=8?P.obj.merge:P.mergeOptions)(u2,t||{});const n=new PC,r=[];let i=null,a=0,o=0;const c=new a2(e,t);let h=!1,m=t.schedule;m==null||m.length===0?m=[{offset:0,url:t.url||null,xml:t.xml||null}]:(m=OC(m),m.forEach(z=>delete z.offsetInSeconds));const _=oe(m),T=me(m),S=te(m).sort((z,G)=>z.offset-G.offset);e.on("adtimeout",()=>{console.log("Ad timeout"),h=!0});const w=new RC(e,t);function b(){i!=null&&i.hasVideoMedia()&&(i.linearAdTracker.skip(),e.trigger({type:"vast.skipAd",vast:Gn(i.linearAdTracker)}),F())}this.skipAd=b,w.on("skip",b),w.on("click",()=>{!e.paused()&&!t.autoplay&&e.pause()}),this.adAction=()=>{i.linearAdTracker.click()};const R=(()=>{let z=!1;return()=>{if(z)return;let G=null;for(;S.length>0&&(G=S[0].offsetInSeconds,G==null);){const{offset:fe}=S[0];G=MC(fe,e.duration()),G==null?S.shift():S[0].offsetInSeconds=G}if(G!=null&&this.player.currentTime()>G){z=!0;const fe=S.shift();U.loadAds(fe).then(ye=>{ye.length>0&&(r.push(...ye),i=null,K())}).catch(ye=>{console.log(`An error occurred when loading ads for the midroll ad break: : ${ye==null?void 0:ye.message}`)}).finally(()=>{z=!1})}}})();S.length>0&&e.on("timeupdate",R),e.on("readyforpostroll",()=>{h=!1,U.loadAds(T).then(z=>{h?z.forEach(G=>{G.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,K()):e.trigger("nopostroll")}).catch(z=>{console.log(`An error occurred when loading ads for the postroll ad break: : ${z.message}`),e.trigger("nopostroll")})}),e.on("readyforpreroll",()=>{K()});const L=ly(()=>{e.trigger("adsready")});setTimeout(L,3e3);const U=new BC(n,new ay,new FC,t);U.loadAds(_).then(z=>{console.log("trackedAds",z),h?z.forEach(G=>{G.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,L(),i||K()):e.trigger("nopreroll")}).catch(z=>{console.log(`An error occurred when loading ads for the preroll ad break: ${z.message}`),e.trigger("nopreroll")});const M=z=>z.filter(G=>G.apiFramework==null).map(G=>({type:G.mimeType,src:G.fileURL})),F=()=>{const z=r.shift();if(z!=null&&z.hasVideoMedia()?i!=null&&i.hasVideoMedia()||w.setUp():i!=null&&i.hasVideoMedia()&&w.tearDown(),z){if(i=z,a++,console.log(`Playing ad ${a}/${o}`),i.hasVideoMedia()){const G=i.linearCreative.mediaFiles,fe=G.filter(Oe=>Oe.deliveryType==="streaming"),ye=G.filter(Oe=>Oe.deliveryType!=="streaming");if(ye.length>0)e.src(M(ye));else if(fe.length>0){let Oe=i.linearAdTracker.assetDuration;if(Oe==null||Oe<1){console.log("Streaming ads must have a duration"),F();return}e.src(M(fe)),i.skipAfterDuration=!0}w.duration=i.linearAdTracker.assetDuration||0;const Pe=i.linearAdTracker.skipDelay;w.skipDelay=Pe!=null&&t.honorSkipOffset?Pe:t.skip,t.autoplay&&e.play(),t.muted&&e.muted(!0)}else c.handle(i.linearAdTracker).then(()=>{F()}).catch(G=>{console.log(G),F()});J()}else i=null,a=0,ue()},{setUpEvents:N,tearDownEvents:j}=(()=>{const z=()=>{if(i.skipAfterDuration){const st=i;setTimeout(()=>{i===st&&b()},st.linearAdTracker.assetDuration*1e3)}!i.linearAdTracker.impressed&&i.hasVideoMedia()&&(i.linearAdTracker.trackImpression(),e.trigger({type:"vast.adStart",vast:Gn(i.linearAdTracker),adCount:a,adTotal:o,skipDelay:w.skipDelay}))},G=()=>{i&&(isNaN(i.linearAdTracker.assetDuration)&&(i.linearAdTracker.assetDuration=e.duration()),i.linearAdTracker.setProgress(e.currentTime()))},fe=()=>{e.remainingTime()>0&&(i.linearAdTracker.setPaused(!0),e.one("adplay",()=>{i.linearAdTracker.setPaused(!1)}))},ye=()=>{i.linearAdTracker.error({ERRORCODE:405}),e.error(null),F()},Pe=()=>{i.linearAdTracker.setFullscreen(e.isFullscreen())},Oe=(()=>{let st=e.muted(),ut=e.volume();return()=>{const be=e.volume(),Re=e.muted();st!==Re?(i.linearAdTracker.setMuted(Re),st=Re):ut!==be&&(ut>0&&be===0?i.linearAdTracker.setMuted(!0):ut===0&&be>0&&i.linearAdTracker.setMuted(!1),ut=be)}})(),tt=()=>{i.hasVideoMedia()&&(i.linearAdTracker.complete(),e.trigger({type:"vast.adEnd",vast:Gn(i.linearAdTracker)}),F())};return{setUpEvents:()=>{e.on("adended",tt),e.on("adplay",z),e.on("adtimeupdate",G),e.on("adpause",fe),e.on("aderror",ye),e.on("advolumechange",Oe),e.on("fullscreenchange",Pe)},tearDownEvents:()=>{e.off("adended",tt),e.off("adplay",z),e.off("adtimeupdate",G),e.off("adpause",fe),e.off("aderror",ye),e.off("advolumechange",Oe),e.off("fullscreenchange",Pe)}}})(),J=()=>{const z=i.companionTracker,G=document.getElementById(t.companion.elementId);if(z&&z.variation&&G){const fe=z.variation,ye=()=>{z.click()},Pe=document.createElement("a");Pe.src="#",Pe.addEventListener("click",ye);const Oe=document.createElement("img");Oe.src=fe.staticResource,Pe.appendChild(Oe),G.innerHTML="",G.appendChild(Pe)}else G&&(G.innerHTML="")},K=()=>{o=r.length,console.log(`Playing ${o} ads`),e.ads.startLinearAdMode(),N(),F()};function ne(z){return z.offset===0||z.offset==null||z.offset==="pre"}function he(z){return z.offset==="post"}function oe(z){return z.find(ne)}function me(z){return z.find(he)}function te(z){return z.filter(G=>!ne(G)&&!he(G))}const ue=()=>{e.ads.endLinearAdMode(),j()}}}P.registerPlugin("vast",h2);const p2=Z.styled_default("div")({name:"Container",class:"c4q6dw1",propsAsIs:!1}),m2=Z.styled_default("div")({name:"ControlsContainer",class:"c1la67r",propsAsIs:!1}),ap="m3guev",op="m7099mt",lp="mmm6o5s",f2=({promotion:s,controlVideo:e,onClose:t,promotionId:n,externalAd:r,skipAutoClose:i})=>{var a,o,c,h,m;const _=Ye.useRef(null),T=Ye.useRef(),S=Ye.useRef(),[w,b]=Ye.useState(!0),[R,L]=Ye.useState(!0),[U,M]=Ye.useState(!1),[F,N]=Ye.useState(0),[j,J]=Ye.useState(0),[K,ne]=Ye.useState(0),[he,oe]=Ye.useState(0),me=Ye.useCallback(()=>{T.current&&(T.current.dispose(),T.current=void 0)},[]),te=Ye.useCallback(()=>{N(0),J(0),ne(0),b(!1),e==null||e({muted:!1}),me(),S.current=void 0,T.current=void 0,_.current&&(_.current.innerHTML="")},[e,me]);Ye.useEffect(()=>{if(r!=null&&r.url&&_.current){b(!0);const z=document.createElement("video");z.classList.add("video-js","vjs-default-skin"),_.current.appendChild(z),T.current=P(z,{controls:!1,playsinline:!0}),T.current.on("pause",()=>{L(!0)}),T.current.on("play",()=>{L(!1)}),T.current.on("vast.play",G=>{console.log("Ad is playing",G)}),T.current.on("timeupdate",G=>{N(Math.round(G.target.player.duration()-G.target.player.currentTime()))}),T.current.on("vast.adStart",G=>{console.log("Ad is start",G),b(!0),ne(G.adCount),J(G.adTotal),oe(G.skipDelay),M(G.vast.hasAdUrl)}),T.current.on("nopreroll",G=>{console.log("Ad is nopreroll",G)}),T.current.on("nopostroll",G=>{console.log("Ad is nopostroll",G)}),T.current.on("vast.adEnd",G=>{console.log("Ad is end",G),b(!1),t==null||t()}),T.current.on("vast.skipAd",G=>{console.log("Ad is skip",G),te(),t==null||t()}),uk(_.current,r==null?void 0:r.url)().then(G=>{G&&T.current?S.current=T.current.vast({url:G.toString(),honorSkipOffset:!0,displayRemainingTimeIcons:!0,displaySkipBtn:!1,withCredentials:!0,autoplay:G.searchParams.get("vpa")!=="click",muted:G.searchParams.get("vpmute")==="1"}):te()}).catch(G=>{console.log("error",G),te()})}return te},[r==null?void 0:r.url,me,te]);const ue=((a=s.sponsor)==null?void 0:a.logo)&&s.logoMode===ge.PromotionLogoMode.CENTER;return X.jsxs(hp,{className:"PromoOverlay",children:[X.jsxs(pp,{children:[X.jsx(mp,{className:Z.cx_default(!ue&&fp),children:X.jsx(yp,{style:{transform:"scale(1.5)"},children:"Ad"})}),X.jsxs(m2,{children:[X.jsx(qb,{time:F,adCount:j,adPosition:K}),!!he&&w&&X.jsx(Z.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{var z;(z=S.current)==null||z.skipAd()},duration:he,isPlaying:!R,skipIcon:!0}),i&&X.jsx(Z.y$1,{className:"ClosePromoIcon",close:()=>{te(),t==null||t()}})]})]}),X.jsx(gp,{className:Z.cx_default(ap,w&&op,!w&&lp),children:X.jsx(p2,{ref:_})}),U&&X.jsx(_p,{className:Z.cx_default(ap,w&&op,!w&&lp),children:X.jsx(vp,{as:"button",onClick:()=>{var z;(z=S.current)==null||z.adAction()},style:{backgroundColor:((c=(o=s.banner)==null?void 0:o.ctaButton)==null?void 0:c.color)||"#009dc4",color:((m=(h=s.banner)==null?void 0:h.ctaButton)==null?void 0:m.textColor)||"#fff"},"data-analytics":"button","data-promo-id":n,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},cp=s=>{var e,t,n,r,i,a,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,K,ne,he,oe,me,te,ue;const{promotion:z,open:G,advertisementPaused:fe,togglePause:ye,controlVideo:Pe,skipAutoClose:Oe,promotionId:tt,onClose:st,markAsViewed:ut,externalAd:be}=s,Re=z.type===ge.PromotionType.INGAME_IAB11_LBAR||z.type===ge.PromotionType.INGAME_IAB11,ps=((e=z.sponsor)==null?void 0:e.logo)&&z.logoMode===ge.PromotionLogoMode.CENTER,Gs=!!((n=(t=z.banner)==null?void 0:t.video)!=null&&n.url),ms=z.autoPlayVideo===ge.AutoPlayVideo.ENABLED;if(Ye.useEffect(()=>{ye==null||ye(Gs||ms),G==null||G()},[]),Ye.useEffect(()=>{tt&&z.type&&ut&&ut()},[tt,z.type,ut]),Ye.useEffect(()=>()=>{Pe==null||Pe({muted:!1})},[Pe]),be)return X.jsx(f2,{...s,externalAd:be});let Gt=(r=z.banner)==null?void 0:r.url;Gt&&Gt.indexOf("http")!==0&&(Gt=`https://${Gt}`);let Cs=!0;return Gs&&(!fe||!ms?Cs=!0:Cs=!1),X.jsxs(hp,{className:"PromoOverlay",children:[X.jsxs(pp,{children:[X.jsxs(mp,{className:Z.cx_default(!ps&&fp),children:[((i=z.sponsor)==null?void 0:i.logo)&&z.logoMode===ge.PromotionLogoMode.LEFT&&X.jsx(nu,{className:"PromoSponsorLogo",src:(a=z.sponsor)==null?void 0:a.logo,alt:"promo"}),X.jsxs(Nb,{style:{paddingLeft:(o=z.sponsor)!=null&&o.logo&&z.logoMode===ge.PromotionLogoMode.LEFT?"0px":"8px"},children:[((c=z.sponsor)==null?void 0:c.logo)&&z.logoMode===ge.PromotionLogoMode.LEFT&&X.jsx(Lb,{children:(h=z.sponsor)==null?void 0:h.name}),X.jsxs(Ob,{className:"SponsorText",children:[X.jsx(yp,{children:"AD"}),X.jsx(Mb,{children:"SPONSORED"})]})]})]}),X.jsx(Z.y$1,{className:"ClosePromoIcon",close:st,autoClose:(m=z.closeTimer)==null?void 0:m.auto,duration:Oe?0:(_=z.closeTimer)==null?void 0:_.seconds,isPlaying:Cs})]}),X.jsxs(gp,{children:[ps&&X.jsx(nu,{className:Rb,src:(T=z.sponsor)==null?void 0:T.logo,alt:"promo"}),X.jsx(ru,{children:(w=(S=z.banner)==null?void 0:S.video)!=null&&w.url?X.jsx(Z.Y,{source:(R=(b=z.banner)==null?void 0:b.video)==null?void 0:R.url,poster:(U=(L=z.banner)==null?void 0:L.video)==null?void 0:U.thumbnailUrl,aspectRatio:Re?"1/1":"16/9",onPause:()=>{ms&&(ye==null||ye(!0))},onPlay:()=>{Z.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:tt,type:z.type}}),ye==null||ye(!1)},controlVideo:Pe,autoPlay:ms}):(M=z.banner)!=null&&M.imageUrl?X.jsx(Pb,{style:Re?{aspectRatio:"1/1"}:{},src:(F=z.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Re&&X.jsxs(ru,{children:[((N=z.banner)==null?void 0:N.title)&&X.jsx(Ub,{className:Z.cx_default("AdvTitle",ps&&Bb),children:(j=z.banner)==null?void 0:j.title}),((J=z.banner)==null?void 0:J.body)&&X.jsx(Db,{className:"AdvDescription",children:(K=z.banner)==null?void 0:K.body})]})]}),z.buttonType!==ge.PromotionButtonType.NO_BUTTON&&X.jsx(_p,{children:X.jsx(vp,{href:Gt,style:{backgroundColor:((he=(ne=z.banner)==null?void 0:ne.ctaButton)==null?void 0:he.color)||"#009dc4",color:((me=(oe=z.banner)==null?void 0:oe.ctaButton)==null?void 0:me.textColor)||"#fff"},"data-analytics":"button","data-promo-id":tt,"data-promo-type":z.type,target:"_blank",children:(ue=(te=z.banner)==null?void 0:te.ctaButton)==null?void 0:ue.label})})]})},g2=Z.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),y2=({children:s,direction:e,style:t,className:n,hiding:r})=>X.jsx(rc,{direction:e,style:t,hiding:r,className:n,children:X.jsx(g2,{children:s})}),_2=s=>(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB11_LBAR||(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB21_LBAR,v2=s=>(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB11||(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB21,b2=({advertisement:s,close:e,skipTypeCheck:t,skipAutoClose:n,layoutMode:r="side-by-side",sidebar:i,isNotification:a,banner:o,markAsViewed:c,open:h,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})=>s.promotion?a&&s.notification?X.jsx(Ib,{open:()=>h==null?void 0:h({fromNotification:!0}),notification:s.notification,promotionId:s.question.id}):!i&&!o&&(t||v2(s.promotion))?X.jsx(xb,{className:"PromoOverlayContainer",children:X.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,onClose:e,open:h,skipAutoClose:n,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})}):i&&(t||_2(s.promotion))?X.jsx(y2,{className:"PromoSidebarContainer",direction:i,hiding:!1,children:X.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,externalAd:m,onClose:e,open:h,controlVideo:_,skipAutoClose:n,advertisementPaused:T,togglePause:S})}):o?X.jsx(zv,{promotionId:s.question.id,hiding:!1,promotion:s.promotion,direction:o}):null:null,T2=Z.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),A2=s=>{const e=s.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",n=e.getAttribute("data-promo-type")||ge.PromotionType.UNSET;e.getAttribute("data-analytics")==="button"&&Z.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:n}}),e.getAttribute("data-analytics")==="banner"&&Z.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:n}})}},S2=({gamification:s,layoutMode:e,skipAutoClose:t,skipTypeCheck:n,sidebar:r,banner:i,notification:a,isMobileScreen:o,persistent:c,externalAd:h,controlVideo:m})=>{var _,T,S;const w=Ye.useRef(null),b=Z.useStore(s.advertisement.$store);Z.y(w,{enabled:!!b.data,event:"click",listener:A2});const R=!i&&!r;if(b.data===void 0||!c&&b.isViewed)return null;const L=((S=(T=(_=b==null?void 0:b.data)==null?void 0:_.notification)==null?void 0:T.promotion)==null?void 0:S.mode)===ge.NotificationPromotionMode.LOWER_THIRD;return X.jsx(T2,{ref:w,style:{height:R?"auto":"100%"},className:Z.cx_default("SL-AdvertisementUIWrap",o&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:X.jsx(b2,{skipTypeCheck:n,sidebar:r,banner:i,advertisement:b.data,advertisementPaused:b.isPaused,togglePause:b.togglePause,close:b.close,externalAd:h?b.externalAd:void 0,markAsViewed:s.advertisement.markAsViewed,open:s.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:m})})},by=({sdk:s,sidebar:e,externalAd:t,banner:n,skipAutoClose:r,skipTypeCheck:i,layoutMode:a,isMobileScreen:o,persistent:c,notification:h})=>{const m=Z.useStore(s.featuresList.getStore()),[_,T]=Ye.useState(!t);if(Ye.useEffect(()=>{if(t){const w=document.createElement("script");w.async=!0,w.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(w),w.onload=()=>{T(!0)}}},[t]),e&&n)return X.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(n&&t)return X.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!m)return null;const S=s.getFeature(ge.SdkOverlayType.GAMES);return!S||t&&!_?null:X.jsx(S2,{gamification:S,sidebar:e,banner:n,layoutMode:a,isMobileScreen:o,persistent:c,notification:h,skipTypeCheck:i,skipAutoClose:r,externalAd:t,controlVideo:s.controlVideoPlayer})},E2=({event:s,sidebar:e,banner:t,isMobileScreen:n,skipAutoClose:r,persistent:i,theme:a,notification:o,skipTypeCheck:c,externalAd:h})=>{const m=Z.useStreamLayer(),_=Z.useStreamLayerUI(),T=Z.useStreamLayerTheme();return m?h&&!_.promotionExternalAd?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):!h&&_.promotionExternalAd?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):e&&!_.promotionSidebar?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):t&&!_.promotionBanner?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):o&&!_.promotionNotification?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):!t&&!e&&!o&&!_.promotionOverlay?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):X.jsxs("div",{className:"StreamLayerSDK",children:[X.jsx(Z.h,{customTheme:a??T.theme,themeMode:T.themeMode,children:X.jsx(by,{sdk:m,sidebar:e,banner:t,isMobileScreen:n,persistent:i,notification:o,skipTypeCheck:c,skipAutoClose:r,layoutMode:"side-by-side",externalAd:h})}),s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s})]}):null};exports.StreamLayerSDKAdvertisement=E2;exports.StreamLayerSDKAdvertisementUI=by;
|
|
220
|
+
`.split("").map(i=>i.charCodeAt(0)));class jw extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class qw extends fl{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 it();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return it([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=ma(e);let n=this.initSegments_[r];if(t&&!n&&e.bytes){const s=oh.byteLength+e.bytes.byteLength,a=new Uint8Array(s);a.set(e.bytes),a.set(oh,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){xn(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===ti.TIMEOUT&&this.handleTimeout_(),e.code===ti.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)}),Ew(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],g=u[1];a[p]=isNaN(g)?g:Number(g)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof x.WebVTT!="function")throw new jw;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=ah(a)),n.parse(a)}let s=e.bytes;r&&(s=ah(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/Yi.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(u=>{const p=u.endTime-u.startTime,g=this.handleRollover_(u.startTime+l,t.time);u.startTime=Math.max(g,0),u.endTime=Math.max(g+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*Yi.ONE_SECOND_IN_TS;const n=t*Yi.ONE_SECOND_IN_TS;let s;for(n<r?s=-8589934592:s=8589934592;Math.abs(r-n)>4294967296;)r+=s;return r/Yi.ONE_SECOND_IN_TS}}const $w=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},Vw=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=$w(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 lh{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 Hw{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 Wm{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 g=this.storage_.get(l),b=a,S=b+u.duration,w=!!(g&&g.segmentSyncInfo&&g.segmentSyncInfo.isAppended),C=new lh({start:b,end:S,appended:w,segmentIndex:p});u.syncInfo=C;let v=a;const D=(u.parts||[]).map((L,O)=>{const U=v,F=v+L.duration,N=!!(g&&g.partsSyncInfo&&g.partsSyncInfo[O]&&g.partsSyncInfo[O].isAppended),V=new lh({start:U,end:F,appended:N,segmentIndex:p,partIndex:O});return v=F,s+=`Media Sequence: ${l}.${O} | Range: ${U} --> ${F} | Appended: ${N}
|
|
222
|
+
`,L.syncInfo=V,V});n.set(l,new Hw(C,D)),s+=`${$m(u.resolvedUri)} | Media Sequence: ${l} | Range: ${b} --> ${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 uh extends Wm{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 zw=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 Ww extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Wm,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>zw){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 Gw 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 Xw=Lm(Dm(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 re,he,le,pe,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^=re||1,V=Y[V]||1)for(pe=V^V<<1^V<<2^V<<3^V<<4,pe=pe>>8^pe&255^99,O[N]=pe,U[pe]=N,le=J[he=J[re=J[N]]],ce=le*16843009^he*65537^re*257^N*16843008,ee=J[pe]*257^pe*16843008,F=0;F<4;F++)D[F][N]=ee=ee<<24^ee>>>8,L[F][pe]=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),re=[];for(this._key=[Y,re],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?re[O]=U:re[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],re=O^V[2],he=L^V[3],le,pe,ee;const ce=V.length/4-2;let ne,de=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[re>>8&255]^ht[he&255]^V[de],pe=ze[Y>>>24]^dt[re>>16&255]^Ot[he>>8&255]^ht[J&255]^V[de+1],ee=ze[re>>>24]^dt[he>>16&255]^Ot[J>>8&255]^ht[Y&255]^V[de+2],he=ze[he>>>24]^dt[J>>16&255]^Ot[Y>>8&255]^ht[re&255]^V[de+3],de+=4,J=le,Y=pe,re=ee;for(ne=0;ne<4;ne++)F[(3&-ne)+N]=Ut[J>>>24]<<24^Ut[Y>>16&255]<<16^Ut[re>>8&255]<<8^Ut[he&255]^V[de++],le=J,J=Y,Y=re,re=he,he=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,re,he,le,pe,ee,ce;for(V=L[0],J=L[1],Y=L[2],re=L[3],ce=0;ce<O.length;ce+=4)he=a(O[ce]),le=a(O[ce+1]),pe=a(O[ce+2]),ee=a(O[ce+3]),U.decrypt(he,le,pe,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]^re),V=he,J=le,Y=pe,re=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 Kw=xm(Xw);const Yw=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Gm=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},_l=(i,e)=>{e.activePlaylistLoader=i,i.load()},Qw=(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,Gm(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),_l(a.playlistLoader,n)}},Jw=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},Zw=(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,Gm(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))}},e2={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:Yw(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}}}}},Xm=(i,e)=>{for(let t=0;t<i.length;t++)if(Eu(e,i[t])||i[t].playlists&&Xm(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&&ts(e.main))for(let u=0;u<l.length;u++){const p=n[l[u]];if(Xm(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},i2={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}},r2=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},n2=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(p=>{e2[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=i2[p](p,i),e[p].onGroupChanged=Qw(p,i),e[p].onGroupChanging=Jw(p,i),e[p].onTrackChanged=Zw(p,i),e[p].getActiveGroup=r2(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])},s2=()=>{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 a2 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 o2=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},l2=10;let Pi;const u2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],c2=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 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 h2 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=o2(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_=s2(),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 Ww(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Kw,this.sourceUpdater_=new zm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Gw,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 qw(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 a2(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_())),u2.forEach(F=>{this[F+"_"]=c2.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()),n2({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 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:l2}))});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 [${sm(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||iT),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)),Vw(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_),Sw({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_),bw({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:Fw(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 p2=(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 g2{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=p2(e.playlists,t.id,s)}}const m2=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 g2(i,r,r.id)):[]}},hh=["seeking","seeked","pause","playing","error"];class f2 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=eE(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 ${sm(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=QS(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 y2={errorInterval:30,getSource(i){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(e)}},Km=function(i,e){let t=0,r=0;const n=fe(y2,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(),Km(i,g)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=p},_2=function(i){Km(this,i)};var Ym="3.16.2",b2="7.1.0",v2="1.3.1",T2="7.2.0",S2="4.0.2";const Ne={PlaylistLoader:Er,Playlist:_t,utils:wE,STANDARD_PLAYLIST_SELECTOR:eh,INITIAL_PLAYLIST_SELECTOR:gw,lastBandwidthSelector:eh,movingAverageBandwidthSelector:hw,comparePlaylistBandwidth:ku,comparePlaylistResolution:dw,xhr:Sm()};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 Qm="videojs-vhs",Jm=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"})},E2=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),Jm(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 w2=(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)},k2=(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},[]),C2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const n=t?r.concat([t]):r,s=k2(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)])},I2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const n=w2(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},Zm=()=>{if(!x.localStorage)return null;const i=x.localStorage.getItem(Qm);if(!i)return null;try{return JSON.parse(i)}catch{return null}},A2=i=>{if(!x.localStorage)return!1;let e=Zm();e=e?fe(e,i):i;try{x.localStorage.setItem(Qm,JSON.stringify(e))}catch{return!1}return e},x2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,ef=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},tf=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},rf=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},nf=(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){ef(Ne.xhr,i)};Ne.xhr.onResponse=function(i){tf(Ne.xhr,i)};Ne.xhr.offRequest=function(i){rf(Ne.xhr,i)};Ne.xhr.offResponse=function(i){nf(Ne.xhr,i)};const L2=B.getComponent("Component");class sf extends L2{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=Zm();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=x2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Ne,this.options_.sourceType=wp(t),this.options_.seekTo=s=>{this.tech_.setCurrentTime(s)},this.options_.player_=this.player_,this.playlistController_=new h2(this.options_);const r=fe({liveRangeSafeTimeDelta:ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new f2(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&&A2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{m2(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"),C2({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=I2({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",()=>{E2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Jm(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Ym,"mux.js":b2,"mpd-parser":v2,"m3u8-parser":T2,"aes-decrypter":S2}}version(){return this.constructor.version()}canChangeType(){return zm.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 DE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,n=2){return Im({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=>{ef(this.xhr,e)},this.xhr.onResponse=e=>{tf(this.xhr,e)},this.xhr.offRequest=e=>{rf(this.xhr,e)},this.xhr.offResponse=e=>{nf(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:Ym,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 sf(i,e,r),e.vhs.xhr=Sm(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=wp(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}},D2=()=>Dn("avc1.4d400d,mp4a.40.2",!0);D2()&&B.getTech("Html5").registerSourceHandler(ba,0);B.VhsHandler=sf;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",_2);const P2=i=>{const e=qe.useRef();return qe.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},af={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(af),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)},R2=(i,e)=>{const t=ob(i,e),r=P2(i),n=qe.useRef(),s=qe.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 J0(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(af),r.current.pause(),r.current.src(void 0)}},[r,t]),a=qe.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=qe.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=qe.useCallback(()=>{r.current&&(n.current&&n.current.skip(),s())},[s,r]);return qe.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]),qe.useEffect(()=>t.subscribe(p=>{p&&(De.setKey("adCount",p.ads.length),De.setKey("adPosition",0),s())}),[t,r,s]),[De,a,l,u]},N2=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:n})=>{var s,a,l,u,p;const g=qe.useRef(null),[b,S,w,C]=R2(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:re,hasAdUrl:he,adAction:le}=X.useStore(b),pe=((s=i.sponsor)==null?void 0:s.logo)&&i.logoMode===ge.PromotionLogoMode.CENTER;return W.jsxs(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsx(bh,{className:X.cx_default(!pe&&vh),children:W.jsx(Sh,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(N0,{children:[W.jsx(A0,{time:v,adCount:D,adPosition:L}),!!O&&U&&W.jsx(X.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{C()},duration:O,isPlaying:!F,skipIcon:!0}),n&&W.jsx(X.y$1,{className:"ClosePromoIcon",close:()=>{N(),e==null||e()}})]})]}),W.jsx(Th,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsxs(R0,{ref:g,children:[re&&W.jsx(L0,{whyThisAd:re}),J&&W.jsx(D0,{className:X.cx_default(!V&&"muted"),onClick:()=>S()}),F&&!Y&&W.jsx(P0,{onClick:()=>w()})]})}),he&&W.jsx(Eh,{className:X.cx_default(bc,U&&vc,!U&&Tc),children:W.jsx(wh,{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-analytics":"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,re,he,le,pe,ee,ce;const{promotion:ne,open:de,advertisementPaused:we,togglePause:ze,controlVideo:dt,skipAutoClose:Ot,promotionId:ht,onClose:Ut,markAsViewed:Vt,externalAd:xe}=i,Be=ne.type===ge.PromotionType.INGAME_IAB11_LBAR||ne.type===ge.PromotionType.INGAME_IAB11,oi=((e=ne.sponsor)==null?void 0:e.logo)&&ne.logoMode===ge.PromotionLogoMode.CENTER,Fi=!!((r=(t=ne.banner)==null?void 0:t.video)!=null&&r.url),li=ne.autoPlayVideo===ge.AutoPlayVideo.ENABLED;if(qe.useEffect(()=>{ze==null||ze(Fi||li),de==null||de()},[]),qe.useEffect(()=>{ht&&ne.type&&Vt&&Vt()},[ht,ne.type,Vt]),qe.useEffect(()=>()=>{dt==null||dt({muted:!1})},[dt]),xe)return W.jsx(N2,{...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(yh,{className:"PromoOverlay",children:[W.jsxs(_h,{children:[W.jsxs(bh,{className:X.cx_default(!oi&&vh),children:[((s=ne.sponsor)==null?void 0:s.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(fc,{className:"PromoSponsorLogo",src:(a=ne.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(T0,{style:{paddingLeft:(l=ne.sponsor)!=null&&l.logo&&ne.logoMode===ge.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=ne.sponsor)==null?void 0:u.logo)&&ne.logoMode===ge.PromotionLogoMode.LEFT&&W.jsx(y0,{children:(p=ne.sponsor)==null?void 0:p.name}),W.jsxs(S0,{className:"SponsorText",children:[W.jsx(Sh,{children:"AD"}),W.jsx(E0,{children:"SPONSORED"})]})]})]}),W.jsx(X.y$1,{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(Th,{children:[oi&&W.jsx(fc,{className:b0,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.Y,{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:Be?"1/1":"16/9",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(_0,{style:Be?{aspectRatio:"1/1"}:{},src:(F=ne.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Be&&W.jsxs(yc,{children:[((N=ne.banner)==null?void 0:N.title)&&W.jsx(w0,{className:X.cx_default("AdvTitle",oi&&k0),children:(V=ne.banner)==null?void 0:V.title}),((J=ne.banner)==null?void 0:J.body)&&W.jsx(v0,{className:"AdvDescription",children:(Y=ne.banner)==null?void 0:Y.body})]})]}),ne.buttonType!==ge.PromotionButtonType.NO_BUTTON&&W.jsx(Eh,{children:W.jsx(wh,{href:Ht,style:{backgroundColor:((he=(re=ne.banner)==null?void 0:re.ctaButton)==null?void 0:he.color)||"#009dc4",color:((pe=(le=ne.banner)==null?void 0:le.ctaButton)==null?void 0:pe.textColor)||"#fff"},"data-analytics":"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})})]})},O2=X.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),U2=({children:i,direction:e,style:t,className:r,hiding:n})=>W.jsx(bl,{direction:e,style:t,hiding:n,className:r,children:W.jsx(O2,{children:i})}),M2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21_LBAR,B2=i=>(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===ge.PromotionType.INGAME_IAB21,F2=({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(m0,{open:()=>p==null?void 0:p({fromNotification:!0}),notification:i.notification,promotionId:i.question.id}):!s&&!l&&(t||B2(i.promotion))?W.jsx(f0,{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||M2(i.promotion))?W.jsx(U2,{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?W.jsx(R_,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l}):null:null,j2=X.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),q2=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")||ge.PromotionType.UNSET;e.getAttribute("data-analytics")==="button"&&X.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-analytics")==="banner"&&X.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},$2=({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=qe.useRef(null),v=X.useStore(i.advertisement.$store);X.y(C,{enabled:!!v.data,event:"click",listener:q2});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)===ge.NotificationPromotionMode.LOWER_THIRD;return W.jsx(j2,{ref:C,style:{height:D?"auto":"100%"},className:X.cx_default("SL-AdvertisementUIWrap",l&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:W.jsx(F2,{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})})},of=({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]=qe.useState(!t);if(qe.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(ge.SdkOverlayType.GAMES);return!w||t&&!b?null:W.jsx($2,{gamification:w,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:p,skipTypeCheck:s,skipAutoClose:n,externalAd:t,controlVideo:i.controlVideoPlayer})},V2=({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(of,{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=V2;exports.StreamLayerSDKAdvertisementUI=of;
|