vendor: 4,080 bytes, line 1
1var Gb=Object.defineProperty;var Kb=Object.getPrototypeOf;var Vb=Reflect.get;var Mm=i=>{throw TypeError(i)};var Wb=(i,e,t)=>e in i?Gb(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var _e=(i,e,t)=>Wb(i,typeof e!="symbol"?e+"":e,t),ru=(i,e,t)=>e.has(i)||Mm("Cannot "+t);var k=(i,e,t)=>(ru(i,e,"read from private field"),t?t.call(i):e.get(i)),ce=(i,e,t)=>e.has(i)?Mm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),ae=(i,e,t,r)=>(ru(i,e,"write to private field"),r?r.call(i,t):e.set(i,t),t),Ce=(i,e,t)=>(ru(i,e,"access private method"),t);var io=(i,e,t)=>Vb(Kb(i),t,e);import{N as Yb,P as ro,ay as qb,W as jb,a3 as Om,a6 as zb,a7 as Xb,ak as Qb,af as su,av as Zb,ap as Jb,a2 as Pm,az as eT}from"./D9W4pA87.js";var tT=Object.create,h0=Object.defineProperty,iT=Object.getOwnPropertyDescriptor,rT=Object.getOwnPropertyNames,sT=Object.getPrototypeOf,nT=Object.prototype.hasOwnProperty,f0=function(i,e){return function(){return i&&(e=i(i=0)),e}},Lt=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}},aT=function(i,e,t,r){if(e&&typeof e=="object"||typeof e=="function")for(var s=rT(e),n=0,a=s.length,o;n<a;n++)o=s[n],!nT.call(i,o)&&o!==t&&h0(i,o,{get:(function(l){return e[l]}).bind(null,o),enumerable:!(r=iT(e,o))||r.enumerable});return i},Pt=function(i,e,t){return t=i!=null?tT(sT(i)):{},aT(!i||!i.__esModule?h0(t,"default",{value:i,enumerable:!0}):t,i)},ai=Lt(function(i,e){var t;typeof window<"u"?t=window:typeof global<"u"?t=global:typeof self<"u"?t=self:t={},e.exports=t});function Ss(i,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](i):Ss(i,e)}var xs=f0(function(){xs()});function m0(i){"@swc/helpers - typeof";return i&&typeof Symbol<"u"&&i.constructor===Symbol?"symbol":typeof i}var p0=f0(function(){}),g0=Lt(function(i,e){var t=Array.prototype.slice;e.exports=r;function r(s,n){for(("length"in s)||(s=[s]),s=t.call(s);s.length;){var a=s.shift(),o=n(a);if(o)return o;a.childNodes&&a.childNodes.length&&(s=t.call(a.childNodes).concat(s))}}}),oT=Lt(function(i,e){xs(),e.exports=t;function t(r,s){if(!Ss(this,t))return new t(r,s);this.data=r,this.nodeValue=r,this.length=r.length,this.ownerDocument=s||null}t.prototype.nodeType=8,t.prototype.nodeName="#comment",t.prototype.toString=function(){return"[object Comment]"}}),lT=Lt(function(i,e){xs(),e.exports=t;function t(r,s){if(!Ss(this,t))return new t(r);this.data=r||"",this.length=this.data.length,this.ownerDocument=s||null}t.prototype.type="DOMTextNode",t.prototype.nodeType=3,t.prototype.nodeName="#text",t.prototype.toString=function(){return this.data},t.prototype.replaceData=function(r,s,n){var a=this.data,o=a.substring(0,r),l=a.substring(r+s,a.length);this.data=o+n+l,this.length=this.data.length}}),v0=Lt(function(i,e){e.exports=t;function t(r){var s=this,n=r.type;r.target||(r.target=s),s.listeners||(s.listeners={});var a=s.listeners[n];if(a)return a.forEach(function(o){r.currentTarget=s,typeof o=="function"?o(r):o.handleEvent(r)});s.parentNode&&s.parentNode.dispatchEvent(r)}}),E0=Lt(function(i,e){e.exports=t;function t(r,s){var n=this;n.listeners||(n.listeners={}),n.listeners[r]||(n.listeners[r]=[]),n.listeners[r].indexOf(s)===-1&&n.listeners[r].push(s)}}),y0=Lt(function(i,e){e.exports=t;function t(r,s){var n=this;if(n.listeners&&n.listeners[r]){var a=n.listeners[r],o=a.indexOf(s);o!==-1&&a.splice(o,1)}}}),dT=Lt(function(i,e){p0(),e.exports=r;var t=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function r(h){switch(h.nodeType){case 3:return u(h.data);case 8:return"<!--"+h.data+"-->";default:return s(h)}}function s(h){var f=[],m=h.tagName;return h.namespaceURI==="http://www.w3.org/1999/xhtml"&&(m=m.toLowerCase()),f.push("<"+m+d(h)+o(h)),t.indexOf(m)>-1?f.push(" />"):(f.push(">"),h.childNodes.length?f.push.apply(f,h.childNodes.map(r)):h.textContent||h.innerText?f.push(u(h.textContent||h.innerText)):h.innerHTML&&f.push(h.innerHTML),f.push("</"+m+">")),f.join("")}function n(h,f){var m=m0(h[f]);
vendor: 6,261 bytes, line 1
1return f==="style"&&Object.keys(h.style).length>0?!0:h.hasOwnProperty(f)&&(m==="string"||m==="boolean"||m==="number")&&f!=="nodeName"&&f!=="className"&&f!=="tagName"&&f!=="textContent"&&f!=="innerText"&&f!=="namespaceURI"&&f!=="innerHTML"}function a(h){if(typeof h=="string")return h;var f="";return Object.keys(h).forEach(function(m){var p=h[m];m=m.replace(/[A-Z]/g,function(g){return"-"+g.toLowerCase()}),f+=m+":"+p+";"}),f}function o(h){var f=h.dataset,m=[];for(var p in f)m.push({name:"data-"+p,value:f[p]});return m.length?l(m):""}function l(h){var f=[];return h.forEach(function(m){var p=m.name,g=m.value;p==="style"&&(g=a(g)),f.push(p+'="'+c(g)+'"')}),f.length?" "+f.join(" "):""}function d(h){var f=[];for(var m in h)n(h,m)&&f.push({name:m,value:h[m]});for(var p in h._attributes)for(var g in h._attributes[p]){var v=h._attributes[p][g],b=(v.prefix?v.prefix+":":"")+g;f.push({name:b,value:v.value})}return h.className&&f.push({name:"class",value:h.className}),f.length?l(f):""}function u(h){var f="";return typeof h=="string"?f=h:h&&(f=h.toString()),f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function c(h){return u(h).replace(/"/g,""")}}),b0=Lt(function(i,e){xs();var t=g0(),r=v0(),s=E0(),n=y0(),a=dT(),o="http://www.w3.org/1999/xhtml";e.exports=l;function l(d,u,c){if(!Ss(this,l))return new l(d);var h=c===void 0?o:c||null;this.tagName=h===o?String(d).toUpperCase():d,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=u||null,this.namespaceURI=h,this._attributes={},this.tagName==="INPUT"&&(this.type="text")}l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(d){return d.parentNode&&d.parentNode.removeChild(d),this.childNodes.push(d),d.parentNode=this,d},l.prototype.replaceChild=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=this.childNodes.indexOf(u);return u.parentNode=null,this.childNodes[c]=d,d.parentNode=this,u},l.prototype.removeChild=function(d){var u=this.childNodes.indexOf(d);return this.childNodes.splice(u,1),d.parentNode=null,d},l.prototype.insertBefore=function(d,u){d.parentNode&&d.parentNode.removeChild(d);var c=u==null?-1:this.childNodes.indexOf(u);return c>-1?this.childNodes.splice(c,0,d):this.childNodes.push(d),d.parentNode=this,d},l.prototype.setAttributeNS=function(d,u,c){var h=null,f=u,m=u.indexOf(":");if(m>-1&&(h=u.substr(0,m),f=u.substr(m+1)),this.tagName==="INPUT"&&u==="type")this.type=c;else{var p=this._attributes[d]||(this._attributes[d]={});p[f]={value:c,prefix:h}}},l.prototype.getAttributeNS=function(d,u){var c=this._attributes[d],h=c&&c[u]&&c[u].value;return this.tagName==="INPUT"&&u==="type"?this.type:typeof h!="string"?null:h},l.prototype.removeAttributeNS=function(d,u){var c=this._attributes[d];c&&delete c[u]},l.prototype.hasAttributeNS=function(d,u){var c=this._attributes[d];return!!c&&u in c},l.prototype.setAttribute=function(d,u){return this.setAttributeNS(null,d,u)},l.prototype.getAttribute=function(d){return this.getAttributeNS(null,d)},l.prototype.removeAttribute=function(d){return this.removeAttributeNS(null,d)},l.prototype.hasAttribute=function(d){return this.hasAttributeNS(null,d)},l.prototype.removeEventListener=n,l.prototype.addEventListener=s,l.prototype.dispatchEvent=r,l.prototype.focus=function(){},l.prototype.toString=function(){return a(this)},l.prototype.getElementsByClassName=function(d){var u=d.split(" "),c=[];return t(this,function(h){if(h.nodeType===1){var f=h.className||"",m=f.split(" ");u.every(function(p){return m.indexOf(p)!==-1})&&c.push(h)}}),c},l.prototype.getElementsByTagName=function(d){d=d.toLowerCase();var u=[];return t(this.childNodes,function(c){c.nodeType===1&&(d==="*"||c.tagName.toLowerCase()===d)&&u.push(c)}),u},l.prototype.contains=function(d){return t(this,function(u){return d===u})||!1}}),uT=Lt(function(i,e){xs();var t=b0();e.exports=r;function r(s){if(!Ss(this,r))return new r;this.childNodes=[],this.parentNode=null,this.ownerDocument=s||null}r.prototype.type="DocumentFragment",r.prototype.nodeType=11,r.prototype.nodeName="#document-fragment",r.prototype.appendChild=t.prototype.appendChild,r.prototype.replaceChild=t.prototype.replaceChild,r.prototype.removeChild=t.prototype.removeChild,r.prototype.toString=function(){return this.childNodes.map(function(s){return String(s)}).join("")}}),cT=Lt(function(i,e){e.exports=t;function t(r){}t.prototype.initEvent=function(r,s,n){this.type=r,this.bubbles=s,this.cancelable=n},t.prototype.preventDefault=function(){}}),hT=Lt(function(i,e){xs();var t=g0(),r=oT(),s=lT(),n=b0(),a=uT(),o=cT(),l=v0(),d=E0(),u=y0();e.exports=c;function c(){if(!Ss(this,c))return new c;this.head=this.createElement("head"),this.body=this.createElement("body"),this.documentElement=this.createElement("html"),this.documentElement.appendChild(this.head),this.documentElement.appendChild(this.body),this.childNodes=[this.documentElement],this.nodeType=9}var h=c.prototype;h.createTextNode=function(f){return new s(f,this)},h.createElementNS=function(f,m){var p=f===null?null:String(f);return new n(m,this,p)},h.createElement=function(f){return new n(f,this)},h.createDocumentFragment=function(){return new a(this)},h.createEvent=function(f){return new o(f)},h.createComment=function(f){return new r(f,this)},h.getElementById=function(f){f=String(f);var m=t(this.childNodes,function(p){if(String(p.id)===f)return p});return m||null},h.getElementsByClassName=n.prototype.getElementsByClassName,h.getElementsByTagName=n.prototype.getElementsByTagName,h.contains=n.prototype.contains,h.removeEventListener=u,h.addEventListener=d,h.dispatchEvent=l}),fT=Lt(function(i,e){var t=hT();e.exports=new t}),T0=Lt(function(i,e){var t=typeof global<"u"?global:typeof window<"u"?window:{},r=fT(),s;typeof document<"u"?s=document:(s=t["__GLOBAL_DOCUMENT_CACHE@4"],s||(s=t["__GLOBAL_DOCUMENT_CACHE@4"]=r)),e.exports=s});function mT(i){if(Array.isArray(i))return i}function pT(i,e){var t=i==null?null:typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t!=null){var r=[],s=!0,n=!1,a,o;try{for(t=t.call(i);!(s=(a=t.next()).done)&&(r.push(a.value),!(e&&r.length===e));s=!0);}catch(l){n=!0,o=l}finally{try{!s&&t.return!=null&&t.return()}finally{if(n)throw o}}return r}}
1function gT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. 2In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Zu(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}function _0(i,e){if(i){if(typeof i=="string")return Zu(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(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Zu(i,e)}}function Zi(i,e){return mT(i)||pT(i,e)||_0(i,e)||gT()}var _a=Pt(ai()),Nm=Pt(ai()),vT=Pt(ai()),ET={now:function(){var i=vT.default.performance,e=i&&i.timing,t=e&&e.navigationStart,r=typeof t=="number"&&typeof i.now=="function"?t+i.now():Date.now();return Math.round(r)}},tt=ET,Ma=function(){var i,e,t;if(typeof((i=Nm.default.crypto)===null||i===void 0?void 0:i.getRandomValues)=="function"){t=new Uint8Array(32),Nm.default.crypto.getRandomValues(t);for(var r=0;r<32;r++)t[r]=t[r]%16}else{t=[];for(var s=0;s<32;s++)t[s]=Math.random()*16|0}var n=0;e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){var d=l==="x"?t[n]:t[n]&3|8;return n++,d.toString(16)});var a=tt.now(),o=a==null?void 0:a.toString(16).substring(3);return o?e.substring(0,28)+o:e},A0=function(){return("000000"+(Math.random()*Math.pow(36,6)<<0).toString(36)).slice(-6)},zt=function(i){if(i&&typeof i.nodeName<"u")return i.muxId||(i.muxId=A0()),i.muxId;var e;try{e=document.querySelector(i)}catch{}return e&&!e.muxId&&(e.muxId=i),(e==null?void 0:e.muxId)||i},Xl=function(i){var e;i&&typeof i.nodeName<"u"?(e=i,i=zt(e)):e=document.querySelector(i);var t=e&&e.nodeName?e.nodeName.toLowerCase():"";return[e,i,t]};function yT(i){if(Array.isArray(i))return Zu(i)}function bT(i){if(typeof Symbol<"u"&&i[Symbol.iterator]!=null||i["@@iterator"]!=null)return Array.from(i)}function TT(){throw new TypeError(`Invalid attempt to spread non-iterable instance. 3In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Xt(i){return yT(i)||bT(i)||_0(i)||TT()}var is={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},_T=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3,t,r,s,n,a,o=[console,i],l=(t=console.trace).bind.apply(t,Xt(o)),d=(r=console.info).bind.apply(r,Xt(o)),u=(s=console.debug).bind.apply(s,Xt(o)),c=(n=console.warn).bind.apply(n,Xt(o)),h=(a=console.error).bind.apply(a,Xt(o)),f=e;return{trace:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>is.TRACE))return l.apply(void 0,Xt(p))},debug:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>is.DEBUG))return u.apply(void 0,Xt(p))},info:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>is.INFO))return d.apply(void 0,Xt(p))},warn:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>is.WARN))return c.apply(void 0,Xt(p))},error:function(){for(var m=arguments.length,p=new Array(m),g=0;g<m;g++)p[g]=arguments[g];if(!(f>is.ERROR))return h.apply(void 0,Xt(p))},get level(){return f},set level(m){m!==this.level&&(f=m??e)}}},De=_T("[mux]"),nu=Pt(ai());function Ju(){var i=nu.default.doNotTrack||nu.default.navigator&&nu.default.navigator.doNotTrack;return i==="1"}function se(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}xs();function mt(i,e){if(!Ss(i,e))throw new TypeError("Cannot call a class as a function")}function AT(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Pi(i,e,t){return e&&AT(i.prototype,e),i}function B(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Sn(i){return Sn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},Sn(i)}function ST(i,e){for(;!Object.prototype.hasOwnProperty.call(i,e)&&(i=Sn(i),i!==null););return i}function No(i,e,t){return typeof Reflect<"u"&&Reflect.get?No=Reflect.get:No=function(r,s,n){var a=ST(r,s);if(a){var o=Object.getOwnPropertyDescriptor(a,s);return o.get?o.get.call(n||r):o.value}},No(i,e,t||i)}
vendor: 2,053 bytes, line 3
3function ec(i,e){return ec=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},ec(i,e)}function xT(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&ec(i,e)}function RT(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}p0();function LT(i,e){return e&&(m0(e)==="object"||typeof e=="function")?e:se(i)}function IT(i){var e=RT();return function(){var t=Sn(i),r;if(e){var s=Sn(this).constructor;r=Reflect.construct(t,arguments,s)}else r=t.apply(this,arguments);return LT(this,r)}}var ri=function(i){return Oa(i)[0]},Oa=function(i){if(typeof i!="string"||i==="")return["localhost"];var e=/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/,t=i.match(e)||[],r=t[4],s;return r&&(s=(r.match(/[^\.]+\.[^\.]+$/)||[])[0]),[r,s]},au=Pt(ai()),kT={exists:function(){var i=au.default.performance,e=i&&i.timing;return e!==void 0},domContentLoadedEventEnd:function(){var i=au.default.performance,e=i&&i.timing;return e&&e.domContentLoadedEventEnd},navigationStart:function(){var i=au.default.performance,e=i&&i.timing;return e&&e.navigationStart}},Ql=kT;function et(i,e,t){t=t===void 0?1:t,i[e]=i[e]||0,i[e]+=t}function Zl(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{},r=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(r=r.concat(Object.getOwnPropertySymbols(t).filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable}))),r.forEach(function(s){B(i,s,t[s])})}return i}function wT(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);t.push.apply(t,r)}return t}function Bh(i,e){return e=e??{},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(e)):wT(Object(e)).forEac
vendor: 11,594 bytes, lines 3-12
3h(function(t){Object.defineProperty(i,t,Object.getOwnPropertyDescriptor(e,t))}),i}var DT=["x-cdn","content-type"],S0=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],CT=DT.concat(S0);function Hh(i){i=i||"";var e={},t=i.trim().split(/[\r\n]+/);return t.forEach(function(r){if(r){var s=r.split(": "),n=s.shift();n&&(CT.indexOf(n.toLowerCase())>=0||n.toLowerCase().indexOf("x-litix-")===0)&&(e[n]=s.join(": "))}}),e}function Jl(i){if(i){var e=S0.find(function(t){return i[t]!==void 0});return e?i[e]:void 0}}var MT=function(i){var e={};for(var t in i){var r=i[t],s=r["DATA-ID"].search("io.litix.data.");if(s!==-1){var n=r["DATA-ID"].replace("io.litix.data.","");e[n]=r.VALUE}}return e},x0=MT,so=function(i){if(!i)return{};var e=Ql.navigationStart(),t=i.loading,r=t?t.start:i.trequest,s=t?t.first:i.tfirst,n=t?t.end:i.tload;return{bytesLoaded:i.total,requestStart:Math.round(e+r),responseStart:Math.round(e+s),responseEnd:Math.round(e+n)}},Bn=function(i){if(!(!i||typeof i.getAllResponseHeaders!="function"))return Hh(i.getAllResponseHeaders())},OT=function(i,e,t){var r=arguments.length>4?arguments[4]:void 0,s=i.log,n=i.utils.secondsToMs,a=function(g){var v=parseInt(r.version),b;return v===1&&g.programDateTime!==null&&(b=g.programDateTime),v===0&&g.pdt!==null&&(b=g.pdt),b};if(!Ql.exists()){s.warn("performance timing not supported. Not tracking HLS.js.");return}var o=function(g,v){return i.emit(e,g,v)},l=function(g,v){var b=v.levels,y=v.audioTracks,A=v.url,_=v.stats,C=v.networkDetails,x=v.sessionData,S={},P={};b.forEach(function(Y,X){S[X]={width:Y.width,height:Y.height,bitrate:Y.bitrate,attrs:Y.attrs}}),y.forEach(function(Y,X){P[X]={name:Y.name,language:Y.lang,bitrate:Y.bitrate}});var I=so(_),M=I.bytesLoaded,$=I.requestStart,F=I.responseStart,Q=I.responseEnd;o("requestcompleted",Bh(Zl({},x0(x)),{request_event_type:g,request_bytes_loaded:M,request_start:$,request_response_start:F,request_response_end:Q,request_type:"manifest",request_hostname:ri(A),request_response_headers:Bn(C),request_rendition_lists:{media:S,audio:P,video:{}}}))};t.on(r.Events.MANIFEST_LOADED,l);var d=function(g,v){var b=v.details,y=v.level,A=v.networkDetails,_=v.stats,C=so(_),x=C.bytesLoaded,S=C.requestStart,P=C.responseStart,I=C.responseEnd,M=b.fragments[b.fragments.length-1],$=a(M)+n(M.duration);o("requestcompleted",{request_event_type:g,request_bytes_loaded:x,request_start:S,request_response_start:P,request_response_end:I,request_current_level:y,request_type:"manifest",request_hostname:ri(b.url),request_response_headers:Bn(A),video_holdback:b.holdBack&&n(b.holdBack),video_part_holdback:b.partHoldBack&&n(b.partHoldBack),video_part_target_duration:b.partTarget&&n(b.partTarget),video_target_duration:b.targetduration&&n(b.targetduration),video_source_is_live:b.live,player_manifest_newest_program_time:isNaN($)?void 0:$})};t.on(r.Events.LEVEL_LOADED,d);var u=function(g,v){var b=v.details,y=v.networkDetails,A=v.stats,_=so(A),C=_.bytesLoaded,x=_.requestStart,S=_.responseStart,P=_.responseEnd;o("requestcompleted",{request_event_type:g,request_bytes_loaded:C,request_start:x,request_response_start:S,request_response_end:P,request_type:"manifest",request_hostname:ri(b.url),request_response_headers:Bn(y)})};t.on(r.Events.AUDIO_TRACK_LOADED,u);var c=function(g,v){var b=v.stats,y=v.networkDetails,A=v.frag;b=b||A.stats;var _=so(b),C=_.bytesLoaded,x=_.requestStart,S=_.responseStart,P=_.responseEnd,I=y?Bn(y):void 0,M={request_event_type:g,request_bytes_loaded:C,request_start:x,request_response_start:S,request_response_end:P,request_hostname:y?ri(y.responseURL):void 0,request_id:I?Jl(I):void 0,request_response_headers:I,request_media_duration:A.duration,request_url:y==null?void 0:y.responseURL};A.type==="main"?(M.request_type="media",M.request_current_level=A.level,M.request_video_width=(t.levels[A.level]||{}).width,M.request_video_height=(t.levels[A.level]||{}).height,M.request_labeled_bitrate=(t.levels[A.level]||{}).bitrate):M.request_type=A.type,o("requestcompleted",M)};t.on(r.Events.FRAG_LOADED,c);var h=function(g,v){var b=v.frag,y=b.start,A=a(b),_={currentFragmentPDT:A,currentFragmentStart:n(y)};o("fragmentchange",_)};t.on(r.Events.FRAG_CHANGED,h);var f=function(g,v){var b=v.type,y=v.details,A=v.response,_=v.fatal,C=v.frag,x=v.networkDetails,S=(C==null?void 0:C.url)||v.url||"",P=x?Bn(x):void 0;if((y===r.ErrorDetails.MANIFEST_LOAD_ERROR||y===r.ErrorDetails.MANIFEST_LOAD_TIMEOUT||y===r.ErrorDetails.FRAG_LOAD_ERROR||y===r.ErrorDetails.FRAG_LOAD_TIMEOUT||y===r.ErrorDetails.LEVEL_LOAD_ERROR||y===r.ErrorDetails.LEVEL_LOAD_TIMEOUT||y===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||y===r.ErrorDetails.SUBTITLE_LOAD_ERROR||y===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||y===r.ErrorDetails.KEY_LOAD_ERROR||y===r.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:y,request_url:S,request_hostname:ri(S),request_id:P?Jl(P):void 0,request_type:y===r.ErrorDetails.FRAG_LOAD_ERROR||y===r.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":y===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||y===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":y===r.ErrorDetails.SUBTITLE_LOAD_ERROR||y===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":y===r.ErrorDetails.KEY_LOAD_ERROR||y===r.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:A==null?void 0:A.code,request_error_text:A==null?void 0:A.text}),_){var I,M="".concat(S?"url: ".concat(S,` 4`):"")+"".concat(A&&(A.code||A.text)?"response: ".concat(A.code,", ").concat(A.text,` 5`):"")+"".concat(v.reason?"failure reason: ".concat(v.reason,` 6`):"")+"".concat(v.level?"level: ".concat(v.level,` 7`):"")+"".concat(v.parent?"parent stream controller: ".concat(v.parent,` 8`):"")+"".concat(v.buffer?"buffer length: ".concat(v.buffer,` 9`):"")+"".concat(v.error?"error: ".concat(v.error,` 10`):"")+"".concat(v.event?"event: ".concat(v.event,` 11`):"")+"".concat(v.err?"error message: ".concat((I=v.err)===null||I===void 0?void 0:I.message,` 12`):"");o("error",{player_error_code:b,player_error_message:y,player_error_context:M})}};t.on(r.Events.ERROR,f);var m=function(g,v){var b=v.frag,y=b&&b._url||"";o("requestcanceled",{request_event_type:g,request_url:y,request_type:"media",request_hostname:ri(y)})};t.on(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,m);var p=function(g,v){var b=v.level,y=t.levels[b];if(y&&y.attrs&&y.attrs.BANDWIDTH){var A=y.attrs.BANDWIDTH,_,C=parseFloat(y.attrs["FRAME-RATE"]);isNaN(C)||(_=C),A?o("renditionchange",{video_source_fps:_,video_source_bitrate:A,video_source_width:y.width,video_source_height:y.height,video_source_rendition_name:y.name,video_source_codec:y==null?void 0:y.videoCodec}):s.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};t.on(r.Events.LEVEL_SWITCHED,p),t._stopMuxMonitor=function(){t.off(r.Events.MANIFEST_LOADED,l),t.off(r.Events.LEVEL_LOADED,d),t.off(r.Events.AUDIO_TRACK_LOADED,u),t.off(r.Events.FRAG_LOADED,c),t.off(r.Events.FRAG_CHANGED,h),t.off(r.Events.ERROR,f),t.off(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,m),t.off(r.Events.LEVEL_SWITCHED,p),t.off(r.Events.DESTROYING,t._stopMuxMonitor),delete t._stopMuxMonitor},t.on(r.Events.DESTROYING,t._stopMuxMonitor)},PT=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Um=function(i,e){if(!i||!i.requestEndDate)return{};var t=ri(i.url),r=i.url,s=i.bytesLoaded,n=new Date(i.requestStartDate).getTime(),a=new Date(i.firstByteDate).getTime(),o=new Date(i.requestEndDate).getTime(),l=isNaN(i.duration)?0:i.duration,d=typeof e.getMetricsFor=="function"?e.getMetricsFor(i.mediaType).HttpList:e.getDashMetrics().getHttpRequests(i.mediaType),u;d.length>0&&(u=Hh(d[d.length-1]._responseHeaders||""));var c=u?Jl(u):void 0;return{requestStart:n,requestResponseStart:a,requestResponseEnd:o,requestBytesLoaded:s,requestResponseHeaders:u,requestMediaDuration:l,requestHostname:t,requestUrl:r,requestId:c}},NT=function(i,e){var t=e.getQualityFor(i),r=e.getCurrentTrackFor(i).bitrateList;return r?{currentLevel:t,renditionWidth:r[t].width||null,renditionHeight:r[t].height||null,renditionBitrate:r[t].bandwidth}:{}},UT=function(i){var e;return(e=i.match(/.*codecs\*?="(.*)"/))===null||e===void 0?void 0:e[1]},FT=function(i){try{var e,t,r=(t=i.getVersion)===null||t===void 0||(e=t.call(i))===null||e===void 0?void 0:e.split(".").map(function(s){return parseInt(s)})[0];return r}catch{return!1}},$T=function(i,e,t){var r=i.log;if(!t||!t.on){r.warn("Invalid dash.js player reference. Monitoring blocked.");return}var s=FT(t),n=function(b,y){return i.emit(e,b,y)},a=function(b){var y=b.type,A=b.data,_=(A||{}).url;n("requestcompleted",{request_event_type:y,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:ri(_),request_url:_})};t.on("manifestLoaded",a);var o={},l=function(b){if(typeof b.getRequests!="function")return null;var y=b.getRequests({state:"executed"});return y.length===0?null:y[y.length-1]},d=function(b){var y=b.type,A=b.fragmentModel,_=b.chunk,C=l(A);u({type:y,request:C,chunk:_})},u=function(b){var y=b.type,A=b.chunk,_=b.request,C=(A||{}).mediaInfo,x=C||{},S=x.type,P=x.bitrateList;P=P||[];var I={};P.forEach(function(H,ne){I[ne]={},I[ne].width=H.width,I[ne].height=H.height,I[ne].bitrate=H.bandwidth,I[ne].attrs={}}),S==="video"?o.video=I:S==="audio"?o.audio=I:o.media=I;var M=Um(_,t),$=M.requestStart,F=M.requestResponseStart,Q=M.requestResponseEnd,Y=M.requestResponseHeaders,X=M.requestMediaDuration,ue=M.requestHostname,de=M.requestUrl,K=M.requestId;n("requestcompleted",{request_event_type:y,request_start:$,request_response_start:F,request_response_end:Q,request_bytes_loaded:-1,request_type:S+"_init",request_response_headers:Y,request_hostname:ue,request_id:K,request_url:de,request_media_duration:X,request_rendition_lists:o})};s>=4?t.on("initFragmentLoaded",u):t.on("initFragmentLoaded",d);var c=function(b){var y=b.type,A=b.fragmentModel,_=b.chunk,C=l(A);h({type:y,request:C,chunk:_})},h=function(b){var y=b.type,A=b.chunk,_=b.request,C=A||{},x=C.mediaInfo,S=C.start,P=x||{},I=P.type,M=Um(_,t),$=M.requestStart,F=M.requestResponseStart,Q=M.requestResponseEnd,Y=M.requestBytesLoaded,X=M.requestResponseHeaders,ue=M.requestMediaDuration,de=M.requestHostname,K=M.requestUrl,H=M.requestId,ne=NT(I,t),oe=ne.currentLevel,pe=ne.renditionWidth,Be=ne.renditionHeight,He=ne.renditionBitrate;n("requestcompleted",{request_event_type:y,request_start:$,request_response_start:F,request_response_end:Q,request_bytes_loaded:Y,request_type:I,request_response_headers:X,request_hostname:de,request_id:H,request_url:K,request_media_start_time:S,request_media_duration:ue,request_current_level:oe,request_labeled_bitrate:He,request_video_width:pe,request_video_height:Be})};s>=4?t.on("mediaFragmentLoaded",h):t.on("mediaFragmentLoaded",c);var f={video:void 0,audio:void 0,totalBitrate:void 0},m=function(){if(f.video&&typeof f.video.bitrate=="number"){if(!(f.video.width&&f.video.height)){r.warn("have bitrate info for video but missing width/height");return}var b=f.video.bitrate;if(f.audio&&typeof f.audio.bitrate=="number"&&(b+=f.audio.bitrate),b!==f.totalBitrate)return f.totalBitrate=b,{video_source_bitrate:b,video_source_height:f.video.height,video_source_width:f.video.width,video_source_codec:UT(f.video.codec)}}},p=function(b,y,A){if(typeof b.newQuality!="number"){r.warn("missing evt.newQuality in qualityChangeRendered event",b);return}var _=b.mediaType;if(_==="audio"||_==="video"){var C=t.getBitrateInfoListFor(_).find(function(S){var P=S.qualityIndex;return P===b.newQuality});if(!(C&&typeof C.bitrate=="number")){r.warn("missing bitrate info for ".concat(_));return}f[_]=Bh(Zl({}
vendor: 19,817 bytes, lines 12-14
12,C),{codec:t.getCurrentTrackFor(_).codec});var x=m();x&&n("renditionchange",x)}};t.on("qualityChangeRendered",p);var g=function(b){var y=b.request,A=b.mediaType;y=y||{},n("requestcanceled",{request_event_type:y.type+"_"+y.action,request_url:y.url,request_type:A,request_hostname:ri(y.url)})};t.on("fragmentLoadingAbandoned",g);var v=function(b){var y=b.error,A,_,C=(y==null||(A=y.data)===null||A===void 0?void 0:A.request)||{},x=(y==null||(_=y.data)===null||_===void 0?void 0:_.response)||{};(y==null?void 0:y.code)===27&&n("requestfailed",{request_error:C.type+"_"+C.action,request_url:C.url,request_hostname:ri(C.url),request_type:C.mediaType,request_error_code:x.status,request_error_text:x.statusText});var S="".concat(C!=null&&C.url?"url: ".concat(C.url,` 13`):"")+"".concat(x!=null&&x.status||x!=null&&x.statusText?"response: ".concat(x==null?void 0:x.status,", ").concat(x==null?void 0:x.statusText,` 14`):"");n("error",{player_error_code:y==null?void 0:y.code,player_error_message:y==null?void 0:y.message,player_error_context:S})};t.on("error",v),t._stopMuxMonitor=function(){t.off("manifestLoaded",a),t.off("initFragmentLoaded",u),t.off("mediaFragmentLoaded",h),t.off("qualityChangeRendered",p),t.off("error",v),t.off("fragmentLoadingAbandoned",g),delete t._stopMuxMonitor}},BT=function(i){i&&typeof i._stopMuxMonitor=="function"&&i._stopMuxMonitor()},Fm=0,HT=function(){function i(){mt(this,i),B(this,"_listeners",void 0)}return Pi(i,[{key:"on",value:function(e,t,r){return t._eventEmitterGuid=t._eventEmitterGuid||++Fm,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],r&&(t=t.bind(r)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var r=this._listeners&&this._listeners[e];r&&r.forEach(function(s,n){s._eventEmitterGuid===t._eventEmitterGuid&&r.splice(n,1)})}},{key:"one",value:function(e,t,r){var s=this;t._eventEmitterGuid=t._eventEmitterGuid||++Fm;var n=function(){s.off(e,n),t.apply(r||this,arguments)};n._eventEmitterGuid=t._eventEmitterGuid,this.on(e,n)}},{key:"emit",value:function(e,t){var r=this;if(this._listeners){t=t||{};var s=this._listeners["before*"]||[],n=this._listeners[e]||[],a=this._listeners["after"+e]||[],o=function(l,d){l=l.slice(),l.forEach(function(u){u.call(r,{type:e},d)})};o(s,t),o(n,t),o(a,t)}}}]),i}(),GT=HT,ou=Pt(ai()),KT=function(){function i(e){var t=this;mt(this,i),B(this,"_playbackHeartbeatInterval",void 0),B(this,"_playheadShouldBeProgressing",void 0),B(this,"pm",void 0),this.pm=e,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,e.on("playing",function(){t._playheadShouldBeProgressing=!0}),e.on("play",this._startPlaybackHeartbeatInterval.bind(this)),e.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),e.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),e.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),e.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),e.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),e.on("seeked",function(){e.data.player_is_paused?t._stopPlaybackHeartbeatInterval():t._startPlaybackHeartbeatInterval()}),e.on("timeupdate",function(){t._playbackHeartbeatInterval!==null&&e.emit("playbackheartbeat")}),e.on("devicesleep",function(r,s){t._playbackHeartbeatInterval!==null&&(ou.default.clearInterval(t._playbackHeartbeatInterval),e.emit("playbackheartbeatend",{viewer_time:s.viewer_time}),t._playbackHeartbeatInterval=null)})}return Pi(i,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;this._playbackHeartbeatInterval===null&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=ou.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,this._playbackHeartbeatInterval!==null&&(ou.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),i}(),VT=KT,WT=function i(e){var t=this;mt(this,i),B(this,"viewErrored",void 0),e.on("viewinit",function(){t.viewErrored=!1}),e.on("error",function(r,s){try{var n=e.errorTranslator({player_error_code:s.player_error_code,player_error_message:s.player_error_message,player_error_context:s.player_error_context,player_error_severity:s.player_error_severity,player_error_business_exception:s.player_error_business_exception});n&&(e.data.player_error_code=n.player_error_code||s.player_error_code,e.data.player_error_message=n.player_error_message||s.player_error_message,e.data.player_error_context=n.player_error_context||s.player_error_context,e.data.player_error_severity=n.player_error_severity||s.player_error_severity,e.data.player_error_business_exception=n.player_error_business_exception||s.player_error_business_exception,t.viewErrored=!0)}catch(a){e.mux.log.warn("Exception in error translator callback.",a),t.viewErrored=!0}}),e.on("aftererror",function(){var r,s,n,a,o;(r=e.data)===null||r===void 0||delete r.player_error_code,(s=e.data)===null||s===void 0||delete s.player_error_message,(n=e.data)===null||n===void 0||delete n.player_error_context,(a=e.data)===null||a===void 0||delete a.player_error_severity,(o=e.data)===null||o===void 0||delete o.player_error_business_exception})},YT=WT,qT=function(){function i(e){mt(this,i),B(this,"_watchTimeTrackerLastCheckedTime",void 0),B(this,"pm",void 0),this.pm=e,this._watchTimeTrackerLastCheckedTime=null,e.on("playbackheartbeat",this._updateWatchTime.bind(this)),e.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return Pi(i,[{key:"_updateWatchTime",value:function(e,t){var r=t.viewer_time;this._watchTimeTrackerLastCheckedTime===null&&(this._watchTimeTrackerLastCheckedTime=r),et(this.pm.data,"view_watch_time",r-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=r}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),i}(),jT=qT,zT=function(){function i(e){var t=this;mt(this,i),B(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),B(this,"_lastTime",void 0),B(this,"_isAdPlaying",void 0),B(this,"_callbackUpdatePlaybackTime",void 0),B(this,"pm",void 0),this.pm=e,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=tt.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null;var r=this._startPlaybackTimeTracking.bind(this);e.on("playing",r),e.on("adplaying",r),e.on("seeked",r);var s=this._stopPlaybackTimeTracking.bind(this);e.on("playbackheartbeatend",s),e.on("seeking",s),e.on("adplaying",function(){t._isAdPlaying=!0}),e.on("adended",function(){t._isAdPlaying=!1}),e.on("adpause",function(){t._isAdPlaying=!1}),e.on("adbreakstart",function(){t._isAdPlaying=!1}),e.on("adbreakend",function(){t._isAdPlaying=!1}),e.on("adplay",function(){t._isAdPlaying=!1}),e.on("viewinit",function(){t._playbackTimeTrackerLastPlayheadPosition=-1,t._lastTime=tt.now(),t._isAdPlaying=!1,t._callbackUpdatePlaybackTime=null})}return Pi(i,[{key:"_startPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime===null&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this.pm.on("playbackheartbeat",this._callbackUpdatePlaybackTime))}},{key:"_stopPlaybackTimeTracking",value:function(){this._callbackUpdatePlaybackTime&&(this._updatePlaybackTime(),this.pm.off("playbackheartbeat",this._callbackUpdatePlaybackTime),this._callbackUpdatePlaybackTime=null,this._playbackTimeTrackerLastPlayheadPosition=-1)}},{key:"_updatePlaybackTime",value:function(){var e=this.pm.data.player_playhead_time,t=tt.now(),r=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>this._playbackTimeTrackerLastPlayheadPosition?r=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(r=t-this._lastTime),r>0&&r<=1e3&&et(this.pm.data,"view_content_playback_time",r),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),i}(),XT=zT,QT=function(){function i(e){mt(this,i),B(this,"pm",void 0),this.pm=e;var t=this._updatePlayheadTime.bind(this);e.on("playbackheartbeat",t),e.on("playbackheartbeatend",t),e.on("timeupdate",t),e.on("destroy",function(){e.off("timeupdate",t)})}return Pi(i,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=typeof this.pm.data.view_max_playhead_position>"u"?this.pm.data.player_playhead_time:Math.max(this.pm.data.view_max_playhead_position,this.pm.data.player_playhead_time)}},{key:"_updatePlayheadTime",value:function(e,t){var r=this,s=function(){r.pm.currentFragmentPDT&&r.pm.currentFragmentStart&&(r.pm.data.player_program_time=r.pm.currentFragmentPDT+r.pm.data.player_playhead_time-r.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,s(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var n=this.pm.getPlayheadTime();typeof n<"u"&&(this.pm.data.player_playhead_time=n,s(),this._updateMaxPlayheadPosition())}}}]),i}(),ZT=QT,$m=5*60*1e3,JT=function i(e){if(mt(this,i),!e.disableRebufferTracking){var t,r=function(n,a){s(a),t=void 0},s=function(n){if(t){var a=n.viewer_time-t;et(e.data,"view_rebuffer_duration",a),t=n.viewer_time,e.data.view_rebuffer_duration>$m&&(e.emit("viewend"),e.send("viewend"),e.mux.log.warn("Ending view after rebuffering for longer than ".concat($m,"ms, future events will be ignored unless a programchange or videochange occurs.")))}e.data.view_watch_time>=0&&e.data.view_rebuffer_count>0&&(e.data.view_rebuffer_frequency=e.data.view_rebuffer_count/e.data.view_watch_time,e.data.view_rebuffer_percentage=e.data.view_rebuffer_duration/e.data.view_watch_time)};e.on("playbackheartbeat",function(n,a){return s(a)}),e.on("rebufferstart",function(n,a){t||(et(e.data,"view_rebuffer_count",1),t=a.viewer_time,e.one("rebufferend",r))}),e.on("viewinit",function(){t=void 0,e.off("rebufferend",r)})}},e_=JT,t_=function(){function i(e){var t=this;mt(this,i),B(this,"_lastCheckedTime",void 0),B(this,"_lastPlayheadTime",void 0),B(this,"_lastPlayheadTimeUpdatedTime",void 0),B(this,"_rebuffering",void 0),B(this,"pm",void 0),this.pm=e,!(e.disableRebufferTracking||e.disablePlayheadRebufferTracking)&&(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,e.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),e.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),e.on("seeking",function(){t._cleanupRebufferTracker(null,{viewer_time:tt.now()})}))}return Pi(i,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing){this._cleanupRebufferTracker(e,t);return}if(this._lastCheckedTime===null){this._prepareRebufferTrackerState(t.viewer_time);return}if(this._lastPlayheadTime!==this.pm.data.player_playhead_time){this._cleanupRebufferTracker(e,t,!0);return}var r=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.sustainedRebufferThreshold=="number"&&r>=this.pm.sustainedRebufferThreshold&&(this._rebuffering||(this._rebuffering=!0,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}))),this._lastCheckedTime=t.viewer_time}},{key:"_clearRebufferTrackerState",value:function(){this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null}},{key:"_prepareRebufferTrackerState",value:function(e){this._lastCheckedTime=e,this._lastPlayheadTime=this.pm.data.player_playhead_time,this._lastPlayheadTimeUpdatedTime=e}},{key:"_cleanupRebufferTracker",value:function(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(this._lastCheckedTime===null)return;var s=this.pm.data.player_playhead_time-this._lastPlayheadTime,n=t.viewer_time-this._lastPlayheadTimeUpdatedTime;typeof this.pm.minimumRebufferDuration=="number"&&s>0&&n-s>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+n-s}))}r?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),i}(),i_=t_,r_=function(){function i(e){var t=this;mt(this,i),B(this,"NAVIGATION_START",void 0),B(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){var r=e.data,s=r.view_id;if(!r.view_program_changed){var n=function(a,o){var l=o.viewer_time;(a.type==="playing"&&typeof e.data.view_time_to_first_frame>"u"||a.type==="adplaying"&&(typeof e.data.view_time_to_first_frame>"u"||t._inPrerollPosition()))&&t.calculateTimeToFirstFrame(l||tt.now(),s)};e.one("playing",n),e.one("adplaying",n),e.one("viewend",function(){e.off("playing",n),e.off("adplaying",n)})}})}return Pi(i,[{key:"_inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"calculateTimeToFirstFrame",value:function(e,t){t===this.pm.data.view_id&&(this.pm.watchTimeTracker._updateWatchTime(null,{viewer_time:e}),this.pm.data.view_time_to_first_frame=this.pm.data.view_watch_time,(this.pm.data.player_autoplay_on||this.pm.data.video_is_autoplay)&&this.NAVIGATION_START&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.NAVIGATION_START))}}]),i}(),s_=r_,n_=function i(e){var t=this;mt(this,i),B(this,"_lastPlayerHeight",void 0),B(this,"_lastPlayerWidth",void 0),B(this,"_lastPlayheadPosition",void 0),B(this,"_lastSourceHeight",void 0),B(this,"_lastSourceWidth",void 0),e.on("viewinit",function(){t._lastPlayheadPosition=-1});var r=["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend"],s=["playing","hb","renditionchange","orientationchange"];r.forEach(function(n){e.on(n,function(){if(t._lastPlayheadPosition>=0&&e.data.player_playhead_time>=0&&t._lastPlayerWidth>=0&&t._lastSourceWidth>0&&t._lastPlayerHeight>=0&&t._lastSourceHeight>0){var a=e.data.player_playhead_time-t._lastPlayheadPosition;if(a<0){t._lastPlayheadPosition=-1;return}var o=Math.min(t._lastPlayerWidth/t._lastSourceWidth,t._lastPlayerHeight/t._lastSourceHeight),l=Math.max(0,o-1),d=Math.max(0,1-o);e.data.view_max_upscale_percentage=Math.max(e.data.view_max_upscale_percentage||0,l),e.data.view_max_downscale_percentage=Math.max(e.data.view_max_downscale_percentage||0,d),et(e.data,"view_total_content_playback_time",a),et(e.data,"view_total_upscaling",l*a),et(e.data,"view_total_downscaling",d*a)}t._lastPlayheadPosition=-1})}),s.forEach(function(n){e.on(n,function(){t._lastPlayheadPosition=e.data.player_playhead_time,t._lastPlayerWidth=e.data.player_width,t._lastPlayerHeight=e.data.player_height,t._lastSourceWidth=e.data.video_source_width,t._lastSourceHeight=e.data.video_source_height})})},a_=n_,o_=2e3,l_=function i(e){var t=this;mt(this,i),B(this,"isSeeking",void 0),this.isSeeking=!1;var r=-1,s=function(){var n=tt.now(),a=(e.data.viewer_time||n)-(r||n);et(e.data,"view_seek_duration",a),e.data.view_max_seek_time=Math.max(e.data.view_max_seek_time||0,a),t.isSeeking=!1,r=-1};e.on("seeking",function(n,a){if(Object.assign(e.data,a),t.isSeeking&&a.viewer_time-r<=o_){r=a.viewer_time;return}t.isSeeking&&s(),t.isSeeking=!0,r=a.viewer_time,et(e.data,"view_seek_count",1),e.send("seeking")}),e.on("seeked",function(){s()}),e.on("viewend",function(){t.isSeeking&&(s(),e.send("seeked")),t.isSeeking=!1,r=-1})},d_=l_,Bm=function(i,e){i.push(e),i.sort(function(t,r){return t.viewer_time-r.viewer_time})},u_=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],c_=function(){function i(e){var t=this;mt(this,i),B(this,"_adHasPlayed",void 0),B(this,"_adRequests",void 0),B(this,"_adResponses",void 0),B(this,"_currentAdRequestNumber",void 0),B(this,"_currentAdResponseNumber",void 0),B(this,"_prerollPlayTime",void 0),B(this,"_wouldBeNewAdPlay",void 0),B(this,"isAdBreak",void 0),B(this,"pm",void 0),this.pm=e,e.on("viewinit",function(){t.isAdBreak=!1,t._currentAdRequestNumber=0,t._currentAdResponseNumber=0,t._adRequests=[],t._adResponses=[],t._adHasPlayed=!1,t._wouldBeNewAdPlay=!0,t._prerollPlayTime=void 0}),u_.forEach(function(s){return e.on(s,t._updateAdData.bind(t))});var r=function(){t.isAdBreak=!1};e.on("adbreakstart",function(){t.isAdBreak=!0}),e.on("play",r),e.on("playing",r),e.on("viewend",r),e.on("adrequest",function(s,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdRequestNumber++},n),Bm(t._adRequests,n),et(e.data,"view_ad_request_count"),t.inPrerollPosition()&&(e.data.view_preroll_requested=!0,t._adHasPlayed||et(e.data,"view_preroll_request_count"))}),e.on("adresponse",function(s,n){n=Object.assign({ad_request_id:"generatedAdRequestId"+t._currentAdResponseNumber++},n),Bm(t._adResponses,n);var a=t.findAdRequest(n.ad_request_id);a&&et(e.data,"view_ad_request_time",Math.max(0,n.viewer_time-a.viewer_time))}),e.on("adplay",function(s,n){t._adHasPlayed=!0,t._wouldBeNewAdPlay&&(t._wouldBeNewAdPlay=!1,et(e.data,"view_ad_played_count")),t.inPrerollPosition()&&!e.data.view_preroll_played&&(e.data.view_preroll_played=!0,t._adRequests.length>0&&(e.data.view_preroll_request_time=Math.max(0,n.viewer_time-t._adRequests[0].viewer_time)),e.data.view_start&&(e.data.view_startup_preroll_request_time=Math.max(0,n.viewer_time-e.data.view_start)),t._prerollPlayTime=n.viewer_time)}),e.on("adplaying",function(s,n){t.inPrerollPosition()&&typeof e.data.view_preroll_load_time>"u"&&typeof t._prerollPlayTime<"u"&&(e.data.view_preroll_load_time=n.viewer_time-t._prerollPlayTime,e.data.view_startup_preroll_load_time=n.viewer_time-t._prerollPlayTime)}),e.on("adclicked",function(s,n){t._wouldBeNewAdPlay||et(e.data,"view_ad_clicked_count")}),e.on("adskipped",function(s,n){t._wouldBeNewAdPlay||et(e.data,"view_ad_skipped_count")}),e.on("adended",function(){t._wouldBeNewAdPlay=!0}),e.on("aderror",function(){t._wouldBeNewAdPlay=!0})}return Pi(i,[{key:"inPrerollPosition",value:function(){return typeof this.pm.data.view_content_playback_time>"u"||this.pm.data.view_content_playback_time<=1e3}},{key:"findAdRequest",value:function(e){for(var t=0;t<this._adRequests.length;t++)if(this._adRequests[t].ad_request_id===e)return this._adRequests[t]}},{key:"_updateAdData",value:function(e,t){if(this.inPrerollPosition()){if(!this.pm.data.view_preroll_ad_tag_hostname&&t.ad_tag_url){var r=Zi(Oa(t.ad_tag_url),2),s=r[0],n=r[1];this.pm.data.view_preroll_ad_tag_domain=n,this.pm.data.view_preroll_ad_tag_hostname=s}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var a=Zi(Oa(t.ad_asset_url),2),o=a[0],l=a[1];this.pm.data.view_preroll_ad_asset_domain=l,this.pm.data.view_preroll_ad_asset_hostname=o}}this.pm.data.ad_asset_url=t==null?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=t==null?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=t==null?void 0:t.ad_creative_id,this.pm.data.ad_id=t==null?void 0:t.ad_id,this.pm.data.ad_universal_id=t==null?void 0:t.ad_universal_id}}]),i}
14(),h_=c_,Hm=Pt(ai()),f_=function i(e){mt(this,i);var t,r,s=function(){e.disableRebufferTracking||(et(e.data,"view_waiting_rebuffer_count",1),t=tt.now(),r=Hm.default.setInterval(function(){if(t){var d=tt.now();et(e.data,"view_waiting_rebuffer_duration",d-t),t=d}},250))},n=function(){e.disableRebufferTracking||t&&(et(e.data,"view_waiting_rebuffer_duration",tt.now()-t),t=!1,Hm.default.clearInterval(r))},a=!1,o=function(){a=!0},l=function(){a=!1,n()};e.on("waiting",function(){a&&s()}),e.on("playing",function(){n(),o()}),e.on("pause",l),e.on("seeking",l)},m_=f_,p_=function i(e){var t=this;mt(this,i),B(this,"lastWallClockTime",void 0);var r=function(){t.lastWallClockTime=tt.now(),e.on("before*",s)},s=function(n){var a=tt.now(),o=t.lastWallClockTime;t.lastWallClockTime=a,a-o>3e4&&(e.emit("devicesleep",{viewer_time:o}),Object.assign(e.data,{viewer_time:o}),e.send("devicesleep"),e.emit("devicewake",{viewer_time:a}),Object.assign(e.data,{viewer_time:a}),e.send("devicewake"))};e.one("playbackheartbeat",r),e.on("playbackheartbeatend",function(){e.off("before*",s),e.one("playbackheartbeat",r)})},g_=p_,lu=Pt(ai()),R0=function(i){return i()}(function(){var i=function(){for(var t=0,r={};t<arguments.length;t++){var s=arguments[t];for(var n in s)r[n]=s[n]}return r};function e(t){function r(s,n,a){var o;if(typeof document<"u"){if(arguments.length>1){if(a=i({path:"/"},r.defaults,a),typeof a.expires=="number"){var l=new Date;l.setMilliseconds(l.getMilliseconds()+a.expires*864e5),a.expires=l}try{o=JSON.stringify(n),/^[\{\[]/.test(o)&&(n=o)}catch{}return t.write?n=t.write(n,s):n=encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),s=encodeURIComponent(String(s)),s=s.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),s=s.replace(/[\(\)]/g,escape),document.cookie=[s,"=",n,a.expires?"; expires="+a.expires.toUTCString():"",a.path?"; path="+a.path:"",a.domain?"; domain="+a.domain:"",a.secure?"; secure":""].join("")}s||(o={});for(var d=document.cookie?document.cookie.split("; "):[],u=/(%[0-9A-Z]{2})+/g,c=0;c<d.length;c++){var h=d[c].split("="),f=h.slice(1).join("=");f.charAt(0)==='"'&&(f=f.slice(1,-1));try{var m=h[0].replace(u,decodeURIComponent);if(f=t.read?t.read(f,m):t(f,m)||f.replace(u,decodeURIComponent),this.json)try{f=JSON.parse(f)}catch{}if(s===m){o=f;break}s||(o[m]=f)}catch{}}return o}}return r.set=r,r.get=function(s){return r.call(r,s)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(s,n){r(s,"",i(n,{expires:-1}))},r.withConverter=e,r}return e(function(){})}),L0="muxData",v_=function(i){return Object.entries(i).map(function(e){var t=Zi(e,2),r=t[0],s=t[1];return"".concat(r,"=").concat(s)}).join("&")},E_=function(i){return i.split("&").reduce(function(e,t){var r=Zi(t.split("="),2),s=r[0],n=r[1],a=+n,o=n&&a==n?a:n;return e[s]=o,e},{})},I0=function(){var i;try{i=E_(R0.get(L0)||"")}catch{i={}}return i},k0=function(i){try{R0.set(L0,v_(i),{expires:365})}catch{}},y_=function(){var i=I0();return i.mux_viewer_id=i.mux_viewer_id||Ma(),i.msn=i.msn||Math.random(),k0(i),{mux_viewer_id:i.mux_viewer_id,mux_sample_number:i.msn}},b_=function(){var i=I0(),e=tt.now();return i.session_start&&(i.sst=i.session_start,delete i.session_start),i.session_id&&(i.sid=i.session_id,delete i.session_id),i.session_expires&&(i.sex=i.session_expires,delete i.session_expires),(!i.sex||i.sex<e)&&(i.sid=Ma(),i.sst=e),i.sex=e+25*60*1e3,k0(i),{session_id:i.sid,session_start:i.sst,session_expires:i.sex}};function T_(i,e){var t=e.beaconCollectionDomain,r=e.beaconDomain;if(t)return"https://"+t;i=i||"inferred";var s=r||"litix.io";return i.match(/^[a-z0-9]+$/)?"https://"+i+"."+s:"https://img.litix.io/a.gif"}var __=Pt(ai()),w0=function(){var i;switch(D0()){case"cellular":i="cellular";break;case"ethernet":i="wired";break;case"wifi":i="wifi";break;case void 0:break;default:i="other"}return i},D0=function(){var i=__.default.navigator,e=i&&(i.connection||i.mozConnection||i.webkitConnection);return e&&e.type};w0.getConnectionFromAPI=D0;var A_=w0,S_={a:"env",b:"beacon",c:"custom",d:"ad",e:"event",f:"experiment",i:"internal",m:"mux",n:"response",p:"player",q:"request",r:"retry",s:"session",t:"timestamp",u:"viewer",v:"video",w:"page",x:"view",y:"sub"},x_=C0(S_),R_={ad:"ad",af:"affiliate",ag:"aggregate",ap:"api",al:"application",ao:"audio",ar:"architecture",as:"asset",au:"autoplay",av:"average",bi:"bitrate",bn:"brand",br:"break",bw:"browser",by:"bytes",bz:"business",ca:"cached",cb:"cancel",cc:"codec",cd:"code",cg:"category",ch:"changed",ci:"client",ck:"clicked",cl:"canceled",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cx:"c
14onnection",cz:"context",dg:"downscaling",dm:"domain",dn:"cdn",do:"downscale",dr:"drm",dp:"dropped",du:"duration",dv:"device",dy:"dynamic",eb:"enabled",ec:"encoding",ed:"edge",en:"end",eg:"engine",em:"embed",er:"error",ep:"experiments",es:"errorcode",et:"errortext",ee:"event",ev:"events",ex:"expires",ez:"exception",fa:"failed",fi:"first",fm:"family",ft:"format",fp:"fps",fq:"frequency",fr:"frame",fs:"fullscreen",ha:"has",hb:"holdback",he:"headers",ho:"host",hn:"hostname",ht:"height",id:"id",ii:"init",in:"instance",ip:"ip",is:"is",ke:"key",la:"language",lb:"labeled",le:"level",li:"live",ld:"loaded",lo:"load",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mx:"mux",ne:"newest",nm:"name",no:"number",on:"on",or:"origin",os:"os",pa:"paused",pb:"playback",pd:"producer",pe:"percentage",pf:"played",pg:"program",ph:"playhead",pi:"plugin",pl:"preroll",pn:"playing",po:"poster",pp:"pip",pr:"preload",ps:"position",pt:"part",py:"property",px:"pop",pz:"plan",ra:"rate",rd:"requested",re:"rebuffer",rf:"rendition",rg:"range",rm:"remote",ro:"ratio",rp:"response",rq:"request",rs:"requests",sa:"sample",sd:"skipped",se:"session",sh:"shift",sk:"seek",sm:"stream",so:"source",sq:"sequence",sr:"series",ss:"status",st:"start",su:"startup",sv:"server",sw:"software",sy:"severity",ta:"tag",tc:"tech",te:"text",tg:"target",th:"throughput",ti:"time",tl:"total",to:"to",tt:"title",ty:"type",ug:"upscaling",un:"universal",up:"upscale",ur:"url",us:"user",va:"variant",vd:"viewed",vi:"video",ve:"version",vw:"view",vr:"viewer",wd:"width",wa:"watch",wt:"waiting"},Gm=C0(R_);function C0(i){var e={};for(var t in i)i.hasOwnProperty(t)&&(e[i[t]]=t);return e}function tc(i){var e={},t={};
vendor: 7,309 bytes, line 14
14return Object.keys(i).forEach(function(r){var s=!1;if(i.hasOwnProperty(r)&&i[r]!==void 0){var n=r.split("_"),a=n[0],o=x_[a];o||(De.info("Data key word `"+n[0]+"` not expected in "+r),o=a+"_"),n.splice(1).forEach(function(l){l==="url"&&(s=!0),Gm[l]?o+=Gm[l]:Number.isInteger(Number(l))?o+=l:(De.info("Data key word `"+l+"` not expected in "+r),o+="_"+l+"_")}),s?t[o]=i[r]:e[o]=i[r]}}),Object.assign(e,t)}var rs=Pt(ai()),L_=Pt(T0()),I_={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},k_=56*1024,w_=["hb","requestcompleted","requestfailed","requestcanceled"],D_="https://img.litix.io",er=function(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this._beaconUrl=i||D_,this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},I_,e)};er.prototype.queueEvent=function(i,e){var t=Object.assign({},e);return this._eventQueue.length<=this._options.maxQueueLength||i==="eventrateexceeded"?(this._eventQueue.push(t),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength):!1};er.prototype.flushEvents=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(i&&this._eventQueue.length===1){this._eventQueue.pop();return}this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()};er.prototype.destroy=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;this.destroyed=!0,i?this._clearBeaconQueue():this.flushEvents(),rs.default.clearTimeout(this._sendTimeout)};er.prototype._clearBeaconQueue=function(){var i=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,e=this._eventQueue.slice(i);i>0&&Object.assign(e[e.length-1],tc({mux_view_message:"event queue truncated"}));var t=this._createPayload(e);M0(this._beaconUrl,t,!0,function(){})};er.prototype._sendBeaconQueue=function(){var i=this;if(this._postInFlight){this._resendAfterPost=!0;return}var e=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var t=this._createPayload(e),r=tt.now();M0(this._beaconUrl,t,!1,function(s,n){n?(i._eventQueue=e.concat(i._eventQueue),i._failureCount+=1,De.info("Error sending beacon: "+n)):i._failureCount=0,i._roundTripTime=tt.now()-r,i._postInFlight=!1,i._resendAfterPost&&(i._resendAfterPost=!1,i._eventQueue.length>0&&i._sendBeaconQueue())})};er.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var i=Math.pow(2,this._failureCount-1);return i=i*Math.random(),(1+i)*this._options.baseTimeBetweenBeacons};er.prototype._startBeaconSending=function(){var i=this;rs.default.clearTimeout(this._sendTimeout),!this.destroyed&&(this._sendTimeout=rs.default.setTimeout(function(){i._eventQueue.length&&i._sendBeaconQueue(),i._startBeaconSending()},this._getNextBeaconTime()))};er.prototype._createPayload=function(i){var e=this,t={transmission_timestamp:Math.round(tt.now())};this._roundTripTime&&(t.rtt_ms=Math.round(this._roundTripTime));var r,s,n,a=function(){r=JSON.stringify({metadata:t,events:s||i}),n=r.length/1024},o=function(){return n<=e._options.maxPayloadKBSize};return a(),o()||(De.info("Payload size is too big ("+n+" kb). Removing unnecessary events."),s=i.filter(function(l){return w_.indexOf(l.e)===-1}),a()),o()||(De.info("Payload size still too big ("+n+" kb). Cropping fields.."),s.forEach(function(l){for(var d in l){var u=l[d],c=50*1024;typeof u=="string"&&u.length>c&&(l[d]=u.substring(0,c))}}),a()),r};var C_=typeof L_.default.exitPictureInPicture=="function"?function(i){return i.length<=k_}:function(i){return!1},M0=function(i,e,t,r){if(t&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(i,e)){r();return}if(rs.default.fetch){rs.default.fetch(i,{method:"POST",body:e,headers:{"Content-Type":"text/plain"},keepalive:C_(e)}).then(function(n){return r(null,n.ok?null:"Error")}).catch(function(n){return r(null,n)});return}if(rs.default.XMLHttpRequest){var s=new rs.default.XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState===4)return r(null,s.status!==200?"error":void 0)},s.open("POST",i),s.setRequestHeader("Content-Type","text/plain"),s.send(e);return}r()},M_=er,O_=["env_key","view_id","view_sequence_number","player_sequence_number","beacon_domain","player_playhead_time","viewer_time","mux_api_version","event","video_id","player_instance_id","player_error_code","player_error_message","player_error_context","player_error_severity","player_error_business_exception"],P_=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],N_=["ad_id","ad_creative_id","ad_universal_id"],U_=["viewstart","error","ended","viewend"],F_=10*60*1e3,$_=function(){function i(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};mt(this,i);var s,n,a,o,l,d,u,c,h,f,m,p;B(this,"mux",void 0),B(this,"envKey",void 0),B(this,"options",void 0),B(this,"eventQueue",void 0),B(this,"sampleRate",void 0),B(this,"disableCookies",void 0),B(this,"respectDoNotTrack",void 0),B(this,"previousBeaconData",void 0),B(this,"lastEventTime",void 0),B(this,"rateLimited",void 0),B(this,"pageLevelData",void 0),B(this,"viewerData",void 0),this.mux=e,this.envKey=t,this.options=r,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new M_(T_(this.envKey,this.options));var g;this.sampleRate=(g=this.options.sampleRate)!==null&&g!==void 0?g:1;var v;this.disableCookies=(v=this.options.disableCookies)!==null&&v!==void 0?v:!1;var b;this.respectDoNotTrack=(b=this.options.respectDoNotTrack)!==null&&b!==void 0?b:!1,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.pageLevelData={mux_api_version:this.mux.API_VERSION,mux_embed:this.mux.NAME,mux_embed_version:this.mux.VERSION,viewer_application_name:(s=this.options.platform)===null||s===void 0?void 0:s.name,viewer_application_version:(n=this.options.platform)===null||n===void 0?void 0:n.version,viewer_application_engine:(a=this.options.platform)===null||a===void 0?void 0:a.layout,viewer_device_name:(o=this.options.platform)===null||o===void 0?void 0:o.product,viewer_device_category:"",viewer_device_manufacturer:(l=this.options.platform)===null||l===void 0?void 0:l.manufacturer,viewer_os_family:(u=this.options.platform)===null||u===void 0||(d=u.os)===null||d===void 0?void 0:d.family,viewer_os_architecture:(h=this.options.platform)===null||h===void 0||(c=h.os)===null||c===void 0?void 0:c.architecture,viewer_os_version:(m=this.options.platform)===null||m===void 0||(f=m.os)===null||f===void 0?void 0:f.version,viewer_connection_type:A_(),page_url:lu.default===null||lu.default===void 0||(p=lu.default.location)===null||p===void 0?void 0:p.href},this.viewerData=this.disableCookies?{}:y_()}return Pi(i,[{key:"send",value:function(e,t){if(!(!e||!(t!=null&&t.view_id))){if(this.respectDoNotTrack&&Ju())return De.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||typeof t!="object")return De.error("A data object was expected in send() but was not provided");var r=this.disableCookies?{}:b_(),s=Bh(Zl({},this.pageLevelData,t,r,this.viewerData),{event:e,env_key:this.envKey});
vendor: 5,634 bytes, line 14
14s.user_id&&(s.viewer_user_id=s.user_id,delete s.user_id);var n,a=((n=s.mux_sample_number)!==null&&n!==void 0?n:0)>=this.sampleRate,o=this._deduplicateBeaconData(e,s),l=tc(o);if(this.lastEventTime=this.mux.utils.now(),a)return De.info("Not sending event due to sample rate restriction",e,s,l);if(this.envKey||De.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,s,l),!this.rateLimited){if(De.info("Sending event",e,s,l),this.rateLimited=!this.eventQueue.queueEvent(e,l),this.mux.WINDOW_UNLOADING&&e==="viewend")this.eventQueue.destroy(!0);else if(this.mux.WINDOW_HIDDEN&&e==="hb"?this.eventQueue.flushEvents(!0):U_.indexOf(e)>=0&&this.eventQueue.flushEvents(),this.rateLimited)return s.event="eventrateexceeded",l=tc(s),this.eventQueue.queueEvent(s.event,l),De.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var r=this,s={},n=t.view_id;if(n==="-1"||e==="viewstart"||e==="viewend"||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=F_)s=Zl({},t),n&&(this.previousBeaconData=s),n&&e==="viewend"&&(this.previousBeaconData=null);else{var a=e.indexOf("request")===0;Object.entries(t).forEach(function(o){var l=Zi(o,2),d=l[0],u=l[1];r.previousBeaconData&&(u!==r.previousBeaconData[d]||O_.indexOf(d)>-1||r.objectHasChanged(a,d,u,r.previousBeaconData[d])||r.eventRequiresKey(e,d))&&(s[d]=u,r.previousBeaconData[d]=u)})}return s}},{key:"objectHasChanged",value:function(e,t,r,s){return!e||t.indexOf("request_")!==0?!1:t==="request_response_headers"||typeof r!="object"||typeof s!="object"?!0:Object.keys(r||{}).length!==Object.keys(s||{}).length}},{key:"eventRequiresKey",value:function(e,t){return!!(e==="renditionchange"&&t.indexOf("video_source_")===0||N_.includes(t)&&P_.includes(e))}}]),i}(),B_=function i(e){mt(this,i);var t=0,r=0,s=0,n=0,a=0,o=0,l=0,d=function(h,f){var m=f.request_start,p=f.request_response_start,g=f.request_response_end,v=f.request_bytes_loaded;n++;var b,y;if(p?(b=p-(m??0),y=(g??0)-p):y=(g??0)-(m??0),y>0&&v&&v>0){var A=v/y*8e3;a++,r+=v,s+=y,e.data.view_min_request_throughput=Math.min(e.data.view_min_request_throughput||1/0,A),e.data.view_average_request_throughput=r/s*8e3,e.data.view_request_count=n,b>0&&(t+=b,e.data.view_max_request_latency=Math.max(e.data.view_max_request_latency||0,b),e.data.view_average_request_latency=t/a)}},u=function(h,f){n++,o++,e.data.view_request_count=n,e.data.view_request_failed_count=o},c=function(h,f){n++,l++,e.data.view_request_count=n,e.data.view_request_canceled_count=l};e.on("requestcompleted",d),e.on("requestfailed",u),e.on("requestcanceled",c)},H_=B_,G_=60*60*1e3,K_=function i(e){var t=this;mt(this,i),B(this,"_lastEventTime",void 0),e.on("before*",function(r,s){var n=s.viewer_time,a=tt.now(),o=t._lastEventTime;if(t._lastEventTime=a,o&&a-o>G_){var l=Object.keys(e.data).reduce(function(u,c){return c.indexOf("video_")===0?Object.assign(u,B({},c,e.data[c])):u},{});e.mux.log.info("Received event after at least an hour inactivity, creating a new view");var d=e.playbackHeartbeat._playheadShouldBeProgressing;e._resetView(Object.assign({viewer_time:n},l)),e.playbackHeartbeat._playheadShouldBeProgressing=d,e.playbackHeartbeat._playheadShouldBeProgressing&&r.type!=="play"&&r.type!=="adbreakstart"&&(e.emit("play",{viewer_time:n}),r.type!=="playing"&&e.emit("playing",{viewer_time:n}))}})},V_=K_,W_=["viewstart","ended","loadstart","pause","play","playing","ratechange","waiting","adplay","adpause","adended","aderror","adplaying","adrequest","adresponse","adbreakstart","adbreakend","adfirstquartile","admidpoint","adthirdquartile","rebufferstart","rebufferend","seeked","error","hb","requestcompleted","requestfailed","requestcanceled","renditionchange"],Y_=new Set(["requestcompleted","requestfailed","requestcanceled"]),q_=function(i){xT(t,i);var e=IT(t);function t(r,s,n){mt(this,t);var a;a=e.call(this),B(se(a),"DOM_CONTENT_LOADED_EVENT_END",void 0),B(se(a),"NAVIGATION_START",void 0),B(se(a),"_destroyed",void 0),B(se(a),"_heartBeatTimeout",void 0),B(se(a),"adTracker",void 0),B(se(a),"dashjs",void 0),B(se(a),"data",void 0),B(se(a),"disablePlayheadRebufferTracking",void 0),B(se(a),"disableRebufferTracking",void 0),B(se(a),"errorTracker",void 0),B(se(a),"errorTranslator",void 0),B(se(a),"emitTranslator",void 0),B(se(a),"getAdData",void 0),B(se(a),"getPlayheadTime",void 0),B(se(a),"getStateData",void 0),B(se(a),"stateDataTranslator",void 0),B(se(a),"hlsjs",void 0),B(se(a),"id",void 0),B(se(a),"longResumeTracker",void 0),B(se(a),"minimumRebufferDuration",void 0),B(se(a),"mux",void 0),B(se(a),"playbackEventDispatcher",void 0),B(se(a),"playbackHeartbeat",void 0),B(se(a),"playbackHeartbeatTime",void 0),B(se(a),"playheadTime",void 0),B(se(a),"seekingTracker",void 0),B(se(a),"sustainedRebufferThreshold",void 0),B(se(a),"watchTimeTracker",void 0),B(se(a),"currentFragmentPDT",void 0),B(se(a),"currentFragmentStart",void 0),a.DOM_CONTENT_LOADED_EVENT_END=Ql.domContentLoadedEventEnd(),a.NAVIGATION_START=Ql.navigationStart();var o={debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,errorTranslator:function(h){return h},emitTranslator:function(){for(var h=arguments.length,f=new Array(h),m=0;m<h;m++)f[m]=arguments[m];return f},stateDataTranslator:function(h){return h}};a.mux=r,a.id=s,n!=null&&n.beaconDomain&&a.mux.log.warn("The `beaconDomain` setting has been deprecated
14in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),n=Object.assign(o,n),n.data=n.data||{},n.data.property_key&&(n.data.env_key=n.data.property_key,delete n.data.property_key),De.level=n.debug?is.DEBUG:is.WARN,a.getPlayheadTime=n.getPlayheadTime,a.getStateData=n.getStateData||function(){return{}},a.getAdData=n.getAdData||function(){},a.minimumRebufferDuration=n.minimumRebufferDuration,a.sustainedRebufferThreshold=n.sustainedRebufferThreshold,a.playbackHeartbeatTime=n.playbackHeartbeatTime,a.disableRebufferTracking=n.disableRebufferTracking,a.disableRebufferTracking&&a.mux.log.warn("Disabling rebuffer tracking. This should only be used in specific circumstances as a last resort when your player is known to unreliably track rebuffering."),a.disablePlayheadRebufferTracking=n.disablePlayheadRebufferTracking,a.errorTranslator=n.errorTranslator,a.emitTranslator=n.emitTranslator,a.stateDataTranslator=n.stateDataTranslator,a.playbackEventDispatcher=new $_(r,n.data.env_key,n),a.data={player_instance_id:Ma(),mux_sample_rate:n.sampleRate,beacon_domain:n.beaconCollectionDomain||n.beaconDomain},a.data.view_sequence_number=1,a.data.player_sequence_number=1;var l=(function(){typeof this.data.view_start>"u"&&(this.data.view_start=this.mux.utils.now(),this.emit("viewstart"))}).bind(se(a));if(a.on("viewinit",function(h,f){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,f),this._initializeViewData(),this.one("play",l),this.one("adbreakstart",l)}),a.on("videochange",function(h,f){this._resetView(f)}),a.on("programchange",function(h,f){this.data.player_is_paused&&this.mux.log.warn("The `programchange` event is intended to be used when the content changes mid playback without the video source changing, however the video is not currently playing. If the video source is changing please use the videochange event otherwise you will lose startup time information."),this._resetView(Object.assign(f,{view_program_changed:!0})),l(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(h,f){this.currentFragmentPDT=f.currentFragmentPDT,this.currentFragmentStart=f.currentFragmentStart}),a.on("destroy",a.destroy),typeof window<"u"&&typeof window.addEventListener=="function"&&typeof window.removeEventListener=="function"){var d=function(){var h=typeof a.data.view_start<"u";a.mux.WINDOW_HIDDEN=document.visibilityState==="hidden",h&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",d,!1);var u=function(h){h.persisted||a.destroy()};window.addEventListener("pagehide",u,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",d),window.removeEventListener("pagehide",u)})}a.on("playerready",function(h,f){Object.assign(this.data,f)}),W_.forEach(function(h){a.on(h,function(f,m){h.indexOf("ad")!==0&&this._updateStateData(),Object.assign(this.data,m),this._sanitizeData()}),a.on("after"+h,function(){(h!=="error"||this.errorTracker.viewErrored)&&this.send(h)})}),a.on("viewend",function(h,f){Object.assign(a.data,f)});var c=function(h){var f=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=f-this.data.player_init_time),!this.mux.PLAYER_TRACKED&&this.NAVIGATION_START&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.DOM_CONTENT_LOADED_EVENT_END)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.DOM_CONTENT_LOADED_EVENT_END||1/0)-this.NAVIGATION_START)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time};return a.one("playerready",c),a.longResumeTracker=new V_(se(a)),a.errorTracker=new YT(se(a)),new g_(se(a)),a.seekingTracker=new d_(se(a)),a.playheadTime=new ZT(se(a)),a.playbackHeartbeat=new VT(se(a)),new a_(se(a)),a.watchTimeTracker=new jT(se(a)),new XT(se(a)),a.adTracker=new h_(se(a)),new i_(se(a)),new e_(se(a)),new s_(se(a)),new m_(se(a)),new H_(se(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addDashJS(n),a.emit("viewinit",n.data),a}
vendor: 18,536 bytes, lines 14-22
14return Pi(t,[{key:"emit",value:function(r,s){var n,a=Object.assign({viewer_time:this.mux.utils.now()},s),o=[r,a];if(this.emitTranslator)try{o=this.emitTranslator(r,a)}catch(l){this.mux.log.warn("Exception in emit translator callback.",l)}o!=null&&o.length&&(n=No(Sn(t.prototype),"emit",this)).call.apply(n,[this].concat(Xt(o)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,typeof this.data.view_start<"u"&&(this.emit("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(r){if(this.data.view_id){var s=Object.assign({},this.data),n=["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"];if(s.video_source_is_live===void 0&&(s.player_source_duration===1/0||s.video_source_duration===1/0?s.video_source_is_live=!0:(s.player_source_duration>0||s.video_source_duration>0)&&(s.video_source_is_live=!1)),s.video_source_is_live||n.forEach(function(d){s[d]=void 0}),s.video_source_url=s.video_source_url||s.player_source_url,s.video_source_url){var a=Zi(Oa(s.video_source_url),2),o=a[0],l=a[1];s.video_source_domain=l,s.video_source_hostname=o}delete s.ad_request_id,this.playbackEventDispatcher.send(r,s),this.data.view_sequence_number++,this.data.player_sequence_number++,Y_.has(r)||this._restartHeartBeat(),r==="viewend"&&delete this.data.view_id}}},{key:"_resetView",value:function(r){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",r)}},{key:"_updateStateData",value:function(){var r=this.getStateData();if(typeof this.stateDataTranslator=="function")try{r=this.stateDataTranslator(r)}catch(s){this.mux.log.warn("Exception in stateDataTranslator translator callback.",s)}Object.assign(this.data,r),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var r=this,s=["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"];s.forEach(function(a){var o=parseInt(r.data[a],10);r.data[a]=isNaN(o)?void 0:o});var n=["player_source_url","video_source_url"];n.forEach(function(a){if(r.data[a]){var o=r.data[a].toLowerCase();(o.indexOf("data:")===0||o.indexOf("blob:")===0)&&(r.data[a]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var r=this;Object.keys(this.data).forEach(function(s){s.indexOf("video_")===0&&delete r.data[s]})}},{key:"_resetViewData",value:function(){var r=this;Object.keys(this.data).forEach(function(s){s.indexOf("view_")===0&&delete r.data[s]}),this.data.view_sequence_number=1}},{key:"_resetErrorData",value:function(){delete this.data.player_error_code,delete this.data.player_error_message,delete this.data.player_error_context,delete this.data.player_error_severity,delete this.data.player_error_business_exception}},{key:"_initializeViewData",value:function(){var r=this,s=this.data.view_id=Ma(),n=function(){s===r.data.view_id&&et(r.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",n):n()}},{key:"_restartHeartBeat",value:function(){var r=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){r.data.player_is_paused||r.emit("hb")},1e4)}},{key:"addHLSJS",value:function(r){if(!r.hlsjs){this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.");return}if(this.hlsjs){this.mux.log.warn("An instance of HLS.js is already being monitored for this player.");return}this.hlsjs=r.hlsjs,OT(this.mux,this.id,r.hlsjs,{},r.Hls||window.Hls)}},{key:"removeHLSJS",value:function(){this.hlsjs&&(PT(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(r){if(!r.dashjs){this.mux.log.warn("You must pass a valid dashjs instance in order to track it.");return}if(this.dashjs){this.mux.log.warn("An instance of Dash.js is already being monitored for this player.");return}this.dashjs=r.dashjs,$T(this.mux,this.id,r.dashjs)}},{key:"removeDashJS",value:function(){this.dashjs&&(BT(this.dashjs),this.dashjs=void 0)}}]),t}(GT),j_=q_,Hn=Pt(T0());function z_(){return Hn.default&&!!(Hn.default.fullscreenElement||Hn.default.webkitFullscreenElement||Hn.default.mozFullScreenElement||Hn.default.msFullscreenElement)}var X_=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],Q_={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"};function Z_(i,e,t){var r=Zi(Xl(e),3),s=r[0],n=r[1],a=r[2],o=i.log,l=i.utils.getComputedStyle,d=i.utils.secondsToMs,u={automaticErrorTracking:!0};if(s){if(a!=="video"&&a!=="audio")return o.error("The element of `"+n+"` was not a media element.")}else return o.error("No element was found with the `"+n+"` query selector.");s.mux&&(s.mux.destroy(),delete s.mux,o.warn("Already monitoring this video element, replacing existing event listeners"));var c={getPlayheadTime:function(){return d(s.currentTime)},getStateData:function(){var f,m,p,g=((f=(m=this).getPlayheadTime)===null||f===void 0?void 0:f.call(m))||d(s.currentTime),v=this.hlsjs&&this.hlsjs.url,b=this.dashjs&&typeof this.dashjs.getSource=="function"&&this.dashjs.getSource(),y={player_is_paused:s.paused,player_width:parseInt(l(s,"width")),player_height:parseInt(l(s,"height")),player_autoplay_on:s.autoplay,player_preload_on:s.preload,player_language_code:s.lang,player_is_fullscreen:z_(),video_poster_url:s.poster,video_source_url:v||b||s.currentSrc,video_source_duration:d(s.duration),video_source_height:s.videoHeight,video_source_width:s.videoWidth,view_dropped_frame_count:s==null||(p=s.getVideoPlaybackQuality)===null||p===void 0?void 0:p.call(s).droppedVideoFrames};if(s.getStartDate&&g>0){var A=s.getStartDate();if(A&&typeof A.getTime=="function"&&A.getTime()){var _=A.getTime();if(y.player_program_time=_+g,s.seekable.length>0){var C=_+s.seekable.end(s.seekable.length-1);y.player_live_edge_program_time=C}}}return y}};t=Object.assign(u,t,c),t.data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:i.VERSION},t.data),s.mux=s.mux||{},s.mux.deleted=!1,s.mux.emit=function(f,m){i.emit(n,f,m)},s.mux.updateData=function(f){s.mux.emit("hb",f)};var h=function(){o.error("The monitor for this video element has already been destroyed.")};s.mux.destroy=function(){Object.keys(s.mux.listeners).forEach(function(f){s.removeEventListener(f,s.mux.listeners[f],!1)}),delete s.mux.listeners,s.mux.destroy=h,s.mux.swapElement=h,s.mux.emit=h,s.mux.addHLSJS=h,s.mux.addDashJS=h,s.mux.removeHLSJS=h,s.mux.removeDashJS=h,s.mux.updateData=h,s.mux.setEmitTranslator=h,s.mux.setStateDataTranslator=h,s.mux.setGetPlayheadTime=h,s.mux.deleted=!0,i.emit(n,"destroy")},s.mux.swapElement=function(f){var m=Zi(Xl(f),3),p=m[0],g=m[1],v=m[2];if(p){if(v!=="video"&&v!=="audio")return i.log.error("The element of `"+g+"` was not a media element.")}else return i.log.error("No element was found with the `"+g+"` query selector.");p.muxId=s.muxId,delete s.muxId,p.mux=p.mux||{},p.mux.listeners=Object.assign({},s.mux.listeners),delete s.mux.listeners,Object.keys(p.mux.listeners).forEach(function(b){s.removeEventListener(b,p.mux.listeners[b],!1),p.addEventListener(b,p.mux.listeners[b],!1)}),p.mux.swapElement=s.mux.swapElement,p.mux.destroy=s.mux.destroy,delete s.mux,s=p},s.mux.addHLSJS=function(f){i.addHLSJS(n,f)},s.mux.addDashJS=function(f){i.addDashJS(n,f)},s.mux.removeHLSJS=function(){i.removeHLSJS(n)},s.mux.removeDashJS=function(){i.removeDashJS(n)},s.mux.setEmitTranslator=function(f){i.setEmitTranslator(n,f)},s.mux.setStateDataTranslator=function(f){i.setStateDataTranslator(n,f)},s.mux.setGetPlayheadTime=function(f){f||(f=t.getPlayheadTime),i.setGetPlayheadTime(n,f)},i.init(n,t),i.emit(n,"playerready"),s.paused||(i.emit(n,"play"),s.readyState>2&&i.emit(n,"playing")),s.mux.listeners={},X_.forEach(function(f){f==="error"&&!t.automaticErrorTracking||(s.mux.listeners[f]=function(){var m={};if(f==="error"){if(!s.error||s.error.code===1)return;m.player_error_code=s.error.code,m.player_error_message=Q_[s.error.code]||s.error.message}i.emit(n,f,m)},s.addEventListener(f,s.mux.listeners[f],!1))})}function J_(i,e,t,r){var s=r;if(i&&typeof i[e]=="function")try{s=i[e].apply(i,t)}catch(n){De.info("safeCall error",n)}return s}var Aa=Pt(ai()),Fs;Aa.default&&Aa.default.WeakMap&&(Fs=new WeakMap);function eA(i,e){if(!i||!e||!Aa.default||typeof Aa.default.getComputedStyle!="function")return"";var t;return Fs&&Fs.has(i)&&(t=Fs.get(i)),t||(t=Aa.default.getComputedStyle(i,null),Fs&&Fs.set(i,t)),t.getPropertyValue(e)}function tA(i){return Math.floor(i*1e3)}var Fr={TARGET_DURATION:"#EXT-X-TARGETDURATION",PART_INF:"#EXT-X-PART-INF",SERVER_CONTROL:"#EXT-X-SERVER-CONTROL",INF:"#EXTINF",PROGRAM_DATE_TIME:"#EXT-X-PROGRAM-DATE-TIME",VERSION:"#EXT-X-VERSION",SESSION_DATA:"#EXT-X-SESSION-DATA"},Od=function(i){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(i),this.manifest};Od.prototype.process=function(i){var e;for(this.buffer+=i,e=this.buffer.indexOf(` 15`);e>-1;e=this.buffer.indexOf(` 16`))this.processLine(this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)};Od.prototype.processLine=function(i){var e=i.indexOf(":"),t=nA(i,e),r=t[0],s=t.length===2?Gh(t[1]):void 0;if(r[0]!=="#")this.currentUri.uri=r,this.manifest.segments.push(this.currentUri),this.manifest.targetDuration&&!("duration"in this.currentUri)&&(this.currentUri.duration=this.manifest.targetDuration),this.currentUri={};else switch(r){case Fr.TARGET_DURATION:{if(!isFinite(s)||s<0)return;this.manifest.targetDuration=s,this.setHoldBack();break}case Fr.PART_INF:{du(this.manifest,t),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break}case Fr.SERVER_CONTROL:{du(this.manifest,t),this.setHoldBack();break}case Fr.INF:{s===0?this.currentUri.duration=.01:s>0&&(this.currentUri.duration=s);break}case Fr.PROGRAM_DATE_TIME:{var n=s,a=new Date(n);this.manifest.dateTimeString||(this.manifest.dateTimeString=n,this.manifest.dateTimeObject=a),this.currentUri.dateTimeString=n,this.currentUri.dateTimeObject=a;break}case Fr.VERSION:{du(this.manifest,t);break}case Fr.SESSION_DATA:{var o=aA(t[1]),l=x0(o);Object.assign(this.manifest.sessionData,l)}}};Od.prototype.setHoldBack=function(){var i=this.manifest,e=i.serverControl,t=i.targetDuration,r=i.partTargetDuration;if(e){var s="holdBack",n="partHoldBack",a=t&&t*3,o=r&&r*2;t&&!e.hasOwnProperty(s)&&(e[s]=a),a&&e[s]<a&&(e[s]=a),r&&!e.hasOwnProperty(n)&&(e[n]=r*3),r&&e[n]<o&&(e[n]=o)}};var du=function(i,e){var t=O0(e[0].replace("#EXT-X-","")),r;sA(e[1])?(r={},r=Object.assign(rA(e[1]),r)):r=Gh(e[1]),i[t]=r},O0=function(i){return i.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},Gh=function(i){if(i.toLowerCase()==="yes"||i.toLowerCase()==="no")return i.toLowerCase()==="yes";var e=i.indexOf(":")!==-1?i:parseFloat(i);return isNaN(e)?i:e},iA=function(i){var e={},t=i.split("=");if(t.length>1){var r=O0(t[0]);e[r]=Gh(t[1])}return e},rA=function(i){for(var e=i.split(","),t={},r=0;e.length>r;r++){var s=e[r],n=iA(s);t=Object.assign(n,t)}return t},sA=function(i){return i.indexOf("=")>-1},nA=function(i,e){return e===-1?[i]:[i.substring(0,e),i.substring(e+1)]},aA=function(i){var e={};if(i){var t=i.search(","),r=i.slice(0,t),s=i.slice(t+1),n=[r,s];return n.forEach(function(a,o){for(var l=a.replace(/['"]+/g,"").split("="),d=0;d<l.length;d++)l[d]==="DATA-ID"&&(e["DATA-ID"]=l[1-d]),l[d]==="VALUE"&&(e.VALUE=l[1-d])}),{data:e}}},oA=Od,lA={safeCall:J_,safeIncrement:et,getComputedStyle:eA,secondsToMs:tA,assign:Object.assign,headersStringToObject:Hh,cdnHeadersToRequestId:Jl,extractHostnameAndDomain:Oa,extractHostname:ri,manifestParser:oA,generateShortID:A0,generateUUID:Ma,now:tt.now,findMediaElement:Xl},dA=lA,uA={PLAYER_READY:"playerready",VIEW_INIT:"viewinit",VIDEO_CHANGE:"videochange",PLAY:"play",PAUSE:"pause",PLAYING:"playing",TIME_UPDATE:"timeupdate",SEEKING:"seeking",SEEKED:"seeked",REBUFFER_START:"rebufferstart",REBUFFER_END:"rebufferend",ERROR:"error",ENDED:"ended",RENDITION_CHANGE:"renditionchange",ORIENTATION_CHANGE:"orientationchange",AD_REQUEST:"adrequest",AD_RESPONSE:"adresponse",AD_BREAK_START:"adbreakstart",AD_PLAY:"adplay",AD_PLAYING:"adplaying",AD_PAUSE:"adpause",AD_FIRST_QUARTILE:"adfirstquartile",AD_MID_POINT:"admidpoint",AD_THIRD_QUARTILE:"adthirdquartile",AD_ENDED:"adended",AD_BREAK_END:"adbreakend",AD_ERROR:"aderror",REQUEST_COMPLETED:"requestcompleted",REQUEST_FAILED:"requestfailed",REQUEST_CANCELLED:"requestcanceled",HEARTBEAT:"hb",DESTROY:"destroy"},cA=uA,hA="mux-embed",fA="5.9.0",mA="2.1",ze={},Or=function(i){var e=arguments;typeof i=="string"?Or.hasOwnProperty(i)?_a.default.setTimeout(function(){e=Array.prototype.splice.call(e,1),Or[i].apply(null,e)},0):De.warn("`"+i+"` is an unknown task"):typeof i=="function"?_a.default.setTimeout(function(){i(Or)},0):De.warn("`"+i+"` is invalid.")},pA={loaded:tt.now(),NAME:hA,VERSION:fA,API_VERSION:mA,PLAYER_TRACKED:!1,monitor:function(i,e){return Z_(Or,i,e)},destroyMonitor:function(i){var e=Zi(Xl(i),1),t=e[0];t&&t.mux&&typeof t.mux.destroy=="function"?t.mux.destroy():De.error("A video element monitor for `"+i+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(i,e){var t=zt(i);ze[t]?ze[t].addHLSJS(e):De.error("A monitor for `"+t+"` has not been initialized.")},addDashJS:function(i,e){var t=zt(i);ze[t]?ze[t].addDashJS(e):De.error("A monitor for `"+t+"` has not been initialized.")},removeHLSJS:function(i){var e=zt(i);ze[e]?ze[e].removeHLSJS():De.error("A monitor for `"+e+"` has not been initialized.")},removeDashJS:function(i){var e=zt(i);ze[e]?ze[e].removeDashJS():De.error("A monitor for `"+e+"` has not been initialized.")},init:function(i,e){Ju()&&e&&e.respectDoNotTrack&&De.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var t=zt(i);ze[t]=new j_(Or,t,e)},emit:function(i,e,t){var r=zt(i);ze[r]?(ze[r].emit(e,t),e==="destroy"&&delete ze[r]):De.error("A monitor for `"+r+"` has not been initialized.")},updateData:function(i,e){var t=zt(i);ze[t]?ze[t].emit("hb",e):De.error("A monitor for `"+t+"` has not been initialized.")},setEmitTranslator:function(i,e){var t=zt(i);ze[t]?ze[t].emitTranslator=e:De.error("A monitor for `"+t+"` has not been initialized.")},setStateDataTranslator:function(i,e){var t=zt(i);ze[t]?ze[t].stateDataTranslator=e:De.error("A monitor for `"+t+"` has not been initialized.")},setGetPlayheadTime:function(i,e){var t=zt(i);ze[t]?ze[t].getPlayheadTime=e:De.error("A monitor for `"+t+"` has not been initialized.")},checkDoNotTrack:Ju,log:De,utils:dA,events:cA,WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(Or,pA);typeof _a.default<"u"&&typeof _a.default.addEventListener=="function"&&_a.default.addEventListener("pagehide",function(i){i.persisted||(Or.WINDOW_UNLOADING=!0)},!1);var Kh=Or;/*! 17* JavaScript Cookie v2.1.3 18* https://github.com/js-cookie/js-cookie 19* 20* Copyright 2006, 2015 Klaus Hartl & Fagner Brack 21* Released under the MIT license 22*/function gA(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var P0={exports:{}};(function(i,e){(function(t){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,d,u){if(u=u||{},l=l.trim(),d=d.trim(),!d){if(!u.alwaysNormalize)return l;var c=o.parseURL(l);if(!c)throw new Error("Error trying to parse base URL.");return c.path=o.normalizePath(c.path),o.buildURLFromParts(c)}var h=o.parseURL(d);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):d;var f=o.parseURL(l);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var m=s.exec(f.path);f.netLoc=m[1],f.path=m[2]}f.netLoc&&!f.path&&(f.path="/");var p={scheme:f.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(p.netLoc=f.netLoc,h.path[0]!=="/"))if(!h.path)p.path=f.path,h.params||(p.params=f.params,h.query||(p.query=f.query));else{var g=f.path,v=g.substring(0,g.lastIndexOf("/")+1)+h.path;p.path=o.normalizePath(v)}return p.path===null&&(p.path=u.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(p)},parseURL:function(l){var d=r.exec(l);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(P0);var Vh=P0.exports;function Km(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(i,s).enumerable})),t.push.apply(t,r)}return t}function ft(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Km(Object(t),!0).forEach(function(r){yA(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Km(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function vA(i,e){if(typeof i!="object"||!i)return i;var t=i[Symbol.toPrimitive];if(t!==void 0){var r=t.call(i,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(i)}function EA(i){var e=vA(i,"string");return typeof e=="symbol"?e:String(e)}function yA(i,e,t){return e=EA(e),e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function it(){return it=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},it.apply(this,arguments)}const q=Number.isFinite||function(i){return typeof i=="number"&&isFinite(i)},bA=Number.isSafeInteger||function(i){return typeof i=="number"&&Math.abs(i)<=TA},TA=Number.MAX_SAFE_INTEGER||9007199254740991;
vendor: 4,878 bytes, line 22
22let E=function(i){return i.MEDIA_ATTACHING="hlsMediaAttaching",i.MEDIA_ATTACHED="hlsMediaAttached",i.MEDIA_DETACHING="hlsMediaDetaching",i.MEDIA_DETACHED="hlsMediaDetached",i.BUFFER_RESET="hlsBufferReset",i.BUFFER_CODECS="hlsBufferCodecs",i.BUFFER_CREATED="hlsBufferCreated",i.BUFFER_APPENDING="hlsBufferAppending",i.BUFFER_APPENDED="hlsBufferAppended",i.BUFFER_EOS="hlsBufferEos",i.BUFFER_FLUSHING="hlsBufferFlushing",i.BUFFER_FLUSHED="hlsBufferFlushed",i.MANIFEST_LOADING="hlsManifestLoading",i.MANIFEST_LOADED="hlsManifestLoaded",i.MANIFEST_PARSED="hlsManifestParsed",i.LEVEL_SWITCHING="hlsLevelSwitching",i.LEVEL_SWITCHED="hlsLevelSwitched",i.LEVEL_LOADING="hlsLevelLoading",i.LEVEL_LOADED="hlsLevelLoaded",i.LEVEL_UPDATED="hlsLevelUpdated",i.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",i.LEVELS_UPDATED="hlsLevelsUpdated",i.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",i.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",i.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",i.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",i.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",i.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",i.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",i.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",i.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",i.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",i.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",i.CUES_PARSED="hlsCuesParsed",i.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",i.INIT_PTS_FOUND="hlsInitPtsFound",i.FRAG_LOADING="hlsFragLoading",i.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",i.FRAG_LOADED="hlsFragLoaded",i.FRAG_DECRYPTED="hlsFragDecrypted",i.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",i.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",i.FRAG_PARSING_METADATA="hlsFragParsingMetadata",i.FRAG_PARSED="hlsFragParsed",i.FRAG_BUFFERED="hlsFragBuffered",i.FRAG_CHANGED="hlsFragChanged",i.FPS_DROP="hlsFpsDrop",i.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",i.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",i.ERROR="hlsError",i.DESTROYING="hlsDestroying",i.KEY_LOADING="hlsKeyLoading",i.KEY_LOADED="hlsKeyLoaded",i.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",i.BACK_BUFFER_REACHED="hlsBackBufferReached",i.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",i}({}),re=function(i){return i.NETWORK_ERROR="networkError",i.MEDIA_ERROR="mediaError",i.KEY_SYSTEM_ERROR="keySystemError",i.MUX_ERROR="muxError",i.OTHER_ERROR="otherError",i}({}),O=function(i){return i.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",i.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",i.KEY_SYSTEM_NO_SESSION="keySystemNoSession",i.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",i.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",i.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",i.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",i.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",i.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",i.MANIFEST_LOAD_ERROR="manifestLoadError",i.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",i.MANIFEST_PARSING_ERROR="manifestParsingError",i.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",i.LEVEL_EMPTY_ERROR="levelEmptyError",i.LEVEL_LOAD_ERROR="levelLoadError",i.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",i.LEVEL_PARSING_ERROR="levelParsingError",i.LEVEL_SWITCH_ERROR="levelSwitchError",i.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",i.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",i.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",i.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",i.FRAG_LOAD_ERROR="fragLoadError",i.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",i.FRAG_DECRYPT_ERROR="fragDecryptError",i.FRAG_PARSING_ERROR="fragParsingError",i.FRAG_GAP="fragGap",i.REMUX_ALLOC_ERROR="remuxAllocError",i.KEY_LOAD_ERROR="keyLoadError",i.KEY_LOAD_TIMEOUT="keyLoadTimeOut",i.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",i.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",i.BUFFER_APPEND_ERROR="bufferAppendError",i.BUFFER_APPENDING_ERROR="bufferAppendingError",i.BUFFER_STALLED_ERROR="bufferStalledError",i.BUFFER_FULL_ERROR="bufferFullError",i.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",i.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",i.INTERNAL_EXCEPTION="internalException",i.INTERNAL_ABORTED="aborted",i.UNKNOWN="unknown",i}({});const Kr=function(){},ic={trace:Kr,debug:Kr,log:Kr,warn:Kr,info:Kr,error:Kr};let Sa=ic;function _A(i){const e=self.console[i];return e?e.bind(self.console,`[${i}] >`):Kr}function AA(i,...e){e.forEach(function(t){Sa[t]=i[t]?i[t].bind(i):_A(t)})}function SA(i,e){if(typeof console=="object"&&i===!0||typeof i=="object"){AA(i,"debug","log","info","warn","error");try{Sa.log(`Debug logs enabled for "${e}
22" in hls.js version 1.5.20`)}catch{Sa=ic}}else Sa=ic}const R=Sa,xA=/^(\d+)x(\d+)$/,Vm=/(.+?)=(".*?"|.*?)(?:,|$)/g;class Ke{constructor(e){typeof e=="string"&&(e=Ke.parseAttrList(e)),it(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const r=new Uint8Array(t.length/2);for(let s=0;s<t.length/2;s++)r[s]=parseInt(t.slice(s*2,s*2+2),16);return r}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const r=this[e];return r?parseFloat(r):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=xA.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const r={},s='"';for(Vm.lastIndex=0;(t=Vm.exec(e))!==null;){let n=t[2];n.indexOf(s)===0&&n.lastIndexOf(s)===n.length-1&&(n=n.slice(1,-1));const a=t[1].trim();r[a]=n}return r}}function RA(i){return i!=="ID"&&i!=="CLASS"&&i!=="START-DATE"&&i!=="DURATION"&&i!=="END-DATE"&&i!=="END-ON-NEXT"}function LA(i){return i==="SCTE35-OUT"||i==="SCTE35-IN"}class N0{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const r=t.attr;for(const s in r)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==r[s]){R.warn(`DATERANGE tag attribute: "${s}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=s;break}e=it(new Ke({}),r,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const r=new Date(this.attr["END-DATE"]);q(r.getTime())&&(this._endDate=r)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(q(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&q(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class Pd{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Le={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class U0{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Le.AUDIO]:null,[Le.VIDEO]:null,[Le.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const r=e.split("@",2);let s;r.length===1?s=(t==null?void 0:t.byteRangeEndOffset)||0:s=parseInt(r[1]),this._byteRange=[s,parseInt(r[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Vh.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class uu extends U0{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new Pd,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const r=Object.keys(this.levelkeys);if(r.length===1)return this._decryptdata=this.levelkeys[r[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!q(this.programDateTime))return null;const e=q(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;
vendor: 19,588 bytes, line 22
22if(this.levelkeys){const t=Object.keys(this.levelkeys),r=t.length;if(r>1||r===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,r,s,n,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:r,startDTS:s,endDTS:n,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,r),l.startDTS=Math.min(l.startDTS,s),l.endDTS=Math.max(l.endDTS,n)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Le.AUDIO]=null,e[Le.VIDEO]=null,e[Le.AUDIOVIDEO]=null}}let IA=class extends U0{constructor(e,t,r,s,n){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new Pd,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};const kA=10;class wA{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&r>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?q(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||kA}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Wh(i){return Uint8Array.from(atob(i),e=>e.charCodeAt(0))}function DA(i){const e=rc(i).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function CA(i){const e=function(r,s,n){const a=r[s];r[s]=r[n],r[n]=a};e(i,0,3),e(i,1,2),e(i,4,5),e(i,6,7)}function MA(i){const e=i.split(":");let t=null;if(e[0]==="data"&&e.length===2){const r=e[1].split(";"),s=r[r.length-1].split(",");if(s.length===2){const n=s[0]==="base64",a=s[1];n?(r.splice(-1,1),t=Wh(a)):t=DA(a)}}return t}function rc(i){return Uint8Array.from(unescape(encodeURIComponent(i)),e=>e.charCodeAt(0))}const xn=typeof self<"u"?self:void 0;var Se={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Rt={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function cu(i){switch(i){case Rt.FAIRPLAY:return Se.FAIRPLAY;case Rt.PLAYREADY:return Se.PLAYREADY;case Rt.WIDEVINE:return Se.WIDEVINE;case Rt.CLEARKEY:return Se.CLEARKEY}}var no={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function hu(i){if(i===no.WIDEVINE)return Se.WIDEVINE;if(i===no.PLAYREADY)return Se.PLAYREADY;if(i===no.CENC||i===no.CLEARKEY)return Se.CLEARKEY}function fu(i){switch(i){case Se.FAIRPLAY:return Rt.FAIRPLAY;case Se.PLAYREADY:return Rt.PLAYREADY;case Se.WIDEVINE:return Rt.WIDEVINE;case Se.CLEARKEY:return Rt.CLEARKEY}}function ao(i){const{drmSystems:e,widevineLicenseUrl:t}=i,r=e?[Se.FAIRPLAY,Se.WIDEVINE,Se.PLAYREADY,Se.CLEARKEY].filter(s=>!!e[s]):[];return!r[Se.WIDEVINE]&&t&&r.push(Se.WIDEVINE),r}const F0=function(i){return xn!=null&&(i=xn.navigator)!=null&&i.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function OA(i,e,t,r){let s;switch(i){case Se.FAIRPLAY:s=["cenc","sinf"];break;case Se.WIDEVINE:case Se.PLAYREADY:s=["cenc"];break;case Se.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${i}`)}return PA(s,e,t,r)}function PA(i,e,t,r){return[{initDataTypes:i,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:e.map(n=>({contentType:`audio/mp4; codecs="${n}"`,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:t.map(n=>({contentType:`video/mp4; codecs="${n}"`,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}function $0(i){const e=new Uint16Array(i.buffer,i.byteOffset,i.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),r=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=Wh(o).subarray(0,16);return CA(l),l}}return null}function ms(i,e,t){return Uint8Array.prototype.slice?i.slice(e,t):new Uint8Array(Array.prototype.slice.call(i,e,t))}const Yh=(i,e)=>e+10<=i.length&&i[e]===73&&i[e+1]===68&&i[e+2]===51&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,B0=(i,e)=>e+10<=i.length&&i[e]===51&&i[e+1]===68&&i[e+2]===73&&i[e+3]<255&&i[e+4]<255&&i[e+6]<128&&i[e+7]<128&&i[e+8]<128&&i[e+9]<128,Pa=(i,e)=>{const t=e;let r=0;for(;Yh(i,e);){r+=10;const s=Nd(i,e+6);r+=s,B0(i,e+10)&&(r+=10),e+=r}if(r>0)return i.subarray(t,t+r)},Nd=(i,e)=>{let t=0;return t=(i[e]&127)<<21,t|=(i[e+1]&127)<<14,t|=(i[e+2]&127)<<7,t|=i[e+3]&127,t},NA=(i,e)=>Yh(i,e)&&Nd(i,e+6)+10<=i.length-e,qh=i=>{const e=G0(i);for(let t=0;t<e.length;t++){const r=e[t];if(H0(r))return GA(r)}},H0=i=>i&&i.key==="PRIV"&&i.info==="com.apple.streaming.transportStreamTimestamp",UA=i=>{const e=String.fromCharCode(i[0],i[1],i[2],i[3]),t=Nd(i,4),r=10;return{type:e,size:t,data:i.subarray(r,r+t)}},G0=i=>{let e=0;const t=[];for(;Yh(i,e);){const r=Nd(i,e+6);e+=10;const s=e+r;for(;e+8<s;){const n=UA(i.subarray(e)),a=FA(n);a&&t.push(a),e+=n.size+10}B0(i,e)&&(e+=10)}return t},FA=i=>i.type==="PRIV"?$A(i):i.type[0]==="W"?HA(i):BA(i),$A=i=>{if(i.size<2)return;const e=Di(i.data,!0),t=new Uint8Array(i.data.subarray(e.length+1));return{key:i.type,info:e,data:t.buffer}},BA=i=>{if(i.size<2)return;if(i.type==="TXXX"){let t=1;const r=Di(i.data.subarray(t),!0);t+=r.length+1;const s=Di(i.data.subarray(t));return{key:i.type,info:r,data:s}}const e=Di(i.data.subarray(1));return{key:i.type,data:e}},HA=i=>{if(i.type==="WXXX"){if(i.size<2)return;let t=1;const r=Di(i.data.subarray(t),!0);t+=r.length+1;const s=Di(i.data.subarray(t));return{key:i.type,info:r,data:s}}const e=Di(i.data);return{key:i.type,data:e}},GA=i=>{if(i.data.byteLength===8){const e=new Uint8Array(i.data),t=e[3]&1;let r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,t&&(r+=4772185884e-2),Math.round(r)}},Di=(i,e=!1)=>{const t=KA();if(t){const d=t.decode(i);if(e){const u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}const r=i.length;let s,n,a,o="",l=0;for(;l<r;){if(s=i[l++],s===0&&e)return o;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(s);break;case 12:case 13:n=i[l++],o+=String.fromCharCode((s&31)<<6|n&63);break;case 14:n=i[l++],a=i[l++],o+=String.fromCharCode((s&15)<<12|(n&63)<<6|(a&63)<<0);break}}return o};let mu;function KA(){if(!navigator.userAgent.includes("PlayStation 4"))return!mu&&typeof self.TextDecoder<"u"&&(mu=new self.TextDecoder("utf-8")),mu}const Ti={hexDump:function(i){let e="";for(let t=0;t<i.length;t++){let r=i[t].toString(16);r.length<2&&(r="0"+r),e+=r}return e}},ed=Math.pow(2,32)-1,VA=[].push,K0={video:1,audio:2,id3:3,text:4};function st(i){return String.fromCharCode.apply(null,i)}function V0(i,e){const t=i[e]<<8|i[e+1];return t<0?65536+t:t}function te(i,e){const t=W0(i,e);return t<0?4294967296+t:t}function Wm(i,e){let t=te(i,e);return t*=Math.pow(2,32),t+=te(i,e+4),t}function W0(i,e){return i[e]<<24|i[e+1]<<16|i[e+2]<<8|i[e+3]}function pu(i,e,t){i[e]=t>>24,i[e+1]=t>>16&255,i[e+2]=t>>8&255,i[e+3]=t&255}function WA(i){const e=i.byteLength;for(let t=0;t<e;){const r=te(i,t);if(r>8&&i[t+4]===109&&i[t+5]===111&&i[t+6]===111&&i[t+7]===102)return!0;t=r>1?t+r:e}return!1}function le(i,e){const t=[];if(!e.length)return t;const r=i.byteLength;for(let s=0;s<r;){const n=te(i,s),a=st(i.subarray(s+4,s+8)),o=n>1?s+n:r;if(a===e[0])if(e.length===1)t.push(i.subarray(s+8,o));else{const l=le(i.subarray(s+8,o),e.slice(1));l.length&&VA.apply(t,l)}s=o}return t}function YA(i){const e=[],t=i[0];let r=8;const s=te(i,r);r+=4;let n=0,a=0;t===0?(n=te(i,r),a=te(i,r+4),r+=8):(n=Wm(i,r),a=Wm(i,r+8),r+=16),r+=2;let o=i.length+a;const l=V0(i,r);r+=2;for(let d=0;d<l;d++){let u=r;const c=te(i,u);u+=4;const h=c&2147483647;if((c&2147483648)>>>31===1)return R.warn("SIDX has hierarchical references (not supported)"),null;const m=te(i,u);u+=4,e.push({referenceSize:h,subsegmentDuration:m,info:{duration:m/s,start:o,end:o+h-1}}),o+=h,u+=4,r=u}return{earliestPresentationTime:n,timescale:s,version:t,referencesCount:l,references:e}}function Y0(i){const e=[],t=le(i,["moov","trak"]);for(let s=0;s<t.length;s++){const n=t[s],a=le(n,["tkhd"])[0];if(a){let o=a[0];const l=te(a,o===0?12:20),d=le(n,["mdia","mdhd"])[0];if(d){o=d[0];const u=te(d,o===0?12:20),c=le(n,["mdia","hdlr"])[0];if(c){const h=st(c.subarray(8,12)),f={soun:Le.AUDIO,vide:Le.VIDEO}[h];if(f){const m=le(n,["mdia","minf","stbl","stsd"])[0],p=qA(m);e[l]={timescale:u,type:f},e[f]=ft({timescale:u,id:l},p)}}}}}return le(i,["moov","mvex","trex"]).forEach(s=>{const n=te(s,4),a=e[n];a&&(a.default={duration:te(s,12),flags:te(s,20)})}),e}function qA(i){const e=i.subarray(8),t=e.subarray(86),r=st(e.subarray(4,8));let s=r;const n=r==="enca"||r==="encv";if(n){const o=le(e,[r])[0].subarray(r==="enca"?28:78);le(o,["sinf"]).forEach(d=>{const u=le(d,["schm"])[0];if(u){const c=st(u.subarray(4,8));if(c==="cbcs"||c==="cenc"){const h=le(d,["frma"])[0];h&&(s=st(h))}}})}switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const a=le(t,["avcC"])[0];s+="."+oo(a[1])+oo(a[2])+oo(a[3]);break}case"mp4a":{const a=le(e,[r])[0],o=le(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=gu(o,l),l+=2;const d=o[l++];if(d&128&&(l+=2),d&64&&(l+=o[l++]),o[l++]!==4)break;l=gu(o,l);const u=o[l++];if(u===64)s+="."+oo(u);else break;if(l+=12,o[l++]!==5)break;l=gu(o,l);const c=o[l++];let h=(c&248)>>3;h===31&&(h+=1+((c&7)<<3)+((o[l]&224)>>5)),s+="."+h}break}case"hvc1":case"hev1":{const a=le(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],d=o&31,u=te(a,2),c=(o&32)>>5?"H":"L",h=a[12],f=a.subarray(6,12);s+="."+l+d,s+="."+u.toString(16).toUpperCase(),s+="."+c+h;let m="";for(let p=f.length;p--;){const g=f[p];(g||m)&&(m="."+g.toString(16).toUpperCase()+m)}s+=m;break}case"dvh1":case"dvhe":{const a=le(t,["dvcC"])[0],o=a[2]>>1&127,l=a[2]<<5&32|a[3]>>3&31;s+="."+oi(o)+"."+oi(l);break}case"vp09":{const a=le(t,["vpcC"])[0],o=a[4],l=a[5],d=a[6]>>4&15;s+="."+oi(o)+"."+oi(l)+"."+oi(d);break}case"av01":{const a=le(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,d=a[2]>>>7?"H":"M",u=(a[2]&64)>>6,c=(a[2]&32)>>5,h=o===2&&u?c?12:10:u?10:8,f=(a[2]&16)>>4,m=(a[2]&8)>>3,p=(a[2]&4)>>2,g=a[2]&3;s+="."+o+"."+oi(l)+d+"."+oi(h)+"."+f+"."+m+p+g+"."+oi(1)+"."+oi(1)+"."+oi(1)+"."+0;break}}return{codec:s,encrypted:n}}function gu(i,e){const t=e+5;for(;i[e++]&128&&e<t;);return e}function oo(i){return("0"+i.toString(16).toUpperCase()).slice(-2)}function oi(i){return(i<10?"0":"")+i}function jA(i,e){if(!i||!e)return i;const t=e.keyId;return t&&e.isCommonEncryption&&le(i,["moov","trak"]).forEach(s=>{const a=le(s,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=le(a,["enca"]);const l=o.length>0;l||(o=le(a,["encv"])),o.forEach(d=>{const u=l?d.subarray(28):d.subarray(78);le(u,["sinf"]).forEach(h=>{const f=q0(h);if(f){const m=f.subarray(8,24);m.some(p=>p!==0)||(R.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${Ti.hexDump(m)} -> ${Ti.hexDump(t)}`),f.set(t,8))}})})}),i}function q0(i){const e=le(i,["schm"])[0];if(e){const t=st(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return le(i,["schi","tenc"])[0]}return null}function zA(i,e){return le(e,["moof","traf"]).reduce((t,r)=>{const s=le(r,["tfdt"])[0],n=s[0],a=le(r,["tfhd"]).reduce((o,l)=>{const d=te(l,4),u=i[d];if(u){let c=te(s,4);if(n===1){if(c===ed)return R.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;c*=ed+1,c+=te(s,8)}const h=u.timescale||9e4,f=c/h;if(q(f)&&(o===null||f<o))return f}return o},null);return a!==null&&q(a)&&(t===null||a<t)?a:t},null)}function XA(i,e){let t=0,r=0,s=0;const n=le(i,["moof","traf"]);for(let a=0;a<n.length;a++){const o=n[a],l=le(o,["tfhd"])[0],d=te(l,4),u=e[d];if(!u)continue;const c=u.default,h=te(l,0)|(c==null?void 0:c.flags);let f=c==null?void 0:c.duration;h&8&&(h&2?f=te(l,12):f=te(l,8));const m=u.timescale||9e4,p=le(o,["trun"]);for(let g=0;g<p.length;g++){if(t=QA(p[g]),!t&&f){const v=te(p[g],4);t=f*v}u.type===Le.VIDEO?r+=t/m:u.type===Le.AUDIO&&(s+=t/m)}}if(r===0&&s===0){let a=1/0,o=0,l=0;const d=le(i,["sidx"]);for(let u=0;u<d.length;u++){const c=YA(d[u]);if(c!=null&&c.references){a=Math.min(a,c.earliestPresentationTime/c.timescale);const h=c.references.reduce((f,m)=>f+m.info.duration||0,0);o=Math.max(o,h+c.earliestPresentationTime/c.timescale),l=o-a}}if(l&&q(l))return l}return r||s}function QA(i){const e=te(i,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let r=0;const s=te(i,4);for(let n=0;n<s;n++){if(e&256){const a=te(i,t);r+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return r}function ZA(i,e,t){le(e,["moof","traf"]).forEach(r=>{le(r,["tfhd"]).forEach(s=>{const n=te(s,4),a=i[n];if(!a)return;const o=a.timescale||9e4;le(r,["tfdt"]).forEach(l=>{const d=l[0],u=t*o;if(u){let c=te(l,4);if(d===0)c-=u,c=Math.max(c,0),pu(l,4,c);else{c*=Math.pow(2,32),c+=te(l,8),c-=u,c=Math.max(c,0);const h=Math.floor(c/(ed+1)),f=Math.floor(c%(ed+1));pu(l,4,h),pu(l,8,f)}}})})})}function JA(i){const e={valid:null,remainder:null},t=le(i,["moof"]);if(t.length<2)return e.remainder=i,e;const r=t[t.length-1];return e.valid=ms(i,0,r.byteOffset-8),e.remainder=ms(i,r.byteOffset-8),e}function Wt(i,e){const t=new Uint8Array(i.length+e.length);return t.set(i),t.set(e,i.length),t}function Ym(i,e){const t=[],r=e.samples,s=e.timescale,n=e.id;let a=!1;return le(r,["moof"]).map(l=>{const d=l.byteOffset-8;le(l,["traf"]).map(c=>{const h=le(c,["tfdt"]).map(f=>{const m=f[0];let p=te(f,4);return m===1&&(p*=Math.pow(2,32),p+=te(f,8)),p/s})[0];return h!==void 0&&(i=h),le(c,["tfhd"]).map(f=>{const m=te(f,4),p=te(f,0)&16777215,g=(p&1)!==0,v=(p&2)!==0,b=(p&8)!==0;let y=0;const A=(p&16)!==0;let _=0;const C=(p&32)!==0;let x=8;m===n&&(g&&(x+=8),v&&(x+=4),b&&(y=te(f,x),x+=4),A&&(_=te(f,x),x+=4),C&&(x+=4),e.type==="video"&&(a=e1(e.codec)),le(c,["trun"]).map(S=>{const P=S[0],I=te(S,0)&16777215,M=(I&1)!==0;let $=0;const F=(I&4)!==0,Q=(I&256)!==0;let Y=0;const X=(I&512)!==0;let ue=0;const de=(I&1024)!==0,K=(I&2048)!==0;let H=0;const ne=te(S,4);let oe=8;M&&($=te(S,oe),oe+=4),F&&(oe+=4);let pe=$+d;for(let Be=0;Be<ne;Be++){if(Q?(Y=te(S,oe),oe+=4):Y=y,X?(ue=te(S,oe),oe+=4):ue=_,de&&(oe+=4),K&&(P===0?H=te(S,oe):H=W0(S,oe),oe+=4),e.type===Le.VIDEO){let He=0;for(;He<ue;){const je=te(r,pe);if(pe+=4,t1(a,r[pe])){const _t=r.subarray(pe,pe+je);j0(_t,a?2:1,i+H/s,t)}pe+=je,He+=je+4}}i+=Y/s}}))})})}),t}function e1(i){if(!i)return!1;const e=i.indexOf("."),t=e<0?i:i.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function t1(i,e){if(i){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function j0(i,e,t,r){const s=z0(i);let n=0;n+=e;let a=0,o=0,l=0;for(;n<s.length;){a=0;do{if(n>=s.length)break;l=s[n++],a+=l}while(l===255);o=0;do{if(n>=s.length)break;l=s[n++],o+=l}while(l===255);const d=s.length-n;let u=n;if(o<d)n+=o;else if(o>d){R.error(`Malformed SEI payload. ${o} is too small, only ${d} bytes left to parse.`);break}if(a===4){if(s[u++]===181){const h=V0(s,u);if(u+=2,h===49){const f=te(s,u);if(u+=4,f===1195456820){const m=s[u++];if(m===3){const p=s[u++],g=31&p,v=64&p,b=v?2+g*3:0,y=new Uint8Array(b);if(v){y[0]=p;for(let A=1;A<b;A++)y[A]=s[u++]}r.push({type:m,payloadType:a,pts:t,bytes:y})}}}}}else if(a===5&&o>16){const c=[];for(let m=0;m<16;m++){const p=s[u++].toString(16);c.push(p.length==1?"0"+p:p),(m===3||m===5||m===7||m===9)&&c.push("-")}const h=o-16,f=new Uint8Array(h);for(let m=0;m<h;m++)f[m]=s[u++];r.push({payloadType:a,pts:t,uuid:c.join(""),userData:Di(f),userDataBytes:f})}}}function z0(i){const e=i.byteLength,t=[];let r=1;for(;r<e-2;)i[r]===0&&i[r+1]===0&&i[r+2]===3?(t.push(r+2),r+=2):r++;if(t.length===0)return i;const s=e-t.length,n=new Uint8Array(s);let a=0;for(r=0;r<s;a++,r++)a===t[0]&&(a++,t.shift()),n[r]=i[a];return n}function i1(i){const e=i[0];let t="",r="",s=0,n=0,a=0,o=0,l=0,d=0;if(e===0){for(;st(i.subarray(d,d+1))!=="\0";)t+=st(i.subarray(d,d+1)),d+=1;for(t+=st(i.subarray(d,d+1)),d+=1;st(i.subarray(d,d+1))!=="\0";)r+=st(i.subarray(d,d+1)),d+=1;r+=st(i.subarray(d,d+1)),d+=1,s=te(i,12),n=te(i,16),o=te(i,20),l=te(i,24),d=28}else if(e===1){d+=4,s=te(i,d),d+=4;const c=te(i,d);d+=4;const h=te(i,d);for(d+=4,a=2**32*c+h,bA(a)||(a=Number.MAX_SAFE_INTEGER,R.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=te(i,d),d+=4,l=te(i,d),d+=4;st(i.subarray(d,d+1))!=="\0";)t+=st(i.subarray(d,d+1)),d+=1;for(t+=st(i.subarray(d,d+1)),d+=1;st(i.subarray(d,d+1))!=="\0";)r+=st(i.subarray(d,d+1)),d+=1;r+=st(i.subarray(d,d+1)),d+=1}const u=i.subarray(d,i.byteLength);return{schemeIdUri:t,value:r,timeScale:s,presentationTime:a,presentationTimeDelta:n,eventDuration:o,id:l,payload:u}}function r1(i,...e){const t=e.length;let r=8,s=t;
vendor: 5,162 bytes, line 22
22for(;s--;)r+=e[s].byteLength;const n=new Uint8Array(r);for(n[0]=r>>24&255,n[1]=r>>16&255,n[2]=r>>8&255,n[3]=r&255,n.set(i,4),s=0,r=8;s<t;s++)n.set(e[s],r),r+=e[s].byteLength;return n}function s1(i,e,t){if(i.byteLength!==16)throw new RangeError("Invalid system id");let r,s;r=0,s=new Uint8Array;let n;r>0?(n=new Uint8Array(4),e.length>0&&new DataView(n.buffer).setUint32(0,e.length,!1)):n=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),r1([112,115,115,104],new Uint8Array([r,0,0,0]),i,n,s,a,t||new Uint8Array)}function n1(i){const e=[];if(i instanceof ArrayBuffer){const t=i.byteLength;let r=0;for(;r+32<t;){const s=new DataView(i,r),n=a1(s);e.push(n),r+=n.size}}return e}function a1(i){const e=i.getUint32(0),t=i.byteOffset,r=i.byteLength;if(r<e)return{offset:t,size:r};if(i.getUint32(4)!==1886614376)return{offset:t,size:e};const n=i.getUint32(8)>>>24;if(n!==0&&n!==1)return{offset:t,size:e};const a=i.buffer,o=Ti.hexDump(new Uint8Array(a,t+12,16)),l=i.getUint32(28);let d=null,u=null;if(n===0){if(e-32<l||l<22)return{offset:t,size:e};u=new Uint8Array(a,t+32,l)}else if(n===1){if(!l||r<t+32+l*16+16)return{offset:t,size:e};d=[];for(let c=0;c<l;c++)d.push(new Uint8Array(a,t+32+c*16,16))}return{version:n,systemId:o,kids:d,data:u,offset:t,size:e}}let lo={};class Na{static clearKeyUriToKeyIdMap(){lo={}}constructor(e,t,r,s=[1],n=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=r,this.keyFormatVersions=s,this.iv=n,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case Rt.FAIRPLAY:case Rt.WIDEVINE:case Rt.PLAYREADY:case Rt.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&R.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const r=o1(e);return new Na(this.method,this.uri,"identity",this.keyFormatVersions,r)}const t=MA(this.uri);if(t)switch(this.keyFormat){case Rt.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case Rt.PLAYREADY:{const r=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=s1(r,null,t),this.keyId=$0(t);break}default:{let r=t.subarray(0,16);if(r.length!==16){const s=new Uint8Array(16);s.set(r,16-r.length),r=s}this.keyId=r;break}}if(!this.keyId||this.keyId.byteLength!==16){let r=lo[this.uri];if(!r){const s=Object.keys(lo).length%Number.MAX_SAFE_INTEGER;r=new Uint8Array(16),new DataView(r.buffer,12,4).setUint32(0,s),lo[this.uri]=r}this.keyId=r}return this}}function o1(i){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=i>>8*(15-t)&255;return e}const X0=/\{\$([a-zA-Z0-9-_]+)\}/g;function qm(i){return X0.test(i)}function At(i,e,t){if(i.variableList!==null||i.hasVariableRefs)for(let r=t.length;r--;){const s=t[r],n=e[s];n&&(e[s]=sc(i,n))}}function sc(i,e){if(i.variableList!==null||i.hasVariableRefs){const t=i.variableList;return e.replace(X0,r=>{const s=r.substring(2,r.length-1),n=t==null?void 0:t[s];return n===void 0?(i.playlistParsingError||(i.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),r):n})}return e}function jm(i,e,t){let r=i.variableList;r||(i.variableList=r={});let s,n;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(s))n=a.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${t}"`)}catch(a){i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,n=e.VALUE;s in r?i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):r[s]=n||""}function l1(i,e,t){const r=e.IMPORT;if(t&&r in t){let s=i.variableList;s||(i.variableList=s={}),s[r]=t[r]}else i.playlistParsingError||(i.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}function _s(i=!0){return typeof self>"u"?void 0:(i||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function d1(i){return typeof self<"u"&&i===self.ManagedMediaSource}const td={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv
vendor: 30,939 bytes, line 22
2260:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function u1(i,e){const t=td[e];return!!t&&!!t[i.slice(0,4)]}function vu(i,e,t=!0){return!i.split(",").some(r=>!Q0(r,e,t))}function Q0(i,e,t=!0){var r;const s=_s(t);return(r=s==null?void 0:s.isTypeSupported(Ua(i,e)))!=null?r:!1}function Ua(i,e){return`${e}/mp4;codecs="${i}"`}function zm(i){if(i){const e=i.substring(0,4);return td.video[e]}return 2}function id(i){return i.split(",").reduce((e,t)=>{const r=td.video[t];return r?(r*2+e)/(e?3:2):(td.audio[t]+e)/(e?2:1)},0)}const Eu={};function c1(i,e=!0){if(Eu[i])return Eu[i];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[i];for(let r=0;r<t.length;r++)if(Q0(t[r],"audio",e))return Eu[i]=t[r],t[r];return i}const h1=/flac|opus/i;function rd(i,e=!0){return i.replace(h1,t=>c1(t.toLowerCase(),e))}function Xm(i,e){return i&&i!=="mp4a"?i:e&&e.split(",")[0]}function f1(i){const e=i.split(",");for(let t=0;t<e.length;t++){const r=e[t].split(".");if(r.length>2){let s=r.shift()+".";s+=parseInt(r.shift()).toString(16),s+=("000"+parseInt(r.shift()).toString(16)).slice(-4),e[t]=s}}return e.join(",")}const Qm=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,Zm=/#EXT-X-MEDIA:(.*)/g,m1=/^#EXT(?:INF|-X-TARGETDURATION):/m,Jm=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),p1=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class Ri{static findGroup(e,t){for(let r=0;r<e.length;r++){const s=e[r];if(s.id===t)return s}}static resolve(e,t){return Vh.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return m1.test(e)}static parseMasterPlaylist(e,t){const r=qm(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},n=[];Qm.lastIndex=0;let a;for(;(a=Qm.exec(e))!=null;)if(a[1]){var o;const d=new Ke(a[1]);At(s,d,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const u=sc(s,a[2]),c={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:Ri.resolve(u,t)},h=d.decimalResolution("RESOLUTION");h&&(c.width=h.width,c.height=h.height),g1(d.CODECS,c),(o=c.unknownCodecs)!=null&&o.length||n.push(c),s.levels.push(c)}else if(a[3]){const d=a[3],u=a[4];switch(d){case"SESSION-DATA":{const c=new Ke(u);At(s,c,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=c["DATA-ID"];h&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[h]=c);break}case"SESSION-KEY":{const c=ep(u,t,s);c.encrypted&&c.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(c)):R.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const c=new Ke(u);At(s,c,["NAME","VALUE","QUERYPARAM"]),jm(s,c,t)}break}case"CONTENT-STEERING":{const c=new Ke(u);At(s,c,["SERVER-URI","PATHWAY-ID"]),s.contentSteering={uri:Ri.resolve(c["SERVER-URI"],t),pathwayId:c["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=tp(u);break}}}const l=n.length>0&&n.length<s.levels.length;return s.levels=l?n:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,r){let s;const n={},a=r.levels,o={AUDIO:a.map(d=>({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:a.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(Zm.lastIndex=0;(s=Zm.exec(e))!==null;){const d=new Ke(s[1]),u=d.TYPE;if(u){const c=o[u],h=n[u]||[];n[u]=h,At(r,d,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const f=d.LANGUAGE,m=d["ASSOC-LANGUAGE"],p=d.CHANNELS,g=d.CHARACTERISTICS,v=d["INSTREAM-ID"],b={attrs:d,bitrate:0,id:l++,groupId:d["GROUP-ID"]||"",name:d.NAME||f||"",type:u,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:f,url:d.URI?Ri.resolve(d.URI,t):""};if(m&&(b.assocLang=m),p&&(b.channels=p),g&&(b.characteristics=g),v&&(b.instreamId=v),c!=null&&c.length){const y=Ri.findGroup(c,b.groupId)||c[0];ip(b,y,"audioCodec"),ip(b,y,"textCodec")}h.push(b)}}return n}static parseLevelPlaylist(e,t,r,s,n,a){const o=new wA(t),l=o.fragments;let d=null,u=0,c=0,h=0,f=0,m=null,p=new uu(s,t),g,v,b,y=-1,A=!1,_=null;for(Jm.lastIndex=0,o.m3u8=e,o.hasVariableRefs=qm(e);(g=Jm.exec(e))!==null;){A&&(A=!1,p=new uu(s,t),p.start=h,p.sn=u,p.cc=f,p.level=r,d&&(p.initSegment=d,p.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null,_&&(p.setByteRange(_),_=null)));const P=g[1];if(P){p.duration=parseFloat(P);const I=(" "+g[2]).slice(1);p.title=I||null,p.tagList.push(I?["INF",P,I]:["INF",P])}else if(g[3]){if(q(p.duration)){p.start=h,b&&np(p,b,o),p.sn=u,p.level=r,p.cc=f,l.push(p);const I=(" "+g[3]).slice(1);p.relurl=sc(o,I),rp(p,m),m=p,h+=p.duration,u++,c=0,A=!0}}else if(g[4]){const I=(" "+g[4]).slice(1);m?p.setByteRange(I,m):p.setByteRange(I)}else if(g[5])p.rawProgramDateTime=(" "+g[5]).slice(1),p.tagList.push(["PROGRAM-DATE-TIME",p.rawProgramDateTime]),y===-1&&(y=l.length);else{if(g=g[0].match(p1),!g){R.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v<g.length&&!(typeof g[v]<"u");v++);const I=(" "+g[v]).slice(1),M=(" "+g[v+1]).slice(1),$=g[v+2]?(" "+g[v+2]).slice(1):"";switch(I){case"PLAYLIST-TYPE":o.type=M.toUpperCase();break;case"MEDIA-SEQUENCE":u=o.startSN=parseInt(M);break;case"SKIP":{const F=new Ke(M);At(o,F,["RECENTLY-REMOVED-DATERANGES"]);const Q=F.decimalInteger("SKIPPED-SEGMENTS");if(q(Q)){o.skippedSegments=Q;for(let X=Q;X--;)l.unshift(null);u+=Q}const Y=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");Y&&(o.recentlyRemovedDateranges=Y.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(M),1);break;case"VERSION":o.version=parseInt(M);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(M||$)&&p.tagList.push($?[M,$]:[M]);break;case"DISCONTINUITY":f++,p.tagList.push(["DIS"]);break;case"GAP":p.gap=!0,p.tagList.push([I]);break;case"BITRATE":p.tagList.push([I,M]);break;case"DATERANGE":{const F=new Ke(M);At(o,F,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),At(o,F,F.clientAttrs);const Q=new N0(F,o.dateRanges[F.ID]);Q.isValid||o.skippedSegments?o.dateRanges[Q.id]=Q:R.warn(`Ignoring invalid DATERANGE tag: "${M}"`),p.tagList.push(["EXT-X-DATERANGE",M]);break}case"DEFINE":{{const F=new Ke(M);At(o,F,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in F?l1(o,F,a):jm(o,F,t)}break}case"DISCONTINUITY-SEQUENCE":f=parseInt(M);break;case"KEY":{const F=ep(M,t,o);if(F.isSupported()){if(F.method==="NONE"){b=void 0;break}b||(b={}),b[F.keyFormat]&&(b=it({},b)),b[F.keyFormat]=F}else R.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${M}"`);break}case"START":o.startTimeOffset=tp(M);break;case"MAP":{const F=new Ke(M);if(At(o,F,["BYTERANGE","URI"]),p.duration){const Q=new uu(s,t);sp(Q,F,r,b),d=Q,p.initSegment=d,d.rawProgramDateTime&&!p.rawProgramDateTime&&(p.rawProgramDateTime=d.rawProgramDateTime)}else{const Q=p.byteRangeEndOffset;if(Q){const Y=p.byteRangeStartOffset;_=`${Q-Y}@${Y}`}else _=null;sp(p,F,r,b),d=p,A=!0}break}case"SERVER-CONTROL":{const F=new Ke(M);o.canBlockReload=F.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=F.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&F.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=F.optionalFloat("PART-HOLD-BACK",0),o.holdBack=F.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const F=new Ke(M);o.partTarget=F.decimalFloatingPoint("PART-TARGET");break}case"PART":{let F=o.partList;F||(F=o.partList=[]);const Q=c>0?F[F.length-1]:void 0,Y=c++,X=new Ke(M);At(o,X,["BYTERANGE","URI"]);const ue=new IA(X,p,t,Y,Q);F.push(ue),p.duration+=ue.duration;break}case"PRELOAD-HINT":{const F=new Ke(M);At(o,F,["URI"]),o.preloadHint=F;break}case"RENDITION-REPORT":{const F=new Ke(M);At(o,F,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(F);break}default:R.warn(`line parsed but not handled: ${g}`);break}}}m&&!m.relurl?(l.pop(),h-=m.duration,o.partList&&(o.fragmentHint=m)):o.partList&&(rp(p,m),p.cc=f,o.fragmentHint=p,b&&np(p,b,o));const C=l.length,x=l[0],S=l[C-1];if(h+=o.skippedSegments*o.targetduration,h>0&&C&&S){o.averagetargetduration=h/C;const P=S.sn;o.endSN=P!=="initSegment"?P:0,o.live||(S.endList=!0),x&&(o.startCC=x.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(h+=o.fragmentHint.duration),o.totalduration=h,o.endCC=f,y>0&&v1(l,y),o}}function ep(i,e,t){var r,s;const n=new Ke(i);At(t,n,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(r=n.METHOD)!=null?r:"",o=n.URI,l=n.hexadecimalInteger("IV"),d=n.KEYFORMATVERSIONS,u=(s=n.KEYFORMAT)!=null?s:"identity";o&&n.IV&&!l&&R.error(`Invalid IV: ${n.IV}`);const c=o?Ri.resolve(o,e):"",h=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Na(a,c,u,h,l)}function tp(i){const t=new Ke(i).decimalFloatingPoint("TIME-OFFSET");return q(t)?t:null}function g1(i,e){let t=(i||"").split(/[ ,]+/).filter(r=>r);["video","audio","text"].forEach(r=>{const s=t.filter(n=>u1(n,r));s.length&&(e[`${r}Codec`]=s.join(","),t=t.filter(n=>s.indexOf(n)===-1))}),e.unknownCodecs=t}function ip(i,e,t){const r=e[t];r&&(i[t]=r)}function v1(i,e){let t=i[e];for(let r=e;r--;){const s=i[r];if(!s)return;s.programDateTime=t.programDateTime-s.duration*1e3,t=s}}function rp(i,e){i.rawProgramDateTime?i.programDateTime=Date.parse(i.rawProgramDateTime):e!=null&&e.programDateTime&&(i.programDateTime=e.endProgramDateTime),q(i.programDateTime)||(i.programDateTime=null,i.rawProgramDateTime=null)}function sp(i,e,t,r){i.relurl=e.URI,e.BYTERANGE&&i.setByteRange(e.BYTERANGE),i.level=t,i.sn="initSegment",r&&(i.levelkeys=r),i.initSegment=null}function np(i,e,t){i.levelkeys=e;const{encryptedFragments:r}=t;(!r.length||r[r.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&r.push(i)}var ge={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},ie={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};function ap(i){const{type:e}=i;switch(e){case ge.AUDIO_TRACK:return ie.AUDIO;case ge.SUBTITLE_TRACK:return ie.SUBTITLE;default:return ie.MAIN}}function yu(i,e){let t=i.url;return(t===void 0||t.indexOf("data:")===0)&&(t=e.url),t}class E1{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(e){const t=this.hls.config,r=t.pLoader,s=t.loader,n=r||s,a=new n(t);return this.loaders[e.type]=a,a}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){const{url:r}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ge.MANIFEST,url:r,deliveryDirectives:null})}onLevelLoading(e,t){const{id:r,level:s,pathwayId:n,url:a,deliveryDirectives:o}=t;this.load({id:r,level:s,pathwayId:n,responseType:"text",type:ge.LEVEL,url:a,deliveryDirectives:o})}onAudioTrackLoading(e,t){const{id:r,groupId:s,url:n,deliveryDirectives:a}=t;this.load({id:r,groupId:s,level:null,responseType:"text",type:ge.AUDIO_TRACK,url:n,deliveryDirectives:a})}onSubtitleTrackLoading(e,t){const{id:r,groupId:s,url:n,deliveryDirectives:a}=t;this.load({id:r,groupId:s,level:null,responseType:"text",type:ge.SUBTITLE_TRACK,url:n,deliveryDirectives:a})}load(e){var t;const r=this.hls.config;let s=this.getInternalLoader(e);if(s){const d=s.context;if(d&&d.url===e.url&&d.level===e.level){R.trace("[playlist-loader]: playlist request ongoing");return}R.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let n;if(e.type===ge.MANIFEST?n=r.manifestLoadPolicy.default:n=it({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),q((t=e.deliveryDirectives)==null?void 0:t.part)){let d;if(e.type===ge.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===ge.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===ge.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,c=d.targetduration;if(u&&c){const h=Math.max(u*3,c*.8)*1e3;n=it({},n,{maxTimeToFirstByteMs:Math.min(h,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,n.maxTimeToFirstByteMs)})}}}const a=n.errorRetry||n.timeoutRetry||{},o={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(d,u,c,h)=>{const f=this.getInternalLoader(c);this.resetInternalLoader(c.type);const m=d.data;if(m.indexOf("#EXTM3U")!==0){this.handleManifestParsingError(d,c,new Error("no EXTM3U delimiter"),h||null,u);return}u.parsing.start=performance.now(),Ri.isMediaPlaylist(m)?this.handleTrackOrLevelPlaylist(d,u,c,h||null,f):this.handleMasterPlaylist(d,u,c,h)},onError:(d,u,c,h)=>{this.handleNetworkError(u,c,!1,d,h)},onTimeout:(d,u,c)=>{this.handleNetworkError(u,c,!0,void 0,d)}};s.load(e,o,l)}handleMasterPlaylist(e,t,r,s){const n=this.hls,a=e.data,o=yu(e,r),l=Ri.parseMasterPlaylist(a,o);if(l.playlistParsingError){this.handleManifestParsingError(e,r,l.playlistParsingError,s,t);return}const{contentSteering:d,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m}=l;this.variableList=m;const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=Ri.parseMasterPlaylistMedia(a,o,l);p.length&&!p.some(y=>!y.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(R.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new Ke({}),bitrate:0,url:""})),n.trigger(E.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:v,contentSteering:d,url:o,stats:t,networkDetails:s,sessionData:c,sessionKeys:h,startTimeOffset:f,variableList:m})}handleTrackOrLevelPlaylist(e,t,r,s,n){const a=this.hls,{id:o,level:l,type:d}=r,u=yu(e,r),c=0,h=q(l)?l:q(o)?o:0,f=ap(r),m=Ri.parseLevelPlaylist(e.data,u,h,f,c,this.variableList);if(d===ge.MANIFEST){const p={attrs:new Ke({}),bitrate:0,details:m,name:"",url:u};a.trigger(E.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:t,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),r.levelDetails=m,this.handlePlaylistLoaded(m,e,t,r,s,n)}handleManifestParsingError(e,t,r,s,n){this.hls.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:O.MANIFEST_PARSING_ERROR,fatal:t.type===ge.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:t,networkDetails:s,stats:n})}handleNetworkError(e,t,r=!1,s,n){let a=`A network ${r?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===ge.LEVEL?a+=`: ${e.level} id: ${e.id}`:(e.type===ge.AUDIO_TRACK||e.type===ge.SUBTITLE_TRACK)&&(a+=` id: ${e.id} group-id: "${e.groupId}"`);const o=new Error(a);R.warn(`[playlist-loader]: ${a}`);let l=O.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case ge.MANIFEST:l=r?O.MANIFEST_LOAD_TIMEOUT:O.MANIFEST_LOAD_ERROR,d=!0;break;case ge.LEVEL:l=r?O.LEVEL_LOAD_TIMEOUT:O.LEVEL_LOAD_ERROR,d=!1;break;case ge.AUDIO_TRACK:l=r?O.AUDIO_TRACK_LOAD_TIMEOUT:O.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case ge.SUBTITLE_TRACK:l=r?O.SUBTITLE_TRACK_LOAD_TIMEOUT:O.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const c={type:re.NETWORK_ERROR,details:l,fatal:d,url:e.url,loader:u,context:e,error:o,networkDetails:t,stats:n};if(s){const h=(t==null?void 0:t.url)||e.url;c.response=ft({url:h,data:void 0},s)}this.hls.trigger(E.ERROR,c)}handlePlaylistLoaded(e,t,r,s,n,a){const o=this.hls,{type:l,level:d,id:u,groupId:c,deliveryDirectives:h}=s,f=yu(t,s),m=ap(s),p=typeof s.level=="number"&&m===ie.MAIN?d:void 0;if(!e.fragments.length){const v=new Error("No Segments found in Playlist");o.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:O.LEVEL_EMPTY_ERROR,fatal:!1,url:f,error:v,reason:v.message,response:t,context:s,level:p,parent:m,networkDetails:n,stats:r});return}e.targetduration||(e.playlistParsingError=new Error("Missing Target Duration"));const g=e.playlistParsingError;if(g){o.trigger(E.ERROR,{type:re.NETWORK_ERROR,details:O.LEVEL_PARSING_ERROR,fatal:!1,url:f,error:g,reason:g.message,response:t,context:s,level:p,parent:m,networkDetails:n,stats:r});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),l){case ge.MANIFEST:case ge.LEVEL:o.trigger(E.LEVEL_LOADED,{details:e,level:p||0,id:u||0,stats:r,networkDetails:n,deliveryDirectives:h});break;case ge.AUDIO_TRACK:o.trigger(E.AUDIO_TRACK_LOADED,{details:e,id:u||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h});break;case ge.SUBTITLE_TRACK:o.trigger(E.SUBTITLE_TRACK_LOADED,{details:e,id:u||0,groupId:c||"",stats:r,networkDetails:n,deliveryDirectives:h});break}}}function Z0(i,e){let t;try{t=new Event("addtrack")}catch{t=document.createEvent("Event"),t.initEvent("addtrack",!1,!1)}t.track=i,e.dispatchEvent(t)}function J0(i,e){const t=i.mode;if(t==="disabled"&&(i.mode="hidden"),i.cues&&!i.cues.getCueById(e.id))try{if(i.addCue(e),!i.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){R.debug(`[texttrack-utils]: ${r}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,i.addCue(s)}catch(s){R.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}t==="disabled"&&(i.mode=t)}function nn(i){const e=i.mode;if(e==="disabled"&&(i.mode="hidden"),i.cues)for(let t=i.cues.length;t--;)i.removeCue(i.cues[t]);e==="disabled"&&(i.mode=e)}function nc(i,e,t,r){const s=i.mode;if(s==="disabled"&&(i.mode="hidden"),i.cues&&i.cues.length>0){const n=b1(i.cues,e,t);for(let a=0;a<n.length;a++)(!r||r(n[a]))&&i.removeCue(n[a])}s==="disabled"&&(i.mode=s)}function y1(i,e){if(e<i[0].startTime)return 0;const t=i.length-1;if(e>i[t].endTime)return-1;let r=0,s=t;for(;r<=s;){const n=Math.floor((s+r)/2);if(e<i[n].startTime)s=n-1;else if(e>i[n].startTime&&r<t)r=n+1;else return n}return i[r].startTime-e<e-i[s].startTime?r:s}function b1(i,e,t){const r=[],s=y1(i,e);if(s>-1)for(let n=s,a=i.length;n<a;n++){const o=i[n];if(o.startTime>=e&&o.endTime<=t)r.push(o);else if(o.startTime>t)return r}return r}function Uo(i){const e=[];for(let t=0;t<i.length;t++){const r=i[t];(r.kind==="subtitles"||r.kind==="captions")&&r.label&&e.push(i[t])}return e}var si={audioId3:"org.id3",dateRange:"com.apple.quicktime.HLS",emsg:"https://aomedia.org/emsg/ID3"};const T1=.25;function ac(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function op(i,e,t,r,s){let n=new i(e,t,"");try{n.value=r,s&&(n.type=s)}catch{n=new i(e,t,JSON.stringify(s?ft({type:s},r):r))}return n}const uo=(()=>{const i=ac();try{i&&new i(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function bu(i,e){return i.getTime()/1e3-e}function _1(i){return Uint8Array.from(i.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}class A1{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(e,t){this.media=t.media}onMediaDetaching(){this.id3Track&&(nn(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const t=this.getID3Track(e.textTracks);return t.mode="hidden",t}getID3Track(e){if(this.media){for(let t=0;t<e.length;t++){const r=e[t];if(r.kind==="metadata"&&r.label==="id3")return Z0(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,t){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:r,enableID3MetadataCues:s}}}=this;if(!r&&!s)return;const{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));const a=ac();if(a)for(let o=0;o<n.length;o++){const l=n[o].type;if(l===si.emsg&&!r||!s)continue;const d=G0(n[o].data);if(d){const u=n[o].pts;let c=u+n[o].duration;c>uo&&(c=uo),c-u<=0&&(c=u+T1);for(let f=0;f<d.length;f++){const m=d[f];if(!H0(m)){this.updateId3CueEnds(u,l);const p=op(a,u,c,m,l);p&&this.id3Track.addCue(p)}}}}}updateId3CueEnds(e,t){var r;const s=(r=this.id3Track)==null?void 0:r.cues;if(s)for(let n=s.length;n--;){const a=s[n];a.type===t&&a.startTime<e&&a.endTime===uo&&(a.endTime=e)}}onBufferFlushing(e,{startOffset:t,endOffset:r,type:s}){const{id3Track:n,hls:a}=this;if(!a)return;const{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=a;if(n&&(o||l)){let d;s==="audio"?d=u=>u.type===si.audioId3&&l:s==="video"?d=u=>u.type===si.emsg&&o:d=u=>u.type===si.audioId3&&l||u.type===si.emsg&&o,nc(n,t,r,d)}}onLevelUpdated(e,{details:t}){if(!this.media||!t.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:r,id3Track:s}=this,{dateRanges:n}=t,a=Object.keys(n);if(s){const u=Object.keys(r).filter(c=>!a.includes(c));for(let c=u.length;c--;){const h=u[c];Object.keys(r[h].cues).forEach(f=>{s.removeCue(r[h].cues[f])}),delete r[h]}}const o=t.fragments[t.fragments.length-1];if(a.length===0||!q(o==null?void 0:o.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const l=o.programDateTime/1e3-o.start,d=ac();for(let u=0;u<a.length;u++){const c=a[u],h=n[c],f=bu(h.startDate,l),m=r[c],p=(m==null?void 0:m.cues)||{};let g=(m==null?void 0:m.durationKnown)||!1,v=uo;const b=h.endDate;if(b)v=bu(b,l),g=!0;else if(h.endOnNext&&!g){const A=a.reduce((_,C)=>{if(C!==h.id){const x=n[C];if(x.class===h.class&&x.startDate>h.startDate&&(!_||h.startDate<_.startDate))return x}return _},null);A&&(v=bu(A.startDate,l),g=!0)}const y=Object.keys(h.attr);for(let A=0;A<y.length;A++){const _=y[A];if(!RA(_))continue;const C=p[_];if(C)g&&!m.durationKnown&&(C.endTime=v);else if(d){let x=h.attr[_];LA(_)&&(x=_1(x));const S=op(d,f,v,{key:_,data:x},si.dateRange);S&&(S.id=c,this.id3Track.addCue(S),p[_]=S)}}r[c]={cues:p,dateRange:h,durationKnown:g}}}}class S1{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.levelDetails=null,this.currentTime=0,this.stallCount=0,this._latency=null,this.timeupdateHandler=()=>this.timeupdate(),this.hls=e,this.config=e.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:e,levelDetails:t}=this;return e.liveMaxLatencyDuration!==void 0?e.liveMaxLatencyDuration:t?e.liveMaxLatencyDurationCount*t.targetduration:0}get targetLatency(){const{levelDetails:e}=this;if(e===null)return null;const{holdBack:t,partHoldBack:r,targetduration:s}=e,{liveSyncDuration:n,liveSyncDurationCount:a,lowLatencyMode:o}=this.config,l=this.hls.userConfig;let d=o&&r||t;(l.liveSyncDuration||l.liveSyncDurationCount||d===0)&&(d=n!==void 0?n:a*s);const u=s;return d+Math.min(this.stallCount*1,u)}get liveSyncPosition(){const e=this.estimateLiveEdge(),t=this.targetLatency,r=this.levelDetails;if(e===null||t===null||r===null)return null;const s=r.edge,n=e-t-this.edgeStalled,a=s-r.totalduration,o=s-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(a,n),o)}get drift(){const{levelDetails:e}=this;return e===null?1:e.drift}get edgeStalled(){const{levelDetails:e}=this;if(e===null)return 0;const t=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-t,0)}get forwardBufferLength(){const{media:e,levelDetails:t}=this;if(!e||!t)return 0;const r=e.buffered.length;return(r?e.buffered.end(r-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(E.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:t}){this.levelDetails=t,t.advanced&&this.timeupdate(),!t.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(e,t){var r;t.details===O.BUFFER_STALLED_ERROR&&(this.stallCount++,(r=this.levelDetails)!=null&&r.live&&R.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:e,levelDetails:t}=this;if(!e||!t)return;this.currentTime=e.currentTime;const r=this.computeLatency();if(r===null)return;this._latency=r;const{lowLatencyMode:s,maxLiveSyncPlaybackRate:n}=this.config;if(!s||n===1||!t.live)return;const a=this.targetLatency;if(a===null)return;const o=r-a,l=Math.min(this.maxLatency,a+t.targetduration);if(o<l&&o>.05&&this.forwardBufferLength>1){const u=Math.min(2,Math.max(1,n)),c=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;e.playbackRate=Math.min(u,Math.max(1,c))}else e.playbackRate!==1&&e.playbackRate!==0&&(e.playbackRate=1)}estimateLiveEdge(){const{levelDetails:e}=this;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const oc=["NONE","TYPE-0","TYPE-1",null];function x1(i){return oc.indexOf(i)>-1}const sd=["SDR","PQ","HLG"];function R1(i){return!!i&&sd.indexOf(i)>-1}var Fo={No:"",Yes:"YES",v2:"v2"};function lp(i){const{canSkipUntil:e,canSkipDateRanges:t,age:r}=i,s=r<e/2;return e&&s?t?Fo.v2:Fo.Yes:Fo.No}class dp{constructor(e,t,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=r}addDirectives(e){const t=new self.URL(e);return this.msn!==void 0&&t.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href}}class Rn{constructor(e){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(t=>!!t).map(t=>t.substring(0,4)).join(","),this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return up(this._audioGroups,e)}hasSubtitleGroup(e){return up(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if(e==="audio"){let r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(t)===-1&&r.push(t)}else if(e==="text"){let r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),r.indexOf(t)===-1&&r.push(t)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function up(i,e){return!e||!i?!1:i.indexOf(e)!==-1}function Tu(i,e){const t=e.startPTS;if(q(t)){let r=0,s;e.sn>i.sn?(r=t-i.start,s=i):(r=i.start-t,s=e),s.duration!==r&&(s.duration=r)}else e.sn>i.sn?i.cc===e.cc&&i.minEndPTS?e.start=i.start+(i.minEndPTS-i.start):e.start=i.start+i.duration:e.start=Math.max(i.start-e.duration,0)}
22function ev(i,e,t,r,s,n){r-t<=0&&(R.warn("Fragment should have a positive duration",e),r=t+e.duration,n=s+e.duration);let o=t,l=r;const d=e.startPTS,u=e.endPTS;if(q(d)){const g=Math.abs(d-t);q(e.deltaPTS)?e.deltaPTS=Math.max(g,e.deltaPTS):e.deltaPTS=g,o=Math.max(t,d),t=Math.min(t,d),s=Math.min(s,e.startDTS),l=Math.min(r,u),r=Math.max(r,u),n=Math.max(n,e.endDTS)}const c=t-e.start;e.start!==0&&(e.start=t),e.duration=r-e.start,e.startPTS=t,e.maxStartPTS=o,e.startDTS=s,e.endPTS=r,e.minEndPTS=l,e.endDTS=n;const h=e.sn;if(!i||h<i.startSN||h>i.endSN)return 0;let f;const m=h-i.startSN,p=i.fragments;for(p[m]=e,f=m;f>0;f--)Tu(p[f],p[f-1]);for(f=m;f<p.length-1;f++)Tu(p[f],p[f+1]);return i.fragmentHint&&Tu(p[p.length-1],i.fragmentHint),i.PTSKnown=i.alignedSliding=!0,c}function L1(i,e){let t=null;const r=i.fragments;for(let o=r.length-1;o>=0;o--){const l=r[o].initSegment;if(l){t=l;break}}i.fragmentHint&&delete i.fragmentHint.endPTS;let s;w1(i,e,(o,l,d,u)=>{if(e.skippedSegments&&l.cc!==o.cc){const c=o.cc-l.cc;for(let h=d;h<u.length;h++)u[h].cc+=c}q(o.startPTS)&&q(o.endPTS)&&(l.start=l.startPTS=o.startPTS,l.startDTS=o.startDTS,l.maxStartPTS=o.maxStartPTS,l.endPTS=o.endPTS,l.endDTS=o.endDTS,l.minEndPTS=o.minEndPTS,l.duration=o.endPTS-o.startPTS,l.duration&&(s=l),e.PTSKnown=e.alignedSliding=!0),l.elementaryStreams=o.elementaryStreams,l.loader=o.loader,l.stats=o.stats,o.initSegment&&(l.initSegment=o.initSegment,t=o.initSegment)});const n=e.fragments;if(t&&(e.fragmentHint?n.concat(e.fragmentHint):n).forEach(l=>{var d;l&&(!l.initSegment||l.initSegment.relurl===((d=t)==null?void 0:d.relurl))&&(l.initSegment=t)}),e.skippedSegments){if(e.deltaUpdateFailed=n.some(o=>!o),e.deltaUpdateFailed){R.warn("[level-helper] Previous playlist missing segments ski
22pped in delta playlist");for(let o=e.skippedSegments;o--;)n.shift();e.startSN=n[0].sn}else e.canSkipDateRanges&&(e.dateRanges=I1(i.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));e.startCC=e.fragments[0].cc,e.endCC=n[n.length-1].cc}k1(i.partList,e.partList,(o,l)=>{l.elementaryStreams=o.elementaryStreams,l.stats=o.stats}),s?ev(e,s,s.startPTS,s.endPTS,s.startDTS,s.endDTS):tv(i,e),n.length&&(e.totalduration=e.edge-n[0].start),e.driftStartTime=i.driftStartTime,e.driftStart=i.driftStart;const a=e.advancedDateTime;if(e.advanced&&a){const o=e.edge;e.driftStart||(e.driftStartTime=a,e.driftStart=o),e.driftEndTime=a,e.driftEnd=o}else e.driftEndTime=i.driftEndTime,e.driftEnd=i.driftEnd,e.advancedDateTime=i.advancedDateTime}function I1(i,e,t){const r=it({},i);return t&&t.forEach(s=>{delete r[s]}),Object.keys(e).forEach(s=>{const n=new N0(e[s].attr,r[s]);n.isValid?r[s]=n:R.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[s].attr)}"`)}),r}function k1(i,e,t){if(i&&e){let r=0;for(let s=0,n=i.length;s<=n;s++){const a=i[s],o=e[s+r];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?t(a,o):r--}}}function w1(i,e,t){const r=e.skippedSegments,s=Math.max(i.startSN,e.startSN)-e.startSN,n=(i.fragmentHint?1:0)+(r?e.endSN:Math.min(i.endSN,e.endSN))-e.startSN,a=e.startSN-i.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=i.fragmentHint?i.fragments.concat(i.fragmentHint):i.fragments;for(let d=s;d<=n;d++){const u=l[a+d];let c=o[d];r&&!c&&d<r&&(c=e.fragments[d]=u),u&&c&&t(u,c,d,o)}}function tv(i,e){const t=e.startSN+e.skippedSegments-i.startSN,r=i.fragments;t<0||t>=r.length||lc(e,r[t].start)}function lc(i,e){if(e){const t=i.fragments;for(let r=i.skippedSegments;r<t.length;r++)t[r].start+=e;i.fragmentHint&&(i.fragmentHint.start+=e)}}function D1(i,e=1/0){let t=1e3*i.targetduration;if(i.updated){const r=i.fragments;if(r.length&&t*4>e){const n=r[r.length-1].duration*1e3;n<t&&(t=n)}}else t/=2;return Math.round(t)}function C1(i,e,t){if(!(i!=null&&i.details))return null;const r=i.details;let s=r.fragments[e-r.startSN];return s||(s=r.fragmentHint,s&&s.sn===e)?s:e<r.startSN&&t&&t.sn===e?t:null}function cp(i,e,t){var r;return i!=null&&i.details?iv((r=i.details)==null?void 0:r.partList,e,t):null}function iv(i,e,t){if(i)for(let r=i.length;r--;){const s=i[r];if(s.index===t&&s.fragment.sn===e)return s}return null}function rv(i){i.forEach((e,t)=>{const{details:r}=e;r!=null&&r.fragments&&r.fragments.forEach(s=>{s.level=t})})}function nd(i){switch(i.details){case O.FRAG_LOAD_TIMEOUT:case O.KEY_LOAD_TIMEOUT:case O.LEVEL_LOAD_TIMEOUT:case O.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function hp(i,e){const t=nd(e);return i.default[`${t?"timeout":"error"}Retry`]}function jh(i,e){const t=i.backoff==="linear"?1:Math.pow(2,e);return Math.min(t*i.retryDelayMs,i.maxRetryDelayMs)}function fp(i){return ft(ft({},i),{errorRetry:null,timeoutRetry:null})}function ad(i,e,t,r){if(!i)return!1;const s=r==null?void 0:r.code,n=e<i.maxNumRetry&&(M1(s)||!!t);return i.shouldRetry?i.shouldRetry(i,e,t,r,n):n}function M1(i){return i===0&&navigator.onLine===!1||!!i&&(i<400||i>499)}const sv={search:function(i,e){let t=0,r=i.length-1,s=null,n=null;for(;t<=r;){s=(t+r)/2|0,n=i[s];const a=e(n);if(a>0)t=s+1;else if(a<0)r=s-1;else return n}return null}};function O1(i,e,t){if(e===null||!Array.isArray(i)||!i.length||!q(e))return null;const r=i[0].programDateTime;if(e<(r||0))return null;const s=i[i.length-1].endProgramDateTime;if(e>=(s||0))return null;t=t||0;for(let n=0;n<i.length;++n){const a=i[n];if(N1(e,t,a))return a}return null}function od(i,e,t=0,r=0,s=.005){let n=null;if(i){n=e[i.sn-e[0].sn+1]||null;const o=i.endDTS-t;o>0&&o<15e-7&&(t+=15e-7)}else t===0&&e[0].start===0&&(n=e[0]);if(n&&((!i||i.level===n.level)&&dc(t,r,n)===0||P1(n,i,Math.min(s,r))))return n;const a=sv.search(e,dc.bind(null,t,r));return a&&(a!==i||!n)?a:n}function P1(i,e,t){if(e&&e.start===0&&e.level<i.level&&(e.endPTS||0)>0){const r=e.tagList.reduce((s,n)=>(n[0]==="INF"&&(s+=parseFloat(n[1])),s),t);return i.start<=r}return!1}function dc(i=0,e=0,t){if(t.start<=i&&t.start+t.duration>i)return 0;const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0));return t.start+t.duration-r<=i?1:t.start-r>i&&t.start?-1:0}function N1(i,e,t){const r=Math.min(e,t.duration+(t.deltaPTS?t.deltaPTS:0))*1e3;return(t.endProgramDateTime||0)-r>i}function U1(i,e){return sv.search(i,t=>t.cc<e?1:t.cc>e?-1:0)}var vt={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Qt={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2};class F1{constructor(e){this.hls=void 0,this.playlistError=0,this.penalizedRenditions={},this.log=void 0,this.warn=void 0,this.error=void 0,this.hls=e,this.log=R.log.bind(R,"[info]:"),this.warn=R.warn.bind(R,"[warning]:"),this.error=R.error.bind(R,"[error]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.ERROR,this.onError,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.ERROR,this.onError,this),e.off(E.ERROR,this.onErrorOut,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===ie.MAIN?e.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(e,t){var r,s;if(t.fatal)return;const n=this.hls,a=t.context;switch(t.details){case O.FRAG_LOAD_ERROR:case O.FRAG_LOAD_TIMEOUT:case O.KEY_LOAD_ERROR:case O.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case O.FRAG_PARSING_ERROR:if((r=t.frag)!=null&&r.gap){t.errorAction={action:vt.DoNothing,flags:Qt.None};return}case O.FRAG_GAP:case O.FRAG_DECRYPT_ERROR:{t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=vt.SendAlternateToPenaltyBox;return}case O.LEVEL_EMPTY_ERROR:case O.LEVEL_PARSING_ERROR:{var o,l;const d=t.parent===ie.MAIN?t.level:n.loadLevel;t.details===O.LEVEL_EMPTY_ERROR&&((o=t.context)!=null&&(l=o.levelDetails)!=null&&l.live)?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,d):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,d))}return;case O.LEVEL_LOAD_ERROR:case O.LEVEL_LOAD_TIMEOUT:typeof(a==null?void 0:a.level)=="number"&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case O.AUDIO_TRACK_LOAD_ERROR:case O.AUDIO_TRACK_LOAD_TIMEOUT:case O.SUBTITLE_LOAD_ERROR:case O.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){const d=n.levels[n.loadLevel];if(d&&(a.type===ge.AUDIO_TRACK&&d.hasAudioGroup(a.groupId)||a.type===ge.SUBTITLE_TRACK&&d.hasSubtitleGroup(a.groupId))){t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=vt.SendAlternateToPenaltyBox,t.errorAction.flags=Qt.MoveAllAlternatesMatchingHost;return}}return;case O.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const d=n.levels[n.loadLevel],u=d==null?void 0:d.attrs["HDCP-LEVEL"];u?t.errorAction={action:vt.SendAlternateToPenaltyBox,flags:Qt.MoveAllAlternatesMatchingHDCP,hdcpLevel:u}:this.keySystemError(t)}return;
vendor: 23,515 bytes, lines 22-29
22case O.BUFFER_ADD_CODEC_ERROR:case O.REMUX_ALLOC_ERROR:case O.BUFFER_APPEND_ERROR:t.errorAction=this.getLevelSwitchAction(t,(s=t.level)!=null?s:n.loadLevel);return;case O.INTERNAL_EXCEPTION:case O.BUFFER_APPENDING_ERROR:case O.BUFFER_FULL_ERROR:case O.LEVEL_SWITCH_ERROR:case O.BUFFER_STALLED_ERROR:case O.BUFFER_SEEK_OVER_HOLE:case O.BUFFER_NUDGE_ON_STALL:t.errorAction={action:vt.DoNothing,flags:Qt.None};return}t.type===re.KEY_SYSTEM_ERROR&&this.keySystemError(t)}keySystemError(e){const t=this.getVariantLevelIndex(e.frag);e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t)}getPlaylistRetryOrSwitchAction(e,t){const r=this.hls,s=hp(r.config.playlistLoadPolicy,e),n=this.playlistError++;if(ad(s,n,nd(e),e.response))return{action:vt.RetryRequest,flags:Qt.None,retryConfig:s,retryCount:n};const o=this.getLevelSwitchAction(e,t);return s&&(o.retryConfig=s,o.retryCount=n),o}getFragRetryOrSwitchAction(e){const t=this.hls,r=this.getVariantLevelIndex(e.frag),s=t.levels[r],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,o=hp(e.details.startsWith("key")?a:n,e),l=t.levels.reduce((u,c)=>u+c.fragmentError,0);if(s&&(e.details!==O.FRAG_GAP&&s.fragmentError++,ad(o,l,nd(e),e.response)))return{action:vt.RetryRequest,flags:Qt.None,retryConfig:o,retryCount:l};const d=this.getLevelSwitchAction(e,r);return o&&(d.retryConfig=o,d.retryCount=l),d}getLevelSwitchAction(e,t){const r=this.hls;t==null&&(t=r.loadLevel);const s=this.hls.levels[t];if(s){var n,a;const d=e.details;s.loadError++,d===O.BUFFER_APPEND_ERROR&&s.fragmentError++;let u=-1;const{levels:c,loadLevel:h,minAutoLevel:f,maxAutoLevel:m}=r;r.autoLevelEnabled||(r.loadLevel=-1);const p=(n=e.frag)==null?void 0:n.type,v=(p===ie.AUDIO&&d===O.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===O.BUFFER_ADD_CODEC_ERROR||d===O.BUFFER_APPEND_ERROR))&&c.some(({audioCodec:C})=>s.audioCodec!==C),y=e.sourceBufferName==="video"&&(d===O.BUFFER_ADD_CODEC_ERROR||d===O.BUFFER_APPEND_ERROR)&&c.some(({codecSet:C,audioCodec:x})=>s.codecSet!==C&&s.audioCodec===x),{type:A,groupId:_}=(a=e.context)!=null?a:{};for(let C=c.length;C--;){const x=(C+h)%c.length;if(x!==h&&x>=f&&x<=m&&c[x].loadError===0){var o,l;const S=c[x];if(d===O.FRAG_GAP&&p===ie.MAIN&&e.frag){const P=c[x].details;if(P){const I=od(e.frag,P.fragments,e.frag.start);if(I!=null&&I.gap)continue}}else{if(A===ge.AUDIO_TRACK&&S.hasAudioGroup(_)||A===ge.SUBTITLE_TRACK&&S.hasSubtitleGroup(_))continue;if(p===ie.AUDIO&&(o=s.audioGroups)!=null&&o.some(P=>S.hasAudioGroup(P))||p===ie.SUBTITLE&&(l=s.subtitleGroups)!=null&&l.some(P=>S.hasSubtitleGroup(P))||v&&s.audioCodec===S.audioCodec||!v&&s.audioCodec!==S.audioCodec||y&&s.codecSet===S.codecSet)continue}u=x;break}}if(u>-1&&r.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:vt.SendAlternateToPenaltyBox,flags:Qt.None,nextAutoLevel:u}}return{action:vt.SendAlternateToPenaltyBox,flags:Qt.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var r;switch((r=t.errorAction)==null?void 0:r.action){case vt.DoNothing:break;case vt.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),!t.errorAction.resolved&&t.details!==O.FRAG_GAP?t.fatal=!0:/MediaSource readyState: ended/.test(t.error.message)&&(this.warn(`MediaSource ended after "${t.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(t.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const t=this.hls,r=e.errorAction;if(!r)return;const{flags:s,hdcpLevel:n,nextAutoLevel:a}=r;switch(s){case Qt.None:this.switchLevel(e,a);break;case Qt.MoveAllAlternatesMatchingHDCP:n&&(t.maxHdcpLevel=oc[oc.indexOf(n)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${t.maxHdcpLevel}" or lower`);break}r.resolved||this.switchLevel(e,a)}switchLevel(e,t){t!==void 0&&e.errorAction&&(this.warn(`switching to level ${t} after ${e.details}`),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel)}}class zh{constructor(e,t){this.hls=void 0,this.timer=-1,this.requestScheduled=-1,this.canLoad=!1,this.log=void 0,this.warn=void 0,this.log=R.log.bind(R,`${t}:`),this.warn=R.warn.bind(R,`${t}:`),this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,r){const s=t==null?void 0:t.renditionReports;if(s){let n=-1;for(let a=0;a<s.length;a++){const o=s[a];let l;try{l=new self.URL(o.URI,t.url).href}catch(d){R.warn(`Could not construct new URL for Rendition Report: ${d}`),l=o.URI||""}if(l===e){n=a;break}else l===e.substring(0,l.length)&&(n=a)}if(n!==-1){const a=s[n],o=parseInt(a["LAST-MSN"])||(t==null?void 0:t.lastPartSn);let l=parseInt(a["LAST-PART"])||(t==null?void 0:t.lastPartIndex);if(this.hls.config.lowLatencyMode){const u=Math.min(t.age-t.partTarget,t.targetduration);l>=0&&u>t.partTarget&&(l+=1)}const d=r&&lp(r);return new dp(o,l>=0?l:void 0,d)}}}loadPlaylist(e){this.requestScheduled===-1&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}shouldReloadPlaylist(e){return this.timer===-1&&this.requestScheduled===-1&&this.shouldLoadPlaylist(e)}playlistLoaded(e,t,r){const{details:s,stats:n}=t,a=self.performance.now(),o=n.loading.first?Math.max(0,a-n.loading.first):0;if(s.advancedDateTime=Date.now()-o,s.live||r!=null&&r.live){if(s.reloaded(r),r&&this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),r&&s.fragments.length>0&&L1(r,s),!this.canLoad||!s.live)return;let l,d,u;if(s.canBlockReload&&s.endSN&&s.advanced){const g=this.hls.config.lowLatencyMode,v=s.lastPartSn,b=s.endSN,y=s.lastPartIndex,A=y!==-1,_=v===b,C=g?0:y;A?(d=_?b+1:v,u=_?C:y+1):d=b+1;const x=s.age,S=x+s.ageHeader;let P=Math.min(S-s.partTarget,s.targetduration*1.5);if(P>0){if(r&&P>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${P} with playlist age: ${s.age}`),P=0;else{const I=Math.floor(P/s.targetduration);if(d+=I,u!==void 0){const M=Math.round(P%s.targetduration/s.partTarget);u+=M}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${x.toFixed(2)}s goal: ${P} skip sn ${I} to part ${u}`)}s.tuneInGoal=P}if(l=this.getDeliveryDirectives(s,t.deliveryDirectives,d,u),g||!_){this.loadPlaylist(l);return}}else(s.canBlockReload||s.canSkipUntil)&&(l=this.getDeliveryDirectives(s,t.deliveryDirectives,d,u));const c=this.hls.mainForwardBufferInfo,h=c?c.end-c.len:0,f=(s.edge-h)*1e3,m=D1(s,f);s.updated&&a>this.requestScheduled+m&&(this.requestScheduled=n.loading.start),d!==void 0&&s.canBlockReload?this.requestScheduled=n.loading.first+m-(s.partTarget*1e3||1e3):this.requestScheduled===-1||this.requestScheduled+m<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=m);let p=this.requestScheduled-a;p=Math.max(0,p),this.log(`reload live playlist ${e} in ${Math.round(p)} ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(l),p)}else this.clearTimer()}getDeliveryDirectives(e,t,r,s){let n=lp(e);return t!=null&&t.skip&&e.deltaUpdateFailed&&(r=t.msn,s=t.part,n=Fo.No),new dp(r,s,n)}checkRetry(e){const t=e.details,r=nd(e),s=e.errorAction,{action:n,retryCount:a=0,retryConfig:o}=s||{},l=!!s&&!!o&&(n===vt.RetryRequest||!s.resolved&&n===vt.SendAlternateToPenaltyBox);if(l){var d;if(this.requestScheduled=-1,a>=o.maxNumRetry)return!1;if(r&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" without delivery-directives`),this.loadPlaylist();else{const u=jh(o,a);this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${a+1}/${o.maxNumRetry} after "${t}" in ${u}ms`)}e.levelRetry=!0,s.resolved=!0}return l}}class Is{constructor(e,t=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=r}sample(e,t){const r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class $1{constructor(e,t,r,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new Is(e),this.fast_=new Is(t),this.defaultTTFB_=s,this.ttfb_=new Is(e)}update(e,t){const{slow_:r,fast_:s,ttfb_:n}=this;r.halfLife!==e&&(this.slow_=new Is(e,r.getEstimate(),r.getTotalWeight())),s.halfLife!==t&&(this.fast_=new Is(t,s.getEstimate(),s.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new Is(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){e=Math.max(e,this.minDelayMs_);const r=8*t,s=e/1e3,n=r/s;this.fast_.sample(s,n),this.slow_.sample(s,n)}sampleTTFB(e){const t=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const nv={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},mp={};function B1(i,e,t,r,s,n){const a=i.audioCodec?i.audioGroups:null,o=n==null?void 0:n.audioCodec,l=n==null?void 0:n.channels,d=l?parseInt(l):o?1/0:2;let u=null;if(a!=null&&a.length)try{a.length===1&&a[0]?u=e.groups[a[0]].channels:u=a.reduce((c,h)=>{if(h){const f=e.groups[h];if(!f)throw new Error(`Audio track group ${h} not found`);Object.keys(f.channels).forEach(m=>{c[m]=(c[m]||0)+f.channels[m]})}return c},{2:0})}catch{return!0}return i.videoCodec!==void 0&&(i.width>1920&&i.height>1088||i.height>1920&&i.width>1088||i.frameRate>Math.max(r,30)||i.videoRange!=="SDR"&&i.videoRange!==t||i.bitrate>Math.max(s,8e6))||!!u&&q(d)&&Object.keys(u).some(c=>parseInt(c)>d)}function H1(i,e,t){const r=i.videoCodec,s=i.audioCodec;if(!r||!s||!t)return Promise.resolve(nv);const n={width:i.width,height:i.height,bitrate:Math.ceil(Math.max(i.bitrate*.9,i.averageBitrate)),framerate:i.frameRate||30},a=i.videoRange;a!=="SDR"&&(n.transferFunction=a.toLowerCase());const o=r.split(",").map(l=>({type:"media-source",video:ft(ft({},n),{},{contentType:Ua(l,"video")})}));return s&&i.audioGroups&&i.audioGroups.forEach(l=>{var d;l&&((d=e.groups[l])==null||d.tracks.forEach(u=>{if(u.groupId===l){const c=u.channels||"",h=parseFloat(c);q(h)&&h>2&&o.push.apply(o,s.split(",").map(f=>({type:"media-source",audio:{contentType:Ua(f,"audio"),channels:""+h}})))}}))}),Promise.all(o.map(l=>{const d=G1(l);return mp[d]||(mp[d]=t.decodingInfo(l))})).then(l=>({supported:!l.some(d=>!d.supported),configurations:o,decodingInfoResults:l})).catch(l=>({supported:!1,configurations:o,decodingInfoResults:[],error:l}))}function G1(i){const{audio:e,video:t}=i,r=t||e;if(r){const s=r.contentType.split('"')[1];if(t)return`r${t.height}x${t.width}f${Math.ceil(t.framerate)}${t.transferFunction||"sd"}_${s}_${Math.ceil(t.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${s}`}return""}function K1(){if(typeof matchMedia=="function"){const i=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(i.media!==e.media)return i.matches===!0}return!1}function V1(i,e){let t=!1,r=[];return i&&(t=i!=="SDR",r=[i]),e&&(r=e.allowedVideoRanges||sd.slice(0),t=e.preferHDR!==void 0?e.preferHDR:K1(),t?r=r.filter(s=>s!=="SDR"):r=["SDR"]),{preferHDR:t,allowedVideoRanges:r}}function W1(i,e,t,r,s){const n=Object.keys(i),a=r==null?void 0:r.channels,o=r==null?void 0:r.audioCodec,l=a&&parseInt(a)===2;let d=!0,u=!1,c=1/0,h=1/0,f=1/0,m=0,p=[];const{preferHDR:g,allowedVideoRanges:v}=V1(e,s);for(let _=n.length;_--;){const C=i[n[_]];d=C.channels[2]>0,c=Math.min(c,C.minHeight),h=Math.min(h,C.minFramerate),f=Math.min(f,C.minBitrate);const x=v.filter(S=>C.videoRanges[S]>0);x.length>0&&(u=!0,p=x)}c=q(c)?c:0,h=q(h)?h:0;const b=Math.max(1080,c),y=Math.max(30,h);return f=q(f)?f:t,t=Math.max(f,t),u||(e=void 0,p=[]),{codecSet:n.reduce((_,C)=>{const x=i[C];if(C===_)return _;if(x.minBitrate>t)return Ui(C,`min bitrate of ${x.minBitrate} > current estimate of ${t}`),_;if(!x.hasDefaultAudio)return Ui(C,"no renditions with default or auto-select sound found"),_;if(o&&C.indexOf(o.substring(0,4))%5!==0)return Ui(C,`audio codec preference "${o}" not found`),_;if(a&&!l){if(!x.channels[a])return Ui(C,`no renditions with ${a} channel sound found (channels options: ${Object.keys(x.channels)})`),_}else if((!o||l)&&d&&x.channels[2]===0)return Ui(C,"no renditions with stereo sound found"),_;return x.minHeight>b?(Ui(C,`min resolution of ${x.minHeight} > maximum of ${b}`),_):x.minFramerate>y?(Ui(C,`min framerate of ${x.minFramerate} > maximum of ${y}`),_):p.some(S=>x.videoRanges[S]>0)?x.maxScore<m?(Ui(C,`max score of ${x.maxScore} < selected max of ${m}`),_):_&&(id(C)>=id(_)||x.fragmentError>i[_].fragmentError)?_:(m=x.maxScore,C):(Ui(C,`no variants with VIDEO-RANGE of ${JSON.stringify(p)} found`),_)},void 0),videoRanges:p,preferHDR:g,minFramerate:h,minBitrate:f}}function Ui(i,e){R.log(`[abr] start candidates with "${i}" ignored because ${e}`)}function Y1(i){return i.reduce((e,t)=>{let r=e.groups[t.groupId];r||(r=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(t);const s=t.channels||"2";return r.channels[s]=(r.channels[s]||0)+1,r.hasDefault=r.hasDefault||t.default,r.hasAutoSelect=r.hasAutoSelect||t.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function q1(i,e,t,r){return i.slice(t,r+1).reduce((s,n)=>{if(!n.codecSet)return s;const a=n.audioGroups;let o=s[n.codecSet];o||(s[n.codecSet]=o={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!a,fragmentError:0}),o.minBitrate=Math.min(o.minBitrate,n.bitrate);const l=Math.min(n.height,n.width);return o.minHeight=Math.min(o.minHeight,l),o.minFramerate=Math.min(o.minFramerate,n.frameRate),o.maxScore=Math.max(o.maxScore,n.score),o.fragmentError+=n.fragmentError,o.videoRanges[n.videoRange]=(o.videoRanges[n.videoRange]||0)+1,a&&a.forEach(d=>{if(!d)return;const u=e.groups[d];u&&(o.hasDefaultAudio=o.hasDefaultAudio||e.hasDefaultAudio?u.hasDefault:u.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(u.channels).forEach(c=>{o.channels[c]=(o.channels[c]||0)+u.channels[c]}))}),s},{})}function Li(i,e,t){if("attrs"in i){const r=e.indexOf(i);if(r!==-1)return r}for(let r=0;r<e.length;r++){const s=e[r];if(ps(i,s,t))return r}return-1}function ps(i,e,t){const{groupId:r,name:s,lang:n,assocLang:a,default:o}=i,l=i.forced;return(r===void 0||e.groupId===r)&&(s===void 0||e.name===s)&&(n===void 0||e.lang===n)&&(n===void 0||e.assocLang===a)&&(o===void 0||e.default===o)&&(l===void 0||e.forced===l)&&(!("characteristics"in i)||j1(i.characteristics||"",e.characteristics))&&(t===void 0||t(i,e))}function j1(i,e=""){const t=i.split(","),r=e.split(",");return t.length===r.length&&!t.some(s=>r.indexOf(s)===-1)}function Vr(i,e){const{audioCodec:t,channels:r}=i;return(t===void 0||(e.audioCodec||"").substring(0,4)===t.substring(0,4))&&(r===void 0||r===(e.channels||"2"))}function z1(i,e,t,r,s){const n=e[r],o=e.reduce((h,f,m)=>{const p=f.uri;return(h[p]||(h[p]=[])).push(m),h},{})[n.uri];o.length>1&&(r=Math.max.apply(Math,o));const l=n.videoRange,d=n.frameRate,u=n.codecSet.substring(0,4),c=pp(e,r,h=>{if(h.videoRange!==l||h.frameRate!==d||h.codecSet.substring(0,4)!==u)return!1;const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Li(i,m,s)>-1});return c>-1?c:pp(e,r,h=>{const f=h.audioGroups,m=t.filter(p=>!f||f.indexOf(p.groupId)!==-1);return Li(i,m,s)>-1})}function pp(i,e,t){for(let r=e;r>-1;r--)if(t(i[r]))return r;for(let r=e+1;r<i.length;r++)if(t(i[r]))return r;return-1}class X1{constructor(e){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:r,hls:s}=this,{autoLevelEnabled:n,media:a}=s;if(!t||!a)return;const o=performance.now(),l=r?r.stats:t.stats,d=r?r.duration:t.duration,u=o-l.loading.start,c=s.minAutoLevel;if(l.aborted||l.loaded&&l.loaded===l.total||t.level<=c){this.clearTimer(),this._nextAutoLevel=-1;return}if(!n||a.paused||!a.playbackRate||!a.readyState)return;const h=s.mainForwardBufferInfo;if(h===null)return;const f=this.bwEstimator.getEstimateTTFB(),m=Math.abs(a.playbackRate);if(u<=Math.max(f,1e3*(d/(m*2))))return;const p=h.len/m,g=l.loading.first?l.loading.first-l.loading.start:-1,v=l.loaded&&g>-1,b=this.getBwEstimate(),y=s.levels,A=y[t.level],_=l.total||Math.max(l.loaded,Math.round(d*A.averageBitrate/8));let C=v?u-g:u;C<1&&v&&(C=Math.min(u,l.loaded*8/b));const x=v?l.loaded*1e3/C:0,S=x?(_-l.loaded)/x:_*8/b+f/1e3;if(S<=p)return;const P=x?x*8:b;let I=Number.POSITIVE_INFINITY,M;for(M=t.level-1;M>c;M--){const F=y[M].maxBitrate;if(I=this.getTimeToLoadFrag(f/1e3,P,d*F,!y[M].details),I<p)break}if(I>=S||I>d*10)return;s.nextLoadLevel=s.nextAutoLevel=M,v?this.bwEstimator.sample(u-Math.min(f,g),l.loaded):this.bwEstimator.sampleTTFB(u);const $=y[M].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>$&&this.resetEstimator($),this.clearTimer(),R.warn(`[abr] Fragment ${t.sn}${r?" part "+r.index:""} of level ${t.level} is loading too slowly; 23 Time to underbuffer: ${p.toFixed(3)} s 24 Estimated load time for current fragment: ${S.toFixed(3)} s 25 Estimated load time for down switch fragment: ${I.toFixed(3)} s 26 TTFB estimate: ${g|0} ms 27 Current BW estimate: ${q(b)?b|0:"Unknown"} bps 28 New BW estimate: ${this.getBwEstimate()|0} bps 29 Switching to level ${M} @ ${$|0} bps`),s.trigger(E.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:r,stats:l})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(R.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new $1(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(E.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,t){const r=t.frag;if(!this.ignoreFragment(r)){if(!r.bitrateTest){var s;this.fragCurrent=r,this.partCurrent=(s=t.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,t){this.clearTimer()}onError(e,t){if(!t.fatal)switch(t.details){case O.BUFFER_ADD_CODEC_ERROR:case O.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case O.FRAG_LOAD_TIMEOUT:{const r=t.frag,{fragCurrent:s,partCurrent:n}=this;if(r&&s&&r.sn===s.sn&&r.level===s.level){const a=performance.now(),o=n?n.stats:r.stats,l=a-o.loading.start,d=o.loading.first?o.loading.first-o.loading.start:-1;if(o.loaded&&d>-1){const c=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(l-Math.min(c,d),o.loaded)}else this.bwEstimator.sampleTTFB(l)}break}}}getTimeToLoadFrag(e,t,r,s){const n=e+r/t,a=s?this.lastLevelLoadSec:0;return n+a}onLevelLoaded(e,t){const r=this.hls.config,{loading:s}=t.stats,n=s.end-s.start;q(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}onFragLoaded(e,{frag:t,part:r}){const s=r?r.stats:t.stats;if(t.type===ie.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(t)){if(this.clearTimer(),t.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const n=r?r.duration:t.duration,a=this.hls.levels[t.level],o=(a.loaded?a.loaded.bytes:0)+s.loaded,l=(a.loaded?a.loaded.duration:0)+n;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(t.bitrateTest){const n={stats:s,frag:t,part:r,id:t.type};this.onFragBuffered(E.FRAG_BUFFERED,n),t.bitrateTest=!1}else this.lastLoadedFragLevel=t.level}}onFragBuffered(e,t){const{frag:r,part:s}=t,n=s!=null&&s.stats.loaded?s.stats:r.stats;if(n.aborted||this.ignoreFragment(r))return;const a=n.parsing.end-n.loading.start-Math.min(n.loading.first-n.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==ie.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:t}=this.hls,r=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,n=this.findBestLevel(r,t,e,0,s,1,1);if(n>-1)return n;const a=this.hls.firstLevel,o=Math.min(Math.max(a,t),e);return R.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${a} clamped to ${o}`),o}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,r=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!r||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const n=r&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const a=this.hls.levels;if(a.length>Math.max(e,n)&&a[e].loadError<=a[n].loadError)return e}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}
29_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:t,hls:r}=this,{maxAutoLevel:s,config:n,minAutoLevel:a}=r,o=t?t.duration:e?e.duration:0,l=this.getBwEstimate(),d=this.getStarvationDelay();let u=n.abrBandWidthFactor,c=n.abrBandWidthUpFactor;if(d){const g=this.findBestLevel(l,a,s,d,0,u,c);if(g>=0)return g}let h=o?Math.min(o,n.maxStarvationDelay):n.maxStarvationDelay;if(!d){const g=this.bitrateTestDelay;g&&(h=(o?Math.min(o,n.maxLoadingDelay):n.maxLoadingDelay)-g,R.info(`[abr] bitrate test took ${Math.round(1e3*g)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=c=1)}const f=this.findBestLevel(l,a,s,d,h,u,c);if(R.info(`[abr] ${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`),f>-1)return f;const m=r.levels[a],p=r.levels[r.loadLevel];return(m==null?void 0:m.bitrate)<(p==null?void 0:p.bitrate)?a:r.loadLevel}getStarvationDelay(){const e=this.hls,t=e.media;if(!t)return 1/0;const r=t&&t.playbackRate!==0?Math.abs(t.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,t,r,s,n,a,o){var l;const d=s+n,u=this.lastLoadedFragLevel,c=u===-1?this.hls.firstLevel:u,{fragCurrent:h,partCurrent:f}=this,{levels:m,allAudioTracks:p,loadLevel:g,config:v}=this.hls;if(m.length===1)return 0;const b=m[c],y=!!(b!=null&&(l=b.details)!=null&&l.live),A=g===-1||u===-1;let _,C="SDR",x=(b==null?void 0:b.frameRate)||0;const{audioPreference:S,videoPreference:P}=v,I=this.audioTracksByGroup||(this.audioTracksByGroup=Y1(p));if(A){if(this.firstSelection!==-1)return this.firstSelection;const Y=this.codecTiers||(this.codecTiers=q1(m,I,t,r)),X=W1(Y,C,e,S,P),{codecSet:ue,videoRanges:de,minFramerate:K,minBitrate:H,preferHDR:ne}=X;_=ue,C=ne?de[de.length-1]:de[0],x=K,e=Math.max(e,H),R.log(`[abr] picked start tier ${JSON.stringify(X)}`)}else _=b==null?void 0:b.codecSet,C=b==null?void 0:b.videoRange;const M=f?f.duration:h?h.duration:0,$=this.bwEstimator.getEstimateTTFB()/1e3,F=[];for(let Y=r;Y>=t;Y--){var Q;const X=m[Y],ue=Y>c;if(!X)continue;if(v.useMediaCapabilities&&!X.supportedResult&&!X.supportedPromise){const Be=navigator.mediaCapabilities;typeof(Be==null?void 0:Be.decodingInfo)=="function"&&B1(X,I,C,x,e,S)?(X.supportedPromise=H1(X,I,Be),X.supportedPromise.then(He=>{if(!this.hls)return;X.supportedResult=He;const je=this.hls.levels,_t=je.indexOf(X);He.error?R.warn(`[abr] MediaCapabilities decodingInfo error: "${He.error}" for level ${_t} ${JSON.stringify(He)}`):He.supported||(R.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${_t} ${JSON.stringify(He)}`),_t>-1&&je.length>1&&(R.log(`[abr] Removing unsupported level ${_t}`),this.hls.removeLevel(_t)))})):X.supportedResult=nv}if(_&&X.codecSet!==_||C&&X.videoRange!==C||ue&&x>X.frameRate||!ue&&x>0&&x<X.frameRate||X.supportedResult&&!((Q=X.supportedResult.decodingInfoResults)!=null&&Q[0].smooth)){F.push(Y);continue}const de=X.details,K=(f?de==null?void 0:de.partTarget:de==null?void 0:de.averagetargetduration)||M;let H;ue?H=o*e:H=a*e;
vendor: 49,188 bytes, line 29
29const ne=M&&s>=M*2&&n===0?m[Y].averageBitrate:m[Y].maxBitrate,oe=this.getTimeToLoadFrag($,H,ne*K,de===void 0);if(H>=ne&&(Y===u||X.loadError===0&&X.fragmentError===0)&&(oe<=$||!q(oe)||y&&!this.bitrateTestDelay||oe<d)){const Be=this.forcedAutoLevel;return Y!==g&&(Be===-1||Be!==g)&&(F.length&&R.trace(`[abr] Skipped level(s) ${F.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${m[F[0]].codecs}" ${m[F[0]].videoRange}; not compatible with "${b.codecs}" ${C}`),R.info(`[abr] switch candidate:${c}->${Y} adjustedbw(${Math.round(H)})-bitrate=${Math.round(H-ne)} ttfb:${$.toFixed(1)} avgDuration:${K.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${oe.toFixed(1)} firstSelection:${A} codecSet:${_} videoRange:${C} hls.loadLevel:${g}`)),A&&(this.firstSelection=Y),Y}}return-1}set nextAutoLevel(e){const{maxAutoLevel:t,minAutoLevel:r}=this.hls,s=Math.min(Math.max(e,r),t);this._nextAutoLevel!==s&&(this.nextAutoLevelKey="",this._nextAutoLevel=s)}}class Q1{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var ht={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class Z1{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.BUFFER_APPENDED,this.onBufferAppended,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.BUFFER_APPENDED,this.onBufferAppended,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){const r=this.activePartLists[t];if(r)for(let s=r.length;s--;){const n=r[s];if(!n)break;const a=n.end;if(n.start<=e&&a!==null&&e<=a)return n}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){const{fragments:r}=this,s=Object.keys(r);for(let n=s.length;n--;){const a=r[s[n]];if((a==null?void 0:a.body.type)===t&&a.buffered){const o=a.body;if(o.start<=e&&e<=o.end)return o}}return null}detectEvictedFragments(e,t,r,s){this.timeRanges&&(this.timeRanges[e]=t);const n=(s==null?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o||n>=o.body.sn)return;if(!o.buffered&&!o.loaded){o.body.type===r&&this.removeFragment(o.body);return}const l=o.range[e];l&&l.time.some(d=>{const u=!this.isTimeBuffered(d.startPTS,d.endPTS,t);return u&&this.removeFragment(o.body),u})})}detectPartialFragments(e){const t=this.timeRanges,{frag:r,part:s}=e;if(!t||r.sn==="initSegment")return;const n=ks(r),a=this.fragments[n];if(!a||a.buffered&&r.gap)return;const o=!r.relurl;Object.keys(t).forEach(l=>{const d=r.elementaryStreams[l];if(!d)return;const u=t[l],c=o||d.partial===!0;a.range[l]=this.getBufferedTimes(r,s,c,u)}),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=r.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),co(a)||this.removeParts(r.sn-1,r.type)):this.removeFragment(a.body)}removeParts(e,t){const r=this.activePartLists[t];r&&(this.activePartLists[t]=r.filter(s=>s.fragment.sn>=e))}fragBuffered(e,t){const r=ks(e);let s=this.fragments[r];!s&&t&&(s=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,s.buffered=!0)}getBufferedTimes(e,t,r,s){const n={time:[],partial:r},a=e.start,o=e.end,l=e.minEndPTS||o,d=e.maxStartPTS||a;for(let u=0;u<s.length;u++){const c=s.start(u)-this.bufferPadding,h=s.end(u)+this.bufferPadding;if(d>=c&&l<=h){n.time.push({startPTS:Math.max(a,s.start(u)),endPTS:Math.min(o,s.end(u))});break}else if(a<h&&o>c){const f=Math.max(a,s.start(u)),m=Math.min(o,s.end(u));m>f&&(n.partial=!0,n.time.push({startPTS:f,endPTS:m}))}else if(o<=c)break}return n}getPartialFragment(e){let t=null,r,s,n,a=0;const{bufferPadding:o,fragments:l}=this;return Object.keys(l).forEach(d=>{const u=l[d];u&&co(u)&&(s=u.body.start-o,n=u.body.end+o,e>=s&&e<=n&&(r=Math.min(e-s,n-e),a<=r&&(t=u.body,a=r)))}),t}isEndListAppended(e){const t=this.endListFragments[e];return t!==void 0&&(t.buffered||co(t))}getState(e){const t=ks(e),r=this.fragments[t];return r?r.buffered?co(r)?ht.PARTIAL:ht.OK:ht.APPENDING:ht.NOT_LOADED}isTimeBuffered(e,t,r){let s,n;for(let a=0;a<r.length;a++){if(s=r.start(a)-this.bufferPadding,n=r.end(a)+this.bufferPadding,e>=s&&t<=n)return!0;if(t<=s)return!1}return!1}onFragLoaded(e,t){const{frag:r,part:s}=t;if(r.sn==="initSegment"||r.bitrateTest)return;const n=s?null:t,a=ks(r);this.fragments[a]={body:r,appendedPTS:null,loaded:n,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){const{frag:r,part:s,timeRanges:n}=t;if(r.sn==="initSegment")return;const a=r.type;if(s){let o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(s)}this.timeRanges=n,Object.keys(n).forEach(o=>{const l=n[o];this.detectEvictedFragments(o,l,a,s)})}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){const t=ks(e);return!!this.fragments[t]}hasParts(e){var t;return!!((t=this.activePartLists[e])!=null&&t.length)}removeFragmentsInRange(e,t,r,s,n){s&&!this.hasGaps||Object.keys(this.fragments).forEach(a=>{const o=this.fragments[a];if(!o)return;const l=o.body;l.type!==r||s&&!l.gap||l.start<t&&l.end>e&&(o.buffered||n)&&this.removeFragment(l)})}removeFragment(e){const t=ks(e);e.stats.loaded=0,e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const s=e.sn;this.activePartLists[e.type]=r.filter(n=>n.fragment.sn!==s)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function co(i){var e,t,r;return i.buffered&&(i.body.gap||((e=i.range.video)==null?void 0:e.partial)||((t=i.range.audio)==null?void 0:t.partial)||((r=i.range.audiovideo)==null?void 0:r.partial))}function ks(i){return`${i.type}_${i.level}_${i.sn}`}const J1={length:0,start:()=>0,end:()=>0};class Pe{static isBuffered(e,t){try{if(e){const r=Pe.getBuffered(e);for(let s=0;s<r.length;s++)if(t>=r.start(s)&&t<=r.end(s))return!0}}catch{}return!1}static bufferInfo(e,t,r){try{if(e){const s=Pe.getBuffered(e),n=[];let a;for(a=0;a<s.length;a++)n.push({start:s.start(a),end:s.end(a)});return this.bufferedInfo(n,t,r)}}catch{}return{len:0,start:t,end:t,nextStart:void 0}}static bufferedInfo(e,t,r){t=Math.max(0,t),e.sort(function(d,u){const c=d.start-u.start;return c||u.end-d.end});let s=[];if(r)for(let d=0;d<e.length;d++){const u=s.length;if(u){const c=s[u-1].end;e[d].start-c<r?e[d].end>c&&(s[u-1].end=e[d].end):s.push(e[d])}else s.push(e[d])}else s=e;let n=0,a,o=t,l=t;for(let d=0;d<s.length;d++){const u=s[d].start,c=s[d].end;if(t+r>=u&&t<c)o=u,l=c,n=l-t;else if(t+r<u){a=u;break}}return{len:n,start:o||0,end:l||0,nextStart:a}}static getBuffered(e){try{return e.buffered}catch(t){return R.log("failed to get media.buffered",t),J1}}}class Xh{constructor(e,t,r,s=0,n=-1,a=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=ho(),this.buffering={audio:ho(),video:ho(),audiovideo:ho()},this.level=e,this.sn=t,this.id=r,this.size=s,this.part=n,this.partial=a}}function ho(){return{start:0,executeStart:0,executeEnd:0,end:0}}function $o(i,e){for(let r=0,s=i.length;r<s;r++){var t;if(((t=i[r])==null?void 0:t.cc)===e)return i[r]}return null}function eS(i,e,t){return!!(e&&(t.endCC>t.startCC||i&&i.cc<t.startCC))}function tS(i,e){const t=i.fragments,r=e.fragments;if(!r.length||!t.length){R.log("No fragments to align");return}const s=$o(t,r[0].cc);if(!s||s&&!s.startPTS){R.log("No frag in previous level to align on");return}return s}function gp(i,e){if(i){const t=i.start+e;i.start=i.startPTS=t,i.endPTS=t+i.duration}}function av(i,e){const t=e.fragments;for(let r=0,s=t.length;r<s;r++)gp(t[r],i);e.fragmentHint&&gp(e.fragmentHint,i),e.alignedSliding=!0}function iS(i,e,t){e&&(rS(i,t,e),!t.alignedSliding&&e&&ld(t,e),!t.alignedSliding&&e&&!t.skippedSegments&&tv(e,t))}function rS(i,e,t){if(eS(i,t,e)){const r=tS(t,e);r&&q(r.start)&&(R.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),av(r.start,e))}}function ld(i,e){if(!i.hasProgramDateTime||!e.hasProgramDateTime)return;const t=i.fragments,r=e.fragments;if(!t.length||!r.length)return;let s,n;const a=Math.min(e.endCC,i.endCC);e.startCC<a&&i.startCC<a&&(s=$o(r,a),n=$o(t,a)),(!s||!n)&&(s=r[Math.floor(r.length/2)],n=$o(t,s.cc)||t[Math.floor(t.length/2)]);const o=s.programDateTime,l=n.programDateTime;if(!o||!l)return;const d=(l-o)/1e3-(n.start-s.start);av(d,i)}const vp=Math.pow(2,17);class sS{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t){const r=e.url;if(!r)return Promise.reject(new Vi({type:re.NETWORK_ERROR,details:O.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${r?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(f=>f[0]==="GAP")){l(yp(e));return}else e.gap=!1;const d=this.loader=e.loader=n?new n(s):new a(s),u=Ep(e),c=fp(s.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:vp};e.stats=d.stats,d.load(u,h,{onSuccess:(f,m,p,g)=>{this.resetLoader(e,d);let v=f.data;p.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(v.slice(0,16)),v=v.slice(16)),o({frag:e,part:null,payload:v,networkDetails:g})},onError:(f,m,p,g)=>{this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:ft({url:r,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:g}))},onAbort:(f,m,p)=>{this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:p,stats:f}))},onTimeout:(f,m,p)=>{this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:p,stats:f}))},onProgress:(f,m,p,g)=>{t&&t({frag:e,part:null,payload:p,networkDetails:g})}})})}loadPart(e,t,r){this.abort();const s=this.config,n=s.fLoader,a=s.loader;return new Promise((o,l)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap){l(yp(e,t));return}const d=this.loader=e.loader=n?new n(s):new a(s),u=Ep(e,t),c=fp(s.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:vp};t.stats=d.stats,d.load(u,h,{onSuccess:(f,m,p,g)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,t);const v={frag:e,part:t,payload:f.data,networkDetails:g};r(v),o(v)},onError:(f,m,p,g)=>{this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:ft({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:p,stats:g}))},onAbort:(f,m,p)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:new Error("Aborted"),networkDetails:p,stats:f}))},onTimeout:(f,m,p)=>{this.resetLoader(e,d),l(new Vi({type:re.NETWORK_ERROR,details:O.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:p,stats:f}))}})})}updateStatsFromPart(e,t){const r=e.stats,s=t.stats,n=s.total;if(r.loaded+=s.loaded,n){const l=Math.round(e.duration/t.duration),d=Math.min(Math.round(r.loaded/n),l),c=(l-d)*Math.round(r.loaded/d);r.total=r.loaded+c}else r.total=Math.max(r.loaded,r.total);const a=r.loading,o=s.loading;a.start?a.first+=o.first-o.start:(a.start=o.start,a.first=o.first),a.end=o.end}resetLoader(e,t){e.loader=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}}function Ep(i,e=null){const t=e||i,r={frag:i,part:e,responseType:"arraybuffer",url:t.url,headers:{},rangeStart:0,rangeEnd:0},s=t.byteRangeStartOffset,n=t.byteRangeEndOffset;if(q(s)&&q(n)){var a;let o=s,l=n;if(i.sn==="initSegment"&&((a=i.decryptdata)==null?void 0:a.method)==="AES-128"){const d=n-s;d%16&&(l=n+(16-d%16)),s!==0&&(r.resetIV=!0,o=s-16)}r.rangeStart=o,r.rangeEnd=l}return r}function yp(i,e){const t=new Error(`GAP ${i.gap?"tag":"attribute"} found`),r={type:re.MEDIA_ERROR,details:O.FRAG_GAP,fatal:!1,frag:i,error:t,networkDetails:null};return e&&(r.part=e),(e||i).stats.aborted=!0,new Vi(r)}class Vi extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class nS{constructor(e,t){this.subtle=void 0,this.aesIV=void 0,this.subtle=e,this.aesIV=t}decrypt(e,t){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e)}}class aS{constructor(e,t){this.subtle=void 0,this.key=void 0,this.subtle=e,this.key=t}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}function oS(i){const e=i.byteLength,t=e&&new DataView(i.buffer).getUint8(e-1);return t?ms(i,0,e-t):i}class lS{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const t=new DataView(e),r=new Uint32Array(4);for(let s=0;s<4;s++)r[s]=t.getUint32(s*4);return r}initTable(){const e=this.sBox,t=this.invSBox,r=this.subMix,s=r[0],n=r[1],a=r[2],o=r[3],l=this.invSubMix,d=l[0],u=l[1],c=l[2],h=l[3],f=new Uint32Array(256);let m=0,p=0,g=0;for(g=0;g<256;g++)g<128?f[g]=g<<1:f[g]=g<<1^283;for(g=0;g<256;g++){let v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^v&255^99,e[m]=v,t[v]=m;const b=f[m],y=f[b],A=f[y];let _=f[v]*257^v*16843008;s[m]=_<<24|_>>>8,n[m]=_<<16|_>>>16,a[m]=_<<8|_>>>24,o[m]=_,_=A*16843009^y*65537^b*257^m*16843008,d[v]=_<<24|_>>>8,u[v]=_<<16|_>>>16,c[v]=_<<8|_>>>24,h[v]=_,m?(m=b^f[f[f[A^b]]],p^=f[f[p]]):m=p=1}}expandKey(e){const t=this.uint8ArrayToUint32Array_(e);let r=!0,s=0;for(;s<t.length&&r;)r=t[s]===this.key[s],s++;if(r)return;this.key=t;const n=this.keySize=t.length;if(n!==4&&n!==6&&n!==8)throw new Error("Invalid aes key size="+n);const a=this.ksRows=(n+6+1)*4;let o,l;const d=this.keySchedule=new Uint32Array(a),u=this.invKeySchedule=new Uint32Array(a),c=this.sBox,h=this.rcon,f=this.invSubMix,m=f[0],p=f[1],g=f[2],v=f[3];let b,y;for(o=0;o<a;o++){if(o<n){b=d[o]=t[o];continue}y=b,o%n===0?(y=y<<8|y>>>24,y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[y&255],y^=h[o/n|0]<<24):n>6&&o%n===4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[y&255]),d[o]=b=(d[o-n]^y)>>>0}for(l=0;l<a;l++)o=a-l,l&3?y=d[o]:y=d[o-4],l<4||o<=4?u[l]=y:u[l]=m[c[y>>>24]]^p[c[y>>>16&255]]^g[c[y>>>8&255]]^v[c[y&255]],u[l]=u[l]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,t,r){const s=this.keySize+6,n=this.invKeySchedule,a=this.invSBox,o=this.invSubMix,l=o[0],d=o[1],u=o[2],c=o[3],h=this.uint8ArrayToUint32Array_(r);let f=h[0],m=h[1],p=h[2],g=h[3];const v=new Int32Array(e),b=new Int32Array(v.length);let y,A,_,C,x,S,P,I,M,$,F,Q,Y,X;const ue=this.networkToHostOrderSwap;for(;t<v.length;){for(M=ue(v[t]),$=ue(v[t+1]),F=ue(v[t+2]),Q=ue(v[t+3]),x=M^n[0],S=Q^n[1],P=F^n[2],I=$^n[3],Y=4,X=1;X<s;X++)y=l[x>>>24]^d[S>>16&255]^u[P>>8&255]^c[I&255]^n[Y],A=l[S>>>24]^d[P>>16&255]^u[I>>8&255]^c[x&255]^n[Y+1],_=l[P>>>24]^d[I>>16&255]^u[x>>8&255]^c[S&255]^n[Y+2],C=l[I>>>24]^d[x>>16&255]^u[S>>8&255]^c[P&255]^n[Y+3],x=y,S=A,P=_,I=C,Y=Y+4;y=a[x>>>24]<<24^a[S>>16&255]<<16^a[P>>8&255]<<8^a[I&255]^n[Y],A=a[S>>>24]<<24^a[P>>16&255]<<16^a[I>>8&255]<<8^a[x&255]^n[Y+1],_=a[P>>>24]<<24^a[I>>16&255]<<16^a[x>>8&255]<<8^a[S&255]^n[Y+2],C=a[I>>>24]<<24^a[x>>16&255]<<16^a[S>>8&255]<<8^a[P&255]^n[Y+3],b[t]=ue(y^f),b[t+1]=ue(C^m),b[t+2]=ue(_^p),b[t+3]=ue(A^g),f=M,m=$,p=F,g=Q,t=t+4}return b.buffer}}const dS=16;class Qh{constructor(e,{removePKCS7Padding:t=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.useSoftware=e.enableSoftwareAES,this.removePKCS7Padding=t,t)try{const r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;const r=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?oS(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,r){return this.useSoftware?new Promise((s,n)=>{this.softwareDecrypt(new Uint8Array(e),t,r);const a=this.flush();a?s(a.buffer):n(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),t,r)}softwareDecrypt(e,t,r){const{currentIV:s,currentResult:n,remainderData:a}=this;this.logOnce("JS AES decrypt"),a&&(e=Wt(a,e),this.remainderData=null);const o=this.getValidChunk(e);if(!o.length)return null;s&&(r=s);let l=this.softwareDecrypter;l||(l=this.softwareDecrypter=new lS),l.expandKey(t);const d=n;return this.currentResult=l.decrypt(o.buffer,0,r),this.currentIV=ms(o,-16).buffer,d||null}webCryptoDecrypt(e,t,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,r));this.key=t,this.fastAesKey=new aS(this.subtle,t)}return this.fastAesKey.expandKey().then(s=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new nS(this.subtle,new Uint8Array(r)).decrypt(e.buffer,s)):Promise.reject(new Error("web crypto not initialized"))).catch(s=>(R.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${s.name}: ${s.message}`),this.onWebCryptoError(e,t,r)))}onWebCryptoError(e,t,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,r);const s=this.flush();if(s)return s.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(e){let t=e;const r=e.length-e.length%dS;return r!==e.length&&(t=ms(e,0,r),this.remainderData=ms(e,r)),t}logOnce(e){this.logEnabled&&(R.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const uS={toString:function(i){let e="";const t=i.length;for(let r=0;r<t;r++)e+=`[${i.start(r).toFixed(3)}-${i.end(r).toFixed(3)}]`;return e}},N={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class Zh extends Q1{constructor(e,t,r,s,n){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=N.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=n,this.logPrefix=s,this.log=R.log.bind(R,`${s}:`),this.warn=R.warn.bind(R,`${s}:`),this.hls=e,this.fragmentLoader=new sS(e.config),this.keyLoader=r,this.fragmentTracker=t,this.config=e.config,this.decrypter=new Qh(e.config),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=N.STOPPED}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}_streamEnded(e,t){if(t.live||e.nextStart||!e.end||!this.media)return!1;const r=t.partList;if(r!=null&&r.length){const n=r[r.length-1];return Pe.isBuffered(this.media,n.start+n.duration/2)}const s=t.fragments[t.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(s)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null){var e;return(e=this.levelLastLoaded)==null?void 0:e.details}}onMediaAttached(e,t){const r=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),r.addEventListener("seeking",this.onvseeking),r.addEventListener("ended",this.onvended);const s=this.config;this.levels&&s.autoStartLoad&&this.state===N.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(){const e=this.media;e!=null&&e.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),e&&this.onvseeking&&this.onvended&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.keyLoader&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}onMediaSeeking(){const{config:e,fragCurrent:t,media:r,mediaBuffer:s,state:n}=this,a=r?r.currentTime:0,o=Pe.bufferInfo(s||r,a,e.maxBufferHole);if(this.log(`media seeking to ${q(a)?a.toFixed(3):a}, state: ${n}`),this.state===N.ENDED)this.resetLoadingState();else if(t){const l=e.maxFragLookUpTolerance,d=t.start-l,u=t.start+t.duration+l;if(!o.len||u<o.start||d>o.end){const c=a>u;(a<d||c)&&(c&&t.loader&&(this.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),t.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}r&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),this.lastCurrentTime=a),!this.loadedmetadata&&!o.len&&(this.nextLoadPosition=this.startPosition=a),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=N.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,r){this._loadFragForPlayback(e,t,r)}_loadFragForPlayback(e,t,r){const s=n=>{if(this.fragContextChanged(e)){this.warn(`Fragment ${e.sn}${n.part?" p: "+n.part.index:""} of level ${e.level} was dropped during download.`),this.fragmentTracker.removeFragment(e);return}e.stats.chunkCount++,this._handleFragmentLoadProgress(n)};this._doFragLoad(e,t,r,s).then(n=>{if(!n)return;const a=this.state;if(this.fragContextChanged(e)){(a===N.FRAG_LOADING||!this.fragCurrent&&a===N.PARSING)&&(this.fragmentTracker.removeFragment(e),this.state=N.IDLE);return}"payload"in n&&(this.log(`Loaded fragment ${e.sn} of level ${e.level}`),this.hls.trigger(E.FRAG_LOADED,n)),this._handleFragmentLoadComplete(n)}).catch(n=>{this.state===N.STOPPED||this.state===N.ERROR||(this.warn(`Frag error: ${(n==null?void 0:n.message)||n}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;const{fragmentTracker:r}=this;if(r.getState(e)===ht.APPENDING){const n=e.type,a=this.getFwdBufferInfo(this.mediaBuffer,n),o=Math.max(e.duration,a?a.len:this.config.maxBufferLength),l=this.backtrackFragment;((l?e.sn-l.sn:0)===1||this.reduceMaxBufferLength(o,e.duration))&&r.removeFragment(e)}else((t=this.mediaBuffer)==null?void 0:t.buffered.length)===0?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===ht.PARTIAL&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const t=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:t,part:null,stats:t.stats,id:t.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}flushMainBuffer(e,t,r=null){if(!(e-t))return;const s={startOffset:e,endOffset:t,type:r};this.hls.trigger(E.BUFFER_FLUSHING,s)}_loadInitSegment(e,t){this._doFragLoad(e,t).then(r=>{if(!r||this.fragContextChanged(e)||!this.levels)throw new Error("init load aborted");return r}).then(r=>{const{hls:s}=this,{payload:n}=r,a=e.decryptdata;if(n&&n.byteLength>0&&a!=null&&a.key&&a.iv&&a.method==="AES-128"){const o=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).catch(l=>{throw s.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:e}),l}).then(l=>{const d=self.performance.now();return s.trigger(E.FRAG_DECRYPTED,{frag:e,payload:l,stats:{tstart:o,tdecrypt:d}}),r.payload=l,this.completeInitSegmentLoad(r)})}return this.completeInitSegmentLoad(r)}).catch(r=>{this.state===N.STOPPED||this.state===N.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:t}=this;if(!t)throw new Error("init load aborted, missing levels");const r=e.frag.stats;this.state=N.IDLE,e.frag.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}fragContextChanged(e){const{fragCurrent:t}=this;return!e||!t||e.sn!==t.sn||e.level!==t.level}fragBufferedComplete(e,t){var r,s,n,a;const o=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${t?" part: "+t.index:""} of ${this.playlistType===ie.MAIN?"level":"track"} ${e.level} (frag:[${((r=e.startPTS)!=null?r:NaN).toFixed(3)}-${((s=e.endPTS)!=null?s:NaN).toFixed(3)}] > buffer:${o?uS.toString(Pe.getBuffered(o)):"(detached)"})`),e.sn!=="initSegment"){var l;if(e.type!==ie.SUBTITLE){const u=e.elementaryStreams;if(!Object.keys(u).some(c=>!!u[c])){this.state=N.IDLE;return}}const d=(l=this.levels)==null?void 0:l[e.level];d!=null&&d.fragmentError&&(this.log(`Resetting level fragment error count of ${d.fragmentError} on frag buffered`),d.fragmentError=0)}this.state=N.IDLE,o&&(!this.loadedmetadata&&e.type==ie.MAIN&&o.buffered.length&&((n=this.fragCurrent)==null?void 0:n.sn)===((a=this.fragPrevious)==null?void 0:a.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(e){const{transmuxer:t}=this;if(!t)return;const{frag:r,part:s,partsLoaded:n}=e,a=!n||n.length===0||n.some(l=>!l),o=new Xh(r.level,r.sn,r.stats.chunkCount+1,0,s?s.index:-1,!a);t.flush(o)}_handleFragmentLoadProgress(e){}_doFragLoad(e,t,r=null,s){var n;const a=t==null?void 0:t.details;if(!this.levels||!a)throw new Error(`frag load aborted, missing level${a?"":" detail"}s`);let o=null;if(e.encrypted&&!((n=e.decryptdata)!=null&&n.key)?(this.log(`Loading key for ${e.sn} of [${a.startSN}-${a.endSN}], ${this.logPrefix==="[stream-controller]"?"level":"track"} ${e.level}`),this.state=N.KEY_LOADING,this.fragCurrent=e,o=this.keyLoader.load(e).then(u=>{if(!this.fragContextChanged(u.frag))return this.hls.trigger(E.KEY_LOADED,u),this.state===N.KEY_LOADING&&(this.state=N.IDLE),u}),this.hls.trigger(E.KEY_LOADING,{frag:e}),this.fragCurrent===null&&(o=Promise.reject(new Error("frag load aborted, context changed in KEY_LOADING")))):!e.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(e,a.encryptedFragments),r=Math.max(e.start,r||0),this.config.lowLatencyMode&&e.sn!=="initSegment"){const u=a.partList;if(u&&s){r>e.end&&a.fragmentHint&&(e=a.fragmentHint);const c=this.getNextPart(u,e,r);if(c>-1){const h=u[c];this.log(`Loading part sn: ${e.sn} p: ${h.index} cc: ${e.cc} of playlist [${a.startSN}-${a.endSN}] parts [0-${c}-${u.length-1}] ${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=h.start+h.duration,this.state=N.FRAG_LOADING;let f;return o?f=o.then(m=>!m||this.fragContextChanged(m.frag)?null:this.doFragPartsLoad(e,h,t,s)).catch(m=>this.handleFragLoadError(m)):f=this.doFragPartsLoad(e,h,t,s).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(E.FRAG_LOADING,{frag:e,part:h,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):f}else if(!e.url||this.loadedEndOfParts(u,r))return Promise.resolve(null)}}this.log(`Loading fragment ${e.sn} cc: ${e.cc} ${a?"of ["+a.startSN+"-"+a.endSN+"] ":""}${this.logPrefix==="[stream-controller]"?"level":"track"}: ${e.level}, target: ${parseFloat(r.toFixed(3))}`),q(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=N.FRAG_LOADING;const l=this.config.progressive;let d;return l&&o?d=o.then(u=>!u||this.fragContextChanged(u==null?void 0:u.frag)?null:this.fragmentLoader.load(e,s)).catch(u=>this.handleFragLoadError(u)):d=Promise.all([this.fragmentLoader.load(e,l?s:void 0),o]).then(([u])=>(!l&&u&&s&&s(u),u)).catch(u=>this.handleFragLoadError(u)),this.hls.trigger(E.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d}doFragPartsLoad(e,t,r,s){return new Promise((n,a)=>{var o;const l=[],d=(o=r.details)==null?void 0:o.partList,u=c=>{this.fragmentLoader.loadPart(e,c,s).then(h=>{l[c.index]=h;const f=h.part;this.hls.trigger(E.FRAG_LOADED,h);const m=cp(r,e.sn,c.index+1)||iv(d,e.sn,c.index+1);if(m)u(m);else return n({frag:e,part:f,partsLoaded:l})}).catch(a)};u(t)})}handleFragLoadError(e){if("data"in e){const t=e.data;e.data&&t.details===O.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):this.hls.trigger(E.ERROR,t)}else this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:O.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const t=this.getCurrentContext(e);if(!t||this.state!==N.PARSING){!this.fragCurrent&&this.state!==N.STOPPED&&this.state!==N.ERROR&&(this.state=N.IDLE);return}const{frag:r,part:s,level:n}=t,a=self.performance.now();r.stats.parsing.end=a,s&&(s.stats.parsing.end=a),this.updateLevelTiming(r,s,n,e.partial)}getCurrentContext(e){const{levels:t,fragCurrent:r}=this,{level:s,sn:n,part:a}=e;if(!(t!=null&&t[s]))return this.warn(`Levels object was unset while buffering fragment ${n} of level ${s}. The current chunk will not be buffered.`),null;const o=t[s],l=a>-1?cp(o,n,a):null,d=l?l.fragment:C1(o,n,r);return d?(r&&r!==d&&(d.stats=r.stats),{frag:d,part:l,level:o}):null}bufferFragmentData(e,t,r,s,n){var a;if(!e||this.state!==N.PARSING)return;const{data1:o,data2:l}=e;let d=o;if(o&&l&&(d=Wt(o,l)),!((a=d)!=null&&a.length))return;const u={type:e.type,frag:t,part:r,chunkMeta:s,parent:t.type,data:d};if(this.hls.trigger(E.BUFFER_APPENDING,u),e.dropped&&e.independent&&!r){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){const t=this.media;if(!t)return;if(!Pe.isBuffered(t,t.currentTime)){this.flushMainBuffer(0,e.start);return}const r=t.currentTime,s=Pe.bufferInfo(t,r,0),n=e.duration,a=Math.min(this.config.maxFragLookUpTolerance*2,n*.25),o=Math.max(Math.min(e.start-a,s.end-a),r+a);e.start-o>a&&this.flushMainBuffer(o,e.start)}getFwdBufferInfo(e,t){const r=this.getLoadPosition();return q(r)?this.getFwdBufferInfoAtPos(e,r,t):null}getFwdBufferInfoAtPos(e,t,r){const{config:{maxBufferHole:s}}=this,n=Pe.bufferInfo(e,t,s);if(n.len===0&&n.nextStart!==void 0){const a=this.fragmentTracker.getBufferedFrag(t,r);if(a&&n.nextStart<a.end)return Pe.bufferInfo(e,t,Math.max(n.nextStart,s))}return n}getMaxBufferLength(e){const{config:t}=this;let r;return e?r=Math.max(8*t.maxBufferSize/e,t.maxBufferLength):r=t.maxBufferLength,Math.min(r,t.maxMaxBufferLength)}reduceMaxBufferLength(e,t){const r=this.config,s=Math.max(Math.min(e-t,r.maxBufferLength),t),n=Math.max(e-t*3,r.maxMaxBufferLength/2,s);return n>=s?(r.maxMaxBufferLength=n,this.warn(`Reduce max buffer length to ${n}s`),!0):!1}getAppendedFrag(e,t=ie.MAIN){const r=this.fragmentTracker.getAppendedFrag(e,ie.MAIN);return r&&"fragment"in r?r.fragment:r}getNextFragment(e,t){const r=t.fragments,s=r.length;if(!s)return null;const{config:n}=this,a=r[0].start;let o;if(t.live){const l=n.initialLiveManifestSize;if(s<l)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${l})`),null;(!t.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<a)&&(o=this.getInitialLiveFragment(t,r),this.startPosition=this.nextLoadPosition=o?this.hls.liveSyncPosition||o.start:e)}else e<=a&&(o=r[0]);if(!o){const l=n.lowLatencyMode?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,l,t)}return this.mapToInitFragWhenRequired(o)}isLoopLoading(e,t){const r=this.fragmentTracker.getState(e);return(r===ht.OK||r===ht.PARTIAL&&!!e.gap)&&this.nextLoadPosition>t}getNextFragmentLoopLoading(e,t,r,s,n){const a=e.gap,o=this.getNextFragment(this.nextLoadPosition,t);if(o===null)return o;if(e=o,a&&e&&!e.gap&&r.nextStart){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,s);if(l!==null&&r.len+l.len>=n)return this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${e.sn}`),null}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!(e!=null&&e.initSegment.data)&&!this.bitrateTest?e.initSegment:e}getNextPart(e,t,r){let s=-1,n=!1,a=!0;for(let o=0,l=e.length;o<l;o++){const d=e[o];if(a=a&&!d.independent,s>-1&&r<d.start)break;const u=d.loaded;u?s=-1:(n||d.independent||a)&&d.fragment===t&&(s=o),n=u}return s}loadedEndOfParts(e,t){const r=e[e.length-1];return r&&t>r.start&&r.loaded}getInitialLiveFragment(e,t){const r=this.fragPrevious;let s=null;if(r){if(e.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),s=O1(t,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!s){const n=r.sn+1;if(n>=e.startSN&&n<=e.endSN){const a=t[n-e.startSN];r.cc===a.cc&&(s=a,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=U1(t,r.cc),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const n=this.hls.liveSyncPosition;n!==null&&(s=this.getFragmentAtPosition(n,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,t,r){const{config:s}=this;let{fragPrevious:n}=this,{fragments:a,endSN:o}=r;const{fragmentHint:l}=r,{maxFragLookUpTolerance:d}=s,u=r.partList,c=!!(s.lowLatencyMode&&u!=null&&u.length&&l);c&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn);let h;if(e<t){const f=e>t-d?0:d;h=od(n,a,e,f)}else h=a[a.length-1];if(h){const f=h.sn-r.startSN,m=this.fragmentTracker.getState(h);if((m===ht.OK||m===ht.PARTIAL&&h.gap)&&(n=h),n&&h.sn===n.sn&&(!c||u[0].fragment.sn>h.sn)&&n&&h.level===n.level){const g=a[f+1];h.sn<o&&this.fragmentTracker.getState(g)!==ht.OK?h=g:h=null}}return h}synchronizeToLiveEdge(e){const{config:t,media:r}=this;if(!r)return;const s=this.hls.liveSyncPosition,n=r.currentTime,a=e.fragments[0].start,o=e.edge,l=n>=a-t.maxFragLookUpTolerance&&n<=o;if(s!==null&&r.duration>s&&(n<s||!l)){const d=t.liveMaxLatencyDuration!==void 0?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;(!l&&r.readyState<4||n<o-d)&&(this.loadedmetadata||(this.nextLoadPosition=s),r.readyState&&(this.warn(`Playback: ${n.toFixed(3)} is located too far from the end of live sliding playlist: ${o}, reset currentTime to : ${s.toFixed(3)}`),r.currentTime=s))}}alignPlaylists(e,t,r){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const n=e.fragments[0].start,a=!t,o=e.alignedSliding&&q(n);if(a||!o&&!n){const{fragPrevious:l}=this;iS(l,r,e);const d=e.fragments[0].start;return this.log(`Live playlist sliding: ${d.toFixed(2)} start-sn: ${t?t.startSN:"na"}->${e.startSN} prev-sn: ${l?l.sn:"na"} fragments: ${s}`),d}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,t){let r=this.startPosition;if(r<t&&(r=-1),r===-1||this.lastCurrentTime===-1){const s=this.startTimeOffset!==null,n=s?this.startTimeOffset:e.startTimeOffset;n!==null&&q(n)?(r=t+n,n<0&&(r+=e.totalduration),r=Math.min(Math.max(t,r),t+e.totalduration),this.log(`Start time offset ${n} found in ${s?"multivariant":"media"} playlist, adjust startPosition to ${r}`),this.startPosition=r):e.live?r=this.hls.liveSyncPosition||t:this.startPosition=r=0,this.lastCurrentTime=r}this.nextLoadPosition=r}getLoadPosition(){const{media:e}=this;let t=0;return this.loadedmetadata&&e?t=e.currentTime:this.nextLoadPosition&&(t=this.nextLoadPosition),t}handleFragLoadAborted(e,t){this.transmuxer&&e.sn!=="initSegment"&&e.stats.aborted&&(this.warn(`Fragment ${e.sn}${t?" part "+t.index:""} of level ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==N.FRAG_LOADING_WAITING_RETRY)&&(this.state=N.IDLE)}onFragmentOrKeyLoadError(e,t){if(t.chunkMeta&&!t.frag){const u=this.getCurrentContext(t.chunkMeta);u&&(t.frag=u.frag)}const r=t.frag;if(!r||r.type!==e||!this.levels)return;if(this.fragContextChanged(r)){var s;this.warn(`Frag load error must match current frag to retry ${r.url} > ${(s=this.fragCurrent)==null?void 0:s.url}`);return}const n=t.details===O.FRAG_GAP;n&&this.fragmentTracker.fragBuffered(r,!0);const a=t.errorAction,{action:o,retryCount:l=0,retryConfig:d}=a||{};if(a&&o===vt.RetryRequest&&d){this.resetStartWhenNotLoaded(this.levelLastLoaded);const u=jh(d,l);this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${t.details}, retrying loading ${l+1}/${d.maxNumRetry} in ${u}ms`),a.resolved=!0,this.retryDate=self.performance.now()+u,this.state=N.FRAG_LOADING_WAITING_RETRY}else if(d&&a)if(this.resetFragmentErrors(e),l<d.maxNumRetry)!n&&o!==vt.RemoveAlternatePermanently&&(a.resolved=!0);else{R.warn(`${t.details} reached or exceeded max retry (${l})`);return}else(a==null?void 0:a.action)===vt.SendAlternateToPenaltyBox?this.state=N.WAITING_LEVEL:this.state=N.ERROR;this.tickImmediate()}reduceLengthAndFlushBuffer(e){if(this.state===N.PARSING||this.state===N.PARSED){const t=e.frag,r=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,r),n=s&&s.len>.5;n&&this.reduceMaxBufferLength(s.len,(t==null?void 0:t.duration)||10);const a=!n;return a&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${r} buffer`),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===ie.AUDIO&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==N.STOPPED&&(this.state=N.IDLE)}afterBufferFlushed(e,t,r){if(!e)return;const s=Pe.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,s,r),this.state===N.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=N.IDLE}resetStartWhenNotLoaded(e){if(!this.loadedmetadata){this.startFragRequested=!1;const t=e?e.details:null;t!=null&&t.live?(this.startPosition=-1,this.setStartPosition(t,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.warn(`The loading context changed while buffering fragment ${e.sn} of level ${e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,r,s){var n;const a=r.details;if(!a){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((l,d)=>{const u=e.elementaryStreams[d];if(u){const c=u.endPTS-u.startPTS;if(c<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${c})`),l||!1;const h=s?0:ev(a,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS);return this.hls.trigger(E.LEVEL_PTS_UPDATED,{details:a,level:r,drift:h,type:d,frag:e,start:u.startPTS,end:u.endPTS}),!0}return l},!1)&&((n=this.transmuxer)==null?void 0:n.error)===null){const l=new Error(`Found no media in fragment ${e.sn} of level ${e.level} resetting transmuxer to fallback to playlist timing`);if(r.fragmentError===0&&(r.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)),this.warn(l.message),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_PARSING_ERROR,fatal:!1,error:l,frag:e,reason:`Found no media in msn ${e.sn} of level "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=N.PARSED,this.hls.trigger(E.FRAG_PARSED,{frag:e,part:t})}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(e){const t=this._state;t!==e&&(this._state=e,this.log(`${t}->${e}`))}get state(){return this._state}}class ov{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:t}=this;let r;if(e.length)e.length===1?r=e[0]:r=cS(e,t);else return new Uint8Array(0);return this.reset(),r}reset(){this.chunks.length=0,this.dataLength=0}}function cS(i,e){const t=new Uint8Array(e);let r=0;for(let s=0;s<i.length;s++){const n=i[s];t.set(n,r),r+=n.length}return t}function hS(){return typeof __HLS_WORKER_BUNDLE__=="function"}function fS(){const i=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(i);return{worker:new self.Worker(e),objectURL:e}}function mS(i){const e=new self.URL(i,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}function _i(i="",e=9e4){return{type:i,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class Jh{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,t,r,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,r){}demux(e,t){this.cachedData&&(e=Wt(this.cachedData,e),this.cachedData=null);let r=Pa(e,0),s=r?r.length:0,n;const a=this._audioTrack,o=this._id3Track,l=r?qh(r):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&q(l))&&(this.basePTS=pS(l,t,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:si.audioId3,duration:Number.POSITIVE_INFINITY});s<d;){if(this.canParse(e,s)){const u=this.appendFrame(a,e,s);u?(this.frameIndex++,this.lastPTS=u.sample.pts,s+=u.length,n=s):s=d}else NA(e,s)?(r=Pa(e,s),o.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:si.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,n=s):s++;if(s===d&&n!==d){const u=ms(e,n);this.cachedData?this.cachedData=Wt(this.cachedData,u):this.cachedData=u}}return{audioTrack:a,videoTrack:_i(),id3Track:o,textTrack:_i()}}demuxSampleAes(e,t,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:_i(),id3Track:this._id3Track,textTrack:_i()}}destroy(){}}const pS=(i,e,t)=>{if(q(i))return i*90;const r=t?t.baseTime*9e4/t.timescale:0;return e*9e4+r};function gS(i,e,t,r){let s,n,a,o;const l=navigator.userAgent.toLowerCase(),d=r,u=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];s=((e[t+2]&192)>>>6)+1;const c=(e[t+2]&60)>>>2;if(c>u.length-1){const h=new Error(`invalid ADTS sampling index:${c}`);i.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_PARSING_ERROR,fatal:!0,error:h,reason:h.message});return}return a=(e[t+2]&1)<<2,a|=(e[t+3]&192)>>>6,R.log(`manifest codec:${r}, ADTS type:${s}, samplingIndex:${c}`),/firefox/i.test(l)?c>=6?(s=5,o=new Array(4),n=c-3):(s=2,o=new Array(2),n=c):l.indexOf("android")!==-1?(s=2,o=new Array(2),n=c):(s=5,o=new Array(4),r&&(r.indexOf("mp4a.40.29")!==-1||r.indexOf("mp4a.40.5")!==-1)||!r&&c>=6?n=c-3:((r&&r.indexOf("mp4a.40.2")!==-1&&(c>=6&&a===1||/vivaldi/i.test(l))||!r&&a===1)&&(s=2,o=new Array(2)),n=c)),o[0]=s<<3,o[0]|=(c&14)>>1,o[1]|=(c&1)<<7,o[1]|=a<<3,s===5&&(o[1]|=(n&14)>>1,o[2]=(n&1)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:u[c],channelCount:a,codec:"mp4a.40."+s,manifestCodec:d}}function lv(i,e){return i[e]===255&&(i[e+1]&246)===240}function dv(i,e){return i[e+1]&1?7:9}function ef(i,e){return(i[e+3]&3)<<11|i[e+4]<<3|(i[e+5]&224)>>>5}function vS(i,e){return e+5<i.length}function dd(i,e){return e+1<i.length&&lv(i,e)}function ES(i,e){return vS(i,e)&&lv(i,e)&&ef(i,e)<=i.length-e}function yS(i,e){if(dd(i,e)){const t=dv(i,e);if(e+t>=i.length)return!1;const r=ef(i,e);if(r<=t)return!1;const s=e+r;return s===i.length||dd(i,s)}return!1}function uv(i,e,t,r,s){if(!i.samplerate){const n=gS(e,t,r,s);if(!n)return;i.config=n.config,i.samplerate=n.samplerate,i.channelCount=n.channelCount,i.codec=n.codec,i.manifestCodec=n.manifestCodec,R.log(`parsed codec:${i.codec}, rate:${n.samplerate}, channels:${n.channelCount}`)}}function cv(i){return 1024*9e4/i}function bS(i,e){const t=dv(i,e);if(e+t<=i.length){const r=ef(i,e)-t;if(r>0)return{headerLength:t,frameLength:r}}}function hv(i,e,t,r,s){const n=cv(i.samplerate),a=r+s*n,o=bS(e,t);let l;if(o){const{frameLength:c,headerLength:h}=o,f=h+c,m=Math.max(0,t+f-e.length);m?(l=new Uint8Array(f-h),l.set(e.subarray(t+h,e.length),0)):l=e.subarray(t+h,t+f);const p={unit:l,pts:a};return m||i.samples.push(p),{sample:p,length:f,missing:m}}const d=e.length-t;return l=new Uint8Array(d),l.set(e.subarray(t,e.length),0),{sample:{unit:l,pts:a},length:d,missing:-1}}let fo=null;const TS=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],_S=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],AS=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],SS=[0,1,1,4];function fv(i,e,t,r,s){if(t+24>e.length)return;const n=mv(e,t);if(n&&t+n.frameLength<=e.length){const a=n.samplesPerFrame*9e4/n.sampleRate,o=r+s*a,l={unit:e.subarray(t,t+n.frameLength),pts:o,dts:o};return i.config=[],i.channelCount=n.channelCount,i.samplerate=n.sampleRate,i.samples.push(l),{sample:l,length:n.frameLength,missing:0}}}function mv(i,e){const t=i[e+1]>>3&3,r=i[e+1]>>1&3,s=i[e+2]>>4&15,n=i[e+2]>>2&3;if(t!==1&&s!==0&&s!==15&&n!==3){const a=i[e+2]>>1&1,o=i[e+3]>>6,l=t===3?3-r:r===3?3:4,d=TS[l*14+s-1]*1e3,c=_S[(t===3?0:t===2?1:2)*3+n],h=o===3?1:2,f=AS[t][r],m=SS[r],p=f*8*m,g=Math.floor(f*d/c+a)*m;if(fo===null){const y=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);fo=y?parseInt(y[1]):0}return!!fo&&fo<=87&&r===2&&d>=224e3&&o===0&&(i[e+3]=i[e+3]|128),{sampleRate:c,channelCount:h,frameLength:g,samplesPerFrame:p}}}function tf(i,e){return i[e]===255&&(i[e+1]&224)===224&&(i[e+1]&6)!==0}function pv(i,e){return e+1<i.length&&tf(i,e)}function xS(i,e){return tf(i,e)&&4<=i.length-e}
vendor: 2,183 bytes, line 29
29function gv(i,e){if(e+1<i.length&&tf(i,e)){const r=mv(i,e);let s=4;r!=null&&r.frameLength&&(s=r.frameLength);const n=e+s;return n===i.length||pv(i,n)}return!1}class RS extends Jh{constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=t}resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Pa(e,0);let r=(t==null?void 0:t.length)||0;if(gv(e,r))return!1;for(let s=e.length;r<s;r++)if(yS(e,r))return R.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return ES(e,t)}appendFrame(e,t,r){uv(e,this.observer,t,r,e.manifestCodec);const s=hv(e,t,r,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}}const LS=/\/emsg[-/]ID3/i;class IS{constructor(e,t){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=t}resetTimeStamp(){}resetInitSegment(e,t,r,s){const n=this.videoTrack=_i("video",1),a=this.audioTrack=_i("audio",1),o=this.txtTrack=_i("text",1);if(this.id3Track=_i("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const l=Y0(e);if(l.video){const{id:d,timescale:u,codec:c}=l.video;n.id=d,n.timescale=o.timescale=u,n.codec=c}if(l.audio){const{id:d,timescale:u,codec:c}=l.audio;a.id=d,a.timescale=u,a.codec=c}o.id=K0.text,n.sampleDuration=0,n.duration=a.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return WA(e)}demux(e,t){this.timeOffset=t;let r=e;const s=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Wt(this.remainderData,e));const o=JA(r);this.remainderData=o.remainder,s.samples=o.valid||new Uint8Array}else s.samples=r;const a=this.extractID3Track(s,t);return n.samples=Ym(t,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:a,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,t=this.videoTrack,r=this.txtTrack;t.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(t,this.timeOffset);
vendor: 45,260 bytes, line 29
29return r.samples=Ym(e,t),{videoTrack:t,audioTrack:_i(),id3Track:s,textTrack:_i()}}extractID3Track(e,t){const r=this.id3Track;if(e.samples.length){const s=le(e.samples,["emsg"]);s&&s.forEach(n=>{const a=i1(n);if(LS.test(a.schemeIdUri)){const o=q(a.presentationTime)?a.presentationTime/a.timeScale:t+a.presentationTimeDelta/a.timeScale;let l=a.eventDuration===4294967295?Number.POSITIVE_INFINITY:a.eventDuration/a.timeScale;l<=.001&&(l=Number.POSITIVE_INFINITY);const d=a.payload;r.samples.push({data:d,len:d.byteLength,dts:o,pts:o,type:si.emsg,duration:l})}})}return r}demuxSampleAes(e,t,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}}const vv=(i,e)=>{let t=0,r=5;e+=r;const s=new Uint32Array(1),n=new Uint32Array(1),a=new Uint8Array(1);for(;r>0;){a[0]=i[e];const o=Math.min(r,8),l=8-o;n[0]=4278190080>>>24+l<<l,s[0]=(a[0]&n[0])>>l,t=t?t<<o|s[0]:s[0],e+=1,r-=o}return t};class kS extends Jh{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,r){const s=Ev(e,t,r,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const t=Pa(e,0);if(!t)return!1;const r=t.length;return e[r]===11&&e[r+1]===119&&qh(t)!==void 0&&vv(e,r)<16}}function Ev(i,e,t,r,s){if(t+8>e.length||e[t]!==11||e[t+1]!==119)return-1;const n=e[t+4]>>6;if(n>=3)return-1;const o=[48e3,44100,32e3][n],l=e[t+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][l*3+n]*2;if(t+u>e.length)return-1;const c=e[t+6]>>5;let h=0;c===2?h+=2:(c&1&&c!==1&&(h+=2),c&4&&(h+=2));const f=(e[t+6]<<8|e[t+7])>>12-h&1,p=[2,1,2,3,3,4,4,5][c]+f,g=e[t+5]>>3,v=e[t+5]&7,b=new Uint8Array([n<<6|g<<1|v>>2,(v&3)<<6|c<<3|f<<2|l>>4,l<<4&224]),y=1536/o*9e4,A=r+s*y,_=e.subarray(t,t+u);return i.config=b,i.channelCount=p,i.samplerate=o,i.samples.push({unit:_,pts:A}),u}class wS{constructor(){this.VideoSample=null}createVideoSample(e,t,r,s){return{key:e,frame:!1,pts:t,dts:r,units:[],debug:s,length:0}}getLastNalUnit(e){var t;let r=this.VideoSample,s;if((!r||r.units.length===0)&&(r=e[e.length-1]),(t=r)!=null&&t.units){const n=r.units;s=n[n.length-1]}return s}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(e.pts===void 0){const r=t.samples,s=r.length;if(s){const n=r[s-1];e.pts=n.pts,e.dts=n.dts}else{t.dropped++;return}}t.samples.push(e)}e.debug.length&&R.log(e.pts+"/"+e.dts+":"+e.debug)}}class bp{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,t=this.bytesAvailable,r=e.byteLength-t,s=new Uint8Array(4),n=Math.min(4,t);if(n===0)throw new Error("no bytes available");s.set(e.subarray(r,r+n)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=n*8,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t<<3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let t=Math.min(this.bitsAvailable,e);const r=this.word>>>32-t;if(e>32&&R.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0)this.word<<=t;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return t=e-t,t>0&&this.bitsAvailable?r<<t|this.readBits(t):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&2147483648>>>e)!==0)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(e){let t=8,r=8,s;for(let n=0;n<e;n++)r!==0&&(s=this.readEG(),r=(t+s+256)%256),t=r===0?t:r}readSPS(){let e=0,t=0,r=0,s=0,n,a,o;const l=this.readUByte.bind(this),d=this.readBits.bind(this),u=this.readUEG.bind(this),c=this.readBoolean.bind(this),h=this.skipBits.bind(this),f=this.skipEG.bind(this),m=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);l();const g=l();if(d(5),h(3),l(),m(),g===100||g===110||g===122||g===244||g===44||g===83||g===86||g===118||g===128){const C=u();if(C===3&&h(1),m(),m(),h(1),c())for(a=C!==3?8:12,o=0;o<a;o++)c()&&(o<6?p(16):p(64))}m();const v=u();if(v===0)u();else if(v===1)for(h(1),f(),f(),n=u(),o=0;o<n;o++)f();m(),h(1);const b=u(),y=u(),A=d(1);A===0&&h(1),h(1),c()&&(e=u(),t=u(),r=u(),s=u());let _=[1,1];if(c()&&c())switch(l()){case 1:_=[1,1];break;case 2:_=[12,11];break;case 3:_=[10,11];break;case 4:_=[16,11];break;case 5:_=[40,33];break;case 6:_=[24,11];break;case 7:_=[20,11];break;case 8:_=[32,11];break;case 9:_=[80,33];break;case 10:_=[18,11];break;case 11:_=[15,11];break;case 12:_=[64,33];break;case 13:_=[160,99];break;case 14:_=[4,3];break;case 15:_=[3,2];break;case 16:_=[2,1];break;case 255:{_=[l()<<8|l(),l()<<8|l()];break}}return{width:Math.ceil((b+1)*16-e*2-t*2),height:(2-A)*(y+1)*16-(A?2:4)*(r+s),pixelRatio:_}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class DS extends wS{parseAVCPES(e,t,r,s,n){const a=this.parseAVCNALu(e,r.data);let o=this.VideoSample,l,d=!1;r.data=null,o&&a.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),a.forEach(u=>{var c;switch(u.type){case 1:{let p=!1;l=!0;const g=u.data;if(d&&g.length>4){const v=new bp(g).readSliceType();(v===2||v===4||v===7||v===9)&&(p=!0)}if(p){var h;(h=o)!=null&&h.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.frame=!0,o.key=p;break}case 5:l=!0,(c=o)!=null&&c.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.key=!0,o.frame=!0;break;case 6:{l=!0,j0(u.data,1,r.pts,t.samples);break}case 7:{var f,m;l=!0,d=!0;const p=u.data,v=new bp(p).readSPS();if(!e.sps||e.width!==v.width||e.height!==v.height||((f=e.pixelRatio)==null?void 0:f[0])!==v.pixelRatio[0]||((m=e.pixelRatio)==null?void 0:m[1])!==v.pixelRatio[1]){e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.sps=[p],e.duration=n;const b=p.subarray(1,4);let y="avc1.";for(let A=0;A<3;A++){let _=b[A].toString(16);_.length<2&&(_="0"+_),y+=_}e.codec=y}break}case 8:l=!0,e.pps=[u.data];break;case 9:l=!0,e.audFound=!0,o&&this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"");break;case 12:l=!0;break;default:l=!1,o&&(o.debug+="unknown NAL "+u.type+" ");break}o&&l&&o.units.push(u)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}parseAVCNALu(e,t){const r=t.byteLength;let s=e.naluState||0;const n=s,a=[];let o=0,l,d,u,c=-1,h=0;for(s===-1&&(c=0,h=t[0]&31,s=0,o=1);o<r;){if(l=t[o++],!s){s=l?0:1;continue}if(s===1){s=l?0:2;continue}if(!l)s=3;else if(l===1){if(d=o-s-1,c>=0){const f={data:t.subarray(c,d),type:h};a.push(f)}else{const f=this.getLastNalUnit(e.samples);f&&(n&&o<=4-n&&f.state&&(f.data=f.data.subarray(0,f.data.byteLength-n)),d>0&&(f.data=Wt(f.data,t.subarray(0,d)),f.state=0))}o<r?(u=t[o]&31,c=o,h=u,s=0):s=-1}else s=0}if(c>=0&&s>=0){const f={data:t.subarray(c,r),type:h,state:s};a.push(f)}if(a.length===0){const f=this.getLastNalUnit(e.samples);f&&(f.data=Wt(f.data,t))}return e.naluState=s,a}}class CS{constructor(e,t,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new Qh(t,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(e,t,r){const s=e[t].unit;if(s.length<=16)return;const n=s.subarray(16,s.length-s.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(o=>{const l=new Uint8Array(o);s.set(l,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,r)})}decryptAacSamples(e,t,r){for(;;t++){if(t>=e.length){r();return}if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const t=Math.floor((e.length-48)/160)*16+16,r=new Int8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)r.set(e.subarray(n,n+16),s);return r}getAvcDecryptedUnit(e,t){const r=new Uint8Array(t);let s=0;for(let n=32;n<e.length-16;n+=160,s+=16)e.set(r.subarray(s,s+16),n);return e}decryptAvcSample(e,t,r,s,n){const a=z0(n.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then(l=>{n.data=this.getAvcDecryptedUnit(a,l),this.decrypter.isSync()||this.decryptAvcSamples(e,t,r+1,s)})}decryptAvcSamples(e,t,r,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;t++,r=0){if(t>=e.length){s();return}const n=e[t].units;for(;!(r>=n.length);r++){const a=n[r];if(!(a.data.length<=48||a.type!==1&&a.type!==5)&&(this.decryptAvcSample(e,t,r,s,a),!this.decrypter.isSync()))return}}}}const lt=188;class gr{constructor(e,t,r){this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._duration=0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.videoParser=new DS}static probe(e){const t=gr.syncOffset(e);return t>0&&R.warn(`MPEG2-TS detected but first sync word found @ offset ${t}`),t!==-1}static syncOffset(e){const t=e.length;let r=Math.min(lt*5,t-lt)+1,s=0;for(;s<r;){let n=!1,a=-1,o=0;for(let l=s;l<t;l+=lt)if(e[l]===71&&(t-l===lt||e[l+lt]===71)){if(o++,a===-1&&(a=l,a!==0&&(r=Math.min(a+lt*99,e.length-lt)+1)),n||(n=uc(e,l)===0),n&&o>1&&(a===0&&o>2||l+lt>r))return a}else{if(o)return-1;break}s++}return-1}static createTrack(e,t){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:K0[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?t:void 0}}resetInitSegment(e,t,r,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=gr.createTrack("video"),this._audioTrack=gr.createTrack("audio",s),this._id3Track=gr.createTrack("id3"),this._txtTrack=gr.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=r,this._duration=s}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:t,_id3Track:r}=this;e&&(e.pesData=null),t&&(t.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,r=!1,s=!1){r||(this.sampleAes=null);let n;const a=this._videoTrack,o=this._audioTrack,l=this._id3Track,d=this._txtTrack;let u=a.pid,c=a.pesData,h=o.pid,f=l.pid,m=o.pesData,p=l.pesData,g=null,v=this.pmtParsed,b=this._pmtId,y=e.length;if(this.remainderData&&(e=Wt(this.remainderData,e),y=e.length,this.remainderData=null),y<lt&&!s)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};const A=Math.max(0,gr.syncOffset(e));y-=(y-A)%lt,y<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,y,e.buffer.byteLength-y));let _=0;for(let x=A;x<y;x+=lt)if(e[x]===71){const S=!!(e[x+1]&64),P=uc(e,x),I=(e[x+3]&48)>>4;let M;if(I>1){if(M=x+5+e[x+4],M===x+lt)continue}else M=x+4;switch(P){case u:S&&(c&&(n=ws(c))&&this.videoParser.parseAVCPES(a,d,n,!1,this._duration),c={data:[],size:0}),c&&(c.data.push(e.subarray(M,x+lt)),c.size+=x+lt-M);break;case h:if(S){if(m&&(n=ws(m)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,n);break;case"mp3":this.parseMPEGPES(o,n);break;case"ac3":this.parseAC3PES(o,n);break}m={data:[],size:0}}m&&(m.data.push(e.subarray(M,x+lt)),m.size+=x+lt-M);break;case f:S&&(p&&(n=ws(p))&&this.parseID3PES(l,n),p={data:[],size:0}),p&&(p.data.push(e.subarray(M,x+lt)),p.size+=x+lt-M);break;case 0:S&&(M+=e[M]+1),b=this._pmtId=MS(e,M);break;case b:{S&&(M+=e[M]+1);const $=OS(e,M,this.typeSupported,r,this.observer);u=$.videoPid,u>0&&(a.pid=u,a.segmentCodec=$.segmentVideoCodec),h=$.audioPid,h>0&&(o.pid=h,o.segmentCodec=$.segmentAudioCodec),f=$.id3Pid,f>0&&(l.pid=f),g!==null&&!v&&(R.warn(`MPEG-TS PMT found at ${x} after unknown PID '${g}'. Backtracking to sync byte @${A} to parse all TS packets.`),g=null,x=A-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=P;break}}else _++;_>0&&ud(this.observer,new Error(`Found ${_} TS packet/s that do not start with 0x47`)),a.pesData=c,o.pesData=m,l.pesData=p;const C={audioTrack:o,videoTrack:a,id3Track:l,textTrack:d};return s&&this.extractRemainingSamples(C),C}flush(){const{remainderData:e}=this;this.remainderData=null;let t;return e?t=this.demux(e,-1,!1,!0):t={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t}extractRemainingSamples(e){const{audioTrack:t,videoTrack:r,id3Track:s,textTrack:n}=e,a=r.pesData,o=t.pesData,l=s.pesData;let d;if(a&&(d=ws(a))?(this.videoParser.parseAVCPES(r,n,d,!0,this._duration),r.pesData=null):r.pesData=a,o&&(d=ws(o))){switch(t.segmentCodec){case"aac":this.parseAACPES(t,d);break;case"mp3":this.parseMPEGPES(t,d);break;case"ac3":this.parseAC3PES(t,d);break}t.pesData=null}else o!=null&&o.size&&R.log("last AAC PES packet truncated,might overlap between fragments"),t.pesData=o;l&&(d=ws(l))?(this.parseID3PES(s,d),s.pesData=null):s.pesData=l}demuxSampleAes(e,t,r){const s=this.demux(e,r,!0,!this.config.progressive),n=this.sampleAes=new CS(this.observer,this.config,t);return this.decrypt(s,n)}decrypt(e,t){return new Promise(r=>{const{audioTrack:s,videoTrack:n}=e;s.samples&&s.segmentCodec==="aac"?t.decryptAacSamples(s.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{r(e)}):r(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{r(e)})})}destroy(){this._duration=0}parseAACPES(e,t){let r=0;const s=this.aacOverFlow;let n=t.data;if(s){this.aacOverFlow=null;const c=s.missing,h=s.sample.unit.byteLength;if(c===-1)n=Wt(s.sample.unit,n);else{const f=h-c;s.sample.unit.set(n.subarray(0,c),f),e.samples.push(s.sample),r=s.missing}}let a,o;for(a=r,o=n.length;a<o-1&&!dd(n,a);a++);if(a!==r){let c;const h=a<o-1;if(h?c=`AAC PES did not start with ADTS header,offset:${a}`:c="No ADTS header found in AAC PES",ud(this.observer,new Error(c),h),!h)return}uv(e,this.observer,n,a,this.audioCodec);let l;if(t.pts!==void 0)l=t.pts;else if(s){const c=cv(e.samplerate);l=s.sample.pts+c}else{R.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,u;for(;a<o;)if(u=hv(e,n,a,l,d),a+=u.length,u.missing){this.aacOverFlow=u;break}else for(d++;a<o-1&&!dd(n,a);a++);}parseMPEGPES(e,t){const r=t.data,s=r.length;let n=0,a=0;const o=t.pts;if(o===void 0){R.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;a<s;)if(pv(r,a)){const l=fv(e,r,a,o,n);if(l)a+=l.length,n++;else break}else a++}parseAC3PES(e,t){{const r=t.data,s=t.pts;if(s===void 0){R.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const n=r.length;let a=0,o=0,l;for(;o<n&&(l=Ev(e,r,o,s,a++))>0;)o+=l}}parseID3PES(e,t){if(t.pts===void 0){R.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const r=it({},t,{type:this._videoTrack?si.emsg:si.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}}function uc(i,e){return((i[e+1]&31)<<8)+i[e+2]}function MS(i,e){return(i[e+10]&31)<<8|i[e+11]}function OS(i,e,t,r,s){const n={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=(i[e+1]&15)<<8|i[e+2],o=e+3+a-4,l=(i[e+10]&15)<<8|i[e+11];for(e+=12+l;e<o;){const d=uc(i,e),u=(i[e+3]&15)<<8|i[e+4];switch(i[e]){case 207:if(!r){_u("ADTS AAC");break}case 15:n.audioPid===-1&&(n.audioPid=d);break;case 21:n.id3Pid===-1&&(n.id3Pid=d);break;case 219:if(!r){_u("H.264");break}case 27:n.videoPid===-1&&(n.videoPid=d,n.segmentVideoCodec="avc");break;case 3:case 4:!t.mpeg&&!t.mp3?R.log("MPEG audio found, not supported in this browser"):n.audioPid===-1&&(n.audioPid=d,n.segmentAudioCodec="mp3");break;case 193:if(!r){_u("AC-3");break}case 129:t.ac3?n.audioPid===-1&&(n.audioPid=d,n.segmentAudioCodec="ac3"):R.log("AC-3 audio found, not supported in this browser");break;case 6:if(n.audioPid===-1&&u>0){let c=e+5,h=u;for(;h>2;){switch(i[c]){case 106:t.ac3!==!0?R.log("AC-3 audio found, not supported in this browser for now"):(n.audioPid=d,n.segmentAudioCodec="ac3");break}const m=i[c+1]+2;c+=m,h-=m}}break;case 194:case 135:return ud(s,new Error("Unsupported EC-3 in M2TS found")),n;case 36:return ud(s,new Error("Unsupported HEVC in M2TS found")),n}e+=u+5}return n}function ud(i,e,t){R.warn(`parsing error: ${e.message}`),i.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_PARSING_ERROR,fatal:!1,levelRetry:t,error:e,reason:e.message})}function _u(i){R.log(`${i} with AES-128-CBC encryption found in unencrypted stream`)}function ws(i){let e=0,t,r,s,n,a;const o=i.data;if(!i||i.size===0)return null;for(;o[0].length<19&&o.length>1;)o[0]=Wt(o[0],o[1]),o.splice(1,1);if(t=o[0],(t[0]<<16)+(t[1]<<8)+t[2]===1){if(r=(t[4]<<8)+t[5],r&&r>i.size-6)return null;const d=t[7];d&192&&(n=(t[9]&14)*536870912+(t[10]&255)*4194304+(t[11]&254)*16384+(t[12]&255)*128+(t[13]&254)/2,d&64?(a=(t[14]&14)*536870912+(t[15]&255)*4194304+(t[16]&254)*16384+(t[17]&255)*128+(t[18]&254)/2,n-a>60*9e4&&(R.warn(`${Math.round((n-a)/9e4)}s delta between PTS and DTS, align them`),n=a)):a=n),s=t[8];let u=s+9;if(i.size<=u)return null;i.size-=u;const c=new Uint8Array(i.size);for(let h=0,f=o.length;h<f;h++){t=o[h];let m=t.byteLength;if(u)if(u>m){u-=m;continue}else t=t.subarray(u),m-=u,u=0;c.set(t,e),e+=m}return r&&(r-=s+3),{data:c,pts:n,dts:a,len:r}}return null}class PS extends Jh{resetInitSegment(e,t,r,s){super.resetInitSegment(e,t,r,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const t=Pa(e,0);let r=(t==null?void 0:t.length)||0;if(t&&e[r]===11&&e[r+1]===119&&qh(t)!==void 0&&vv(e,r)<=16)return!1;for(let s=e.length;r<s;r++)if(gv(e,r))return R.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return xS(e,t)}appendFrame(e,t,r){if(this.basePTS!==null)return fv(e,t,r,this.basePTS,this.frameIndex)}}class Tp{static getSilentFrame(e,t){switch(e){case"mp4a.40.2":if(t===1)return new Uint8Array([0,200,0,128,35,128]);if(t===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(t===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(t===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(t===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(t===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(t===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(t===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}const rr=Math.pow(2,32)-1;class w{static init(){w.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in w.types)w.types.hasOwnProperty(e)&&(w.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const t=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=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]);w.HDLR_TYPES={video:t,audio:r};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),n=new Uint8Array([0,0,0,0,0,0,0,0]);w.STTS=w.STSC=w.STCO=n,w.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),w.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),w.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),w.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const a=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);w.FTYP=w.box(w.types.ftyp,a,l,a,o),w.DINF=w.box(w.types.dinf,w.box(w.types.dref,s))}static box(e,...t){let r=8,s=t.length;const n=s;for(;s--;)r+=t[s].byteLength;const a=new Uint8Array(r);for(a[0]=r>>24&255,a[1]=r>>16&255,a[2]=r>>8&255,a[3]=r&255,a.set(e,4),s=0,r=8;s<n;s++)a.set(t[s],r),r+=t[s].byteLength;return a}static hdlr(e){return w.box(w.types.hdlr,w.HDLR_TYPES[e])}static mdat(e){return w.box(w.types.mdat,e)}static mdhd(e,t){t*=e;const r=Math.floor(t/(rr+1)),s=Math.floor(t%(rr+1));return w.box(w.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return w.box(w.types.mdia,w.mdhd(e.timescale,e.duration),w.hdlr(e.type),w.minf(e))}static mfhd(e){return w.box(w.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?w.box(w.types.minf,w.box(w.types.smhd,w.SMHD),w.DINF,w.stbl(e)):w.box(w.types.minf,w.box(w.types.vmhd,w.VMHD),w.DINF,w.stbl(e))}static moof(e,t,r){return w.box(w.types.moof,w.mfhd(e),w.traf(r,t))}static moov(e){let t=e.length;const r=[];for(;t--;)r[t]=w.trak(e[t]);return w.box.apply(null,[w.types.moov,w.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(w.mvex(e)))}static mvex(e){let t=e.length;const r=[];for(;t--;)r[t]=w.trex(e[t]);return w.box.apply(null,[w.types.mvex,...r])}static mvhd(e,t){t*=e;const r=Math.floor(t/(rr+1)),s=Math.floor(t%(rr+1)),n=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&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 w.box(w.types.mvhd,n)}static sdtp(e){const t=e.samples||[],r=new Uint8Array(4+t.length);let s,n;for(s=0;s<t.length;s++)n=t[s].flags,r[s+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return w.box(w.types.sdtp,r)}static stbl(e){return w.box(w.types.stbl,w.stsd(e),w.box(w.types.stts,w.STTS),w.box(w.types.stsc,w.STSC),w.box(w.types.stsz,w.STSZ),w.box(w.types.stco,w.STCO))}static avc1(e){let t=[],r=[],s,n,a;for(s=0;s<e.sps.length;s++)n=e.sps[s],a=n.byteLength,t.push(a>>>8&255),t.push(a&255),t=t.concat(Array.prototype.slice.call(n));for(s=0;s<e.pps.length;s++)n=e.pps[s],a=n.byteLength,r.push(a>>>8&255),r.push(a&255),r=r.concat(Array.prototype.slice.call(n));const o=w.box(w.types.avcC,new Uint8Array([1,t[3],t[4],t[5],255,224|e.sps.length].concat(t).concat([e.pps.length]).concat(r))),l=e.width,d=e.height,u=e.pixelRatio[0],c=e.pixelRatio[1];return w.box(w.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,l&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,w.box(w.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),w.box(w.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,c>>24,c>>16&255,c>>8&255,c&255])))}static esds(e){const t=e.config.length;return new Uint8Array([0,0,0,0,3,23+t,0,1,0,4,15+t,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([t]).concat(e.config).concat([6,1,2]))}static audioStsd(e){const t=e.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,t>>8&255,t&255,0,0])}static mp4a(e){return w.box(w.types.mp4a,w.audioStsd(e),w.box(w.types.esds,w.esds(e)))}static mp3(e){return w.box(w.types[".mp3"],w.audioStsd(e))}static ac3(e){return w.box(w.types["ac-3"],w.audioStsd(e),w.box(w.types.dac3,e.config))}static stsd(e){return e.type==="audio"?e.segmentCodec==="mp3"&&e.codec==="mp3"?w.box(w.types.stsd,w.STSD,w.mp3(e)):e.segmentCodec==="ac3"?w.box(w.types.stsd,w.STSD,w.ac3(e)):w.box(w.types.stsd,w.STSD,w.mp4a(e)):w.box(w.types.stsd,w.STSD,w.avc1(e))}static tkhd(e){const t=e.id,r=e.duration*e.timescale,s=e.width,n=e.height,a=Math.floor(r/(rr+1)),o=Math.floor(r%(rr+1));return w.box(w.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,t&255,0,0,0,0,a>>24,a>>16&255,a>>8&255,a&255,o>>24,o>>16&255,o>>8&255,o&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,s&255,0,0,n>>8&255,n&255,0,0]))}static traf(e,t){const r=w.sdtp(e),s=e.id,n=Math.floor(t/(rr+1)),a=Math.floor(t%(rr+1));return w.box(w.types.traf,w.box(w.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),w.box(w.types.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,a>>24,a>>16&255,a>>8&255,a&255])),w.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,w.box(w.types.trak,w.tkhd(e),w.mdia(e))}static trex(e){const t=e.id;return w.box(w.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,t&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){const r=e.samples||[],s=r.length,n=12+16*s,a=new Uint8Array(n);let o,l,d,u,c,h;for(t+=8+n,a.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,t>>>24&255,t>>>16&255,t>>>8&255,t&255],0),o=0;o<s;o++)l=r[o],d=l.duration,u=l.size,c=l.flags,h=l.cts,a.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,c.degradPrio&61440,c.degradPrio&15,h>>>24&255,h>>>16&255,h>>>8&255,h&255],12+16*o);return w.box(w.types.trun,a)}static initSegment(e){w.types||w.init();const t=w.moov(e);return Wt(w.FTYP,t)}}w.types=void 0;w.HDLR_TYPES=void 0;w.STTS=void 0;w.STSC=void 0;w.STCO=void 0;w.STSZ=void 0;w.VMHD=void 0;w.SMHD=void 0;w.STSD=void 0;w.FTYP=void 0;w.DINF=void 0;const yv=9e4;function rf(i,e,t=1,r=!1){const s=i*e*t;return r?Math.round(s):s}function NS(i,e,t=1,r=!1){return rf(i,e,1/t,r)}function Gn(i,e=!1){return rf(i,1e3,1/yv,e)}function US(i,e=1){return rf(i,yv,1/e)}const FS=10*1e3,_p=1024,$S=1152,BS=1536;let Ds=null,Au=null;class Bo{constructor(e,t,r,s=""){if(this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextAvcDts=null,this.nextAudioPts=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=r,this.ISGenerated=!1,Ds===null){const a=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Ds=a?parseInt(a[1]):0}if(Au===null){const n=navigator.userAgent.match(/Safari\/(\d+)/i);Au=n?parseInt(n[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){R.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=e}resetNextTimestamp(){R.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){R.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1;const r=e[0].pts,s=e.reduce((n,a)=>{let o=a.pts,l=o-n;return l<-4294967296&&(t=!0,o=Ht(o,r),l=o-n),l>0?n:o},r);return t&&R.debug("PTS rollover detected"),s}remux(e,t,r,s,n,a,o,l){let d,u,c,h,f,m,p=n,g=n;const v=e.pid>-1,b=t.pid>-1,y=t.samples.length,A=e.samples.length>0,_=o&&y>0||y>1;if((!v||A)&&(!b||_)||this.ISGenerated||o){if(this.ISGenerated){var x,S,P,I;const Q=this.videoTrackConfig;Q&&(t.width!==Q.width||t.height!==Q.height||((x=t.pixelRatio)==null?void 0:x[0])!==((S=Q.pixelRatio)==null?void 0:S[0])||((P=t.pixelRatio)==null?void 0:P[1])!==((I=Q.pixelRatio)==null?void 0:I[1]))&&this.resetInitSegment()}else c=this.generateIS(e,t,n,a);const M=this.isVideoContiguous;let $=-1,F;if(_&&($=HS(t.samples),!M&&this.config.forceKeyFrameOnDiscontinuity))if(m=!0,$>0){R.warn(`[mp4-remuxer]: Dropped ${$} out of ${y} video samples due to a missing keyframe`);const Q=this.getVideoStartPts(t.samples);t.samples=t.samples.slice($),t.dropped+=$,g+=(t.samples[0].pts-Q)/t.inputTimeScale,F=g}else $===-1&&(R.warn(`[mp4-remuxer]: No keyframe found out of ${y} video samples`),m=!1);if(this.ISGenerated){if(A&&_){const Q=this.getVideoStartPts(t.samples),X=(Ht(e.samples[0].pts,Q)-Q)/t.inputTimeScale;p+=Math.max(0,X),g+=Math.max(0,-X)}if(A){if(e.samplerate||(R.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,p,this.isAudioContiguous,a,b||_||l===ie.AUDIO?g:void 0),_){const Q=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(R.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(e,t,n,a)),d=this.remuxVideo(t,g,M,Q)}}else _&&(d=this.remuxVideo(t,g,M,0));d&&(d.firstKeyFrame=$,d.independent=$!==-1,d.firstKeyFramePTS=F)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(f=bv(r,n,this._initPTS,this._initDTS)),s.samples.length&&(h=Tv(s,n,this._initPTS))),{audio:u,video:d,initSegment:c,independent:m,text:h,id3:f}}generateIS(e,t,r,s){const n=e.samples,a=t.samples,o=this.typeSupported,l={},d=this._initPTS;let u=!d||s,c="audio/mp4",h,f,m;if(u&&(h=f=1/0),e.config&&n.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":o.mpeg?(c="audio/mpeg",e.codec=""):o.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}l.audio={id:"audio",container:c,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&o.mpeg?new Uint8Array(0):w.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(m=e.inputTimeScale,!d||m!==d.timescale?h=f=n[0].pts-Math.round(m*r):u=!1)}if(t.sps&&t.pps&&a.length){if(t.timescale=t.inputTimeScale,l.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:w.initSegment([t]),metadata:{width:t.width,height:t.height}},u)if(m=t.inputTimeScale,!d||m!==d.timescale){const p=this.getVideoStartPts(a),g=Math.round(m*r);f=Math.min(f,Ht(a[0].dts,p)-g),h=Math.min(h,p-g)}else u=!1;this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(l).length)return this.ISGenerated=!0,u?(this._initPTS={baseTime:h,timescale:m},this._initDTS={baseTime:f,timescale:m}):h=m=void 0,{tracks:l,initPTS:h,timescale:m}}remuxVideo(e,t,r,s){const n=e.inputTimeScale,a=e.samples,o=[],l=a.length,d=this._initPTS;let u=this.nextAvcDts,c=8,h=this.videoSampleDuration,f,m,p=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,v=!1;if(!r||u===null){const K=t*n,H=a[0].pts-Ht(a[0].dts,a[0].pts);Ds&&u!==null&&Math.abs(K-H-u)<15e3?r=!0:u=K-H}const b=d.baseTime*n/d.timescale;for(let K=0;K<l;K++){const H=a[K];H.pts=Ht(H.pts-b,u),H.dts=Ht(H.dts-b,u),H.dts<a[K>0?K-1:K].dts&&(v=!0)}v&&a.sort(function(K,H){const ne=K.dts-H.dts,oe=K.pts-H.pts;return ne||oe}),f=a[0].dts,m=a[a.length-1].dts;const y=m-f,A=y?Math.round(y/(l-1)):h||e.inputTimeScale/30;if(r){const K=f-u,H=K>A,ne=K<-1;if((H||ne)&&(H?R.warn(`AVC: ${Gn(K,!0)} ms (${K}dts) hole between fragments detected at ${t.toFixed(3)}`):R.warn(`AVC: ${Gn(-K,!0)} ms (${K}dts) overlapping between fragments detected at ${t.toFixed(3)}`),!ne||u>=a[0].pts||Ds)){f=u;const oe=a[0].pts-K;if(H)a[0].dts=f,a[0].pts=oe;else for(let pe=0;pe<a.length&&!(a[pe].dts>oe);pe++)a[pe].dts-=K,a[pe].pts-=K;R.log(`Video: Initial PTS/DTS adjusted: ${Gn(oe,!0)}/${Gn(f,!0)}, delta: ${Gn(K,!0)} ms`)}}f=Math.max(0,f);let _=0,C=0,x=f;for(let K=0;K<l;K++){const H=a[K],ne=H.units,oe=ne.length;let pe=0;for(let Be=0;Be<oe;Be++)pe+=ne[Be].data.length;C+=pe,_+=oe,H.length=pe,H.dts<x?(H.dts=x,x+=A/4|0||1):x=H.dts,p=Math.min(H.pts,p),g=Math.max(H.pts,g)}m=a[l-1].dts;const S=C+4*_+8;let P;try{P=new Uint8Array(S)}catch(K){this.observer.emit(E.ERROR,E.ERROR,{type:re.MUX_ERROR,details:O.REMUX_ALLOC_ERROR,fatal:!1,error:K,bytes:S,reason:`fail allocating video mdat ${S}`});return}const I=new DataView(P.buffer);I.setUint32(0,S),P.set(w.types.mdat,4);let M=!1,$=Number.POSITIVE_INFINITY,F=Number.POSITIVE_INFINITY,Q=Number.NEGATIVE_INFINITY,Y=Number.NEGATIVE_INFINITY;for(let K=0;K<l;K++){const H=a[K],ne=H.units;let oe=0;for(let He=0,je=ne.length;He<je;He++){const _t=ne[He],ir=_t.data,Rs=_t.data.byteLength;I.setUint32(c,Rs),c+=4,P.set(ir,c),c+=Rs,oe+=4+Rs}let pe;if(K<l-1)h=a[K+1].dts-H.dts,pe=a[K+1].pts-H.pts;else{const He=this.config,je=K>0?H.dts-a[K-1].dts:A;if(pe=K>0?H.pts-a[K-1].pts:A,He.stretchShortVideoTrack&&this.nextAudioPts!==null){const _t=Math.floor(He.maxBufferHole*n),ir=(s?p+s*n:this.nextAudioPts)-H.pts;ir>_t?(h=ir-je,h<0?h=je:M=!0,R.log(`[mp4-remuxer]: It is approximately ${ir/90} ms to the next segment; using duration ${h/90} ms for the last video frame.`)):h=je}else h=je}const Be=Math.round(H.pts-H.dts);$=Math.min($,h),Q=Math.max(Q,h),F=Math.min(F,pe),Y=Math.max(Y,pe),o.push(new Ap(H.key,h,oe,Be))}if(o.length){if(Ds){if(Ds<70){const K=o[0].flags;K.dependsOn=2,K.isNonSync=0}}else if(Au&&Y-F<Q-$&&A/Q<.025&&o[0].cts===0){R.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let K=f;for(let H=0,ne=o.length;H<ne;H++){const oe=K+o[H].duration,pe=K+o[H].cts;if(H<ne-1){const Be=oe+o[H+1].cts;o[H].duration=Be-pe}else o[H].duration=H?o[H-1].duration:A;o[H].cts=0,K=oe}}}h=M||!h?A:h,this.nextAvcDts=u=m+h,this.videoSampleDuration=h,this.isVideoContiguous=!0;const de={data1:w.moof(e.sequenceNumber++,f,it({},e,{samples:o})),data2:P,startPTS:p/n,endPTS:(g+h)/n,startDTS:f/n,endDTS:u/n,type:"video",hasAudio:!1,hasVideo:!0,nb:o.length,dropped:e.dropped};return e.samples=[],e.dropped=0,de}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return $S;case"ac3":return BS;default:return _p}}remuxAudio(e,t,r,s,n){const a=e.inputTimeScale,o=e.samplerate?e.samplerate:a,l=a/o,d=this.getSamplesPerFrame(e),u=d*l,c=this._initPTS,h=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,f=[],m=n!==void 0;let p=e.samples,g=h?0:8,v=this.nextAudioPts||-1;const b=t*a,y=c.baseTime*a/c.timescale;if(this.isAudioContiguous=r=r||p.length&&v>0&&(s&&Math.abs(b-v)<9e3||Math.abs(Ht(p[0].pts-y,b)-v)<20*u),p.forEach(function(X){X.pts=Ht(X.pts-y,b)}),!r||v<0){if(p=p.filter(X=>X.pts>=0),!p.length)return;n===0?v=0:s&&!m?v=Math.max(0,b):v=p[0].pts}if(e.segmentCodec==="aac"){const X=this.config.maxAudioFramesDrift;for(let ue=0,de=v;ue<p.length;ue++){const K=p[ue],H=K.pts,ne=H-de,oe=Math.abs(1e3*ne/a);if(ne<=-X*u&&m)ue===0&&(R.warn(`Audio frame @ ${(H/a).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*ne/a)} ms.`),this.nextAudioPts=v=de=H);else if(ne>=X*u&&oe<FS&&m){let pe=Math.round(ne/u);de=H-pe*u,de<0&&(pe--,de+=u),ue===0&&(this.nextAudioPts=v=de),R.warn(`[mp4-remuxer]: Injecting ${pe} audio frame @ ${(de/a).toFixed(3)}s due to ${Math.round(1e3*ne/a)} ms gap.`);for(let Be=0;Be<pe;Be++){const He=Math.max(de,0);let je=Tp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);je||(R.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),je=K.unit.subarray()),p.splice(ue,0,{unit:je,pts:He}),de+=u,ue++}}K.pts=de,de+=u}}let A=null,_=null,C,x=0,S=p.length;for(;S--;)x+=p[S].unit.byteLength;for(let X=0,ue=p.length;X<ue;X++){const de=p[X],K=de.unit;let H=de.pts;if(_!==null){const oe=f[X-1];oe.duration=Math.round((H-_)/l)}else if(r&&e.segmentCodec==="aac"&&(H=v),A=H,x>0){x+=g;try{C=new Uint8Array(x)}catch(oe){this.observer.emit(E.ERROR,E.ERROR,{type:re.MUX_ERROR,details:O.REMUX_ALLOC_ERROR,fatal:!1,error:oe,bytes:x,reason:`fail allocating audio mdat ${x}`});return}h||(new DataView(C.buffer).setUint32(0,x),C.set(w.types.mdat,4))}else return;C.set(K,g);const ne=K.byteLength;g+=ne,f.push(new Ap(!0,d,ne,0)),_=H}const P=f.length;if(!P)return;const I=f[f.length-1];this.nextAudioPts=v=_+l*I.duration;const M=h?new Uint8Array(0):w.moof(e.sequenceNumber++,A/l,it({},e,{samples:f}));e.samples=[];const $=A/a,F=v/a,Y={data1:M,data2:C,startPTS:$,endPTS:F,startDTS:$,endDTS:F,type:"audio",hasAudio:!0,hasVideo:!1,nb:P};return this.isAudioContiguous=!0,Y}remuxEmptyAudio(e,t,r,s){const n=e.inputTimeScale,a=e.samplerate?e.samplerate:n,o=n/a,l=this.nextAudioPts,d=this._initDTS,u=d.baseTime*9e4/d.timescale,c=(l!==null?l:s.startDTS*n)+u,h=s.endDTS*n+u,f=o*_p,m=Math.ceil((h-c)/f),p=Tp.getSilentFrame(e.manifestCodec||e.codec,e.channelCount);if(R.warn("[mp4-remuxer]: remux empty Audio"),!p){R.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");return}const g=[];for(let v=0;v<m;v++){const b=c+v*f;g.push({unit:p,pts:b,dts:b})}return e.samples=g,this.remuxAudio(e,t,r,!1)}}function Ht(i,e){let t;if(e===null)return i;for(e<i?t=-8589934592:t=8589934592;Math.abs(i-e)>4294967296;)i+=t;return i}function HS(i){for(let e=0;e<i.length;e++)if(i[e].key)return e;return-1}function bv(i,e,t,r){const s=i.samples.length;if(!s)return;const n=i.inputTimeScale;for(let o=0;o<s;o++){const l=i.samples[o];l.pts=Ht(l.pts-t.baseTime*n/t.timescale,e*n)/n,l.dts=Ht(l.dts-r.baseTime*n/r.timescale,e*n)/n}const a=i.samples;return i.samples=[],{samples:a}}function Tv(i,e,t){const r=i.samples.length;if(!r)return;const s=i.inputTimeScale;for(let a=0;a<r;a++){const o=i.samples[a];o.pts=Ht(o.pts-t.baseTime*s/t.timescale,e*s)/s}i.samples.sort((a,o)=>a.pts-o.pts);const n=i.samples;return i.samples=[],{samples:n}}class Ap{constructor(e,t,r,s){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=t,this.size=r,this.cts=s,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:e?0:1}}}class GS{constructor(){this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null}destroy(){}resetTimeStamp(e){this.initPTS=e,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(e,t,r,s){this.audioCodec=t,this.videoCodec=r,this.generateInitSegment(jA(e,s)),this.emitInitSegment=!0}generateInitSegment(e){let{audioCodec:t,videoCodec:r}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const s=this.initData=Y0(e);s.audio&&(t=Sp(s.audio,Le.AUDIO)),s.video&&(r=Sp(s.video,Le.VIDEO));const n={};s.audio&&s.video?n.audiovideo={container:"video/mp4",codec:t+","+r,initSegment:e,id:"main"}:s.audio?n.audio={container:"audio/mp4",codec:t,initSegment:e,id:"audio"}:s.video?n.video={container:"video/mp4",codec:r,initSegment:e,id:"main"}:R.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=n}remux(e,t,r,s,n,a){var o,l;let{initPTS:d,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:s,id3:r,initSegment:void 0};q(u)||(u=this.lastEndTime=n||0);const h=t.samples;if(!(h!=null&&h.length))return c;const f={initPTS:void 0,timescale:1};let m=this.initData;if((o=m)!=null&&o.length||(this.generateInitSegment(h),m=this.initData),!((l=m)!=null&&l.length))return R.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const p=XA(h,m),g=zA(m,h),v=g===null?n:g;(KS(d,v,n,p)||f.timescale!==d.timescale&&a)&&(f.initPTS=v-n,d&&d.timescale===1&&R.warn(`Adjusting initPTS by ${f.initPTS-d.baseTime}`),this.initPTS=d={baseTime:f.initPTS,timescale:1});const b=e?v-d.baseTime/d.timescale:u,y=b+p;ZA(m,h,d.baseTime/d.timescale),p>0?this.lastEndTime=y:(R.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const A=!!m.audio,_=!!m.video;let C="";A&&(C+="audio"),_&&(C+="video");const x={data1:h,startPTS:b,startDTS:b,endPTS:y,endDTS:y,type:C,hasAudio:A,hasVideo:_,nb:1,dropped:0};return c.audio=x.type==="audio"?x:void 0,c.video=x.type!=="audio"?x:void 0,c.initSegment=f,c.id3=bv(r,n,d,d),s.samples.length&&(c.text=Tv(s,n,d)),c}}function KS(i,e,t,r){if(i===null)return!0;const s=Math.max(r,1),n=e-i.baseTime/i.timescale;return Math.abs(n-t)>s}function Sp(i,e){const t=i==null?void 0:i.codec;if(t&&t.length>4)return t;if(e===Le.AUDIO){if(t==="ec-3"||t==="ac-3"||t==="alac")return t;if(t==="fLaC"||t==="Opus")return rd(t,!1);const r="mp4a.40.5";return R.info(`Parsed audio codec "${t}" or audio object type not handled. Using "${r}"`),r}return R.warn(`Unhandled video codec "${t}"`),t==="hvc1"||t==="hev1"?"hvc1.1.6.L120.90":t==="av01"?"av01.0.04M.08":"avc1.42e01e"}let Wi;try{Wi=self.performance.now.bind(self.performance)}catch{R.debug("Unable to use Performance API on this environment"),Wi=xn==null?void 0:xn.Date.now}const Ho=[{demux:IS,remux:GS},{demux:gr,remux:Bo},{demux:RS,remux:Bo},{demux:PS,remux:Bo}];Ho.splice(2,0,{demux:kS,remux:Bo});class xp{constructor(e,t,r,s,n){this.async=!1,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=r,this.vendor=s,this.id=n}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,r,s){const n=r.transmuxing;n.executeStart=Wi();let a=new Uint8Array(e);const{currentTransmuxState:o,transmuxConfig:l}=this;s&&(this.currentTransmuxState=s);const{contiguous:d,discontinuity:u,trackSwitch:c,accurateTimeOffset:h,timeOffset:f,initSegmentChange:m}=s||o,{audioCodec:p,videoCodec:g,defaultInitPts:v,duration:b,initSegmentData:y}=l,A=VS(a,t);if(A&&A.method==="AES-128"){const S=this.getDecrypter();if(S.isSync()){let P=S.softwareDecrypt(a,A.key.buffer,A.iv.buffer);if(r.part>-1&&(P=S.flush()),!P)return n.executeEnd=Wi(),Su(r);a=new Uint8Array(P)}else return this.decryptionPromise=S.webCryptoDecrypt(a,A.key.buffer,A.iv.buffer).then(P=>{const I=this.push(P,null,r);return this.decryptionPromise=null,I}),this.decryptionPromise}const _=this.needsProbing(u,c);if(_){const S=this.configureTransmuxer(a);if(S)return R.warn(`[transmuxer] ${S.message}`),this.observer.emit(E.ERROR,E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_PARSING_ERROR,fatal:!1,error:S,reason:S.message}),n.executeEnd=Wi(),Su(r)}(u||c||m||_)&&this.resetInitSegment(y,p,g,b,t),(u||m||_)&&this.resetInitialTimestamp(v),d||this.resetContiguity();const C=this.transmux(a,A,f,h,r),x=this.currentTransmuxState;return x.contiguous=!0,x.discontinuity=!1,x.trackSwitch=!1,n.executeEnd=Wi(),C}flush(e){const t=e.transmuxing;t.executeStart=Wi();const{decrypter:r,currentTransmuxState:s,decryptionPromise:n}=this;if(n)return n.then(()=>this.flush(e));const a=[],{timeOffset:o}=s;if(r){const c=r.flush();c&&a.push(this.push(c,null,e))}const{demuxer:l,remuxer:d}=this;if(!l||!d)return t.executeEnd=Wi(),[Su(e)];const u=l.flush(o);return Go(u)?u.then(c=>(this.flushRemux(a,c,e),a)):(this.flushRemux(a,u,e),a)}flushRemux(e,t,r){const{audioTrack:s,videoTrack:n,id3Track:a,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;R.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);const u=this.remuxer.remux(s,n,a,o,d,l,!0,this.id);e.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=Wi()}resetInitialTimestamp(e){const{demuxer:t,remuxer:r}=this;!t||!r||(t.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:t}=this;!e||!t||(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,r,s,n){const{demuxer:a,remuxer:o}=this;!a||!o||(a.resetInitSegment(e,t,r,s),o.resetInitSegment(e,t,r,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,t,r,s,n){let a;return t&&t.method==="SAMPLE-AES"?a=this.transmuxSampleAes(e,t,r,s,n):a=this.transmuxUnencrypted(e,r,s,n),a}transmuxUnencrypted(e,t,r,s){const{audioTrack:n,videoTrack:a,id3Track:o,textTrack:l}=this.demuxer.demux(e,t,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(n,a,o,l,t,r,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,t,r,s,n){return this.demuxer.demuxSampleAes(e,t,r).then(a=>({remuxResult:this.remuxer.remux(a.audioTrack,a.videoTrack,a.id3Track,a.textTrack,r,s,!1,this.id),chunkMeta:n}))}
vendor: 2,289 bytes, line 29
29configureTransmuxer(e){const{config:t,observer:r,typeSupported:s,vendor:n}=this;let a;for(let h=0,f=Ho.length;h<f;h++){var o;if((o=Ho[h].demux)!=null&&o.probe(e)){a=Ho[h];break}}if(!a)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,d=this.remuxer,u=a.remux,c=a.demux;(!d||!(d instanceof u))&&(this.remuxer=new u(r,t,s,n)),(!l||!(l instanceof c))&&(this.demuxer=new c(r,t,s),this.probe=c.probe)}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new Qh(this.config)),e}}function VS(i,e){let t=null;return i.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(t=e),t}const Su=i=>({remuxResult:{},chunkMeta:i});function Go(i){return"then"in i&&i.then instanceof Function}class WS{constructor(e,t,r,s,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=r,this.duration=s,this.defaultInitPts=n||null}}class YS{constructor(e,t,r,s,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=r,this.trackSwitch=s,this.timeOffset=n,this.initSegmentChange=a}}var _v={exports:{}};(function(i){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function s(l,d,u){this.fn=l,this.context=d,this.once=u||!1}function n(l,d,u,c,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,c||l,h),m=t?t+d:d;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function a(l,d){--l._eventsCount===0?l._events=new r:delete l._events[d]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var d=[],u,c;if(this._eventsCount===0)return d;for(c in u=this._events)e.call(u,c)&&d.push(t?c.slice(1):c);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},o.prototype.listeners=function(d){var u=t?t+d:d,c=this._events[u];if(!c)return[];
vendor: 4,844 bytes, lines 29-32
29if(c.fn)return[c.fn];for(var h=0,f=c.length,m=new Array(f);h<f;h++)m[h]=c[h].fn;return m},o.prototype.listenerCount=function(d){var u=t?t+d:d,c=this._events[u];return c?c.fn?1:c.length:0},o.prototype.emit=function(d,u,c,h,f,m){var p=t?t+d:d;if(!this._events[p])return!1;var g=this._events[p],v=arguments.length,b,y;if(g.fn){switch(g.once&&this.removeListener(d,g.fn,void 0,!0),v){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,u),!0;case 3:return g.fn.call(g.context,u,c),!0;case 4:return g.fn.call(g.context,u,c,h),!0;case 5:return g.fn.call(g.context,u,c,h,f),!0;case 6:return g.fn.call(g.context,u,c,h,f,m),!0}for(y=1,b=new Array(v-1);y<v;y++)b[y-1]=arguments[y];g.fn.apply(g.context,b)}else{var A=g.length,_;for(y=0;y<A;y++)switch(g[y].once&&this.removeListener(d,g[y].fn,void 0,!0),v){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,u);break;case 3:g[y].fn.call(g[y].context,u,c);break;case 4:g[y].fn.call(g[y].context,u,c,h);break;default:if(!b)for(_=1,b=new Array(v-1);_<v;_++)b[_-1]=arguments[_];g[y].fn.apply(g[y].context,b)}}return!0},o.prototype.on=function(d,u,c){return n(this,d,u,c,!1)},o.prototype.once=function(d,u,c){return n(this,d,u,c,!0)},o.prototype.removeListener=function(d,u,c,h){var f=t?t+d:d;if(!this._events[f])return this;if(!u)return a(this,f),this;var m=this._events[f];if(m.fn)m.fn===u&&(!h||m.once)&&(!c||m.context===c)&&a(this,f);else{for(var p=0,g=[],v=m.length;p<v;p++)(m[p].fn!==u||h&&!m[p].once||c&&m[p].context!==c)&&g.push(m[p]);g.length?this._events[f]=g.length===1?g[0]:g:a(this,f)}return this},o.prototype.removeAllListeners=function(d){var u;return d?(u=t?t+d:d,this._events[u]&&a(this,u)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=t,o.EventEmitter=o,i.exports=o})(_v);var qS=_v.exports,sf=gA(qS);class Av{constructor(e,t,r,s){this.error=null,this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0;const n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=r,this.onFlush=s;const a=(d,u)=>{u=u||{},u.frag=this.frag,u.id=this.id,d===E.ERROR&&(this.error=u.error),this.hls.trigger(d,u)};this.observer=new sf,this.observer.on(E.FRAG_DECRYPTED,a),this.observer.on(E.ERROR,a);const o=_s(n.preferManagedMediaSource)||{isTypeSupported:()=>!1},l={mpeg:o.isTypeSupported("audio/mpeg"),mp3:o.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:o.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&typeof Worker<"u"&&(n.workerPath||hS())){try{n.workerPath?(R.log(`loading Web Worker ${n.workerPath} for "${t}"`),this.workerContext=mS(n.workerPath)):(R.log(`injecting Web Worker for "${t}"`),this.workerContext=fS()),this.onwmsg=c=>this.onWorkerMessage(c);const{worker:u}=this.workerContext;u.addEventListener("message",this.onwmsg),u.onerror=c=>{const h=new Error(`${c.message} (${c.filename}:${c.lineno})`);n.enableWorker=!1,R.warn(`Error in "${t}" Web Worker, fallback to inline`),this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:O.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:h})},u.postMessage({cmd:"init",typeSupported:l,vendor:"",id:t,config:JSON.stringify(n)})}catch(u){R.warn(`Error setting up "${t}" Web Worker, fallback to inline`,u),this.resetWorker(),this.error=null,this.transmuxer=new xp(this.observer,l,n,"",t)}return}this.transmuxer=new xp(this.observer,l,n,"",t)}resetWorker(){if(this.workerContext){const{worker:e,objectURL:t}=this.workerContext;t&&self.URL.revokeObjectURL(t),e.removeEventListener("message",this.onwmsg),e.onerror=null,e.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(e,t,r,s,n,a,o,l,d,u){var c,h;d.transmuxing.start=self.performance.now();const{transmuxer:f}=this,m=a?a.start:n.start,p=n.decryptdata,g=this.frag,v=!(g&&n.cc===g.cc),b=!(g&&d.level===g.level),y=g?d.sn-g.sn:-1,A=this.part?d.part-this.part.index:-1,_=y===0&&d.id>1&&d.id===(g==null?void 0:g.stats.chunkCount),C=!b&&(y===1||y===0&&(A===1||_&&A<=0)),x=self.performance.now();(b||y||n.stats.parsing.start===0)&&(n.stats.parsing.start=x),a&&(A||!C)&&(a.stats.parsing.start=x);const S=!(g&&((c=n.initSegment)==null?void 0:c.url)===((h=g.initSegment)==null?void 0:h.url)),P=new YS(v,C,l,b,m,S);if(!C||v||S){R.log(`[transmuxer-interface, ${n.type}]: Starting new transmux session for sn: ${d.sn} p: ${d.part} level: ${d.level} id: ${d.id} 30 discontinuity: ${v} 31 trackSwitch: ${b} 32 contiguous: ${C}
33 accurateTimeOffset: ${l} 34 timeOffset: ${m} 35 initSegmentChange: ${S}`);const I=new WS(r,s,t,o,u);this.configureTransmuxer(I)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:e,decryptdata:p,chunkMeta:d,state:P},e instanceof ArrayBuffer?[e]:[]);else if(f){const I=f.push(e,p,d,P);Go(I)?(f.async=!0,I.then(M=>{this.handleTransmuxComplete(M)}).catch(M=>{this.transmuxerError(M,d,"transmuxer-interface push error")})):(f.async=!1,this.handleTransmuxComplete(I))}}flush(e){e.transmuxing.start=self.performance.now();const{transmuxer:t}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:e});else if(t){let r=t.flush(e);Go(r)||t.async?(Go(r)||(r=Promise.resolve(r)),r.then(n=>{this.handleFlushResult(n,e)}).catch(n=>{this.transmuxerError(n,e,"transmuxer-interface flush error")})):this.handleFlushResult(r,e)}}transmuxerError(e,t,r){this.hls&&(this.error=e,this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,t){e.forEach(r=>{this.handleTransmuxComplete(r)}),this.onFlush(t)}onWorkerMessage(e){const t=e.data;if(!(t!=null&&t.event)){R.warn(`worker message received with no ${t?"event name":"data"}`);return}const r=this.hls;if(this.hls)switch(t.event){case"init":{var s;const n=(s=this.workerContext)==null?void 0:s.objectURL;n&&self.URL.revokeObjectURL(n);break}case"transmuxComplete":{this.handleTransmuxComplete(t.data);break}case"flush":{this.onFlush(t.data);break}case"workerLog":R[t.data.logType]&&R[t.data.logType](t.data.message);break;default:{t.data=t.data||{},t.data.frag=this.frag,t.data.id=this.id,r.trigger(t.event,t.data);break}}}configureTransmuxer(e){const{transmuxer:t}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:e}):t&&t.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const Rp=100;class jS extends Zh{constructor(e,t,r){super(e,t,r,"[audio-stream-controller]",ie.AUDIO),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(e,{frag:t,id:r,initPTS:s,timescale:n}){if(r==="main"){const a=t.cc;this.initPTS[t.cc]={baseTime:s,timescale:n},this.log(`InitPTS for cc: ${a} found from main: ${s}`),this.videoTrackCC=a,this.state===N.WAITING_INIT_PTS&&this.tick()}}
vendor: 11,308 bytes, line 35
35startLoad(e){if(!this.levels){this.startPosition=e,this.state=N.STOPPED;return}const t=this.lastCurrentTime;this.stopLoad(),this.setInterval(Rp),t>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t,this.state=N.IDLE):(this.loadedmetadata=!1,this.state=N.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}doTick(){switch(this.state){case N.IDLE:this.doTickIdle();break;case N.WAITING_TRACK:{var e;const{levels:r,trackId:s}=this,n=r==null||(e=r[s])==null?void 0:e.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=N.WAITING_INIT_PTS}break}case N.FRAG_LOADING_WAITING_RETRY:{var t;const r=performance.now(),s=this.retryDate;if(!s||r>=s||(t=this.media)!=null&&t.seeking){const{levels:n,trackId:a}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((n==null?void 0:n[a])||null),this.state=N.IDLE}break}case N.WAITING_INIT_PTS:{const r=this.waitingData;if(r){const{frag:s,part:n,cache:a,complete:o}=r;if(this.initPTS[s.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=N.FRAG_LOADING;const l=a.flush(),d={frag:s,part:n,payload:l,networkDetails:null};this._handleFragmentLoadProgress(d),o&&super._handleFragmentLoadComplete(d)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${s.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const l=this.getLoadPosition(),d=Pe.bufferInfo(this.mediaBuffer,l,this.config.maxBufferHole);dc(d.end,this.config.maxFragLookUpTolerance,s)<0&&(this.log(`Waiting fragment cc (${s.cc}) @ ${s.start} cancelled because another fragment at ${d.end} is needed`),this.clearWaitingFragment())}}else this.state=N.IDLE}}this.onTickEnd()}clearWaitingFragment(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=N.IDLE)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){const{hls:e,levels:t,media:r,trackId:s}=this,n=e.config;if(!this.buffering||!r&&(this.startFragRequested||!n.startFragPrefetch)||!(t!=null&&t[s]))return;const a=t[s],o=a.details;if(!o||o.live&&this.levelLastLoaded!==a||this.waitForCdnTuneIn(o)){this.state=N.WAITING_TRACK;return}const l=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,Le.AUDIO,ie.AUDIO));const d=this.getFwdBufferInfo(l,ie.AUDIO);if(d===null)return;if(!this.switchingTrack&&this._streamEnded(d,o)){e.trigger(E.BUFFER_EOS,{type:"audio"}),this.state=N.ENDED;return}const u=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,ie.MAIN),c=d.len,h=this.getMaxBufferLength(u==null?void 0:u.len),f=o.fragments,m=f[0].start,p=this.getLoadPosition(),g=this.flushing?p:d.end;if(this.switchingTrack&&r){const A=p;o.PTSKnown&&A<m&&(d.end>m||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),r.currentTime=m+.05)}if(c>=h&&!this.switchingTrack&&g<f[f.length-1].start)return;let v=this.getNextFragment(g,o),b=!1;if(v&&this.isLoopLoading(v,g)&&(b=!!v.gap,v=this.getNextFragmentLoopLoading(v,o,d,ie.MAIN,h)),!v){this.bufferFlushed=!0;return}const y=u&&v.start>u.end+o.targetduration;if(y||!(u!=null&&u.len)&&d.len){const A=this.getAppendedFrag(v.start,ie.MAIN);if(A===null||(b||(b=!!A.gap||!!y&&u.len===0),y&&!b||b&&d.nextStart&&d.nextStart<A.end))return}this.loadFragment(v,a,g)}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.min(Math.max(t,e),this.config.maxMaxBufferLength):t}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(e,{audioTracks:t}){this.resetTransmuxer(),this.levels=t.map(r=>new Rn(r))}onAudioTrackSwitching(e,t){const r=!!t.url;this.trackId=t.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),r?this.setInterval(Rp):this.resetTransmuxer(),r?(this.switchingTrack=t,this.state=N.IDLE,this.flushAudioIfNeeded(t)):(this.switchingTrack=null,this.bufferedTrack=t,this.state=N.STOPPED),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(e,t){this.mainDetails=t.details,this.cachedTrackLoadedData!==null&&(this.hls.trigger(E.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(e,t){var r;if(this.mainDetails==null){this.cachedTrackLoadedData=t;return}const{levels:s}=this,{details:n,id:a}=t;if(!s){this.warn(`Audio tracks were reset while loading level ${a}`);return}this.log(`Audio track ${a} loaded [${n.startSN},${n.endSN}]${n.lastPartSn?`[part-${n.lastPartSn}-${n.lastPartIndex}]`:""},duration:${n.totalduration}`);const o=s[a];let l=0;if(n.live||(r=o.details)!=null&&r.live){this.checkLiveUpdate(n);const u=this.mainDetails;if(n.deltaUpdateFailed||!u)return;if(!o.details&&n.hasProgramDateTime&&u.hasProgramDateTime)ld(n,u),l=n.fragments[0].start;else{var d;l=this.alignPlaylists(n,o.details,(d=this.levelLastLoaded)==null?void 0:d.details)}}o.details=n,this.levelLastLoaded=o,!this.startFragRequested&&(this.mainDetails||!n.live)&&this.setStartPosition(this.mainDetails||n,l),this.state===N.WAITING_TRACK&&!this.waitForCdnTuneIn(n)&&(this.state=N.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:r,part:s,payload:n}=e,{config:a,trackId:o,levels:l}=this;if(!l){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const d=l[o];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(r.start);return}const c=a.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new Av(this.hls,ie.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[r.cc],m=(t=r.initSegment)==null?void 0:t.data;if(f!==void 0){const g=s?s.index:-1,v=g!==-1,b=new Xh(r.level,r.sn,r.stats.chunkCount,n.byteLength,g,v);h.push(n,m,c,"",r,s,u.totalduration,!1,b,f)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${u.startSN} ,${u.endSN}],track ${o}`);const{cache:p}=this.waitingData=this.waitingData||{frag:r,part:s,cache:new ov,complete:!1};p.push(new Uint8Array(n)),this.waitingVideoCC=this.videoTrackCC,this.state=N.WAITING_INIT_PTS}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(e,t){const r=t.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),t.tracks.video&&(this.videoBuffer=t.tracks.video.buffer||null)}onFragBuffered(e,t){const{frag:r,part:s}=t;if(r.type!==ie.AUDIO){if(!this.loadedmetadata&&r.type===ie.MAIN){const n=this.videoBuffer||this.media;n&&Pe.getBuffered(n).length&&(this.loadedmetadata=!0)}return}if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(r.sn!=="initSegment"){this.fragPrevious=r;const n=this.switchingTrack;n&&(this.bufferedTrack=n,this.switchingTrack=null,this.hls.trigger(E.AUDIO_TRACK_SWITCHED,ft({},n)))}this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=N.ERROR;return}switch(t.details){case O.FRAG_GAP:case O.FRAG_PARSING_ERROR:case O.FRAG_DECRYPT_ERROR:case O.FRAG_LOAD_ERROR:case O.FRAG_LOAD_TIMEOUT:case O.KEY_LOAD_ERROR:case O.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ie.AUDIO,t);break;case O.AUDIO_TRACK_LOAD_ERROR:case O.AUDIO_TRACK_LOAD_TIMEOUT:case O.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_TRACK&&((r=t.context)==null?void 0:r.type)===ge.AUDIO_TRACK&&(this.state=N.IDLE);break;case O.BUFFER_APPEND_ERROR:case O.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="audio")return;if(t.details===O.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case O.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}onBufferFlushing(e,{type:t}){t!==Le.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:t}){if(t!==Le.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===N.ENDED&&(this.state=N.IDLE);const r=this.mediaBuffer||this.media;r&&(this.afterBufferFlushed(r,t,ie.AUDIO),this.tick())}}_handleTransmuxComplete(e){var t;const r="audio",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:d,level:u}=o,{details:c}=u,{audio:h,text:f,id3:m,initSegment:p}=n;if(this.fragContextChanged(l)||!c){this.fragmentTracker.removeFragment(l);return}if(this.state=N.PARSING,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),p!=null&&p.tracks){const g=l.initSegment||l;this._bufferInitSegment(u,p.tracks,g,a),s.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:g,id:r,tracks:p.tracks})}if(h){const{startPTS:g,endPTS:v,startDTS:b,endDTS:y}=h;d&&(d.elementaryStreams[Le.AUDIO]={startPTS:g,endPTS:v,startDTS:b,endDTS:y}),l.setElementaryStreamInfo(Le.AUDIO,g,v,b,y),this.bufferFragmentData(h,l,d,a)}if(m!=null&&(t=m.samples)!=null&&t.length){const g=it({id:r,frag:l,details:c},m);s.trigger(E.FRAG_PARSING_METADATA,g)}if(f){const g=it({id:r,frag:l,details:c},f);s.trigger(E.FRAG_PARSING_USERDATA,g)}}_bufferInitSegment(e,t,r,s){if(this.state!==N.PARSING)return;t.video&&delete t.video;const n=t.audio;if(!n)return;n.id="audio";const a=e.audioCodec;this.log(`Init audio buffer, container:${n.container}, codecs[level/parsed]=[${a}/${n.codec}]`),a&&a.split(",").length===1&&(n.levelCodec=a),this.hls.trigger(E.BUFFER_CODECS,t);const o=n.initSegment;if(o!=null&&o.byteLength){const l={type:"audio",frag:r,part:null,chunkMeta:s,parent:r.type,data:o};this.hls.trigger(E.BUFFER_APPENDING,l)}this.tickImmediate()}loadFragment(e,t,r){const s=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||s===ht.NOT_LOADED||s===ht.PARTIAL){var n;if(e.sn==="initSegment")this._loadInitSegment(e,t);else if((n=t.details)!=null&&n.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=N.WAITING_INIT_PTS;const a=this.mainDetails;a&&a.fragments[0].start!==t.details.fragments[0].start&&ld(t.details,a)}else this.startFragRequested=!0,super.loadFragment(e,t,r)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:t,lang:r,assocLang:s,characteristics:n,audioCodec:a,channels:o}=this.bufferedTrack;
vendor: 4,373 bytes, line 35
35ps({name:t,lang:r,assocLang:s,characteristics:n,audioCodec:a,channels:o},e,Vr)||(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}}completeAudioSwitch(e){const{hls:t}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,t.trigger(E.AUDIO_TRACK_SWITCHED,ft({},e))}}function Sv(i,e){if(i.length!==e.length)return!1;for(let t=0;t<i.length;t++)if(!Fa(i[t].attrs,e[t].attrs))return!1;return!0}function Fa(i,e,t){const r=i["STABLE-RENDITION-ID"];return r&&!t?r===e["STABLE-RENDITION-ID"]:!(t||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>i[s]!==e[s])}function cc(i,e){return e.label.toLowerCase()===i.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(i.lang||"").toLowerCase())}class zS extends zh{constructor(e){super(e,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(E.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.audioTracks||[]}onAudioTrackLoaded(e,t){const{id:r,groupId:s,details:n}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==s){this.warn(`Audio track with id:${r} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Audio track ${r} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.audioGroups||null,s=this.groupIds;let n=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(o=>(s==null?void 0:s.indexOf(o))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(h=>!r||r.indexOf(h.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(h=>h.default)&&(this.selectDefaultTrack=!1),o.forEach((h,f)=>{h.id=f});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.audioPreference;if(!n&&l){const h=Li(l,o,Vr);if(h>-1)n=o[h];else{const f=Li(l,this.tracks);n=this.tracks[f]}}let d=this.findTrackId(n);d===-1&&n&&(d=this.findTrackId(null));const u={audioTracks:o};this.log(`Updating audio tracks, ${o.length} track(s) found in group(s): ${r==null?void 0:r.join(",")}`),this.hls.trigger(E.AUDIO_TRACKS_UPDATED,u);const c=this.trackId;if(d!==-1&&c===-1)this.setAudioTrack(d);else if(o.length&&c===-1){var a;const h=new Error(`No audio track selected for current audio group-ID(s): ${(a=this.groupIds)==null?void 0:a.join(",")} track count: ${o.length}`);this.warn(h.message),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:h})}}else this.shouldReloadPlaylist(n)&&this.setAudioTrack(this.trackId)}onError(e,t){t.fatal||!t.context||t.context.type===ge.AUDIO_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&(this.requestScheduled=-1,this.checkRetry(t))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const t=this.hls;if(t.config.audioPreference=e,e){const r=this.allAudioTracks;
vendor: 73,087 bytes, lines 35-46
35if(this.selectDefaultTrack=!1,r.length){const s=this.currentTrack;if(s&&ps(e,s,Vr))return s;const n=Li(e,this.tracksInGroup,Vr);if(n>-1){const a=this.tracksInGroup[n];return this.setAudioTrack(n),a}else if(s){let a=t.loadLevel;a===-1&&(a=t.firstAutoLevel);const o=z1(e,t.levels,r,a,Vr);if(o===-1)return null;t.nextLoadLevel=o}if(e.channels||e.audioCodec){const a=Li(e,r);if(a>-1)return r[a]}}}return null}setAudioTrack(e){const t=this.tracksInGroup;if(e<0||e>=t.length){this.warn(`Invalid audio track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,s=t[e],n=s.details&&!s.details.live;if(e===this.trackId&&s===r&&n||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(E.AUDIO_TRACK_SWITCHING,ft({},s)),n))return;const a=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(a)}findTrackId(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const s=t[r];if(!(this.selectDefaultTrack&&!s.default)&&(!e||ps(e,s,Vr)))return r}if(e){const{name:r,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:l}=e;for(let d=0;d<t.length;d++){const u=t[d];if(ps({name:r,lang:s,assocLang:n,characteristics:a,audioCodec:o,channels:l},u,Vr))return d}for(let d=0;d<t.length;d++){const u=t[d];if(Fa(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<t.length;d++){const u=t[d];if(Fa(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){super.loadPlaylist();const r=t.id,s=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`loading audio-track playlist ${r} "${t.name}" lang:${t.lang} group:${s}`),this.clearTimer(),this.hls.trigger(E.AUDIO_TRACK_LOADING,{url:n,id:r,groupId:s,deliveryDirectives:e||null})}}}const Lp=500;class XS extends Zh{constructor(e,t,r){super(e,t,r,"[subtitle-stream-controller]",ie.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.ERROR,this.onError,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.ERROR,this.onError,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(e){this.stopLoad(),this.state=N.IDLE,this.setInterval(Lp),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){const{frag:r,success:s}=t;if(this.fragPrevious=r,this.state=N.IDLE,!s)return;const n=this.tracksBuffered[this.currentTrackId];if(!n)return;let a;const o=r.start;for(let d=0;d<n.length;d++)if(o>=n[d].start&&o<=n[d].end){a=n[d];break}const l=r.start+r.duration;a?a.end=l:(a={start:o,end:l},n.push(a)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(e,t){const{startOffset:r,endOffset:s}=t;if(r===0&&s!==Number.POSITIVE_INFINITY){const n=s-1;if(n<=0)return;t.endOffsetSubtitles=Math.max(0,n),this.tracksBuffered.forEach(a=>{for(let o=0;o<a.length;){if(a[o].end<=n){a.shift();continue}else if(a[o].start<n)a[o].start=n;else break;o++}}),this.fragmentTracker.removeFragmentsInRange(r,n,ie.SUBTITLE)}}onFragBuffered(e,t){if(!this.loadedmetadata&&t.frag.type===ie.MAIN){var r;(r=this.media)!=null&&r.buffered.length&&(this.loadedmetadata=!0)}}onError(e,t){const r=t.frag;(r==null?void 0:r.type)===ie.SUBTITLE&&(t.details===O.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==N.STOPPED&&(this.state=N.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:t}){if(this.levels&&Sv(this.levels,t)){this.levels=t.map(r=>new Rn(r));return}this.tracksBuffered=[],this.levels=t.map(r=>{const s=new Rn(r);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,ie.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var r;if(this.currentTrackId=t.id,!((r=this.levels)!=null&&r.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.setInterval(Lp)}onSubtitleTrackLoaded(e,t){var r;const{currentTrackId:s,levels:n}=this,{details:a,id:o}=t;if(!n){this.warn(`Subtitle tracks were reset while loading level ${o}`);return}const l=n[o];if(o>=n.length||!l)return;this.log(`Subtitle track ${o} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""},duration:${a.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(a.live||(r=l.details)!=null&&r.live){const c=this.mainDetails;if(a.deltaUpdateFailed||!c)return;const h=c.fragments[0];if(!l.details)a.hasProgramDateTime&&c.hasProgramDateTime?(ld(a,c),d=a.fragments[0].start):h&&(d=h.start,lc(a,d));else{var u;d=this.alignPlaylists(a,l.details,(u=this.levelLastLoaded)==null?void 0:u.details),d===0&&h&&(d=h.start,lc(a,d))}}l.details=a,this.levelLastLoaded=l,o===s&&(!this.startFragRequested&&(this.mainDetails||!a.live)&&this.setStartPosition(this.mainDetails||a,d),this.tick(),a.live&&!this.fragCurrent&&this.media&&this.state===N.IDLE&&(od(null,a.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),l.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:t,payload:r}=e,s=t.decryptdata,n=this.hls;if(!this.fragContextChanged(t)&&r&&r.byteLength>0&&s!=null&&s.key&&s.iv&&s.method==="AES-128"){const a=performance.now();this.decrypter.decrypt(new Uint8Array(r),s.key.buffer,s.iv.buffer).catch(o=>{throw n.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:t}),o}).then(o=>{const l=performance.now();n.trigger(E.FRAG_DECRYPTED,{frag:t,payload:o,stats:{tstart:a,tdecrypt:l}})}).catch(o=>{this.warn(`${o.name}: ${o.message}`),this.state=N.IDLE})}}doTick(){if(!this.media){this.state=N.IDLE;return}if(this.state===N.IDLE){const{currentTrackId:e,levels:t}=this,r=t==null?void 0:t[e];if(!r||!t.length||!r.details)return;const{config:s}=this,n=this.getLoadPosition(),a=Pe.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],n,s.maxBufferHole),{end:o,len:l}=a,d=this.getFwdBufferInfo(this.media,ie.MAIN),u=r.details,c=this.getMaxBufferLength(d==null?void 0:d.len)+u.levelTargetDuration;if(l>c)return;const h=u.fragments,f=h.length,m=u.edge;let p=null;const g=this.fragPrevious;if(o<m){const v=s.maxFragLookUpTolerance,b=o>m-v?0:v;p=od(g,h,Math.max(h[0].start,o),b),!p&&g&&g.start<h[0].start&&(p=h[0])}else p=h[f-1];if(!p)return;if(p=this.mapToInitFragWhenRequired(p),p.sn!=="initSegment"){const v=p.sn-u.startSN,b=h[v-1];b&&b.cc===p.cc&&this.fragmentTracker.getState(b)===ht.NOT_LOADED&&(p=b)}this.fragmentTracker.getState(p)===ht.NOT_LOADED&&this.loadFragment(p,r,o)}}getMaxBufferLength(e){const t=super.getMaxBufferLength();return e?Math.max(t,e):t}loadFragment(e,t,r){this.fragCurrent=e,e.sn==="initSegment"?this._loadInitSegment(e,t):(this.startFragRequested=!0,super.loadFragment(e,t,r))}get mediaBufferTimeRanges(){return new QS(this.tracksBuffered[this.currentTrackId]||[])}}class QS{constructor(e){this.buffered=void 0;const t=(r,s,n)=>{if(s=s>>>0,s>n-1)throw new DOMException(`Failed to execute '${r}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${n})`);return e[s][r]};this.buffered={get length(){return e.length},end(r){return t("end",r,e.length)},start(r){return t("start",r,e.length)}}}}class ZS extends zh{constructor(e){super(e,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const r=Uo(this.media.textTracks);for(let n=0;n<r.length;n++)if(r[n].mode==="hidden")t=r[n];else if(r[n].mode==="showing"){t=r[n];break}const s=this.findTrackForTextTrack(t);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(E.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(E.ERROR,this.onError,this)}onMediaAttached(e,t){this.media=t.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(){if(!this.media)return;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Uo(this.media.textTracks).forEach(t=>{nn(t)}),this.subtitleTrack=-1,this.media=null}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,t){this.tracks=t.subtitleTracks}onSubtitleTrackLoaded(e,t){const{id:r,groupId:s,details:n}=t,a=this.tracksInGroup[r];if(!a||a.groupId!==s){this.warn(`Subtitle track with id:${r} and group:${s} not found in active group ${a==null?void 0:a.groupId}`);return}const o=a.details;a.details=t.details,this.log(`Subtitle track ${r} "${a.name}" lang:${a.lang} group:${s} loaded [${n.startSN}-${n.endSN}]`),r===this.trackId&&this.playlistLoaded(r,t,o)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){const t=this.hls.levels[e];if(!t)return;const r=t.subtitleGroups||null,s=this.groupIds;let n=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(a=>(s==null?void 0:s.indexOf(a))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const a=this.tracks.filter(u=>!r||r.indexOf(u.groupId)!==-1);if(a.length)this.selectDefaultTrack&&!a.some(u=>u.default)&&(this.selectDefaultTrack=!1),a.forEach((u,c)=>{u.id=c});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=a;const o=this.hls.config.subtitlePreference;if(!n&&o){this.selectDefaultTrack=!1;const u=Li(o,a);if(u>-1)n=a[u];else{const c=Li(o,this.tracks);n=this.tracks[c]}}let l=this.findTrackId(n);l===-1&&n&&(l=this.findTrackId(null));const d={subtitleTracks:a};this.log(`Updating subtitle tracks, ${a.length} track(s) found in "${r==null?void 0:r.join(",")}" group-id`),this.hls.trigger(E.SUBTITLE_TRACKS_UPDATED,d),l!==-1&&this.trackId===-1&&this.setSubtitleTrack(l)}else this.shouldReloadPlaylist(n)&&this.setSubtitleTrack(this.trackId)}findTrackId(e){const t=this.tracksInGroup,r=this.selectDefaultTrack;for(let s=0;s<t.length;s++){const n=t[s];if(!(r&&!n.default||!r&&!e)&&(!e||ps(n,e)))return s}if(e){for(let s=0;s<t.length;s++){const n=t[s];if(Fa(e.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<t.length;s++){const n=t[s];if(Fa(e.attrs,n.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const t=this.tracksInGroup;for(let r=0;r<t.length;r++){const s=t[r];if(cc(s,e))return r}}return-1}onError(e,t){t.fatal||!t.context||t.context.type===ge.SUBTITLE_TRACK&&t.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(t.context.groupId)!==-1)&&this.checkRetry(t)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){const t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){const r=this.currentTrack;if(r&&ps(e,r))return r;const s=Li(e,this.tracksInGroup);if(s>-1){const n=this.tracksInGroup[s];return this.setSubtitleTrack(s),n}else{if(r)return null;{const n=Li(e,t);if(n>-1)return t[n]}}}}return null}loadPlaylist(e){super.loadPlaylist();const t=this.currentTrack;if(this.shouldLoadPlaylist(t)&&t){const r=t.id,s=t.groupId;let n=t.url;if(e)try{n=e.addDirectives(n)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}this.log(`Loading subtitle playlist for id ${r}`),this.hls.trigger(E.SUBTITLE_TRACK_LOADING,{url:n,id:r,groupId:s,deliveryDirectives:e||null})}}toggleTrackModes(){const{media:e}=this;if(!e)return;const t=Uo(e.textTracks),r=this.currentTrack;let s;if(r&&(s=t.filter(n=>cc(r,n))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(t).forEach(n=>{n.mode!=="disabled"&&n!==s&&(n.mode="disabled")}),s){const n=this.subtitleDisplay?"showing":"hidden";s.mode!==n&&(s.mode=n)}}setSubtitleTrack(e){const t=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=t.length||!q(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,s=t[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:e});return}const n=!!s.details&&!s.details.live;if(e===this.trackId&&s===r&&n)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:a,groupId:o="",name:l,type:d,url:u}=s;this.hls.trigger(E.SUBTITLE_TRACK_SWITCH,{id:a,groupId:o,name:l,type:d,url:u});const c=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(c)}}class JS{constructor(e){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=e}append(e,t,r){const s=this.queues[t];s.push(e),s.length===1&&!r&&this.executeNext(t)}insertAbort(e,t){this.queues[t].unshift(e),this.executeNext(t)}appendBlocker(e){let t;const r=new Promise(n=>{t=n}),s={execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(s,e),r}executeNext(e){const t=this.queues[e];if(t.length){const r=t[0];try{r.execute()}catch(s){R.warn(`[buffer-operation-queue]: Exception executing "${e}" SourceBuffer operation: ${s}`),r.onError(s);const n=this.buffers[e];n!=null&&n.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues[e].shift(),this.executeNext(e)}current(e){return this.queues[e][0]}}const Ip=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;class ex{constructor(e){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=r=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=r=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:r,mediaSource:s}=this;this.log("Media source opened"),r&&(r.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(E.MEDIA_ATTACHED,{media:r,mediaSource:s})),s&&s.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:r,_objectUrl:s}=this;r!==s&&R.error(`Media element src was set while attaching MediaSource (${s} > ${r})`)},this.hls=e;const t="[buffer-controller]";this.appendSource=d1(_s(e.config.preferManagedMediaSource)),this.log=R.log.bind(R,t),this.warn=R.warn.bind(R,t),this.error=R.error.bind(R,t),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:e}=this;e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.BUFFER_RESET,this.onBufferReset,this),e.on(E.BUFFER_APPENDING,this.onBufferAppending,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.BUFFER_EOS,this.onBufferEos,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(E.FRAG_PARSED,this.onFragParsed,this),e.on(E.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.BUFFER_RESET,this.onBufferReset,this),e.off(E.BUFFER_APPENDING,this.onBufferAppending,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.BUFFER_EOS,this.onBufferEos,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(E.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(E.FRAG_PARSED,this.onFragParsed,this),e.off(E.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new JS(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,t){let r=2;(t.audio&&!t.video||!t.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(e,t){const r=this.media=t.media,s=_s(this.appendSource);if(r&&s){var n;const a=this.mediaSource=new s;this.log(`created media source: ${(n=a.constructor)==null?void 0:n.name}`),a.addEventListener("sourceopen",this._onMediaSourceOpen),a.addEventListener("sourceended",this._onMediaSourceEnded),a.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(a.addEventListener("startstreaming",this._onStartStreaming),a.addEventListener("endstreaming",this._onEndStreaming));const o=this._objectUrl=self.URL.createObjectURL(a);if(this.appendSource)try{r.removeAttribute("src");const l=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||l&&a instanceof l,kp(r),tx(r,o),r.load()}catch{r.src=o}else r.src=o;r.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:e,mediaSource:t,_objectUrl:r}=this;if(t){if(this.log("media source detaching"),t.readyState==="open")try{t.endOfStream()}catch(s){this.warn(`onMediaDetaching: ${s.message} while calling endOfStream`)}this.onBufferReset(),t.removeEventListener("sourceopen",this._onMediaSourceOpen),t.removeEventListener("sourceended",this._onMediaSourceEnded),t.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.removeEventListener("startstreaming",this._onStartStreaming),t.removeEventListener("endstreaming",this._onEndStreaming)),e&&(e.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(e.removeAttribute("src"),this.appendSource&&kp(e),e.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(E.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach(e=>{this.resetBuffer(e)}),this._initSourceBuffer(),this.hls.resumeBuffering()}resetBuffer(e){const t=this.sourceBuffer[e];try{if(t){var r;this.removeBufferListeners(e),this.sourceBuffer[e]=void 0,(r=this.mediaSource)!=null&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(t)}}catch(s){this.warn(`onBufferReset ${e}`,s)}}onBufferCodecs(e,t){const r=this.getSourceBufferTypes().length,s=Object.keys(t);if(s.forEach(a=>{if(r){const l=this.tracks[a];if(l&&typeof l.buffer.changeType=="function"){var o;const{id:d,codec:u,levelCodec:c,container:h,metadata:f}=t[a],m=Xm(l.codec,l.levelCodec),p=m==null?void 0:m.replace(Ip,"$1");let g=Xm(u,c);const v=(o=g)==null?void 0:o.replace(Ip,"$1");if(g&&p!==v){a.slice(0,5)==="audio"&&(g=rd(g,this.appendSource));const b=`${h};codecs=${g}`;this.appendChangeType(a,b),this.log(`switching codec ${m} to ${g}`),this.tracks[a]={buffer:l.buffer,codec:u,container:h,levelCodec:c,metadata:f,id:d}}}}else this.pendingTracks[a]=t[a]}),r)return;const n=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==n&&(this.log(`${n} bufferCodec event(s) expected ${s.join(",")}`),this.bufferCodecEventsExpected=n),this.mediaSource&&this.mediaSource.readyState==="open"&&this.checkPendingTracks()}appendChangeType(e,t){const{operationQueue:r}=this,s={execute:()=>{const n=this.sourceBuffer[e];n&&(this.log(`changing ${e} sourceBuffer type to ${t}`),n.changeType(t)),r.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:n=>{this.warn(`Failed to change ${e} SourceBuffer type`,n)}};r.append(s,e,!!this.pendingTracks[e])}onBufferAppending(e,t){const{hls:r,operationQueue:s,tracks:n}=this,{data:a,type:o,frag:l,part:d,chunkMeta:u}=t,c=u.buffering[o],h=self.performance.now();c.start=h;const f=l.stats.buffering,m=d?d.stats.buffering:null;f.start===0&&(f.start=h),m&&m.start===0&&(m.start=h);const p=n.audio;let g=!1;o==="audio"&&(p==null?void 0:p.container)==="audio/mpeg"&&(g=!this.lastMpegAudioChunk||u.id===1||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const v=l.start,b={execute:()=>{if(c.executeStart=self.performance.now(),g){const y=this.sourceBuffer[o];if(y){const A=v-y.timestampOffset;Math.abs(A)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${v} (delta: ${A}) sn: ${l.sn})`),y.timestampOffset=v)}}this.appendExecutor(a,o)},onStart:()=>{},onComplete:()=>{const y=self.performance.now();c.executeEnd=c.end=y,f.first===0&&(f.first=y),m&&m.first===0&&(m.first=y);const{sourceBuffer:A}=this,_={};for(const C in A)_[C]=Pe.getBuffered(A[C]);this.appendErrors[o]=0,o==="audio"||o==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(E.BUFFER_APPENDED,{type:o,frag:l,part:d,chunkMeta:u,parent:l.type,timeRanges:_})},onError:y=>{const A={type:re.MEDIA_ERROR,parent:l.type,details:O.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:d,chunkMeta:u,error:y,err:y,fatal:!1};if(y.code===DOMException.QUOTA_EXCEEDED_ERR)A.details=O.BUFFER_FULL_ERROR;else{const _=++this.appendErrors[o];A.details=O.BUFFER_APPEND_ERROR,this.warn(`Failed ${_}/${r.config.appendErrorMaxRetry} times to append segment in "${o}" sourceBuffer`),_>=r.config.appendErrorMaxRetry&&(A.fatal=!0)}r.trigger(E.ERROR,A)}};s.append(b,o,!!this.pendingTracks[o])}onBufferFlushing(e,t){const{operationQueue:r}=this,s=n=>({execute:this.removeExecutor.bind(this,n,t.startOffset,t.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(E.BUFFER_FLUSHED,{type:n})},onError:a=>{this.warn(`Failed to remove from ${n} SourceBuffer`,a)}});t.type?r.append(s(t.type),t.type):this.getSourceBufferTypes().forEach(n=>{r.append(s(n),n)})}onFragParsed(e,t){const{frag:r,part:s}=t,n=[],a=s?s.elementaryStreams:r.elementaryStreams;a[Le.AUDIOVIDEO]?n.push("audiovideo"):(a[Le.AUDIO]&&n.push("audio"),a[Le.VIDEO]&&n.push("video"));const o=()=>{const l=self.performance.now();r.stats.buffering.end=l,s&&(s.stats.buffering.end=l);const d=s?s.stats:r.stats;this.hls.trigger(E.FRAG_BUFFERED,{frag:r,part:s,stats:d,id:r.type})};n.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers(o,n)}onFragChanged(e,t){this.trimBuffers()}onBufferEos(e,t){this.getSourceBufferTypes().reduce((s,n)=>{const a=this.sourceBuffer[n];return a&&(!t.type||t.type===n)&&(a.ending=!0,a.ended||(a.ended=!0,this.log(`${n} sourceBuffer now EOS`))),s&&!!(!a||a.ended)},!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers(()=>{this.getSourceBufferTypes().forEach(n=>{const a=this.sourceBuffer[n];a&&(a.ending=!1)});const{mediaSource:s}=this;if(!s||s.readyState!=="open"){s&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${s.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),s.endOfStream()}))}onLevelUpdated(e,{details:t}){t.fragments.length&&(this.details=t,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:e,details:t,media:r}=this;if(!r||t===null||!this.getSourceBufferTypes().length)return;const n=e.config,a=r.currentTime,o=t.levelTargetDuration,l=t.live&&n.liveBackBufferLength!==null?n.liveBackBufferLength:n.backBufferLength;if(q(l)&&l>0){const d=Math.max(l,o),u=Math.floor(a/o)*o-d;this.flushBackBuffer(a,o,u)}if(q(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const d=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),u=Math.max(d,o),c=Math.floor(a/o)*o+u;this.flushFrontBuffer(a,o,c)}}flushBackBuffer(e,t,r){const{details:s,sourceBuffer:n}=this;this.getSourceBufferTypes().forEach(o=>{const l=n[o];if(l){const d=Pe.getBuffered(l);if(d.length>0&&r>d.start(0)){if(this.hls.trigger(E.BACK_BUFFER_REACHED,{bufferEnd:r}),s!=null&&s.live)this.hls.trigger(E.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(l.ended&&d.end(d.length-1)-e<t*2){this.log(`Cannot flush ${o} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:o})}}})}flushFrontBuffer(e,t,r){const{sourceBuffer:s}=this;this.getSourceBufferTypes().forEach(a=>{const o=s[a];if(o){const l=Pe.getBuffered(o),d=l.length;if(d<2)return;const u=l.start(d-1),c=l.end(d-1);if(r>u||e>=u&&e<=c)return;if(o.ended&&e-c<2*t){this.log(`Cannot flush ${a} front buffer while SourceBuffer is in ended state`);return}this.hls.trigger(E.BUFFER_FLUSHING,{startOffset:u,endOffset:1/0,type:a})}})}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||this.mediaSource.readyState!=="open")return;const{details:e,hls:t,media:r,mediaSource:s}=this,n=e.fragments[0].start+e.totalduration,a=r.duration,o=q(s.duration)?s.duration:0;e.live&&t.config.liveDurationInfinity?(s.duration=1/0,this.updateSeekableRange(e)):(n>o&&n>a||!q(a))&&(this.log(`Updating Media Source duration to ${n.toFixed(3)}`),s.duration=n)}updateSeekableRange(e){const t=this.mediaSource,r=e.fragments;if(r.length&&e.live&&t!=null&&t.setLiveSeekableRange){const n=Math.max(0,r[0].start),a=Math.max(n,n+e.totalduration);this.log(`Media Source duration is set to ${t.duration}. Setting seekable range to ${n}-${a}.`),t.setLiveSeekableRange(n,a)}}checkPendingTracks(){const{bufferCodecEventsExpected:e,operationQueue:t,pendingTracks:r}=this,s=Object.keys(r).length;if(s&&(!e||s===2||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};const n=this.getSourceBufferTypes();if(n.length)this.hls.trigger(E.BUFFER_CREATED,{tracks:this.tracks}),n.forEach(a=>{t.executeNext(a)});else{const a=new Error("could not create source buffer for media codec(s)");this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:a,reason:a.message})}}}createSourceBuffers(e){const{sourceBuffer:t,mediaSource:r}=this;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(const n in e)if(!t[n]){var s;const a=e[n];if(!a)throw Error(`source buffer exists for track ${n}, however track does not`);let o=((s=a.levelCodec)==null?void 0:s.indexOf(","))===-1?a.levelCodec:a.codec;o&&n.slice(0,5)==="audio"&&(o=rd(o,this.appendSource));const l=`${a.container};codecs=${o}`;this.log(`creating sourceBuffer(${l})`);try{const d=t[n]=r.addSourceBuffer(l),u=n;this.addBufferListener(u,"updatestart",this._onSBUpdateStart),this.addBufferListener(u,"updateend",this._onSBUpdateEnd),this.addBufferListener(u,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(u,"bufferedchange",(c,h)=>{const f=h.removedRanges;f!=null&&f.length&&this.hls.trigger(E.BUFFER_FLUSHED,{type:n})}),this.tracks[n]={buffer:d,codec:o,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(d){this.error(`error while trying to add sourceBuffer: ${d.message}`),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:d,sourceBufferName:n,mimeType:l})}}}get mediaSrc(){var e,t;const r=((e=this.media)==null||(t=e.querySelector)==null?void 0:t.call(e,"source"))||this.media;return r==null?void 0:r.src}_onSBUpdateStart(e){const{operationQueue:t}=this;t.current(e).onStart()}_onSBUpdateEnd(e){var t;if(((t=this.mediaSource)==null?void 0:t.readyState)==="closed"){this.resetBuffer(e);return}const{operationQueue:r}=this;r.current(e).onComplete(),r.shiftAndExecuteNext(e)}_onSBUpdateError(e,t){var r;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(r=this.mediaSource)==null?void 0:r.readyState}`);this.error(`${s}`,t),this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const n=this.operationQueue.current(e);n&&n.onError(s)}removeExecutor(e,t,r){const{media:s,mediaSource:n,operationQueue:a,sourceBuffer:o}=this,l=o[e];if(!s||!n||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),a.shiftAndExecuteNext(e);return}const d=q(s.duration)?s.duration:1/0,u=q(n.duration)?n.duration:1/0,c=Math.max(0,t),h=Math.min(r,d,u);h>c&&(!l.ending||l.ended)?(l.ended=!1,this.log(`Removing [${c},${h}] from the ${e} SourceBuffer`),l.remove(c,h)):a.shiftAndExecuteNext(e)}appendExecutor(e,t){const r=this.sourceBuffer[t];if(!r){if(!this.pendingTracks[t])throw new Error(`Attempting to append to the ${t} SourceBuffer, but it does not exist`);return}r.ended=!1,r.appendBuffer(e)}blockBuffers(e,t=this.getSourceBufferTypes()){if(!t.length){this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);return}const{operationQueue:r}=this,s=t.map(n=>r.appendBlocker(n));Promise.all(s).then(()=>{e(),t.forEach(n=>{const a=this.sourceBuffer[n];a!=null&&a.updating||r.shiftAndExecuteNext(n)})})}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(e,t,r){const s=this.sourceBuffer[e];if(!s)return;const n=r.bind(this,e);this.listeners[e].push({event:t,listener:n}),s.addEventListener(t,n)}removeBufferListeners(e){const t=this.sourceBuffer[e];t&&this.listeners[e].forEach(r=>{t.removeEventListener(r.event,r.listener)})}}function kp(i){const e=i.querySelectorAll("source");[].slice.call(e).forEach(t=>{i.removeChild(t)})}function tx(i,e){const t=self.document.createElement("source");t.type="video/mp4",t.src=e,i.appendChild(t)}const ix={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},xv=i=>String.fromCharCode(ix[i]||i),Jt=15,Fi=100,rx={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},sx={17:2,18:4,21:6,22:8,23:10,19:13,20:15},nx={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},ax={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ox=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class lx{constructor(){this.time=null,this.verboseLevel=0}log(e,t){if(this.verboseLevel>=e){const r=typeof t=="function"?t():t;R.log(`${this.time} [${e}] ${r}`)}}}const $r=function(e){const t=[];for(let r=0;r<e.length;r++)t.push(e[r].toString(16));return t};class Rv{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const t=["foreground","underline","italics","background","flash"];for(let r=0;r<t.length;r++){const s=t[r];e.hasOwnProperty(s)&&(this[s]=e[s])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class dx{constructor(){this.uchar=" ",this.penState=new Rv}reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.copy(t)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}}class ux{constructor(e){this.chars=[],this.pos=0,this.currPenState=new Rv,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Fi;t++)this.chars.push(new dx);this.logger=e}equals(e){for(let t=0;t<Fi;t++)if(!this.chars[t].equals(e.chars[t]))return!1;return!0}copy(e){for(let t=0;t<Fi;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=!0;for(let t=0;t<Fi;t++)if(!this.chars[t].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Fi&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Fi)}moveCursor(e){const t=this.pos+e;if(e>1)for(let r=this.pos+1;r<t+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const t=xv(e);if(this.pos>=Fi){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<Fi;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let t=!0;for(let r=0;r<Fi;r++){const s=this.chars[r].uchar;s!==" "&&(t=!1),e.push(s)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}}class xu{constructor(e){this.rows=[],this.currRow=Jt-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<Jt;t++)this.rows.push(new ux(e));this.logger=e}reset(){for(let e=0;e<Jt;e++)this.rows[e].clear();this.currRow=Jt-1}equals(e){let t=!0;for(let r=0;r<Jt;r++)if(!this.rows[r].equals(e.rows[r])){t=!1;break}return t}copy(e){for(let t=0;t<Jt;t++)this.rows[t].copy(e.rows[t])}isEmpty(){let e=!0;for(let t=0;t<Jt;t++)if(!this.rows[t].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+JSON.stringify(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let o=0;o<Jt;o++)this.rows[o].clear();const n=this.currRow+1-this.nrRollUpRows,a=this.lastOutputScreen;if(a){const o=a.rows[n].cueStartTime,l=this.logger.time;if(o!==null&&l!==null&&o<l)for(let d=0;d<this.nrRollUpRows;d++)this.rows[t-this.nrRollUpRows+d+1].copy(a.rows[n+d])}}this.currRow=t;const r=this.rows[this.currRow];if(e.indent!==null){const n=e.indent,a=Math.max(n-1,0);r.setCursor(e.indent),e.color=r.chars[a].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+JSON.stringify(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,t=this.rows.splice(e,1)[0];t.clear(),this.rows.splice(this.currRow,0,t),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const t=[];let r="",s=-1;for(let n=0;n<Jt;n++){const a=this.rows[n].getTextString();a&&(s=n+1,e?t.push("Row "+s+": '"+a+"'"):t.push(a.trim()))}return t.length>0&&(e?r="["+t.join(" | ")+"]":r=t.join(` 36`)),r}getTextAndFormat(){return this.rows}}class wp{constructor(e,t,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new xu(r),this.nonDisplayedMemory=new xu(r),this.lastOutputScreen=new xu(r),this.currRollUpRow=this.displayedMemory.rows[Jt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Jt-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);const t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const t={flash:!1};if(t.underline=e%2===1,t.italics=e>=46,t.italics)t.foreground="white";else{const r=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];t.foreground=s[r]}this.logger.log(2,"MIDROW: "+JSON.stringify(t)),this.writeScreen.setPen(t)}outputDataUpdate(e=!1){const t=this.logger.time;t!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=t:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:t),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class Dp{constructor(e,t,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=hx(),this.logger=void 0;const s=this.logger=new lx;this.channels=[null,new wp(e,t,s),new wp(e+1,r,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,t){this.channels[e].setHandler(t)}addData(e,t){this.logger.time=e;for(let r=0;r<t.length;r+=2){const s=t[r]&127,n=t[r+1]&127;let a=!1,o=null;if(s===0&&n===0)continue;this.logger.log(3,()=>"["+$r([t[r],t[r+1]])+"] -> ("+$r([s,n])+")");const l=this.cmdHistory;if(s>=16&&s<=31){if(cx(s,n,l)){mo(null,null,l),this.logger.log(3,()=>"Repeated command ("+$r([s,n])+") is dropped");continue}mo(s,n,this.cmdHistory),a=this.parseCmd(s,n),a||(a=this.parseMidrow(s,n)),a||(a=this.parsePAC(s,n)),a||(a=this.parseBackgroundAttributes(s,n))}else mo(null,null,l);if(!a&&(o=this.parseChars(s,n),o)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(o):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!a&&!o&&this.logger.log(2,()=>"Couldn't parse cleaned data "+$r([s,n])+" orig: "+$r([t[r],t[r+1]]))}}parseCmd(e,t){const r=(e===20||e===28||e===21||e===29)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=33&&t<=35;if(!(r||s))return!1;const n=e===20||e===21||e===23?1:2,a=this.channels[n];return e===20||e===21||e===28||e===29?t===32?a.ccRCL():t===33?a.ccBS():t===34?a.ccAOF():t===35?a.ccAON():t===36?a.ccDER():t===37?a.ccRU(2):t===38?a.ccRU(3):t===39?a.ccRU(4):t===40?a.ccFON():t===41?a.ccRDC():t===42?a.ccTR():t===43?a.ccRTD():t===44?a.ccEDM():t===45?a.ccCR():t===46?a.ccENM():t===47&&a.ccEOC():a.ccTO(t-32),this.currentChannel=n,!0}parseMidrow(e,t){let r=0;if((e===17||e===25)&&t>=32&&t<=47){if(e===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[r];return s?(s.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+$r([e,t])+")"),!0):!1}return!1}parsePAC(e,t){let r;const s=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(e===16||e===24)&&t>=64&&t<=95;if(!(s||n))return!1;const a=e<=23?1:2;t>=64&&t<=95?r=a===1?rx[e]:nx[e]:r=a===1?sx[e]:ax[e];const o=this.channels[a];return o?(o.setPAC(this.interpretPAC(r,t)),this.currentChannel=a,!0):!1}interpretPAC(e,t){let r;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return t>95?r=t-96:r=t-64,s.underline=(r&1)===1,r<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((r-16)/2)*4,s}parseChars(e,t){let r,s=null,n=null;if(e>=25?(r=2,n=e-8):(r=1,n=e),n>=17&&n<=19){let a;n===17?a=t+80:n===18?a=t+112:a=t+144,this.logger.log(2,()=>"Special char '"+xv(a)+"' in channel "+r),s=[a]}else e>=32&&e<=127&&(s=t===0?[e]:[e,t]);return s&&this.logger.log(3,()=>"Char codes = "+$r(s).join(",")),s}parseBackgroundAttributes(e,t){const r=(e===16||e===24)&&t>=32&&t<=47,s=(e===23||e===31)&&t>=45&&t<=47;if(!(r||s))return!1;let n;const a={};e===16||e===24?(n=Math.floor((t-32)/2),a.background=ox[n],t%2===1&&(a.background=a.background+"_semi")):t===45?a.background="transparent":(a.foreground="black",t===47&&(a.underline=!0));const o=e<=23?1:2;return this.channels[o].setBkgData(a),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const t=this.channels[e];t&&t.reset()}mo(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){const r=this.channels[t];r&&r.cueSplitAtTime(e)}}}function mo(i,e,t){t.a=i,t.b=e}function cx(i,e,t){return t.a===i&&t.b===e}function hx(){return{a:null,b:null}}class po{constructor(e,t){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=t}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,r){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var nf=function(){if(xn!=null&&xn.VTTCue)return self.VTTCue;const i=["","lr","rl"],e=["start","middle","end","left","right"];function t(o,l){if(typeof l!="string"||!Array.isArray(o))return!1;const d=l.toLowerCase();return~o.indexOf(d)?d:!1}function r(o){return t(i,o)}function s(o){return t(e,o)}function n(o,...l){let d=1;for(;d<arguments.length;d++){const u=arguments[d];for(const c in u)o[c]=u[c]}return o}function a(o,l,d){const u=this,c={enumerable:!0};u.hasBeenReset=!1;let h="",f=!1,m=o,p=l,g=d,v=null,b="",y=!0,A="auto",_="start",C=50,x="middle",S=50,P="middle";Object.defineProperty(u,"id",n({},c,{get:function(){return h},set:function(I){h=""+I}})),Object.defineProperty(u,"pauseOnExit",n({},c,{get:function(){return f},set:function(I){f=!!I}})),Object.defineProperty(u,"startTime",n({},c,{get:function(){return m},set:function(I){if(typeof I!="number")throw new TypeError("Start time must be set to a number.");m=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",n({},c,{get:function(){return p},set:function(I){if(typeof I!="number")throw new TypeError("End time must be set to a number.");p=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",n({},c,{get:function(){return g},set:function(I){g=""+I,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",n({},c,{get:function(){return v},set:function(I){v=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",n({},c,{get:function(){return b},set:function(I){const M=r(I);if(M===!1)throw new SyntaxError("An invalid or illegal string was specified.");b=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",n({},c,{get:function(){return y},set:function(I){y=!!I,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",n({},c,{get:function(){return A},set:function(I){if(typeof I!="number"&&I!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");A=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",n({},c,{get:function(){return _},set:function(I){const M=s(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");_=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",n({},c,{get:function(){return C},set:function(I){if(I<0||I>100)throw new Error("Position must be between 0 and 100.");C=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",n({},c,{get:function(){return x},set:function(I){const M=s(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");x=M,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",n({},c,{get:function(){return S},set:function(I){if(I<0||I>100)throw new Error("Size must be between 0 and 100.");S=I,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",n({},c,{get:function(){return P},set:function(I){const M=s(I);if(!M)throw new SyntaxError("An invalid or illegal string was specified.");P=M,this.hasBeenReset=!0}})),u.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}();class fx{decode(e,t){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function Lv(i){function e(r,s,n,a){return(r|0)*3600+(s|0)*60+(n|0)+parseFloat(a||0)}const t=i.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return t?parseFloat(t[2])>59?e(t[2],t[3],0,t[4]):e(t[1],t[2],t[3],t[4]):null}class mx{constructor(){this.values=Object.create(null)}set(e,t){!this.get(e)&&t!==""&&(this.values[e]=t)}get(e,t,r){return r?this.has(e)?this.values[e]:t[r]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,r){for(let s=0;s<r.length;++s)if(t===r[s]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){const r=parseFloat(t);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}function Iv(i,e,t,r){const s=r?i.split(r):[i];for(const n in s){if(typeof s[n]!="string")continue;const a=s[n].split(t);if(a.length!==2)continue;const o=a[0],l=a[1];e(o,l)}}const hc=new nf(0,0,""),go=hc.align==="middle"?"middle":"center";function px(i,e,t){const r=i;function s(){const o=Lv(i);if(o===null)throw new Error("Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){const d=new mx;Iv(o,function(h,f){let m;switch(h){case"region":for(let p=t.length-1;p>=0;p--)if(t[p].id===f){d.set(h,t[p].region);break}break;case"vertical":d.alt(h,f,["rl","lr"]);break;case"line":m=f.split(","),d.integer(h,m[0]),d.percent(h,m[0])&&d.set("snapToLines",!1),d.alt(h,m[0],["auto"]),m.length===2&&d.alt("lineAlign",m[1],["start",go,"end"]);break;case"position":m=f.split(","),d.percent(h,m[0]),m.length===2&&d.alt("positionAlign",m[1],["start",go,"end","line-left","line-right","auto"]);break;case"size":d.percent(h,f);break;case"align":d.alt(h,f,["start",go,"end","left","right"]);break}},/:/,/\s/),l.region=d.get("region",null),l.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&hc.line===-1&&(u=-1),l.line=u,l.lineAlign=d.get("lineAlign","start"),l.snapToLines=d.get("snapToLines",!0),l.size=d.get("size",100),l.align=d.get("align",go);let c=d.get("position","auto");c==="auto"&&hc.position===50&&(c=l.align==="start"||l.align==="left"?0:l.align==="end"||l.align==="right"?100:50),l.position=c}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),i.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.slice(3),a(),e.endTime=s(),a(),n(i,e)}function kv(i){return i.replace(/<br(?: \/)?>/gi,` 37`)}class gx{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new fx,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const t=this;e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));function r(){let n=t.buffer,a=0;for(n=kv(n);a<n.length&&n[a]!=="\r"&&n[a]!==` 38`;)++a;const o=n.slice(0,a);return n[a]==="\r"&&++a,n[a]===` 39`&&++a,t.buffer=n.slice(a),o}function s(n){Iv(n,function(a,o){},/:/)}try{let n="";if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;n=r();const o=n.match(/^()?WEBVTT([ \t].*)?$/);if(!(o!=null&&o[0]))throw new Error("Malformed WebVTT signature.");t.state="HEADER"}let a=!1;for(;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;switch(a?a=!1:n=r(),t.state){case"HEADER":/:/.test(n)?s(n):n||(t.state="ID");continue;case"NOTE":n||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){t.state="NOTE";break}if(!n)continue;if(t.cue=new nf(0,0,""),t.state="CUE",n.indexOf("-->")===-1){t.cue.id=n;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{px(n,t.cue,t.regionList)}catch{t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{const o=n.indexOf("-->")!==-1;if(!n||o&&(a=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(t.cue===null)continue;t.cue.text&&(t.cue.text+=` 40`),t.cue.text+=n}continue;case"BADCUE":n||(t.state="ID")}}}catch{t.state==="CUETEXT"&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=` 41 42`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(t){e.onparsingerror&&e.onparsingerror(t)}return e.onflush&&e.onflush(),this}}const vx=/\r\n|\n\r|\n|\r/g,Ru=function(e,t,r=0){return e.slice(r,r+t.length)===t},Ex=function(e){let t=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!q(t)||!q(r)||!q(s)||!q(n))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return t+=1e3*r,t+=60*1e3*s,t+=60*60*1e3*n,t},Lu=function(e){let t=5381,r=e.length;for(;r;)t=t*33^e.charCodeAt(--r);return(t>>>0).toString()};function af(i,e,t){return Lu(i.toString())+Lu(e.toString())+Lu(t)}const yx=function(e,t,r){let s=e[t],n=e[s.prevCC];if(!n||!n.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(a=n)!=null&&a.new;){var a;e.ccOffset+=s.start-n.start,s.new=!1,s=n,n=e[s.prevCC]}e.presentationOffset=r};function bx(i,e,t,r,s,n,a){const o=new gx,l=Di(new Uint8Array(i)).trim().replace(vx,` 43`).split(` 44`),d=[],u=e?US(e.baseTime,e.timescale):0;let c="00:00.000",h=0,f=0,m,p=!0;o.oncue=function(g){const v=t[r];let b=t.ccOffset;const y=(h-u)/9e4;if(v!=null&&v.new&&(f!==void 0?b=t.ccOffset=v.start:yx(t,r,y)),y){if(!e){m=new Error("Missing initPTS for VTT MPEGTS");return}b=y-t.presentationOffset}const A=g.endTime-g.startTime,_=Ht((g.startTime+b-f)*9e4,s*9e4)/9e4;g.startTime=Math.max(_,0),g.endTime=Math.max(_+A,0);const C=g.text.trim();g.text=decodeURIComponent(encodeURIComponent(C)),g.id||(g.id=af(g.startTime,g.endTime,C)),g.endTime>0&&d.push(g)},o.onparsingerror=function(g){m=g},o.onflush=function(){if(m){a(m);return}n(d)},l.forEach(g=>{if(p)if(Ru(g,"X-TIMESTAMP-MAP=")){p=!1,g.slice(16).split(",").forEach(v=>{Ru(v,"LOCAL:")?c=v.slice(6):Ru(v,"MPEGTS:")&&(h=parseInt(v.slice(7)))});try{f=Ex(c)/1e3}catch(v){m=v}return}else g===""&&(p=!1);o.parse(g+` 45`)}),o.flush()}const Iu="stpp.ttml.im1t",wv=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Dv=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Tx={left:"start",center:"center",right:"end",start:"start",end:"end"};function Cp(i,e,t,r){const s=le(new Uint8Array(i),["mdat"]);if(s.length===0){r(new Error("Could not parse IMSC1 mdat"));return}const n=s.map(o=>Di(o)),a=NS(e.baseTime,1,e.timescale);try{n.forEach(o=>t(_x(o,a)))}catch(o){r(o)}}function _x(i,e){const s=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},a=Object.keys(n).reduce((c,h)=>(c[h]=s.getAttribute(`ttp:${h}`)||n[h],c),{}),o=s.getAttribute("xml:space")!=="preserve",l=Mp(ku(s,"styling","style")),d=Mp(ku(s,"layout","region")),u=ku(s,"body","[begin]");return[].map.call(u,c=>{const h=Cv(c,o);if(!h||!c.hasAttribute("begin"))return null;const f=Du(c.getAttribute("begin"),a),m=Du(c.getAttribute("dur"),a);let p=Du(c.getAttribute("end"),a);if(f===null)throw Op(c);if(p===null){if(m===null)throw Op(c);p=f+m}const g=new nf(f-e,p-e,h);g.id=af(g.startTime,g.endTime,g.text);const v=d[c.getAttribute("region")],b=l[c.getAttribute("style")],y=Ax(v,b,l),{textAlign:A}=y;if(A){const _=Tx[A];_&&(g.lineAlign=_),g.align=A}return it(g,y),g}).filter(c=>c!==null)}function ku(i,e,t){const r=i.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(t)):[]}function Mp(i){return i.reduce((e,t)=>{const r=t.getAttribute("xml:id");return r&&(e[r]=t),e},{})}function Cv(i,e){return[].slice.call(i.childNodes).reduce((t,r,s)=>{var n;return r.nodeName==="br"&&s?t+` 46`:(n=r.childNodes)!=null&&n.length?Cv(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}function Ax(i,e,t){const r="http://www.w3.org/ns/ttml#styling";let s=null;const n=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=i!=null&&i.hasAttribute("style")?i.getAttribute("style"):null;return a&&t.hasOwnProperty(a)&&(s=t[a]),n.reduce((o,l)=>{const d=wu(e,r,l)||wu(i,r,l)||wu(s,r,l);return d&&(o[l]=d),o},{})}function wu(i,e,t){return i&&i.hasAttributeNS(e,t)?i.getAttributeNS(e,t):null}function Op(i){return new Error(`Could not parse ttml timestamp ${i}`)}function Du(i,e){if(!i)return null;let t=Lv(i);return t===null&&(wv.test(i)?t=Sx(i,e):Dv.test(i)&&(t=xx(i,e))),t}function Sx(i,e){const t=wv.exec(i),r=(t[4]|0)+(t[5]|0)/e.subFrameRate;return(t[1]|0)*3600+(t[2]|0)*60+(t[3]|0)+r/e.frameRate}function xx(i,e){const t=Dv.exec(i),r=Number(t[1]);switch(t[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}class Rx{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Np(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(E.FRAG_LOADING,this.onFragLoading,this),e.on(E.FRAG_LOADED,this.onFragLoaded,this),e.on(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(E.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(E.FRAG_LOADING,this.onFragLoading,this),e.off(E.FRAG_LOADED,this.onFragLoaded,this),e.off(E.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(E.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(E.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(E.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(E.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const e=new po(this,"textTrack1"),t=new po(this,"textTrack2"),r=new po(this,"textTrack3"),s=new po(this,"textTrack4");this.cea608Parser1=new Dp(1,e,t),this.cea608Parser2=new Dp(3,r,s)}}addCues(e,t,r,s,n){let a=!1;for(let o=n.length;o--;){const l=n[o],d=Lx(l[0],l[1],t,r);if(d>=0&&(l[0]=Math.min(l[0],t),l[1]=Math.max(l[1],r),a=!0,d/(r-t)>.5))return}if(a||n.push([t,r]),this.config.renderTextTracksNatively){const o=this.captionsTracks[e];this.Cues.newCue(o,t,r,s)}else{const o=this.Cues.newCue(null,t,r,s);this.hls.trigger(E.CUES_PARSED,{type:"captions",cues:o,track:e})}}onInitPtsFound(e,{frag:t,id:r,initPTS:s,timescale:n}){const{unparsedVttFrags:a}=this;r==="main"&&(this.initPTS[t.cc]={baseTime:s,timescale:n}),a.length&&(this.unparsedVttFrags=[],a.forEach(o=>{this.onFragLoaded(E.FRAG_LOADED,o)}))}getExistingTrack(e,t){const{media:r}=this;if(r)for(let s=0;s<r.textTracks.length;s++){const n=r.textTracks[s];if(Pp(n,{name:e,lang:t}))return n}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:t,captionsTracks:r,media:s}=this,{label:n,languageCode:a}=t[e],o=this.getExistingTrack(n,a);if(o)r[e]=o,nn(r[e]),Z0(r[e],s);else{const l=this.createTextTrack("captions",n,a);l&&(l[e]=!0,r[e]=l)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const t=this.captionsProperties[e];if(!t)return;const r=t.label,s={_id:e,label:r,kind:"captions",default:t.media?!!t.media.default:!1,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,t,r){const s=this.media;if(s)return s.addTextTrack(e,t,r)}onMediaAttaching(e,t){this.media=t.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:e}=this;Object.keys(e).forEach(t=>{nn(e[t]),delete e[t]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=Np(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const t=e.textTracks;if(t)for(let r=0;r<t.length;r++)nn(t[r])}onSubtitleTracksUpdated(e,t){const r=t.subtitleTracks||[],s=r.some(n=>n.textCodec===Iu);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(Sv(this.tracks,r)){this.tracks=r;return}if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const a=this.media,o=a?Uo(a.textTracks):null;if(this.tracks.forEach((l,d)=>{let u;if(o){let c=null;for(let h=0;h<o.length;h++)if(o[h]&&Pp(o[h],l)){c=o[h],o[h]=null;break}c&&(u=c)}if(u)nn(u);else{const c=Mv(l);u=this.createTextTrack(c,l.name,l.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),o!=null&&o.length){const l=o.filter(d=>d!==null).map(d=>d.label);l.length&&R.warn(`Media element contains unused subtitle tracks: ${l.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const a=this.tracks.map(o=>({label:o.name,kind:o.type.toLowerCase(),default:o.default,subtitleTrack:o}));this.hls.trigger(E.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:a})}}}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(r=>{const s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;const n=`textTrack${s[1]}`,a=this.captionsProperties[n];a&&(a.label=r.name,r.lang&&(a.languageCode=r.lang),a.media=r)})}closedCaptionsForLevel(e){const t=this.hls.levels[e.level];return t==null?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===ie.MAIN){var r,s;const{cea608Parser1:n,cea608Parser2:a,lastSn:o}=this,{cc:l,sn:d}=t.frag,u=(r=(s=t.part)==null?void 0:s.index)!=null?r:-1;n&&a&&(d!==o+1||d===o&&u!==this.lastPartIndex+1||l!==this.lastCc)&&(n.reset(),a.reset()),this.lastCc=l,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,t){const{frag:r,payload:s}=t;if(r.type===ie.SUBTITLE)if(s.byteLength){const n=r.decryptdata,a="stats"in t;if(n==null||!n.encrypted||a){const o=this.tracks[r.level],l=this.vttCCs;l[r.cc]||(l[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),o&&o.textCodec===Iu?this._parseIMSC1(r,s):this._parseVTTs(t)}}else this.hls.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,t){const r=this.hls;Cp(t,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),r.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{R.log(`Failed to parse IMSC1: ${s}`),r.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var t;const{frag:r,payload:s}=e,{initPTS:n,unparsedVttFrags:a}=this,o=n.length-1;if(!n[r.cc]&&o===-1){a.push(e);return}const l=this.hls,d=(t=r.initSegment)!=null&&t.data?Wt(r.initSegment.data,new Uint8Array(s)):s;bx(d,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,u=>{this._appendCues(u,r.level),l.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},u=>{const c=u.message==="Missing initPTS for VTT MPEGTS";c?a.push(e):this._fallbackToIMSC1(r,s),R.log(`Failed to parse VTT cue: ${u}`),!(c&&o>r.cc)&&l.trigger(E.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:u})})}_fallbackToIMSC1(e,t){const r=this.tracks[e.level];r.textCodec||Cp(t,this.initPTS[e.cc],()=>{r.textCodec=Iu,this._parseIMSC1(e,t)},()=>{r.textCodec="wvtt"})}_appendCues(e,t){const r=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[t];if(!s||s.mode==="disabled")return;e.forEach(n=>J0(s,n))}else{const s=this.tracks[t];if(!s)return;const n=s.default?"default":"subtitles"+t;r.trigger(E.CUES_PARSED,{type:"subtitles",cues:e,track:n})}}onFragDecrypted(e,t){const{frag:r}=t;r.type===ie.SUBTITLE&&this.onFragLoaded(E.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){this.initCea608Parsers();const{cea608Parser1:r,cea608Parser2:s}=this;if(!this.enabled||!r||!s)return;const{frag:n,samples:a}=t;if(!(n.type===ie.MAIN&&this.closedCaptionsForLevel(n)==="NONE"))for(let o=0;o<a.length;o++){const l=a[o].bytes;if(l){const d=this.extractCea608Data(l);r.addData(a[o].pts,d[0]),s.addData(a[o].pts,d[1])}}}onBufferFlushing(e,{startOffset:t,endOffset:r,endOffsetSubtitles:s,type:n}){const{media:a}=this;if(!(!a||a.currentTime<r)){if(!n||n==="video"){const{captionsTracks:o}=this;Object.keys(o).forEach(l=>nc(o[l],t,r))}if(this.config.renderTextTracksNatively&&t===0&&s!==void 0){const{textTracks:o}=this;Object.keys(o).forEach(l=>nc(o[l],t,s))}}}extractCea608Data(e){const t=[[],[]],r=e[0]&31;let s=2;for(let n=0;n<r;n++){const a=e[s++],o=127&e[s++],l=127&e[s++];if(o===0&&l===0)continue;if((4&a)!==0){const u=3&a;(u===0||u===1)&&(t[u].push(o),t[u].push(l))}}return t}}function Mv(i){return i.characteristics&&/transcribes-spoken-dialog/gi.test(i.characteristics)&&/describes-music-and-sound/gi.test(i.characteristics)?"captions":"subtitles"}function Pp(i,e){return!!i&&i.kind===Mv(e)&&cc(e,i)}function Lx(i,e,t,r){return Math.min(e,r)-Math.max(i,t)}function Np(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}class of{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.BUFFER_CODECS,this.onBufferCodecs,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(E.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.BUFFER_CODECS,this.onBufferCodecs,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,t){const r=this.hls.levels[t.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,t){this.media=t.media instanceof HTMLVideoElement?t.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,t){const r=this.hls;this.restrictedLevels=[],this.firstLevel=t.firstLevel,r.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onLevelsUpdated(e,t){this.timer&&q(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,t){this.hls.config.capLevelToPlayerSize&&t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const t=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&R.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),t.autoLevelCapping=r,t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}}}getMaxLevel(e){const t=this.hls.levels;if(!t.length)return-1;const r=t.filter((s,n)=>this.isLevelAllowed(s)&&n<=e);return this.clientRect=null,of.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,t={width:0,height:0};if(e){const r=e.getBoundingClientRect();t.width=r.width,t.height=r.height,!t.width&&!t.height&&(t.width=r.right-r.left||e.
46width||0,t.height=r.bottom-r.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return e}isLevelAllowed(e){return!this.restrictedLevels.some(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,t,r){if(!(e!=null&&e.length))return-1;const s=(o,l)=>l?o.width!==l.width||o.height!==l.height:!0;let n=e.length-1;const a=Math.max(t,r);for(let o=0;o<e.length;o+=1){const l=e[o];if((l.width>=a||l.height>=a)&&s(l,e[o+1])){n=o;break}}return n}}class Ix{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){const r=this.hls.config;if(r.capLevelOnFPSDrop){const s=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(e,t,r){const s=performance.now();if(t){if(this.lastTime){const n=s-this.lastTime,a=r-this.lastDroppedFrames,o=t-this.lastDecodedFrames,l=1e3*a/n,d=this.hls;if(d.trigger(E.FPS_DROP,{currentDropped:a,currentDecoded:o,totalDroppedFrames:r}),l>0&&a>d.config.fpsDroppedMonitoringThreshold*o){let u=d.currentLevel;R.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(E.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=t}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}const vo="[eme]";class un{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.setMediaKeysQueue=un.CDMCleanupPromise?[un.CDMCleanupPromise]:[],this.debug=R.debug.bind(R,vo),this.log=R.log.bind(R,vo),this.warn=R.warn.bind(R,vo),this.error=R.error.bind(R,vo),this.onMediaEncrypted=t=>{const{initDataType:r,initData:s}=t,n=`"${t.type}" event: init data type: "${r}"`;if(this.debug(n),s!==null){if(!this.keyFormatPromise){let a=Object.keys(this.keySystemAccessPromises);a.length||(a=ao(this.config));const o=a.map(fu).filter(l=>!!l);this.keyFormatPromise=this.getKeyFormatPromise(o)}this.keyFormatPromise.then(a=>{const o=cu(a);let l,d;if(r==="sinf"){if(o!==Se.FAIRPLAY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${r}" for selected key-system ${o}`);return}const m=st(new Uint8Array(s));try{const p=Wh(JSON.parse(m).sinf),g=q0(p);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=g.subarray(8,24),d=Se.FAIRPLAY}catch(p){this.warn(`${n} Failed to parse sinf: ${p}`);return}}else{if(o!==Se.WIDEVINE&&o!==Se.PLAYREADY){this.warn(`Ignoring unexpected "${t.type}" event with init data type: "${r}" for selected key-system ${o}`);return}const m=n1(s),p=m.filter(v=>!!v.systemId&&hu(v.systemId)===o);p.length>1&&this.warn(`${n} Using first of ${p.length} pssh found for selected key-system ${o}`);const g=p[0];if(!g){m.length===0||m.some(v=>!v.systemId)?this.warn(`${n} contains incomplete or invalid pssh data`):this.log(`ignoring ${n} for ${m.map(v=>hu(v.systemId)).join(",")} pssh data in favor of playlist keys`);return}if(d=hu(g.systemId),g.version===0&&g.data)if(d===Se.WIDEVINE){const v=g.data.length-22;l=g.data.subarray(v,v+16)}else d===Se.PLAYREADY&&(l=$0(g.data))}if(!d||!l){this.log(`Unable to handle ${n} with key-system ${o}`);return}const u=Ti.hexDump(l),{keyIdToKeySessionPromise:c,mediaKeySessions:h}=this;let f=c[u];for(let m=0;m<h.length;m++){const p=h[m],g=p.decryptdata;if(!g.keyId)continue;const v=Ti.hexDump(g.keyId);if(u===v||g.uri.replace(/-/g,"").indexOf(u)!==-1){if(f=c[v],g.pssh)break;delete c[v],g.pssh=new Uint8Array(s),g.keyId=l,f=c[u]=f.then(()=>this.generateRequestWithPreferredKeySession(p,r,s,"encrypted-event-key-match")),f.catch(b=>this.handleError(b));break}}if(!f){if(d!==o){this.log(`Ignoring "${n}" with ${d} init data for selected key-system ${o}`);return}f=c[u]=this.getKeySystemSelectionPromise([d]).then(({keySystem:m,mediaKeys:p})=>{var g;this.throwIfDestroyed();const v=new Na("ISO-23001-7",u,(g=fu(m))!=null?g:"");return v.pssh=new Uint8Array(s),v.keyId=l,this.attemptSetMediaKeys(m,p).then(()=>{this.throwIfDestroyed();const b=this.createMediaKeySessionContext({decryptdata:v,keySystem:m,mediaKeys:p});return this.generateRequestWithPreferredKeySession(b,r,s,"encrypted-event-no-match")})}),f.catch(m=>this.handleError(m))}})}},this.onWaitingForKey=t=>{this.log(`"${t.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}
vendor: 21,653 bytes, lines 46-47
46registerListeners(){this.hls.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(E.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(E.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(E.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(E.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(e){const{drmSystems:t,widevineLicenseUrl:r}=this.config,s=t[e];if(s)return s.licenseUrl;if(e===Se.WIDEVINE&&r)return r}getLicenseServerUrlOrThrow(e){const t=this.getLicenseServerUrl(e);if(t===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return t}getServerCertificateUrl(e){const{drmSystems:t}=this.config,r=t[e];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const t=this.hls.levels,r=(a,o,l)=>!!a&&l.indexOf(a)===o,s=t.map(a=>a.audioCodec).filter(r),n=t.map(a=>a.videoCodec).filter(r);return s.length+n.length===0&&n.push("avc1.42e01e"),new Promise((a,o)=>{const l=d=>{const u=d.shift();this.getMediaKeysPromise(u,s,n).then(c=>a({keySystem:u,mediaKeys:c})).catch(c=>{d.length?l(d):c instanceof Ut?o(c):o(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_NO_ACCESS,error:c,fatal:!0},c.message))})};l(e)})}requestMediaKeySystemAccess(e,t){const{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${r}`;return F0===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return r(e,t)}getMediaKeysPromise(e,t,r){const s=OA(e,t,r,this.config.drmSystemOptions),n=this.keySystemAccessPromises[e];let a=n==null?void 0:n.keySystemAccess;if(!a){this.log(`Requesting encrypted media "${e}" key-system access with config: ${JSON.stringify(s)}`),a=this.requestMediaKeySystemAccess(e,s);const o=this.keySystemAccessPromises[e]={keySystemAccess:a};return a.catch(l=>{this.log(`Failed to obtain access to key-system "${e}": ${l}`)}),a.then(l=>{this.log(`Access for key-system "${l.keySystem}" obtained`);const d=this.fetchServerCertificate(e);return this.log(`Create media-keys for "${e}"`),o.mediaKeys=l.createMediaKeys().then(u=>(this.log(`Media-keys created for "${e}"`),d.then(c=>c?this.setMediaKeysServerCertificate(u,e,c):u))),o.mediaKeys.catch(u=>{this.error(`Failed to create media-keys for "${e}"}: ${u}`)}),o.mediaKeys})}return a.then(()=>n.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:t,mediaKeys:r}){this.log(`Creating key-system session "${t}" keyId: ${Ti.hexDump(e.keyId||[])}`);const s=r.createSession(),n={decryptdata:e,keySystem:t,mediaKeys:r,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(n),n}renewKeySession(e){const t=e.decryptdata;if(t.pssh){const r=this.createMediaKeySessionContext(e),s=this.getKeyIdString(t),n="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(r,n,t.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}getKeyIdString(e){if(!e)throw new Error("Could not read keyId of undefined decryptdata");if(e.keyId===null)throw new Error("keyId is null");return Ti.hexDump(e.keyId)}updateKeySession(e,t){var r;const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyID ${Ti.hexDump(((r=e.decryptdata)==null?void 0:r.keyId)||[])} 47 } (data length: ${t&&t.byteLength})`),s.update(t)}selectKeySystemFormat(e){const t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){return new Promise((t,r)=>{const s=ao(this.config),n=e.map(cu).filter(a=>!!a&&s.indexOf(a)!==-1);return this.getKeySystemSelectionPromise(n).then(({keySystem:a})=>{const o=fu(a);o?t(o):r(new Error(`Unable to find format for key-system "${a}"`))}).catch(r)})}loadKey(e){const t=e.keyInfo.decryptdata,r=this.getKeyIdString(t),s=`(keyId: ${r} format: "${t.keyFormat}" method: ${t.method} uri: ${t.uri})`;this.log(`Starting session for key ${s}`);let n=this.keyIdToKeySessionPromise[r];return n||(n=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(t).then(({keySystem:a,mediaKeys:o})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${s}`),this.attemptSetMediaKeys(a,o).then(()=>{this.throwIfDestroyed();const l=this.createMediaKeySessionContext({keySystem:a,mediaKeys:o,decryptdata:t});return this.generateRequestWithPreferredKeySession(l,"cenc",t.pssh,"playlist-key")}))),n.catch(a=>this.handleError(a))),n}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e){this.hls&&(this.error(e.message),e instanceof Ut?this.hls.trigger(E.ERROR,e.data):this.hls.trigger(E.ERROR,{type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0}))}getKeySystemForKeyPromise(e){const t=this.getKeyIdString(e),r=this.keyIdToKeySessionPromise[t];if(!r){const s=cu(e.keyFormat),n=s?[s]:ao(this.config);return this.attemptKeySystemAccess(n)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=ao(this.config)),e.length===0)throw new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,t){const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(r).then(()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(t)});return this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(n=>r.indexOf(n)===-1)})}generateRequestWithPreferredKeySession(e,t,r,s){var n,a;const o=(n=this.config.drmSystems)==null||(a=n[e.keySystem])==null?void 0:a.generateRequest;if(o)try{const m=o.call(this.hls,t,r,e);if(!m)throw new Error("Invalid response from configured generateRequest filter");t=m.initDataType,r=e.decryptdata.pssh=m.initData?new Uint8Array(m.initData):null}catch(m){var l;if(this.warn(m.message),(l=this.hls)!=null&&l.config.debug)throw m}if(r===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const d=this.getKeyIdString(e.decryptdata);this.log(`Generating key-session request for "${s}": ${d} (init data type: ${t} length: ${r?r.byteLength:null})`);const u=new sf,c=e._onmessage=m=>{const p=e.mediaKeysSession;if(!p){u.emit("error",new Error("invalid state"));return}const{messageType:g,message:v}=m;this.log(`"${g}" message event for session "${p.sessionId}" message size: ${v.byteLength}`),g==="license-request"||g==="license-renewal"?this.renewLicense(e,v).catch(b=>{this.handleError(b),u.emit("error",b)}):g==="license-release"?e.keySystem===Se.FAIRPLAY&&(this.updateKeySession(e,rc("acknowledged")),this.removeSession(e)):this.warn(`unhandled media key message type "${g}"`)},h=e._onkeystatuseschange=m=>{if(!e.mediaKeysSession){u.emit("error",new Error("invalid state"));return}this.onKeyStatusChange(e);const g=e.keyStatus;u.emit("keyStatus",g),g==="expired"&&(this.warn(`${e.keySystem} expired for key ${d}`),this.renewKeySession(e))};e.mediaKeysSession.addEventListener("message",c),e.mediaKeysSession.addEventListener("keystatuseschange",h);const f=new Promise((m,p)=>{u.on("error",p),u.on("keyStatus",g=>{g.startsWith("usable")?m():g==="output-restricted"?p(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):g==="internal-error"?p(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${g}"`)):g==="expired"?p(new Error("key expired while generating request")):this.warn(`unhandled key status change "${g}"`)})});return e.mediaKeysSession.generateRequest(t,r).then(()=>{var m;this.log(`Request generated for key-session "${(m=e.mediaKeysSession)==null?void 0:m.sessionId}" keyId: ${d}`)}).catch(m=>{throw new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_NO_SESSION,error:m,fatal:!1},`Error generating key-session request: ${m}`)}).then(()=>f).catch(m=>{throw u.removeAllListeners(),this.removeSession(e),m}).then(()=>(u.removeAllListeners(),e))}onKeyStatusChange(e){e.mediaKeysSession.keyStatuses.forEach((t,r)=>{this.log(`key status change "${t}" for keyStatuses keyId: ${Ti.hexDump("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${Ti.hexDump(new Uint8Array(e.decryptdata.keyId||[]))} uri: ${e.decryptdata.uri}`),e.keyStatus=t})}fetchServerCertificate(e){const t=this.config,r=t.loader,s=new r(t),n=this.getServerCertificateUrl(e);return n?(this.log(`Fetching server certificate for "${e}"`),new Promise((a,o)=>{const l={responseType:"arraybuffer",url:n},d=t.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{a(h.data)},onError:(h,f,m,p)=>{o(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:ft({url:l.url,data:void 0},h)},`"${e}" certificate request failed (${n}). Status: ${h.code} (${h.text})`))},onTimeout:(h,f,m)=>{o(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:m,response:{url:l.url,data:void 0}},`"${e}" certificate request timed out (${n})`))},onAbort:(h,f,m)=>{o(new Error("aborted"))}};s.load(l,u,c)})):Promise.resolve()}setMediaKeysServerCertificate(e,t,r){return new Promise((s,n)=>{e.setServerCertificate(r).then(a=>{this.log(`setServerCertificate ${a?"success":"not supported by CDM"} (${r==null?void 0:r.byteLength}) on "${t}"`),s(e)}).catch(a=>{n(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:a,fatal:!0},a.message))})})}renewLicense(e,t){return this.requestLicense(e,new Uint8Array(t)).then(r=>this.updateKeySession(e,new Uint8Array(r)).catch(s=>{throw new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:s,fatal:!0},s.message)}))}unpackPlayReadyKeyMessage(e,t){const r=String.fromCharCode.apply(null,new Uint16Array(t.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;const s=new DOMParser().parseFromString(r,"application/xml"),n=s.querySelectorAll("HttpHeader");if(n.length>0){let u;for(let c=0,h=n.length;c<h;c++){var a,o;u=n[c];const f=(a=u.querySelector("name"))==null?void 0:a.textContent,m=(o=u.querySelector("value"))==null?void 0:o.textContent;f&&m&&e.setRequestHeader(f,m)}}const l=s.querySelector("Challenge"),d=l==null?void 0:l.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return rc(atob(d))}setupLicenseXHR(e,t,r,s){const n=this.config.licenseXhrSetup;return n?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return n.call(this.hls,e,t,r,s)}).catch(a=>{if(!r.decryptdata)throw a;return e.open("POST",t,!0),n.call(this.hls,e,t,r,s)}).then(a=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:a||s})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,t){const r=this.config.keyLoadPolicy.default;return new Promise((s,n)=>{const a=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${a}`);const o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(new Error("invalid state"));if(o.readyState===4)if(o.status===200){this._requestLicenseFailureCount=0;let l=o.response;this.log(`License received ${l instanceof ArrayBuffer?l.byteLength:l}`);const d=this.config.licenseResponseCallback;if(d)try{l=d.call(this.hls,o,a,e)}catch(u){this.error(u)}s(l)}else{const l=r.errorRetry,d=l?l.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||o.status>=400&&o.status<500)n(new Ut({type:re.KEY_SYSTEM_ERROR,details:O.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},`License Request XHR failed (${a}). Status: ${o.status} (${o.statusText})`));else{const u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,t).then(s,n)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=o,this.setupLicenseXHR(o,a,e,t).then(({xhr:l,licenseChallenge:d})=>{e.keySystem==Se.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(l,d)),l.send(d)})})}onMediaAttached(e,t){if(!this.config.emeEnabled)return;const r=t.media;this.media=r,r.removeEventListener("encrypted",this.onMediaEncrypted),r.removeEventListener("waitingforkey",this.onWaitingForKey),r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const e=this.media,t=this.mediaKeySessions;e&&(e.removeEventListener("encrypted",this.onMediaEncrypted),e.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Na.clearKeyUriToKeyIdMap();const r=t.length;un.CDMCleanupPromise=Promise.all(t.map(s=>this.removeSession(s)).concat(e==null?void 0:e.setMediaKeys(null).catch(s=>{this.log(`Could not clear media keys: ${s}`)}))).then(()=>{r&&(this.log("finished closing key sessions and clearing media keys"),t.length=0)}).catch(s=>{this.log(`Could not close sessions and clear media keys: ${s}`)})}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:t}){if(!(!t||!this.config.emeEnabled)&&!this.keyFormatPromise){const r=t.reduce((s,n)=>(s.indexOf(n.keyFormat)===-1&&s.push(n.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)}}removeSession(e){const{mediaKeysSession:t,licenseXhr:r}=e;if(t){this.log(`Remove licenses and keys and close session ${t.sessionId}`),e._onmessage&&(t.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(t.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const s=this.mediaKeySessions.indexOf(e);return s>-1&&this.mediaKeySessions.splice(s,1),t.remove().catch(n=>{this.log(`Could not remove session: ${n}`)}).then(()=>t.close()).catch(n=>{this.log(`Could not close session: ${n}`)})}}}un.CDMCleanupPromise=void 0;class Ut extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=new Error(t)),this.data=e,e.err=e.error}}var yt;(function(i){i.MANIFEST="m",i.AUDIO="a",i.VIDEO="v",i.MUXED="av",i.INIT="i",i.CAPTION="c",i.TIMED_TEXT="tt",i.KEY="k",i.OTHER="o"})(yt||(yt={}));var fc;(function(i){i.DASH="d",i.HLS="h",i.SMOOTH="s",i.OTHER="o"})(fc||(fc={}));var ss;(function(i){i.OBJECT="CMCD-Object",i.REQUEST="CMCD-Request",i.SESSION="CMCD-Session",i.STATUS="CMCD-Status"})(ss||(ss={}));const kx={[ss.OBJECT]:["br","d","ot","tb"],[ss.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ss.SESSION]:["cid","pr","sf","sid","st","v"],[ss.STATUS]:["bs","rtp"]};class Ln{constructor(e,t){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map(r=>r instanceof Ln?r:new Ln(r))),this.value=e,this.params=t}}class Ov{constructor(e){this.description=void 0,this.description=e}}const wx="Dict";function Dx(i){return Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":typeof i=="object"?JSON.stringify(i):String(i)}function Cx(i,e,t,r){return new Error(`failed to ${i} "${Dx(e)}" as ${t}`,{cause:r})}const Up="Bare Item",Mx="Boolean",Ox="Byte Sequence",Px="Decimal",Nx="Integer";function Ux(i){return i<-999999999999999||999999999999999<i}const Fx=/[\x00-\x1f\x7f]+/,$x="Token",Bx="Key";function Oi(i,e,t){return Cx("serialize",i,e,t)}function Hx(i){if(typeof i!="boolean")throw Oi(i,Mx);return i?"?1":"?0"}function Gx(i){return btoa(String.fromCharCode(...i))}function Kx(i){if(ArrayBuffer.isView(i)===!1)throw Oi(i,Ox);return`:${Gx(i)}:`}function Pv(i){if(Ux(i))throw Oi(i,Nx);return i.toString()}function Vx(i){return`@${Pv(i.getTime()/1e3)}`}function Nv(i,e){if(i<0)return-Nv(-i,e);const t=Math.pow(10,e);if(Math.abs(i*t%1-.5)<Number.EPSILON){const s=Math.floor(i*t);return(s%2===0?s:s+1)/t}else return Math.round(i*t)/t}function Wx(i){const e=Nv(i,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Oi(i,Px);const t=e.toString();return t.includes(".")?t:`${t}.0`}const Yx="String";function qx(i){if(Fx.test(i))throw Oi(i,Yx);return`"${i.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function jx(i){return i.description||i.toString().slice(7,-1)}function Fp(i){const e=jx(i);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Oi(e,$x);return e}function mc(i){switch(typeof i){case"number":if(!q(i))throw Oi(i,Up);return Number.isInteger(i)?Pv(i):Wx(i);case"string":return qx(i);case"symbol":return Fp(i);case"boolean":return Hx(i);case"object":if(i instanceof Date)return Vx(i);if(i instanceof Uint8Array)return Kx(i);if(i instanceof Ov)return Fp(i);default:throw Oi(i,Up)}}function pc(i){if(/^[a-z*][a-z0-9\-_.*]*$/.test(i)===!1)throw Oi(i,Bx);return i}function lf(i){return i==null?"":Object.entries(i).map(([e,t])=>t===!0?`;${pc(e)}`:`;${pc(e)}=${mc(t)}`).join("")}function Uv(i){return i instanceof Ln?`${mc(i.value)}${lf(i.params)}`:mc(i)}function zx(i){return`(${i.value.map(Uv).join(" ")})${lf(i.params)}`}function Xx(i,e={whitespace:!0}){if(typeof i!="object")throw Oi(i,wx);const t=i instanceof Map?i.entries():Object.entries(i),r=e!=null&&e.whitespace?" ":"";return Array.from(t).map(([s,n])=>{n instanceof Ln||(n=new Ln(n));let a=pc(s);return n.value===!0?a+=lf(n.params):(a+="=",Array.isArray(n.value)?a+=zx(n):a+=Uv(n)),a}).join(`,${r}`)}function Qx(i,e){return Xx(i,e)}const Zx=i=>i==="ot"||i==="sf"||i==="st",Jx=i=>typeof i=="number"?q(i):i!=null&&i!==""&&i!==!1;function eR(i,e){const t=new URL(i),r=new URL(e);if(t.origin!==r.origin)return i;const s=t.pathname.split("/").slice(1),n=r.pathname.split("/").slice(1,-1);for(;s[0]===n[0];)s.shift(),n.shift();for(;n.length;)n.shift(),s.unshift("..");return s.join("/")}function tR(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch{let t=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const n=(t+Math.random()*16)%16|0;return t=Math.floor(t/16),(s=="x"?n:n&3|8).toString(16)})}}}const Ko=i=>Math.round(i),iR=(i,e)=>(e!=null&&e.baseUrl&&(i=eR(i,e.baseUrl)),encodeURIComponent(i)),Eo=i=>Ko(i/100)*100,rR={br:Ko,d:Ko,bl:Eo,dl:Eo,mtp:Eo,nor:iR,rtp:Eo,tb:Ko};function sR(i,e){const t={};if(i==null||typeof i!="object")return t;const r=Object.keys(i).sort(),s=it({},rR,e==null?void 0:e.formatters),n=e==null?void 0:e.filter;return r.forEach(a=>{if(n!=null&&n(a))return;let o=i[a];const l=s[a];l&&(o=l(o,e)),!(a==="v"&&o===1)&&(a=="pr"&&o===1||Jx(o)&&(Zx(a)&&typeof o=="string"&&(o=new Ov(o)),t[a]=o))}),t}function Fv(i,e={}){return i?Qx(sR(i,e),it({whitespace:!1},e)):""}function nR(i,e={}){if(!i)return{};const t=Object.entries(i),r=Object.entries(kx).concat(Object.entries((e==null?void 0:e.customHeaderMap)||{})),s=t.reduce((n,a)=>{var o,l;const[d,u]=a,c=((o=r.find(h=>h[1].includes(d)))==null?void 0:o[0])||ss.REQUEST;return(l=n[c])!=null||(n[c]={}),n[c][d]=u,n},{});return Object.entries(s).reduce((n,[a,o])=>(n[a]=Fv(o,e),n),{})}function aR(i,e,t){return it(i,nR(e,t))}const oR="CMCD";function lR(i,e={}){if(!i)return"";const t=Fv(i,e);return`${oR}=${encodeURIComponent(t)}`}const $p=/CMCD=[^&#]+/;function dR(i,e,t){const r=lR(e,t);if(!r)return i;if($p.test(i))return i.replace($p,r);const s=i.includes("?")?"&":"?";return`${i}${s}${r}`}class uR{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:yt.MANIFEST,su:!this.initialized})}catch(n){R.warn("Could not generate manifest CMCD data.",n)}},this.applyFragmentData=s=>{try{const n=s.frag,a=this.hls.levels[n.level],o=this.getObjectType(n),l={d:n.duration*1e3,ot:o};(o===yt.VIDEO||o===yt.AUDIO||o==yt.MUXED)&&(l.br=a.bitrate/1e3,l.tb=this.getTopBandwidth(o)/1e3,l.bl=this.getBufferLength(o)),this.apply(s,l)}catch(n){R.warn("Could not generate segment CMCD data.",n)}},this.hls=e;const t=this.config=e.config,{cmcd:r}=t;r!=null&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||tR(),this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;
47e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHED,this.onMediaDetached,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHED,this.onMediaDetached,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,t){var r,s;this.audioBuffer=(r=t.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=t.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:fc.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,t={}){it(t,this.createData());const r=t.ot===yt.INIT||t.ot===yt.VIDEO||t.ot===yt.MUXED;this.starved&&r&&(t.bs=!0,t.su=!0,this.starved=!1),t.su==null&&(t.su=this.buffering);const{includeKeys:s}=this;s&&(t=Object.keys(t).reduce((n,a)=>(s.includes(a)&&(n[a]=t[a]),n),{})),this.useHeaders?(e.headers||(e.headers={}),aR(e.headers,t)):e.url=dR(e.url,t)}getObjectType(e){const{type:t}=e;if(t==="subtitle")return yt.TIMED_TEXT;if(e.sn==="initSegment")return yt.INIT;if(t==="audio")return yt.AUDIO;if(t==="main")return this.hls.audioTracks.length?yt.VIDEO:yt.MUXED}getTopBandwidth(e){let t=0,r;const s=this.hls;if(e===yt.AUDIO)r=s.audioTracks;else{const n=s.maxAutoLevel,a=n>-1?n+1:s.levels.length;r=s.levels.slice(0,a)}for(const n of r)n.bitrate>t&&(t=n.bitrate);return t>0?t:NaN}getBufferLength(e){const t=this.hls.media,r=e===yt.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!t?NaN:Pe.bufferInfo(r,t.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,t=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}createFragmentLoader(){const{fLoader:e}=this.config,t=this.applyFragmentData,r=e||this.config.loader;return class{constructor(n){this.loader=void 0,this.loader=new r(n)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(n,a,o){t(n),this.loader.load(n,a,o)}}}}const cR=3e5;class hR{constructor(e){this.hls=void 0,this.log=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this.pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.log=R.log.bind(R,"[content-steering]:"),this.registerListeners()}registerListeners(){const e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const t=this.levels;t&&(this.levels=t.filter(r=>r!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,t){const{contentSteering:r}=t;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){const{errorAction:r}=t;if((r==null?void 0:r.action)===vt.SendAlternateToPenaltyBox&&r.flags===Qt.MoveAllAlternatesMatchingHost){const s=this.levels;let n=this.pathwayPriority,a=this.pathwayId;if(t.context){const{groupId:o,pathwayId:l,type:d}=t.context;o&&s?a=this.getPathwayForGroupId(o,d,a):l&&(a=l)}a in this.penalizedPathways||(this.penalizedPathways[a]=performance.now()),!n&&s&&(n=s.reduce((o,l)=>(o.indexOf(l.pathwayId)===-1&&o.push(l.pathwayId),o),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==a),r.resolved||R.warn(`Could not resolve ${t.details} ("${t.error.message}") with content-steering for Pathway: ${a} levels: ${s&&s.length} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(t.length===0){const r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),t=this.getLevelsForPathway(r),this.pathwayId=r}return t.length!==e.length&&this.log(`Found ${t.length}/${e.length} levels in Pathway "${this.pathwayId}"`),t}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){this.pathwayPriority=e;let t;const r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(n=>{s-r[n]>cR&&delete r[n]});for(let n=0;n<e.length;n++){const a=e[n];if(a in r)continue;if(a===this.pathwayId)return;const o=this.hls.nextLoadLevel,l=this.hls.levels[o];if(t=this.getLevelsForPathway(a),t.length>0){this.log(`Setting Pathway to "${a}"`),this.pathwayId=a,rv(t),this.hls.trigger(E.LEVELS_UPDATED,{levels:t});const d=this.hls.levels[o];l&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==l.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==l.bitrate&&this.log(`Unstable Pathways change from bitrate ${l.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=o);break}}}getPathwayForGroupId(e,t,r){const s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let n=0;n<s.length;n++)if(t===ge.AUDIO_TRACK&&s[n].hasAudioGroup(e)||t===ge.SUBTITLE_TRACK&&s[n].hasSubtitleGroup(e))return s[n].pathwayId;return r}clonePathways(e){const t=this.levels;if(!t)return;const r={},s={};e.forEach(n=>{const{ID:a,"BASE-ID":o,"URI-REPLACEMENT":l}=n;if(t.some(u=>u.pathwayId===a))return;const d=this.getLevelsForPathway(o).map(u=>{const c=new Ke(u.attrs);c["PATHWAY-ID"]=a;const h=c.AUDIO&&`${c.AUDIO}_clone_${a}`,f=c.SUBTITLES&&`${c.SUBTITLES}_clone_${a}`;h&&(r[c.AUDIO]=h,c.AUDIO=h),f&&(s[c.SUBTITLES]=f,c.SUBTITLES=f);const m=$v(u.uri,c["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",l),p=new Rn({attrs:c,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:m,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let g=1;g<u.audioGroups.length;g++)p.addGroupId("audio",`${u.audioGroups[g]}_clone_${a}`);if(u.subtitleGroups)for(let g=1;g<u.subtitleGroups.length;g++)p.addGroupId("text",`${u.subtitleGroups[g]}_clone_${a}`);return p});t.push(...d),Bp(this.audioTracks,r,l,a),Bp(this.subtitleTracks,s,l,a)})}loadSteeringManifest(e){const t=this.hls.config,r=t.loader;this.loader&&this.loader.destroy(),this.loader=new r(t);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||t.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+u)}const n={responseType:"json",url:s.href},a=t.steeringManifestLoadPolicy.default,o=a.errorRetry||a.timeoutRetry||{},l={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},d={onSuccess:(u,c,h,f)=>{this.log(`Loaded steering manifest: "${s}"`);const m=u.data;if(m.VERSION!==1){this.log(`Steering VERSION ${m.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=m.TTL;const{"RELOAD-URI":p,"PATHWAY-CLONES":g,"PATHWAY-PRIORITY":v}=m;if(p)try{this.uri=new self.URL(p,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${p}`);return}this.scheduleRefresh(this.uri||h.url),g&&this.clonePathways(g);const b={steeringManifest:m,url:s.toString()};this.hls.trigger(E.STEERING_MANIFEST_LOADED,b),v&&this.updatePathwayPriority(v)},onError:(u,c,h,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${c.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${c.url} no longer available`);return}let m=this.timeToLoad*1e3;if(u.code===429){const p=this.loader;if(typeof(p==null?void 0:p.getResponseHeader)=="function"){const g=p.getResponseHeader("Retry-After");g&&(m=parseFloat(g)*1e3)}this.log(`Steering manifest ${c.url} rate limited`);return}this.scheduleRefresh(this.uri||c.url,m)},onTimeout:(u,c,h)=>{this.log(`Timeout loading steering manifest (${c.url})`),this.scheduleRefresh(this.uri||c.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(n,l,d)}scheduleRefresh(e,t=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},t)}}function Bp(i,e,t,r){i&&Object.keys(e).forEach(s=>{const n=i.filter(a=>a.groupId===s).map(a=>{const o=it({},a);return o.details=void 0,o.attrs=new Ke(o.attrs),o.url=o.attrs.URI=$v(a.url,a.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",t),o.groupId=o.attrs["GROUP-ID"]=e[s],o.attrs["PATHWAY-ID"]=r,o});i.push(...n)})}function $v(i,e,t,r){const{HOST:s,PARAMS:n,[t]:a}=r;let o;e&&(o=a==null?void 0:a[e],o&&(i=o));const l=new self.URL(i);
47return s&&!o&&(l.host=s),n&&Object.keys(n).sort().forEach(d=>{d&&l.searchParams.set(d,n[d])}),l.href}const fR=/^age:\s*[\d.]+\s*$/im;class Bv{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new Pd,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,t,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:e,context:t}=this;if(!e||!t)return;const r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const n=this.xhrSetup;n?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return n(r,t.url)}).catch(a=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",t.url,!0),n(r,t.url)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,t,e)}).catch(a=>{this.callbacks.onError({code:r.status,text:a.message},t,r,s)}):this.openAndSendXhr(r,t,e)}openAndSendXhr(e,t,r){e.readyState||e.open("GET",t.url,!0);const s=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=r.loadPolicy;if(s)for(const o in s)e.setRequestHeader(o,s[o]);t.rangeEnd&&e.setRequestHeader("Range","bytes="+t.rangeStart+"-"+(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),r.timeout=n&&q(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:t,stats:r}=this;if(!e||!t)return;const s=t.readyState,n=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;const a=t.status,o=t.responseType==="text"?t.responseText:null;if(a>=200&&a<300){const c=o??t.response;if(c!=null){r.loading.end=Math.max(self.performance.now(),r.loading.first);const h=t.responseType==="arraybuffer"?c.byteLength:c.length;if(r.loaded=r.total=h,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first),!this.callbacks)return;const f=this.callbacks.onProgress;if(f&&f(r,e,c,t),!this.callbacks)return;const m={url:t.responseURL,data:c,code:a};this.callbacks.onSuccess(m,r,e,t);return}}const l=n.loadPolicy.errorRetry,d=r.retry,u={url:e.url,data:void 0,code:a};ad(l,d,!1,u)?this.retry(l):(R.error(`${a} while loading ${e.url}`),this.callbacks.onError({code:a,text:t.statusText},e,t,r))}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,t=this.stats.retry;if(ad(e,t,!0))this.retry(e);else{var r;R.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:t,stats:r}=this;this.retryDelay=jh(e,r.retry),r.retry++,R.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${t==null?void 0:t.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&fR.test(this.loader.getAllResponseHeaders())){const t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}function mR(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const pR=/(\d+)-(\d+)\/(\d+)/;class Hp{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||yR,this.controller=new self.AbortController,this.stats=new Pd}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,t,r){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const n=gR(e,this.controller.signal),a=r.onProgress,o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:d,maxLoadTimeMs:u}=t.loadPolicy;this.context=e,this.config=t,this.callbacks=r,this.request=this.fetchSetup(e,n),self.clearTimeout(this.requestTimeout),t.timeout=
47d&&q(d)?d:u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},t.timeout),self.fetch(this.request).then(c=>{this.response=this.loader=c;const h=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),t.timeout=u,this.requestTimeout=self.setTimeout(()=>{this.abortInternal(),r.onTimeout(s,e,this.response)},u-(h-s.loading.start)),!c.ok){const{status:f,statusText:m}=c;throw new bR(m||"fetch, bad network response",f,c)}return s.loading.first=h,s.total=ER(c.headers)||s.total,a&&q(t.highWaterMark)?this.loadProgressively(c,s,e,t.highWaterMark,a):o?c.arrayBuffer():e.responseType==="json"?c.json():c.text()}).then(c=>{const h=this.response;if(!h)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const f=c[l];f&&(s.loaded=s.total=f);const m={url:h.url,data:c,code:h.status};a&&!q(t.highWaterMark)&&a(s,e,c,h),r.onSuccess(m,s,e,h)}).catch(c=>{if(self.clearTimeout(this.requestTimeout),s.aborted)return;const h=c&&c.code||0,f=c?c.message:null;r.onError({code:h,text:f},e,c?c.details:null,s)})}getCacheAge(){let e=null;if(this.response){const t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,r,s=0,n){const a=new ov,o=e.body.getReader(),l=()=>o.read().then(d=>{if(d.done)return a.dataLength&&n(t,r,a.flush(),e),Promise.resolve(new ArrayBuffer(0));const u=d.value,c=u.length;return t.loaded+=c,c<s||a.dataLength?(a.push(u),a.dataLength>=s&&n(t,r,a.flush(),e)):n(t,r,u,e),l()}).catch(()=>Promise.reject());return l()}}function gR(i,e){const t={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(it({},i.headers))};return i.rangeEnd&&t.headers.set("Range","bytes="+i.rangeStart+"-"+String(i.rangeEnd-1)),t}function vR(i){const e=pR.exec(i);if(e)return parseInt(e[2])-parseInt(e[1])+1}function ER(i){const e=i.get("Content-Range");if(e){const r=vR(e);if(q(r))return r}const t=i.get("Content-Length");if(t)return parseInt(t)}function yR(i,e){return new self.Request(i.url,e)}class bR extends Error{constructor(e,t,r){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=r}}const TR=/\s/,_R={newCue(i,e,t,r){const s=[];let n,a,o,l,d;const u=self.VTTCue||self.TextTrackCue;for(let h=0;h<r.rows.length;h++)if(n=r.rows[h],o=!0,l=0,d="",!n.isEmpty()){var c;for(let p=0;p<n.chars.length;p++)TR.test(n.chars[p].uchar)&&o?l++:(d+=n.chars[p].uchar,o=!1);n.cueStartTime=e,e===t&&(t+=1e-4),l>=16?l--:l++;const f=kv(d.trim()),m=af(e,t,f);i!=null&&(c=i.cues)!=null&&c.getCueById(m)||(a=new u(e,t,f),a.id=m,a.line=h+1,a.align="left",a.position=10+Math.min(80,Math.floor(l*8/32)*10),s.push(a))}return i&&s.length&&(s.sort((h,f)=>h.line==="auto"||f.line==="auto"?0:h.line>8&&f.line>8?f.line-h.line:h.line-f.line),s.forEach(h=>J0(i,h))),s}},AR={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Hv=ft(ft({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:60*1e3*1e3,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Bv,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:X1,bufferController:ex,capLevelController:of,errorController:F1,fpsController:Ix,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:F0,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,cert
vendor: 4,957 bytes, line 47
47LoadPolicy:{default:AR},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},SR()),{},{subtitleStreamController:XS,subtitleTrackController:ZS,timelineController:Rx,audioStreamController:jS,audioTrackController:zS,emeController:un,cmcdController:uR,contentSteeringController:hR});function SR(){return{cueHandler:_R,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function xR(i,e){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const t=gc(i),r=["manifest","level","frag"],s=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return r.forEach(n=>{const a=`${n==="level"?"playlist":n}LoadPolicy`,o=e[a]===void 0,l=[];s.forEach(d=>{const u=`${n}Loading${d}`,c=e[u];if(c!==void 0&&o){l.push(u);const h=t[a].default;switch(e[a]={default:h},d){case"TimeOut":h.maxLoadTimeMs=c,h.maxTimeToFirstByteMs=c;break;case"MaxRetry":h.errorRetry.maxNumRetry=c,h.timeoutRetry.maxNumRetry=c;break;case"RetryDelay":h.errorRetry.retryDelayMs=c,h.timeoutRetry.retryDelayMs=c;break;case"MaxRetryTimeout":h.errorRetry.maxRetryDelayMs=c,h.timeoutRetry.maxRetryDelayMs=c;break}}}),l.length&&R.warn(`hls.js config: "${l.join('", "')}" setting(s) are deprecated, use "${a}": ${JSON.stringify(e[a])}`)}),ft(ft({},t),e)}function gc(i){return i&&typeof i=="object"?Array.isArray(i)?i.map(gc):Object.keys(i).reduce((e,t)=>(e[t]=gc(i[t]),e),{}):i}function RR(i){const e=i.loader;e!==Hp&&e!==Bv?(R.log("[config]: Custom loader detected, cannot enable progressive streaming"),i.progressive=!1):mR()&&(i.loader=Hp,i.progressive=!0,i.enableSoftwareAES=!0,R.log("[config]: Progressive streaming enabled, using FetchLoader"))}let Cu;class LR extends zh{constructor(e,t){super(e,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this),e.on(E.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this),e.off(E.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}
47stopLoad(){this._levels.forEach(t=>{t.loadError=0,t.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){const r=this.hls.config.preferManagedMediaSource,s=[],n={},a={};let o=!1,l=!1,d=!1;t.levels.forEach(u=>{var c,h;const f=u.attrs;let{audioCodec:m,videoCodec:p}=u;((c=m)==null?void 0:c.indexOf("mp4a.40.34"))!==-1&&(Cu||(Cu=/chrome|firefox/i.test(navigator.userAgent)),Cu&&(u.audioCodec=m=void 0)),m&&(u.audioCodec=m=rd(m,r)),((h=p)==null?void 0:h.indexOf("avc1"))===0&&(p=u.videoCodec=f1(p));const{width:g,height:v,unknownCodecs:b}=u;if(o||(o=!!(g&&v)),l||(l=!!p),d||(d=!!m),b!=null&&b.length||m&&!vu(m,"audio",r)||p&&!vu(p,"video",r))return;const{CODECS:y,"FRAME-RATE":A,"HDCP-LEVEL":_,"PATHWAY-ID":C,RESOLUTION:x,"VIDEO-RANGE":S}=f,I=`${`${C||"."}-`}${u.bitrate}-${x}-${A}-${y}-${S}-${_}`;if(n[I])if(n[I].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const M=a[I]+=1;u.attrs["PATHWAY-ID"]=new Array(M+1).join(".");const $=new Rn(u);n[I]=$,s.push($)}else n[I].addGroupId("audio",f.AUDIO),n[I].addGroupId("text",f.SUBTITLES);else{const M=new Rn(u);n[I]=M,a[I]=1,s.push(M)}}),this.filterAndSortMediaOptions(s,t,o,l,d)}filterAndSortMediaOptions(e,t,r,s,n){let a=[],o=[],l=e;if((r||s)&&n&&(l=l.filter(({videoCodec:m,videoRange:p,width:g,height:v})=>(!!m||!!(g&&v))&&R1(p))),l.length===0){Promise.resolve().then(()=>{if(this.hls){t.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(t.levels[0].attrs)}`);const m=new Error("no level with compatible codecs found in manifest");this.hls.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:m,reason:m.message})}});return}if(t.audioTracks){const{preferManagedMediaSource:m}=this.hls.config;a=t.audioTracks.filter(p=>!p.audioCodec||vu(p.audioCodec,"audio",m)),Gp(a)}t.subtitles&&(o=t.subtitles,Gp(o));const d=l.slice(0);l.sort((m,p)=>{if(m.attrs["HDCP-LEVEL"]!==p.attrs["HDCP-LEVEL"])return(m.attrs["HDCP-LEVEL"]||"")>(p.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&m.height!==p.height)return m.height-p.height;if(m.frameRate!==p.frameRate)return m.frameRate-p.frameRate;if(m.videoRange!==p.videoRange)return sd.indexOf(m.videoRange)-sd.indexOf(p.videoRange);if(m.videoCodec!==p.videoCodec){const g=zm(m.videoCodec),v=zm(p.videoCodec);if(g!==v)return v-g}if(m.uri===p.uri&&m.codecSet!==p.codecSet){const g=id(m.codecSet),v=id(p.codecSet);if(g!==v)return v-g}return m.averageBitrate!==p.averageBitrate?m.averageBitrate-p.averageBitrate:0});let u=d[0];if(this.steering&&(l=this.steering.filterParsedLevels(l),l.length!==d.length)){for(let m=0;m<d.length;m++)if(d[m].pathwayId===l[0].pathwayId){u=d[m];break}}this._levels=l;for(let m=0;m<l.length;m++)if(l[m]===u){var c;this._firstLevel=m;const p=u.bitrate,g=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${l.length} level(s) found, first bitrate: ${p}`),((c=this.hls.userConfig)==null?void 0:c.abrEwmaDefaultEstimate)===void 0){const v=Math.min(p,this.hls.config.abrEwmaDefaultEstimateMax);v>g&&g===Hv.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=v)}break}const h=n&&!s,f={levels:l,audioTracks:a,subtitleTracks:o,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:s,altAudio:!h&&a.some(m=>!!m.url)};this.hls.trigger(E.MANIFEST_PARSED,f),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return this._levels.length===0?null:this._levels}get level(){return this.currentLevelIndex}set level(e){const t=this._levels;if(t.length===0)return;if(e<0||e>=t.length){const u=new Error("invalid level idx"),c=e<0;if(this.hls.trigger(E.ERROR,{type:re.OTHER_ERROR,details:O.LEVEL_SWITCH_ERROR,level:e,fatal:c,error:u,reason:u.message}),c)return;e=Math.min(e,t.length-1)}const r=this.currentLevelIndex,s=this.currentLevel,n=s?s.attrs["PATHWAY-ID"]:void 0,a=t[e],o=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,r===e&&a.details&&s&&n===o)return;this.log(`Switching to level ${e} (${a.height?a.height+"p ":""}${a.videoRange?a.videoRange+" ":""}${a.codecSet?a.codecSet+" ":""}@${a.bitrate})${o?" with Pathway "+o:""} from level ${r}${n?" with Pathway "+n:""}`);const l={level:e,attrs:a.attrs,details:a.details,bitrate:a.bitrate,averageBitrate:a.averageBitrate,maxBitrate:a.maxBitrate,realBitrate:a.realBitrate,width:a.width,height:a.height,codecSet:a.codecSet,audioCodec:a.audioCodec,videoCodec:a.videoCodec,audioGroups:a.audioGroups,subtitleGroups:a.subtitleGroups,loaded:a.loaded,loadError:a.loadError,fragmentError:a.fragmentError,name:a.name,id:a.id,uri:a.uri,url:a.url,urlId:0,audioGroupIds:a.audioGroupIds,textGroupIds:a.textGroupIds};this.hls.trigger(E.LEVEL_SWITCHING,l);const d=a.details;if(!d||d.live){const u=this.switchParams(a.uri,s==null?void 0:s.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}onError(e,t){t.fatal||!t.context||t.context.type===ge.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,{frag:t}){if(t!==void 0&&t.type===ie.MAIN){const r=t.elementaryStreams;if(!Object.keys(r).some(n=>!!r[n]))return;const s=this._levels[t.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,t){var r;const{level:s,details:n}=t,a=this._levels[s];if(!a){var o;this.warn(`Invalid level index ${s}
47`),(o=t.deliveryDirectives)!=null&&o.skip&&(n.deltaUpdateFailed=!0);return}s===this.currentLevelIndex?(a.fragmentError===0&&(a.loadError=0),this.playlistLoaded(s,t,a.details)):(r=t.deliveryDirectives)!=null&&r.skip&&(n.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist();const t=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let s=r.uri;if(e)try{s=e.addDirectives(s)}catch(a){this.warn(`Could not construct new URL with HLS Delivery Directives: ${a}`)}const n=r.attrs["PATHWAY-ID"];this.log(`Loading level index ${t}${(e==null?void 0:e.msn)!==void 0?" at sn "+e.msn+" part "+e.part:""} with${n?" Pathway "+n:""} ${s}`),this.clearTimer(),this.hls.trigger(E.LEVEL_LOADING,{url:s,level:t,pathwayId:r.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;const r=this._levels.filter((s,n)=>n!==e?!0:(this.steering&&this.steering.removeLevel(s),s===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,s.details&&s.details.fragments.forEach(a=>a.level=-1)),!1));rv(r),this._levels=r,this.currentLevelIndex>-1&&(t=this.currentLevel)!=null&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(E.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:t}){this._levels=t}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(E.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function Gp(i){const e={};i.forEach(t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++})}class IR{constructor(e){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyUriToKeyInfo){const s=this.keyUriToKeyInfo[r].loader;if(s){var t;if(e&&e!==((t=s.context)==null?void 0:t.frag.type))return;s.abort()}}}detach(){for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e];(t.mediaKeySessionContext||t.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyUriToKeyInfo){const t=this.keyUriToKeyInfo[e].loader;t&&t.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(e,t=O.KEY_LOAD_ERROR,r,s,n){return new Vi({type:re.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:r,networkDetails:s})}loadClear(e,t){if(this.emeController&&this.config.emeEnabled){const{sn:r,cc:s}=e;for(let n=0;n<t.length;n++){const a=t[n];if(s<=a.cc&&(r==="initSegment"||a.sn==="initSegment"||r<a.sn)){this.emeController.selectKeySystemFormat(a).then(o=>{a.setKeyFormat(o)});break}}}}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(t=>this.loadInternal(e,t)):this.loadInternal(e)}loadInternal(e,t){var r,s;t&&e.setKeyFormat(t);const n=e.decryptdata;if(!n){const d=new Error(t?`Expected frag.decryptdata to be defined after setting format ${t}`:"Missing decryption data on fragment in onKeyLoading");return Promise.reject(this.createKeyLoadError(e,O.KEY_LOAD_ERROR,d))}const a=n.uri;if(!a)return Promise.reject(this.createKeyLoadError(e,O.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${a}"`)));let o=this.keyUriToKeyInfo[a];if((r=o)!=null&&r.decryptdata.key)return n.key=o.decryptdata.key,Promise.resolve({frag:e,keyInfo:o});if((s=o)!=null&&s.keyLoadPromise){var l;switch((l=o.mediaKeySessionContext)==null?void 0:l.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return o.keyLoadPromise.then(d=>(n.key=d.keyInfo.decryptdata.key,{frag:e,keyInfo:o}))}}switch(o=this.keyUriToKeyInfo[a]={decryptdata:n,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},n.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return n.keyFormat==="identity"?this.loadKeyHTTP(o,e):this.loadKeyEME(o,e);case"AES-128":return this.loadKeyHTTP(o,e);default:return Promise.reject(this.createKeyLoadError(e,O.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${n.method}"`)))}}loadKeyEME(e,t){const r={frag:t,keyInfo:e};if(this.emeController&&this.config.emeEnabled){const s=this.emeController.loadKey(r);
47if(s)return(e.keyLoadPromise=s.then(n=>(e.mediaKeySessionContext=n,r))).catch(n=>{throw e.keyLoadPromise=null,n})}return Promise.resolve(r)}loadKeyHTTP(e,t){const r=this.config,s=r.loader,n=new s(r);return t.keyLoader=e.loader=n,e.keyLoadPromise=new Promise((a,o)=>{const l={keyInfo:e,frag:t,responseType:"arraybuffer",url:e.decryptdata.uri},d=r.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:(h,f,m,p)=>{const{frag:g,keyInfo:v,url:b}=m;if(!g.decryptdata||v!==this.keyUriToKeyInfo[b])return o(this.createKeyLoadError(g,O.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),p));v.decryptdata.key=g.decryptdata.key=new Uint8Array(h.data),g.keyLoader=null,v.loader=null,a({frag:g,keyInfo:v})},onError:(h,f,m,p)=>{this.resetLoader(f),o(this.createKeyLoadError(t,O.KEY_LOAD_ERROR,new Error(`HTTP Error ${h.code} loading key ${h.text}`),m,ft({url:l.url,data:void 0},h)))},onTimeout:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,O.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),m))},onAbort:(h,f,m)=>{this.resetLoader(f),o(this.createKeyLoadError(t,O.INTERNAL_ABORTED,new Error("key loading aborted"),m))}};n.load(l,u,c)})}resetLoader(e){const{frag:t,keyInfo:r,url:s}=e,n=r.loader;t.keyLoader===n&&(t.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[s],n&&n.destroy()}}function Gv(){return self.SourceBuffer||self.WebKitSourceBuffer}function Kv(){if(!_s())return!1;const e=Gv();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function kR(){if(!Kv())return!1;const i=_s();return typeof(i==null?void 0:i.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>i.isTypeSupported(Ua(e,"video")))||["mp4a.40.2","fLaC"].some(e=>i.isTypeSupported(Ua(e,"audio"))))}function wR(){var i;const e=Gv();return typeof(e==null||(i=e.prototype)==null?void 0:i.changeType)=="function"}const DR=250,Vo=2,CR=.1,MR=.05;class OR{constructor(e,t,r,s){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=e,this.media=t,this.fragmentTracker=r,this.hls=s}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(e,t){const{config:r,media:s,stalled:n}=this;if(s===null)return;const{currentTime:a,seeking:o}=s,l=this.seeking&&!o,d=!this.seeking&&o;if(this.seeking=o,a!==e){if(this.moved=!0,o||(this.nudgeRetry=0),n!==null){if(this.stallReported){const g=self.performance.now()-n;R.warn(`playback not stuck anymore @${a}, after ${Math.round(g)}ms`),this.stallReported=!1}this.stalled=null}return}if(d||l){this.stalled=null;return}if(s.paused&&!o||s.ended||s.playbackRate===0||!Pe.getBuffered(s).length){this.nudgeRetry=0;return}const u=Pe.bufferInfo(s,a,0),c=u.nextStart||0;if(o){const g=u.len>Vo,v=!c||t&&t.start<=a||c-a>Vo&&!this.fragmentTracker.getPartialFragment(a);if(g||v)return;this.moved=!1}if(!this.moved&&this.stalled!==null){var h;if(!(u.len>0)&&!c)return;const v=Math.max(c,u.start||0)-a,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,A=(b==null||(h=b.details)==null?void 0:h.live)?b.details.targetduration*2:Vo,_=this.fragmentTracker.getPartialFragment(a);if(v>0&&(v<=A||_)){s.paused||this._trySkipBufferHole(_);return}}const f=self.performance.now();if(n===null){this.stalled=f;return}const m=f-n;if(!o&&m>=DR&&(this._reportStall(u),!this.media))return;const p=Pe.bufferInfo(s,a,r.maxBufferHole);this._tryFixBufferStall(p,m)}_tryFixBufferStall(e,t){const{config:r,fragmentTracker:s,media:n}=this;if(n===null)return;const a=n.currentTime,o=s.getPartialFragment(a);o&&(this._trySkipBufferHole(o)||!this.media)||(e.len>r.maxBufferHole||e.nextStart&&e.nextStart-a<r.maxBufferHole)&&t>r.highBufferWatchdogPeriod*1e3&&(R.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(e){const{hls:t,media:r,stallReported:s}=this;if(!s&&r){this.stallReported=!0;const n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(e)})`);R.warn(n.message),t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:e.len})}}_trySkipBufferHole(e){const{config:t,hls:r,media:s}=this;if(s===null)return 0;const n=s.currentTime,a=Pe.bufferInfo(s,n,0),o=n<a.start?a.start:a.nextStart;if(o){const l=a.len<=t.maxBufferHole,d=a.len>0&&a.len<1&&s.readyState<3,u=o-n;if(u>0&&(l||d)){if(u>t.maxBufferHole){const{fragmentTracker:h}=this;let f=!1;if(n===0){const m=h.getAppendedFrag(0,ie.MAIN);m&&o<m.end&&(f=!0)}if(!f){const m=e||h.getAppendedFrag(n,ie.MAIN);if(m){let p=!1,g=m.end;for(;g<o;){const v=h.getPartialFragment(g);if(v)g+=v.duration;else{p=!0;break}}if(p)return 0}}}const c=Math.max(o+MR,n+CR);if(R.warn(`skipping hole, adjusting currentTime from ${n} to ${c}`),this.moved=!0,this.stalled=null,s.currentTime=c,e&&!e.gap){const h=new Error(`fragment loaded with buffer holes, seeking from ${n} to ${c}`);r.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:e})}return c}}return 0}_tryNudgeBuffer(){const{config:e,hls:t,media:r,nudgeRetry:s}=this;if(r===null)return;const n=r.currentTime;if(this.nudgeRetry++,s<e.nudgeMaxRetry){const a=n+(s+1)*e.nudgeOffset,o=new Error(`Nudging 'currentTime' from ${n} to ${a}`);R.warn(o.message),r.currentTime=a,t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1})}else{const a=new Error(`Playhead still not moving while enough data buffered @${n} after ${e.nudgeMaxRetry} nudges`);R.error(a.message),t.trigger(E.ERROR,{type:re.MEDIA_ERROR,details:O.BUFFER_STALLED_ERROR,error:a,fatal:!0})}}}const PR=100;class NR extends Zh{constructor(e,t,r){super(e,t,r,"[stream-controller]",ie.MAIN),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:e}=this;
47e.on(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.MANIFEST_PARSED,this.onManifestParsed,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.LEVEL_LOADED,this.onLevelLoaded,this),e.on(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(E.ERROR,this.onError,this),e.on(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(E.BUFFER_CREATED,this.onBufferCreated,this),e.on(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(E.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:e}=this;e.off(E.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(E.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.MANIFEST_PARSED,this.onManifestParsed,this),e.off(E.LEVEL_LOADED,this.onLevelLoaded,this),e.off(E.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(E.ERROR,this.onError,this),e.off(E.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(E.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(E.BUFFER_CREATED,this.onBufferCreated,this),e.off(E.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(E.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(E.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(e){if(this.levels){const{lastCurrentTime:t,hls:r}=this;if(this.stopLoad(),this.setInterval(PR),this.level=-1,!this.startFragRequested){let s=r.startLevel;s===-1&&(r.config.testBandwidth&&this.levels.length>1?(s=0,this.bitrateTest=!0):s=r.firstAutoLevel),r.nextLoadLevel=s,this.level=r.loadLevel,this.loadedmetadata=!1}t>0&&e===-1&&(this.log(`Override startPosition with lastCurrentTime @${t.toFixed(3)}`),e=t),this.state=N.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=e,this.tick()}else this._forceStartLoad=!0,this.state=N.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case N.WAITING_LEVEL:{const{levels:t,level:r}=this,s=t==null?void 0:t[r],n=s==null?void 0:s.details;if(n&&(!n.live||this.levelLastLoaded===s)){if(this.waitForCdnTuneIn(n))break;this.state=N.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=N.IDLE;break}break}case N.FRAG_LOADING_WAITING_RETRY:{var e;const t=self.performance.now(),r=this.retryDate;if(!r||t>=r||(e=this.media)!=null&&e.seeking){const{levels:s,level:n}=this,a=s==null?void 0:s[n];this.resetStartWhenNotLoaded(a||null),this.state=N.IDLE}}break}this.state===N.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:t,levels:r,media:s}=this;if(t===null||!s&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[n]))return;const a=r[n],o=this.getMainFwdBufferInfo();if(o===null)return;const l=this.getLevelDetails();if(l&&this._streamEnded(o,l)){const p={};this.altAudio&&(p.type="video"),this.hls.trigger(E.BUFFER_EOS,p),this.state=N.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&e.manualLevel===-1&&this.log(`Adapting to level ${n} from level ${this.level}`),this.level=e.nextLoadLevel=n;const d=a.details;if(!d||this.state===N.WAITING_LEVEL||d.live&&this.levelLastLoaded!==a){this.level=n,this.state=N.WAITING_LEVEL;return}const u=o.len,c=this.getMaxBufferLength(a.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>o.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:o.end;let f=this.getNextFragment(h,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&f.sn!=="initSegment"&&this.fragmentTracker.getState(f)!==ht.OK){var m;const g=((m=this.backtrackFragment)!=null?m:f).sn-d.startSN,v=d.fragments[g-1];v&&f.cc===v.cc&&(f=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&o.len&&(this.backtrackFragment=null);
47if(f&&this.isLoopLoading(f,h)){if(!f.gap){const g=this.audioOnly&&!this.altAudio?Le.AUDIO:Le.VIDEO,v=(g===Le.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;v&&this.afterBufferFlushed(v,g,ie.MAIN)}f=this.getNextFragmentLoopLoading(f,d,o,ie.MAIN,c)}f&&(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,a,h))}loadFragment(e,t,r){const s=this.fragmentTracker.getState(e);this.fragCurrent=e,s===ht.NOT_LOADED||s===ht.PARTIAL?e.sn==="initSegment"?this._loadInitSegment(e,t):this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,t)):(this.startFragRequested=!0,super.loadFragment(e,t,r)):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,ie.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:e,media:t}=this;if(t!=null&&t.readyState){let r;const s=this.getAppendedFrag(t.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const n=this.getLevelDetails();if(n!=null&&n.live){const o=this.getMainFwdBufferInfo();if(!o||o.len<n.targetduration*2)return}if(!t.paused&&e){const o=this.hls.nextLoadLevel,l=e[o],d=this.fragLastKbps;d&&this.fragCurrent?r=this.fragCurrent.duration*l.maxBitrate/(1e3*d)+1:r=0}else r=0;const a=this.getBufferedFrag(t.currentTime+r);if(a){const o=this.followingBufferedFrag(a);if(o){this.abortCurrentFrag();const l=o.maxStartPTS?o.maxStartPTS:o.start,d=o.duration,u=Math.max(a.end,l+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case N.KEY_LOADING:case N.FRAG_LOADING:case N.FRAG_LOADING_WAITING_RETRY:case N.PARSING:case N.PARSED:this.state=N.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.altAudio?"video":null)}onMediaAttached(e,t){super.onMediaAttached(e,t);const r=t.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new OR(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:e}=this;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const e=this.media,t=e?e.currentTime:null;q(t)&&this.log(`Media seeked to ${t.toFixed(3)}`);const r=this.getMainFwdBufferInfo();if(r===null||r.len===0){this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`);return}this.tick()}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(E.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(e,t){let r=!1,s=!1;t.levels.forEach(n=>{const a=n.audioCodec;a&&(r=r||a.indexOf("mp4a.40.2")!==-1,s=s||a.indexOf("mp4a.40.5")!==-1)}),this.audioCodecSwitch=r&&s&&!wR(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startFragRequested=!1}onLevelLoading(e,t){const{levels:r}=this;if(!r||this.state!==N.IDLE)return;const s=r[t.level];(!s.details||s.details.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(s.details))&&(this.state=N.WAITING_LEVEL)}onLevelLoaded(e,t){var r;const{levels:s}=this,n=t.level,a=t.details,o=a.totalduration;if(!s){this.warn(`Levels were reset while loading level ${n}`);return}this.log(`Level ${n} loaded [${a.startSN},${a.endSN}]${a.lastPartSn?`[part-${a.lastPartSn}-${a.lastPartIndex}]`:""}, cc [${a.startCC}, ${a.endCC}] duration:${o}`);const l=s[n],d=this.fragCurrent;d&&(this.state===N.FRAG_LOADING||this.state===N.FRAG_LOADING_WAITING_RETRY)&&d.level!==t.level&&d.loader&&this.abortCurrentFrag();let u=0;if(a.live||(r=l.details)!=null&&r.live){var c;if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;u=this.alignPlaylists(a,l.details,(c=this.levelLastLoaded)==null?void 0:c.details)}if(l.details=a,this.levelLastLoaded=l,this.hls.trigger(E.LEVEL_UPDATED,{details:a,level:n}),this.state===N.WAITING_LEVEL){if(this.waitForCdnTuneIn(a))return;this.state=N.IDLE}this.startFragRequested?a.live&&this.synchronizeToLiveEdge(a):this.setStartPosition(a,u),this.tick()}_handleFragmentLoadProgress(e){var t;const{frag:r,part:s,payload:n}=e,{levels:a}=this;if(!a){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const o=a[r.level],l=o.details;if(!l){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}const d=o.videoCodec,u=l.PTSKnown||!l.live,c=(t=r.initSegment)==null?void 0:t.data,h=this._getAudioCodec(o),f=this.transmuxer=this.transmuxer||new Av(this.hls,ie.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=s?s.index:-1,p=m!==-1,g=new Xh(r.level,r.sn,r.stats.chunkCount,n.byteLength,m,p),v=this.initPTS[r.cc];f.push(n,c,h,d,r,s,l.totalduration,u,g,v)}onAudioTrackSwitching(e,t){const r=this.altAudio;if(!!!t.url){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const a=this.fragCurrent;a&&(this.log("Switching to main audio track, cancel main fragment load"),a.abortRequests(),this.fragmentTracker.removeFragment(a)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const n=this.hls;r&&(n.trigger(E.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),n.trigger(E.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){const r=t.id,s=!!this.hls.audioTracks[r].url;if(s){const n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=s,this.tick()}onBufferCreated(e,t){const r=t.tracks;let s,n,a=!1;
47for(const o in r){const l=r[o];if(l.id==="main"){if(n=o,s=l,o==="video"){const d=r[o];d&&(this.videoBuffer=d.buffer)}}else a=!0}a&&s?(this.log(`Alternate track found, use ${n}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){const{frag:r,part:s}=t;if(r&&r.type!==ie.MAIN)return;if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===N.PARSED&&(this.state=N.IDLE);return}const n=s?s.stats:r.stats;this.fragLastKbps=Math.round(8*n.total/(n.buffering.end-n.loading.first)),r.sn!=="initSegment"&&(this.fragPrevious=r),this.fragBufferedComplete(r,s)}onError(e,t){var r;if(t.fatal){this.state=N.ERROR;return}switch(t.details){case O.FRAG_GAP:case O.FRAG_PARSING_ERROR:case O.FRAG_DECRYPT_ERROR:case O.FRAG_LOAD_ERROR:case O.FRAG_LOAD_TIMEOUT:case O.KEY_LOAD_ERROR:case O.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(ie.MAIN,t);break;case O.LEVEL_LOAD_ERROR:case O.LEVEL_LOAD_TIMEOUT:case O.LEVEL_PARSING_ERROR:!t.levelRetry&&this.state===N.WAITING_LEVEL&&((r=t.context)==null?void 0:r.type)===ge.LEVEL&&(this.state=N.IDLE);break;case O.BUFFER_APPEND_ERROR:case O.BUFFER_FULL_ERROR:if(!t.parent||t.parent!=="main")return;if(t.details===O.BUFFER_APPEND_ERROR){this.resetLoadingState();return}this.reduceLengthAndFlushBuffer(t)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case O.INTERNAL_EXCEPTION:this.recoverWorkerError(t);break}}checkBuffer(){const{media:e,gapController:t}=this;if(!(!e||!t||!e.readyState)){if(this.loadedmetadata||!Pe.getBuffered(e).length){const r=this.state!==N.IDLE?this.fragCurrent:null;t.poll(this.lastCurrentTime,r)}this.lastCurrentTime=e.currentTime}}onFragLoadEmergencyAborted(){this.state=N.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(e,{type:t}){if(t!==Le.AUDIO||this.audioOnly&&!this.altAudio){const r=(t===Le.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,t,ie.MAIN),this.tick()}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const t=e.currentTime;let r=this.startPosition;if(r>=0&&t<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${t}`);return}const s=Pe.getBuffered(e),a=(s.length?s.start(0):0)-r;a>0&&(a<this.config.maxBufferHole||a<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${a} to match buffer start`),r+=a,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${t}`),e.currentTime=r}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t.indexOf("mp4a.40.5")!==-1?t="mp4a.40.2":t="mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(r=>{const{hls:s}=this;if(!r||this.fragContextChanged(e))return;t.fragmentError=0,this.state=N.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const n=e.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),s.trigger(E.FRAG_LOADED,r),e.bitrateTest=!1})}_handleTransmuxComplete(e){var t;const r="main",{hls:s}=this,{remuxResult:n,chunkMeta:a}=e,o=this.getCurrentContext(a);if(!o){this.resetWhenMissingContext(a);return}const{frag:l,part:d,level:u}=o,{video:c,text:h,id3:f,initSegment:m}=n,{details:p}=u,g=this.altAudio?void 0:n.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=N.PARSING,m){if(m!=null&&m.tracks){const y=l.initSegment||l;this._bufferInitSegment(u,m.tracks,y,a),s.trigger(E.FRAG_PARSING_INIT_SEGMENT,{frag:y,id:r,tracks:m.tracks})}const v=m.initPTS,b=m.timescale;q(v)&&(this.initPTS[l.cc]={baseTime:v,timescale:b},s.trigger(E.INIT_PTS_FOUND,{frag:l,id:r,initPTS:v,timescale:b}))}if(c&&p&&l.sn!=="initSegment"){const v=p.fragments[l.sn-1-p.startSN],b=l.sn===p.startSN,y=!v||l.cc>v.cc;if(n.independent!==!1){const{startPTS:A,endPTS:_,startDTS:C,endDTS:x}=c;if(d)d.elementaryStreams[c.type]={startPTS:A,endPTS:_,startDTS:C,endDTS:x};else if(c.firstKeyFrame&&c.independent&&a.id===1&&!y&&(this.couldBacktrack=!0),c.dropped&&c.independent){const S=this.getMainFwdBufferInfo(),P=(S?S.end:this.getLoadPosition())+this.config.maxBufferHole,I=c.firstKeyFramePTS?c.firstKeyFramePTS:A;if(!b&&P<I-this.config.maxBufferHole&&!y){this.backtrack(l);return}
47else y&&(l.gap=!0);l.setElementaryStreamInfo(c.type,l.start,_,l.start,x,!0)}else b&&A>Vo&&(l.gap=!0);l.setElementaryStreamInfo(c.type,A,_,C,x),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(c,l,d,a,b||y)}else if(b||y)l.gap=!0;else{this.backtrack(l);return}}if(g){const{startPTS:v,endPTS:b,startDTS:y,endDTS:A}=g;d&&(d.elementaryStreams[Le.AUDIO]={startPTS:v,endPTS:b,startDTS:y,endDTS:A}),l.setElementaryStreamInfo(Le.AUDIO,v,b,y,A),this.bufferFragmentData(g,l,d,a)}if(p&&f!=null&&(t=f.samples)!=null&&t.length){const v={id:r,frag:l,details:p,samples:f.samples};s.trigger(E.FRAG_PARSING_METADATA,v)}if(p&&h){const v={id:r,frag:l,details:p,samples:h.samples};s.trigger(E.FRAG_PARSING_USERDATA,v)}}_bufferInitSegment(e,t,r,s){if(this.state!==N.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&delete t.audio;const{audio:n,video:a,audiovideo:o}=t;if(n){let l=e.audioCodec;const d=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l.indexOf("mp4a.40.5")!==-1?l="mp4a.40.2":l="mp4a.40.5");const u=n.metadata;u&&"channelCount"in u&&(u.channelCount||1)!==1&&d.indexOf("firefox")===-1&&(l="mp4a.40.5")}l&&l.indexOf("mp4a.40.5")!==-1&&d.indexOf("android")!==-1&&n.container!=="audio/mpeg"&&(l="mp4a.40.2",this.log(`Android: force audio codec to ${l}`)),e.audioCodec&&e.audioCodec!==l&&this.log(`Swapping manifest audio codec "${e.audioCodec}" for "${l}"`),n.levelCodec=l,n.id="main",this.log(`Init audio buffer, container:${n.container}, codecs[selected/level/parsed]=[${l||""}/${e.audioCodec||""}/${n.codec}]`)}a&&(a.levelCodec=e.videoCodec,a.id="main",this.log(`Init video buffer, container:${a.container}, codecs[level/parsed]=[${e.videoCodec||""}/${a.codec}]`)),o&&this.log(`Init audiovideo buffer, container:${o.container}, codecs[level/parsed]=[${e.codecs}/${o.codec}]`),this.hls.trigger(E.BUFFER_CODECS,t),Object.keys(t).forEach(l=>{const u=t[l].initSegment;u!=null&&u.byteLength&&this.hls.trigger(E.BUFFER_APPENDING,{type:l,data:u,frag:r,part:null,chunkMeta:s,parent:r.type})}),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,ie.MAIN)}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=N.IDLE}checkFragmentChanged(){const e=this.media;let t=null;if(e&&e.readyState>1&&e.seeking===!1){const r=e.currentTime;if(Pe.isBuffered(e,r)?t=this.getAppendedFrag(r):Pe.isBuffered(e,r+.1)&&(t=this.getAppendedFrag(r+.1)),t){this.backtrackFragment=null;const s=this.fragPlaying,n=t.level;(!s||t.sn!==s.sn||s.level!==n)&&(this.fragPlaying=t,this.hls.trigger(E.FRAG_CHANGED,{frag:t}),(!s||s.level!==n)&&this.hls.trigger(E.LEVEL_SWITCHED,{level:n}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){const e=this.media;return e?this.fragPlaying||this.getAppendedFrag(e.currentTime):null}get currentProgramDateTime(){const e=this.media;if(e){const t=e.currentTime,r=this.currentFrag;if(r&&q(t)&&q(r.programDateTime)){const s=r.programDateTime+(t-r.start)*1e3;return new Date(s)}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class ns{static get version(){return"1.5.20"}static isMSESupported(){return Kv()}static isSupported(){return kR()}static getMediaSource(){return _s()}static get Events(){return E}static get ErrorTypes(){return re}static get ErrorDetails(){return O}static get DefaultConfig(){return ns.defaultConfig?ns.defaultConfig:Hv}static set DefaultConfig(e){ns.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new sf,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,SA(e.debug||!1,"Hls instance");const t=this.config=xR(ns.DefaultConfig,e);this.userConfig=e,t.progressive&&RR(t);const{abrController:r,bufferController:s,capLevelController:n,errorController:a,fpsController:o}=t,l=new a(this),d=this.abrController=new r(this),u=this.bufferController=new s(this),c=this.capLevelController=new n(this),h=new o(this),f=new E1(this),m=new A1(this),p=t.contentSteeringController,g=p?new p(this):null,v=this.levelController=new LR(this,g),b=new Z1(this),y=new IR(this.config),A=this.streamController=new NR(this,b,y);c.setStreamController(A),h.setStreamController(A);const _=[f,v,A];g&&_.splice(1,0,g),this.networkControllers=_;const C=[d,u,c,h,m,b];this.audioTrackController=this.createController(t.audioTrackController,_);const x=t.audioStreamController;x&&_.push(new x(this,b,y)),this.subtitleTrackController=this.createController(t.subtitleTrackController,_);const S=t.subtitleStreamController;S&&_.push(new S(this,b,y)),this.createController(t.timelineController,C),y.emeController=this.emeController=this.createController(t.emeController,C),this.cmcdController=this.createController(t.cmcdController,C),this.latencyController=this.createController(S1,C),this.coreComponents=C,_.push(l);const P=l.onErrorOut;typeof P=="function"&&this.on(E.ERROR,P,l)}createController(e,t){if(e){const r=new e(this);return t&&t.push(r),r}return null}on(e,t,r=this){this._emitter.on(e,t,r)}once(e,t,r=this){this._emitter.once(e,t,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t,r=this,s){this._emitter.off(e,t,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,t,r){return this._emitter.emit(e,t,r)}
47trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(r){if(R.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;const s=e===E.ERROR;this.trigger(E.ERROR,{type:re.OTHER_ERROR,details:O.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){R.log("destroy"),this.trigger(E.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach(t=>t.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(t=>t.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){R.log("attachMedia"),this._media=e,this.trigger(E.MEDIA_ATTACHING,{media:e})}detachMedia(){R.log("detachMedia"),this.trigger(E.MEDIA_DETACHING,void 0),this._media=null}loadSource(e){this.stopLoad();const t=this.media,r=this.url,s=this.url=Vh.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,R.log(`loadSource:${s}`),t&&r&&(r!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(t)),this.trigger(E.MANIFEST_LOADING,{url:e})}startLoad(e=-1){R.log(`startLoad(${e})`),this.started=!0,this.resumeBuffering();for(let t=0;t<this.networkControllers.length&&(this.networkControllers[t].startLoad(e),!(!this.started||!this.networkControllers));t++);}stopLoad(){R.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}resumeBuffering(){R.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()})}pauseBuffering(){R.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()})}swapAudioCodec(){R.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){R.log("recoverMediaError");const e=this._media;this.detachMedia(),e&&this.attachMedia(e)}removeLevel(e){this.levelController.removeLevel(e)}get levels(){const e=this.levelController.levels;return e||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){R.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){R.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){R.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){R.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){R.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const t=!!e;t!==this.config.capLevelToPlayerSize&&(t?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=t)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(R.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){x1(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;const r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=t)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:t,maxHdcpLevel:r}=this;let s;if(t===-1&&e!=null&&e.length?s=e.length-1:s=t,r)for(let n=s;n--;){const a=e[n].attrs["HDCP-LEVEL"];if(a&&a<=r)return n}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(e){var t;return(t=this.audioTrackController)==null?void 0:t.setAudioOption(e)}setSubtitleOption(e){var t;return(t=this.subtitleTrackController)==null||t.setSubtitleOption(e),null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const t=this.audioTrackController;t&&(t.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}ns.defaultConfig=void 0;var fe=ns,Oe={VIDEO:"video",THUMBNAIL:"thumbnail",STORYBOARD:"storyboard",DRM:"drm"},ee={NOT_AN_ERROR:0,NETWORK_OFFLINE:2000002,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_NO_STATUS:2000001,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,NETWORK_GENERIC_SERVER_FAIL:25e5,NETWORK_TOKEN_MISSING:2403201,NETWORK_TOKEN_MALFORMED:2412202,NETWORK_TOKEN_EXPIRED:2403210,NETWORK_TOKEN_AUD_MISSING:2403221,NETWORK_TOKEN_AUD_MISMATCH:2403222,NETWORK_TOKEN_SUB_MISMATCH:2403232,ENCRYPTED_ERROR:5e6,ENCRYPTED_UNSUPPORTED_
47KEY_SYSTEM:5000001,ENCRYPTED_GENERATE_REQUEST_FAILED:5000002,ENCRYPTED_UPDATE_LICENSE_FAILED:5000003,ENCRYPTED_UPDATE_SERVER_CERT_FAILED:5000004,ENCRYPTED_CDM_ERROR:5000005,ENCRYPTED_OUTPUT_RESTRICTED:5000006,ENCRYPTED_MISSING_TOKEN:5000002},Ud=i=>i===Oe.VIDEO?"playback":i,lr=class ea extends Error{constructor(e,t=ea.MEDIA_ERR_CUSTOM,r,s){var n;super(e),this.name="MediaError",this.code=t,this.context=s,this.fatal=r??(t>=ea.MEDIA_ERR_NETWORK&&t<=ea.MEDIA_ERR_ENCRYPTED),this.message||(this.message=(n=ea.defaultMessages[this.code])!=null?n:"")}};lr.MEDIA_ERR_ABORTED=1,lr.MEDIA_ERR_NETWORK=2,lr.MEDIA_ERR_DECODE=3,lr.MEDIA_ERR_SRC_NOT_SUPPORTED=4,lr.MEDIA_ERR_ENCRYPTED=5,lr.MEDIA_ERR_CUSTOM=100,lr.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail.",3:"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.",4:"An unsupported error occurred. The server or network failed, or your browser does not support this format.",5:"The media is encrypted and there are no keys to decrypt it."};var G=lr,UR=i=>i==null,df=(i,e)=>UR(e)?!1:i in e,vc={ANY:"any",MUTED:"muted"},xe={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},Ii={MSE:"mse",NATIVE:"native"},ta={HEADER:"header",QUERY:"query",NONE:"none"},cd=Object.values(ta),Xi={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},Kp={HLS:Xi.M3U8};[...Object.values(Xi)];var FR="en",Ec={code:FR},Qe=(i,e,t,r,s=i)=>{s.addEventListener(e,t,r),i.addEventListener("teardown",()=>{s.removeEventListener(e,t)},{once:!0})};function $R(i,e,t){e&&t>e&&(t=e);for(let r=0;r<i.length;r++)if(i.start(r)<=t&&i.end(r)>=t)return!0;return!1}var uf=i=>{let e=i.indexOf("?");if(e<0)return[i];let t=i.slice(0,e),r=i.slice(e);return[t,r]},Fd=i=>{let{type:e}=i;if(e){let t=e.toUpperCase();return df(t,Kp)?Kp[t]:e}return BR(i)},Vv=i=>i==="VOD"?xe.ON_DEMAND:xe.LIVE,Wv=i=>i==="EVENT"?Number.POSITIVE_INFINITY:i==="VOD"?Number.NaN:0,BR=i=>{let{src:e}=i;if(!e)return"";let t="";try{t=new URL(e).pathname}catch{console.error("invalid url")}let r=t.lastIndexOf(".");if(r<0)return GR(i)?Xi.M3U8:"";let s=t.slice(r+1).toUpperCase();return df(s,Xi)?Xi[s]:""},HR="mux.com",GR=({src:i,customDomain:e=HR})=>{let t;try{t=new URL(`${i}`)}catch{return!1}let r=t.protocol==="https:",s=t.hostname===`stream.${e}`.toLowerCase(),n=t.pathname.split("/"),a=n.length===2,o=!(n!=null&&n[1].includes("."));return r&&s&&a&&o},cn=i=>{let e=(i??"").split(".")[1];if(e)try{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=decodeURIComponent(atob(t).split("").map(function(s){return"%"+("00"+s.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(r)}catch{return}},KR=({exp:i},e=Date.now())=>!i||i*1e3<e,VR=({sub:i},e)=>i!==e,WR=({aud:i},e)=>!i,YR=({aud:i},e)=>i!==e,Yv="en";function Z(i,e=!0){var t,r;let s=e&&(r=(t=Ec)==null?void 0:t[i])!=null?r:i,n=e?Ec.code:Yv;return new qR(s,n)}var qR=class{constructor(e,t=(r=>(r=Ec)!=null?r:Yv)()){this.message=e,this.locale=t}format(e){return this.message.replace(/\{(\w+)\}/g,(t,r)=>{var s;return(s=e[r])!=null?s:""})}toString(){return this.message}},jR=Object.values(vc),Vp=i=>typeof i=="boolean"||typeof i=="string"&&jR.includes(i),zR=(i,e,t)=>{let{autoplay:r}=i,s=!1,n=!1,a=Vp(r)?r:!!r,o=()=>{s||Qe(e,"playing",()=>{s=!0},{once:!0})};if(o(),Qe(e,"loadstart",()=>{s=!1,o(),Mu(e,a)},{once:!0}),Qe(e,"loadstart",()=>{t||(i.streamType&&i.streamType!==xe.UNKNOWN?n=i.streamType===xe.LIVE:n=!Number.isFinite(e.duration)),Mu(e,a)},{once:!0}),t&&t.once(fe.Events.LEVEL_LOADED,(l,d)=>{var u;i.streamType&&i.streamType!==xe.UNKNOWN?n=i.streamType===xe.LIVE:n=(u=d.details.live)!=null?u:!1}),!a){let l=()=>{!n||Number.isFinite(i.startTime)||(t!=null&&t.liveSyncPosition?e.currentTime=t.liveSyncPosition:Number.isFinite(e.seekable.end(0))&&(e.currentTime=e.seekable.end(0)))};t&&Qe(e,"play",()=>{e.preload==="metadata"?t.once(fe.Events.LEVEL_UPDATED,l):l()},{once:!0})}return l=>{s||(a=Vp(l)?l:!!l,Mu(e,a))}},Mu=(i,e)=>{if(!e)return;let t=i.muted,r=()=>i.muted=t;switch(e){case vc.ANY:i.play().catch(()=>{i.muted=!0,i.play().catch(r)});break;case vc.MUTED:i.muted=!0,i.play().catch(r);break;default:i.play().catch(()=>{});break}},XR=({preload:i,src:e},t,r)=>{let s=c=>{c!=null&&["","none","metadata","auto"].includes(c)?t.setAttribute("preload",c):t.removeAttribute("preload")};if(!r)return s(i),s;let n=!1,a=!1,o=r.config.maxBufferLength,l=r.config.maxBufferSize,d=c=>{s(c);let h=c??t.preload;a||h==="none"||(h==="metadata"?(r.config.maxBufferLength=1,r.config.maxBufferSize=1):(r.config.maxBufferLength=o,r.config.maxBufferSize=l),u())},u=()=>{!n&&e&&(n=!0,r.loadSource(e))};return Qe(t,"play",()=>{a=!0,r.config.maxBufferLength=o,r.config.maxBufferSize=l,u()},{once:!0}),d(i),d};function QR(i,e){var t;if(!("videoTracks"in i))return;let r=new WeakMap;e.on(fe.Events.MANIFEST_PARSED,function(d,u){l();let c=i.addVideoTrack("main");c.selected=!0;for(let[h,f]of u.levels.entries()){let m=c.addRendition(f.url[0],f.width,f.height,f.videoCodec,f.bitrate);r.set(f,`${h}`),m.id=`${h}`}}),e.on(fe.Events.AUDIO_TRACKS_UPDATED,function(d,u){o();for(let c of u.audioTracks){let h=c.default?"main":"alternative",f=i.addAudioTrack(h,c.name,c.lang);f.id=`${c.id}`,c.default&&(f.enabled=!0)}}),i.audioTracks.addEventListener("change",()=>{var d;let u=+((d=[...i.audioTracks].find(h=>h.enabled))==null?void 0:d.id),c=e.audioTracks.map(h=>h.id);u!=e.audioTrack&&c.includes(u)&&(e.audioTrack=u)}),e.on(fe.Events.LEVELS_UPDATED,function(d,u){var c;let h=i.videoTracks[(c=i.videoTracks.selectedIndex)!=null?c:0];if(!h)return;let f=u.levels.map(m=>r.get(m));for(let m of i.videoRenditions)m.id&&!f.includes(m.id)&&h.removeRendition(m)});let s=d=>{let u=d.target.selectedIndex;u!=e.nextLevel&&n(u)},n=d=>{let u=i.currentTime,c=!1,h=(f,m)=>{c||(c=!Number.isFinite(m.endOffset))};e.on(fe.Events.BUFFER_FLUSHING,h),e.nextLevel=d,e.off(fe.Events.BUFFER_FLUSHING,h),c||e.trigger(fe.Events.BUFFER_FLUSHING,{startOffset:u+10,endOffset:1/0,type:"video"})};(t=i.videoRenditions)==null||t.addEventListener("change",s);let a=()=>{for(let d of i.videoTracks)i.removeVideoTrack(d)},o=()=>{for(let d of i.audioTracks)i.removeAudioTrack(d)},l=()=>{a(),o()};e.once(fe.Events.DESTROYING,l)}var Ou=i=>"time"in i?i.time:i.startTime;function ZR(i,e){e.on(fe.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(s,{tracks:n})=>
vendor: 6,041 bytes, line 47
47{n.forEach(a=>{var o,l;let d=(o=a.subtitleTrack)!=null?o:a.closedCaptions,u=e.subtitleTracks.findIndex(({lang:h,name:f,type:m})=>h==(d==null?void 0:d.lang)&&f===a.label&&m.toLowerCase()===a.kind),c=((l=a._id)!=null?l:a.default)?"default":`${a.kind}${u}`;cf(i,a.kind,a.label,d==null?void 0:d.lang,c,a.default)})});let t=()=>{if(!e.subtitleTracks.length)return;let s=Array.from(i.textTracks).find(o=>o.id&&o.mode==="showing"&&["subtitles","captions"].includes(o.kind));if(!s)return;let n=e.subtitleTracks[e.subtitleTrack],a=n?n.default?"default":`${e.subtitleTracks[e.subtitleTrack].type.toLowerCase()}${e.subtitleTrack}`:void 0;if(e.subtitleTrack<0||(s==null?void 0:s.id)!==a){let o=e.subtitleTracks.findIndex(({lang:l,name:d,type:u,default:c})=>s.id==="default"&&c||l==s.language&&d===s.label&&u.toLowerCase()===s.kind);e.subtitleTrack=o}(s==null?void 0:s.id)===a&&s.cues&&Array.from(s.cues).forEach(o=>{s.addCue(o)})};i.textTracks.addEventListener("change",t),e.on(fe.Events.CUES_PARSED,(s,{track:n,cues:a})=>{let o=i.textTracks.getTrackById(n);if(!o)return;let l=o.mode==="disabled";l&&(o.mode="hidden"),a.forEach(d=>{var u;(u=o.cues)!=null&&u.getCueById(d.id)||o.addCue(d)}),l&&(o.mode="disabled")}),e.once(fe.Events.DESTROYING,()=>{i.textTracks.removeEventListener("change",t),i.querySelectorAll("track[data-removeondestroy]").forEach(s=>{s.remove()})});let r=()=>{Array.from(i.textTracks).forEach(s=>{var n,a;if(!["subtitles","caption"].includes(s.kind)&&(s.label==="thumbnails"||s.kind==="chapters")){if(!((n=s.cues)!=null&&n.length)){let o="track";s.kind&&(o+=`[kind="${s.kind}"]`),s.label&&(o+=`[label="${s.label}"]`);let l=i.querySelector(o),d=(a=l==null?void 0:l.getAttribute("src"))!=null?a:"";l==null||l.removeAttribute("src"),setTimeout(()=>{l==null||l.setAttribute("src",d)},0)}s.mode!=="hidden"&&(s.mode="hidden")}})};e.once(fe.Events.MANIFEST_LOADED,r),e.once(fe.Events.MEDIA_ATTACHED,r)}function cf(i,e,t,r,s,n){let a=document.createElement("track");return a.kind=e,a.label=t,r&&(a.srclang=r),s&&(a.id=s),n&&(a.default=!0),a.track.mode=["subtitles","captions"].includes(e)?"disabled":"hidden",a.setAttribute("data-removeondestroy",""),i.append(a),a.track}function JR(i,e){let t=Array.prototype.find.call(i.querySelectorAll("track"),r=>r.track===e);t==null||t.remove()}function eo(i,e,t){var r;return(r=Array.from(i.querySelectorAll("track")).find(s=>s.track.label===e&&s.track.kind===t))==null?void 0:r.track}async function qv(i,e,t,r){let s=eo(i,t,r);return s||(s=cf(i,r,t),s.mode="hidden",await new Promise(n=>setTimeout(()=>n(void 0),0))),s.mode!=="hidden"&&(s.mode="hidden"),[...e].sort((n,a)=>Ou(a)-Ou(n)).forEach(n=>{var a,o;let l=n.value,d=Ou(n);if("endTime"in n&&n.endTime!=null)s==null||s.addCue(new VTTCue(d,n.endTime,r==="chapters"?l:JSON.stringify(l??null)));else{let u=Array.prototype.findIndex.call(s==null?void 0:s.cues,m=>m.startTime>=d),c=(a=s==null?void 0:s.cues)==null?void 0:a[u],h=c?c.startTime:Number.isFinite(i.duration)?i.duration:Number.MAX_SAFE_INTEGER,f=(o=s==null?void 0:s.cues)==null?void 0:o[u-1];f&&(f.endTime=d),s==null||s.addCue(new VTTCue(d,h,r==="chapters"?l:JSON.stringify(l??null)))}}),i.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),s}var hf="cuepoints",jv=Object.freeze({label:hf});async function zv(i,e,t=jv){return qv(i,e,t.label,"metadata")}var yc=i=>({time:i.startTime,value:JSON.parse(i.text)});function eL(i,e={label:hf}){let t=eo(i,e.label,"metadata");return t!=null&&t.cues?Array.from(t.cues,r=>yc(r)):[]}function Xv(i,e={label:hf}){var t,r;let s=eo(i,e.label,"metadata");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return yc(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return yc(a||s.activeCues[0])}async function tL(i,e=jv){return new Promise(t=>{Qe(i,"loadstart",async()=>{let r=await zv(i,[],e);Qe(i,"cuechange",()=>{let s=Xv(i);if(s){let n=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}var ff="chapters",Qv=Object.freeze({label:ff}),bc=i=>({startTime:i.startTime,endTime:i.endTime,value:i.text});async function Zv(i,e,t=Qv){return qv(i,e,t.label,"chapters")}function iL(i,e={label:ff}){var t;let r=eo(i,e.label,"chapters");return(t=r==null?void 0:r.cues)!=null&&t.length?Array.from(r.cues,s=>bc(s)):[]}function Jv(i,e={label:ff}){var t,r;let s=eo(i,e.label,"chapters");if(!((t=s==null?void 0:s.activeCues)!=null&&t.length))return;if(s.activeCues.length===1)return bc(s.activeCues[0]);let{currentTime:n}=i,a=Array.prototype.find.call((r=s.activeCues)!=null?r:[],({startTime:o,endTime:l})=>o<=n&&l>n);return bc(a||s.activeCues[0])}async function rL(i,e=Qv){return new Promise(t=>{Qe(i,"loadstart",async()=>{let r=await Zv(i,[],e);Qe(i,"cuechange",()=>{let s=Jv(i);if(s){let n=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:s});i.dispatchEvent(n)}},{},r),t(r)})})}function sL(i,e){if(e){let t=e.playingDate;if(t!=null)return new Date(t.getTime()-i.currentTime*1e3)}return typeof i.getStartDate=="function"?i.getStartDate():new Date(NaN)}function nL(i,e){if(e&&e.playingDate)return e.playingDate;if(typeof i.getStartDate=="function"){let t=i.getStartDate();return new Date(t.getTime()+i.currentTime*1e3)}return new Date(NaN)}var xa={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},aL=i=>{if(i===Oe.VIDEO)return xa.VIDEO;if(i===Oe.DRM)return xa.DRM},oL=(i,e)=>{var t,r;let s=Ud(i),n=`${s}Token`;return(t=e.tokens)!=null&&t[s]?(r=e.tokens)==null?void 0:r[s]:df(n,e)?e[n]:void 0},hd=(i,e,t,r,s=!1,n=!(a=>(a=globalThis.navigator)==null?void 0:a.onLine)())=>{var a,o;if(n){let v=Z("Your device appears to be offline",s),b,y=G.MEDIA_ERR_NETWORK,A=new G(v,y,!1,b);return A.errorCategory=e,A.muxCode=ee.NETWORK_OFFLINE,A.data=i,A}let l="status"in i?i.status:i.code,d=Date.now(),u=G.MEDIA_ERR_NETWORK;if(l===200)return;let c=Ud(e),h=oL(e,t),f=aL(e),[m]=uf((a=t.playbackId)!=null?a:"");if(!l||!m)return;let p=cn(h);if(h&&!p){let v=Z("The {tokenNamePrefix}
47-token provided is invalid or malformed.",s).format({tokenNamePrefix:c}),b=Z("Compact JWT string: {token}",s).format({token:h}),y=new G(v,u,!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_TOKEN_MALFORMED,y.data=i,y}if(l>=500){let v=new G("",u,r??!0);return v.errorCategory=e,v.muxCode=ee.NETWORK_UNKNOWN_ERROR,v}if(l===403)if(p){if(KR(p,d)){let v={timeStyle:"medium",dateStyle:"medium"},b=Z("The video’s secured {tokenNamePrefix}-token has expired.",s).format({tokenNamePrefix:c}),y=Z("Expired at: {expiredDate}. Current time: {currentDate}.",s).format({expiredDate:new Intl.DateTimeFormat("en",v).format((o=p.exp)!=null?o:0*1e3),currentDate:new Intl.DateTimeFormat("en",v).format(d)}),A=new G(b,u,!0,y);return A.errorCategory=e,A.muxCode=ee.NETWORK_TOKEN_EXPIRED,A.data=i,A}if(VR(p,m)){let v=Z("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",s).format({tokenNamePrefix:c}),b=Z("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",s).format({tokenNamePrefix:c,playbackId:m,tokenPlaybackId:p.sub}),y=new G(v,u,!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_TOKEN_SUB_MISMATCH,y.data=i,y}if(WR(p)){let v=Z("The {tokenNamePrefix}-token is formatted with incorrect information.",s).format({tokenNamePrefix:c}),b=Z("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",s).format({tokenNamePrefix:c,expectedAud:f}),y=new G(v,u,!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_TOKEN_AUD_MISSING,y.data=i,y}if(YR(p,f)){let v=Z("The {tokenNamePrefix}-token is formatted with incorrect information.",s).format({tokenNamePrefix:c}),b=Z("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",s).format({tokenNamePrefix:c,expectedAud:f,aud:p.aud}),y=new G(v,u,!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_TOKEN_AUD_MISMATCH,y.data=i,y}}else{let v=Z("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",s).format({tokenNamePrefix:c,category:e}),b=Z("Specified playback ID: {playbackId}",s).format({playbackId:m}),y=new G(v,u,r??!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_TOKEN_MISSING,y.data=i,y}if(l===412){let v=Z("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",s),b=Z("Specified playback ID: {playbackId}",s).format({playbackId:m}),y=new G(v,u,r??!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_NOT_READY,y.streamType=t.streamType===xe.LIVE?"live":t.streamType===xe.ON_DEMAND?"on-demand":"unknown",y.data=i,y}if(l===404){let v=Z("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",s),b=Z("Specified playback ID: {playbackId}",s).format({playbackId:m}),y=new G(v,u,r??!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_NOT_FOUND,y.data=i,y}if(l===400){let v=Z("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),b=Z("Specified playback ID: {playbackId}",s).format({playbackId:m}),y=new G(v,u,r??!0,b);return y.errorCategory=e,y.muxCode=ee.NETWORK_INVALID_URL,y.data=i,y}let g=new G("",u,r??!0);return g.errorCategory=e,g.muxCode=ee.NETWORK_UNKNOWN_ERROR,g.data=i,g},Wp=fe.DefaultConfig.capLevelController,eE=class tE extends Wp{constructor(e){super(e)}get levels(){var e;return(e=this.hls.levels)!=null?e:[]}getValidLevels(e){return this.levels.filter((t,r)=>this.isLevelAllowed(t)&&r<=e)}getMaxLevel(e){let t=super.getMaxLevel(e),r=this.getValidLevels(e);if(!r[t])return t;let s=Math.min(r[t].width,r[t].height),n=tE.minMaxResolution;return s>=n?t:Wp.getMaxLevelByMediaSize(r,n*(16/9),n)}};eE.minMaxResolution=720;var lL=eE,dL=lL,Wo={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},uL=i=>{if(i.includes("fps"))return Wo.FAIRPLAY;if(i.includes("playready"))return Wo.PLAYREADY;if(i.includes("widevine"))return Wo.WIDEVINE},cL=i=>{let e=i.split(` 48`).find((t,r,s)=>r&&s[r-1].startsWith("#EXT-X-STREAM-INF"));return fetch(e).then(t=>t.status!==200?Promise.reject(t):t.text())},hL=i=>
vendor: 10,224 bytes, lines 48-50
48{let e=i.split(` 49`).filter(r=>r.startsWith("#EXT-X-SESSION-DATA"));if(!e.length)return{};let t={};for(let r of e){let s=mL(r),n=s["DATA-ID"];n&&(t[n]={...s})}return{sessionData:t}},fL=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g;function mL(i){let e=[...i.matchAll(fL)];return Object.fromEntries(e.map(([,t,r])=>[t,r]))}var pL=i=>{var e,t,r;let s=i.split(` 50`),n=(t=((e=s.find(d=>d.startsWith("#EXT-X-PLAYLIST-TYPE")))!=null?e:"").split(":")[1])==null?void 0:t.trim(),a=Vv(n),o=Wv(n),l;if(a===xe.LIVE){let d=s.find(u=>u.startsWith("#EXT-X-PART-INF"));if(d)l=+d.split(":")[1].split("=")[1]*2;else{let u=s.find(h=>h.startsWith("#EXT-X-TARGETDURATION")),c=(r=u==null?void 0:u.split(":"))==null?void 0:r[1];l=+(c??6)*3}}return{streamType:a,targetLiveWindow:o,liveEdgeStartOffset:l}},gL=async(i,e)=>{if(e===Xi.MP4)return{streamType:xe.ON_DEMAND,targetLiveWindow:Number.NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(e===Xi.M3U8){let t=await fetch(i);if(!t.ok)return Promise.reject(t);let r=await t.text(),s=await cL(r);return{...hL(r),...pL(s)}}return console.error(`Media type ${e} is an unrecognized or unsupported type for src ${i}.`),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},vL=async(i,e,t=Fd({src:i}))=>{var r,s,n,a;let{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await gL(i,t),c=u==null?void 0:u["com.apple.hls.chapters"];(c!=null&&c.URI||c!=null&&c.VALUE.toLocaleLowerCase().startsWith("http"))&&mf((r=c.URI)!=null?r:c.VALUE,e),((s=We.get(e))!=null?s:{}).liveEdgeStartOffset=d,((n=We.get(e))!=null?n:{}).targetLiveWindow=l,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((a=We.get(e))!=null?a:{}).streamType=o,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},mf=async(i,e)=>{var t;try{let r=await fetch(i);if(!r.ok)throw new Error(`Failed to fetch Mux metadata: ${r.status} ${r.statusText}`);let s=await r.json(),n={};for(let o of s[0].metadata)o.key&&o.value&&(n[o.key]=o.value);((t=We.get(e))!=null?t:{}).metadata=n;let a=new CustomEvent("muxmetadata");e.dispatchEvent(a)}catch(r){console.error(r)}},EL=i=>{var e;let t=i.type,r=Vv(t),s=Wv(t),n,a=!!((e=i.partList)!=null&&e.length);return r===xe.LIVE&&(n=a?i.partTarget*2:i.targetduration*3),{streamType:r,targetLiveWindow:s,liveEdgeStartOffset:n,lowLatency:a}},yL=(i,e,t)=>{var r,s,n,a,o,l,d,u;let{streamType:c,targetLiveWindow:h,liveEdgeStartOffset:f,lowLatency:m}=EL(i);if(c===xe.LIVE){m?(t.config.backBufferLength=(r=t.userConfig.backBufferLength)!=null?r:4,t.config.maxFragLookUpTolerance=(s=t.userConfig.maxFragLookUpTolerance)!=null?s:.001,t.config.abrBandWidthUpFactor=(n=t.userConfig.abrBandWidthUpFactor)!=null?n:t.config.abrBandWidthFactor):t.config.backBufferLength=(a=t.userConfig.backBufferLength)!=null?a:8;let p=Object.freeze({get length(){return e.seekable.length},start(g){return e.seekable.start(g)},end(g){var v;return g>this.length||g<0||Number.isFinite(e.duration)?e.seekable.end(g):(v=t.liveSyncPosition)!=null?v:e.seekable.end(g)}});((o=We.get(e))!=null?o:{}).seekable=p}((l=We.get(e))!=null?l:{}).liveEdgeStartOffset=f,((d=We.get(e))!=null?d:{}).targetLiveWindow=h,e.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),((u=We.get(e))!=null?u:{}).streamType=c,e.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},Yp,qp,bL=(qp=(Yp=globalThis==null?void 0:globalThis.navigator)==null?void 0:Yp.userAgent)!=null?qp:"",jp,zp,Xp,TL=(Xp=(zp=(jp=globalThis==null?void 0:globalThis.navigator)==null?void 0:jp.userAgentData)==null?void 0:zp.platform)!=null?Xp:"",_L=bL.toLowerCase().includes("android")||["x11","android"].some(i=>TL.toLowerCase().includes(i)),We=new WeakMap,Qi="mux.com",Qp,Zp,iE=(Zp=(Qp=fe).isSupported)==null?void 0:Zp.call(Qp),AL=_L,rE=()=>Kh.utils.now(),SL=Kh.utils.generateUUID,Tc=({playbackId:i,customDomain:e=Qi,maxResolution:t,minResolution:r,renditionOrder:s,programStartTime:n,programEndTime:a,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:c={}}={})=>{if(!i)return;let[h,f=""]=uf(i),m=new URL(`https://stream.${e}/${h}.m3u8${f}`);return u||m.searchParams.has("token")?(m.searchParams.forEach((p,g)=>{g!="token"&&m.searchParams.delete(g)}),u&&m.searchParams.set("token",u)):(t&&m.searchParams.set("max_resolution",t),r&&(m.searchParams.set("min_resolution",r),t&&+t.slice(0,-1)<+r.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",r,"maxResolution",t)),s&&m.searchParams.set("rendition_order",s),n&&m.searchParams.set("program_start_time",`${n}`),a&&m.searchParams.set("program_end_time",`${a}`),o&&m.searchParams.set("asset_start_time",`${o}`),l&&m.searchParams.set("asset_end_time",`${l}`),Object.entries(c).forEach(([p,g])=>{g!=null&&m.searchParams.set(p,g)})),m.toString()},$d=i=>{if(!i)return;let[e]=i.split("?");return e||void 0},pf=i=>{if(!i||!i.startsWith("https://stream."))return;let[e]=new URL(i).pathname.slice(1).split(/\.m3u8|\//);return e||void 0},xL=i=>{var e,t,r;return(e=i==null?void 0:i.metadata)!=null&&e.video_id?i.metadata.video_id:cE(i)&&(r=(t=$d(i.playbackId))!=null?t:pf(i.src))!=null?r:i.src},sE=i=>{var e;return(e=We.get(i))==null?void 0:e.error},RL=i=>{var e;return(e=We.get(i))==null?void 0:e.metadata},_c=i=>{var e,t;return(t=(e=We.get(i))==null?void 0:e.streamType)!=null?t:xe.UNKNOWN},LL=i=>{var e,t;return(t=(e=We.get(i))==null?void 0:e.targetLiveWindow)!=null?t:Number.NaN},gf=i=>{var e,t;return(t=(e=We.get(i))==null?void 0:e.seekable)!=null?t:i.seekable},IL=i=>{var e;let t=(e=We.get(i))==null?void 0:e.liveEdgeStartOffset;if(typeof t!="number")return Number.NaN;let r=gf(i);return r.length?r.end(r.length-1)-t:Number.NaN},vf=.034,kL=(i,e,t=vf)=>Math.abs(i-e)<=t,nE=(i,e,t=vf)=>i>e||kL(i,e,t),wL=(i,e=vf)=>i.paused&&nE(i.currentTime,i.duration,e),aE=(i,e)=>{var t,r,s;if(!e||!i.buffered.length)return;if(i.readyState>2)return!1;let n=e.currentLevel>=0?(r=(t=e.levels)==null?void 0:t[e.currentLevel])==null?void 0:r.details:(s=e.levels.find(c=>!!c.details))==null?void 0:s.details;if(!n||n.live)return;let{fragments:a}=n;if(!(a!=null&&a.length))return;if(i.currentTime<i.duration-(n.targetduration+.5))return!1;let o=a[a.length-1];if(i.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=i.buffered.start(i.buffered.length-1),u=i.buffered.end(i.buffered.length-1);return l>d&&l<u},oE=(i,e)=>i.ended||i.loop?i.ended:e&&aE(i,e)?!0:wL(i),DL=(i,e,t)=>{lE(e,t,i);let{metadata:r={}}=i,{view_session_id:s=SL()}=r,n=xL(i);r.view_session_id=s,r.video_id=n,i.metadata=r;let a=u=>{var c;(c=e.mux)==null||c.emit("hb",{view_drm_type:u})};i.drmTypeCb=a,We.set(e,{retryCount:0});let o=CL(i,e),l=XR(i,e,o);i!=null&&i.muxDataKeepSession&&e!=null&&e.mux&&!e.mux.deleted?o&&e.mux.addHLSJS({hlsjs:o,Hls:o?fe:void 0}):FL(i,e,o),$L(i,e,o),tL(e),rL(e);let d=zR(i,e,o);return{engine:o,setAutoplay:d,setPreload:l}},lE=(i,e,t)=>{let r=e==null?void 0:e.engine;i!=null&&i.mux&&!i.mux.deleted&&(t!=null&&t.muxDataKeepSession?r&&i.mux.removeHLSJS():(i.mux.destroy(),delete i.mux)),r&&(r.detachMedia(),r.destroy()),i&&(i.hasAttribute("src")&&(i.removeAttribute("src"),i.load()),i.removeEventListener("error",fE),i.removeEventListener("error",Ac),i.removeEventListener("durationchange",hE),We.delete(i),i.dispatchEvent(new Event("teardown")))};function dE(i,e){var t;let r=Fd(i);if(r!==Xi.M3U8)return!0;let s=!r||((t=e.canPlayType(r))!=null?t:!0),{preferPlayback:n}=i,a=n===Ii.MSE,o=n===Ii.NATIVE;return s&&(o||!(iE&&(a||AL)))}var CL=(i,e)=>{let{debug:t,streamType:r,startTime:s=-1,metadata:n,preferCmcd:a,_hlsConfig:o={}}=i,l=Fd(i)===Xi.M3U8,d=dE(i,e);if(l&&!d&&iE){let u={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelToPlayerSize:!0,capLevelOnFPSDrop:!0},c=ML(r),h=OL(i),f=[ta.QUERY,ta.HEADER].includes(a)?{useHeaders:a===ta.HEADER,sessionId:n==null?void 0:n.view_session_id,contentId:n==null?void 0:n.video_id}:void 0,m=new fe({debug:t,startPosition:s,cmcd:f,xhrSetup:(p,g)=>{var v,b;if(a&&a!==ta.QUERY)return;let y=new URL(g);if(!y.searchParams.has("CMCD"))return;let A=((b=(v=y.searchParams.get("CMCD"))==null?void 0:v.split(","))!=null?b:[]).filter(_=>_.startsWith("sid")||_.startsWith("cid")).join(",");y.searchParams.set("CMCD",A),p.open("GET",y)},capLevelController:dL,...u,...c,...h,...o});return m.on(fe.Events.MANIFEST_PARSED,async function(p,g){var v,b;let y=(v=g.sessionData)==null?void 0:v["com.apple.hls.chapters"];(y!=null&&y.URI||y!=null&&y.VALUE.toLocaleLowerCase().startsWith("http"))&&mf((b=y==null?void 0:y.URI)!=null?b:y==null?void 0:y.VALUE,e)}),m}},ML=i=>i===xe.LIVE?{backBufferLength:8}:{},OL=i=>{let{tokens:{drm:e}={},playbackId:t,drmTypeCb:r}=i,s=$d(t);return!e||!s?{}:{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:Yo(i,"fairplay"),serverCertificateUrl:uE(i,"fairplay")},"com.widevine.alpha":{licenseUrl:Yo(i,"widevine")},"com.microsoft.playready":{licenseUrl:Yo(i,"playready")}},requestMediaKeySystemAccessFunc:(n,a)=>(n==="com.widevine.alpha"&&(a=[...a.map(o=>{var l;let d=(l=o.videoCapabilities)==null?void 0:l.map(u=>({...u,robustness:"HW_SECURE_ALL"}));return{...o,videoCapabilities:d}}),...a]),navigator.requestMediaKeySystemAccess(n,a).then(o=>{let l=uL(n);return r==null||r(l),o}))}},PL=async i=>{let e=await fetch(i);return e.status!==200?Promise.reject(e):await e.arrayBuffer()},NL=async(i,e)=>{let t=await fetch(e,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:i});if(t.status!==200)return Promise.reject(t);let r=await t.arrayBuffer();return new Uint8Array(r)},UL=(i,e)=>{Qe(e,"encrypted",async t=>{try{let r=t.initDataType;if(r!=="skd"){console.error(`Received unexpected initialization data type "${r}"`);return}if(!e.mediaKeys){let l=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[r],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(u=>{var c;return(c=i.drmTypeCb)==null||c.call(i,Wo.FAIRPLAY),u}).catch(()=>{let u=Z("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),c=new G(u,G.MEDIA_ERR_ENCRYPTED,!0);
50c.errorCategory=Oe.DRM,c.muxCode=ee.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,Kt(e,c)});if(!l)return;let d=await l.createMediaKeys();try{let u=await PL(uE(i,"fairplay")).catch(c=>{if(c instanceof Response){let h=hd(c,Oe.DRM,i);return console.error("mediaError",h==null?void 0:h.message,h==null?void 0:h.context),h?Promise.reject(h):Promise.reject(new Error("Unexpected error in app cert request"))}return Promise.reject(c)});await d.setServerCertificate(u).catch(()=>{let c=Z("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),h=new G(c,G.MEDIA_ERR_ENCRYPTED,!0);return h.errorCategory=Oe.DRM,h.muxCode=ee.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(h)})}catch(u){Kt(e,u);return}await e.setMediaKeys(d)}let s=t.initData;if(s==null){console.error(`Could not start encrypted playback due to missing initData in ${t.type} event`);return}let n=e.mediaKeys.createSession();n.addEventListener("keystatuseschange",()=>{n.keyStatuses.forEach(l=>{let d;if(l==="internal-error"){let u=Z("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");d=new G(u,G.MEDIA_ERR_ENCRYPTED,!0),d.errorCategory=Oe.DRM,d.muxCode=ee.ENCRYPTED_CDM_ERROR}else if(l==="output-restricted"||l==="output-downscaled"){let u=Z("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");d=new G(u,G.MEDIA_ERR_ENCRYPTED,!1),d.errorCategory=Oe.DRM,d.muxCode=ee.ENCRYPTED_OUTPUT_RESTRICTED}d&&Kt(e,d)})});let a=await Promise.all([n.generateRequest(r,s).catch(()=>{let l=Z("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),d=new G(l,G.MEDIA_ERR_ENCRYPTED,!0);d.errorCategory=Oe.DRM,d.muxCode=ee.ENCRYPTED_GENERATE_REQUEST_FAILED,Kt(e,d)}),new Promise(l=>{n.addEventListener("message",d=>{l(d.message)},{once:!0})})]).then(([,l])=>l),o=await NL(a,Yo(i,"fairplay")).catch(l=>{if(l instanceof Response){let d=hd(l,Oe.DRM,i);return console.error("mediaError",d==null?void 0:d.message,d==null?void 0:d.context),d?Promise.reject(d):Promise.reject(new Error("Unexpected error in license key request"))}return Promise.reject(l)});await n.update(o).catch(()=>{let l=Z("Failed to update DRM license. This may be an issue with the player or your protected content."),d=new G(l,G.MEDIA_ERR_ENCRYPTED,!0);return d.errorCategory=Oe.DRM,d.muxCode=ee.ENCRYPTED_UPDATE_LICENSE_FAILED,Promise.reject(d)})}catch(r){Kt(e,r);return}})},Yo=({playbackId:i,tokens:{drm:e}={},customDomain:t=Qi},r)=>{let s=$d(i);return`https://license.${t.toLocaleLowerCase().endsWith(Qi)?t:Qi}/license/${r}/${s}?token=${e}`},uE=({playbackId:i,tokens:{drm:e}={},customDomain:t=Qi},r)=>{let s=$d(i);return`https://license.${t.toLocaleLowerCase().endsWith(Qi)?t:Qi}/appcert/${r}/${s}?token=${e}`},cE=({playbackId:i,src:e,customDomain:t})=>{if(i)return!0;if(typeof e!="string")return!1;let r=window==null?void 0:window.location.href,s=new URL(e,r).hostname.toLocaleLowerCase();return s.includes(Qi)||!!t&&s.includes(t.toLocaleLowerCase())},FL=(i,e,t)=>{var r;let{envKey:s,disableTracking:n,muxDataSDK:a=Kh,muxDataSDKOptions:o={}}=i,l=cE(i);if(!n&&(s||l)){let{playerInitTime:d,playerSoftwareName:u,playerSoftwareVersion:c,beaconCollectionDomain:h,debug:f,disableCookies:m}=i,p={...i.metadata,video_title:((r=i==null?void 0:i.metadata)==null?void 0:r.video_title)||void 0},g=v=>typeof v.player_error_code=="string"?!1:typeof i.errorTranslator=="function"?i.errorTranslator(v):v;a.monitor(e,{debug:f,beaconCollectionDomain:h,hlsjs:t,Hls:t?fe:void 0,automaticErrorTracking:!1,errorTranslator:g,disableCookies:m,...o,data:{...s?{env_key:s}:{},player_software_name:u,player_software:u,player_software_version:c,player_init_time:d,...p}})}},$L=(i,e,t)=>{var r,s;let n=dE(i,e),{src:a,customDomain:o=Qi}=i,l=()=>{e.ended||!oE(e,t)||(aE(e,t)?e.currentTime=e.buffered.end(e.buffered.length-1):e.dispatchEvent(new Event("ended")))},d,u,c=()=>{let h=gf(e),f,m;h.length>0&&(f=h.start(0),m=h.end(0)),(u!==m||d!==f)&&e.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),d=f,u=m};if(Qe(e,"durationchange",c),e&&n){let h=Fd(i);
vendor: 4,278 bytes, line 50
50if(typeof a=="string"){if(a.endsWith(".mp4")&&a.includes(o)){let p=pf(a),g=new URL(`https://stream.${o}/${p}/metadata.json`);mf(g.toString(),e)}let f=()=>{if(_c(e)!==xe.LIVE||Number.isFinite(e.duration))return;let p=setInterval(c,1e3);e.addEventListener("teardown",()=>{clearInterval(p)},{once:!0}),Qe(e,"durationchange",()=>{Number.isFinite(e.duration)&&clearInterval(p)})},m=async()=>vL(a,e,h).then(f).catch(p=>{if(p instanceof Response){let g=hd(p,Oe.VIDEO,i);if(g){Kt(e,g);return}}});if(e.preload==="none"){let p=()=>{m(),e.removeEventListener("loadedmetadata",g)},g=()=>{m(),e.removeEventListener("play",p)};Qe(e,"play",p,{once:!0}),Qe(e,"loadedmetadata",g,{once:!0})}else m();(r=i.tokens)!=null&&r.drm?UL(i,e):Qe(e,"encrypted",()=>{let p=Z("Attempting to play DRM-protected content without providing a DRM token."),g=new G(p,G.MEDIA_ERR_ENCRYPTED,!0);g.errorCategory=Oe.DRM,g.muxCode=ee.ENCRYPTED_MISSING_TOKEN,Kt(e,g)},{once:!0}),e.setAttribute("src",a),i.startTime&&(((s=We.get(e))!=null?s:{}).startTime=i.startTime,e.addEventListener("durationchange",hE,{once:!0}))}else e.removeAttribute("src");e.addEventListener("error",fE),e.addEventListener("error",Ac),e.addEventListener("emptied",()=>{e.querySelectorAll("track[data-removeondestroy]").forEach(f=>{f.remove()})},{once:!0}),Qe(e,"pause",l),Qe(e,"seeked",l),Qe(e,"play",()=>{e.ended||nE(e.currentTime,e.duration)&&(e.currentTime=e.seekable.length?e.seekable.start(0):0)})}else t&&a?(t.once(fe.Events.LEVEL_LOADED,(h,f)=>{yL(f.details,e,t),c(),_c(e)===xe.LIVE&&!Number.isFinite(e.duration)&&(t.on(fe.Events.LEVEL_UPDATED,c),Qe(e,"durationchange",()=>{Number.isFinite(e.duration)&&t.off(fe.Events.LEVELS_UPDATED,c)}))}),t.on(fe.Events.ERROR,(h,f)=>{var m,p;let g=BL(f,i);if(g.muxCode===ee.NETWORK_NOT_READY){let v=(m=We.get(e))!=null?m:{},b=(p=v.retryCount)!=null?p:0;if(b<6){let y=b===0?5e3:6e4,A=new G(`Retrying in ${y/1e3} seconds...`,g.code,g.fatal);Object.assign(A,g),Kt(e,A),setTimeout(()=>{v.retryCount=b+1,f.details==="manifestLoadError"&&f.url&&t.loadSource(f.url)},y);return}else{v.retryCount=0;let y=new G('Try again later or <a href="#" onclick="window.location.reload(); return false;" style="color: #4a90e2;">click here to retry</a>',g.code,g.fatal);Object.assign(y,g),Kt(e,y);return}}Kt(e,g)}),t.on(fe.Events.MANIFEST_LOADED,()=>{let h=We.get(e);h&&h.error&&(h.error=null,h.retryCount=0,e.dispatchEvent(new Event("emptied")),e.dispatchEvent(new Event("loadstart")))}),e.addEventListener("error",Ac),Qe(e,"waiting",l),QR(i,t),ZR(e,t),t.attachMedia(e)):console.error("It looks like the video you're trying to play will not work on this system! If possible, try upgrading to the newest versions of your browser or software.")};function hE(i){var e;let t=i.target,r=(e=We.get(t))==null?void 0:e.startTime;if(r&&$R(t.seekable,t.duration,r)){let s=t.preload==="auto";s&&(t.preload="none"),t.currentTime=r,s&&(t.preload="auto")}}async function fE(i){if(!i.isTrusted)return;i.stopImmediatePropagation();let e=i.target;if(!(e!=null&&e.error))return;let{message:t,code:r}=e.error,s=new G(t,r);if(e.src&&r===G.MEDIA_ERR_SRC_NOT_SUPPORTED&&e.readyState===HTMLMediaElement.HAVE_NOTHING){setTimeout(()=>{var n;let a=(n=sE(e))!=null?n:e.error;(a==null?void 0:a.code)===G.MEDIA_ERR_SRC_NOT_SUPPORTED&&Kt(e,s)},500);return}if(e.src&&(r!==G.MEDIA_ERR_DECODE||r!==void 0))try{let{status:n}=await fetch(e.src);s.data={response:{code:n}}}catch{}Kt(e,s)}function Kt(i,e){var t;e.fatal&&(((t=We.get(i))!=null?t:{}).error=e,i.dispatchEvent(new CustomEvent("error",{detail:e})))}function Ac(i){var e,t;if(!(i instanceof CustomEvent)||!(i.detail instanceof G))return;let r=i.target,s=i.detail;!s||!s.fatal||(((e=We.get(r))!=null?e:{}).error=s,(t=r.mux)==null||t.emit("error",{player_error_code:s.code,player_error_message:s.message,player_error_context:s.context}))}var BL=(i,e)=>{var t,r,s;console.error("getErrorFromHlsErrorData()",i);let n={[fe.ErrorTypes.NETWORK_ERROR]:G.MEDIA_ERR_NETWORK,[fe.ErrorTypes.MEDIA_ERROR]:G.MEDIA_ERR_DECODE,[fe.ErrorTypes.KEY_SYSTEM_ERROR]:G.MEDIA_ERR_ENCRYPTED},a=u=>[fe.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fe.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(u.details)?G.MEDIA_ERR_NETWORK:n[u.type],o=u=>{if(u.type===fe.ErrorTypes.KEY_SYSTEM_ERROR)return Oe.DRM;
50if(u.type===fe.ErrorTypes.NETWORK_ERROR)return Oe.VIDEO},l,d=a(i);if(d===G.MEDIA_ERR_NETWORK&&i.response){let u=(t=o(i))!=null?t:Oe.VIDEO;l=(r=hd(i.response,u,e,i.fatal))!=null?r:new G("",d,i.fatal)}else if(d===G.MEDIA_ERR_ENCRYPTED)if(i.details===fe.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE){let u=Z("Attempting to play DRM-protected content without providing a DRM token.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_MISSING_TOKEN}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_NO_ACCESS){let u=Z("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_NO_SESSION){let u=Z("Failed to generate a DRM license request. This may be an issue with the player or your protected content.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,!0),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_GENERATE_REQUEST_FAILED}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED){let u=Z("Failed to update DRM license. This may be an issue with the player or your protected content.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_UPDATE_LICENSE_FAILED}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED){let u=Z("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_UPDATE_SERVER_CERT_FAILED}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR){let u=Z("The DRM Content Decryption Module system had an internal failure. Try reloading the page, upading your browser, or playing in another browser.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_CDM_ERROR}else if(i.details===fe.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED){let u=Z("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen.");l=new G(u,G.MEDIA_ERR_ENCRYPTED,!1),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_OUTPUT_RESTRICTED}else l=new G(i.error.message,G.MEDIA_ERR_ENCRYPTED,i.fatal),l.errorCategory=Oe.DRM,l.muxCode=ee.ENCRYPTED_ERROR;else l=new G("",d,i.fatal);return l.context||(l.context=`${i.url?`url: ${i.url} 51`:""}${i.response&&(i.response.code||i.response.text)?`response: ${i.response.code}, ${i.response.text} 52`:""}${i.reason?`failure reason: ${i.reason} 53`:""}${i.level?`level: ${i.level} 54`:""}${i.parent?`parent stream controller: ${i.parent} 55`:""}${i.buffer?`buffer length: ${i.buffer} 56`:""}${i.error?`error: ${i.error} 57`:""}${i.event?`event: ${i.event} 58`:""}${i.err?`error message: ${(s=i.err)==null?void 0:s.message} 59`:""}`),l.data=i,l};const HL=["abort","canplay","canplaythrough","durationchange","emptied","encrypted","ended","error","loadeddata","loadedmetadata","loadstart","pause","play","playing","progress","ratechange","seeked","seeking","stalled","suspend","timeupdate","volumechange","waiting","waitingforkey","resize","enterpictureinpicture","leavepictureinpicture","webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"],mE=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function GL(i){return` 60 <style> 61 :host { 62 display: inline-flex; 63 line-height: 0; 64 flex-direction: column; 65 justify-content: end; 66 } 67 68 audio { 69 width: 100%; 70 } 71 </style> 72 <slot name="media"> 73 <audio${bE(i)}></audio> 74 </slot> 75 <slot></slot> 76 `}function KL(i){return` 77 <style> 78 :host { 79 display: inline-block; 80 line-height: 0; 81 } 82 83 video { 84 max-width: 100%; 85 max-height: 100%; 86 min-width: 100%; 87 min-height: 100%; 88 object-fit: var(--media-object-fit, contain); 89 object-position: var(--media-object-position, 50% 50%); 90 } 91 92 video::-webkit-media-text-track-container { 93 transform: var(--media-webkit-text-track-transform); 94 transition: var(--media-webkit-text-track-transition); 95 } 96 </style> 97 <slot name="media"> 98 <video${bE(i)}></video> 99 </slot> 100 <slot></slot> 101 `}function yE(i,{tag:e,is:t}){var n,a,o,l,d,pE,c,h,f,m,p,Wr,Sc,gE,xc,vE,EE;const r=(a=(n=globalThis.document)==null?void 0:n.createElement)==null?void 0:a.call(n,e,{is:t}),s=r?VL(r):[];return o=class extends i{constructor(){super(...arguments);ce(this,p);ce(this,c,!1);ce(this,h,null);ce(this,f,new Map);ce(this,m);_e(this,"get");_e(this,"set");_e(this,"call")}static get observedAttributes(){var P,I;return Ce(P=o,d,pE).call(P),[...((I=r==null?void 0:r.constructor)==null?void 0:I.observedAttributes)??[],...mE]}get nativeEl(){var S;return Ce(this,p,Wr).call(this),k(this,h)??this.querySelector(":scope > [slot=media]")??this.querySelector(e)??((S=this.shadowRoot)==null?void 0:S.querySelector(e))??null}set nativeEl(S){ae(this,h,S)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(S){this.toggleAttribute("muted",S)}get src(){return this.getAttribute("src")}set src(S){this.setAttribute("src",`${S}`)}get preload(){var S;return this.getAttribute("preload")??((S=this.nativeEl)==null?void 0:S.preload)}set preload(S){this.setAttribute("preload",`${S}`)}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});const S=WL(this.attributes);t&&(S.is=t),e&&(S.part=e),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(S)}this.nativeEl.muted=this.hasAttribute("muted");for(const S of s)Ce(this,p,vE).call(this,S);ae(this,m,new MutationObserver(Ce(this,p,gE).bind(this))),this.shadowRoot.addEventListener("slotchange",()=>Ce(this,p,Sc).call(this)),Ce(this,p,Sc).call(this);for(const S of this.constructor.Events)this.shadowRoot.addEventListener(S,this,!0)}handleEvent(S){S.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(S.type,{detail:S.detail}))}attributeChangedCallback(S,P,I){Ce(this,p,Wr).call(this),Ce(this,p,EE).call(this,S,P,I)}connectedCallback(){Ce(this,p,Wr).call(this)}},l=new WeakMap,d=new WeakSet,pE=function(){if(k(this,l))return;ae(this,l,!0);const S=new Set(this.observedAttributes);S.delete("muted");for(const P of s)if(!(P in this.prototype))if(typeof r[P]=="function")this.prototype[P]=function(...I){return Ce(this,p,Wr).call(this),(()=>{var F;if(this.call)return this.call(P,...I);const $=(F=this.nativeEl)==null?void 0:F[P];return $==null?void 0:$.apply(this.nativeEl,I)})()};else{const I={get(){var $,F;Ce(this,p,Wr).call(this);const M=P.toLowerCase();if(S.has(M)){const Q=this.getAttribute(M);return Q===null?!1:Q===""?!0:Q}return(($=this.get)==null?void 0:$.call(this,P))??((F=this.nativeEl)==null?void 0:F[P])}};P!==P.toUpperCase()&&(I.set=function(M){Ce(this,p,Wr).call(this);const $=P.toLowerCase();if(S.has($)){M===!0||M===!1||M==null?this.toggleAttribute($,!!M):this.setAttribute($,M);return}if(this.set){this.set(P,M);return}this.nativeEl&&(this.nativeEl[P]=M)}),Object.defineProperty(this.prototype,P,I)}},c=new WeakMap,h=new WeakMap,f=new WeakMap,m=new WeakMap,p=new WeakSet,Wr=function(){k(this,c)||(ae(this,c,!0),this.init())},Sc=function(){var M;const S=new Map(k(this,f)),P=(M=this.shadowRoot)==null?void 0:M.querySelector("slot:not([name])");(P==null?void 0:P.assignedElements({flatten:!0}).filter($=>
101["track","source"].includes($.localName))).forEach($=>{var Q,Y;S.delete($);let F=k(this,f).get($);F||(F=$.cloneNode(),k(this,f).set($,F),(Q=k(this,m))==null||Q.observe($,{attributes:!0})),(Y=this.nativeEl)==null||Y.append(F),Ce(this,p,xc).call(this,F)}),S.forEach(($,F)=>{$.remove(),k(this,f).delete(F)})},gE=function(S){for(const P of S)if(P.type==="attributes"){const{target:I,attributeName:M}=P,$=k(this,f).get(I);$&&M&&($.setAttribute(M,I.getAttribute(M)??""),Ce(this,p,xc).call(this,$))}},xc=function(S){S&&S.localName==="track"&&S.default&&(S.kind==="chapters"||S.kind==="metadata")&&S.track.mode==="disabled"&&(S.track.mode="hidden")},vE=function(S){if(Object.prototype.hasOwnProperty.call(this,S)){const P=this[S];delete this[S],this[S]=P}},EE=function(S,P,I){var M,$,F;["id","class"].includes(S)||!o.observedAttributes.includes(S)&&this.constructor.observedAttributes.includes(S)||(I===null?(M=this.nativeEl)==null||M.removeAttribute(S):(($=this.nativeEl)==null?void 0:$.getAttribute(S))!==I&&((F=this.nativeEl)==null||F.setAttribute(S,I)))},ce(o,d),_e(o,"getTemplateHTML",e.endsWith("audio")?GL:KL),_e(o,"shadowRootOptions",{mode:"open"}),_e(o,"Events",HL),ce(o,l,!1),o}function VL(i){const e=[];for(let t=Object.getPrototypeOf(i);t&&t!==HTMLElement.prototype;t=Object.getPrototypeOf(t)){const r=Object.getOwnPropertyNames(t);e.push(...r)}return e}function bE(i){let e="";for(const t in i){if(!mE.includes(t))continue;const r=i[t];r===""?e+=` ${t}`:e+=` ${t}="${r}"`}return e}function WL(i){const e={};for(const t of i)e[t.name]=t.value;return e}const yo=yE(globalThis.HTMLElement??class{},{tag:"video"});yE(globalThis.HTMLElement??class{},{tag:"audio"});var TE=i=>{throw TypeError(i)},Ef=(i,e,t)=>e.has(i)||TE("Cannot "+t),gt=(i,e,t)=>(Ef(i,e,"read from private field"),t?t.call(i):e.get(i)),jt=(i,e,t)=>e.has(i)?TE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Bt=(i,e,t,r)=>(Ef(i,e,"write to private field"),e.set(i,t),t),Pu=(i,e,t)=>(Ef(i,e,"access private method"),t),YL=()=>{try{return"0.26.0"}catch{}return"UNKNOWN"},qL=YL(),jL=()=>qL,zL=` 102<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" part="logo" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1600 500"><g fill="#fff"><path d="M994.287 93.486c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m0-93.486c-34.509 0-62.484 27.976-62.484 62.486v187.511c0 68.943-56.09 125.033-125.032 125.033s-125.03-56.09-125.03-125.033V62.486C681.741 27.976 653.765 0 619.256 0s-62.484 27.976-62.484 62.486v187.511C556.772 387.85 668.921 500 806.771 500c137.851 0 250.001-112.15 250.001-250.003V62.486c0-34.51-27.976-62.486-62.485-62.486M1537.51 468.511c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31m-275.883-218.509-143.33 143.329c-24.402 24.402-24.402 63.966 0 88.368 24.402 24.402 63.967 24.402 88.369 0l143.33-143.329 143.328 143.329c24.402 24.4 63.967 24.402 88.369 0 24.403-24.402 24.403-63.966.001-88.368l-143.33-143.329.001-.004 143.329-143.329c24.402-24.402 24.402-63.965 0-88.367s-63.967-24.402-88.369 0L1349.996 161.63 1206.667 18.302c-24.402-24.401-63.967-24.402-88.369 0s-24.402 63.965 0 88.367l143.329 143.329v.004ZM437.511 468.521c-17.121 0-31-13.879-31-31 0-17.121 13.879-31 31-31 17.121 0 31 13.879 31 31 0 17.121-13.879 31-31 31M461.426 4.759C438.078-4.913 411.2.432 393.33 18.303L249.999 161.632 106.669 18.303C88.798.432 61.922-4.913 38.573 4.759 15.224 14.43-.001 37.214-.001 62.488v375.026c0 34.51 27.977 62.486 62.487 62.486 34.51 0 62.486-27.976 62.486-62.486V213.341l80.843 80.844c24.404 24.402 63.965 24.402 88.369 0l80.843-80.844v224.173c0 34.51 27.976 62.486 62.486 62.486s62.486-27.976 62.486-62.486V62.488c0-25.274-15.224-48.058-38.573-57.729" style="fill-rule:nonzero"/></g></svg>`,D={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",RENDITION_ORDER:"rendition-order",PROGRAM_START_TIME:"program-start-time",PROGRAM_END_TIME:"program-end-time",ASSET_START_TIME:"asset-start-time",ASSET_END_TIME:"asset-end-time",METADATA_URL:"metadata-url",PLAYBACK_ID:"playback-id",PLAYER_SOFTWARE_NAME:"player-software-name",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_INIT_TIME:"player-init-time",PREFER_CMCD:"prefer-cmcd",PREFER_PLAYBACK:"prefer-playback",START_TIME:"start-time",STREAM_TYPE:"stream-type",TARGET_LIVE_WINDOW:"target-live-window",LIVE_EDGE_OFFSET:"live-edge-offset",TYPE:"type",LOGO:"logo"},XL=Object.values(D),Jp=jL(),eg="mux-video",ui,ia,qo,ra,jo,zo,Xo,Qo,Zo,sa,na,Jo,QL=class extends yo{constructor(){super(),jt(this,na),jt(this,ui),jt(this,ia),jt(this,qo),jt(this,ra,{}),jt(this,jo,{}
vendor: 9,763 bytes, lines 102-130
102),jt(this,zo),jt(this,Xo),jt(this,Qo),jt(this,Zo),jt(this,sa,""),Bt(this,qo,rE()),this.nativeEl.addEventListener("muxmetadata",i=>{var e;let t=RL(this.nativeEl),r=(e=this.metadata)!=null?e:{};this.metadata={...t,...r},(t==null?void 0:t["com.mux.video.branding"])==="mux-free-plan"&&(Bt(this,sa,"default"),this.updateLogo())})}static get NAME(){return eg}static get VERSION(){return Jp}static get observedAttributes(){var i;return[...XL,...(i=yo.observedAttributes)!=null?i:[]]}static getLogoHTML(i){return!i||i==="false"?"":i==="default"?zL:`<img part="logo" src="${i}" />`}static getTemplateHTML(i={}){var e;return` 103 ${yo.getTemplateHTML(i)} 104 <style> 105 :host { 106 position: relative; 107 } 108 slot[name="logo"] { 109 display: flex; 110 justify-content: end; 111 position: absolute; 112 top: 1rem; 113 right: 1rem; 114 opacity: 0; 115 transition: opacity 0.25s ease-in-out; 116 z-index: 1; 117 } 118 slot[name="logo"]:has([part="logo"]) { 119 opacity: 1; 120 } 121 slot[name="logo"] [part="logo"] { 122 width: 5rem; 123 pointer-events: none; 124 user-select: none; 125 } 126 </style> 127 <slot name="logo"> 128 ${this.getLogoHTML((e=i[D.LOGO])!=null?e:"")} 129 </slot> 130 `}get preferCmcd(){var i;return(i=this.getAttribute(D.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?cd.includes(i)?this.setAttribute(D.PREFER_CMCD,i):console.warn(`Invalid value for preferCmcd. Must be one of ${cd.join()}`):this.removeAttribute(D.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(D.PLAYER_INIT_TIME)?+this.getAttribute(D.PLAYER_INIT_TIME):gt(this,qo)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(D.PLAYER_INIT_TIME):this.setAttribute(D.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=gt(this,Qo))!=null?i:eg}set playerSoftwareName(i){Bt(this,Qo,i)}get playerSoftwareVersion(){var i;return(i=gt(this,Xo))!=null?i:Jp}set playerSoftwareVersion(i){Bt(this,Xo,i)}get _hls(){var i;return(i=gt(this,ui))==null?void 0:i.engine}get mux(){var i;return(i=this.nativeEl)==null?void 0:i.mux}get error(){var i;return(i=sE(this.nativeEl))!=null?i:null}get errorTranslator(){return gt(this,Zo)}set errorTranslator(i){Bt(this,Zo,i)}get src(){return this.getAttribute("src")}set src(i){i!==this.src&&(i==null?this.removeAttribute("src"):this.setAttribute("src",i))}get type(){var i;return(i=this.getAttribute(D.TYPE))!=null?i:void 0}set type(i){i!==this.type&&(i?this.setAttribute(D.TYPE,i):this.removeAttribute(D.TYPE))}get preload(){let i=this.getAttribute("preload");return i===""?"auto":["none","metadata","auto"].includes(i)?i:super.preload}set preload(i){i!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(i)?this.setAttribute("preload",i):this.removeAttribute("preload"))}get debug(){return this.getAttribute(D.DEBUG)!=null}set debug(i){i!==this.debug&&(i?this.setAttribute(D.DEBUG,""):this.removeAttribute(D.DEBUG))}get disableTracking(){return this.hasAttribute(D.DISABLE_TRACKING)}set disableTracking(i){i!==this.disableTracking&&this.toggleAttribute(D.DISABLE_TRACKING,!!i)}get disableCookies(){return this.hasAttribute(D.DISABLE_COOKIES)}set disableCookies(i){i!==this.disableCookies&&(i?this.setAttribute(D.DISABLE_COOKIES,""):this.removeAttribute(D.DISABLE_COOKIES))}get startTime(){let i=this.getAttribute(D.START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set startTime(i){i!==this.startTime&&(i==null?this.removeAttribute(D.START_TIME):this.setAttribute(D.START_TIME,`${i}`))}get playbackId(){var i;return this.hasAttribute(D.PLAYBACK_ID)?this.getAttribute(D.PLAYBACK_ID):(i=pf(this.src))!=null?i:void 0}set playbackId(i){i!==this.playbackId&&(i?this.setAttribute(D.PLAYBACK_ID,i):this.removeAttribute(D.PLAYBACK_ID))}get maxResolution(){var i;return(i=this.getAttribute(D.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(D.MAX_RESOLUTION,i):this.removeAttribute(D.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(D.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(D.MIN_RESOLUTION,i):this.removeAttribute(D.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(D.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(D.RENDITION_ORDER,i):this.removeAttribute(D.RENDITION_ORDER))}get programStartTime(){let i=this.getAttribute(D.PROGRAM_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programStartTime(i){i==null?this.removeAttribute(D.PROGRAM_START_TIME):this.setAttribute(D.PROGRAM_START_TIME,`${i}`)}get programEndTime(){let i=this.getAttribute(D.PROGRAM_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set programEndTime(i){i==null?this.removeAttribute(D.PROGRAM_END_TIME):this.setAttribute(D.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){let i=this.getAttribute(D.ASSET_START_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetStartTime(i){i==null?this.removeAttribute(D.ASSET_START_TIME):this.setAttribute(D.ASSET_START_TIME,`${i}`)}get assetEndTime(){let i=this.getAttribute(D.ASSET_END_TIME);if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}set assetEndTime(i){i==null?this.removeAttribute(D.ASSET_END_TIME):this.setAttribute(D.ASSET_END_TIME,`${i}`)}get customDomain(){var i;return(i=this.getAttribute(D.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(D.CUSTOM_DOMAIN,i):this.removeAttribute(D.CUSTOM_DOMAIN))}get drmToken(){var i;return(i=this.getAttribute(D.DRM_TOKEN))!=null?i:void 0}set drmToken(i){i!==this.drmToken&&(i?this.setAttribute(D.DRM_TOKEN,i):this.removeAttribute(D.DRM_TOKEN))}get playbackToken(){var i,e,t,r;if(this.hasAttribute(D.PLAYBACK_TOKEN))return(i=this.getAttribute(D.PLAYBACK_TOKEN))!=null?i:void 0;if(this.hasAttribute(D.PLAYBACK_ID)){let[,s]=uf((e=this.playbackId)!=null?e:"");return(t=new URLSearchParams(s).get("token"))!=null?t:void 0}if(this.src)return(r=new URLSearchParams(this.src).get("token"))!=null?r:void 0}set playbackToken(i){i!==this.playbackToken&&(i?this.setAttribute(D.PLAYBACK_TOKEN,i):this.removeAttribute(D.PLAYBACK_TOKEN))}get tokens(){let i=this.getAttribute(D.PLAYBACK_TOKEN),e=this.getAttribute(D.DRM_TOKEN);return{...gt(this,jo),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{}}}set tokens(i){Bt(this,jo,i??{})}get ended(){return oE(this.nativeEl,this._hls)}get envKey(){var i;return(i=this.getAttribute(D.ENV_KEY))!=null?i:void 0}set envKey(i){i!==this.envKey&&(i?this.setAttribute(D.ENV_KEY,i):this.removeAttribute(D.ENV_KEY))}get beaconCollectionDomain(){var i;return(i=this.getAttribute(D.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(D.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(D.BEACON_COLLECTION_DOMAIN))}get streamType(){var i;return(i=this.getAttribute(D.STREAM_TYPE))!=null?i:_c(this.nativeEl)}set streamType(i){i!==this.streamType&&(i?this.setAttribute(D.STREAM_TYPE,i):this.removeAttribute(D.STREAM_TYPE))}get targetLiveWindow(){return this.hasAttribute(D.TARGET_LIVE_WINDOW)?+this.getAttribute(D.TARGET_LIVE_WINDOW):LL(this.nativeEl)}set targetLiveWindow(i){i!=this.targetLiveWindow&&(i==null?this.removeAttribute(D.TARGET_LIVE_WINDOW):this.setAttribute(D.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i,e;if(this.hasAttribute(D.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:t}=this,r=(i=this.nativeEl.seekable.end(0))!=null?i:0,s=(e=this.nativeEl.seekable.start(0))!=null?e:0;return Math.max(s,r-t)}return IL(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(D.LIVE_EDGE_OFFSET))return+this.getAttribute(D.LIVE_EDGE_OFFSET)}set liveEdgeOffset(i){i!=this.liveEdgeOffset&&(i==null?this.removeAttribute(D.LIVE_EDGE_OFFSET):this.setAttribute(D.LIVE_EDGE_OFFSET,`${+i}`))}get seekable(){return gf(this.nativeEl)}async addCuePoints(i){return zv(this.nativeEl,i)}get activeCuePoint(){return Xv(this.nativeEl)}get cuePoints(){return eL(this.nativeEl)}async addChapters(i){return Zv(this.nativeEl,i)}get activeChapter(){return Jv(this.nativeEl)}get chapters(){return iL(this.nativeEl)}getStartDate(){return sL(this.nativeEl,this._hls)}get currentPdt(){return nL(this.nativeEl,this._hls)}get preferPlayback(){let i=this.getAttribute(D.PREFER_PLAYBACK);if(i===Ii.MSE||i===Ii.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Ii.MSE||i===Ii.NATIVE?this.setAttribute(D.PREFER_PLAYBACK,i):this.removeAttribute(D.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(i=>i.startsWith("metadata-")&&![D.METADATA_URL].includes(i)).reduce((i,e)=>{let t=this.getAttribute(e);return t!=null&&(i[e.replace(/^metadata-/,"").replace(/-/g,"_")]=t),i},{}),...gt(this,ra)}}set metadata(i){Bt(this,ra,i??{}),this.mux&&this.mux.emit("hb",gt(this,ra))}get _hlsConfig(){return gt(this,zo)}set _hlsConfig(i){Bt(this,zo,i)}get logo(){var i;return(i=this.getAttribute(D.LOGO))!=null?i:gt(this,sa)}set logo(i){i?this.setAttribute(D.LOGO,i):this.removeAttribute(D.LOGO)}load(){Bt(this,ui,DL(this,this.nativeEl,gt(this,ui)))}unload(){lE(this.nativeEl,gt(this,ui),this),Bt(this,ui,void 0)}attributeChangedCallback(i,e,t){var r,s;switch(yo.observedAttributes.includes(i)&&!["src","autoplay","preload"].includes(i)&&super.attributeChangedCallback(i,e,t),i){case D.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=t??void 0;break;case D.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=t??void 0;break;case"src":{let n=!!e,a=!!t;!n&&a?Pu(this,na,Jo).call(this):n&&!a?this.unload():n&&a&&(this.unload(),Pu(this,na,Jo).call(this));break}
130case"autoplay":if(t===e)break;(r=gt(this,ui))==null||r.setAutoplay(this.autoplay);break;case"preload":if(t===e)break;(s=gt(this,ui))==null||s.setPreload(t);break;case D.PLAYBACK_ID:this.src=Tc(this);break;case D.DEBUG:{let n=this.debug;this.mux&&console.info("Cannot toggle debug mode of mux data after initialization. Make sure you set all metadata to override before setting the src."),this._hls&&(this._hls.config.debug=n);break}case D.METADATA_URL:t&&fetch(t).then(n=>n.json()).then(n=>this.metadata=n).catch(()=>console.error(`Unable to load or parse metadata JSON from metadata-url ${t}!`));break;case D.STREAM_TYPE:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case D.TARGET_LIVE_WINDOW:(t==null||t!==e)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case D.LOGO:(t==null||t!==e)&&this.updateLogo();break}}updateLogo(){if(!this.shadowRoot)return;let i=this.shadowRoot.querySelector('slot[name="logo"]');if(!i)return;let e=this.constructor.getLogoHTML(gt(this,sa)||this.logo);i.innerHTML=e}connectedCallback(){var i;(i=super.connectedCallback)==null||i.call(this),this.nativeEl&&this.src&&!gt(this,ui)&&Pu(this,na,Jo).call(this)}disconnectedCallback(){this.unload()}handleEvent(i){i.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(i.type,{composed:!0,detail:i.detail}))}};ui=new WeakMap,ia=new WeakMap,qo=new WeakMap,ra=new WeakMap,jo=new WeakMap,zo=new WeakMap,Xo=new WeakMap,Qo=new WeakMap,Zo=new WeakMap,sa=new WeakMap,na=new WeakSet,Jo=async function(){gt(this,ia)||(await Bt(this,ia,Promise.resolve()),Bt(this,ia,null),this.load())};const gs=new WeakMap;class Nu extends Error{}class ZL extends Error{}const JL=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"],eI=globalThis.WeakRef?class extends Set{add(i){super.add(new WeakRef(i))}forEach(i){super.forEach(e=>{const t=e.deref();t&&i(t)})}}:Set;function tI(i){var e,t,r;(t=(e=globalThis.chrome)==null?void 0:e.cast)!=null&&t.isAvailable?(r=globalThis.cast)!=null&&r.framework?i():customElements.whenDefined("google-cast-button").then(i):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(i)}}function iI(){return globalThis.chrome}function rI(){var t;const i="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((t=globalThis.chrome)!=null&&t.cast||document.querySelector(`script[src="${i}"]`))return;const e=document.createElement("script");e.src=i,document.head.append(e)}function Mr(){var i,e;return(e=(i=globalThis.cast)==null?void 0:i.framework)==null?void 0:e.CastContext.getInstance()}function yf(){var i;return(i=Mr())==null?void 0:i.getCurrentSession()}function bf(){var i;return(i=yf())==null?void 0:i.getSessionObj().media[0]}function sI(i){return new Promise((e,t)=>{bf().editTracksInfo(i,e,t)})}function nI(i){return new Promise((e,t)=>{bf().getStatus(i,e,t)})}function tg(i){return Mr().setOptions({..._E(),...i})}function _E(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function aI(i){if(!i)return;const e=/\.([a-zA-Z0-9]+)(?:\?.*)?$/,t=i.match(e);return t?t[1]:null}function oI(i){const e=i.split(` 131`),t=[];for(let r=0;r<e.length;r++)if(e[r].trim().startsWith("#EXT-X-STREAM-INF")){const n=e[r+1]?e[r+1].trim():"";n&&!n.startsWith("#")&&t.push(n)}return t}function lI(i){return i.split(` 132`).find(r=>!r.trim().startsWith("#")&&r.trim()!=="")}async function dI(i){try{const t=(await fetch(i,{method:"HEAD"})).headers.get("Content-Type");return JL.some(r=>t===r)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function uI(i){try{const e=await(await fetch(i)).text();let t=e;const r=oI(e);if(r.length>0){const a=new URL(r[0],i).toString();t=await(await fetch(a)).text()}const s=lI(t);return aI(s)}catch(e){console.error("Error while trying to parse the manifest playlist",e);return}}const el=new eI,sr=new WeakSet;let rt;tI(()=>{var i,e,t,r;if(!((e=(i=globalThis.chrome)==null?void 0:i.cast)!=null&&e.isAvailable)){console.debug("chrome.cast.isAvailable",(r=(t=globalThis.chrome)==null?void 0:t.cast)==null?void 0:r.isAvailable);return}rt||(rt=cast.framework,Mr().addEventListener(rt.CastContextEventType.CAST_STATE_CHANGED,s=>{el.forEach(n=>{var a,o;return(o=(a=gs.get(n)).onCastStateChanged)==null?void 0:o.call(a,s)})}),Mr().addEventListener(rt.CastContextEventType.SESSION_STATE_CHANGED,s=>{el.forEach(n=>{var a,o;return(o=(a=gs.get(n)).onSessionStateChanged)==null?void 0:o.call(a,s)})}),el.forEach(s=>{var n,a;return(a=(n=gs.get(s)).init)==null?void 0:a.call(n)}))});let ig=0;var Ae,Ja,Mt,ji,cs,hs,br,Md,Ne,Yr,AE,SE,Rc,xE,Lc,RE,Ic;
vendor: 1,941 bytes, line 132
132class cI extends EventTarget{constructor(t){super();ce(this,Ne);ce(this,Ae);ce(this,Ja);ce(this,Mt);ce(this,ji);ce(this,cs,"disconnected");ce(this,hs,!1);ce(this,br,new Set);ce(this,Md,new WeakMap);ae(this,Ae,t),el.add(this),gs.set(this,{init:()=>Ce(this,Ne,Lc).call(this),onCastStateChanged:()=>Ce(this,Ne,Rc).call(this),onSessionStateChanged:()=>Ce(this,Ne,xE).call(this),getCastPlayer:()=>k(this,Ne,Yr)}),Ce(this,Ne,Lc).call(this)}get state(){return k(this,cs)}async watchAvailability(t){if(k(this,Ae).disableRemotePlayback)throw new Nu("disableRemotePlayback attribute is present.");return k(this,Md).set(t,++ig),k(this,br).add(t),queueMicrotask(()=>t(Ce(this,Ne,SE).call(this))),ig}async cancelWatchAvailability(t){if(k(this,Ae).disableRemotePlayback)throw new Nu("disableRemotePlayback attribute is present.");t?k(this,br).delete(t):k(this,br).clear()}async prompt(){var r,s,n,a;if(k(this,Ae).disableRemotePlayback)throw new Nu("disableRemotePlayback attribute is present.");if(!((s=(r=globalThis.chrome)==null?void 0:r.cast)!=null&&s.isAvailable))throw new ZL("The RemotePlayback API is disabled on this platform.");const t=sr.has(k(this,Ae));sr.add(k(this,Ae)),tg(k(this,Ae).castOptions),Object.entries(k(this,ji)).forEach(([o,l])=>{k(this,Mt).controller.addEventListener(o,l)});try{await Mr().requestSession()}catch(o){if(t||sr.delete(k(this,Ae)),o==="cancel")return;throw new Error(o)}(a=(n=gs.get(k(this,Ae)))==null?void 0:n.loadOnPrompt)==null||a.call(n)}}Ae=new WeakMap,Ja=new WeakMap,Mt=new WeakMap,ji=new WeakMap,cs=new WeakMap,hs=new WeakMap,br=new WeakMap,Md=new WeakMap,Ne=new WeakSet,Yr=function(){if(sr.has(k(this,Ae)))return k(this,Mt)},AE=function(){sr.has(k(this,Ae))&&(Object.entries(k(this,ji)).forEach(([t,r])=>{k(this,Mt).controller.removeEventListener(t,r)}),sr.delete(k(this,Ae)),k(this,Ae).muted=k(this,Mt).isMuted,k(this,Ae).currentTime=k(this,Mt).savedPlayerState.currentTime,k(this,Mt).savedPlayerState.isPau
132sed===!1&&k(this,Ae).play())},SE=function(){var r;const t=(r=Mr())==null?void 0:r.getCastState();return t&&t!=="NO_DEVICES_AVAILABLE"},Rc=function(){const t=Mr().getCastState();if(sr.has(k(this,Ae))&&t==="CONNECTING"&&(ae(this,cs,"connecting"),this.dispatchEvent(new Event("connecting"))),!k(this,hs)&&(t!=null&&t.includes("CONNECT"))){ae(this,hs,!0);for(let r of k(this,br))r(!0)}else if(k(this,hs)&&(!t||t==="NO_DEVICES_AVAILABLE")){ae(this,hs,!1);for(let r of k(this,br))r(!1)}},xE=async function(){var r;const{SESSION_RESUMED:t}=rt.SessionState;if(Mr().getSessionState()===t&&k(this,Ae).castSrc===((r=bf())==null?void 0:r.media.contentId)){sr.add(k(this,Ae)),Object.entries(k(this,ji)).forEach(([s,n])=>{k(this,Mt).controller.addEventListener(s,n)});try{await nI(new chrome.cast.media.GetStatusRequest)}catch(s){console.error(s)}k(this,ji)[rt.RemotePlayerEventType.IS_PAUSED_CHANGED](),k(this,ji)[rt.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}},Lc=function(){!rt||k(this,Ja)||(ae(this,Ja,!0),tg(k(this,Ae).castOptions),k(this,Ae).textTracks.addEventListener("change",()=>Ce(this,Ne,Ic).call(this)),Ce(this,Ne,Rc).call(this),ae(this,Mt,new rt.RemotePlayer),new rt.RemotePlayerController(k(this,Mt)),ae(this,ji,{[rt.RemotePlayerEventType.IS_CONNECTED_CHANGED]:({value:t})=>{t===!0?(ae(this,cs,"connected"),this.dispatchEvent(new Event("connect"))):(Ce(this,Ne,AE).call(this),ae(this,cs,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[rt.RemotePlayerEventType.DURATION_CHANGED]:()=>{k(this,Ae).dispatchEvent(new Event("durationchange"))},[rt.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{k(this,Ae).dispatchEvent(new Event("volumechange"))},[rt.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{k(this,Ae).dispatchEvent(new Event("volumechange"))},[rt.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var t;(t=k(this,Ne,Yr))!=null&&t.isMediaLoaded&&k(this,Ae).dispatchEvent(new Event("timeupdate"))},[rt.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{k(this,Ae).dispatchEvent(new Event("resize"))},[rt.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{k(this,Ae).dispatchEvent(new Event(this.paused?"pause":"play"))},[rt.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var t,r;((t=k(this,Ne,Yr))==null?void 0:t.playerState)!==chrome.cast.media.PlayerState.PAUSED&&k(this,Ae).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[(r=k(this,Ne,Yr))==null?void 0:r.playerState]))},[rt.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var t;(t=k(this,Ne,Yr))!=null&&t.isMediaLoaded&&(await Promise.resolve(),Ce(this,Ne,RE).call(this))}}))},RE=function(){Ce(this,Ne,Ic).call(this)},Ic=async function(){var h,f,m;if(!k(this,Ne,Yr))return;const r=(((h=k(this,Mt).mediaInfo)==null?void 0:h.tracks)??[]).filter(({type:p})=>p===chrome.cast.media.TrackType.TEXT),s=[...k(this,Ae).textTracks].filter(({kind:p})=>p==="subtitles"||p==="captions"),n=r.map(({language:p,name:g,trackId:v})=>{const{mode:b}=s.find(y=>y.language===p&&y.label===g)??{};return b?{mode:b,trackId:v}:!1}).filter(Boolean),o=n.filter(({mode:p})=>p!=="showing").map(({trackId:p})=>p),l=n.find(({mode:p})=>p==="showing"),d=((m=(f=yf())==null?void 0:f.getSessionObj().media[0])==null?void 0:m.activeTrackIds)??[];let u=d;if(d.length&&(u=u.filter(p=>!o.includes(p))),l!=null&&l.trackId&&(u=[...u,l.trackId]),u=[...new Set(u)],!((p,g)=>p.length===g.length&&p.every(v=>g.includes(v)))(d,u))try{const p=new chrome.cast.media.EditTracksInfoRequest(u);await sI(p)}catch(p){console.error(p)}};const hI=i=>{var e,t,r,s,n,a,ye,LE;return e=class extends i{constructor(){super(...arguments);ce(this,a);ce(this,t,{paused:!1});ce(this,r,_E());ce(this,s);ce(this,n)}get remote(){return k(this,n)?k(this,n):iI()?(this.disableRemotePlayback||rI(),gs.set(this,{loadOnPrompt:()=>Ce(this,a,LE).call(this)}),ae(this,n,new cI(this))):super.remote}attributeChangedCallback(c,h,f){if(super.attributeChangedCallback(c,h,f),c==="cast-receiver"&&f){k(this,r).receiverApplicationId=f;return}if(k(this,a,ye))switch(c){case"cast-stream-type":case"cast-src":this.load();break}}async load(){var g;if(!k(this,a,ye))return super.load();const c=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);c.customData=this.castCustomData;const h=[...this.querySelectorAll("track")].filter(({kind:v,src:b})=>b&&(v==="subtitles"||v==="captions")),f=[];let m=0;if(h.length&&(c.tracks=h.map(v=>{const b=++m;f.length===0&&v.track.mode==="showing"&&f.push(b);const y=new chrome.cast.media.Track(b,chrome.cast.media.TrackType.TEXT);return y.trackContentId=v.src,y.trackContentType="text/vtt",y.subtype=v.kind==="captions"?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,y.name=v.label,y.language=v.srclang,y})),this.castStreamType==="live"?c.streamType=chrome.cast.media.StreamType.LIVE:c.streamType=chrome.cast.media.StreamType.BUFFERED,c.metadata=new chrome.cast.media.GenericMediaMetadata,c.metadata.title=this.title,c.metadata.images=[{url:this.poster}],dI(this.castSrc)){const v=await uI(this.castSrc);((v==null?void 0:v.includes("m4s"))||(v==null?void 0:v.includes("mp4")))&&(c.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,c.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4)}const p=new chrome.cast.media.LoadRequest(c);p.currentTime=super.currentTime??0,p.autoplay=!k(this,t).paused,p.activeTrackIds=f,await((g=yf())==null?void 0:g.loadMedia(p)),this.dispatchEvent(new Event("volumechange"))}play(){var c;if(k(this,a,ye)){k(this,a,ye).isPaused&&((c=k(this,a,ye).controller)==null||c.playOrPause());return}return super.play()}pause(){var c;if(k(this,a,ye)){k(this,a,ye).isPaused||(c=k(this,a,ye).controller)==null||c.playOrPause();return}super.pause()}get castOptions(){return k(this,r)}get castReceiver(){return this.getAttribute("cast-receiver")??void 0}set castReceiver(c){this.castReceiver!=c&&this.setAttribute("cast-receiver",`${c}`)}get castSrc(){var c;return this.getAttribute("cast-src")??((c=this.querySelector("source"))==null?void 0:c.src)??this.currentSrc}set castSrc(c){this.castSrc!=c&&this.setAttribute("cast-src",`${c}`)}get castContentType(){return this.getAttribute("cast-content-type")??void 0}set castContentType(c){this.setAttribute("cast-content-type",`${c}`)}get castStreamType(){return this.getAttribute("cast-stream-type")??this.streamType??void 0}set castStreamType(c){this.setAttribute("cast-stream-type",`${c}`)}get castCustomData(){return k(this,s)}set castCustomData(c){const h=typeof c;if(!["object","undefined"].includes(h)){console.error(`castCustomData must be nullish or an object but value was of type ${h}`);return}ae(this,s,c)}get readyState(){if(k(this,a,ye))switch(k(this,a,ye).playerState){case chrome.cast.media.PlayerState.IDLE:return 0;case chrome.cast.media.PlayerState.BUFFERING:return 2;default:return 3}return super.readyState}get paused(){return k(this,a,ye)?k(this,a,ye).isPaused:super.paused}get muted(){var c;return k(this,a,ye)?(c=k(this,a,ye))==null?void 0:c.isMuted:super.muted}set muted(c){var h;if(k(this,a,ye)){(c&&!k(this,a,ye).isMuted||!c&&k(this,a,ye).isMuted)&&((h=k(this,a,ye).controller)==null||h.muteOrUnmute());return}super.muted=c}get volume(){var c;return k(this,a,ye)?((c=k(this,a,ye))==null?void 0:c.volumeLevel)??1:super.volume}set volume(c){var h;if(k(this,a,ye)){k(this,a,ye).volumeLevel=+c,(h=k(this,a,ye).controller)==null||h.setVolumeLevel();return}super.volume=c}get duration(){var c,h;return k(this,a,ye)&&((c=k(this,a,ye))!=null&&c.isMediaLoaded)?((h=k(this,a,ye))==null?void 0:h.duration)??NaN:super.duration}get currentTime(){var c,h;return k(this,a,ye)&&((c=k(this,a,ye))!=null&&c.isMediaLoaded)?((h=k(this,a,ye))==null?void 0:h.currentTime)??0:super.currentTime}set currentTime(c){var h;if(k(this,a,ye)){k(this,a,ye).currentTime=c,(h=k(this,a,ye).controller)==null||h.seek();return}super.currentTime=c}},t=new WeakMap,r=new WeakMap,s=new WeakMap,n=new WeakMap,a=new WeakSet,ye=function(){var c,h;
132return(h=(c=gs.get(this.remote))==null?void 0:c.getCastPlayer)==null?void 0:h.call(c)},LE=async function(){k(this,t).paused=io(e.prototype,this,"paused"),io(e.prototype,this,"pause").call(this),this.muted=io(e.prototype,this,"muted");try{await this.load()}catch(c){console.error(c)}},_e(e,"observedAttributes",[...i.observedAttributes??[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),e};class Bd extends Event{constructor(t,r){super(t);_e(this,"track");this.track=r.track}}const kc=new WeakMap;function W(i){return kc.get(i)??fI(i,{})}function fI(i,e){let t=kc.get(i);return t||kc.set(i,t={}),Object.assign(t,e)}function wc(i,e){const t=i.videoTracks;W(e).media=i,W(e).renditionSet||(W(e).renditionSet=new Set);const r=W(t).trackSet;r.add(e);const s=r.size-1;s in Cc.prototype||Object.defineProperty(Cc.prototype,s,{get(){return[...W(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Bd("addtrack",{track:e}))})}function Dc(i){var r;const e=(r=W(i).media)==null?void 0:r.videoTracks;if(!e)return;W(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new Bd("removetrack",{track:i}))})}function mI(i){const e=W(i).media.videoTracks??[];let t=!1;for(const r of e)r!==i&&(r.selected=!1,t=!0);if(t){if(W(e).changeRequested)return;W(e).changeRequested=!0,queueMicrotask(()=>{delete W(e).changeRequested,e.dispatchEvent(new Event("change"))})}}var Tr,_r,Ar,fs,aa;class Cc extends EventTarget{constructor(){super();ce(this,fs);ce(this,Tr);ce(this,_r);ce(this,Ar);W(this).trackSet=new Set}[Symbol.iterator](){return k(this,fs,aa).values()}get length(){return k(this,fs,aa).size}getTrackById(t){return[...k(this,fs,aa)].find(r=>r.id===t)??null}get selectedIndex(){return[...k(this,fs,aa)].findIndex(t=>t.selected)}get onaddtrack(){return k(this,Tr)}set onaddtrack(t){k(this,Tr)&&(this.removeEventListener("addtrack",k(this,Tr)),ae(this,Tr,void 0)),typeof t=="function"&&(ae(this,Tr,t),this.addEventListener("addtrack",t))}get onremovetrack(){return k(this,_r)}set onremovetrack(t){k(this,_r)&&(this.removeEventListener("removetrack",k(this,_r)),ae(this,_r,void 0)),typeof t=="function"&&(ae(this,_r,t),this.addEventListener("removetrack",t))}get onchange(){return k(this,Ar)}set onchange(t){k(this,Ar)&&(this.removeEventListener("change",k(this,Ar)),ae(this,Ar,void 0)),typeof t=="function"&&(ae(this,Ar,t),this.addEventListener("change",t))}}Tr=new WeakMap,_r=new WeakMap,Ar=new WeakMap,fs=new WeakSet,aa=function(){return W(this).trackSet};class Hd extends Event{constructor(t,r){super(t);_e(this,"rendition");this.rendition=r.rendition}}function pI(i,e){const t=W(i).media.videoRenditions;W(e).media=W(i).media,W(e).track=i;const r=W(i).renditionSet;r.add(e);const s=r.size-1;s in Mc.prototype||Object.defineProperty(Mc.prototype,s,{get(){return $s(this)[s]}}),queueMicrotask(()=>{i.selected&&t.dispatchEvent(new Hd("addrendition",{rendition:e}))})}function gI(i){const e=W(i).media.videoRenditions,t=W(i).track;W(t).renditionSet.delete(i),queueMicrotask(()=>{W(i).track.selected&&e.dispatchEvent(new Hd("removerendition",{rendition:i}))})}function vI(i){const e=W(i).media.videoRenditions;!e||W(e).changeRequested||(W(e).changeRequested=!0,queueMicrotask(()=>{delete W(e).changeRequested,W(i).track.selected&&e.dispatchEvent(new Event("change"))}))}function $s(i){return[...W(i).media.videoTracks].filter(t=>t.selected).flatMap(t=>[...W(t).renditionSet])}var Sr,xr,Rr;class Mc extends EventTarget{constructor(){super(...arguments);ce(this,Sr);ce(this,xr);ce(this,Rr)}[Symbol.iterator](){return $s(this).values()}get length(){return $s(this).length}getRenditionById(t){return $s(this).find(r=>`${r.id}`==`${t}`)??null}get selectedIndex(){return $s(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[r,s]of $s(this).entries())s.selected=r===t}get onaddrendition(){return k(this,Sr)}set onaddrendition(t){k(this,Sr)&&(this.removeEventListener("addrendition",k(this,Sr)),ae(this,Sr,void 0)),typeof t=="function"&&(ae(this,Sr,t),this.addEventListener("addrendition",t))}get onremoverendition(){return k(this,xr)}set onremoverendition(t){k(this,xr)&&(this.removeEventListener("removerendition",k(this,xr)),ae(this,xr,void 0)),typeof t=="function"&&(ae(this,xr,t),this.addEventListener("removerendition",t))}get onchange(){return k(this,Rr)}
132set onchange(t){k(this,Rr)&&(this.removeEventListener("change",k(this,Rr)),ae(this,Rr,void 0)),typeof t=="function"&&(ae(this,Rr,t),this.addEventListener("change",t))}}Sr=new WeakMap,xr=new WeakMap,Rr=new WeakMap;var yn;class EI{constructor(){_e(this,"src");_e(this,"id");_e(this,"width");_e(this,"height");_e(this,"bitrate");_e(this,"frameRate");_e(this,"codec");ce(this,yn,!1)}get selected(){return k(this,yn)}set selected(e){k(this,yn)!==e&&(ae(this,yn,e),vI(this))}}yn=new WeakMap;var bn;class IE{constructor(){_e(this,"id");_e(this,"kind");_e(this,"label","");_e(this,"language","");_e(this,"sourceBuffer");ce(this,bn,!1)}addRendition(e,t,r,s,n,a){const o=new EI;return o.src=e,o.width=t,o.height=r,o.frameRate=a,o.bitrate=n,o.codec=s,pI(this,o),o}removeRendition(e){gI(e)}get selected(){return k(this,bn)}set selected(e){k(this,bn)!==e&&(ae(this,bn,e),e===!0&&mI(this))}}bn=new WeakMap;function yI(i,e){const t=W(i).media.audioRenditions;W(e).media=W(i).media,W(e).track=i;const r=W(i).renditionSet;r.add(e);const s=r.size-1;s in Oc.prototype||Object.defineProperty(Oc.prototype,s,{get(){return Bs(this)[s]}}),queueMicrotask(()=>{i.enabled&&t.dispatchEvent(new Hd("addrendition",{rendition:e}))})}function bI(i){const e=W(i).media.audioRenditions,t=W(i).track;W(t).renditionSet.delete(i),queueMicrotask(()=>{W(i).track.enabled&&e.dispatchEvent(new Hd("removerendition",{rendition:i}))})}function TI(i){const e=W(i).media.audioRenditions;!e||W(e).changeRequested||(W(e).changeRequested=!0,queueMicrotask(()=>{delete W(e).changeRequested,W(i).track.enabled&&e.dispatchEvent(new Event("change"))}))}function Bs(i){return[...W(i).media.audioTracks].filter(t=>t.enabled).flatMap(t=>[...W(t).renditionSet])}var Lr,Ir,kr;class Oc extends EventTarget{constructor(){super(...arguments);ce(this,Lr);ce(this,Ir);ce(this,kr)}[Symbol.iterator](){return Bs(this).values()}get length(){return Bs(this).length}getRenditionById(t){return Bs(this).find(r=>`${r.id}`==`${t}`)??null}get selectedIndex(){return Bs(this).findIndex(t=>t.selected)}set selectedIndex(t){for(const[r,s]of Bs(this).entries())s.selected=r===t}get onaddrendition(){return k(this,Lr)}set onaddrendition(t){k(this,Lr)&&(this.removeEventListener("addrendition",k(this,Lr)),ae(this,Lr,void 0)),typeof t=="function"&&(ae(this,Lr,t),this.addEventListener("addrendition",t))}get onremoverendition(){return k(this,Ir)}set onremoverendition(t){k(this,Ir)&&(this.removeEventListener("removerendition",k(this,Ir)),ae(this,Ir,void 0)),typeof t=="function"&&(ae(this,Ir,t),this.addEventListener("removerendition",t))}get onchange(){return k(this,kr)}set onchange(t){k(this,kr)&&(this.removeEventListener("change",k(this,kr)),ae(this,kr,void 0)),typeof t=="function"&&(ae(this,kr,t),this.addEventListener("change",t))}}Lr=new WeakMap,Ir=new WeakMap,kr=new WeakMap;var Tn;class _I{constructor(){_e(this,"src");_e(this,"id");_e(this,"bitrate");_e(this,"codec");ce(this,Tn,!1)}get selected(){return k(this,Tn)}set selected(e){k(this,Tn)!==e&&(ae(this,Tn,e),TI(this))}}Tn=new WeakMap;function Pc(i,e){const t=i.audioTracks;W(e).media=i,W(e).renditionSet||(W(e).renditionSet=new Set);const r=W(t).trackSet;r.add(e);const s=r.size-1;s in Uc.prototype||Object.defineProperty(Uc.prototype,s,{get(){return[...W(this).trackSet][s]}}),queueMicrotask(()=>{t.dispatchEvent(new Bd("addtrack",{track:e}))})}function Nc(i){var r;const e=(r=W(i).media)==null?void 0:r.audioTracks;
132if(!e)return;W(e).trackSet.delete(i),queueMicrotask(()=>{e.dispatchEvent(new Bd("removetrack",{track:i}))})}function AI(i){const e=W(i).media.audioTracks;!e||W(e).changeRequested||(W(e).changeRequested=!0,queueMicrotask(()=>{delete W(e).changeRequested,e.dispatchEvent(new Event("change"))}))}var wr,Dr,Cr,_n,tl;class Uc extends EventTarget{constructor(){super();ce(this,_n);ce(this,wr);ce(this,Dr);ce(this,Cr);W(this).trackSet=new Set}[Symbol.iterator](){return k(this,_n,tl).values()}get length(){return k(this,_n,tl).size}getTrackById(t){return[...k(this,_n,tl)].find(r=>r.id===t)??null}get onaddtrack(){return k(this,wr)}set onaddtrack(t){k(this,wr)&&(this.removeEventListener("addtrack",k(this,wr)),ae(this,wr,void 0)),typeof t=="function"&&(ae(this,wr,t),this.addEventListener("addtrack",t))}get onremovetrack(){return k(this,Dr)}set onremovetrack(t){k(this,Dr)&&(this.removeEventListener("removetrack",k(this,Dr)),ae(this,Dr,void 0)),typeof t=="function"&&(ae(this,Dr,t),this.addEventListener("removetrack",t))}get onchange(){return k(this,Cr)}set onchange(t){k(this,Cr)&&(this.removeEventListener("change",k(this,Cr)),ae(this,Cr,void 0)),typeof t=="function"&&(ae(this,Cr,t),this.addEventListener("change",t))}}wr=new WeakMap,Dr=new WeakMap,Cr=new WeakMap,_n=new WeakSet,tl=function(){return W(this).trackSet};var An;class kE{constructor(){_e(this,"id");_e(this,"kind");_e(this,"label","");_e(this,"language","");_e(this,"sourceBuffer");ce(this,An,!1)}addRendition(e,t,r){const s=new _I;return s.src=e,s.codec=t,s.bitrate=r,yI(this,s),s}removeRendition(e){bI(e)}get enabled(){return k(this,An)}set enabled(e){k(this,An)!==e&&(ae(this,An,e),AI(this))}}An=new WeakMap;const rg=fd(globalThis.HTMLMediaElement,"video"),sg=fd(globalThis.HTMLMediaElement,"audio");function SI(i){if(!(i!=null&&i.prototype))return i;const e=fd(i,"video");(!e||`${e}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"videoTracks",{get(){return xI(this)}});const t=fd(i,"audio");(!t||`${t}`.includes("[native code]"))&&Object.defineProperty(i.prototype,"audioTracks",{get(){return RI(this)}}),"addVideoTrack"in i.prototype||(i.prototype.addVideoTrack=function(n,a="",o=""){const l=new IE;return l.kind=n,l.label=a,l.language=o,wc(this,l),l}),"removeVideoTrack"in i.prototype||(i.prototype.removeVideoTrack=Dc),"addAudioTrack"in i.prototype||(i.prototype.addAudioTrack=function(n,a="",o=""){const l=new kE;return l.kind=n,l.label=a,l.language=o,Pc(this,l),l}),"removeAudioTrack"in i.prototype||(i.prototype.removeAudioTrack=Nc),"videoRenditions"in i.prototype||Object.defineProperty(i.prototype,"videoRenditions",{get(){return r(this)}});const r=n=>{let a=W(n).videoRenditions;return a||(a=new Mc,W(a).media=n,W(n).videoRenditions=a),a};"audioRenditions"in i.prototype||Object.defineProperty(i.prototype,"audioRenditions",{get(){return s(this)}});const s=n=>{let a=W(n).audioRenditions;return a||(a=new Oc,W(a).media=n,W(n).audioRenditions=a),a};return i}function fd(i,e){var t;if(i!=null&&i.prototype)return(t=Object.getOwnPropertyDescriptor(i.prototype,`${e}Tracks`))==null?void 0:t.get}function xI(i){let e=W(i).videoTracks;if(!e&&(e=new Cc,W(i).videoTracks=e,rg)){const t=rg.call(i.nativeEl??i);for(const r of t)wc(i,r);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",r=>{if([...e].some(s=>s instanceof IE)){for(const s of t)Dc(s);return}wc(i,r.track)}),t.addEventListener("removetrack",r=>{Dc(r.track)})}return e}function RI(i){let e=W(i).audioTracks;
132if(!e&&(e=new Uc,W(i).audioTracks=e,sg)){const t=sg.call(i.nativeEl??i);for(const r of t)Pc(i,r);t.addEventListener("change",()=>{e.dispatchEvent(new Event("change"))}),t.addEventListener("addtrack",r=>{if([...e].some(s=>s instanceof kE)){for(const s of t)Nc(s);return}Pc(i,r.track)}),t.addEventListener("removetrack",r=>{Nc(r.track)})}return e}var wE=i=>{throw TypeError(i)},DE=(i,e,t)=>e.has(i)||wE("Cannot "+t),LI=(i,e,t)=>(DE(i,e,"read from private field"),t?t.call(i):e.get(i)),II=(i,e,t)=>e.has(i)?wE("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),kI=(i,e,t,r)=>(DE(i,e,"write to private field"),e.set(i,t),t),CE=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};if(typeof DocumentFragment>"u"){class i extends CE{}globalThis.DocumentFragment=i}var wI=class extends CE{},DI={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(wI)}},CI={customElements:DI},MI=typeof window>"u"||typeof globalThis.customElements>"u",Uu=MI?CI:globalThis,il,ng=class extends hI(SI(QL)){constructor(){super(...arguments),II(this,il)}get autoplay(){let i=this.getAttribute("autoplay");return i===null?!1:i===""?!0:i}set autoplay(i){let e=this.autoplay;i!==e&&(i?this.setAttribute("autoplay",typeof i=="string"?i:""):this.removeAttribute("autoplay"))}get muxCastCustomData(){return{mux:{playbackId:this.playbackId,minResolution:this.minResolution,maxResolution:this.maxResolution,renditionOrder:this.renditionOrder,customDomain:this.customDomain,tokens:{drm:this.drmToken},envKey:this.envKey,metadata:this.metadata,disableCookies:this.disableCookies,disableTracking:this.disableTracking,beaconCollectionDomain:this.beaconCollectionDomain,startTime:this.startTime,preferCmcd:this.preferCmcd}}}get castCustomData(){var i;return(i=LI(this,il))!=null?i:this.muxCastCustomData}set castCustomData(i){kI(this,il,i)}};il=new WeakMap;Uu.customElements.get("mux-video")||(Uu.customElements.define("mux-video",ng),Uu.MuxVideoElement=ng);const j={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_VOLUME_REQUEST:"mediavolumerequest",MEDIA_SEEK_REQUEST:"mediaseekrequest",MEDIA_AIRPLAY_REQUEST:"mediaairplayrequest",MEDIA_ENTER_FULLSCREEN_REQUEST:"mediaenterfullscreenrequest",MEDIA_EXIT_FULLSCREEN_REQUEST:"mediaexitfullscreenrequest",MEDIA_PREVIEW_REQUEST:"mediapreviewrequest",MEDIA_ENTER_PIP_REQUEST:"mediaenterpiprequest",MEDIA_EXIT_PIP_REQUEST:"mediaexitpiprequest",MEDIA_ENTER_CAST_REQUEST:"mediaentercastrequest",MEDIA_EXIT_CAST_REQUEST:"mediaexitcastrequest",MEDIA_SHOW_TEXT_TRACKS_REQUEST:"mediashowtexttracksrequest",MEDIA_HIDE_TEXT_TRACKS_REQUEST:"mediahidetexttracksrequest",MEDIA_SHOW_SUBTITLES_REQUEST:"mediashowsubtitlesrequest",MEDIA_DISABLE_SUBTITLES_REQUEST:"mediadisablesubtitlesrequest",MEDIA_TOGGLE_SUBTITLES_REQUEST:"mediatogglesubtitlesrequest",MEDIA_PLAYBACK_RATE_REQUEST:"mediaplaybackraterequest",MEDIA_RENDITION_REQUEST:"mediarenditionrequest",MEDIA_AUDIO_TRACK_REQUEST:"mediaaudiotrackrequest",MEDIA_SEEK_TO_LIVE_REQUEST:"mediaseektoliverequest",REGISTER_MEDIA_STATE_RECEIVER:"registermediastatereceiver",UNREGISTER_MEDIA_STATE_RECEIVER:"unregistermediastatereceiver"},Te={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},ME={MEDIA_AIRPLAY_UNAVAILABLE:"mediaAirplayUnavailable",MEDIA_AUDIO_TRACK_ENABLED:"mediaAudioTrackEnabled",MEDIA_AUDIO_TRACK_LIST:"mediaAudioTrackList",MEDIA_AUDIO_TRACK_UNAVAILABLE:"mediaAudioTrackUnavailable",MEDIA_BUFFERED:"mediaBuffered",MEDIA_CAST_UNAVAILABLE:"mediaCastUnavailable",MEDIA_CHAPTERS_CUES:"mediaChaptersCues",MEDIA_CURRENT_TIME:"mediaCurrentTime",MEDIA_DURATION:"mediaDuration",MEDIA_ENDED:"mediaEnded",MEDIA_ERROR:"mediaError",MEDIA_ERROR_CODE:"mediaErrorCode",MEDIA_ERROR_MESSAGE:"mediaErrorMessage",MEDIA_FULLSCREEN_UNAVAILABLE:"mediaFullscreenUnavailable",MEDIA_HAS_P
132LAYED:"mediaHasPlayed",MEDIA_HEIGHT:"mediaHeight",MEDIA_IS_AIRPLAYING:"mediaIsAirplaying",MEDIA_IS_CASTING:"mediaIsCasting",MEDIA_IS_FULLSCREEN:"mediaIsFullscreen",MEDIA_IS_PIP:"mediaIsPip",MEDIA_LOADING:"mediaLoading",MEDIA_MUTED:"mediaMuted",MEDIA_PAUSED:"mediaPaused",MEDIA_PIP_UNAVAILABLE:"mediaPipUnavailable",MEDIA_PLAYBACK_RATE:"mediaPlaybackRate",MEDIA_PREVIEW_CHAPTER:"mediaPreviewChapter",MEDIA_PREVIEW_COORDS:"mediaPreviewCoords",MEDIA_PREVIEW_IMAGE:"mediaPreviewImage",MEDIA_PREVIEW_TIME:"mediaPreviewTime",MEDIA_RENDITION_LIST:"mediaRenditionList",MEDIA_RENDITION_SELECTED:"mediaRenditionSelected",MEDIA_RENDITION_UNAVAILABLE:"mediaRenditionUnavailable",MEDIA_SEEKABLE:"mediaSeekable",MEDIA_STREAM_TYPE:"mediaStreamType",MEDIA_SUBTITLES_LIST:"mediaSubtitlesList",MEDIA_SUBTITLES_SHOWING:"mediaSubtitlesShowing",MEDIA_TARGET_LIVE_WINDOW:"mediaTargetLiveWindow",MEDIA_TIME_IS_LIVE:"mediaTimeIsLive",MEDIA_VOLUME:"mediaVolume",MEDIA_VOLUME_LEVEL:"mediaVolumeLevel",MEDIA_VOLUME_UNAVAILABLE:"mediaVolumeUnavailable",MEDIA_WIDTH:"mediaWidth"},OE=Object.entries(ME),T=OE.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{}),OI={USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"},Ji=OE.reduce((i,[e,t])=>(i[e]=t.toLowerCase(),i),{...OI});Object.entries(Ji).reduce((i,[e,t])=>{const r=T[e];return r&&(i[t]=r),i},{userinactivechange:"userinactive"});const PI=Object.entries(T).reduce((i,[e,t])=>{const r=Ji[e];return r&&(i[t]=r),i},{userinactive:"userinactivechange"}),Ci={SUBTITLES:"subtitles",CAPTIONS:"captions",CHAPTERS:"chapters",METADATA:"metadata"},hn={DISABLED:"disabled",SHOWING:"showing"},ag={MOUSE:"mouse",TOUCH:"touch"},Ft={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},Yi={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},NI={FULLSCREEN:"fullscreen"};function UI(i){return i==null?void 0:i.map($I).join(" ")}function FI(i){return i==null?void 0:i.split(/\s+/).map(BI)}function $I(i){if(i){const{id:e,width:t,height:r}=i;return[e,t,r].filter(s=>s!=null).join(":")}}function BI(i){if(i){const[e,t,r]=i.split(":");return{id:e,width:+t,height:+r}}}function HI(i){return i==null?void 0:i.map(KI).join(" ")}function GI(i){return i==null?void 0:i.split(/\s+/).map(VI)}function KI(i){if(i){const{id:e,kind:t,language:r,label:s}=i;return[e,t,r,s].filter(n=>n!=null).join(":")}}function VI(i){if(i){const[e,t,r,s]=i.split(":");return{id:e,kind:t,language:r,label:s}}}function WI(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Tf(i){return typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i)}function PE(i){return typeof i!="string"?!1:!isNaN(i)&&!isNaN(parseFloat(i))}const NE=i=>new Promise(e=>setTimeout(e,i)),og=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],YI=(i,e)=>{const t=i===1?og[e].singular:og[e].plural;return`${i} ${t}`},Ra=i=>{if(!Tf(i))return"";const e=Math.abs(i),t=e!==i,r=new Date(0,0,0,0,0,e,0);return`${[r.getHours(),r.getMinutes(),r.getSeconds()].map((o,l)=>o&&YI(o,l)).filter(o=>o).join(", ")}${t?" remaining":""}`};function Pr(i,e){let t=!1;i<0&&(t=!0,i=0-i),i=i<0?0:i;let r=Math.floor(i%60),s=Math.floor(i/60%60),n=Math.floor(i/3600);const a=Math.floor(e/60%60),o=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(n=s=r="0"),n=n>0||o>0?n+":":"",s=((n||a>=10)&&s<10?"0"+s:s)+":",r=r<10?"0"+r:r,(t?"-":"")+n+s+r}const qI={"Start airplay":"Start airplay","Stop airplay":"Stop airplay",Audio:"Audio",Captions:"Captions","Enable captions":"Enable captions","Disable captions":"Disable captions","Start casting":"Start casting","Stop casting":"Stop casting","Enter fullscreen mode":"Enter fullscreen mode","Exit fullscreen mode":"Exit fullscreen mode",Mute:"Mute",Unmute:"Unmute","Enter picture in picture mode":"Enter picture in picture mode","Exit picture in picture mode":"Exit picture in picture mode",Play:"Play",Pause:"Pause","Playback rate":"Playback rate","Playback rate {playbackRate}":"Playback rate {playbackRate}",Quality:"Quality","Seek backward":"Seek backward","Seek forward":"Seek forward",Settings:"Settings",Auto:"Auto","audio player":"audio player","video player":"video player",volume:"volume",seek:"seek","closed captions":"closed captions","current playback rate":"current playback rate","playback time":"playback time","media loading":"media loading",settings:"settings","audio tracks":"audio tracks",quality:"quality",play:"play",pause:"pause",mute:"mute",unmute:"unmute",live:"live",Off:"Off","start airplay":"start airplay","stop airplay":"stop airplay","start casting":"start casting","stop casting":"stop casting","enter fullscreen mode":"enter fullscreen mode","exit fullscreen mode":"exit fullscreen mode","enter picture in picture mode":"enter picture in picture mode","exit picture in picture mode":"exit picture in picture mode","seek to live":"seek to live","playing live":"playing live","seek back {seekOffset} seconds":"seek back {seekOffset} seconds","seek forward {seekOffset} seconds":"seek forward {seekOffset} seconds","Network Error":"Network Error","Decode Error":"Decode Error","S
132ource Not Supported":"Source Not Supported","Encryption Error":"Encryption Error","A network error caused the media download to fail.":"A network error caused the media download to fail.","A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.":"A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format.","An unsupported error occurred. The server or network failed, or your browser does not support this format.":"An unsupported error occurred. The server or network failed, or your browser does not support this format.","The media is encrypted and there are no keys to decrypt it.":"The media is encrypted and there are no keys to decrypt it."};var lg;const Fu={en:qI};let Fc=((lg=globalThis.navigator)==null?void 0:lg.language)||"en";const jI=i=>{Fc=i},zI=i=>{var e,t,r;const[s]=Fc.split("-");return((e=Fu[Fc])==null?void 0:e[i])||((t=Fu[s])==null?void 0:t[i])||((r=Fu.en)==null?void 0:r[i])||i},z=(i,e={})=>zI(i).replace(/\{(\w+)\}/g,(t,r)=>r in e?String(e[r]):`{${r}}`);let UE=class{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}};class FE extends UE{}let dg=class extends FE{constructor(){super(...arguments),this.role=null}};class XI{observe(){}unobserve(){}disconnect(){}}const $E={createElement:function(){return new $a.HTMLElement},createElementNS:function(){return new $a.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent(i){return!1}},$a={ResizeObserver:XI,document:$E,Node:FE,Element:dg,HTMLElement:class extends dg{constructor(){super(...arguments),this.innerHTML=""}get content(){return new $a.DocumentFragment}},DocumentFragment:class extends UE{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem(i){return null},setItem(i,e){},removeItem(i){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia(i){return{matches:!1,media:i}},DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},BE=typeof window>"u"||typeof window.customElements>"u",HE=Object.keys($a).every(i=>i in globalThis),L=BE&&!HE?$a:globalThis,at=BE&&!HE?$E:globalThis.document,ug=new WeakMap,_f=i=>{let e=ug.get(i);return e||ug.set(i,e=new Set),e},GE=new L.ResizeObserver(i=>{for(const e of i)for(const t of _f(e.target))t(e)});function In(i,e){_f(i).add(e),GE.observe(i)}function kn(i,e){const t=_f(i);t.delete(e),t.size||GE.unobserve(i)}function Nt(i){const e={};for(const t of i)e[t.name]=t.value;return e}function Yt(i){var e;return(e=$c(i))!=null?e:On(i,"media-controller")}function $c(i){var e;const{MEDIA_CONTROLLER:t}=Te,r=i.getAttribute(t);if(r)return(e=Gd(i))==null?void 0:e.getElementById(r)}const KE=(i,e,t=".value")=>{const r=i.querySelector(t);r&&(r.textContent=e)},QI=(i,e)=>{const t=`slot[name="${e}"]`,r=i.shadowRoot.querySelector(t);return r?r.children:[]},VE=(i,e)=>QI(i,e)[0],tr=(i,e)=>!i||!e?!1:i!=null&&i.contains(e)?!0:tr(i,e.getRootNode().host),On=(i,e)=>{if(!i)return null;const t=i.closest(e);return t||On(i.getRootNode().host,e)};function Af(i=document){var e;const t=i==null?void 0:i.activeElement;return t?(e=Af(t.shadowRoot))!=null?e:t:null}function Gd(i){var e;const t=(e=i==null?void 0:i.getRootNode)==null?void 0:e.call(i);return t instanceof ShadowRoot||t instanceof Document?t:null}function WE(i,{depth:e=3,checkOpacity:t=!0,checkVisibilityCSS:r=!0}={}){if(i.checkVisibility)return i.checkVisibility({checkOpacity:t,checkVisibilityCSS:r});let s=i;for(;s&&e>0;){const n=getComputedStyle(s);if(t&&n.opacity==="0"||r&&n.visibility==="hidden"||n.display==="none")return!1;s=s.parentElement,e--}return!0}function ZI(i,e,t,r){const s=r.x-t.x,n=r.y-t.y,a=s*s+n*n;if(a===0)return 0;const o=((i-t.x)*s+(e-t.y)*n)/a;return Math.max(0,Math.min(1,o))}function Je(i,e){const t=JI(i,r=>r===e);return t||YE(i,e)}function JI(i,e){var t,r;let s;for(s of(t=i.querySelectorAll("style:not([media])"))!=null?t:[]){let n;try{n=(r=s.sheet)==null?void 0:r.cssRules}catch{continue}for(const a of n??[])if(e(a.selectorText))return a}}function YE(i,e){var t,r;const s=(t=i.querySelectorAll("style:not([media])"))!=null?t:[],n=s==null?void 0:s[s.length-1];return n!=null&&n.sheet?(n==null||n.sheet.insertRule(`${e}{}`,n.sheet.cssRules.length),(r=n.sheet.cssRules)==null?void 0:r[n.sheet.cssRules.length-1]):(console.warn("Media Chrome: No style sheet found on style tag of",i),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}})}function Ue(i,e,t=Number.NaN){const r=i.getAttribute(e);return r!=null?+r:t}function Ye(i,e,t){const r=+t;if(t==null||Number.isNaN(r)){i.hasAttribute(e)&&i.removeAttribute(e);return}Ue(i,e,void 0)!==r&&i.setAttribute(e,`${r}`)}function ve(i,e){return i.hasAttribute(e)}function Ee(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}ve(i,e)!=t&&i.toggleAttribute(e,t)}function Fe(i,e,t=null){var r;return(r=i.getAttribute(e))!=null?r:t}function $e(i,e,t){if(t==null){i.hasAttribute(e)&&i.removeAttribute(e);return}const r=`${t}`;Fe(i,e,void 0)!==r&&i.setAttribute(e,r)}var qE=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nr=(i,e,t)=>
132(qE(i,e,"read from private field"),t?t.call(i):e.get(i)),ek=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},bo=(i,e,t,r)=>(qE(i,e,"write to private field"),e.set(i,t),t),St;function tk(i){return` 133 <style> 134 :host { 135 display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block)); 136 box-sizing: border-box; 137 } 138 </style> 139 `}class Kd extends L.HTMLElement{constructor(){if(super(),ek(this,St,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,T.MEDIA_PAUSED]}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(s=nr(this,St))==null?void 0:s.unassociateElement)==null||n.call(s,this),bo(this,St,null)),r&&this.isConnected&&(bo(this,St,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=nr(this,St))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,r,s;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),bo(this,St,ik(this)),this.getAttribute(Te.MEDIA_CONTROLLER)&&((t=(e=nr(this,St))==null?void 0:e.associateElement)==null||t.call(e,this)),(r=nr(this,St))==null||r.addEventListener("pointerdown",this),(s=nr(this,St))==null||s.addEventListener("click",this)}disconnectedCallback(){var e,t,r,s;this.getAttribute(Te.MEDIA_CONTROLLER)&&((t=(e=nr(this,St))==null?void 0:e.unassociateElement)==null||t.call(e,this)),(r=nr(this,St))==null||r.removeEventListener("pointerdown",this),(s=nr(this,St))==null||s.removeEventListener("click",this),bo(this,St,null)}handleEvent(e){var t;const r=(t=e.composedPath())==null?void 0:t[0];if(["video","media-controller"].includes(r==null?void 0:r.localName)){if(e.type==="pointerdown")this._pointerType=e.pointerType;else if(e.type==="click"){const{clientX:n,clientY:a}=e,{left:o,top:l,width:d,height:u}=this.getBoundingClientRect(),c=n-o,h=a-l;if(c<0||h<0||c>d||h>u||d===0&&u===0)return;const{pointerType:f=this._pointerType}=e;if(this._pointerType=void 0,f===ag.TOUCH){this.handleTap(e);return}else if(f===ag.MOUSE){this.handleMouseClick(e);return}}}}get mediaPaused(){return ve(this,T.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,T.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){const t=this.mediaPaused?j.MEDIA_PLAY_REQUEST:j.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new L.CustomEvent(t,{composed:!0,bubbles:!0}))}}St=new WeakMap;Kd.shadowRootOptions={mode:"open"};Kd.getTemplateHTML=tk;function ik(i){var e;const t=i.getAttribute(Te.MEDIA_CONTROLLER);return t?(e=i.getRootNode())==null?void 0:e.getElementById(t):On(i,"media-controller")}L.customElements.get("media-gesture-receiver")||L.customElements.define("media-gesture-receiver",Kd);var cg=Kd,Sf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ot=(i,e,t)=>(Sf(i,e,"read from private field"),t?t.call(i):e.get(i)),wt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},qr=(i,e,t,r)=>(Sf(i,e,"write to private field"),e.set(i,t),t),Vt=(i,e,t)=>(Sf(i,e,"access private method"),t),md,Hs,Ba,an,rl,Bc,jE,oa,sl,Hc,zE,Gc,XE,Ha,Vd,Wd,xf,wn,Ga;const J={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"};function rk(i){return` 140 <style> 141 142 :host([${T.MEDIA_IS_FULLSCREEN}]) ::slotted([slot=media]) { 143 outline: none; 144 } 145 146 :host { 147 box-sizing: border-box; 148 position: relative; 149 display: inline-block; 150 line-height: 0; 151 background-color: var(--media-background-color, #000); 152 } 153 154 :host(:not([${J.AUDIO}])) [part~=layer]:not([part~=media-layer]) { 155 position: absolute; 156 top: 0; 157 left: 0; 158 bottom: 0; 159 right: 0; 160 display: flex; 161 flex-flow: column nowrap; 162 align-items: start; 163 pointer-events: none; 164 background: none; 165 } 166 167 slot[name=media] { 168 display: var(--media-slot-display, contents); 169 } 170 171 172 :host([${J.AUDIO}]) slot[name=media] { 173 display: var(--media-slot-display, none); 174 } 175 176 177 :host([${J.AUDIO}]) [part~=layer][part~=gesture-layer] { 178 height: 0; 179 display: block; 180 } 181 182 183 :host(:not([${J.AUDIO}])[${J.GESTURES_DISABLED}]) ::slotted([slot=gestures-chrome]), 184 :host(:not([${J.AUDIO}])[${J.GESTURES_DISABLED}]) media-gesture-receiver[slot=gestures-chrome] { 185 display: none; 186 } 187 188 189 ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) { 190 pointer-events: auto; 191 } 192 193 :host(:not([${J.AUDIO}])) *[part~=layer][part~=centered-layer] { 194 align-items: center; 195 justify-content: center; 196 } 197 198 :host(:not([${J.AUDIO}])) ::slotted(media-gesture-receiver[slot=gestures-chrome]), 199 :host(:not([${J.AUDIO}])) media-gesture-receiver[slot=gestures-chrome] { 200 align-self: stretch; 201 flex-grow: 1; 202 } 203 204 slot[name=middle-chrome] { 205 display: inline; 206 flex-grow: 1; 207 pointer-events: none; 208 background: none; 209 } 210 211 212 ::slotted([slot=media]), 213 ::slotted([slot=poster]) { 214 width: 100%; 215 height: 100%; 216 } 217 218 219 :host(:not([${J.AUDIO}])) .spacer { 220 flex-grow: 1; 221 } 222 223 224 :host(:-webkit-full-screen) { 225 226 width: 100% !important; 227 height: 100% !important; 228 } 229 230 231 ::slotted(:not([slot=media]):not([slot=poster]):not([${J.NO_AUTOHIDE}]):not([hidden]):not([role=dialog])) { 232 opacity: 1; 233 transition: var(--media-control-transition-in, opacity 0.25s); 234 } 235 236 237 :host([${J.USER_INACTIVE}]:not([${T.MEDIA_PAUSED}]):not([${T.MEDIA_IS_AIRPLAYING}
237]):not([${T.MEDIA_IS_CASTING}]):not([${J.AUDIO}])) ::slotted(:not([slot=media]):not([slot=poster]):not([${J.NO_AUTOHIDE}]):not([role=dialog])) { 238 opacity: 0; 239 transition: var(--media-control-transition-out, opacity 1s); 240 } 241 242 :host([${J.USER_INACTIVE}]:not([${J.NO_AUTOHIDE}]):not([${T.MEDIA_PAUSED}]):not([${T.MEDIA_IS_CASTING}]):not([${J.AUDIO}])) ::slotted([slot=media]) { 243 cursor: none; 244 } 245 246 :host([${J.USER_INACTIVE}][${J.AUTOHIDE_OVER_CONTROLS}]:not([${J.NO_AUTOHIDE}]):not([${T.MEDIA_PAUSED}]):not([${T.MEDIA_IS_CASTING}]):not([${J.AUDIO}])) * { 247 --media-cursor: none; 248 cursor: none; 249 } 250 251 252 ::slotted(media-control-bar) { 253 align-self: stretch; 254 } 255 256 257 :host(:not([${J.AUDIO}])[${T.MEDIA_HAS_PLAYED}]) slot[name=poster] { 258 display: none; 259 } 260 261 ::slotted([role=dialog]) { 262 width: 100%; 263 height: 100%; 264 align-self: center; 265 } 266 267 ::slotted([role=menu]) { 268 align-self: end; 269 } 270 </style> 271 272 <slot name="media" part="layer media-layer"></slot> 273 <slot name="poster" part="layer poster-layer"></slot> 274 <slot name="gestures-chrome" part="layer gesture-layer"> 275 <media-gesture-receiver slot="gestures-chrome"> 276 <template shadowrootmode="${cg.shadowRootOptions.mode}"> 277 ${cg.getTemplateHTML({})} 278 </template> 279 </media-gesture-receiver> 280 </slot> 281 <span part="layer vertical-layer"> 282 <slot name="top-chrome" part="top chrome"></slot> 283 <slot name="middle-chrome" part="middle chrome"></slot> 284 <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot> 285 286 <slot part="bottom chrome"></slot> 287 </span> 288 <slot name="dialog" part="layer dialog-layer"></slot> 289 `}const sk=Object.values(T),nk="sm:384 md:576 lg:768 xl:960";function ak(i){QE(i.target,i.contentRect.width)}function QE(i,e){var t;if(!i.isConnected)return;const r=(t=i.getAttribute(J.BREAKPOINTS))!=null?t:nk,s=ok(r),n=lk(s,e);let a=!1;if(Object.keys(s).forEach(o=>{if(n.includes(o)){i.hasAttribute(`breakpoint${o}`)||(i.setAttribute(`breakpoint${o}`,""),a=!0);return}i.hasAttribute(`breakpoint${o}`)&&(i.removeAttribute(`breakpoint${o}`),a=!0)}),a){const o=new CustomEvent(Ji.BREAKPOINTS_CHANGE,{detail:n});i.dispatchEvent(o)}i.breakpointsComputed||(i.breakpointsComputed=!0,i.dispatchEvent(new CustomEvent(Ji.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}function ok(i){const e=i.split(/\s+/);return Object.fromEntries(e.map(t=>t.split(":")))}function lk(i,e){return Object.keys(i).filter(t=>e>=parseInt(i[t]))}class Yd extends L.HTMLElement{constructor(){if(super(),wt(this,Bc),wt(this,Hc),wt(this,Gc),wt(this,Ha),wt(this,Wd),wt(this,wn),wt(this,md,0),wt(this,Hs,null),wt(this,Ba,null),wt(this,an,void 0),this.breakpointsComputed=!1,wt(this,rl,new MutationObserver(Vt(this,Bc,jE).bind(this))),wt(this,oa,!1),wt(this,sl,t=>{Ot(this,oa)||(setTimeout(()=>{ak(t),qr(this,oa,!1)},0),qr(this,oa,!0))}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const t=Nt(this.attributes),r=this.constructor.getTemplateHTML(t);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(r):this.shadowRoot.innerHTML=r}const e=this.querySelector(":scope > slot[slot=media]");e&&e.addEventListener("slotchange",()=>{if(!e.assignedElements({flatten:!0}).length){Ot(this,Hs)&&this.mediaUnsetCallback(Ot(this,Hs));return}this.handleMediaUpdated(this.media)})}static get observedAttributes(){return[J.AUTOHIDE,J.GESTURES_DISABLED].concat(sk).filter(e=>![T.MEDIA_RENDITION_LIST,T.MEDIA_AUDIO_TRACK_LIST,T.MEDIA_CHAPTERS_CUES,T.MEDIA_WIDTH,T.MEDIA_HEIGHT,T.MEDIA_ERROR,T.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,r){e.toLowerCase()==J.AUTOHIDE&&(this.autohide=r)}get media(){let e=this.querySelector(":scope > [slot=media]");return(e==null?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(qr(this,Hs,e),e.localName.includes("-")&&await L.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;Ot(this,rl).observe(this,{childList:!0,subtree:!0}),In(this,Ot(this,sl));const t=this.getAttribute(J.AUDIO)!=null,r=z(t?"audio player":"video player");
vendor: 5,210 bytes, line 289
289this.setAttribute("role","region"),this.setAttribute("aria-label",r),this.handleMediaUpdated(this.media),this.setAttribute(J.USER_INACTIVE,""),QE(this,this.getBoundingClientRect().width),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),(e=L.window)==null||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;Ot(this,rl).disconnect(),kn(this,Ot(this,sl)),this.media&&this.mediaUnsetCallback(this.media),(e=L.window)==null||e.removeEventListener("mouseup",this)}mediaSetCallback(e){}mediaUnsetCallback(e){qr(this,Hs,null)}handleEvent(e){switch(e.type){case"pointerdown":qr(this,md,e.timeStamp);break;case"pointermove":Vt(this,Hc,zE).call(this,e);break;case"pointerup":Vt(this,Gc,XE).call(this,e);break;case"mouseleave":Vt(this,Ha,Vd).call(this);break;case"mouseup":this.removeAttribute(J.KEYBOARD_CONTROL);break;case"keyup":Vt(this,wn,Ga).call(this),this.setAttribute(J.KEYBOARD_CONTROL,"");break}}set autohide(e){const t=Number(e);qr(this,an,isNaN(t)?0:t)}get autohide(){return(Ot(this,an)===void 0?2:Ot(this,an)).toString()}get breakpoints(){return Fe(this,J.BREAKPOINTS)}set breakpoints(e){$e(this,J.BREAKPOINTS,e)}get audio(){return ve(this,J.AUDIO)}set audio(e){Ee(this,J.AUDIO,e)}get gesturesDisabled(){return ve(this,J.GESTURES_DISABLED)}set gesturesDisabled(e){Ee(this,J.GESTURES_DISABLED,e)}get keyboardControl(){return ve(this,J.KEYBOARD_CONTROL)}set keyboardControl(e){Ee(this,J.KEYBOARD_CONTROL,e)}get noAutohide(){return ve(this,J.NO_AUTOHIDE)}set noAutohide(e){Ee(this,J.NO_AUTOHIDE,e)}get autohideOverControls(){return ve(this,J.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){Ee(this,J.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return ve(this,J.USER_INACTIVE)}set userInteractive(e){Ee(this,J.USER_INACTIVE,e)}}md=new WeakMap;Hs=new WeakMap;Ba=new WeakMap;an=new WeakMap;rl=new WeakMap;Bc=new WeakSet;jE=function(i){const e=this.media;for(const t of i){if(t.type!=="childList")continue;const r=t.removedNodes;for(const s of r){if(s.slot!="media"||t.target!=this)continue;let n=t.previousSibling&&t.previousSibling.previousElementSibling;if(!n||!e)this.mediaUnsetCallback(s);else{let a=n.slot!=="media";for(;(n=n.previousSibling)!==null;)n.slot=="media"&&(a=!1);a&&this.mediaUnsetCallback(s)}}if(e)for(const s of t.addedNodes)s===e&&this.handleMediaUpdated(e)}};oa=new WeakMap;sl=new WeakMap;Hc=new WeakSet;zE=function(i){if(i.pointerType!=="mouse"&&i.timeStamp-Ot(this,md)<250)return;Vt(this,Wd,xf).call(this),clearTimeout(Ot(this,Ba));const e=this.hasAttribute(J.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(i.target)||e)&&Vt(this,wn,Ga).call(this)};Gc=new WeakSet;XE=function(i){if(i.pointerType==="touch"){const e=!this.hasAttribute(J.USER_INACTIVE);[this,this.media].includes(i.target)&&e?Vt(this,Ha,Vd).call(this):Vt(this,wn,Ga).call(this)}else i.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(e==null?void 0:e.localName))&&Vt(this,wn,Ga).call(this)};Ha=new WeakSet;Vd=function(){if(Ot(this,an)<0||this.hasAttribute(J.USER_INACTIVE))return;this.setAttribute(J.USER_INACTIVE,"");const i=new L.CustomEvent(Ji.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(i)};Wd=new WeakSet;xf=function(){if(!this.hasAttribute(J.USER_INACTIVE))return;this.removeAttribute(J.USER_INACTIVE);const i=new L.CustomEvent(Ji.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(i)};wn=new WeakSet;Ga=function(){Vt(this,Wd,xf).call(this),clearTimeout(Ot(this,Ba));const i=parseInt(this.autohide);i<0||qr(this,Ba,setTimeout(()=>{Vt(this,Ha,Vd).call(this)},i*1e3))};Yd.shadowRootOptions={mode:"open"};Yd.getTemplateHTML=rk;L.customElements.get("media-container")||L.customElements.define("media-container",Yd);var ZE=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ct=(i,e,t)=>(ZE(i,e,"read from private field"),t?t.call(i):e.get(i)),Kn=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},To=(i,e,t,r)=>(ZE(i,e,"write to private field"),e.set(i,t),t),Gs,Ks,pd,as,Gi,dr;class Rf{constructor(e,t,{defaultValue:r}={defaultValue:void 0}){Kn(this,Gi),Kn(this,Gs,void 0),Kn(this,Ks,void 0),Kn(this,pd,void 0),Kn(this,as,new Set),To(this,Gs,e),To(this,Ks,t),To(this,pd,new Set(r))}[Symbol.iterator](){return ct(this,Gi,dr).values()}get length(){return ct(this,Gi,dr).size}get value(){var e;return(e=[...ct(this,Gi,dr)].join(" "))!=null?e:""}set value(e){var t;e!==this.value&&(To(this,as,new Set),this.add(...(t=e==null?void 0:e.split(" "))!=null?t:[]))}toString(){return this.value}item(e){return[...ct(this,Gi,dr)][e]}values(){return ct(this,Gi,dr).values()}forEach(e,t){ct(this,Gi,dr).forEach(e,t)}add(...e){var t,r;e.forEach(s=>ct(this,as).add(s)),!(this.value===""&&!((t=ct(this,Gs))!=null&&t.hasAttribute(`${ct(this,Ks)}`)))&&((r=ct(this,Gs))==null||r.setAttribute(`${ct(this,Ks)}`,`${this.value}`))}remove(...e){var t;e.forEach(r=>ct(this,as).delete(r)),(t=ct(this,Gs))==null||t.setAttribute(`${ct(this,Ks)}`,`${this.value}`)}contains(e){return ct(this,Gi,dr).has(e)}
289toggle(e,t){return typeof t<"u"?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}}Gs=new WeakMap;Ks=new WeakMap;pd=new WeakMap;as=new WeakMap;Gi=new WeakSet;dr=function(){return ct(this,as).size?ct(this,as):ct(this,pd)};const dk=(i="")=>i.split(/\s+/),JE=(i="")=>{const[e,t,r]=i.split(":"),s=r?decodeURIComponent(r):void 0;return{kind:e==="cc"?Ci.CAPTIONS:Ci.SUBTITLES,language:t,label:s}},qd=(i="",e={})=>dk(i).map(t=>{const r=JE(t);return{...e,...r}}),ey=i=>i?Array.isArray(i)?i.map(e=>typeof e=="string"?JE(e):e):typeof i=="string"?qd(i):[i]:[],Kc=({kind:i,label:e,language:t}={kind:"subtitles"})=>e?`${i==="captions"?"cc":"sb"}:${t}:${encodeURIComponent(e)}`:t,Ka=(i=[])=>Array.prototype.map.call(i,Kc).join(" "),uk=(i,e)=>t=>t[i]===e,ty=i=>{const e=Object.entries(i).map(([t,r])=>uk(t,r));return t=>e.every(r=>r(t))},La=(i,e=[],t=[])=>{const r=ey(t).map(ty),s=n=>r.some(a=>a(n));Array.from(e).filter(s).forEach(n=>{n.mode=i})},jd=(i,e=()=>!0)=>{if(!(i!=null&&i.textTracks))return[];const t=typeof e=="function"?e:ty(e);return Array.from(i.textTracks).filter(t)},iy=i=>{var e;return!!((e=i.mediaSubtitlesShowing)!=null&&e.length)||i.hasAttribute(T.MEDIA_SUBTITLES_SHOWING)},ck=i=>{var e;const{media:t,fullscreenElement:r}=i;try{const s=r&&"requestFullscreen"in r?"requestFullscreen":r&&"webkitRequestFullScreen"in r?"webkitRequestFullScreen":void 0;if(s){const n=(e=r[s])==null?void 0:e.call(r);if(n instanceof Promise)return n.catch(()=>{})}else t!=null&&t.webkitEnterFullscreen?t.webkitEnterFullscreen():t!=null&&t.requestFullscreen&&t.requestFullscreen()}catch(s){console.error(s)}},hg="exitFullscreen"in at?"exitFullscreen":"webkitExitFullscreen"in at?"webkitExitFullscreen":"webkitCancelFullScreen"in at?"webkitCancelFullScreen":void 0,hk=i=>{var e;const{documentElement:t}=i;if(hg){const r=(e=t==null?void 0:t[hg])==null?void 0:e.call(t);if(r instanceof Promise)return r.catch(()=>{})}},la="fullscreenElement"in at?"fullscreenElement":"webkitFullscreenElement"in at?"webkitFullscreenElement":void 0,fk=i=>{const{documentElement:e,media:t}=i,r=e==null?void 0:e[la];return!r&&"webkitDisplayingFullscreen"in t&&"webkitPresentationMode"in t&&t.webkitDisplayingFullscreen&&t.webkitPresentationMode===NI.FULLSCREEN?t:r},mk=i=>{var e;const{media:t,documentElement:r,fullscreenElement:s=t}=i;if(!t||!r)return!1;const n=fk(i);if(!n)return!1;if(n===s||n===t)return!0;if(n.localName.includes("-")){let a=n.shadowRoot;if(!(la in a))return tr(n,s);for(;a!=null&&a[la];){if(a[la]===s)return!0;a=(e=a[la])==null?void 0:e.shadowRoot}}return!1},pk="fullscreenEnabled"in at?"fullscreenEnabled":"webkitFullscreenEnabled"in at?"webkitFullscreenEnabled":void 0,gk=i=>{const{documentElement:e,media:t}=i;return!!(e!=null&&e[pk])||t&&"webkitSupportsFullscreen"in t};let _o;const Lf=()=>{var i,e;return _o||(_o=(e=(i=at)==null?void 0:i.createElement)==null?void 0:e.call(i,"video"),_o)},vk=async(i=Lf())=>{if(!i)return!1;const e=i.volume;i.volume=e/2+.1;const t=new AbortController,r=await Promise.race([Ek(i,t.signal),yk(i,e)]);return t.abort(),r},Ek=(i,e)=>new Promise(t=>{i.addEventListener("volumechange",()=>t(!0),{signal:e})}),yk=async(i,e)=>{for(let t=0;t<10;t++){if(i.volume===e)return!1;await NE(10)}return i.volume!==e},bk=/.*Version\/.*Safari\/.*/.test(L.navigator.userAgent),ry=(i=Lf())=>L.matchMedia("(display-mode: standalone)").matches&&bk?!1:typeof(i==null?void 0:i.requestPictureInPicture)=="function",sy=(i=Lf())=>gk({documentElement:at,media:i}),Tk=sy(),_k=ry(),Ak=!!L.WebKitPlaybackTargetAvailabilityEvent,Sk=!!L.chrome,gd=i=>jd(i.media,e=>[Ci.SUBTITLES,Ci.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),ny=i=>jd(i.media,e=>e.mode===hn.SHOWING&&[Ci.SUBTITLES,Ci.CAPTIONS].includes(e.kind)),ay=(i,e)=>{const t=gd(i),r=ny(i),s=!!r.length;if(t.length){if(e===!1||s&&e!==!0)La(hn.DISABLED,t,r);else if(e===!0||!s&&e!==!1){let n=t[0];const{options:a}=i;if(!(a!=null&&a.noSubtitlesLangPref)){const u=globalThis.localStorage.getItem("media-chrome-pref-subtitles-lang"),c=u?[u,...globalThis.navigator.languages]:globalThis.navigator.languages,h=t.filter(f=>c.some(m=>f.language.toLowerCase().startsWith(m.split("-")[0]))).sort((f,m)=>{const p=c.findIndex(v=>f.language.toLowerCase().startsWith(v.split("-")[0])),g=c.findIndex(v=>m.language.toLowerCase().startsWith(v.split("-")[0]));return p-g});h[0]&&(n=h[0])}const{language:o,label:l,kind:d}=n;La(hn.DISABLED,t,r),La(hn.SHOWING,t,[{language:o,label:l,kind:d}])}}},If=(i,e)=>i===e?!0:i==null||e==null||typeof i!=typeof e?!1:typeof i=="number"&&Number.isNaN(i)&&Number.isNaN(e)?!0:typeof i!="object"?!1:Array.isArray(i)?xk(i,e):Object.entries(i).every(([t,r])=>t in e&&If(r,e[t])),xk=(i,e)=>{const t=Array.isArray(i),r=Array.isArray(e);return t!==r?!1:t||r?i.length!==e.length?!1:i.every((s,n)=>If(s,e[n])):!0},Rk=Object.values(Yi);let vd;const Lk=vk().then(i=>(vd=i,vd)),Ik=async(...i)=>{await Promise.all(i.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof L.HTMLElement))return;const t=e.localName;if(!t.includes("-"))return;const r=L.customElements.get(t);r&&e instanceof r||(await L.customElements.whenDefined(t),L.customElements.upgrade(e))}))},kk=new L.DOMParser,wk=i=>i&&(kk.parseFromString(i,"text/html").body.textContent||i),da={mediaError:{get(i,e){const{media:t}=i;
289if((e==null?void 0:e.type)!=="playing")return t==null?void 0:t.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(i,e){var t;const{media:r}=i;if((e==null?void 0:e.type)!=="playing")return(t=r==null?void 0:r.error)==null?void 0:t.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(i,e){var t,r;const{media:s}=i;if((e==null?void 0:e.type)!=="playing")return(r=(t=s==null?void 0:s.error)==null?void 0:t.message)!=null?r:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.videoWidth)!=null?e:0},mediaEvents:["resize"]},mediaHeight:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.videoHeight)!=null?e:0},mediaEvents:["resize"]},mediaPaused:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.paused)!=null?e:!0},set(i,e){var t;const{media:r}=e;r&&(i?r.pause():(t=r.play())==null||t.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(i,e){const{media:t}=i;return t?e?e.type==="playing":!t.paused:!1},mediaEvents:["playing","emptied"]},mediaEnded:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.ended)!=null?e:!1},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.playbackRate)!=null?e:1},set(i,e){const{media:t}=e;t&&Number.isFinite(+i)&&(t.playbackRate=+i)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.muted)!=null?e:!1},set(i,e){const{media:t}=e;if(t){try{L.localStorage.setItem("media-chrome-pref-muted",i?"true":"false")}catch(r){console.debug("Error setting muted pref",r)}t.muted=i}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noMutedPref:t}}=e,{media:r}=e;if(!(!r||r.muted||t))try{const s=L.localStorage.getItem("media-chrome-pref-muted")==="true";da.mediaMuted.set(s,e),i(s)}catch(s){console.debug("Error getting muted pref",s)}}]},mediaVolume:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.volume)!=null?e:1},set(i,e){const{media:t}=e;if(t){try{i==null?L.localStorage.removeItem("media-chrome-pref-volume"):L.localStorage.setItem("media-chrome-pref-volume",i.toString())}catch(r){console.debug("Error setting volume pref",r)}Number.isFinite(+i)&&(t.volume=+i)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(i,e)=>{const{options:{noVolumePref:t}}=e;if(!t)try{const{media:r}=e;if(!r)return;const s=L.localStorage.getItem("media-chrome-pref-volume");if(s==null)return;da.mediaVolume.set(+s,e),i(+s)}catch(r){console.debug("Error getting volume pref",r)}}]},mediaVolumeLevel:{get(i){const{media:e}=i;return typeof(e==null?void 0:e.volume)>"u"?"high":e.muted||e.volume===0?"off":e.volume<.5?"low":e.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(i){var e;const{media:t}=i;return(e=t==null?void 0:t.currentTime)!=null?e:0},set(i,e){const{media:t}=e;!t||!Tf(i)||(t.currentTime=i)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(i){const{media:e,options:{defaultDuration:t}={}}=i;return t&&(!e||!e.duration||Number.isNaN(e.duration)||!Number.isFinite(e.duration))?t:Number.isFinite(e==null?void 0:e.duration)?e.duration:Number.NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(i){const{media:e}=i;return(e==null?void 0:e.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(i){var e;const{media:t}=i;if(!((e=t==null?void 0:t.seekable)!=null&&e.length))return;const r=t.seekable.start(0),s=t.seekable.end(t.seekable.length-1);if(!(!r&&!s))return[Number(r.toFixed(3)),Number(s.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(i){var e;const{media:t}=i,r=(e=t==null?void 0:t.buffered)!=null?e:[];return Array.from(r).map((s,n)=>[Number(r.start(n).toFixed(3)),Number(r.end(n).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(i){const{media:e,options:{defaultStreamType:t}={}}=i,r=[Yi.LIVE,Yi.ON_DEMAND].includes(t)?t:void 0;if(!e)return r;const{streamType:s}=e;if(Rk.includes(s))return s===Yi.UNKNOWN?r:s;const n=e.duration;return n===1/0?Yi.LIVE:Number.isFinite(n)?Yi.ON_DEMAND:r}
289,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(i){const{media:e}=i;if(!e)return Number.NaN;const{targetLiveWindow:t}=e,r=da.mediaStreamType.get(i);return(t==null||Number.isNaN(t))&&r===Yi.LIVE?0:t},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(i){const{media:e,options:{liveEdgeOffset:t=10}={}}=i;if(!e)return!1;if(typeof e.liveEdgeStart=="number")return Number.isNaN(e.liveEdgeStart)?!1:e.currentTime>=e.liveEdgeStart;if(!(da.mediaStreamType.get(i)===Yi.LIVE))return!1;const s=e.seekable;if(!s)return!0;if(!s.length)return!1;const n=s.end(s.length-1)-t;return e.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get(i){return gd(i).map(({kind:e,label:t,language:r})=>({kind:e,label:t,language:r}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get(i){return ny(i).map(({kind:e,label:t,language:r})=>({kind:e,label:t,language:r}))},mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t,r;const{media:s,options:n}=e;if(!s)return;const a=o=>{var l;!n.defaultSubtitles||o&&![Ci.CAPTIONS,Ci.SUBTITLES].includes((l=o==null?void 0:o.track)==null?void 0:l.kind)||ay(e,!0)};return s.addEventListener("loadstart",a),(t=s.textTracks)==null||t.addEventListener("addtrack",a),(r=s.textTracks)==null||r.addEventListener("removetrack",a),()=>{var o,l;s.removeEventListener("loadstart",a),(o=s.textTracks)==null||o.removeEventListener("addtrack",a),(l=s.textTracks)==null||l.removeEventListener("removetrack",a)}}]},mediaChaptersCues:{get(i){var e;const{media:t}=i;if(!t)return[];const[r]=jd(t,{kind:Ci.CHAPTERS});return Array.from((e=r==null?void 0:r.cues)!=null?e:[]).map(({text:s,startTime:n,endTime:a})=>({text:wk(s),startTime:n,endTime:a}))},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:r}=e;if(!r)return;const s=r.querySelector('track[kind="chapters"][default][src]'),n=(t=r.shadowRoot)==null?void 0:t.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return s==null||s.addEventListener("load",i),n==null||n.addEventListener("load",i),()=>{s==null||s.removeEventListener("load",i),n==null||n.removeEventListener("load",i)}}]},mediaIsPip:{get(i){var e,t;const{media:r,documentElement:s}=i;if(!r||!s||!s.pictureInPictureElement)return!1;if(s.pictureInPictureElement===r)return!0;if(s.pictureInPictureElement instanceof HTMLMediaElement)return(e=r.localName)!=null&&e.includes("-")?tr(r,s.pictureInPictureElement):!1;if(s.pictureInPictureElement.localName.includes("-")){let n=s.pictureInPictureElement.shadowRoot;for(;n!=null&&n.pictureInPictureElement;){if(n.pictureInPictureElement===r)return!0;n=(t=n.pictureInPictureElement)==null?void 0:t.shadowRoot}}return!1},set(i,e){const{media:t}=e;if(t)if(i){if(!at.pictureInPictureEnabled){console.warn("MediaChrome: Picture-in-picture is not enabled");return}if(!t.requestPictureInPicture){console.warn("MediaChrome: The current media does not support picture-in-picture");return}const r=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};t.requestPictureInPicture().catch(s=>{if(s.code===11){if(!t.src){console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");return}if(t.readyState===0&&t.preload==="none"){const n=()=>{t.removeEventListener("loadedmetadata",a),t.preload="none"},a=()=>{t.requestPictureInPicture().catch(r),n()};t.addEventListener("loadedmetadata",a),t.preload="metadata",setTimeout(()=>{t.readyState===0&&r(),n()},1e3)}else throw s}else throw s})}else at.pictureInPictureElement&&at.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(i){var e;const{media:t}=i;return[...(e=t==null?void 0:t.videoRenditions)!=null?e:[]].map(r=>({...r}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(i){var e,t,r;const{media:s}=i;return(r=(t=s==null?void 0:s.videoRenditions)==null?void 0:t[(e=s.videoRenditions)==null?void 0:e.selectedIndex])==null?void 0:r.id},set(i,e){const{media:t}=e;if(!(t!=null&&t.videoRenditions)){console.warn("MediaController: Rendition selection not supported by this media.");return}const r=i,s=Array.prototype.findIndex.call(t.videoRenditions,n=>n.id==r);t.videoRenditions.selectedIndex!=s&&(t.videoRenditions.selectedIndex=s)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(i){var e;const{media:t}=i;return[...(e=t==null?void 0:t.audioTracks)!=null?e:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(i){var e,t;const{media:r}=i;return(t=[...(e=r==null?void 0:r.audioTracks)!=null?e:[]].find(s=>s.enabled))==null?void 0:t.id},set(i,e){const{media:t}=e;if(!(t!=null&&t.audioTracks)){console.warn("MediaChrome: Audio track selection not supported by this media.");return}const r=i;for(const s of t.audioTracks)s.enabled=r==s.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get(i){return mk(i)},set(i,e){i?ck(e):hk(e)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(i){var e;const{media:t}=i;return!(t!=null&&t.remote)||((e=t.remote)==null?void 0:e.state)==="disconnected"?!1:!!t.remote.state},set(i,e){var t,r;const{media:s}=e;if(s&&!(i&&((t=s.remote)==null?void 0:t.state)!=="disconnected")&&!(!i&&((r=s.remote)==null?void 0:r.state)!=="connected")){if(typeof s.remote.prompt!="function"){console.warn("MediaChrome: Casting is not supported in this environment");return}s.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get(){return!1},set(i,e){const{media:t}=e;if(t){if(!(t.webkitShowPlaybackTargetPicker&&L.WebKitPlaybackTargetAvailabilityEvent)){console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");return}t.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(i){const{media:e}=i;if(!Tk||!sy(e))return Ft.UNSUPPORTED}},mediaPipUnavailable:{get(i){const{media:e}=i;if(!_k||!ry(e))return Ft.UNSUPPORTED}},mediaVolumeUnavailable:{get(i){const{media:e}=i;if(vd===!1||(e==null?void 0:e.volume)==null)return Ft.UNSUPPORTED},stateOwnersUpdateHandlers:[i=>{vd==null&&Lk.then(e=>i(e?void 0:Ft.UNSUPPORTED))}]},mediaCastUnavailable:{get(i,{availability:e="not-available"}={}){var t;const{media:r}=i;if(!Sk||!((t=r==null?void 0:r.remote)!=null&&t.state))return Ft.UNSUPPORTED;if(!(e==null||e==="available"))return Ft.UNAVAILABLE},stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:r}=e;return r?(r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||(t=r==null?void 0:r.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=r==null?void 0:r.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaAirplayUnavailable:{get(i,e){if(!Ak)return Ft.UNSUPPORTED;if((e==null?void 0:e.availability)==="not-available")return Ft.UNAVAILABLE},mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(i,e)=>{var t;const{media:r}=e;return r?(r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||(t=r==null?void 0:r.remote)==null||t.watchAvailability(n=>{i({availability:n?"available":"not-available"})}).catch(n=>{n.name==="NotSupportedError"?i({availability:null}):i({availability:"not-available"})}),()=>{var n;(n=r==null?void 0:r.remote)==null||n.cancelWatchAvailability().catch(()=>{})}):void 0}]},mediaRenditionUnavailable:{get(i){var e;const{media:t}=i;if(!(t!=null&&t.videoRenditions))return Ft.UNSUPPORTED;if(!((e=t.videoRenditions)!=null&&e.length))return Ft.UNAVAILABLE},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(i){var e,t;const{media:r}=i;if(!(r!=null&&r.audioTracks))return Ft.UNSUPPORTED;if(((t=(e=r.audioTracks)==null?void 0:e.length)!=null?t:0)<=1)return Ft.UNAVAILABLE},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]}},Dk={[j.MEDIA_PREVIEW_REQUEST](i,e,{detail:t}){var r,s,n;const{media:a}=e,o=t??void 0;let l,d;if(a&&o!=null){const[f]=jd(a,{kind:Ci.METADATA,label:"thumbnails"}),m=Array.prototype.find.call((r=f==null?void 0:f.cues)!=null?r:[],(p,g,v)=>g===0?p.endTime>o:g===v.length-1?p.startTime<=o:p.startTime<=o&&p.endTime>o);if(m){const p=/'^(?:[a-z]+:)?\/\//i.test(m.text)||(s=a==null?void 0:a.querySelector('track[label="thumbnails"]'))==null?void 0:s.src,g=new URL(m.text,p);d=new URLSearchParams(g.hash).get("#xywh").split(",").map(b=>+b),l=g.href}}const u=i.mediaDuration.get(e);
289let h=(n=i.mediaChaptersCues.get(e).find((f,m,p)=>m===p.length-1&&u===f.endTime?f.startTime<=o&&f.endTime>=o:f.startTime<=o&&f.endTime>o))==null?void 0:n.text;return t!=null&&h==null&&(h=""),{mediaPreviewTime:o,mediaPreviewImage:l,mediaPreviewCoords:d,mediaPreviewChapter:h}},[j.MEDIA_PAUSE_REQUEST](i,e){i["mediaPaused"].set(!0,e)},[j.MEDIA_PLAY_REQUEST](i,e){var t,r,s,n;const a="mediaPaused",l=i.mediaStreamType.get(e)===Yi.LIVE,d=!((t=e.options)!=null&&t.noAutoSeekToLive),u=i.mediaTargetLiveWindow.get(e)>0;if(l&&d&&!u){const c=(r=i.mediaSeekable.get(e))==null?void 0:r[1];if(c){const h=(n=(s=e.options)==null?void 0:s.seekToLiveOffset)!=null?n:0,f=c-h;i.mediaCurrentTime.set(f,e)}}i[a].set(!1,e)},[j.MEDIA_PLAYBACK_RATE_REQUEST](i,e,{detail:t}){const r="mediaPlaybackRate",s=t;i[r].set(s,e)},[j.MEDIA_MUTE_REQUEST](i,e){i["mediaMuted"].set(!0,e)},[j.MEDIA_UNMUTE_REQUEST](i,e){const t="mediaMuted";i.mediaVolume.get(e)||i.mediaVolume.set(.25,e),i[t].set(!1,e)},[j.MEDIA_VOLUME_REQUEST](i,e,{detail:t}){const r="mediaVolume",s=t;s&&i.mediaMuted.get(e)&&i.mediaMuted.set(!1,e),i[r].set(s,e)},[j.MEDIA_SEEK_REQUEST](i,e,{detail:t}){const r="mediaCurrentTime",s=t;i[r].set(s,e)},[j.MEDIA_SEEK_TO_LIVE_REQUEST](i,e){var t,r,s;const n="mediaCurrentTime",a=(t=i.mediaSeekable.get(e))==null?void 0:t[1];if(Number.isNaN(Number(a)))return;const o=(s=(r=e.options)==null?void 0:r.seekToLiveOffset)!=null?s:0,l=a-o;i[n].set(l,e)},[j.MEDIA_SHOW_SUBTITLES_REQUEST](i,e,{detail:t}){var r;const{options:s}=e,n=gd(e),a=ey(t),o=(r=a[0])==null?void 0:r.language;o&&!s.noSubtitlesLangPref&&L.localStorage.setItem("media-chrome-pref-subtitles-lang",o),La(hn.SHOWING,n,a)},[j.MEDIA_DISABLE_SUBTITLES_REQUEST](i,e,{detail:t}){const r=gd(e),s=t??[];La(hn.DISABLED,r,s)},[j.MEDIA_TOGGLE_SUBTITLES_REQUEST](i,e,{detail:t}){ay(e,t)},[j.MEDIA_RENDITION_REQUEST](i,e,{detail:t}){const r="mediaRenditionSelected",s=t;i[r].set(s,e)},[j.MEDIA_AUDIO_TRACK_REQUEST](i,e,{detail:t}){const r="mediaAudioTrackEnabled",s=t;i[r].set(s,e)},[j.MEDIA_ENTER_PIP_REQUEST](i,e){const t="mediaIsPip";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[j.MEDIA_EXIT_PIP_REQUEST](i,e){i["mediaIsPip"].set(!1,e)},[j.MEDIA_ENTER_FULLSCREEN_REQUEST](i,e){const t="mediaIsFullscreen";i.mediaIsPip.get(e)&&i.mediaIsPip.set(!1,e),i[t].set(!0,e)},[j.MEDIA_EXIT_FULLSCREEN_REQUEST](i,e){i["mediaIsFullscreen"].set(!1,e)},[j.MEDIA_ENTER_CAST_REQUEST](i,e){const t="mediaIsCasting";i.mediaIsFullscreen.get(e)&&i.mediaIsFullscreen.set(!1,e),i[t].set(!0,e)},[j.MEDIA_EXIT_CAST_REQUEST](i,e){i["mediaIsCasting"].set(!1,e)},[j.MEDIA_AIRPLAY_REQUEST](i,e){i["mediaIsAirplaying"].set(!0,e)}},Ck=({media:i,fullscreenElement:e,documentElement:t,stateMediator:r=da,requestMap:s=Dk,options:n={},monitorStateOwnersOnlyWithSubscriptions:a=!0})=>{const o=[],l={options:{...n}};let d=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0});const u=p=>{p!=null&&(If(p,d)||(d=Object.freeze({...d,...p}),o.forEach(g=>g(d))))},c=()=>{const p=Object.entries(r).reduce((g,[v,{get:b}])=>(g[v]=b(l),g),{});u(p)},h={};let f;const m=async(p,g)=>{var v,b,y,A,_,C,x,S,P,I,M,$,F,Q,Y,X;const ue=!!f;if(f={...l,...f??{},...p},ue)return;await Ik(...Object.values(p));const de=o.length>0&&g===0&&a,K=l.media!==f.media,H=((v=l.media)==null?void 0:v.textTracks)!==((b=f.media)==null?void 0:b.textTracks),ne=((y=l.media)==null?void 0:y.videoRenditions)!==((A=f.media)==null?void 0:A.videoRenditions),oe=((_=l.media)==null?void 0:_.audioTracks)!==((C=f.media)==null?void 0:C.audioTracks),pe=((x=l.media)==null?void 0:x.remote)!==((S=f.media)==null?void 0:S.remote),Be=l.documentElement!==f.documentElement,He=!!l.media&&(K||de),je=!!((P=l.media)!=null&&P.textTracks)&&(H||de),_t=!!((I=l.media)!=null&&I.videoRenditions)&&(ne||de),ir=!!((M=l.media)!=null&&M.audioTracks)&&(oe||de),Rs=!!(($=l.media)!=null&&$.remote)&&(pe||de),Am=!!l.documentElement&&(Be||de),Sm=He||je||_t||ir||Rs||Am,Ls=o.length===0&&g===1&&a,xm=!!f.media&&(K||Ls),Rm=!!((F=f.media)!=null&&F.textTracks)&&(H||Ls),Lm=!!((Q=f.media)!=null&&Q.videoRenditions)&&(ne||Ls),Im=!!((Y=f.media)!=null&&Y.audioTracks)&&(oe||Ls),km=!!((X=f.media)!=null&&X.remote)&&(pe||Ls),wm=!!f.documentElement&&(Be||Ls),Dm=xm||Rm||Lm||Im||km||wm;if(!(Sm||Dm)){Object.entries(f).forEach(([Ie,$n])=>{l[Ie]=$n}),c(),f=void 0;return}Object.entries(r).forEach(([Ie,{get:$n,mediaEvents:Pb=[],textTracksEvents:Nb=[],videoRenditionsEvents:Ub=[],audioTracksEvents:Fb=[],remoteEvents:$b=[],rootEvents:Bb=[],stateOwnersUpdateHandlers:Hb=[]}])=>{h[Ie]||(h[Ie]={});const It=qe=>{const kt=$n(l,qe);u({[Ie]:kt})};let ot;ot=h[Ie].mediaEvents,Pb.forEach(qe=>{ot&&He&&(l.media.removeEventListener(qe,ot),h[Ie].mediaEvents=void 0),xm&&(f.media.addEventListener(qe,It),h[Ie].mediaEvents=It)}),ot=h[Ie].textTracksEvents,Nb.forEach(qe=>{var kt,qt;ot&&je&&((kt=l.media.textTracks)==null||kt.removeEventListener(qe,ot),h[Ie].textTracksEvents=void 0),Rm&&((qt=f.media.textTracks)==null||qt.addEventListener(qe,It),h[Ie].textTracksEvents=It)}),ot=h[Ie].videoRenditionsEvents,Ub.forEach(qe=>{var kt,qt;ot&&_t&&((kt=l.media.videoRenditions)==null||kt.removeEventListener(qe,ot),h[Ie].videoRenditionsEvents=void 0),Lm&&((qt=f.media.videoRenditions)==null||qt.addEventListener(qe,It),h[Ie].videoRenditionsEvents=It)}),ot=h[Ie].audioTracksEvents,Fb.forEach(qe=>{var kt,qt;ot&&ir&&((kt=l.media.audioTracks)==null||kt.removeEventListener(qe,ot),h[Ie].audioTracksEvents=void 0),Im&&((qt=f.media.audioTracks)==null||qt.addEventListener(qe,It),h[Ie].audioTracksEvents=It)}),ot=h[Ie].remoteEvents,$b.forEach(qe=>{var kt,qt;ot&&Rs&&((kt=l.media.remote)==null||kt.removeEventListener(qe,ot),h[Ie].remoteEvents=void 0),km&&((qt=f.media.remote)==null||qt.addEventListener(qe,It),h[Ie].remoteEvents=It)}),ot=h[Ie].rootEvents,Bb.forEach(qe=>{ot&&Am&&(l.documentElement.removeEventListener(qe,ot),h[Ie].rootEvents=void 0),wm&&(f.documentElement.addEventListener(qe,It),h[Ie].rootEvents=It)});const Cm=h[Ie].stateOwnersUpdateHandlers;Hb.forEach(qe=>{Cm&&Sm&&Cm(),Dm&&(h[Ie].stateOwnersUpdateHandlers=qe(It,f))})}),Object.entries(f).forEach(([Ie,$n])=>{l[Ie]=$n}),c(),f=void 0};
vendor: 5,671 bytes, line 289
289return m({media:i,fullscreenElement:e,documentElement:t,options:n}),{dispatch(p){const{type:g,detail:v}=p;if(s[g]&&d.mediaErrorCode==null){u(s[g](r,l,p));return}g==="mediaelementchangerequest"?m({media:v}):g==="fullscreenelementchangerequest"?m({fullscreenElement:v}):g==="documentelementchangerequest"?m({documentElement:v}):g==="optionschangerequest"&&Object.entries(v??{}).forEach(([b,y])=>{l.options[b]=y})},getState(){return d},subscribe(p){return m({},o.length+1),o.push(p),p(d),()=>{const g=o.indexOf(p);g>=0&&(m({},o.length-1),o.splice(g,1))}}}};var kf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},me=(i,e,t)=>(kf(i,e,"read from private field"),t?t.call(i):e.get(i)),$i=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ar=(i,e,t,r)=>(kf(i,e,"write to private field"),e.set(i,t),t),Er=(i,e,t)=>(kf(i,e,"access private method"),t),os,ua,we,ca,ci,nl,al,Vc,Dn,Va,ol,Wc;const oy=["ArrowLeft","ArrowRight","Enter"," ","f","m","k","c"],fg=10,V={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYS_USED:"keysused",LIVE_EDGE_OFFSET:"liveedgeoffset",SEEK_TO_LIVE_OFFSET:"seektoliveoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_HOTKEYS:"nohotkeys",NO_VOLUME_PREF:"novolumepref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_DEFAULT_STORE:"nodefaultstore",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",LANG:"lang"};class ly extends Yd{constructor(){super(),$i(this,al),$i(this,Dn),$i(this,ol),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,$i(this,os,new Rf(this,V.HOTKEYS)),$i(this,ua,void 0),$i(this,we,void 0),$i(this,ca,void 0),$i(this,ci,void 0),$i(this,nl,t=>{var r;(r=me(this,we))==null||r.dispatch(t)}),this.associateElement(this);let e={};ar(this,ca,t=>{Object.entries(t).forEach(([r,s])=>{if(r in e&&e[r]===s)return;this.propagateMediaState(r,s);const n=r.toLowerCase(),a=new L.CustomEvent(PI[n],{composed:!0,detail:s});this.dispatchEvent(a)}),e=t}),this.enableHotkeys()}static get observedAttributes(){return super.observedAttributes.concat(V.NO_HOTKEYS,V.HOTKEYS,V.DEFAULT_STREAM_TYPE,V.DEFAULT_SUBTITLES,V.DEFAULT_DURATION,V.LANG)}get mediaStore(){return me(this,we)}set mediaStore(e){var t,r;if(me(this,we)&&((t=me(this,ci))==null||t.call(this),ar(this,ci,void 0)),ar(this,we,e),!me(this,we)&&!this.hasAttribute(V.NO_DEFAULT_STORE)){Er(this,al,Vc).call(this);return}ar(this,ci,(r=me(this,we))==null?void 0:r.subscribe(me(this,ca)))}get fullscreenElement(){var e;return(e=me(this,ua))!=null?e:this}set fullscreenElement(e){var t;this.hasAttribute(V.FULLSCREEN_ELEMENT)&&this.removeAttribute(V.FULLSCREEN_ELEMENT),ar(this,ua,e),(t=me(this,we))==null||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return ve(this,V.DEFAULT_SUBTITLES)}set defaultSubtitles(e){Ee(this,V.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return Fe(this,V.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){$e(this,V.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return Ue(this,V.DEFAULT_DURATION)}set defaultDuration(e){Ye(this,V.DEFAULT_DURATION,e)}get noHotkeys(){return ve(this,V.NO_HOTKEYS)}set noHotkeys(e){Ee(this,V.NO_HOTKEYS,e)}get keysUsed(){return Fe(this,V.KEYS_USED)}set keysUsed(e){$e(this,V.KEYS_USED,e)}get liveEdgeOffset(){return Ue(this,V.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){Ye(this,V.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return ve(this,V.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){Ee(this,V.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return ve(this,V.NO_VOLUME_PREF)}set noVolumePref(e){Ee(this,V.NO_VOLUME_PREF,e)}get noSubtitlesLangPref(){return ve(this,V.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){Ee(this,V.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return ve(this,V.NO_DEFAULT_STORE)}set noDefaultStore(e){Ee(this,V.NO_DEFAULT_STORE,e)}attributeChangedCallback(e,t,r){var s,n,a,o,l,d,u,c;if(super.attributeChangedCallback(e,t,r),e===V.NO_HOTKEYS)r!==t&&r===""?(this.hasAttribute(V.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):r!==t&&r===null&&this.enableHotkeys();else if(e===V.HOTKEYS)me(this,os).value=r;else if(e===V.DEFAULT_SUBTITLES&&r!==t)(s=me(this,we))==null||s.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(V.DEFAULT_SUBTITLES)}});else if(e===V.DEFAULT_STREAM_TYPE)(a=me(this,we))==null||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:(n=this.getAttribute(V.DEFAULT_STREAM_TYPE))!=null?n:void 0}});else if(e===V.LIVE_EDGE_OFFSET)(o=me(this,we))==null||o.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(V.LIVE_EDGE_OFFSET)?+this.getAttribute(V.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(V.SEEK_TO_LIVE_OFFSET)?void 0:+this.getAttribute(V.LIVE_EDGE_OFFSET)}});else if(e===V.SEEK_TO_LIVE_OFFSET)(l=me(this,we))==null||l.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(V.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(V.SEEK_TO_LIVE_OFFSET):void 0}});else if(e===V.NO_AUTO_SEEK_TO_LIVE)(d=me(this,we))==null||d.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(V.NO_AUTO_SEEK_TO_LIVE)}});else if(e===V.FULLSCREEN_ELEMENT){const h=r?(u=this.getRootNode())==null?void 0:u.getElementById(r):void 0;ar(this,ua,h),(c=me(this,we))==null||c.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}
289else e===V.LANG&&r!==t&&jI(r)}connectedCallback(){var e,t;!me(this,we)&&!this.hasAttribute(V.NO_DEFAULT_STORE)&&Er(this,al,Vc).call(this),(e=me(this,we))==null||e.dispatch({type:"documentelementchangerequest",detail:at}),super.connectedCallback(),me(this,we)&&!me(this,ci)&&ar(this,ci,(t=me(this,we))==null?void 0:t.subscribe(me(this,ca))),this.enableHotkeys()}disconnectedCallback(){var e,t,r,s;(e=super.disconnectedCallback)==null||e.call(this),me(this,we)&&((t=me(this,we))==null||t.dispatch({type:"documentelementchangerequest",detail:void 0}),(r=me(this,we))==null||r.dispatch({type:j.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})),me(this,ci)&&((s=me(this,ci))==null||s.call(this),ar(this,ci,void 0))}mediaSetCallback(e){var t;super.mediaSetCallback(e),(t=me(this,we))==null||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),(t=me(this,we))==null||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){gg(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(t.has(e))return;const r=this.registerMediaStateReceiver.bind(this),s=this.unregisterMediaStateReceiver.bind(this),n=Fk(e,r,s);Object.values(j).forEach(a=>{e.addEventListener(a,me(this,nl))}),t.set(e,n)}unassociateElement(e){if(!e)return;const{associatedElementSubscriptions:t}=this;if(!t.has(e))return;t.get(e)(),t.delete(e),Object.values(j).forEach(s=>{e.removeEventListener(s,me(this,nl))})}registerMediaStateReceiver(e){if(!e)return;const t=this.mediaStateReceivers;t.indexOf(e)>-1||(t.push(e),me(this,we)&&Object.entries(me(this,we).getState()).forEach(([s,n])=>{gg([e],s,n)}))}unregisterMediaStateReceiver(e){const t=this.mediaStateReceivers,r=t.indexOf(e);r<0||t.splice(r,1)}enableHotkeys(){this.addEventListener("keydown",Er(this,ol,Wc))}disableHotkeys(){this.removeEventListener("keydown",Er(this,ol,Wc)),this.removeEventListener("keyup",Er(this,Dn,Va))}get hotkeys(){return Fe(this,V.HOTKEYS)}set hotkeys(e){$e(this,V.HOTKEYS,e)}keyboardShortcutHandler(e){var t,r,s,n,a;const o=e.target;if(((s=(r=(t=o.getAttribute(V.KEYS_USED))==null?void 0:t.split(" "))!=null?r:o==null?void 0:o.keysUsed)!=null?s:[]).map(h=>h==="Space"?" ":h).filter(Boolean).includes(e.key))return;let d,u,c;if(!me(this,os).contains(`no${e.key.toLowerCase()}`)&&!(e.key===" "&&me(this,os).contains("nospace")))switch(e.key){case" ":case"k":d=me(this,we).getState().mediaPaused?j.MEDIA_PLAY_REQUEST:j.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new L.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"m":d=this.mediaStore.getState().mediaVolumeLevel==="off"?j.MEDIA_UNMUTE_REQUEST:j.MEDIA_MUTE_REQUEST,this.dispatchEvent(new L.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"f":d=this.mediaStore.getState().mediaIsFullscreen?j.MEDIA_EXIT_FULLSCREEN_REQUEST:j.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new L.CustomEvent(d,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new L.CustomEvent(j.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":{const h=this.hasAttribute(V.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(V.KEYBOARD_BACKWARD_SEEK_OFFSET):fg;u=Math.max(((n=this.mediaStore.getState().mediaCurrentTime)!=null?n:0)-h,0),c=new L.CustomEvent(j.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(c);break}case"ArrowRight":{const h=this.hasAttribute(V.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(V.KEYBOARD_FORWARD_SEEK_OFFSET):fg;u=Math.max(((a=this.mediaStore.getState().mediaCurrentTime)!=null?a:0)+h,0),c=new L.CustomEvent(j.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:u}),this.dispatchEvent(c);break}}}}os=new WeakMap;ua=new WeakMap;we=new WeakMap;ca=new WeakMap;ci=new WeakMap;nl=new WeakMap;al=new WeakSet;Vc=function(){var i;this.mediaStore=Ck({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(V.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(V.DEFAULT_DURATION)?+this.getAttribute(V.DEFAULT_DURATION):void 0,defaultStreamType:(i=this.getAttribute(V.DEFAULT_STREAM_TYPE))!=null?i:void 0,liveEdgeOffset:this.hasAttribute(V.LIVE_EDGE_OFFSET)?+this.getAttribute(V.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(V.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(V.SEEK_TO_LIVE_OFFSET):this.hasAttribute(V.LIVE_EDGE_OFFSET)?+this.getAttribute(V.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(V.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(V.NO_VOLUME_PREF),noSubtitlesLangPref:this.hasAttribute(V.NO_SUBTITLES_LANG_PREF)}})};Dn=new WeakSet;Va=function(i){const{key:e}=i;if(!oy.includes(e)){this.removeEventListener("keyup",Er(this,Dn,Va));return}this.keyboardShortcutHandler(i)};ol=new WeakSet;Wc=function(i){const{metaKey:e,altKey:t,key:r}=i;if(e||t||!oy.includes(r)){this.removeEventListener("keyup",Er(this,Dn,Va));return}[" ","ArrowLeft","ArrowRight"].includes(r)&&!(me(this,os).contains(`no${r.toLowerCase()}
289`)||r===" "&&me(this,os).contains("nospace"))&&i.preventDefault(),this.addEventListener("keyup",Er(this,Dn,Va),{once:!0})};const Mk=Object.values(T),Ok=Object.values(ME),dy=i=>{var e,t,r,s;let{observedAttributes:n}=i.constructor;!n&&((e=i.nodeName)!=null&&e.includes("-"))&&(L.customElements.upgrade(i),{observedAttributes:n}=i.constructor);const a=(s=(r=(t=i==null?void 0:i.getAttribute)==null?void 0:t.call(i,Te.MEDIA_CHROME_ATTRIBUTES))==null?void 0:r.split)==null?void 0:s.call(r,/\s+/);return Array.isArray(n||a)?(n||a).filter(o=>Mk.includes(o)):[]},Pk=i=>{var e,t;return(e=i.nodeName)!=null&&e.includes("-")&&L.customElements.get((t=i.nodeName)==null?void 0:t.toLowerCase())&&!(i instanceof L.customElements.get(i.nodeName.toLowerCase()))&&L.customElements.upgrade(i),Ok.some(r=>r in i)},Yc=i=>Pk(i)||!!dy(i).length,mg=i=>{var e;return(e=i==null?void 0:i.join)==null?void 0:e.call(i,":")},pg={[T.MEDIA_SUBTITLES_LIST]:Ka,[T.MEDIA_SUBTITLES_SHOWING]:Ka,[T.MEDIA_SEEKABLE]:mg,[T.MEDIA_BUFFERED]:i=>i==null?void 0:i.map(mg).join(" "),[T.MEDIA_PREVIEW_COORDS]:i=>i==null?void 0:i.join(" "),[T.MEDIA_RENDITION_LIST]:UI,[T.MEDIA_AUDIO_TRACK_LIST]:HI},Nk=async(i,e,t)=>{var r,s;if(i.isConnected||await NE(0),typeof t=="boolean"||t==null)return Ee(i,e,t);if(typeof t=="number")return Ye(i,e,t);if(typeof t=="string")return $e(i,e,t);if(Array.isArray(t)&&!t.length)return i.removeAttribute(e);const n=(s=(r=pg[e])==null?void 0:r.call(pg,t))!=null?s:t;return i.setAttribute(e,n)},Uk=i=>{var e;return!!((e=i.closest)!=null&&e.call(i,'*[slot="media"]'))},jr=(i,e)=>{if(Uk(i))return;const t=(s,n)=>{var a,o;Yc(s)&&n(s);const{children:l=[]}=s??{},d=(o=(a=s==null?void 0:s.shadowRoot)==null?void 0:a.children)!=null?o:[];[...l,...d].forEach(c=>jr(c,n))},r=i==null?void 0:i.nodeName.toLowerCase();if(r.includes("-")&&!Yc(i)){L.customElements.whenDefined(r).then(()=>{t(i,e)});return}t(i,e)},gg=(i,e,t)=>{i.forEach(r=>{if(e in r){r[e]=t;return}const s=dy(r),n=e.toLowerCase();s.includes(n)&&Nk(r,n,t)})},Fk=(i,e,t)=>{jr(i,e);const r=u=>{var c;const h=(c=u==null?void 0:u.composedPath()[0])!=null?c:u.target;e(h)},s=u=>{var c;const h=(c=u==null?void 0:u.composedPath()[0])!=null?c:u.target;t(h)};i.addEventListener(j.REGISTER_MEDIA_STATE_RECEIVER,r),i.addEventListener(j.UNREGISTER_MEDIA_STATE_RECEIVER,s);const n=u=>{u.forEach(c=>{const{addedNodes:h=[],removedNodes:f=[],type:m,target:p,attributeName:g}=c;m==="childList"?(Array.prototype.forEach.call(h,v=>jr(v,e)),Array.prototype.forEach.call(f,v=>jr(v,t))):m==="attributes"&&g===Te.MEDIA_CHROME_ATTRIBUTES&&(Yc(p)?e(p):t(p))})};let a=[];const o=u=>{const c=u.target;c.name!=="media"&&(a.forEach(h=>jr(h,t)),a=[...c.assignedElements({flatten:!0})],a.forEach(h=>jr(h,e)))};i.addEventListener("slotchange",o);const l=new MutationObserver(n);return l.observe(i,{childList:!0,attributes:!0,subtree:!0}),()=>{jr(i,t),i.removeEventListener("slotchange",o),l.disconnect(),i.removeEventListener(j.REGISTER_MEDIA_STATE_RECEIVER,r),i.removeEventListener(j.UNREGISTER_MEDIA_STATE_RECEIVER,s)}};L.customElements.get("media-controller")||L.customElements.define("media-controller",ly);var $k=ly;const Cs={PLACEMENT:"placement",BOUNDS:"bounds"};function Bk(i){return` 290 <style> 291 :host { 292 --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7))); 293 --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color)); 294 --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2); 295 --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px); 296 --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color)); 297 position: relative; 298 pointer-events: none; 299 display: var(--media-tooltip-display, inline-flex); 300 justify-content: center; 301 align-items: center; 302 box-sizing: border-box; 303 z-index: var(--media-tooltip-z-index, 1); 304 background: var(--_tooltip-background); 305 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 306 font: var(--media-font, 307 var(--media-font-weight, 400) 308 var(--media-font-size, 13px) / 309 var(--media-text-content-height, var(--media-control-height, 18px)) 310 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 311 padding: var(--media-tooltip-padding, .35em .7em); 312 border: var(--media-tooltip-border, none); 313 border-radius: var(--media-tooltip-border-radius, 5px); 314 filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2))); 315 white-space: var(--media-tooltip-white-space, nowrap); 316 } 317 318 :host([hidden]) { 319 display: none; 320 } 321 322 img, svg { 323 display: inline-block; 324 } 325 326 #arrow { 327 position: absolute; 328 width: 0px; 329 height: 0px; 330 border-style: solid; 331 display: var(--media-tooltip-arrow-display, block); 332 } 333 334 :host(:not([placement])), 335 :host([placement="top"]) { 336 position: absolute; 337 bottom: calc(100% + var(--media-tooltip-distance, 12px)); 338 left: 50%; 339 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
339); 340 } 341 :host(:not([placement])) #arrow, 342 :host([placement="top"]) #arrow { 343 top: 100%; 344 left: 50%; 345 border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width); 346 border-color: var(--_tooltip-arrow-background) transparent transparent transparent; 347 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 348 } 349 350 :host([placement="right"]) { 351 position: absolute; 352 left: calc(100% + var(--media-tooltip-distance, 12px)); 353 top: 50%; 354 transform: translate(0, -50%); 355 } 356 :host([placement="right"]) #arrow { 357 top: 50%; 358 right: 100%; 359 border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0; 360 border-color: transparent var(--_tooltip-arrow-background) transparent transparent; 361 transform: translate(0, -50%); 362 } 363 364 :host([placement="bottom"]) { 365 position: absolute; 366 top: calc(100% + var(--media-tooltip-distance, 12px)); 367 left: 50%; 368 transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0); 369 } 370 :host([placement="bottom"]) #arrow { 371 bottom: 100%; 372 left: 50%; 373 border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width); 374 border-color: transparent transparent var(--_tooltip-arrow-background) transparent; 375 transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0); 376 } 377 378 :host([placement="left"]) { 379 position: absolute; 380 right: calc(100% + var(--media-tooltip-distance, 12px)); 381 top: 50%; 382 transform: translate(0, -50%); 383 } 384 :host([placement="left"]) #arrow { 385 top: 50%; 386 left: 100%; 387 border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height); 388 border-color: transparent transparent transparent var(--_tooltip-arrow-background); 389 transform: translate(0, -50%); 390 } 391 392 :host([placement="none"]) #arrow { 393 display: none; 394 } 395 </style> 396 <slot></slot> 397 <div id="arrow"></div> 398 `}class zd extends L.HTMLElement{constructor(){if(super(),this.updateXOffset=()=>{var e;if(!WE(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;const t=this.placement;if(t==="left"||t==="right"){this.style.removeProperty("--media-tooltip-offset-x");return}const r=getComputedStyle(this),s=(e=On(this,"#"+this.bounds))!=null?e:Yt(this);if(!s)return;const{x:n,width:a}=s.getBoundingClientRect(),{x:o,width:l}=this.getBoundingClientRect(),d=o+l,u=n+a,c=r.getPropertyValue("--media-tooltip-offset-x"),h=c?parseFloat(c.replace("px","")):0,f=r.getPropertyValue("--media-tooltip-container-margin"),m=f?parseFloat(f.replace("px","")):0,p=o-n+h-m,g=d-u+h+m;if(p<0){this.style.setProperty("--media-tooltip-offset-x",`${p}px`);return}if(g>0){this.style.setProperty("--media-tooltip-offset-x",`${g}px`);return}this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){const e=this.placement;delete this.placement,this.placement=e}}static get observedAttributes(){return[Cs.PLACEMENT,Cs.BOUNDS]}get placement(){return Fe(this,Cs.PLACEMENT)}set placement(e){$e(this,Cs.PLACEMENT,e)}get bounds(){return Fe(this,Cs.BOUNDS)}set bounds(e){$e(this,Cs.BOUNDS,e)}}zd.shadowRootOptions={mode:"open"};zd.getTemplateHTML=Bk;L.customElements.get("media-tooltip")||L.customElements.define("media-tooltip",zd);var vg=zd,wf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Xe=(i,e,t)=>(wf(i,e,"read from private field"),t?t.call(i):e.get(i)),Ms=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ao=(i,e,t,r)=>(wf(i,e,"write to private field"),e.set(i,t),t),Hk=(i,e,t)=>(wf(i,e,"access private method"),t),hi,on,yr,Vs,ll,qc,uy;const or={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};function Gk(i,e={}){return` 399 <style> 400 :host { 401 position: relative; 402 font: var(--media-font, 403 var(--media-font-weight, bold) 404 var(--media-font-size, 14px) / 405 var(--media-text-content-height, var(--media-control-height, 24px)) 406 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 407 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 408 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 409 padding: var(--media-button-padding, var(--media-control-padding, 10px)); 410 justify-content: var(--media-button-justify-content, center); 411 display: inline-flex; 412 align-items: center; 413 vertical-align: middle; 414 box-sizing: border-box; 415 transition: background .15s linear; 416 pointer-events: auto; 417 cursor: var(--media-cursor, pointer); 418 -webkit-tap-highlight-color: transparent; 419 } 420 421 422 :host(:focus-visible) { 423 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 424 outline: 0; 425 } 426 427 :host(:where(:focus)) { 428 box-shadow: none; 429 outline: 0; 430 } 431 432 :host(:hover) { 433 background: var(--media-control-hover-background, rgba(50 50 70 / .7)); 434 } 435 436 svg, img, ::slotted(svg), ::slotted(img) { 437 width: var(--media-button-icon-width); 438 height: var(--media-button-icon-height, var(--media-control-height, 24px)); 439 transform: var(--media-button-icon-transform); 440 transition: var(--media-button-icon-transition); 441 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 442 vertical-align: middle; 443 max-width: 100%; 444 max-height: 100%; 445 min-width: 100%; 446 } 447 448 media-tooltip { 449 450 max-width: 0; 451 overflow-x: clip; 452 opacity: 0; 453 transition: opacity .3s, max-width 0s 9s; 454 } 455 456 :host(:hover) media-tooltip, 457 :host(:focus-visible) media-tooltip { 458 max-width: 100vw; 459 opacity: 1; 460 transition: opacity .3s; 461 } 462 463 :host([notooltip]) slot[name="tooltip"] { 464 display: none; 465 } 466 </style> 467
468 ${this.getSlotTemplateHTML(i,e)} 469 470 <slot name="tooltip"> 471 <media-tooltip part="tooltip" aria-hidden="true"> 472 <template shadowrootmode="${vg.shadowRootOptions.mode}"> 473 ${vg.getTemplateHTML({})} 474 </template> 475 <slot name="tooltip-content"> 476 ${this.getTooltipContentHTML(i)} 477 </slot> 478 </media-tooltip> 479 </slot> 480 `}function Kk(i,e){return` 481 <slot></slot> 482 `}function Vk(){return""}class Et extends L.HTMLElement{constructor(){if(super(),Ms(this,qc),Ms(this,hi,void 0),this.preventClick=!1,this.tooltipEl=null,Ms(this,on,e=>{this.preventClick||this.handleClick(e),setTimeout(Xe(this,yr),0)}),Ms(this,yr,()=>{var e,t;(t=(e=this.tooltipEl)==null?void 0:e.updateXOffset)==null||t.call(e)}),Ms(this,Vs,e=>{const{key:t}=e;if(!this.keysUsed.includes(t)){this.removeEventListener("keyup",Xe(this,Vs));return}this.preventClick||this.handleClick(e)}),Ms(this,ll,e=>{const{metaKey:t,altKey:r,key:s}=e;if(t||r||!this.keysUsed.includes(s)){this.removeEventListener("keyup",Xe(this,Vs));return}this.addEventListener("keyup",Xe(this,Vs),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.tooltipEl=this.shadowRoot.querySelector("media-tooltip")}static get observedAttributes(){return["disabled",or.TOOLTIP_PLACEMENT,Te.MEDIA_CONTROLLER]}enable(){this.addEventListener("click",Xe(this,on)),this.addEventListener("keydown",Xe(this,ll)),this.tabIndex=0}disable(){this.removeEventListener("click",Xe(this,on)),this.removeEventListener("keydown",Xe(this,ll)),this.removeEventListener("keyup",Xe(this,Vs)),this.tabIndex=-1}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Te.MEDIA_CONTROLLER?(t&&((n=(s=Xe(this,hi))==null?void 0:s.unassociateElement)==null||n.call(s,this),Ao(this,hi,null)),r&&this.isConnected&&(Ao(this,hi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=Xe(this,hi))==null?void 0:o.associateElement)==null||l.call(o,this))):e==="disabled"&&r!==t?r==null?this.enable():this.disable():e===or.TOOLTIP_PLACEMENT&&this.tooltipEl&&r!==t&&(this.tooltipEl.placement=r),Xe(this,yr).call(this)}connectedCallback(){var e,t,r;const{style:s}=Je(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(Ao(this,hi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(r=(t=Xe(this,hi))==null?void 0:t.associateElement)==null||r.call(t,this)),L.customElements.whenDefined("media-tooltip").then(()=>Hk(this,qc,uy).call(this))}disconnectedCallback(){var e,t;this.disable(),(t=(e=Xe(this,hi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Ao(this,hi,null),this.removeEventListener("mouseenter",Xe(this,yr)),this.removeEventListener("focus",Xe(this,yr)),this.removeEventListener("click",Xe(this,on))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return Fe(this,or.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){$e(this,or.TOOLTIP_PLACEMENT,e)}get mediaController(){return Fe(this,Te.MEDIA_CONTROLLER)}set mediaController(e){$e(this,Te.MEDIA_CONTROLLER,e)}get disabled(){return ve(this,or.DISABLED)}set disabled(e){Ee(this,or.DISABLED,e)}get noTooltip(){return ve(this,or.NO_TOOLTIP)}set noTooltip(e){Ee(this,or.NO_TOOLTIP,e)}handleClick(e){}}hi=new WeakMap;on=new WeakMap;yr=new WeakMap;Vs=new WeakMap;ll=new WeakMap;qc=new WeakSet;uy=function(){this.addEventListener("mouseenter",Xe(this,yr)),this.addEventListener("focus",Xe(this,yr)),this.addEventListener("click",Xe(this,on));const i=this.tooltipPlacement;i&&this.tooltipEl&&(this.tooltipEl.placement=i)};Et.shadowRootOptions={mode:"open"};Et.getTemplateHTML=Gk;Et.getSlotTemplateHTML=Kk;Et.getTooltipContentHTML=Vk;L.customElements.get("media-chrome-button")||L.customElements.define("media-chrome-button",Et);const Eg=`<svg aria-hidden="true" viewBox="0 0 26 24"> 483 <path d="M22.13 3H3.87a.87.87 0 0 0-.87.87v13.26a.87.87 0 0 0 .87.87h3.4L9 16H5V5h16v11h-4l1.72 2h3.4a.87.87 0 0 0 .87-.87V3.87a.87.87 0 0 0-.86-.87Zm-8.75 11.44a.5.5 0 0 0-.76 0l-4.91 5.73a.5.5 0 0 0 .38.83h9.82a.501.501 0 0 0 .38-.83l-4.91-5.73Z"/> 484</svg> 485`;function Wk(i){return` 486 <style> 487 :host([${T.MEDIA_IS_AIRPLAYING}]) slot[name=icon] slot:not([name=exit]) { 488 display: none !important; 489 } 490 491 492 :host(:not([${T.MEDIA_IS_AIRPLAYING}])) slot[name=icon] slot:not([name=enter]) { 493 display: none !important; 494 } 495 496 :host([${T.MEDIA_IS_AIRPLAYING}]) slot[name=tooltip-enter], 497 :host(:not([${T.MEDIA_IS_AIRPLAYING}])) slot[name=tooltip-exit] { 498 display: none; 499 } 500 </style> 501 502 <slot name="icon"> 503 <slot name="enter">${Eg}</slot> 504 <slot name="exit">${Eg}</slot> 505 </slot> 506 `}function Yk(){return` 507 <slot name="tooltip-enter">${z("start airplay")}</slot> 508 <slot name="tooltip-exit">${z("stop airplay")}</slot> 509 `}const yg=i=>{const e=i.mediaIsAirplaying?z("stop airplay"):z("start airplay");
509i.setAttribute("aria-label",e)};class Df extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_IS_AIRPLAYING,T.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),yg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_IS_AIRPLAYING&&yg(this)}get mediaIsAirplaying(){return ve(this,T.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){Ee(this,T.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return Fe(this,T.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){$e(this,T.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){const e=new L.CustomEvent(j.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}Df.getSlotTemplateHTML=Wk;Df.getTooltipContentHTML=Yk;L.customElements.get("media-airplay-button")||L.customElements.define("media-airplay-button",Df);const qk=`<svg aria-hidden="true" viewBox="0 0 26 24"> 510 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 511</svg>`,jk=`<svg aria-hidden="true" viewBox="0 0 26 24"> 512 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/> 513</svg>`;function zk(i){return` 514 <style> 515 :host([aria-checked="true"]) slot[name=off] { 516 display: none !important; 517 } 518 519 520 :host(:not([aria-checked="true"])) slot[name=on] { 521 display: none !important; 522 } 523 524 :host([aria-checked="true"]) slot[name=tooltip-enable], 525 :host(:not([aria-checked="true"])) slot[name=tooltip-disable] { 526 display: none; 527 } 528 </style> 529 530 <slot name="icon"> 531 <slot name="on">${qk}</slot> 532 <slot name="off">${jk}</slot> 533 </slot> 534 `}function Xk(){return` 535 <slot name="tooltip-enable">${z("Enable captions")}</slot> 536 <slot name="tooltip-disable">${z("Disable captions")}</slot> 537 `}const bg=i=>{i.setAttribute("aria-checked",iy(i).toString())};class Cf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_SUBTITLES_LIST,T.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","switch"),this.setAttribute("aria-label",z("closed captions")),bg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_SUBTITLES_SHOWING&&bg(this)}get mediaSubtitlesList(){return Tg(this,T.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){_g(this,T.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Tg(this,T.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){_g(this,T.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new L.CustomEvent(j.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}Cf.getSlotTemplateHTML=zk;Cf.getTooltipContentHTML=Xk;const Tg=(i,e)=>{const t=i.getAttribute(e);return t?qd(t):[]},_g=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const r=Ka(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};L.customElements.get("media-captions-button")||L.customElements.define("media-captions-button",Cf);const Qk='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/></g></svg>',Zk='<svg aria-hidden="true" viewBox="0 0 24 24"><g><path class="cast_caf_icon_arch0" d="M1,18 L1,21 L4,21 C4,19.3 2.66,18 1,18 L1,18 Z"/><path class="cast_caf_icon_arch1" d="M1,14 L1,16 C3.76,16 6,18.2 6,21 L8,21 C8,17.13 4.87,14 1,14 L1,14 Z"/><path class="cast_caf_icon_arch2" d="M1,10 L1,12 C5.97,12 10,16.0 10,21 L12,21 C12,14.92 7.07,10 1,10 L1,10 Z"/><path class="cast_caf_icon_box" d="M21,3 L3,3 C1.9,3 1,3.9 1,5 L1,8 L3,8 L3,5 L21,5 L21,19 L14,19 L14,21 L21,21 C22.1,21 23,20.1 23,19 L23,5 C23,3.9 22.1,3 21,3 L21,3 Z"/><path class="cast_caf_icon_boxfill" d="M5,7 L5,8.63 C8,8.6 13.37,14 13.37,17 L19,17 L19,7 Z"/></g></svg>';function Jk(i){return` 538 <style> 539 :host([${T.MEDIA_IS_CASTING}]) slot[name=icon] slot:not([name=exit]) { 540 display: none !important; 541 } 542 543 544 :host(:not([${T.MEDIA_IS_CASTING}])) slot[name=icon] slot:not([name=enter]) { 545 display: none !important; 546 } 547 548 :host([${T.MEDIA_IS_CASTING}]) slot[name=tooltip-enter], 549 :host(:not([${T.MEDIA_IS_CASTING}])) slot[name=tooltip-exit] { 550 display: none; 551 } 552 </style> 553 554 <slot name="icon"> 555 <slot name="enter">${Qk}</slot> 556 <slot name="exit">${Zk}</slot> 557 </slot> 558 `}function ew(){return` 559 <slot name="tooltip-enter">${z("Start casting")}</slot> 560 <slot name="tooltip-exit">${z("Stop casting")}</slot> 561 `}const Ag=i=>{const e=i.mediaIsCasting?z("stop casting"):z("start casting");i.setAttribute("aria-label",e)};
561class Mf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_IS_CASTING,T.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Ag(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_IS_CASTING&&Ag(this)}get mediaIsCasting(){return ve(this,T.MEDIA_IS_CASTING)}set mediaIsCasting(e){Ee(this,T.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return Fe(this,T.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){$e(this,T.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){const e=this.mediaIsCasting?j.MEDIA_EXIT_CAST_REQUEST:j.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}Mf.getSlotTemplateHTML=Jk;Mf.getTooltipContentHTML=ew;L.customElements.get("media-cast-button")||L.customElements.define("media-cast-button",Mf);var Of=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},vs=(i,e,t)=>(Of(i,e,"read from private field"),e.get(i)),Bi=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Pf=(i,e,t,r)=>(Of(i,e,"write to private field"),e.set(i,t),t),Br=(i,e,t)=>(Of(i,e,"access private method"),t),Ed,Wa,As,dl,jc,zc,cy,Xc,hy,Qc,fy,Zc,my,Jc,py;function tw(i){return` 562 <style> 563 :host { 564 font: var(--media-font, 565 var(--media-font-weight, normal) 566 var(--media-font-size, 14px) / 567 var(--media-text-content-height, var(--media-control-height, 24px)) 568 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 569 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 570 display: var(--media-dialog-display, inline-flex); 571 justify-content: center; 572 align-items: center; 573 574 transition-behavior: allow-discrete; 575 visibility: hidden; 576 opacity: 0; 577 transform: translateY(2px) scale(.99); 578 pointer-events: none; 579 } 580 581 :host([open]) { 582 transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out; 583 visibility: visible; 584 opacity: 1; 585 transform: translateY(0) scale(1); 586 pointer-events: auto; 587 } 588 589 #content { 590 display: flex; 591 position: relative; 592 box-sizing: border-box; 593 width: min(320px, 100%); 594 word-wrap: break-word; 595 max-height: 100%; 596 overflow: auto; 597 text-align: center; 598 line-height: 1.4; 599 } 600 </style> 601 ${this.getSlotTemplateHTML(i)} 602 `}function iw(i){return` 603 <slot id="content"></slot> 604 `}const Vn={OPEN:"open",ANCHOR:"anchor"};class to extends L.HTMLElement{constructor(){super(),Bi(this,dl),Bi(this,zc),Bi(this,Xc),Bi(this,Qc),Bi(this,Zc),Bi(this,Jc),Bi(this,Ed,!1),Bi(this,Wa,null),Bi(this,As,null),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}static get observedAttributes(){return[Vn.OPEN,Vn.ANCHOR]}get open(){return ve(this,Vn.OPEN)}set open(e){Ee(this,Vn.OPEN,e)}
vendor: 6,423 bytes, lines 604-724
604handleEvent(e){switch(e.type){case"invoke":Br(this,Qc,fy).call(this,e);break;case"focusout":Br(this,Zc,my).call(this,e);break;case"keydown":Br(this,Jc,py).call(this,e);break}}connectedCallback(){Br(this,dl,jc).call(this),this.role||(this.role="dialog")}attributeChangedCallback(e,t,r){Br(this,dl,jc).call(this),e===Vn.OPEN&&r!==t&&(this.open?Br(this,zc,cy).call(this):Br(this,Xc,hy).call(this))}focus(){Pf(this,Wa,Af());const e=!this.dispatchEvent(new Event("focus",{composed:!0,cancelable:!0})),t=!this.dispatchEvent(new Event("focusin",{composed:!0,bubbles:!0,cancelable:!0}));if(e||t)return;const r=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');r==null||r.focus()}get keysUsed(){return["Escape","Tab"]}}Ed=new WeakMap;Wa=new WeakMap;As=new WeakMap;dl=new WeakSet;jc=function(){if(!vs(this,Ed)&&(Pf(this,Ed,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);const i=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(i),queueMicrotask(()=>{const{style:e}=Je(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}};zc=new WeakSet;cy=function(){var i;(i=vs(this,As))==null||i.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})};Xc=new WeakSet;hy=function(){var i;(i=vs(this,As))==null||i.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))};Qc=new WeakSet;fy=function(i){Pf(this,As,i.relatedTarget),tr(this,i.relatedTarget)||(this.open=!this.open)};Zc=new WeakSet;my=function(i){var e;tr(this,i.relatedTarget)||((e=vs(this,Wa))==null||e.focus(),vs(this,As)&&vs(this,As)!==i.relatedTarget&&this.open&&(this.open=!1))};Jc=new WeakSet;py=function(i){var e,t,r,s,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;o||l||d||this.keysUsed.includes(a)&&(i.preventDefault(),i.stopPropagation(),a==="Tab"?(i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(s=(r=this.nextElementSibling)==null?void 0:r.focus)==null||s.call(r),this.blur()):a==="Escape"&&((n=vs(this,Wa))==null||n.focus(),this.open=!1))};to.shadowRootOptions={mode:"open"};to.getTemplateHTML=tw;to.getSlotTemplateHTML=iw;L.customElements.get("media-chrome-dialog")||L.customElements.define("media-chrome-dialog",to);var Nf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ge=(i,e,t)=>(Nf(i,e,"read from private field"),t?t.call(i):e.get(i)),pt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},ur=(i,e,t,r)=>(Nf(i,e,"write to private field"),e.set(i,t),t),ei=(i,e,t)=>(Nf(i,e,"access private method"),t),fi,Xd,ul,cl,ti,yd,hl,fl,ml,Uf,gy,pl,eh,gl,th,bd,Ff,ih,vy,rh,Ey,sh,yy,nh,by;function rw(i){return` 605 <style> 606 :host { 607 --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 608 --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px)); 609 610 box-shadow: var(--_focus-visible-box-shadow, none); 611 background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 612 height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding)); 613 display: inline-flex; 614 align-items: center; 615 616 vertical-align: middle; 617 box-sizing: border-box; 618 position: relative; 619 width: 100px; 620 transition: background .15s linear; 621 cursor: var(--media-cursor, pointer); 622 pointer-events: auto; 623 touch-action: none; 624 } 625 626 627 input[type=range]:focus { 628 outline: 0; 629 } 630 input[type=range]:focus::-webkit-slider-runnable-track { 631 outline: 0; 632 } 633 634 :host(:hover) { 635 background: var(--media-control-hover-background, rgb(50 50 70 / .7)); 636 } 637 638 #leftgap { 639 padding-left: var(--media-range-padding-left, var(--_media-range-padding)); 640 } 641 642 #rightgap { 643 padding-right: var(--media-range-padding-right, var(--_media-range-padding)); 644 } 645 646 #startpoint, 647 #endpoint { 648 position: absolute; 649 } 650 651 #endpoint { 652 right: 0; 653 } 654 655 #container { 656 657 width: var(--media-range-track-width, 100%); 658 transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px)); 659 position: relative; 660 height: 100%; 661 display: flex; 662 align-items: center; 663 min-width: 40px; 664 } 665 666 #range { 667 668 display: var(--media-time-range-hover-display, block); 669 bottom: var(--media-time-range-hover-bottom, -7px); 670 height: var(--media-time-range-hover-height, max(100% + 7px, 25px)); 671 width: 100%; 672 position: absolute; 673 cursor: var(--media-cursor, pointer); 674 675 -webkit-appearance: none; 676 -webkit-tap-highlight-color: transparent; 677 background: transparent; 678 margin: 0; 679 z-index: 1; 680 } 681 682 @media (hover: hover) { 683 #range { 684 bottom: var(--media-time-range-hover-bottom, -5px); 685 height: var(--media-time-range-hover-height, max(100% + 5px, 20px)); 686 } 687 } 688 689 690 691 #range::-webkit-slider-thumb { 692 -webkit-appearance: none; 693 background: transparent; 694 width: .1px; 695 height: .1px; 696 } 697 698 699 #range::-moz-range-thumb { 700 background: transparent; 701 border: transparent; 702 width: .1px; 703 height: .1px; 704 } 705 706 #appearance { 707 height: var(--media-range-track-height, 4px); 708 display: flex; 709 flex-direction: column; 710 justify-content: center; 711 width: 100%; 712 position: absolute; 713 714 will-change: transform; 715 } 716 717 #track { 718 background: var(--media-range-track-background, rgb(255 255 255 / .2)); 719 border-radius: var(--media-range-track-border-radius, 1px); 720 border: var(--media-range-track-border, none); 721 outline: var(--media-range-track-outline); 722 outline-offset: var(--media-range-track-outline-offset); 723 backdrop-filter: var(--media-range-track-backdrop-filter); 724 -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
725 box-shadow: var(--media-range-track-box-shadow, none); 726 position: absolute; 727 width: 100%; 728 height: 100%; 729 overflow: hidden; 730 } 731 732 #progress, 733 #pointer { 734 position: absolute; 735 height: 100%; 736 will-change: width; 737 } 738 739 #progress { 740 background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238))); 741 transition: var(--media-range-track-transition); 742 } 743 744 #pointer { 745 background: var(--media-range-track-pointer-background); 746 border-right: var(--media-range-track-pointer-border-right); 747 transition: visibility .25s, opacity .25s; 748 visibility: hidden; 749 opacity: 0; 750 } 751 752 @media (hover: hover) { 753 :host(:hover) #pointer { 754 transition: visibility .5s, opacity .5s; 755 visibility: visible; 756 opacity: 1; 757 } 758 } 759 760 #thumb, 761 ::slotted([slot=thumb]) { 762 width: var(--media-range-thumb-width, 10px); 763 height: var(--media-range-thumb-height, 10px); 764 transition: var(--media-range-thumb-transition); 765 transform: var(--media-range-thumb-transform, none); 766 opacity: var(--media-range-thumb-opacity, 1); 767 translate: -50%; 768 position: absolute; 769 left: 0; 770 cursor: var(--media-cursor, pointer); 771 } 772 773 #thumb { 774 border-radius: var(--media-range-thumb-border-radius, 10px); 775 background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238))); 776 box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent); 777 border: var(--media-range-thumb-border, none); 778 } 779 780 :host([disabled]) #thumb { 781 background-color: #777; 782 } 783 784 .segments #appearance { 785 height: var(--media-range-segment-hover-height, 7px); 786 } 787 788 #track { 789 clip-path: url(#segments-clipping); 790 } 791 792 #segments { 793 --segments-gap: var(--media-range-segments-gap, 2px); 794 position: absolute; 795 width: 100%; 796 height: 100%; 797 } 798 799 #segments-clipping { 800 transform: translateX(calc(var(--segments-gap) / 2)); 801 } 802 803 #segments-clipping:empty { 804 display: none; 805 } 806 807 #segments-clipping rect { 808 height: var(--media-range-track-height, 4px); 809 y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2); 810 transition: var(--media-range-segment-transition, transform .1s ease-in-out); 811 transform: var(--media-range-segment-transform, scaleY(1)); 812 transform-origin: center; 813 } 814 </style> 815 <div id="leftgap"></div> 816 <div id="container"> 817 <div id="startpoint"></div> 818 <div id="endpoint"></div> 819 <div id="appearance"> 820 <div id="track" part="track"> 821 <div id="pointer"></div> 822 <div id="progress" part="progress"></div> 823 </div> 824 <slot name="thumb"> 825 <div id="thumb" part="thumb"></div> 826 </slot> 827 <svg id="segments"><clipPath id="segments-clipping"></clipPath></svg> 828 </div>
829 <input id="range" type="range" min="0" max="1" step="any" value="0"> 830 </div> 831 <div id="rightgap"></div> 832 `}class Pn extends L.HTMLElement{constructor(){if(super(),pt(this,Uf),pt(this,pl),pt(this,gl),pt(this,bd),pt(this,ih),pt(this,rh),pt(this,sh),pt(this,nh),pt(this,fi,void 0),pt(this,Xd,void 0),pt(this,ul,void 0),pt(this,cl,void 0),pt(this,ti,{}),pt(this,yd,[]),pt(this,hl,()=>{if(this.range.matches(":focus-visible")){const{style:e}=Je(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-shadow)")}}),pt(this,fl,()=>{const{style:e}=Je(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),pt(this,ml,()=>{const e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),ur(this,ul,this.shadowRoot.querySelector("#startpoint")),ur(this,cl,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}static get observedAttributes(){return["disabled","aria-disabled",Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Te.MEDIA_CONTROLLER?(t&&((n=(s=Ge(this,fi))==null?void 0:s.unassociateElement)==null||n.call(s,this),ur(this,fi,null)),r&&this.isConnected&&(ur(this,fi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=Ge(this,fi))==null?void 0:o.associateElement)==null||l.call(o,this))):(e==="disabled"||e==="aria-disabled"&&t!==r)&&(r==null?(this.range.removeAttribute(e),ei(this,pl,eh).call(this)):(this.range.setAttribute(e,r),ei(this,gl,th).call(this)))}connectedCallback(){var e,t,r;const{style:s}=Je(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`),Ge(this,ti).pointer=Je(this.shadowRoot,"#pointer"),Ge(this,ti).progress=Je(this.shadowRoot,"#progress"),Ge(this,ti).thumb=Je(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),Ge(this,ti).activeSegment=Je(this.shadowRoot,"#segments-clipping rect:nth-child(0)");const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(ur(this,fi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(r=(t=Ge(this,fi))==null?void 0:t.associateElement)==null||r.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",Ge(this,hl)),this.shadowRoot.addEventListener("focusout",Ge(this,fl)),ei(this,pl,eh).call(this),In(this.container,Ge(this,ml))}disconnectedCallback(){var e,t;ei(this,gl,th).call(this),(t=(e=Ge(this,fi))==null?void 0:e.unassociateElement)==null||t.call(e,this),ur(this,fi,null),this.shadowRoot.removeEventListener("focusin",Ge(this,hl)),this.shadowRoot.removeEventListener("focusout",Ge(this,fl)),kn(this.container,Ge(this,ml))}updatePointerBar(e){var t;(t=Ge(this,ti).pointer)==null||t.style.setProperty("width",`${this.getPointerRatio(e)*100}%`)}updateBar(){var e,t;const r=this.range.valueAsNumber*100;(e=Ge(this,ti).progress)==null||e.style.setProperty("width",`${r}%`),(t=Ge(this,ti).thumb)==null||t.style.setProperty("left",`${r}%`)}updateSegments(e){const t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!(e!=null&&e.length)),!(e!=null&&e.length))return;const r=[...new Set([+this.range.min,...e.flatMap(n=>[n.start,n.end]),+this.range.max])];ur(this,yd,[...r]);const s=r.pop();for(const[n,a]of r.entries()){const[o,l]=[n===0,n===r.length-1],d=o?"calc(var(--segments-gap) / -1)":`${a*100}%`,c=`calc(${((l?s:r[n+1])-a)*100}%${o||l?"":" - var(--segments-gap)"})`,h=at.createElementNS("http://www.w3.org/2000/svg","rect"),f=Je(this.shadowRoot,`#segments-clipping rect:nth-child(${n+1})`);f.style.setProperty("x",d),f.style.setProperty("width",c),t.append(h)}}getPointerRatio(e){return ZI(e.clientX,e.clientY,Ge(this,ul).getBoundingClientRect(),Ge(this,cl).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}
vendor: 6,228 bytes, lines 832-890
832handleEvent(e){switch(e.type){case"pointermove":ei(this,nh,by).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":ei(this,ih,vy).call(this,e);break;case"pointerdown":ei(this,bd,Ff).call(this,e);break;case"pointerup":ei(this,rh,Ey).call(this);break;case"pointerleave":ei(this,sh,yy).call(this);break}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}}fi=new WeakMap;Xd=new WeakMap;ul=new WeakMap;cl=new WeakMap;ti=new WeakMap;yd=new WeakMap;hl=new WeakMap;fl=new WeakMap;ml=new WeakMap;Uf=new WeakSet;gy=function(i){const e=Ge(this,ti).activeSegment;if(!e)return;const t=this.getPointerRatio(i),s=`#segments-clipping rect:nth-child(${Ge(this,yd).findIndex((n,a,o)=>{const l=o[a+1];return l!=null&&t>=n&&t<=l})+1})`;(e.selectorText!=s||!e.style.transform)&&(e.selectorText=s,e.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))};pl=new WeakSet;eh=function(){this.hasAttribute("disabled")||(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))};gl=new WeakSet;th=function(){var i,e;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),(i=L.window)==null||i.removeEventListener("pointerup",this),(e=L.window)==null||e.removeEventListener("pointermove",this)};bd=new WeakSet;Ff=function(i){var e;ur(this,Xd,i.composedPath().includes(this.range)),(e=L.window)==null||e.addEventListener("pointerup",this)};ih=new WeakSet;vy=function(i){var e;i.pointerType!=="mouse"&&ei(this,bd,Ff).call(this,i),this.addEventListener("pointerleave",this),(e=L.window)==null||e.addEventListener("pointermove",this)};rh=new WeakSet;Ey=function(){var i;(i=L.window)==null||i.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")};sh=new WeakSet;yy=function(){var i,e;this.removeEventListener("pointerleave",this),(i=L.window)==null||i.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),(e=Ge(this,ti).activeSegment)==null||e.style.removeProperty("transform")};nh=new WeakSet;by=function(i){this.toggleAttribute("dragging",i.buttons===1||i.pointerType!=="mouse"),this.updatePointerBar(i),ei(this,Uf,gy).call(this,i),this.dragging&&(i.pointerType!=="mouse"||!Ge(this,Xd))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(i),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0})))};Pn.shadowRootOptions={mode:"open"};Pn.getTemplateHTML=rw;L.customElements.get("media-chrome-range")||L.customElements.define("media-chrome-range",Pn);var Ty=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},So=(i,e,t)=>(Ty(i,e,"read from private field"),t?t.call(i):e.get(i)),sw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},xo=(i,e,t,r)=>(Ty(i,e,"write to private field"),e.set(i,t),t),mi;function nw(i){return` 833 <style> 834 :host { 835 836 box-sizing: border-box; 837 display: var(--media-control-display, var(--media-control-bar-display, inline-flex)); 838 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 839 --media-loading-indicator-icon-height: 44px; 840 } 841 842 ::slotted(media-time-range), 843 ::slotted(media-volume-range) { 844 min-height: 100%; 845 } 846 847 ::slotted(media-time-range), 848 ::slotted(media-clip-selector) { 849 flex-grow: 1; 850 } 851 852 ::slotted([role="menu"]) { 853 position: absolute; 854 } 855 </style> 856 857 <slot></slot> 858 `}class $f extends L.HTMLElement{constructor(){if(super(),sw(this,mi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(s=So(this,mi))==null?void 0:s.unassociateElement)==null||n.call(s,this),xo(this,mi,null)),r&&this.isConnected&&(xo(this,mi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=So(this,mi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,r;const s=this.getAttribute(Te.MEDIA_CONTROLLER);s&&(xo(this,mi,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(r=(t=So(this,mi))==null?void 0:t.associateElement)==null||r.call(t,this))}disconnectedCallback(){var e,t;(t=(e=So(this,mi))==null?void 0:e.unassociateElement)==null||t.call(e,this),xo(this,mi,null)}}mi=new WeakMap;$f.shadowRootOptions={mode:"open"};$f.getTemplateHTML=nw;L.customElements.get("media-control-bar")||L.customElements.define("media-control-bar",$f);var _y=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Ro=(i,e,t)=>(_y(i,e,"read from private field"),t?t.call(i):e.get(i)),aw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Lo=(i,e,t,r)=>(_y(i,e,"write to private field"),e.set(i,t),t),pi;function ow(i,e={}){return` 859 <style> 860 :host { 861 font: var(--media-font, 862 var(--media-font-weight, normal) 863 var(--media-font-size, 14px) / 864 var(--media-text-content-height, var(--media-control-height, 24px)) 865 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 866 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 867 background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)))); 868 padding: var(--media-control-padding, 10px); 869 display: inline-flex; 870 justify-content: center; 871 align-items: center; 872 vertical-align: middle; 873 box-sizing: border-box; 874 text-align: center; 875 pointer-events: auto; 876 } 877 878 879 :host(:focus-visible) { 880 box-shadow: inset 0 0 0 2px rgb(27 127 204 / .9); 881 outline: 0; 882 } 883 884 885 :host(:where(:focus)) { 886 box-shadow: none; 887 outline: 0; 888 } 889 </style> 890
891 ${this.getSlotTemplateHTML(i,e)} 892 `}function lw(i,e){return` 893 <slot></slot> 894 `}class Ur extends L.HTMLElement{constructor(){if(super(),aw(this,pi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Te.MEDIA_CONTROLLER&&(t&&((n=(s=Ro(this,pi))==null?void 0:s.unassociateElement)==null||n.call(s,this),Lo(this,pi,null)),r&&this.isConnected&&(Lo(this,pi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=Ro(this,pi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,r;const{style:s}=Je(this.shadowRoot,":host");s.setProperty("display",`var(--media-control-display, var(--${this.localName}-display, inline-flex))`);const n=this.getAttribute(Te.MEDIA_CONTROLLER);n&&(Lo(this,pi,(e=this.getRootNode())==null?void 0:e.getElementById(n)),(r=(t=Ro(this,pi))==null?void 0:t.associateElement)==null||r.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Ro(this,pi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Lo(this,pi,null)}}pi=new WeakMap;Ur.shadowRootOptions={mode:"open"};Ur.getTemplateHTML=ow;Ur.getSlotTemplateHTML=lw;L.customElements.get("media-text-display")||L.customElements.define("media-text-display",Ur);var Ay=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Sg=(i,e,t)=>(Ay(i,e,"read from private field"),t?t.call(i):e.get(i)),dw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},uw=(i,e,t,r)=>(Ay(i,e,"write to private field"),e.set(i,t),t),ha;function cw(i,e){return` 895 <slot>${Pr(e.mediaDuration)}</slot> 896 `}class Sy extends Ur{constructor(){var e;super(),dw(this,ha,void 0),uw(this,ha,this.shadowRoot.querySelector("slot")),Sg(this,ha).textContent=Pr((e=this.mediaDuration)!=null?e:0)}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_DURATION]}attributeChangedCallback(e,t,r){e===T.MEDIA_DURATION&&(Sg(this,ha).textContent=Pr(+r)),super.attributeChangedCallback(e,t,r)}get mediaDuration(){return Ue(this,T.MEDIA_DURATION)}set mediaDuration(e){Ye(this,T.MEDIA_DURATION,e)}}ha=new WeakMap;Sy.getSlotTemplateHTML=cw;L.customElements.get("media-duration-display")||L.customElements.define("media-duration-display",Sy);const hw={2:z("Network Error"),3:z("Decode Error"),4:z("Source Not Supported"),5:z("Encryption
896Error")},fw={2:z("A network error caused the media download to fail."),3:z("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:z("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:z("The media is encrypted and there are no keys to decrypt it.")},xy=i=>{var e,t;return i.code===1?null:{title:(e=hw[i.code])!=null?e:`Error ${i.code}`,message:(t=fw[i.code])!=null?t:i.message}};var Ry=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},mw=(i,e,t)=>(Ry(i,e,"read from private field"),t?t.call(i):e.get(i)),pw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},gw=(i,e,t,r)=>(Ry(i,e,"write to private field"),e.set(i,t),t),vl;function vw(i){return` 897 <style> 898 :host { 899 background: rgb(20 20 30 / .8); 900 } 901 902 #content { 903 display: block; 904 padding: 1.2em 1.5em; 905 } 906 907 h3, 908 p { 909 margin-block: 0 .3em; 910 } 911 </style> 912 <slot name="error-${i.mediaerrorcode}" id="content"> 913 ${Ly({code:+i.mediaerrorcode,message:i.mediaerrormessage})} 914 </slot> 915 `}function Ew(i){return i.code&&xy(i)!==null}function Ly(i){var e;const{title:t,message:r}=(e=xy(i))!=null?e:{};let s="";return t&&(s+=`<slot name="error-${i.code}-title"><h3>${t}</h3></slot>`),r&&(s+=`<slot name="error-${i.code}-message"><p>${r}</p></slot>`),s}const xg=[T.MEDIA_ERROR_CODE,T.MEDIA_ERROR_MESSAGE];class Qd extends to{constructor(){super(...arguments),pw(this,vl,null)}static get observedAttributes(){return[...super.observedAttributes,...xg]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,r){var s;if(super.attributeChangedCallback(e,t,r),!xg.includes(e))return;const n=(s=this.mediaError)!=null?s:{code:this.mediaErrorCode,message:this.mediaErrorMessage};this.open=Ew(n),this.open&&(this.shadowRoot.querySelector("slot").name=`error-${this.mediaErrorCode}`,this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n))}get mediaError(){return mw(this,vl)}set mediaError(e){gw(this,vl,e)}get mediaErrorCode(){return Ue(this,"mediaerrorcode")}set mediaErrorCode(e){Ye(this,"mediaerrorcode",e)}get mediaErrorMessage(){return Fe(this,"mediaerrormessage")}set mediaErrorMessage(e){$e(this,"mediaerrormessage",e)}}vl=new WeakMap;Qd.getSlotTemplateHTML=vw;Qd.formatErrorMessage=Ly;L.customElements.get("media-error-dialog")||L.customElements.define("media-error-dialog",Qd);var Iy=Qd;const yw=`<svg aria-hidden="true" viewBox="0 0 26 24"> 916 <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/> 917</svg>`,bw=`<svg aria-hidden="true" viewBox="0 0 26 24"> 918 <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/> 919</svg>`;function Tw(i){return` 920 <style> 921 :host([${T.MEDIA_IS_FULLSCREEN}]) slot[name=icon] slot:not([name=exit]) { 922 display: none !important; 923 } 924 925 926 :host(:not([${T.MEDIA_IS_FULLSCREEN}])) slot[name=icon] slot:not([name=enter]) { 927 display: none !important; 928 } 929 930 :host([${T.MEDIA_IS_FULLSCREEN}]) slot[name=tooltip-enter], 931 :host(:not([${T.MEDIA_IS_FULLSCREEN}])) slot[name=tooltip-exit] { 932 display: none; 933 } 934 </style> 935 936 <slot name="icon"> 937 <slot name="enter">${yw}</slot> 938 <slot name="exit">${bw}</slot> 939 </slot> 940 `}function _w(){return` 941 <slot name="tooltip-enter">${z("Enter fullscreen mode")}</slot> 942 <slot name="tooltip-exit">${z("Exit fullscreen mode")}</slot> 943 `}const Rg=i=>{const e=i.mediaIsFullscreen?z("exit fullscreen mode"):z("enter fullscreen mode");i.setAttribute("aria-label",e)};class Bf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_IS_FULLSCREEN,T.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Rg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_IS_FULLSCREEN&&Rg(this)}get mediaFullscreenUnavailable(){return Fe(this,T.MEDIA_FULLSCREEN_UNAVAILABLE)}
943set mediaFullscreenUnavailable(e){$e(this,T.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return ve(this,T.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){Ee(this,T.MEDIA_IS_FULLSCREEN,e)}handleClick(){const e=this.mediaIsFullscreen?j.MEDIA_EXIT_FULLSCREEN_REQUEST:j.MEDIA_ENTER_FULLSCREEN_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}Bf.getSlotTemplateHTML=Tw;Bf.getTooltipContentHTML=_w;L.customElements.get("media-fullscreen-button")||L.customElements.define("media-fullscreen-button",Bf);const{MEDIA_TIME_IS_LIVE:El,MEDIA_PAUSED:Ia}=T,{MEDIA_SEEK_TO_LIVE_REQUEST:Aw,MEDIA_PLAY_REQUEST:Sw}=j,xw='<svg viewBox="0 0 6 12"><circle cx="3" cy="6" r="2"></circle></svg>';function Rw(i){return` 944 <style> 945 :host { --media-tooltip-display: none; } 946 947 slot[name=indicator] > *, 948 :host ::slotted([slot=indicator]) { 949 950 min-width: auto; 951 fill: var(--media-live-button-icon-color, rgb(140, 140, 140)); 952 color: var(--media-live-button-icon-color, rgb(140, 140, 140)); 953 } 954 955 :host([${El}]:not([${Ia}])) slot[name=indicator] > *, 956 :host([${El}]:not([${Ia}])) ::slotted([slot=indicator]) { 957 fill: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 958 color: var(--media-live-button-indicator-color, rgb(255, 0, 0)); 959 } 960 961 :host([${El}]:not([${Ia}])) { 962 cursor: var(--media-cursor, not-allowed); 963 } 964 965 slot[name=text]{ 966 text-transform: uppercase; 967 } 968 969 </style> 970 971 <slot name="indicator">${xw}</slot> 972 973 <slot name="spacer"> </slot><slot name="text">${z("live")}</slot> 974 `}const Lg=i=>{const e=i.mediaPaused||!i.mediaTimeIsLive,t=z(e?"seek to live":"playing live");i.setAttribute("aria-label",t),e?i.removeAttribute("aria-disabled"):i.setAttribute("aria-disabled","true")};
974class ky extends Et{static get observedAttributes(){return[...super.observedAttributes,El,Ia]}connectedCallback(){super.connectedCallback(),Lg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),Lg(this)}get mediaPaused(){return ve(this,T.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,T.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return ve(this,T.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){Ee(this,T.MEDIA_TIME_IS_LIVE,e)}handleClick(){!this.mediaPaused&&this.mediaTimeIsLive||(this.dispatchEvent(new L.CustomEvent(Aw,{composed:!0,bubbles:!0})),this.hasAttribute(Ia)&&this.dispatchEvent(new L.CustomEvent(Sw,{composed:!0,bubbles:!0})))}}ky.getSlotTemplateHTML=Rw;L.customElements.get("media-live-button")||L.customElements.define("media-live-button",ky);var wy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Wn=(i,e,t)=>(wy(i,e,"read from private field"),t?t.call(i):e.get(i)),Ig=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Yn=(i,e,t,r)=>(wy(i,e,"write to private field"),e.set(i,t),t),gi,yl;const Io={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"},Dy=500,Lw=` 975<svg aria-hidden="true" viewBox="0 0 100 100"> 976 <path d="M73,50c0-12.7-10.3-23-23-23S27,37.3,27,50 M30.9,50c0-10.5,8.5-19.1,19.1-19.1S69.1,39.5,69.1,50"> 977 <animateTransform 978 attributeName="transform" 979 attributeType="XML" 980 type="rotate" 981 dur="1s" 982 from="0 50 50" 983 to="360 50 50" 984 repeatCount="indefinite" /> 985 </path> 986</svg> 987`;function Iw(i){return` 988 <style> 989 :host { 990 display: var(--media-control-display, var(--media-loading-indicator-display, inline-block)); 991 vertical-align: middle; 992 box-sizing: border-box; 993 --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ${Dy}ms); 994 } 995 996 #status { 997 color: rgba(0,0,0,0); 998 width: 0px; 999 height: 0px; 1000 } 1001 1002 :host slot[name=icon] > *, 1003 :host ::slotted([slot=icon]) { 1004 opacity: var(--media-loading-indicator-opacity, 0); 1005 transition: opacity 0.15s; 1006 } 1007 1008 :host([${T.MEDIA_LOADING}]:not([${T.MEDIA_PAUSED}])) slot[name=icon] > *, 1009 :host([${T.MEDIA_LOADING}]:not([${T.MEDIA_PAUSED}])) ::slotted([slot=icon]) { 1010 opacity: var(--media-loading-indicator-opacity, 1); 1011 transition: opacity 0.15s var(--_loading-indicator-delay); 1012 } 1013 1014 :host #status { 1015 visibility: var(--media-loading-indicator-opacity, hidden); 1016 transition: visibility 0.15s; 1017 } 1018 1019 :host([${T.MEDIA_LOADING}]:not([${T.MEDIA_PAUSED}])) #status { 1020 visibility: var(--media-loading-indicator-opacity, visible); 1021 transition: visibility 0.15s var(--_loading-indicator-delay); 1022 } 1023 1024 svg, img, ::slotted(svg), ::slotted(img) { 1025 width: var(--media-loading-indicator-icon-width); 1026 height: var(--media-loading-indicator-icon-height, 100px); 1027 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1028 vertical-align: middle; 1029 } 1030 </style> 1031 1032 <slot name="icon">${Lw}</slot> 1033 <div id="status" role="status" aria-live="polite">${z("media loading")}</div> 1034 `}class Hf extends L.HTMLElement{constructor(){if(super(),Ig(this,gi,void 0),Ig(this,yl,Dy),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,T.MEDIA_PAUSED,T.MEDIA_LOADING,Io.LOADING_DELAY]}attributeChangedCallback(e,t,r){var s,n,a,o,l;e===Io.LOADING_DELAY&&t!==r?this.loadingDelay=Number(r):e===Te.MEDIA_CONTROLLER&&(t&&((n=(s=Wn(this,gi))==null?void 0:s.unassociateElement)==null||n.call(s,this),Yn(this,gi,null)),r&&this.isConnected&&(Yn(this,gi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=Wn(this,gi))==null?void 0:o.associateElement)==null||l.call(o,this)))}connectedCallback(){var e,t,r;const s=this.getAttribute(Te.MEDIA_CONTROLLER);s&&(Yn(this,gi,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(r=(t=Wn(this,gi))==null?void 0:t.associateElement)==null||r.call(t,this))}disconnectedCallback(){var e,t;(t=(e=Wn(this,gi))==null?void 0:e.unassociateElement)==null||t.call(e,this),Yn(this,gi,null)}get loadingDelay(){return Wn(this,yl)}set loadingDelay(e){Yn(this,yl,e);const{style:t}=Je(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay",`var(--media-loading-indicator-transition-delay, ${e}ms)`)}get mediaPaused(){return ve(this,T.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,T.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,T.MEDIA_LOADING)}set mediaLoading(e){Ee(this,T.MEDIA_LOADING,e)}get mediaController(){return Fe(this,Te.MEDIA_CONTROLLER)}set mediaController(e){$e(this,Te.MEDIA_CONTROLLER,e)}get noAutohide(){return ve(this,Io.NO_AUTOHIDE)}set noAutohide(e){Ee(this,Io.NO_AUTOHIDE,e)}}gi=new WeakMap;yl=new WeakMap;Hf.shadowRootOptions={mode:"open"};Hf.getTemplateHTML=Iw;L.customElements.get("media-loading-indicator")||L.customElements.define("media-loading-indicator",Hf);const kw=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1035 <path d="M16.5 12A4.5 4.5 0 0 0 14 8v2.18l2.45 2.45a4.22 4.22 0 0 0 .05-.63Zm2.5 0a6.84 6.84 0 0 1-.54 2.64L20 16.15A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12ZM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A6.92 6.92 0 0 1 14 18.7v2.06A9 9 0 0 0 17.69 19l2 2.05L21 19.73l-9-9L4.27 3ZM12 4 9.91 6.09 12 8.18V4Z"/> 1036</svg>`,kg=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1037 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4Z"/> 1038</svg>`,ww=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1039 <path d="M3 9v6h4l5 5V4L7 9H3Zm13.5 3A4.5 4.5 0 0 0 14 8v8a4.47 4.47 0 0 0 2.5-4ZM14 3.23v2.06a7 7 0 0 1 0 13.42v2.06a9 9 0 0 0 0-17.54Z"/> 1040</svg>`;function Dw(i){return` 1041 <style> 1042 :host(:not([${T.MEDIA_VOLUME_LEVEL}])) slot[name=icon] slot:not([name=high]), 1043 :host([${T.MEDIA_VOLUME_LEVEL}=high]) slot[name=icon] slot:not([name=high]) { 1044 display: none !important; 1045 } 1046 1047 :host([${T.MEDIA_VOLUME_LEVEL}=off]) slot[name=icon] slot:not([name=off]) { 1048 display: none !important; 1049 } 1050 1051 :host([${T.MEDIA_VOLUME_LEVEL}=low]) slot[name=icon] slot:not([name=low]) { 1052 display: none !important; 1053 } 1054 1055 :host([${T.MEDIA_VOLUME_LEVEL}=medium]) slot[name=icon] slot:not([name=medium]) { 1056 display: none !important; 1057 } 1058 1059 :host(:not([${T.MEDIA_VOLUME_LEVEL}=off])) slot[name=tooltip-unmute], 1060 :host([${T.MEDIA_VOLUME_LEVEL}=off]) slot[name=tooltip-mute] { 1061 display: none; 1062 } 1063 </style> 1064 1065 <slot name="icon"> 1066 <slot name="off">${kw}</slot> 1067 <slot name="low">${kg}</slot> 1068 <slot name="medium">${kg}</slot> 1069 <slot name="high">${ww}</slot> 1070 </slot> 1071 `}function Cw(){return` 1072 <slot name="tooltip-mute">${z("Mute")}</slot> 1073 <slot name="tooltip-unmute">${z("Unmute")}</slot> 1074 `}const wg=i=>{const e=i.mediaVolumeLevel==="off",t=z(e?"unmute":"mute");i.setAttribute("aria-label",t)};
1074class Gf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),wg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_VOLUME_LEVEL&&wg(this)}get mediaVolumeLevel(){return Fe(this,T.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){$e(this,T.MEDIA_VOLUME_LEVEL,e)}handleClick(){const e=this.mediaVolumeLevel==="off"?j.MEDIA_UNMUTE_REQUEST:j.MEDIA_MUTE_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}Gf.getSlotTemplateHTML=Dw;Gf.getTooltipContentHTML=Cw;L.customElements.get("media-mute-button")||L.customElements.define("media-mute-button",Gf);const Dg=`<svg aria-hidden="true" viewBox="0 0 28 24"> 1075 <path d="M24 3H4a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h20a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1Zm-1 16H5V5h18v14Zm-3-8h-7v5h7v-5Z"/> 1076</svg>`;function Mw(i){return` 1077 <style> 1078 :host([${T.MEDIA_IS_PIP}]) slot[name=icon] slot:not([name=exit]) { 1079 display: none !important; 1080 } 1081 1082 :host(:not([${T.MEDIA_IS_PIP}])) slot[name=icon] slot:not([name=enter]) { 1083 display: none !important; 1084 } 1085 1086 :host([${T.MEDIA_IS_PIP}]) slot[name=tooltip-enter], 1087 :host(:not([${T.MEDIA_IS_PIP}])) slot[name=tooltip-exit] { 1088 display: none; 1089 } 1090 </style> 1091 1092 <slot name="icon"> 1093 <slot name="enter">${Dg}</slot> 1094 <slot name="exit">${Dg}</slot> 1095 </slot> 1096 `}function Ow(){return` 1097 <slot name="tooltip-enter">${z("Enter picture in picture mode")}</slot> 1098 <slot name="tooltip-exit">${z("Exit picture in picture mode")}</slot> 1099 `}const Cg=i=>{const e=i.mediaIsPip?z("exit picture in picture mode"):z("enter picture in picture mode");i.setAttribute("aria-label",e)};class Kf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_IS_PIP,T.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),Cg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_IS_PIP&&Cg(this)}get mediaPipUnavailable(){return Fe(this,T.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){$e(this,T.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return ve(this,T.MEDIA_IS_PIP)}set mediaIsPip(e){Ee(this,T.MEDIA_IS_PIP,e)}handleClick(){const e=this.mediaIsPip?j.MEDIA_EXIT_PIP_REQUEST:j.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}Kf.getSlotTemplateHTML=Mw;Kf.getTooltipContentHTML=Ow;L.customElements.get("media-pip-button")||L.customElements.define("media-pip-button",Kf);var Pw=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Os=(i,e,t)=>(Pw(i,e,"read from private field"),t?t.call(i):e.get(i)),Nw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},cr;const $u={RATES:"rates"},Cy=[1,1.2,1.5,1.7,2],ln=1;function Uw(i){return` 1100 <style> 1101 :host { 1102 min-width: 5ch; 1103 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1104 } 1105 </style> 1106 <slot name="icon">${i.mediaplaybackrate||ln}x</slot> 1107 `}function Fw(){return z("Playback rate")}class Vf extends Et{constructor(){var e;super(),Nw(this,cr,new Rf(this,$u.RATES,{defaultValue:Cy})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:ln}x`}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PLAYBACK_RATE,$u.RATES]}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),e===$u.RATES&&(Os(this,cr).value=r),e===T.MEDIA_PLAYBACK_RATE){const s=r?+r:Number.NaN,n=Number.isNaN(s)?ln:s;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",z("Playback rate {playbackRate}",{playbackRate:n}))}}get rates(){return Os(this,cr)}set rates(e){e?Array.isArray(e)?Os(this,cr).value=e.join(" "):typeof e=="string"&&(Os(this,cr).value=e):Os(this,cr).value=""}get mediaPlaybackRate(){return Ue(this,T.MEDIA_PLAYBACK_RATE,ln)}set mediaPlaybackRate(e){Ye(this,T.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;const r=Array.from(Os(this,cr).values(),a=>+a).sort((a,o)=>a-o),s=(t=(e=r.find(a=>a>this.mediaPlaybackRate))!=null?e:r[0])!=null?t:ln,n=new L.CustomEvent(j.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:s});this.dispatchEvent(n)}}cr=new WeakMap;Vf.getSlotTemplateHTML=Uw;Vf.getTooltipContentHTML=Fw;L.customElements.get("media-playback-rate-button")||L.customElements.define("media-playback-rate-button",Vf);const $w=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1108 <path d="m6 21 15-9L6 3v18Z"/> 1109</svg>`,Bw=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1110 <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/> 1111</svg>`;function Hw(i){return` 1112 <style> 1113 :host([${T.MEDIA_PAUSED}]) slot[name=pause], 1114 :host(:not([${T.MEDIA_PAUSED}])) slot[name=play] { 1115 display: none !important; 1116 } 1117 1118 :host([${T.MEDIA_PAUSED}]) slot[name=tooltip-pause], 1119 :host(:not([${T.MEDIA_PAUSED}
1119])) slot[name=tooltip-play] { 1120 display: none; 1121 } 1122 </style> 1123 1124 <slot name="icon"> 1125 <slot name="play">${$w}</slot> 1126 <slot name="pause">${Bw}</slot> 1127 </slot> 1128 `}function Gw(){return` 1129 <slot name="tooltip-play">${z("Play")}</slot> 1130 <slot name="tooltip-pause">${z("Pause")}</slot> 1131 `}const Mg=i=>{const e=i.mediaPaused?z("play"):z("pause");i.setAttribute("aria-label",e)};class Wf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PAUSED,T.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),Mg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_PAUSED&&Mg(this)}get mediaPaused(){return ve(this,T.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,T.MEDIA_PAUSED,e)}handleClick(){const e=this.mediaPaused?j.MEDIA_PLAY_REQUEST:j.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new L.CustomEvent(e,{composed:!0,bubbles:!0}))}}Wf.getSlotTemplateHTML=Hw;Wf.getTooltipContentHTML=Gw;L.customElements.get("media-play-button")||L.customElements.define("media-play-button",Wf);const li={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};function Kw(i){return` 1132 <style> 1133 :host { 1134 pointer-events: none; 1135 display: var(--media-poster-image-display, inline-block); 1136 box-sizing: border-box; 1137 } 1138 1139 img { 1140 max-width: 100%; 1141 max-height: 100%; 1142 min-width: 100%; 1143 min-height: 100%; 1144 background-repeat: no-repeat; 1145 background-position: var(--media-poster-image-background-position, var(--media-object-position, center)); 1146 background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain)); 1147 object-fit: var(--media-object-fit, contain); 1148 object-position: var(--media-object-position, center); 1149 } 1150 </style> 1151 1152 <img part="poster img" aria-hidden="true" id="image"/> 1153 `}const Vw=i=>{i.style.removeProperty("background-image")},Ww=(i,e)=>{i.style["background-image"]=`url('${e}')`};class Yf extends L.HTMLElement{static get observedAttributes(){return[li.PLACEHOLDER_SRC,li.SRC]}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}attributeChangedCallback(e,t,r){e===li.SRC&&(r==null?this.image.removeAttribute(li.SRC):this.image.setAttribute(li.SRC,r)),e===li.PLACEHOLDER_SRC&&(r==null?Vw(this.image):Ww(this.image,r))}get placeholderSrc(){return Fe(this,li.PLACEHOLDER_SRC)}set placeholderSrc(e){$e(this,li.SRC,e)}get src(){return Fe(this,li.SRC)}set src(e){$e(this,li.SRC,e)}}Yf.shadowRootOptions={mode:"open"};Yf.getTemplateHTML=Kw;L.customElements.get("media-poster-image")||L.customElements.define("media-poster-image",Yf);var My=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Yw=(i,e,t)=>(My(i,e,"read from private field"),t?t.call(i):e.get(i)),qw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},jw=(i,e,t,r)=>(My(i,e,"write to private field"),e.set(i,t),t),bl;class zw extends Ur{constructor(){super(),qw(this,bl,void 0),jw(this,bl,this.shadowRoot.querySelector("slot"))}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PREVIEW_CHAPTER]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_PREVIEW_CHAPTER&&r!==t&&r!=null&&(Yw(this,bl).textContent=r,r!==""?this.setAttribute("aria-valuetext",`chapter: ${r}`):this.removeAttribute("aria-valuetext"))}get mediaPreviewChapter(){return Fe(this,T.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){$e(this,T.MEDIA_PREVIEW_CHAPTER,e)}}bl=new WeakMap;L.customElements.get("media-preview-chapter-display")||L.customElements.define("media-preview-chapter-display",zw);var Oy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ko=(i,e,t)=>(Oy(i,e,"read from private field"),t?t.call(i):e.get(i)),Xw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},wo=(i,e,t,r)=>(Oy(i,e,"write to private field"),e.set(i,t),t),vi;function Qw(i){return` 1154 <style> 1155 :host { 1156 box-sizing: border-box; 1157 display: var(--media-control-display, var(--media-preview-thumbn
1157ail-display, inline-block)); 1158 overflow: hidden; 1159 } 1160 1161 img { 1162 display: none; 1163 position: relative; 1164 } 1165 </style> 1166 <img crossorigin loading="eager" decoding="async"> 1167 `}class Zd extends L.HTMLElement{constructor(){if(super(),Xw(this,vi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}static get observedAttributes(){return[Te.MEDIA_CONTROLLER,T.MEDIA_PREVIEW_IMAGE,T.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,r;const s=this.getAttribute(Te.MEDIA_CONTROLLER);s&&(wo(this,vi,(e=this.getRootNode())==null?void 0:e.getElementById(s)),(r=(t=ko(this,vi))==null?void 0:t.associateElement)==null||r.call(t,this))}disconnectedCallback(){var e,t;(t=(e=ko(this,vi))==null?void 0:e.unassociateElement)==null||t.call(e,this),wo(this,vi,null)}attributeChangedCallback(e,t,r){var s,n,a,o,l;[T.MEDIA_PREVIEW_IMAGE,T.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===Te.MEDIA_CONTROLLER&&(t&&((n=(s=ko(this,vi))==null?void 0:s.unassociateElement)==null||n.call(s,this),wo(this,vi,null)),r&&this.isConnected&&(wo(this,vi,(a=this.getRootNode())==null?void 0:a.getElementById(r)),(l=(o=ko(this,vi))==null?void 0:o.associateElement)==null||l.call(o,this)))}get mediaPreviewImage(){return Fe(this,T.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){$e(this,T.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){const e=this.getAttribute(T.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(t=>+t)}set mediaPreviewCoords(e){if(!e){this.removeAttribute(T.MEDIA_PREVIEW_COORDS);return}this.setAttribute(T.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){const e=this.mediaPreviewCoords,t=this.mediaPreviewImage;if(!(e&&t))return;const[r,s,n,a]=e,o=t.split("#")[0],l=getComputedStyle(this),{maxWidth:d,maxHeight:u,minWidth:c,minHeight:h}=l,f=Math.min(parseInt(d)/n,parseInt(u)/a),m=Math.max(parseInt(c)/n,parseInt(h)/a),p=f<1,g=p?f:m>1?m:1,{style:v}=Je(this.shadowRoot,":host"),b=Je(this.shadowRoot,"img").style,y=this.shadowRoot.querySelector("img"),A=p?"min":"max";v.setProperty(`${A}-width`,"initial","important"),v.setProperty(`${A}-height`,"initial","important"),v.width=`${n*g}px`,v.height=`${a*g}px`;const _=()=>{b.width=`${this.imgWidth*g}px`,b.height=`${this.imgHeight*g}px`,b.display="block"};y.src!==o&&(y.onload=()=>{this.imgWidth=y.naturalWidth,this.imgHeight=y.naturalHeight,_()},y.src=o,_()),_(),b.transform=`translate(-${r*g}px, -${s*g}px)`}}vi=new WeakMap;Zd.shadowRootOptions={mode:"open"};Zd.getTemplateHTML=Qw;L.customElements.get("media-preview-thumbnail")||L.customElements.define("media-preview-thumbnail",Zd);var Og=Zd,Py=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Pg=(i,e,t)=>(Py(i,e,"read from private field"),t?t.call(i):e.get(i)),Zw=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Jw=(i,e,t,r)=>(Py(i,e,"write to private field"),e.set(i,t),t),fa;class eD extends Ur{constructor(){super(),Zw(this,fa,void 0),Jw(this,fa,this.shadowRoot.querySelector("slot")),Pg(this,fa).textContent=Pr(0)}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_PREVIEW_TIME&&r!=null&&(Pg(this,fa).textContent=Pr(parseFloat(r)))}get mediaPreviewTime(){return Ue(this,T.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,T.MEDIA_PREVIEW_TIME,e)}}fa=new WeakMap;L.customElements.get("media-preview-time-display")||L.customElements.define("media-preview-time-display",eD);const Ps={SEEK_OFFSET:"seekoffset"},Bu=30,tD=i=>` 1168 <svg aria-hidden="true" viewBox="0 0 20 24"> 1169 <defs> 1170 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1171 </defs> 1172 <text class="text value" transform="translate(2.18 19.87)">${i}</text> 1173 <path d="M10 6V3L4.37 7 10 10.94V8a5.54 5.54 0 0 1 1.9 10.48v2.12A7.5 7.5 0 0 0 10 6Z"/> 1174 </svg>`;function iD(i,e){return` 1175 <slot name="icon">${tD(e.seekOffset)}</slot> 1176 `}function rD(){return z("Seek backward")}const sD=0;
1176class qf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_CURRENT_TIME,Ps.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Ue(this,Ps.SEEK_OFFSET,Bu)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===Ps.SEEK_OFFSET&&(this.seekOffset=Ue(this,Ps.SEEK_OFFSET,Bu))}get seekOffset(){return Ue(this,Ps.SEEK_OFFSET,Bu)}set seekOffset(e){Ye(this,Ps.SEEK_OFFSET,e),this.setAttribute("aria-label",z("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),KE(VE(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Ue(this,T.MEDIA_CURRENT_TIME,sD)}set mediaCurrentTime(e){Ye(this,T.MEDIA_CURRENT_TIME,e)}handleClick(){const e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new L.CustomEvent(j.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}qf.getSlotTemplateHTML=iD;qf.getTooltipContentHTML=rD;L.customElements.get("media-seek-backward-button")||L.customElements.define("media-seek-backward-button",qf);const Ns={SEEK_OFFSET:"seekoffset"},Hu=30,nD=i=>` 1177 <svg aria-hidden="true" viewBox="0 0 20 24"> 1178 <defs> 1179 <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style> 1180 </defs> 1181 <text class="text value" transform="translate(8.9 19.87)">${i}</text> 1182 <path d="M10 6V3l5.61 4L10 10.94V8a5.54 5.54 0 0 0-1.9 10.48v2.12A7.5 7.5 0 0 1 10 6Z"/> 1183 </svg>`;function aD(i,e){return` 1184 <slot name="icon">${nD(e.seekOffset)}</slot> 1185 `}function oD(){return z("Seek forward")}const lD=0;class jf extends Et{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_CURRENT_TIME,Ns.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=Ue(this,Ns.SEEK_OFFSET,Hu)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===Ns.SEEK_OFFSET&&(this.seekOffset=Ue(this,Ns.SEEK_OFFSET,Hu))}get seekOffset(){return Ue(this,Ns.SEEK_OFFSET,Hu)}set seekOffset(e){Ye(this,Ns.SEEK_OFFSET,e),this.setAttribute("aria-label",z("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),KE(VE(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return Ue(this,T.MEDIA_CURRENT_TIME,lD)}set mediaCurrentTime(e){Ye(this,T.MEDIA_CURRENT_TIME,e)}handleClick(){const e=this.mediaCurrentTime+this.seekOffset,t=new L.CustomEvent(j.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}jf.getSlotTemplateHTML=aD;jf.getTooltipContentHTML=oD;L.customElements.get("media-seek-forward-button")||L.customElements.define("media-seek-forward-button",jf);var Ny=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},Gu=(i,e,t)=>(Ny(i,e,"read from private field"),t?t.call(i):e.get(i)),dD=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},uD=(i,e,t,r)=>(Ny(i,e,"write to private field"),e.set(i,t),t),Ws;const zr={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},Ng=[...Object.values(zr),T.MEDIA_CURRENT_TIME,T.MEDIA_DURATION,T.MEDIA_SEEKABLE],Ug=["Enter"," "],cD=" / ",ah=(i,{timesSep:e=cD}={})=>{var t,r;const s=(t=i.mediaCurrentTime)!=null?t:0,[,n]=(r=i.mediaSeekable)!=null?r:[];let a=0;Number.isFinite(i.mediaDuration)?a=i.mediaDuration:Number.isFinite(n)&&(a=n);const o=i.remaining?Pr(0-(a-s)):Pr(s);return i.showDuration?`${o}${e}${Pr(a)}`:o},hD="video not loaded, unknown time.",fD=i=>{var e;const t=i.mediaCurrentTime,[,r]=(e=i.mediaSeekable)!=null?e:[];let s=null;if(Number.isFinite(i.mediaDuration)?s=i.mediaDuration:Number.isFinite(r)&&(s=r),t==null||s===null){i.setAttribute("aria-valuetext",hD);return}const n=i.remaining?Ra(0-(s-t)):Ra(t);if(!i.showDuration){i.setAttribute("aria-valuetext",n);return}const a=Ra(s),o=`${n} of ${a}`;i.setAttribute("aria-valuetext",o)};function mD(i,e){return` 1186 <slot>${ah(e)}</slot> 1187 `}class Uy extends Ur{constructor(){super(),dD(this,Ws,void 0),uD(this,Ws,this.shadowRoot.querySelector("slot")),Gu(this,Ws).innerHTML=`${ah(this)}`}static get observedAttributes(){return[...super.observedAttributes,...Ng,"disabled"]}connectedCallback(){const{style:e}=Je(this.shadowRoot,":host(:hover:not([notoggle]))");e.setProperty("cursor","var(--media-cursor, pointer)"),e.setProperty("background","var(--media-control-hover-background, rgba(50 50 70 / .7))"),this.hasAttribute("disabled")||this.enable(),this.setAttribute("role","progressbar"),this.setAttribute("aria-label",z("playback time"));const t=r=>{const{key:s}=r;if(!Ug.includes(s)){this.removeEventListener("keyup",t);return}this.toggleTimeDisplay()};this.addEventListener("keydown",r=>{const{metaKey:s,altKey:n,key:a}=r;if(s||n||!Ug.includes(a)){this.removeEventListener("keyup",t);return}this.addEventListener("keyup",t)}),this.addEventListener("click",this.toggleTimeDisplay),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),super.disconnectedCallback()}attributeChangedCallback(e,t,r){Ng.includes(e)?this.update():e==="disabled"&&r!==t&&(r==null?this.enable():this.disable()),super.attributeChangedCallback(e,t,r)}enable(){this.tabIndex=0}disable(){this.tabIndex=-1}get remaining(){return ve(this,zr.REMAINING)}set remaining(e){Ee(this,zr.REMAINING,e)}get showDuration(){return ve(this,zr.SHOW_DURATION)}set showDuration(e){Ee(this,zr.SHOW_DURATION,e)}get noToggle(){return ve(this,zr.NO_TOGGLE)}set noToggle(e){Ee(this,zr.NO_TOGGLE,e)}get mediaDuration(){return Ue(this,T.MEDIA_DURATION)}set mediaDuration(e){Ye(this,T.MEDIA_DURATION,e)}get mediaCurrentTime(){return Ue(this,T.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,T.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){const e=this.getAttribute(T.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(T.MEDIA_SEEKABLE);return}this.setAttribute(T.MEDIA_SEEKABLE,e.join(":"))}update(){const e=ah(this);fD(this),e!==Gu(this,Ws).innerHTML&&(Gu(this,Ws).innerHTML=e)}}Ws=new WeakMap;Uy.getSlotTemplateHTML=mD;L.customElements.get("media-time-display")||L.customElements.define("media-time-display",Uy);var Fy=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ut=(i,e,t)=>(Fy(i,e,"read from private field"),e.get(i)),di=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Dt=(i,e,t,r)=>(Fy(i,e,"write to private field"),e.set(i,t),t),pD=(i,e,t,r)=>({set _(s){Dt(i,e,s)},get _(){return ut(i,e)}}),Ys,Tl,qs,ma,_l,Al,Sl,js,Xr,xl;class gD{constructor(e,t,r){di(this,Ys,void 0),di(this,Tl,void 0),di(this,qs,void 0),di(this,ma,void 0),di(this,_l,void 0),di(this,Al,void 0),di(this,Sl,void 0),di(this,js,void 0),di(this,Xr,0),di(this,xl,(s=performance.now())=>{Dt(this,Xr,requestAnimationFrame(ut(this,xl))),Dt(this,ma,performance.now()-ut(this,qs));const n=1e3/this.fps;if(ut(this,ma)>n){Dt(this,qs,s-ut(this,ma)%n);const a=1e3/((s-ut(this,Tl))/++pD(this,_l)._),o=(s-ut(this,Al))/1e3/this.duration;let l=ut(this,Sl)+o*this.playbackRate;l-ut(this,Ys).valueAsNumber>0?Dt(this,js,this.playbackRate/this.duration/a):(Dt(this,js,.995*ut(this,js)),l=ut(this,Ys).valueAsNumber+ut(this,js)),this.callback(l)}}),Dt(this,Ys,e),this.callback=t,this.fps=r}start(){ut(this,Xr)===0&&(Dt(this,qs,performance.now()),Dt(this,Tl,ut(this,qs)),Dt(this,_l,0),ut(this,xl).call(this))}stop(){ut(this,Xr)!==0&&(cancelAnimationFrame(ut(this,Xr)),Dt(this,Xr,0))}update({start:e,duration:t,playbackRate:r}){const s=e-ut(this,Ys).valueAsNumber,n=Math.abs(t-this.duration);(s>0||s<-.03||n>=.5)&&this.callback(e),Dt(this,Sl,e),Dt(this,Al,performance.now()),this.duration=t,this.playbackRate=r}}Ys=new WeakMap;Tl=new WeakMap;qs=new WeakMap;ma=new WeakMap;_l=new WeakMap;Al=new WeakMap;Sl=new WeakMap;js=new WeakMap;Xr=new WeakMap;xl=new WeakMap;var zf=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},nt=(i,e,t)=>(zf(i,e,"read from private field"),t?t.call(i):e.get(i)),dt=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ei=(i,e,t,r)=>(zf(i,e,"write to private field"),e.set(i,t),t),Tt=(i,e,t)=>(zf(i,e,"access private method"),t),zs,Es,Td,ka,_d,Rl,Ya,qa,Xs,Qs,pa,Xf,$y,oh,Ad,Qf,Sd,Zf,xd,Jf,lh,By,ja,Rd,dh,Hy;const vD="video not loaded, unknown time.",ED=i=>{const e=i.range,t=Ra(+Gy(i)),r=Ra(+i.mediaSeekableEnd),s=t&&r?`${t} of ${r}`:vD;e.setAttribute("aria-valuetext",s)};function yD(i){return` 1188 ${Pn.getTemplateHTML(i)} 1189 <style> 1190 :host { 1191 --media-box-border-radius: 4px; 1192 --media-box-padding-left: 10px; 1193 --media-box-padding-right: 10px; 1194 --media-preview-border-radius: var(--media-box-border-radius); 1195 --media-box-arrow-offset: var(--media-box-border-radius); 1196 --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))); 1197 --_preview-background: var(--media-preview-background, var(--_control-background)); 1198 1199 1200 contain: layout; 1201 } 1202 1203 #buffered { 1204 background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4)); 1205 position: absolute; 1206 height: 100%; 1207 will-change: width; 1208 } 1209 1210 #preview-rail, 1211 #current-rail { 1212 width: 100%; 1213 position: absolute; 1214 left: 0; 1215 bottom: 100%; 1216 pointer-events: none; 1217 will-change: transform; 1218 } 1219 1220 [part~="box"] { 1221 width: min-content; 1222 1223 position: absolute; 1224 bottom: 100%; 1225 flex-direction: column; 1226 align-items: center; 1227 transform: translateX(-50%); 1228 } 1229 1230 [part~="current-box"] { 1231 display: var(--media-current-box-display, var(--media-box-display, flex)); 1232 margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px)); 1233 visibility: hidden; 1234 } 1235 1236 [part~="preview-box"] { 1237 display: var(--media-preview-box-display, var(--media-box-display, flex)); 1238 margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px)); 1239 transition-property: var(--media-preview-transition-property, visibility, opacity); 1240 transition-duration: var(--media-preview-transition-duration-out, .25s); 1241 transition-delay: var(--media-preview-transition-delay-out, 0s); 1242 visibility: hidden; 1243 opacity: 0; 1244 } 1245 1246 :host(:is([${T.MEDIA_PREVIEW_IMAGE}], [${T.MEDIA_PREVIEW_TIME}])[dragging]) [part~="preview-box"] { 1247 transition-duration: var(--media-preview-transition-duration-in, .5s); 1248 transition-delay: var(--media-preview-transition-delay-in, .25s); 1249 visibility: visible; 1250 opacity: 1; 1251 } 1252 1253 @media (hover: hover) { 1254 :host(:is([${T.MEDIA_PREVIEW_IMAGE}], [${T.MEDIA_PREVIEW_TIME}]):hover) [part~="preview-box"] { 1255 transition-duration: var(--media-preview-transition-duration-in, .5s); 1256 transition-delay: var(--media-preview-transition-delay-in, .25s); 1257 visibility: visible; 1258 opacity: 1; 1259 } 1260 } 1261
1262 media-preview-thumbnail, 1263 ::slotted(media-preview-thumbnail) { 1264 visibility: hidden; 1265 1266 transition: visibility 0s .25s; 1267 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1268 background: var(--media-preview-thumbnail-background, var(--_preview-background)); 1269 box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2)); 1270 max-width: var(--media-preview-thumbnail-max-width, 180px); 1271 max-height: var(--media-preview-thumbnail-max-height, 160px); 1272 min-width: var(--media-preview-thumbnail-min-width, 120px); 1273 min-height: var(--media-preview-thumbnail-min-height, 80px); 1274 border: var(--media-preview-thumbnail-border); 1275 border-radius: var(--media-preview-thumbnail-border-radius, 1276 var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0); 1277 } 1278 1279 :host([${T.MEDIA_PREVIEW_IMAGE}][dragging]) media-preview-thumbnail, 1280 :host([${T.MEDIA_PREVIEW_IMAGE}][dragging]) ::slotted(media-preview-thumbnail) { 1281 transition-delay: var(--media-preview-transition-delay-in, .25s); 1282 visibility: visible; 1283 } 1284 1285 @media (hover: hover) { 1286 :host([${T.MEDIA_PREVIEW_IMAGE}]:hover) media-preview-thumbnail, 1287 :host([${T.MEDIA_PREVIEW_IMAGE}]:hover) ::slotted(media-preview-thumbnail) { 1288 transition-delay: var(--media-preview-transition-delay-in, .25s); 1289 visibility: visible; 1290 } 1291 1292 :host([${T.MEDIA_PREVIEW_TIME}]:hover) { 1293 --media-time-range-hover-display: block; 1294 } 1295 } 1296 1297 media-preview-chapter-display, 1298 ::slotted(media-preview-chapter-display) { 1299 font-size: var(--media-font-size, 13px); 1300 line-height: 17px; 1301 min-width: 0; 1302 visibility: hidden; 1303 1304 transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s; 1305 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1306 background: var(--media-preview-chapter-background, var(--_preview-background)); 1307 border-radius: var(--media-preview-chapter-border-radius, 1308 var(--media-preview-border-radius) var(--media-preview-border-radius) 1309 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1310 padding: var(--media-preview-chapter-padding, 3.5px 9px); 1311 margin: var(--media-preview-chapter-margin, 0 0 5px); 1312 text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1313 } 1314 1315 :host([${T.MEDIA_PREVIEW_IMAGE}]) media-preview-chapter-display, 1316 :host([${T.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-chapter-display) { 1317 transition-delay: var(--media-preview-transition-delay-in, .25s); 1318 border-radius: var(--media-preview-chapter-border-radius, 0); 1319 padding: var(--media-preview-chapter-padding, 3.5px 9px 0); 1320 margin: var(--media-preview-chapter-margin, 0); 1321 min-width: 100%; 1322 } 1323 1324 media-preview-chapter-display[${T.MEDIA_PREVIEW_CHAPTER}], 1325 ::slotted(media-preview-chapter-display[${T.MEDIA_PREVIEW_CHAPTER}]) { 1326 visibility: visible; 1327 } 1328 1329 media-preview-chapter-display:not([aria-valuetext]), 1330 ::slotted(media-preview-chapter-display:not([aria-valuetext])) { 1331 display: none; 1332 } 1333 1334 media-preview-time-display, 1335 ::slotted(media-preview-time-display), 1336 media-time-display, 1337 ::slotted(media-time-display) { 1338 font-size: var(--media-font-size, 13px); 1339 line-height: 17px; 1340 min-width: 0; 1341 1342 transition: min-width 0s, border-radius 0s; 1343 transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s)); 1344 background: var(--media-preview-time-background, var(--_preview-background)); 1345 border-radius: var(--media-preview-time-border-radius, 1346 var(--media-preview-border-radius) var(--media-preview-border-radius) 1347 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1348 padding: var(--media-preview-time-padding, 3.5px 9px); 1349 margin: var(--media-preview-time-margin, 0); 1350 text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75)); 1351 transform: translateX(min( 1352 max(calc(50% - var(--_box-width) / 2), 1353 calc(var(--_box-shift, 0))), 1354 calc(var(--_box-width) / 2 - 50%) 1355 )); 1356 } 1357 1358 :host([${T.MEDIA_PREVIEW_IMAGE}]) media-preview-time-display, 1359 :host([${T.MEDIA_PREVIEW_IMAGE}]) ::slotted(media-preview-time-display) { 1360 transition-delay: var(--media-preview-transition-delay-in, .25s); 1361 border-radius: var(--media-preview-time-border-radius, 1362 0 0 var(--media-preview-border-radius) var(--media-preview-border-radius)); 1363 min-width: 100%; 1364 } 1365 1366 :host([${T.MEDIA_PREVIEW_TIME}]:hover) { 1367 --media-time-range-hover-display: block; 1368 } 1369 1370 [part~="arrow"], 1371 ::slotted([part~="arrow"]) { 1372 display: var(--media-box-arrow-display, inline-block); 1373 transform: translateX(min( 1374 max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)), 1375 calc(var(--_box-shift, 0))), 1376 calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset)) 1377 )); 1378 1379 border-color: transparent; 1380 border-top-color: var(--media-box-arrow-background, var(--_control-background)); 1381 border-width: var(--media-box-arrow-border-width, 1382 var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0); 1383 border-style: solid; 1384 justify-content: center; 1385 height: 0; 1386 } 1387 </style> 1388 <div id="preview-rail"> 1389 <slot name="preview" part="box preview-box">
1390 <media-preview-thumbnail> 1391 <template shadowrootmode="${Og.shadowRootOptions.mode}"> 1392 ${Og.getTemplateHTML({})} 1393 </template> 1394 </media-preview-thumbnail> 1395 <media-preview-chapter-display></media-preview-chapter-display> 1396 <media-preview-time-display></media-preview-time-display> 1397 <slot name="preview-arrow"><div part="arrow"></div></slot> 1398 </slot> 1399 </div> 1400 <div id="current-rail"> 1401 <slot name="current" part="box current-box"> 1402 1403 </slot> 1404 </div> 1405 `}const Do=(i,e=i.mediaCurrentTime)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,r=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;if(Number.isNaN(r))return 0;const s=(e-t)/(r-t);return Math.max(0,Math.min(s,1))},Gy=(i,e=i.range.valueAsNumber)=>{const t=Number.isFinite(i.mediaSeekableStart)?i.mediaSeekableStart:0,r=Number.isFinite(i.mediaDuration)?i.mediaDuration:i.mediaSeekableEnd;return Number.isNaN(r)?0:e*(r-t)+t};class em extends Pn{constructor(){super(),dt(this,Qs),dt(this,Xf),dt(this,Ad),dt(this,Sd),dt(this,xd),dt(this,lh),dt(this,ja),dt(this,dh),dt(this,zs,void 0),dt(this,Es,void 0),dt(this,Td,void 0),dt(this,ka,void 0),dt(this,_d,void 0),dt(this,Rl,void 0),dt(this,Ya,void 0),dt(this,qa,void 0),dt(this,Xs,void 0),dt(this,oh,r=>{this.dragging||(Tf(r)&&(this.range.valueAsNumber=r),this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),Ei(this,Td,this.shadowRoot.querySelectorAll('[part~="box"]')),Ei(this,_d,this.shadowRoot.querySelector('[part~="preview-box"]')),Ei(this,Rl,this.shadowRoot.querySelector('[part~="current-box"]'));const t=getComputedStyle(this);Ei(this,Ya,parseInt(t.getPropertyValue("--media-box-padding-left"))),Ei(this,qa,parseInt(t.getPropertyValue("--media-box-padding-right"))),Ei(this,Es,new gD(this.range,nt(this,oh),60))}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PAUSED,T.MEDIA_DURATION,T.MEDIA_SEEKABLE,T.MEDIA_CURRENT_TIME,T.MEDIA_PREVIEW_IMAGE,T.MEDIA_PREVIEW_TIME,T.MEDIA_PREVIEW_CHAPTER,T.MEDIA_BUFFERED,T.MEDIA_PLAYBACK_RATE,T.MEDIA_LOADING,T.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",z("seek")),Tt(this,Qs,pa).call(this),Ei(this,zs,this.getRootNode()),(e=nt(this,zs))==null||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),Tt(this,Qs,pa).call(this),(e=nt(this,zs))==null||e.removeEventListener("transitionstart",this),Ei(this,zs,null)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),t!=r&&(e===T.MEDIA_CURRENT_TIME||e===T.MEDIA_PAUSED||e===T.MEDIA_ENDED||e===T.MEDIA_LOADING||e===T.MEDIA_DURATION||e===T.MEDIA_SEEKABLE?(nt(this,Es).update({start:Do(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),Tt(this,Qs,pa).call(this),ED(this)):e===T.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===T.MEDIA_DURATION||e===T.MEDIA_SEEKABLE)&&(this.mediaChaptersCues=nt(this,Xs),this.updateBar()))}get mediaChaptersCues(){return nt(this,Xs)}set mediaChaptersCues(e){var t;Ei(this,Xs,e),this.updateSegments((t=nt(this,Xs))==null?void 0:t.map(r=>({start:Do(this,r.startTime),end:Do(this,r.endTime)})))}get mediaPaused(){return ve(this,T.MEDIA_PAUSED)}set mediaPaused(e){Ee(this,T.MEDIA_PAUSED,e)}get mediaLoading(){return ve(this,T.MEDIA_LOADING)}set mediaLoading(e){Ee(this,T.MEDIA_LOADING,e)}get mediaDuration(){return Ue(this,T.MEDIA_DURATION)}set mediaDuration(e){Ye(this,T.MEDIA_DURATION,e)}get mediaCurrentTime(){return Ue(this,T.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){Ye(this,T.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return Ue(this,T.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){Ye(this,T.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){const e=this.getAttribute(T.MEDIA_BUFFERED);return e?e.split(" ").map(t=>t.split(":").map(r=>+r)):[]}set mediaBuffered(e){if(!e){this.removeAttribute(T.MEDIA_BUFFERED);return}const t=e.map(r=>r.join(":")).join(" ");this.setAttribute(T.MEDIA_BUFFERED,t)}get mediaSeekable(){const e=this.getAttribute(T.MEDIA_SEEKABLE);if(e)return e.split(":").map(t=>+t)}set mediaSeekable(e){if(e==null){this.removeAttribute(T.MEDIA_SEEKABLE);return}this.setAttribute(T.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;const[,t=this.mediaDuration]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaSeekableStart(){var e;const[t=0]=(e=this.mediaSeekable)!=null?e:[];return t}get mediaPreviewImage(){return Fe(this,T.MEDIA_PREVIEW_IMAGE)}
1405set mediaPreviewImage(e){$e(this,T.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return Ue(this,T.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){Ye(this,T.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return ve(this,T.MEDIA_ENDED)}set mediaEnded(e){Ee(this,T.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;const t=this.mediaBuffered;if(!t.length)return;let r;if(this.mediaEnded)r=1;else{const n=this.mediaCurrentTime,[,a=this.mediaSeekableStart]=(e=t.find(([o,l])=>o<=n&&n<=l))!=null?e:[];r=Do(this,a)}const{style:s}=Je(this.shadowRoot,"#buffered");s.setProperty("width",`${r*100}%`)}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;const t=Je(this.shadowRoot,"#current-rail"),r=Je(this.shadowRoot,'[part~="current-box"]'),s=Tt(this,Ad,Qf).call(this,nt(this,Rl)),n=Tt(this,Sd,Zf).call(this,s,this.range.valueAsNumber),a=Tt(this,xd,Jf).call(this,s,this.range.valueAsNumber);t.style.transform=`translateX(${n})`,t.style.setProperty("--_range-width",`${s.range.width}`),r.style.setProperty("--_box-shift",`${a}`),r.style.setProperty("--_box-width",`${s.box.width}px`),r.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":Tt(this,dh,Hy).call(this);break;case"pointermove":Tt(this,lh,By).call(this,e);break;case"pointerup":case"pointerleave":Tt(this,ja,Rd).call(this,null);break;case"transitionstart":tr(e.target,this)&&setTimeout(()=>Tt(this,Qs,pa).call(this),0);break}}}zs=new WeakMap;Es=new WeakMap;Td=new WeakMap;ka=new WeakMap;_d=new WeakMap;Rl=new WeakMap;Ya=new WeakMap;qa=new WeakMap;Xs=new WeakMap;Qs=new WeakSet;pa=function(){Tt(this,Xf,$y).call(this)?nt(this,Es).start():nt(this,Es).stop()};Xf=new WeakSet;$y=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&WE(this)};oh=new WeakMap;Ad=new WeakSet;Qf=function(i){var e;const r=((e=this.getAttribute("bounds")?On(this,`#${this.getAttribute("bounds")}`):this.parentElement)!=null?e:this).getBoundingClientRect(),s=this.range.getBoundingClientRect(),n=i.offsetWidth,a=-(s.left-r.left-n/2),o=r.right-s.left-n/2;return{box:{width:n,min:a,max:o},bounds:r,range:s}};Sd=new WeakSet;Zf=function(i,e){let t=`${e*100}%`;const{width:r,min:s,max:n}=i.box;if(!r)return t;if(Number.isNaN(s)||(t=`max(${`calc(1 / var(--_range-width) * 100 * ${s}% + var(--media-box-padding-left))`}, ${t})`),!Number.isNaN(n)){const o=`calc(1 / var(--_range-width) * 100 * ${n}% - var(--media-box-padding-right))`;t=`min(${t}, ${o})`}return t};xd=new WeakSet;Jf=function(i,e){const{width:t,min:r,max:s}=i.box,n=e*i.range.width;if(n<r+nt(this,Ya)){const a=i.range.left-i.bounds.left-nt(this,Ya);return`${n-t/2+a}px`}if(n>s-nt(this,qa)){const a=i.bounds.right-i.range.right-nt(this,qa);return`${n+t/2-a-i.range.width}px`}return 0};lh=new WeakSet;By=function(i){const e=[...nt(this,Td)].some(u=>i.composedPath().includes(u));if(!this.dragging&&(e||!i.composedPath().includes(this))){Tt(this,ja,Rd).call(this,null);return}const t=this.mediaSeekableEnd;if(!t)return;const r=Je(this.shadowRoot,"#preview-rail"),s=Je(this.shadowRoot,'[part~="preview-box"]'),n=Tt(this,Ad,Qf).call(this,nt(this,_d));let a=(i.clientX-n.range.left)/n.range.width;a=Math.max(0,Math.min(1,a));const o=Tt(this,Sd,Zf).call(this,n,a),l=Tt(this,xd,Jf).call(this,n,a);r.style.transform=`translateX(${o})`,r.style.setProperty("--_range-width",`${n.range.width}`),s.style.setProperty("--_box-shift",`${l}`),s.style.setProperty("--_box-width",`${n.box.width}px`);const d=Math.round(nt(this,ka))-Math.round(a*t);Math.abs(d)<1&&a>.01&&a<.99||(Ei(this,ka,a*t),Tt(this,ja,Rd).call(this,nt(this,ka)))};ja=new WeakSet;Rd=function(i){this.dispatchEvent(new L.CustomEvent(j.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:i}))};dh=new WeakSet;Hy=function(){nt(this,Es).stop();const i=Gy(this);this.dispatchEvent(new L.CustomEvent(j.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:i}))};em.shadowRootOptions={mode:"open"};em.getTemplateHTML=yD;L.customElements.get("media-time-range")||L.customElements.define("media-time-range",em);const bD=1,TD=i=>i.mediaMuted?0:i.mediaVolume,_D=i=>`${Math.round(i*100)}%`;class AD extends Pn{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_VOLUME,T.MEDIA_MUTED,T.MEDIA_VOLUME_UNAVAILABLE]}constructor(){super(),this.range.addEventListener("input",()=>{const e=this.range.value,t=new L.CustomEvent(j.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",z("volume"))}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),
1405(e===T.MEDIA_VOLUME||e===T.MEDIA_MUTED)&&(this.range.valueAsNumber=TD(this),this.range.setAttribute("aria-valuetext",_D(this.range.valueAsNumber)),this.updateBar())}get mediaVolume(){return Ue(this,T.MEDIA_VOLUME,bD)}set mediaVolume(e){Ye(this,T.MEDIA_VOLUME,e)}get mediaMuted(){return ve(this,T.MEDIA_MUTED)}set mediaMuted(e){Ee(this,T.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return Fe(this,T.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){$e(this,T.MEDIA_VOLUME_UNAVAILABLE,e)}}L.customElements.get("media-volume-range")||L.customElements.define("media-volume-range",AD);var Ky=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},he=(i,e,t)=>(Ky(i,e,"read from private field"),t?t.call(i):e.get(i)),Ai=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},zi=(i,e,t,r)=>(Ky(i,e,"write to private field"),e.set(i,t),t),Zs,Ll,Qr,ga,hr,fr,mr,Zr,Js,Il,Zt;const Fg=1,$g=0,SD=1,xD={processCallback(i,e,t){if(t){for(const[r,s]of e)if(r in t){const n=t[r];typeof n=="boolean"&&s instanceof ni&&typeof s.element[s.attributeName]=="boolean"?s.booleanValue=n:typeof n=="function"&&s instanceof ni?s.element[s.attributeName]=n:s.value=n}}}};class Jd extends L.DocumentFragment{constructor(e,t,r=xD){var s;super(),Ai(this,Zs,void 0),Ai(this,Ll,void 0),this.append(e.content.cloneNode(!0)),zi(this,Zs,Vy(this)),zi(this,Ll,r),(s=r.createCallback)==null||s.call(r,this,he(this,Zs),t),r.processCallback(this,he(this,Zs),t)}update(e){he(this,Ll).processCallback(this,he(this,Zs),e)}}Zs=new WeakMap;Ll=new WeakMap;const Vy=(i,e=[])=>{let t,r;for(const s of i.attributes||[])if(s.value.includes("{{")){const n=new LD;for([t,r]of Hg(s.value))if(!t)n.append(r);else{const a=new ni(i,s.name,s.namespaceURI);n.append(a),e.push([r,a])}s.value=n.toString()}for(const s of i.childNodes)if(s.nodeType===Fg&&!(s instanceof HTMLTemplateElement))Vy(s,e);else{const n=s.data;if(s.nodeType===Fg||n.includes("{{")){const a=[];if(n)for([t,r]of Hg(n))if(!t)a.push(new Text(r));else{const o=new Nn(i);a.push(o),e.push([r,o])}else if(s instanceof HTMLTemplateElement){const o=new qy(i,s);a.push(o),e.push([o.expression,o])}s.replaceWith(...a.flatMap(o=>o.replacementNodes||[o]))}}return e},Bg={},Hg=i=>{let e="",t=0,r=Bg[i],s=0,n;if(r)return r;for(r=[];n=i[s];s++)n==="{"&&i[s+1]==="{"&&i[s-1]!=="\\"&&i[s+2]&&++t==1?(e&&r.push([$g,e]),e="",s++):n==="}"&&i[s+1]==="}"&&i[s-1]!=="\\"&&!--t?(r.push([SD,e.trim()]),e="",s++):e+=n||"";return e&&r.push([$g,(t>0?"{{":"")+e]),Bg[i]=r},RD=11;class Wy{get value(){return""}set value(e){}toString(){return this.value}}const Yy=new WeakMap;class LD{constructor(){Ai(this,Qr,[])}[Symbol.iterator](){return he(this,Qr).values()}get length(){return he(this,Qr).length}item(e){return he(this,Qr)[e]}append(...e){for(const t of e)t instanceof ni&&Yy.set(t,this),he(this,Qr).push(t)}toString(){return he(this,Qr).join("")}}Qr=new WeakMap;class ni extends Wy{constructor(e,t,r){super(),Ai(this,Zr),Ai(this,ga,""),Ai(this,hr,void 0),Ai(this,fr,void 0),Ai(this,mr,void 0),zi(this,hr,e),zi(this,fr,t),zi(this,mr,r)}get attributeName(){return he(this,fr)}get attributeNamespace(){return he(this,mr)}get element(){return he(this,hr)}get value(){return he(this,ga)}set value(e){he(this,ga)!==e&&(zi(this,ga,e),!he(this,Zr,Js)||he(this,Zr,Js).length===1?e==null?he(this,hr).removeAttributeNS(he(this,mr),he(this,fr)):he(this,hr).setAttributeNS(he(this,mr),he(this,fr),e):he(this,hr).setAttributeNS(he(this,mr),he(this,fr),he(this,Zr,Js).toString()))}get booleanValue(){return he(this,hr).hasAttributeNS(he(this,mr),he(this,fr))}set booleanValue(e){if(!he(this,Zr,Js)||he(this,Zr,Js).length===1)this.value=e?"":null;else throw new DOMException("Value is not fully templatized")}}ga=new WeakMap;hr=new WeakMap;fr=new WeakMap;mr=new WeakMap;Zr=new WeakSet;Js=function(){return Yy.get(this)};class Nn extends Wy{constructor(e,t){super(),Ai(this,Il,void 0),Ai(this,Zt,void 0),zi(this,Il,e),zi(this,Zt,t?[...t]:[new Text])}get replacementNodes(){return he(this,Zt)}get parentNode(){return he(this,Il)}get nextSibling(){return he(this,Zt)[he(this,Zt).length-1].nextSibling}get previousSibling(){return he(this,Zt)[0].previousSibling}get value(){return he(this,Zt).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(...e){const t=e.flat().flatMap(r=>r==null?[new Text]:r.forEach?[...r]:r.nodeType===RD?[...r.childNodes]:r.no
1405deType?[r]:[new Text(r)]);t.length||t.push(new Text),zi(this,Zt,ID(he(this,Zt)[0].parentNode,he(this,Zt),t,this.nextSibling))}}Il=new WeakMap;Zt=new WeakMap;class qy extends Nn{constructor(e,t){const r=t.getAttribute("directive")||t.getAttribute("type");let s=t.getAttribute("expression")||t.getAttribute(r)||"";s.startsWith("{{")&&(s=s.trim().slice(2,-2).trim()),super(e),this.expression=s,this.template=t,this.directive=r}}function ID(i,e,t,r=null){let s=0,n,a,o,l=t.length,d=e.length;for(;s<l&&s<d&&e[s]==t[s];)s++;for(;s<l&&s<d&&t[l-1]==e[d-1];)r=t[--d,--l];if(s==d)for(;s<l;)i.insertBefore(t[s++],r);if(s==l)for(;s<d;)i.removeChild(e[s++]);else{for(n=e[s];s<l;)o=t[s++],a=n?n.nextSibling:r,n==o?n=a:s<l&&t[s]==a?(i.replaceChild(o,n),n=a):i.insertBefore(o,n);for(;n!=r;)a=n.nextSibling,i.removeChild(n),n=a}return t}const Gg={string:i=>String(i)};class jy{constructor(e){this.template=e,this.state=void 0}}const ls=new WeakMap,ds=new WeakMap,uh={partial:(i,e)=>{e[i.expression]=new jy(i.template)},if:(i,e)=>{var t;if(zy(i.expression,e))if(ls.get(i)!==i.template){ls.set(i,i.template);const r=new Jd(i.template,e,tm);i.replace(r),ds.set(i,r)}else(t=ds.get(i))==null||t.update(e);else i.replace(""),ls.delete(i),ds.delete(i)}},kD=Object.keys(uh),tm={processCallback(i,e,t){var r,s;if(t)for(const[n,a]of e){if(a instanceof qy){if(!a.directive){const l=kD.find(d=>a.template.hasAttribute(d));l&&(a.directive=l,a.expression=a.template.getAttribute(l))}(r=uh[a.directive])==null||r.call(uh,a,t);continue}let o=zy(n,t);if(o instanceof jy){ls.get(a)!==o.template?(ls.set(a,o.template),o=new Jd(o.template,o.state,tm),a.value=o,ds.set(a,o)):(s=ds.get(a))==null||s.update(o.state);continue}o?(a instanceof ni&&a.attributeName.startsWith("aria-")&&(o=String(o)),a instanceof ni?typeof o=="boolean"?a.booleanValue=o:typeof o=="function"?a.element[a.attributeName]=o:a.value=o:(a.value=o,ls.delete(a),ds.delete(a))):a instanceof ni?a.value=void 0:(a.value=void 0,ls.delete(a),ds.delete(a))}}},Kg={"!":i=>!i,"!!":i=>!!i,"==":(i,e)=>i==e,"!=":(i,e)=>i!=e,">":(i,e)=>i>e,">=":(i,e)=>i>=e,"<":(i,e)=>i<e,"<=":(i,e)=>i<=e,"??":(i,e)=>i??e,"|":(i,e)=>{var t;return(t=Gg[e])==null?void 0:t.call(Gg,i)}};function wD(i){return DD(i,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(({type:e})=>e!=="ws")}function zy(i,e={}){var t,r,s,n,a,o,l;const d=wD(i);if(d.length===0||d.some(({type:u})=>!u))return qn(i);if(((t=d[0])==null?void 0:t.token)===">"){const u=e[(r=d[1])==null?void 0:r.token];if(!u)return qn(i);const c={...e};u.state=c;const h=d.slice(2);for(let f=0;f<h.length;f+=3){const m=(s=h[f])==null?void 0:s.token,p=(n=h[f+1])==null?void 0:n.token,g=(a=h[f+2])==null?void 0:a.token;m&&p==="="&&(c[m]=jn(g,e))}return u}if(d.length===1)return Co(d[0])?jn(d[0].token,e):qn(i);if(d.length===2){const u=(o=d[0])==null?void 0:o.token,c=Kg[u];if(!c||!Co(d[1]))return qn(i);const h=jn(d[1].token,e);return c(h)}if(d.length===3){const u=(l=d[1])==null?void 0:l.token,c=Kg[u];if(!c||!Co(d[0])||!Co(d[2]))return qn(i);const h=jn(d[0].token,e);if(u==="|")return c(h,d[2].token);const f=jn(d[2].token,e);return c(h,f)}}function qn(i){return console.warn(`Warning: invalid expression \`${i}\``),!1}function Co({type:i}){return["number","boolean","string","param"].includes(i)}function jn(i,e){const t=i[0],r=i.slice(-1);return i==="true"||i==="false"?i==="true":t===r&&["'",'"'].includes(t)?i.slice(1,-1):PE(i)?parseFloat(i):e[i]}function DD(i,e){let t,r,s;const n=[];for(;i;){s=null,t=i.length;for(const a in e)r=e[a].exec(i),r&&r.index<t&&(s={token:r[0],type:a,matches:r.slice(1)},t=r.index);t&&n.push({token:i.substr(0,t),type:void 0}),s&&n.push(s),i=i.substr(t+(s?s.token.length:0))}return n}var im=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ch=(i,e,t)=>(im(i,e,"read from private field"),t?t.call(i):e.get(i)),zn=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},us=(i,e,t,r)=>(im(i,e,"write to private field"),e.set(i,t),t),Ku=(i,e,t)=>(im(i,e,"access private method"),t),fn,kl,mn,hh,Xy,wl,fh;const Vu={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},Qy=at.createElement("template");Qy.innerHTML=` 1406 <style> 1407 :host { 1408 display: inline-block; 1409 line-height: 0; 1410 } 1411 1412 media-controller { 1413 width: 100%; 1414 height: 100%; 1415 } 1416 1417 media-captions-button:not([mediasubtitleslist]), 1418 media-captions-menu:not([mediasubtitleslist]), 1419 media-captions-menu-button:not([mediasubtitleslist]), 1420 media-audio-track-menu[mediaaudiotrackunavailable], 1421 media-audio-track-menu-button[mediaaudiotrackunavailable], 1422 media-rendition-menu[mediarenditionunavailable], 1423 media-rendition-menu-button[mediarenditionunavailable], 1424 media-volume-range[mediavolumeunavailable], 1425 media-airplay-button[mediaairplayunavailable], 1426 media-fullscreen-button[mediafullscreenunavailable], 1427 media-cast-button[mediacastunavailable], 1428 media-pip-button[mediapipunavailable] { 1429 display: none; 1430 } 1431 </style> 1432`;class eu extends L.HTMLElement{constructor(){super(),zn(this,hh),zn(this,wl),zn(this,fn,void 0),zn(this,kl,void 0),zn(this,mn,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer());const e=new MutationObserver(t=>{var r;this.mediaController&&!((r=this.mediaController)!=null&&r.breakpointsComputed)||t.some(s=>{const n=s.target;return n===this?!0:n.localName!=="media-controller"?!1:!!(Vu[s.attributeName]||s.attributeName.startsWith("breakpoint"))})&&this.render()});e.observe(this,{attributes:!0}),e.observe(this.renderRoot,{attributes:!0,subtree:!0}),this.addEventListener(Ji.BREAKPOINTS_COMPUTED,this.render),Ku(this,hh,Xy).call(this,"template")}get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return(e=ch(this,fn))!=null?e:this.constructor.template}set template(e){us(this,mn,null),us(this,fn,e),this.createRenderer()}get props(){var e,t,r;const s=[...Array.from((t=(e=this.mediaController)==null?void 0:e.attributes)!=null?t:[]).filter(({name:a})=>Vu[a]||a.startsWith("breakpoint")),...Array.from(this.attributes)],n={};for(const a of s){const o=(r=Vu[a.name])!=null?r:WI(a.name);let{value:l}=a;l!=null?(PE(l)&&(l=parseFloat(l)),n[o]=l===""?!0:l):n[o]=!1}return n}attributeChangedCallback(e,t,r){e==="template"&&t!=r&&Ku(this,wl,fh).call(this)}connectedCallback(){Ku(this,wl,fh).call(this)}createRenderer(){this.template&&this.template!==ch(this,kl)&&(us(this,kl,this.template),this.renderer=new Jd(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(Qy.content.cloneNode(!0),this.renderer))}render(){var e;(e=this.renderer)==null||e.update(this.props)}}fn=new WeakMap;kl=new WeakMap;mn=new WeakMap;hh=new WeakSet;Xy=function(i){if(Object.prototype.hasOwnProperty.call(this,i)){const e=this[i];delete this[i],this[i]=e}};wl=new WeakSet;fh=function(){var i;const e=this.getAttribute("template");if(!e||e===ch(this,mn))return;const t=this.getRootNode(),r=(i=t==null?void 0:t.getElementById)==null?void 0:i.call(t,e);if(r){us(this,mn,e),us(this,fn,r),this.createRenderer();return}CD(e)&&(us(this,mn,e),MD(e).then(s=>{const n=at.createElement("template");n.innerHTML=s,us(this,fn,n),this.createRenderer()}).catch(console.error))};eu.observedAttributes=["template"];eu.processor=tm;function CD(i){if(!/^(\/|\.\/|https?:\/\/)/.test(i))return!1;const e=/^https?:\/\//.test(i)?void 0:location.origin;try{new URL(i,e)}catch{return!1}return!0}async function MD(i){const e=await fetch(i);if(e.status!==200)throw new Error(`Failed to load resource: the server responded with a status of ${e.status}`);return e.text()}L.customElements.get("media-theme")||L.customElements.define("media-theme",eu);function OD({anchor:i,floating:e,placement:t}){const r=PD({anchor:i,floating:e}),{x:s,y:n}=UD(r,t);return{x:s,y:n}}function PD({anchor:i,floating:e}){return{anchor:ND(i,e.offsetParent),floating:{x:0,y:0,width:e.offsetWidth,height:e.offsetHeight}}}function ND(i,e){var t;const r=i.getBoundingClientRect(),s=(t=e==null?void 0:e.getBoundingClientRect())!=null?t:{x:0,y:0};return{x:r.x-s.x,y:r.y-s.y,width:r.width,height:r.height}}function UD({anchor:i,floating:e},t){const r=FD(t)==="x"?"y":"x",s=r==="y"?"height":"width",n=Zy(t),a=i.x+i.width/2-e.width/2,o=i.y+i.height/2-e.height/2,l=i[s]/2-e[s]/2;let d;switch(n){case"top":d={x:a,y:i.y-e.height};break;case"bottom":d={x:a,y:i.y+i.height};break;case"right":d={x:i.x+i.width,y:o};break;case"left":d={x:i.x-e.width,y:o};break;default:d={x:i.x,y:i.y}}switch(t.split("-")[1]){case"start":d[r]-=l;break;case"end":d[r]+=l;break}return d}function Zy(i){return i.split("-")[0]}function FD(i){return["top","bottom"].includes(Zy(i))?"y":"x"}
1432class rm extends Event{constructor({action:e="auto",relatedTarget:t,...r}){super("invoke",r),this.action=e,this.relatedTarget=t}}class $D extends Event{constructor({newState:e,oldState:t,...r}){super("toggle",r),this.newState=e,this.oldState=t}}var sm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},be=(i,e,t)=>(sm(i,e,"read from private field"),t?t.call(i):e.get(i)),ke=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},yi=(i,e,t,r)=>(sm(i,e,"write to private field"),e.set(i,t),t),Me=(i,e,t)=>(sm(i,e,"access private method"),t),bi,ys,Nr,Dl,Cl,bs,za,mh,Jy,Ld,Ml,ph,gh,eb,vh,tb,Eh,ib,pn,gn,vn,Xa,Id,nm,yh,rb,am,sb,bh,nb,om,ab,Th,ob,_h,lb,wa,kd,Ah,db,Da,wd,Ol,Sh;function Cn({type:i,text:e,value:t,checked:r}){const s=at.createElement("media-chrome-menu-item");s.type=i,s.part.add("menu-item"),s.part.add(i),s.value=t,s.checked=r;const n=at.createElement("span");return n.textContent=e,s.append(n),s}function Ts(i,e){let t=i.querySelector(`:scope > [slot="${e}"]`);if((t==null?void 0:t.nodeName)=="SLOT"&&(t=t.assignedElements({flatten:!0})[0]),t)return t=t.cloneNode(!0),t;const r=i.shadowRoot.querySelector(`[name="${e}"] > svg`);return r?r.cloneNode(!0):""}function BD(i){return` 1433 <style> 1434 :host { 1435 font: var(--media-font, 1436 var(--media-font-weight, normal) 1437 var(--media-font-size, 14px) / 1438 var(--media-text-content-height, var(--media-control-height, 24px)) 1439 var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif)); 1440 color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238))); 1441 --_menu-bg: rgb(20 20 30 / .8); 1442 background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg)))); 1443 border-radius: var(--media-menu-border-radius); 1444 border: var(--media-menu-border, none); 1445 display: var(--media-menu-display, inline-flex); 1446 transition: var(--media-menu-transition-in, 1447 visibility 0s, 1448 opacity .2s ease-out, 1449 transform .15s ease-out, 1450 left .2s ease-in-out, 1451 min-width .2s ease-in-out, 1452 min-height .2s ease-in-out 1453 ) !important; 1454 1455 visibility: var(--media-menu-visibility, visible); 1456 opacity: var(--media-menu-opacity, 1); 1457 max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px)); 1458 transform: var(--media-menu-transform-in, translateY(0) scale(1)); 1459 flex-direction: column; 1460 1461 min-height: 0; 1462 position: relative; 1463 bottom: var(--_menu-bottom); 1464 box-sizing: border-box; 1465 } 1466 1467 @-moz-document url-prefix() { 1468 :host{ 1469 --_menu-bg: rgb(20 20 30); 1470 } 1471 } 1472 1473 :host([hidden]) { 1474 transition: var(--media-menu-transition-out, 1475 visibility .15s ease-in, 1476 opacity .15s ease-in, 1477 transform .15s ease-in 1478 ) !important; 1479 visibility: var(--media-menu-hidden-visibility, hidden); 1480 opacity: var(--media-menu-hidden-opacity, 0); 1481 max-height: var(--media-menu-hidden-max-height, 1482 var(--media-menu-max-height, var(--_menu-max-height, 300px))); 1483 transform: var(--media-menu-transform-out, translateY(2px) scale(.99)); 1484 pointer-events: none; 1485 } 1486 1487 :host([slot="submenu"]) { 1488 background: none; 1489 width: 100%; 1490 min-height: 100%; 1491 position: absolute; 1492 bottom: 0; 1493 right: -100%; 1494 } 1495 1496 #container { 1497 display: flex; 1498 flex-direction: column; 1499 min-height: 0; 1500 transition: transform .2s ease-out; 1501 transform: translate(0, 0); 1502 } 1503 1504 #container.has-expanded { 1505 transition: transform .2s ease-in; 1506 transform: translate(-100%, 0); 1507 } 1508 1509 button { 1510 background: none; 1511 color: inherit; 1512 border: none; 1513 padding: 0; 1514 font: inherit; 1515 outline: inherit; 1516 display: inline-flex; 1517 align-items: center; 1518 } 1519 1520 slot[name="header"][hidden] { 1521 display: none; 1522 } 1523 1524 slot[name="header"] > *, 1525 slot[name="header"]::slotted(*) { 1526 padding: .4em .7em; 1527 border-bottom: 1px solid rgb(255 255 255 / .25); 1528 cursor: var(--media-cursor, default); 1529 } 1530 1531 slot[name="header"] > button[part~="back"], 1532 slot[name="header"]::slotted(button[part~="back"]) { 1533 cursor: var(--media-cursor, pointer); 1534 } 1535 1536 svg[part~="back"] { 1537 height: var(--media-menu-icon-height, var(--media-control-height, 24px)); 1538 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1539 display: block; 1540 margin-right: .5ch; 1541 } 1542 1543 slot:not([name]) { 1544 gap: var(--media-menu-gap); 1545 flex-direction: var(--media-menu-flex-direction, column); 1546 overflow: var(--media-menu-overflow, hidden auto); 1547 display: flex; 1548 min-height: 0; 1549 } 1550 1551 :host([role="menu"]) slot:not([name]) { 1552 padding-block: .4em; 1553 } 1554 1555 slot:not([name])::slotted([role="menu"]) { 1556 background: none; 1557 } 1558 1559 media-chrome-menu-item > span { 1560 margin-right: .5ch; 1561 max-width: var(--media-menu-item-max-width); 1562 text-overflow: ellipsis; 1563 overflow: hidden; 1564 } 1565 </style> 1566 <style id="layout-row" media="width:0"> 1567 1568 slot[name="header"] > *, 1569 slot[name="header"]::slotted(*) { 1570 padding: .4em .5em; 1571 } 1572 1573 slot:not([name]) { 1574 gap: var(--media-menu-gap, .25em); 1575 flex-direction: var(--media-menu-flex-direction, row); 1576 padding-inline: .5em; 1577 } 1578 1579 media-chrome-menu-item { 1580 padding: .3em .5em; 1581 } 1582 1583 media-chrome-menu-item[aria-checked="true"] { 1584 background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2)); 1585 } 1586 1587 1588 media-chrome-menu-item::part(checked-indicator) { 1589 display: var(--media-menu-item-checked-indicator-display, none); 1590 } 1591 </style> 1592 <div id="container"> 1593 <slot name="header" hidden> 1594 <button part="back button" aria-label="Back to previous menu"> 1595 <slot name="back-icon"> 1596 <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator"> 1597 <path d="m11.88 17.585.742-.669-4.2-4.665 4.2-4.666-.743-.669-4.803 5.335 4.803 5.334Z"/> 1598 </svg> 1599 </slot> 1600 <slot name="title"></slot> 1601 </button> 1602 </slot> 1603 <slot></slot> 1604 </div> 1605 <slot name="checked-indicator" hidden></slot> 1606 `}const Hr={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class Ni extends L.HTMLElement{constructor(){if(super(),ke(this,mh),
vendor: 5,648 bytes, line 1606
1606ke(this,Ml),ke(this,gh),ke(this,vh),ke(this,Eh),ke(this,vn),ke(this,Id),ke(this,yh),ke(this,am),ke(this,bh),ke(this,om),ke(this,Th),ke(this,_h),ke(this,wa),ke(this,Ah),ke(this,Da),ke(this,Ol),ke(this,bi,null),ke(this,ys,null),ke(this,Nr,null),ke(this,Dl,new Set),ke(this,Cl,void 0),ke(this,bs,!1),ke(this,za,null),ke(this,Ld,()=>{const e=be(this,Dl),t=new Set(this.items);for(const r of e)t.has(r)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:r}));for(const r of t)e.has(r)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:r}));yi(this,Dl,t)}),ke(this,pn,()=>{Me(this,vn,Xa).call(this),Me(this,Id,nm).call(this,!1)}),ke(this,gn,()=>{Me(this,vn,Xa).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),this.shadowRoot.addEventListener("slotchange",this),yi(this,Cl,new MutationObserver(be(this,Ld))),be(this,Cl).observe(this.defaultSlot,{childList:!0})}static get observedAttributes(){return[Hr.DISABLED,Hr.HIDDEN,Hr.STYLE,Hr.ANCHOR,Te.MEDIA_CONTROLLER]}static formatMenuItemText(e,t){return e}enable(){this.addEventListener("click",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this),this.addEventListener("invoke",this),this.addEventListener("toggle",this)}disable(){this.removeEventListener("click",this),this.removeEventListener("focusout",this),this.removeEventListener("keyup",this),this.removeEventListener("invoke",this),this.removeEventListener("toggle",this)}handleEvent(e){switch(e.type){case"slotchange":Me(this,mh,Jy).call(this,e);break;case"invoke":Me(this,gh,eb).call(this,e);break;case"click":Me(this,yh,rb).call(this,e);break;case"toggle":Me(this,bh,nb).call(this,e);break;case"focusout":Me(this,Th,ob).call(this,e);break;case"keydown":Me(this,_h,lb).call(this,e);break}}connectedCallback(){var e,t;yi(this,za,YE(this.shadowRoot,":host")),Me(this,Ml,ph).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),yi(this,bi,$c(this)),(t=(e=be(this,bi))==null?void 0:e.associateElement)==null||t.call(e,this),this.hidden||(In(Qa(this),be(this,pn)),In(this,be(this,gn)))}disconnectedCallback(){var e,t;kn(Qa(this),be(this,pn)),kn(this,be(this,gn)),this.disable(),(t=(e=be(this,bi))==null?void 0:e.unassociateElement)==null||t.call(e,this),yi(this,bi,null)}attributeChangedCallback(e,t,r){var s,n,a,o;e===Hr.HIDDEN&&r!==t?(be(this,bs)||yi(this,bs,!0),this.hidden?Me(this,Eh,ib).call(this):Me(this,vh,tb).call(this),this.dispatchEvent(new $D({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===Te.MEDIA_CONTROLLER?(t&&((n=(s=be(this,bi))==null?void 0:s.unassociateElement)==null||n.call(s,this),yi(this,bi,null)),r&&this.isConnected&&(yi(this,bi,$c(this)),(o=(a=be(this,bi))==null?void 0:a.associateElement)==null||o.call(a,this))):e===Hr.DISABLED&&r!==t?r==null?this.enable():this.disable():e===Hr.STYLE&&r!==t&&Me(this,Ml,ph).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor",`${e}`)}get anchorElement(){var e;return this.anchor?(e=Gd(this))==null?void 0:e.querySelector(`#${this.anchor}`):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(HD)}get radioGroupItems(){return this.items.filter(e=>e.role==="menuitemradio")}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return(t=(e=this.checkedItems[0])==null?void 0:e.value)!=null?t:""}set value(e){const t=this.items.find(r=>r.value===e);t&&Me(this,Ol,Sh).call(this,t)}focus(){if(yi(this,ys,Af()),this.items.length){Me(this,Da,wd).call(this,this.items[0]),this.items[0].focus();return}const e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');e==null||e.focus()}handleSelect(e){var t;const r=Me(this,wa,kd).call(this,e);r&&(Me(this,Ol,Sh).call(this,r,r.type==="checkbox"),be(this,Nr)&&!this.hidden&&((t=be(this,ys))==null||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,r;const{key:s}=e,n=this.items,a=(r=(t=Me(this,wa,kd).call(this,e))!=null?t:Me(this,Ah,db).call(this))!=null?r:n[0],o=n.indexOf(a);let l=Math.max(0,o);s==="ArrowDown"?l++:s==="ArrowUp"?l--:e.key==="Home"?l=0:e.key==="End"&&(l=n.length-1),l<0&&(l=n.length-1),l>n.length-1&&(l=0),Me(this,Da,wd).call(this,n[l]),n[l].focus()}}bi=new WeakMap;ys=new WeakMap;Nr=new WeakMap;Dl=new WeakMap;Cl=new WeakMap;bs=new WeakMap;za=new WeakMap;mh=new WeakSet;Jy=function(i){const e=i.target;for(const t of e.assignedNodes({flatten:!0}))t.nodeType===3&&t.textContent.trim()===""&&t.remove();if(["header","title"].includes(e.name)){const t=this.shadowRoot.querySelector('slot[name="header"]');t.hidden=e.assignedNodes().length===0}e.name||be(this,Ld).call(this)};Ld=new WeakMap;Ml=new WeakSet;ph=function(){var i;const e=this.shadowRoot.querySelector("#layout-row"),t=(i=getComputedStyle(this).getPropertyValue("--media-menu-layout"))==null?void 0:i.trim();e.setAttribute("media",t==="row"?"":"width:0")};gh=new WeakSet;eb=function(i){yi(this,Nr,i.relatedTarget),tr(this,i.relatedTarget)||(this.hidden=!this.hidden)};vh=new WeakSet;tb=function(){var i;(i=be(this,Nr))==null||i.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),In(Qa(this),be(this,pn)),In(this,be(this,gn))};Eh=new WeakSet;ib=function(){var i;
vendor: 8,111 bytes, lines 1606-1720
1606(i=be(this,Nr))==null||i.setAttribute("aria-expanded","false"),kn(Qa(this),be(this,pn)),kn(this,be(this,gn))};pn=new WeakMap;gn=new WeakMap;vn=new WeakSet;Xa=function(i){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;const{x:e,y:t}=OD({anchor:this.anchorElement,floating:this,placement:"top-start"});i??(i=this.offsetWidth);const s=Qa(this).getBoundingClientRect(),n=s.width-e-i,a=s.height-t-this.offsetHeight,{style:o}=be(this,za);o.setProperty("position","absolute"),o.setProperty("right",`${Math.max(0,n)}px`),o.setProperty("--_menu-bottom",`${a}px`);const l=getComputedStyle(this),u=o.getPropertyValue("--_menu-bottom")===l.bottom?a:parseFloat(l.bottom),c=s.height-u-parseFloat(l.marginBottom);this.style.setProperty("--_menu-max-height",`${c}px`)};Id=new WeakSet;nm=function(i){const e=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),t=e==null?void 0:e.querySelector('[role="menu"]'),{style:r}=be(this,za);if(i||r.setProperty("--media-menu-transition-in","none"),t){const s=t.offsetHeight,n=Math.max(t.offsetWidth,e.offsetWidth);this.style.setProperty("min-width",`${n}px`),this.style.setProperty("min-height",`${s}px`),Me(this,vn,Xa).call(this,n)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),Me(this,vn,Xa).call(this);r.removeProperty("--media-menu-transition-in")};yh=new WeakSet;rb=function(i){var e;if(i.stopPropagation(),i.composedPath().includes(be(this,am,sb))){(e=be(this,ys))==null||e.focus(),this.hidden=!0;return}const t=Me(this,wa,kd).call(this,i);!t||t.hasAttribute("disabled")||(Me(this,Da,wd).call(this,t),this.handleSelect(i))};am=new WeakSet;sb=function(){var i;return(i=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))==null?void 0:i.find(t=>t.matches('button[part~="back"]'))};bh=new WeakSet;nb=function(i){if(i.target===this)return;Me(this,om,ab).call(this);const e=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(const t of e)t.invokeTargetElement!=i.target&&i.newState=="open"&&t.getAttribute("aria-expanded")=="true"&&!t.invokeTargetElement.hidden&&t.invokeTargetElement.dispatchEvent(new rm({relatedTarget:t}));for(const t of e)t.setAttribute("aria-expanded",`${!t.submenuElement.hidden}`);Me(this,Id,nm).call(this,!0)};om=new WeakSet;ab=function(){const e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)};Th=new WeakSet;ob=function(i){var e;tr(this,i.relatedTarget)||(be(this,bs)&&((e=be(this,ys))==null||e.focus()),be(this,Nr)&&be(this,Nr)!==i.relatedTarget&&!this.hidden&&(this.hidden=!0))};_h=new WeakSet;lb=function(i){var e,t,r,s,n;const{key:a,ctrlKey:o,altKey:l,metaKey:d}=i;if(!(o||l||d)&&this.keysUsed.includes(a))if(i.preventDefault(),i.stopPropagation(),a==="Tab"){if(be(this,bs)){this.hidden=!0;return}i.shiftKey?(t=(e=this.previousElementSibling)==null?void 0:e.focus)==null||t.call(e):(s=(r=this.nextElementSibling)==null?void 0:r.focus)==null||s.call(r),this.blur()}else a==="Escape"?((n=be(this,ys))==null||n.focus(),be(this,bs)&&(this.hidden=!0)):a==="Enter"||a===" "?this.handleSelect(i):this.handleMove(i)};wa=new WeakSet;kd=function(i){return i.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))};Ah=new WeakSet;db=function(){return this.items.find(i=>i.tabIndex===0)};Da=new WeakSet;wd=function(i){for(const e of this.items)e.tabIndex=e===i?0:-1};Ol=new WeakSet;Sh=function(i,e){const t=[...this.checkedItems];i.type==="radio"&&this.radioGroupItems.forEach(r=>r.checked=!1),e?i.checked=!i.checked:i.checked=!0,this.checkedItems.some((r,s)=>r!=t[s])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))};Ni.shadowRootOptions={mode:"open"};Ni.getTemplateHTML=BD;function HD(i){return["menuitem","menuitemradio","menuitemcheckbox"].includes(i==null?void 0:i.role)}function Qa(i){var e;return(e=i.getAttribute("bounds")?On(i,`#${i.getAttribute("bounds")}`):Yt(i)||i.parentElement)!=null?e:i}L.customElements.get("media-chrome-menu")||L.customElements.define("media-chrome-menu",Ni);var lm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ki=(i,e,t)=>(lm(i,e,"read from private field"),t?t.call(i):e.get(i)),Hi=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Wu=(i,e,t,r)=>(lm(i,e,"write to private field"),e.set(i,t),t),Si=(i,e,t)=>(lm(i,e,"access private method"),t),Pl,Ca,xh,ub,dm,cb,um,hb,wi,Mn,Za,Rh,fb,Nl,Lh;function GD(i){return` 1607 <style> 1608 :host { 1609 transition: var(--media-menu-item-transition, 1610 background .15s linear, 1611 opacity .2s ease-in-out 1612 ); 1613 outline: var(--media-menu-item-outline, 0); 1614 outline-offset: var(--media-menu-item-outline-offset, -1px); 1615 cursor: var(--media-cursor, pointer); 1616 display: flex; 1617 align-items: center; 1618 align-self: stretch; 1619 justify-self: stretch; 1620 white-space: nowrap; 1621 white-space-collapse: collapse; 1622 text-wrap: nowrap; 1623 padding: .4em .8em .4em 1em; 1624 } 1625 1626 :host(:focus-visible) { 1627 box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9)); 1628 outline: var(--media-menu-item-hover-outline, 0); 1629 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1630 } 1631 1632 :host(:hover) { 1633 cursor: var(--media-cursor, pointer); 1634 background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5)); 1635 outline: var(--media-menu-item-hover-outline); 1636 outline-offset: var(--media-menu-item-hover-outline-offset, var(--media-menu-item-outline-offset, -1px)); 1637 } 1638 1639 :host([aria-checked="true"]) { 1640 background: var(--media-menu-item-checked-background); 1641 } 1642 1643 :host([hidden]) { 1644 display: none; 1645 } 1646 1647 :host([disabled]) { 1648 pointer-events: none; 1649 color: rgba(255, 255, 255, .3); 1650 } 1651 1652 slot:not([name]) { 1653 width: 100%; 1654 } 1655 1656 slot:not([name="submenu"]) { 1657 display: inline-flex; 1658 align-items: center; 1659 transition: inherit; 1660 opacity: var(--media-menu-item-opacity, 1); 1661 } 1662 1663 slot[name="description"] { 1664 justify-content: end; 1665 } 1666 1667 slot[name="description"] > span { 1668 display: inline-block; 1669 margin-inline: 1em .2em; 1670 max-width: var(--media-menu-item-description-max-width, 100px); 1671 text-overflow: ellipsis; 1672 overflow: hidden; 1673 font-size: .8em; 1674 font-weight: 400; 1675 text-align: right; 1676 position: relative; 1677 top: .04em; 1678 } 1679 1680 slot[name="checked-indicator"] { 1681 display: none; 1682 } 1683 1684 :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] { 1685 display: var(--media-menu-item-checked-indicator-display, inline-block); 1686 } 1687 1688 1689 svg, img, ::slotted(svg), ::slotted(img) { 1690 height: var(--media-menu-item-icon-height, var(--media-control-height, 24px)); 1691 fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))); 1692 display: block; 1693 } 1694 1695 1696 [part~="indicator"], 1697 ::slotted([part~="indicator"]) { 1698 fill: var(--media-menu-item-indicator-fill, 1699 var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)))); 1700 height: var(--media-menu-item-indicator-height, 1.25em); 1701 margin-right: .5ch; 1702 } 1703 1704 [part~="checked-indicator"] { 1705 visibility: hidden; 1706 } 1707 1708 :host([aria-checked="true"]) [part~="checked-indicator"] { 1709 visibility: visible; 1710 } 1711 </style> 1712 <slot name="checked-indicator"> 1713 <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator"> 1714 <path d="m10 15.17 9.193-9.191 1.414 1.414-10.606 10.606-6.364-6.364 1.414-1.414 4.95 4.95Z"/> 1715 </svg> 1716 </slot> 1717 <slot name="prefix"></slot> 1718 <slot></slot> 1719 <slot name="description"></slot> 1720 <slot name="suffix">
1721 ${this.getSuffixSlotInnerHTML(i)} 1722 </slot> 1723 <slot name="submenu"></slot> 1724 `}function KD(i){return""}const $t={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class Un extends L.HTMLElement{constructor(){if(super(),Hi(this,xh),Hi(this,dm),Hi(this,um),Hi(this,Mn),Hi(this,Rh),Hi(this,Nl),Hi(this,Pl,!1),Hi(this,Ca,void 0),Hi(this,wi,()=>{var e,t;this.setAttribute("submenusize",`${this.submenuElement.items.length}`);const r=this.shadowRoot.querySelector('slot[name="description"]'),s=(e=this.submenuElement.checkedItems)==null?void 0:e[0],n=(t=s==null?void 0:s.dataset.description)!=null?t:s==null?void 0:s.text,a=at.createElement("span");a.textContent=n??"",r.replaceChildren(a)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);const e=Nt(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.shadowRoot.addEventListener("slotchange",this)}static get observedAttributes(){return[$t.TYPE,$t.DISABLED,$t.CHECKED,$t.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),Xn(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","false"),this.addEventListener("click",this),this.addEventListener("keydown",this)}disable(){this.removeAttribute("tabindex"),this.removeEventListener("click",this),this.removeEventListener("keydown",this),this.removeEventListener("keyup",this)}handleEvent(e){switch(e.type){case"slotchange":Si(this,xh,ub).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":Si(this,Rh,fb).call(this,e);break;case"keyup":Si(this,Mn,Za).call(this,e);break}}attributeChangedCallback(e,t,r){e===$t.CHECKED&&Xn(this)&&!ki(this,Pl)?this.setAttribute("aria-checked",r!=null?"true":"false"):e===$t.TYPE&&r!==t?this.role="menuitem"+r:e===$t.DISABLED&&r!==t&&(r==null?this.enable():this.disable())}connectedCallback(){this.hasAttribute($t.DISABLED)||this.enable(),this.role="menuitem"+this.type,Wu(this,Ca,Ih(this,this.parentNode)),Si(this,Nl,Lh).call(this)}disconnectedCallback(){this.disable(),Si(this,Nl,Lh).call(this),Wu(this,Ca,null)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=Gd(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var e;return(e=this.getAttribute($t.TYPE))!=null?e:""}set type(e){this.setAttribute($t.TYPE,`${e}`)}get value(){var e;return(e=this.getAttribute($t.VALUE))!=null?e:this.text}set value(e){this.setAttribute($t.VALUE,e)}get text(){var e;return((e=this.textContent)!=null?e:"").trim()}get checked(){if(Xn(this))return this.getAttribute("aria-checked")==="true"}set checked(e){Xn(this)&&(Wu(this,Pl,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){Xn(this)||this.invokeTargetElement&&tr(this,e.target)&&this.invokeTargetElement.dispatchEvent(new rm({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}}Pl=new WeakMap;Ca=new WeakMap;xh=new WeakSet;ub=function(i){const e=i.target;if(!(e!=null&&e.name))for(const r of e.assignedNodes({flatten:!0}))r instanceof Text&&r.textContent.trim()===""&&r.remove();e.name==="submenu"&&(this.submenuElement?Si(this,dm,cb).call(this):Si(this,um,hb).call(this))};dm=new WeakSet;cb=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded",`${!this.submenuElement.hidden}`),this.submenuElement.addEventListener("change",ki(this,wi)),this.submenuElement.addEventListener("addmenuitem",ki(this,wi)),this.submenuElement.addEventListener("removemenuitem",ki(this,wi)),ki(this,wi).call(this)};um=new WeakSet;hb=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",ki(this,wi)),this.submenuElement.removeEventListener("addmenuitem",ki(this,wi)),this.submenuElement.removeEventListener("removemenuitem",ki(this,wi)),ki(this,wi).call(this)};wi=new WeakMap;Mn=new WeakSet;Za=function(i){const{key:e}=i;if(!this.keysUsed.includes(e)){this.removeEventListener("keyup",Si(this,Mn,Za));return}this.handleClick(i)};Rh=new WeakSet;fb=function(i){const{metaKey:e,altKey:t,key:r}=i;if(e||t||!this.keysUsed.includes(r)){this.removeEventListener("keyup",Si(this,Mn,Za));return}this.addEventListener("keyup",Si(this,Mn,Za),{once:!0})};Nl=new WeakSet;Lh=function(){var i;const e=(i=ki(this,Ca))==null?void 0:i.radioGroupItems;if(!e)return;let t=e.filter(r=>r.getAttribute("aria-checked")==="true").pop();t||(t=e[0]);
1724for(const r of e)r.setAttribute("aria-checked","false");t==null||t.setAttribute("aria-checked","true")};Un.shadowRootOptions={mode:"open"};Un.getTemplateHTML=GD;Un.getSuffixSlotInnerHTML=KD;function Xn(i){return i.type==="radio"||i.type==="checkbox"}function Ih(i,e){if(!i)return null;const{host:t}=i.getRootNode();return!e&&t?Ih(i,t):e!=null&&e.items?e:Ih(e,e==null?void 0:e.parentNode)}L.customElements.get("media-chrome-menu-item")||L.customElements.define("media-chrome-menu-item",Un);function VD(i){return` 1725 ${Ni.getTemplateHTML(i)} 1726 <style> 1727 :host { 1728 --_menu-bg: rgb(20 20 30 / .8); 1729 background: var(--media-settings-menu-background, 1730 var(--media-menu-background, 1731 var(--media-control-background, 1732 var(--media-secondary-color, var(--_menu-bg))))); 1733 min-width: var(--media-settings-menu-min-width, 170px); 1734 border-radius: 2px 2px 0 0; 1735 overflow: hidden; 1736 } 1737 1738 @-moz-document url-prefix() { 1739 :host{ 1740 --_menu-bg: rgb(20 20 30); 1741 } 1742 } 1743 1744 :host([role="menu"]) { 1745 1746 justify-content: end; 1747 } 1748 1749 slot:not([name]) { 1750 justify-content: var(--media-settings-menu-justify-content); 1751 flex-direction: var(--media-settings-menu-flex-direction, column); 1752 overflow: visible; 1753 } 1754 1755 #container.has-expanded { 1756 --media-settings-menu-item-opacity: 0; 1757 } 1758 </style> 1759 `}class mb extends Ni{get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yt(this).querySelector("media-settings-menu-button")}}mb.getTemplateHTML=VD;L.customElements.get("media-settings-menu")||L.customElements.define("media-settings-menu",mb);function WD(i){return` 1760 ${Un.getTemplateHTML.call(this,i)} 1761 <style> 1762 slot:not([name="submenu"]) { 1763 opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity)); 1764 } 1765 1766 :host([aria-expanded="true"]:hover) { 1767 background: transparent; 1768 } 1769 </style> 1770 `}function YD(i){return` 1771 <svg aria-hidden="true" viewBox="0 0 20 24"> 1772 <path d="m8.12 17.585-.742-.669 4.2-4.665-4.2-4.666.743-.669 4.803 5.335-4.803 5.334Z"/> 1773 </svg> 1774 `}class tu extends Un{}tu.shadowRootOptions={mode:"open"};tu.getTemplateHTML=WD;tu.getSuffixSlotInnerHTML=YD;L.customElements.get("media-settings-menu-item")||L.customElements.define("media-settings-menu-item",tu);class Fn extends Et{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget",`${e}`)}get invokeTargetElement(){var e;return this.invokeTarget?(e=Gd(this))==null?void 0:e.querySelector(`#${this.invokeTarget}`):null}handleClick(){var e;(e=this.invokeTargetElement)==null||e.dispatchEvent(new rm({relatedTarget:this}))}}L.customElements.get("media-chrome-menu-button")||L.customElements.define("media-chrome-menu-button",Fn);function qD(){return` 1775 <style> 1776 :host([aria-expanded="true"]) slot[name=tooltip] { 1777 display: none; 1778 } 1779 </style> 1780 <slot name="icon"> 1781 <svg aria-hidden="true" viewBox="0 0 24 24"> 1782 <path d="M4.5 14.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Zm7.5 0a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/> 1783 </svg> 1784 </slot> 1785 `}function jD(){return z("Settings")}class cm extends Fn{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",z("settings"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yt(this).querySelector("media-settings-menu")}}cm.getSlotTemplateHTML=qD;cm.getTooltipContentHTML=jD;L.customElements.get("media-settings-menu-button")||L.customElements.define("media-settings-menu-button",cm);var hm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},pb=(i,e,t)=>(hm(i,e,"read from private field"),t?t.call(i):e.get(i)),Mo=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},kh=(i,e,t,r)=>(hm(i,e,"write to private field"),e.set(i,t),t),Oo=(i,e,t)=>(hm(i,e,"access private method"),t),va,Dd,Ul,wh,Fl,Dh;class zD extends Ni{constructor(){super(...arguments),Mo(this,Ul),Mo(this,Fl),Mo(this,va,[]),Mo(this,Dd,void 0)}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_AUDIO_TRACK_LIST,T.MEDIA_AUDIO_TRACK_ENABLED,T.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_AUDIO_TRACK_ENABLED&&t!==r?this.value=r:e===T.MEDIA_AUDIO_TRACK_LIST&&t!==r&&(kh(this,va,GI(r??"")),Oo(this,Ul,wh).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Oo(this,Fl,Dh))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Oo(this,Fl,Dh))}get anchorElement(){var e;return this.anchor!=="auto"?super.anchorElement:(e=Yt(this))==null?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return pb(this,va)}set mediaAudioTrackList(e){kh(this,va,e),Oo(this,Ul,wh).call(this)}get mediaAudioTrackEnabled(){var e;return(e=Fe(this,T.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){$e(this,T.MEDIA_AUDIO_TRACK_ENABLED,e)}}va=new WeakMap;Dd=new WeakMap;Ul=new WeakSet;wh=function(){if(pb(this,Dd)===JSON.stringify(this.mediaAudioTrackList))return;kh(this,Dd,JSON.stringify(this.mediaAudioTrackList));const i=this.mediaAudioTrackList;this.defaultSlot.textContent="";for(const e of i){const t=this.formatMenuItemText(e.label,e),r=Cn({type:"radio",text:t,value:`${e.id}`,checked:e.enabled});r.prepend(Ts(this,"checked-indicator")),this.defaultSlot.append(r)}};Fl=new WeakSet;Dh=function(){if(this.value==null)return;const i=new L.CustomEvent(j.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};L.customElements.get("media-audio-track-menu")||L.customElements.define("media-audio-track-menu",zD);const XD=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1786 <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/> 1787 <path d="M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0Z"/> 1788</svg>`;function QD(){return` 1789 <style> 1790 :host([aria-expanded="true"]) slot[name=tooltip] { 1791 display: none; 1792 } 1793 </style> 1794 <slot name="icon">${XD}</slot> 1795 `}function ZD(){return z("Audio")}class fm extends Fn{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_AUDIO_TRACK_ENABLED,T.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",z("Audio"))}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Yt(this))==null?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return(e=Fe(this,T.MEDIA_AUDIO_TRACK_ENABLED))!=null?e:""}set mediaAudioTrackEnabled(e){$e(this,T.MEDIA_AUDIO_TRACK_ENABLED,e)}}fm.getSlotTemplateHTML=QD;
1795fm.getTooltipContentHTML=ZD;L.customElements.get("media-audio-track-menu-button")||L.customElements.define("media-audio-track-menu-button",fm);var mm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},JD=(i,e,t)=>(mm(i,e,"read from private field"),e.get(i)),Yu=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},eC=(i,e,t,r)=>(mm(i,e,"write to private field"),e.set(i,t),t),qu=(i,e,t)=>(mm(i,e,"access private method"),t),Cd,Ch,gb,$l,Mh;const tC=` 1796 <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator"> 1797 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79 0 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 1798 </svg>`;function iC(i){return` 1799 ${Ni.getTemplateHTML(i)} 1800 <slot name="captions-indicator" hidden>${tC}</slot> 1801 `}class vb extends Ni{constructor(){super(...arguments),Yu(this,Ch),Yu(this,$l),Yu(this,Cd,void 0)}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_SUBTITLES_LIST,T.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_SUBTITLES_LIST&&t!==r?qu(this,Ch,gb).call(this):e===T.MEDIA_SUBTITLES_SHOWING&&t!==r&&(this.value=r)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",qu(this,$l,Mh))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",qu(this,$l,Mh))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yt(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return Vg(this,T.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Wg(this,T.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Vg(this,T.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Wg(this,T.MEDIA_SUBTITLES_SHOWING,e)}}Cd=new WeakMap;Ch=new WeakSet;gb=function(){var i;if(JD(this,Cd)===JSON.stringify(this.mediaSubtitlesList))return;eC(this,Cd,JSON.stringify(this.mediaSubtitlesList)),this.defaultSlot.textContent="";const e=!this.value,t=Cn({type:"radio",text:this.formatMenuItemText(z("Off")),value:"off",checked:e});t.prepend(Ts(this,"checked-indicator")),this.defaultSlot.append(t);const r=this.mediaSubtitlesList;for(const s of r){const n=Cn({type:"radio",text:this.formatMenuItemText(s.label,s),value:Kc(s),checked:this.value==Kc(s)});n.prepend(Ts(this,"checked-indicator")),((i=s.kind)!=null?i:"subs")==="captions"&&n.append(Ts(this,"captions-indicator")),this.defaultSlot.append(n)}};$l=new WeakSet;Mh=function(){const i=this.mediaSubtitlesShowing,e=this.getAttribute(T.MEDIA_SUBTITLES_SHOWING),t=this.value!==e;if(i!=null&&i.length&&t&&this.dispatchEvent(new L.CustomEvent(j.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:i})),!this.value||!t)return;const r=new L.CustomEvent(j.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)};vb.getTemplateHTML=iC;const Vg=(i,e)=>{const t=i.getAttribute(e);return t?qd(t):[]},Wg=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const r=Ka(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};L.customElements.get("media-captions-menu")||L.customElements.define("media-captions-menu",vb);const rC=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1802 <path d="M22.83 5.68a2.58 2.58 0 0 0-2.3-2.5c-3.62-.24-11.44-.24-15.06 0a2.58 2.58 0 0 0-2.3 2.5c-.23 4.21-.23 8.43 0 12.64a2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5c.23-4.21.23-8.43 0-12.64Zm-11.39 9.45a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.92 3.92 0 0 1 .92-2.77 3.18 3.18 0 0 1 2.43-1 2.94 2.94 0 0 1 2.13.78c.364.359.62.813.74 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.17 1.61 1.61 0 0 0-1.29.58 2.79 2.79
18020 0 0-.5 1.89 3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.48 1.48 0 0 0 1-.37 2.1 2.1 0 0 0 .59-1.14l1.4.44a3.23 3.23 0 0 1-1.07 1.69Zm7.22 0a3.07 3.07 0 0 1-1.91.57 3.06 3.06 0 0 1-2.34-1 3.75 3.75 0 0 1-.92-2.67 3.88 3.88 0 0 1 .93-2.77 3.14 3.14 0 0 1 2.42-1 3 3 0 0 1 2.16.82 2.8 2.8 0 0 1 .73 1.31l-1.43.35a1.49 1.49 0 0 0-1.51-1.21 1.61 1.61 0 0 0-1.29.58A2.79 2.79 0 0 0 15 12a3 3 0 0 0 .49 1.93 1.61 1.61 0 0 0 1.27.58 1.44 1.44 0 0 0 1-.37 2.1 2.1 0 0 0 .6-1.15l1.4.44a3.17 3.17 0 0 1-1.1 1.7Z"/> 1803</svg>`,sC=`<svg aria-hidden="true" viewBox="0 0 26 24"> 1804 <path d="M17.73 14.09a1.4 1.4 0 0 1-1 .37 1.579 1.579 0 0 1-1.27-.58A3 3 0 0 1 15 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34A2.89 2.89 0 0 0 19 9.07a3 3 0 0 0-2.14-.78 3.14 3.14 0 0 0-2.42 1 3.91 3.91 0 0 0-.93 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.17 3.17 0 0 0 1.07-1.74l-1.4-.45c-.083.43-.3.822-.62 1.12Zm-7.22 0a1.43 1.43 0 0 1-1 .37 1.58 1.58 0 0 1-1.27-.58A3 3 0 0 1 7.76 12a2.8 2.8 0 0 1 .5-1.85 1.63 1.63 0 0 1 1.29-.57 1.47 1.47 0 0 1 1.51 1.2l1.43-.34a2.81 2.81 0 0 0-.74-1.32 2.94 2.94 0 0 0-2.13-.78 3.18 3.18 0 0 0-2.43 1 4 4 0 0 0-.92 2.78 3.74 3.74 0 0 0 .92 2.66 3.07 3.07 0 0 0 2.34 1 3.07 3.07 0 0 0 1.91-.57 3.23 3.23 0 0 0 1.07-1.74l-1.4-.45a2.06 2.06 0 0 1-.6 1.07Zm12.32-8.41a2.59 2.59 0 0 0-2.3-2.51C18.72 3.05 15.86 3 13 3c-2.86 0-5.72.05-7.53.17a2.59 2.59 0 0 0-2.3 2.51c-.23 4.207-.23 8.423 0 12.63a2.57 2.57 0 0 0 2.3 2.5c1.81.13 4.67.19 7.53.19 2.86 0 5.72-.06 7.53-.19a2.57 2.57 0 0 0 2.3-2.5c.23-4.207.23-8.423 0-12.63Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18-2.98 0-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11c-.21-4.14-.21-8.29 0-12.43a1.11 1.11 0 0 1 .91-1.11C7.24 4.56 10 4.49 13 4.49s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11c.21 4.14.21 8.29 0 12.43Z"/> 1805</svg>`;function nC(){return` 1806 <style> 1807 :host([aria-checked="true"]) slot[name=off] { 1808 display: none !important; 1809 } 1810 1811 1812 :host(:not([aria-checked="true"])) slot[name=on] { 1813 display: none !important; 1814 } 1815 1816 :host([aria-expanded="true"]) slot[name=tooltip] { 1817 display: none; 1818 } 1819 </style> 1820 1821 <slot name="icon"> 1822 <slot name="on">${rC}</slot> 1823 <slot name="off">${sC}</slot> 1824 </slot> 1825 `}function aC(){return z("Captions")}const Yg=i=>{i.setAttribute("aria-checked",iy(i).toString())};class pm extends Fn{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_SUBTITLES_LIST,T.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",z("closed captions")),Yg(this)}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_SUBTITLES_SHOWING&&Yg(this)}get invokeTargetElement(){var e;return this.invokeTarget!=null?super.invokeTargetElement:(e=Yt(this))==null?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return qg(this,T.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){jg(this,T.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return qg(this,T.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){jg(this,T.MEDIA_SUBTITLES_SHOWING,e)}}pm.getSlotTemplateHTML=nC;pm.getTooltipContentHTML=aC;const qg=(i,e)=>{const t=i.getAttribute(e);return t?qd(t):[]},jg=(i,e,t)=>{if(!(t!=null&&t.length)){i.removeAttribute(e);return}const r=Ka(t);i.getAttribute(e)!==r&&i.setAttribute(e,r)};L.customElements.get("media-captions-menu-button")||L.customElements.define("media-captions-menu-button",pm);var Eb=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},en=(i,e,t)=>(Eb(i,e,"read from private field"),t?t.call(i):e.get(i)),ju=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Qn=(i,e,t)=>(Eb(i,e,"access private method"),t),vr,Ea,Bl,Hl,Oh;const zu={RATES:"rates"};class oC extends Ni{constructor(){super(),ju(this,Ea),ju(this,Hl),ju(this,vr,new Rf(this,zu.RATES,{defaultValue:Cy})),Qn(this,Ea,Bl).call(this)}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PLAYBACK_RATE,zu.RATES]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_PLAYBACK_RATE&&t!=r?this.value=r:e===zu.RATES&&t!=r&&(en(this,vr).value=r,Qn(this,Ea,Bl).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Qn(this,Hl,Oh))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Qn(this,Hl,Oh))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yt(this).querySelector("media-playback-rate-menu-button")}get rates(){return en(this,vr)}set rates(e){e?Array.isArray(e)?en(this,vr).value=e.join(" "):typeof e=="string"&&(en(this,vr).value=e):en(this,vr).value="",Qn(this,Ea,Bl).call(this)}get mediaPlaybackRate(){return Ue(this,T.MEDIA_PLAYBACK_RATE,ln)}set mediaPlaybackRate(e){Ye(this,T.MEDIA_PLAYBACK_RATE,e)}}vr=new WeakMap;Ea=new WeakSet;Bl=function(){this.defaultSlot.textContent="";for(const i of en(this,vr)){const e=Cn({type:"radio",text:this.formatMenuItemText(`${i}x`,i),value:i,checked:this.mediaPlaybackRate===Number(i)});
1825e.prepend(Ts(this,"checked-indicator")),this.defaultSlot.append(e)}};Hl=new WeakSet;Oh=function(){if(!this.value)return;const i=new L.CustomEvent(j.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};L.customElements.get("media-playback-rate-menu")||L.customElements.define("media-playback-rate-menu",oC);const Gl=1;function lC(i){return` 1826 <style> 1827 :host { 1828 min-width: 5ch; 1829 padding: var(--media-button-padding, var(--media-control-padding, 10px 5px)); 1830 } 1831 1832 :host([aria-expanded="true"]) slot[name=tooltip] { 1833 display: none; 1834 } 1835 </style> 1836 <slot name="icon">${i.mediaplaybackrate||Gl}x</slot> 1837 `}function dC(){return z("Playback rate")}class gm extends Fn{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_PLAYBACK_RATE]}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML=`${(e=this.mediaPlaybackRate)!=null?e:Gl}x`}attributeChangedCallback(e,t,r){if(super.attributeChangedCallback(e,t,r),e===T.MEDIA_PLAYBACK_RATE){const s=r?+r:Number.NaN,n=Number.isNaN(s)?Gl:s;this.container.innerHTML=`${n}x`,this.setAttribute("aria-label",z("Playback rate {playbackRate}",{playbackRate:n}))}}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yt(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return Ue(this,T.MEDIA_PLAYBACK_RATE,Gl)}set mediaPlaybackRate(e){Ye(this,T.MEDIA_PLAYBACK_RATE,e)}}gm.getSlotTemplateHTML=lC;gm.getTooltipContentHTML=dC;L.customElements.get("media-playback-rate-menu-button")||L.customElements.define("media-playback-rate-menu-button",gm);var vm=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)},ya=(i,e,t)=>(vm(i,e,"read from private field"),t?t.call(i):e.get(i)),Po=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},zg=(i,e,t,r)=>(vm(i,e,"write to private field"),e.set(i,t),t),Us=(i,e,t)=>(vm(i,e,"access private method"),t),ba,dn,tn,Ta,Kl,Ph;class uC extends Ni{constructor(){super(...arguments),Po(this,tn),Po(this,Kl),Po(this,ba,[]),Po(this,dn,{})}static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_RENDITION_LIST,T.MEDIA_RENDITION_SELECTED,T.MEDIA_RENDITION_UNAVAILABLE,T.MEDIA_HEIGHT]}attributeChangedCallback(e,t,r){super.attributeChangedCallback(e,t,r),e===T.MEDIA_RENDITION_SELECTED&&t!==r?(this.value=r??"auto",Us(this,tn,Ta).call(this)):e===T.MEDIA_RENDITION_LIST&&t!==r?(zg(this,ba,FI(r)),Us(this,tn,Ta).call(this)):e===T.MEDIA_HEIGHT&&t!==r&&Us(this,tn,Ta).call(this)}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Us(this,Kl,Ph))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Us(this,Kl,Ph))}get anchorElement(){return this.anchor!=="auto"?super.anchorElement:Yt(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return ya(this,ba)}set mediaRenditionList(e){zg(this,ba,e),Us(this,tn,Ta).call(this)}get mediaRenditionSelected(){return Fe(this,T.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){$e(this,T.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Ue(this,T.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,T.MEDIA_HEIGHT,e)}}ba=new WeakMap;dn=new WeakMap;tn=new WeakSet;Ta=function(){if(ya(this,dn).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&ya(this,dn).mediaHeight===this.mediaHeight)return;ya(this,dn).mediaRenditionList=JSON.stringify(this.mediaRenditionList),ya(this,dn).mediaHeight=this.mediaHeight;const i=this.mediaRenditionList.sort((n,a)=>a.height-n.height);for(const n of i)n.selected=n.id===this.mediaRenditionSelected;this.defaultSlot.textContent="";const e=!this.mediaRenditionSelected;for(const n of i){const a=this.formatMenuItemText(`${Math.min(n.width,n.height)}p`,n),o=Cn({type:"radio",text:a,value:`${n.id}`,checked:n.selected&&!e});o.prepend(Ts(this,"checked-indicator")),this.defaultSlot.append(o)}const t=e?this.formatMenuItemText(`${z("Auto")} (${this.mediaHeight}p)`):this.formatMenuItemText(z("Auto")),r=Cn({type:"radio",text:t,value:"auto",checked:e}),s=this.mediaHeight>0?`${z("Auto")} (${this.mediaHeight}p)`:z("Auto");r.dataset.description=s,r.prepend(Ts(this,"checked-indicator")),this.defaultSlot.append(r)};Kl=new WeakSet;Ph=function(){if(this.value==null)return;const i=new L.CustomEvent(j.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(i)};L.customElements.get("media-rendition-menu")||L.customElements.define("media-rendition-menu",uC);const cC=`<svg aria-hidden="true" viewBox="0 0 24 24"> 1838 <path d="M13.5 2.5h2v6h-2v-2h-11v-2h11v-2Zm4 2h4v2h-4v-2Zm-12 4h2v6h-2v-2h-3v-2h3v-2Zm4 2h12v2h-12v-2Zm1 4h2v6h-2v-2h-8v-2h8v-2Zm4 2h7v2h-7v-2Z" /> 1839</svg>`;function hC(){return` 1840 <style> 1841 :host([aria-expanded="true"]) slot[name=tooltip] { 1842 display: none; 1843 } 1844 </style> 1845 <slot name="icon">${cC}</slot> 1846 `}function fC(){return z("Quality")}class Em extends Fn{static get observedAttributes(){return[...super.observedAttributes,T.MEDIA_RENDITION_SELECTED,T.MEDIA_RENDITION_UNAVAILABLE,T.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",z("qual
1846ity"))}get invokeTargetElement(){return this.invokeTarget!=null?super.invokeTargetElement:Yt(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return Fe(this,T.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){$e(this,T.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return Ue(this,T.MEDIA_HEIGHT)}set mediaHeight(e){Ye(this,T.MEDIA_HEIGHT,e)}}Em.getSlotTemplateHTML=hC;Em.getTooltipContentHTML=fC;L.customElements.get("media-rendition-menu-button")||L.customElements.define("media-rendition-menu-button",Em);var yb=i=>{throw TypeError(i)},ym=(i,e,t)=>e.has(i)||yb("Cannot "+t),Re=(i,e,t)=>(ym(i,e,"read from private field"),t?t.call(i):e.get(i)),ii=(i,e,t)=>e.has(i)?yb("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),Mi=(i,e,t,r)=>(ym(i,e,"write to private field"),e.set(i,t),t),Ze=(i,e,t)=>(ym(i,e,"access private method"),t),iu=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends iu{}globalThis.DocumentFragment=i}var bm=class extends iu{},mC=class extends iu{},pC={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(bm)}},Vl,gC=class{constructor(i,e={}){ii(this,Vl),Mi(this,Vl,e==null?void 0:e.detail)}get detail(){return Re(this,Vl)}initCustomEvent(){}};Vl=new WeakMap;function vC(i,e){return new bm}var bb={document:{createElement:vC},DocumentFragment,customElements:pC,CustomEvent:gC,EventTarget:iu,HTMLElement:bm,HTMLVideoElement:mC},Tb=typeof window>"u"||typeof globalThis.customElements>"u",xi=Tb?bb:globalThis,Tm=Tb?bb.document:globalThis.document;function EC(i){let e="";return Object.entries(i).forEach(([t,r])=>{r!=null&&(e+=`${Nh(t)}: ${r}; `)}),e?e.trim():void 0}function Nh(i){return i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _b(i){return i.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function Ct(i){if(i==null)return;let e=+i;return Number.isNaN(e)?void 0:e}function Ab(i){let e=yC(i).toString();return e?"?"+e:""}function yC(i){let e={};for(let t in i)i[t]!=null&&(e[t]=i[t]);return new URLSearchParams(e)}var Sb=(i,e)=>!i||!e?!1:i.contains(e)?!0:Sb(i,e.getRootNode().host),xb="mux.com",bC=()=>{try{return"3.5.0"}catch{}return"UNKNOWN"},TC=bC(),Rb=()=>TC,_C=(i,{token:e,customDomain:t=xb,thumbnailTime:r,programTime:s}={})=>{var n;let a=e==null?r:void 0,{aud:o}=(n=cn(e))!=null?n:{};if(!(e&&o!=="t"))return`https://image.${t}/${i}/thumbnail.webp${Ab({token:e,time:a,program_time:s})}`},AC=(i,{token:e,customDomain:t=xb,programStartTime:r,programEndTime:s}={})=>{var n;let{aud:a}=(n=cn(e))!=null?n:{};if(!(e&&a!=="s"))return`https://image.${t}/${i}/storyboard.vtt${Ab({token:e,format:"webp",program_start_time:r,program_end_time:s})}`},_m=i=>{if(i){if([xe.LIVE,xe.ON_DEMAND].includes(i))return i;if(i!=null&&i.includes("live"))return xe.LIVE}},SC={crossorigin:"crossOrigin",playsinline:"playsInline"};function xC(i){var e;return(e=SC[i])!=null?e:_b(i)}var rn,sn,xt,RC=class{constructor(i,e){ii(this,rn),ii(this,sn),ii(this,xt,[]),Mi(this,rn,i),Mi(this,sn,e)}[Symbol.iterator](){return Re(this,xt).values()}get length(){return Re(this,xt).length}get value(){var i;return(i=Re(this,xt).join(" "))!=null?i:""}set value(i){var e;i!==this.value&&(Mi(this,xt,[]),this.add(...(e=i==null?void 0:i.split(" "))!=null?e:[]))}toString(){return this.value}item(i){return Re(this,xt)[i]}values(){return Re(this,xt).values()}keys(){return Re(this,xt).keys()}forEach(i){Re(this,xt).forEach(i)}add(...i){var e,t;i.forEach(r=>{this.contains(r)||Re(this,xt).push(r)}),!(this.value===""&&!((e=Re(this,rn))!=null&&e.hasAttribute(`${Re(this,sn)}`)))&&((t=Re(this,rn))==null||t.setAttribute(`${Re(this,sn)}`,`${this.value}`))}remove(...i){var e;i.forEach(t=>{Re(this,xt).splice(Re(this,xt).indexOf(t),1)}),(e=Re(this,rn))==null||e.setAttribute(`${Re(this,sn)}`,`${this.value}`)}contains(i){return Re(this,xt).includes(i)}toggle(i,e){return typeof e<"u"?e?(this.add(i),!0):(this.remove(i),!1):this.contains(i)?(this.remove(i),!1):(this.add(i),!0)}replace(i,e){this.remove(i),this.add(e)}};rn=new WeakMap,sn=new WeakMap,xt=new WeakMap;
vendor: 8,320 bytes, lines 1846-1934
1846var Lb=`[mux-player ${Rb()}]`;function qi(...i){console.warn(Lb,...i)}function Gt(...i){console.error(Lb,...i)}function Ib(i){var e;let t=(e=i.message)!=null?e:"";i.context&&(t+=` ${i.context}`),i.file&&(t+=` ${Z("Read more: ")} 1847https://github.com/muxinc/elements/blob/main/errors/${i.file}`),qi(t)}var bt={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Jr={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Xg=Object.freeze({length:0,start(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'start' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0},end(i){let e=i>>>0;if(e>=this.length)throw new DOMException(`Failed to execute 'end' on 'TimeRanges': The index provided (${e}) is greater than or equal to the maximum bound (${this.length}).`);return 0}}),LC=Object.values(bt).filter(i=>bt.PLAYSINLINE!==i),IC=Object.values(Jr),kC=[...LC,...IC],wC=class extends xi.HTMLElement{static get observedAttributes(){return kC}constructor(){super()}attributeChangedCallback(i,e,t){var r,s;switch(i){case Jr.MUTED:{this.media&&(this.media.muted=t!=null,this.media.defaultMuted=t!=null);return}case Jr.VOLUME:{let n=(r=Ct(t))!=null?r:1;this.media&&(this.media.volume=n);return}case Jr.PLAYBACKRATE:{let n=(s=Ct(t))!=null?s:1;this.media&&(this.media.playbackRate=n,this.media.defaultPlaybackRate=n);return}}}play(){var i,e;return(e=(i=this.media)==null?void 0:i.play())!=null?e:Promise.reject()}pause(){var i;(i=this.media)==null||i.pause()}load(){var i;(i=this.media)==null||i.load()}get media(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("mux-video")}get audioTracks(){return this.media.audioTracks}get videoTracks(){return this.media.videoTracks}get audioRenditions(){return this.media.audioRenditions}get videoRenditions(){return this.media.videoRenditions}get paused(){var i,e;return(e=(i=this.media)==null?void 0:i.paused)!=null?e:!0}get duration(){var i,e;return(e=(i=this.media)==null?void 0:i.duration)!=null?e:NaN}get ended(){var i,e;return(e=(i=this.media)==null?void 0:i.ended)!=null?e:!1}get buffered(){var i,e;return(e=(i=this.media)==null?void 0:i.buffered)!=null?e:Xg}get seekable(){var i,e;return(e=(i=this.media)==null?void 0:i.seekable)!=null?e:Xg}get readyState(){var i,e;return(e=(i=this.media)==null?void 0:i.readyState)!=null?e:0}get videoWidth(){var i,e;return(e=(i=this.media)==null?void 0:i.videoWidth)!=null?e:0}get videoHeight(){var i,e;return(e=(i=this.media)==null?void 0:i.videoHeight)!=null?e:0}get currentSrc(){var i,e;return(e=(i=this.media)==null?void 0:i.currentSrc)!=null?e:""}get currentTime(){var i,e;return(e=(i=this.media)==null?void 0:i.currentTime)!=null?e:0}set currentTime(i){this.media&&(this.media.currentTime=Number(i))}get volume(){var i,e;return(e=(i=this.media)==null?void 0:i.volume)!=null?e:1}set volume(i){this.media&&(this.media.volume=Number(i))}get playbackRate(){var i,e;return(e=(i=this.media)==null?void 0:i.playbackRate)!=null?e:1}set playbackRate(i){this.media&&(this.media.playbackRate=Number(i))}get defaultPlaybackRate(){var i;return(i=Ct(this.getAttribute(Jr.PLAYBACKRATE)))!=null?i:1}set defaultPlaybackRate(i){i!=null?this.setAttribute(Jr.PLAYBACKRATE,`${i}`):this.removeAttribute(Jr.PLAYBACKRATE)}get crossOrigin(){return Zn(this,bt.CROSSORIGIN)}set crossOrigin(i){this.setAttribute(bt.CROSSORIGIN,`${i}`)}get autoplay(){return Zn(this,bt.AUTOPLAY)!=null}set autoplay(i){i?this.setAttribute(bt.AUTOPLAY,typeof i=="string"?i:""):this.removeAttribute(bt.AUTOPLAY)}get loop(){return Zn(this,bt.LOOP)!=null}set loop(i){i?this.setAttribute(bt.LOOP,""):this.removeAttribute(bt.LOOP)}get muted(){var i,e;return(e=(i=this.media)==null?void 0:i.muted)!=null?e:!1}set muted(i){this.media&&(this.media.muted=!!i)}get defaultMuted(){return Zn(this,bt.MUTED)!=null}set defaultMuted(i){i?this.setAttribute(bt.MUTED,""):this.removeAttribute(bt.MUTED)}get playsInline(){return Zn(this,bt.PLAYSINLINE)!=null}set playsInline(i){Gt("playsInline is set to true by default and is not currently supported as a setter.")}get preload(){return this.media?this.media.preload:this.getAttribute("preload")}set preload(i){["","none","metadata","auto"].includes(i)?this.setAttribute(bt.PRELOAD,i):this.removeAttribute(bt.PRELOAD)}};function Zn(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var Qg=wC,DC=`:host { 1848 --media-control-display: var(--controls); 1849 --media-loading-indicator-display: var(--loading-indicator); 1850 --media-dialog-display: var(--dialog); 1851 --media-play-button-display: var(--play-button); 1852 --media-live-button-display: var(--live-button); 1853 --media-seek-backward-button-display: var(--seek-backward-button); 1854 --media-seek-forward-button-display: var(--seek-forward-button); 1855 --media-mute-button-display: var(--mute-button); 1856 --media-captions-button-display: var(--captions-button); 1857 --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display)); 1858 --media-rendition-menu-button-display: var(--rendition-menu-button); 1859 --media-audio-track-menu-button-display: var(--audio-track-menu-button); 1860 --media-airplay-button-display: var(--airplay-button); 1861 --media-pip-button-display: var(--pip-button); 1862 --media-fullscreen-button-display: var(--fullscreen-button); 1863 --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display)); 1864 --media-playback-rate-button-display: var(--playback-rate-button); 1865 --media-playback-rate-menu-button-display: var(--playback-rate-menu-button); 1866 --media-volume-range-display: var(--volume-range); 1867 --media-time-range-display: var(--time-range); 1868 --media-time-display-display: var(--time-display); 1869 --media-duration-display-display: var(--duration-display); 1870 --media-title-display-display: var(--title-display); 1871 1872 display: inline-block; 1873 line-height: 0; 1874 width: 100%; 1875} 1876 1877a { 1878 color: #fff; 1879 font-size: 0.9em; 1880 text-decoration: underline; 1881} 1882 1883media-theme { 1884 display: inline-block; 1885 line-height: 0; 1886 width: 100%; 1887 height: 100%; 1888 direction: ltr; 1889} 1890 1891media-poster-image { 1892 display: inline-block; 1893 line-height: 0; 1894 width: 100%; 1895 height: 100%; 1896} 1897 1898media-poster-image:not([src]):not([placeholdersrc]) { 1899 display: none; 1900} 1901 1902::part(top), 1903[part~='top'] { 1904 --media-control-display: var(--controls, var(--top-controls)); 1905 --media-play-button-display: var(--play-button, var(--top-play-button)); 1906 --media-live-button-display: var(--live-button, var(--top-live-button)); 1907 --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button)); 1908 --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button)); 1909 --media-mute-button-display: var(--mute-button, var(--top-mute-button)); 1910 --media-captions-button-display: var(--captions-button, var(--top-captions-button)); 1911 --media-captions-menu-button-display: var( 1912 --captions-menu-button, 1913 var(--media-captions-button-display, var(--top-captions-menu-button)) 1914 ); 1915 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button)); 1916 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button)); 1917 --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button)); 1918 --media-pip-button-display: var(--pip-button, var(--top-pip-button)); 1919 --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button)); 1920 --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display))); 1921 --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button)); 1922 --media-playback-rate-menu-button-display: var( 1923 --captions-menu-button, 1924 var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button)) 1925 ); 1926 --media-volume-range-display: var(--volume-range, var(--top-volume-range)); 1927 --media-time-range-display: var(--time-range, var(--top-time-range)); 1928 --media-time-display-display: var(--time-display, var(--top-time-display)); 1929 --media-duration-display-display: var(--duration-display, var(--top-duration-display)); 1930 --media-title-display-display: var(--title-display, var(--top-title-display)); 1931} 1932 1933::part(center), 1934[part~='center'] {
1935 --media-control-display: var(--controls, var(--center-controls)); 1936 --media-play-button-display: var(--play-button, var(--center-play-button)); 1937 --media-live-button-display: var(--live-button, var(--center-live-button)); 1938 --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button)); 1939 --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button)); 1940 --media-mute-button-display: var(--mute-button, var(--center-mute-button)); 1941 --media-captions-button-display: var(--captions-button, var(--center-captions-button)); 1942 --media-captions-menu-button-display: var( 1943 --captions-menu-button, 1944 var(--media-captions-button-display, var(--center-captions-menu-button)) 1945 ); 1946 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button)); 1947 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button)); 1948 --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button)); 1949 --media-pip-button-display: var(--pip-button, var(--center-pip-button)); 1950 --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button)); 1951 --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display))); 1952 --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button)); 1953 --media-playback-rate-menu-button-display: var( 1954 --playback-rate-menu-button, 1955 var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button)) 1956 ); 1957 --media-volume-range-display: var(--volume-range, var(--center-volume-range)); 1958 --media-time-range-display: var(--time-range, var(--center-time-range)); 1959 --media-time-display-display: var(--time-display, var(--center-time-display)); 1960 --media-duration-display-display: var(--duration-display, var(--center-duration-display)); 1961} 1962 1963::part(bottom), 1964[part~='bottom'] { 1965 --media-control-display: var(--controls, var(--bottom-controls)); 1966 --media-play-button-display: var(--play-button, var(--bottom-play-button)); 1967 --media-live-button-display: var(--live-button, var(--bottom-live-button)); 1968 --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button)); 1969 --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button)); 1970 --media-mute-button-display: var(--mute-button, var(--bottom-mute-button)); 1971 --media-captions-button-display: var(--captions-button, var(--bottom-captions-button)); 1972 --media-captions-menu-button-display: var( 1973 --captions-menu-button, 1974 var(--media-captions-button-display, var(--bottom-captions-menu-button)) 1975 ); 1976 --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button)); 1977 --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button)); 1978 --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button)); 1979 --media-pip-button-display: var(--pip-button, var(--bottom-pip-button)); 1980 --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button)); 1981 --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display))); 1982 --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button)); 1983 --media-playback-rate-menu-button-display: var( 1984 --playback-rate-menu-button, 1985 var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button)) 1986 ); 1987 --media-volume-range-display: var(--volume-range, var(--bottom-volume-range)); 1988 --media-time-range-display: var(--time-range, var(--bottom-time-range)); 1989 --media-time-display-display: var(--time-display, var(--bottom-time-display)); 1990 --media-duration-display-display: var(--duration-display, var(--bottom-duration-display)); 1991 --media-title-display-display: var(--title-display, var(--bottom-title-display)); 1992} 1993 1994:host([no-tooltips]) { 1995 --media-tooltip-display: none; 1996} 1997`,Jn=new WeakMap,CC=class kb{constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let r=Jn.get(this.element);r&&r.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let t=Jn.get(this.element);
vendor: 4,298 bytes, lines 1997-2022
1997t&&t.delete(this.type)}}static for(e){Jn.has(e.element)||Jn.set(e.element,new Map);let t=e.attributeName.slice(2),r=Jn.get(e.element);return r&&r.has(t)?r.get(t):new kb(e.element,t)}};function MC(i,e){return i instanceof ni&&i.attributeName.startsWith("on")?(CC.for(i).set(e),i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),!0):!1}function OC(i,e){return e instanceof wb&&i instanceof Nn?(e.renderInto(i),!0):!1}function PC(i,e){return e instanceof DocumentFragment&&i instanceof Nn?(e.childNodes.length&&i.replace(...e.childNodes),!0):!1}function NC(i,e){if(i instanceof ni){let t=i.attributeNamespace,r=i.element.getAttributeNS(t,i.attributeName);return String(e)!==r&&(i.value=String(e)),!0}return i.value=String(e),!0}function UC(i,e){if(i instanceof ni&&e instanceof Element){let t=i.element;return t[i.attributeName]!==e&&(i.element.removeAttributeNS(i.attributeNamespace,i.attributeName),t[i.attributeName]=e),!0}return!1}function FC(i,e){if(typeof e=="boolean"&&i instanceof ni){let t=i.attributeNamespace,r=i.element.hasAttributeNS(t,i.attributeName);return e!==r&&(i.booleanValue=e),!0}return!1}function $C(i,e){return e===!1&&i instanceof Nn?(i.replace(""),!0):!1}function BC(i,e){UC(i,e)||FC(i,e)||MC(i,e)||$C(i,e)||OC(i,e)||PC(i,e)||NC(i,e)}var Xu=new Map,Zg=new WeakMap,Jg=new WeakMap,wb=class{constructor(i,e,t){this.strings=i,this.values=e,this.processor=t,this.stringsKey=this.strings.join("�")}get template(){if(Xu.has(this.stringsKey))return Xu.get(this.stringsKey);{let i=Tm.createElement("template"),e=this.strings.length-1;return i.innerHTML=this.strings.reduce((t,r,s)=>t+r+(s<e?`{{ ${s} }}`:""),""),Xu.set(this.stringsKey,i),i}}renderInto(i){var e;let t=this.template;if(Zg.get(i)!==t){Zg.set(i,t);let s=new Jd(t,this.values,this.processor);Jg.set(i,s),i instanceof Nn?i.replace(...s.children):i.appendChild(s);return}let r=Jg.get(i);(e=r==null?void 0:r.update)==null||e.call(r,this.values)}},HC={processCallback(i,e,t){var r;if(t){for(let[s,n]of e)if(s in t){let a=(r=t[s])!=null?r:"";BC(n,a)}}}};function Wl(i,...e){return new wb(i,e,HC)}function GC(i,e){i.renderInto(e)}var KC=i=>{let{tokens:e}=i;return e.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""},VC=i=>Wl` 1998 <style> 1999 ${KC(i)} 2000 ${DC} 2001 </style> 2002 ${jC(i)} 2003`,WC=i=>{let e=i.hotKeys?`${i.hotKeys}`:"";return _m(i.streamType)==="live"&&(e+=" noarrowleft noarrowright"),e},YC={TOP:"top",CENTER:"center",BOTTOM:"bottom",LAYER:"layer",MEDIA_LAYER:"media-layer",POSTER_LAYER:"poster-layer",VERTICAL_LAYER:"vertical-layer",CENTERED_LAYER:"centered-layer",GESTURE_LAYER:"gesture-layer",CONTROLLER_LAYER:"controller",BUTTON:"button",RANGE:"range",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",OPTION:"option",POSTER:"poster",LIVE:"live",PLAY:"play",PRE_PLAY:"pre-play",SEEK_BACKWARD:"seek-backward",SEEK_FORWARD:"seek-forward",MUTE:"mute",CAPTIONS:"captions",AIRPLAY:"airplay",PIP:"pip",FULLSCREEN:"fullscreen",CAST:"cast",PLAYBACK_RATE:"playback-rate",VOLUME:"volume",TIME:"time",TITLE:"title",AUDIO_TRACK:"audio-track",RENDITION:"rendition"},qC=Object.values(YC).join(", "),jC=i=>{var e,t,r,s,n,a,o,l,d,u,c,h,f,m,p,g,v,b,y,A,_,C,x,S,P,I,M,$,F,Q,Y,X,ue,de,K;return Wl` 2004 <media-theme 2005 template="${i.themeTemplate||!1}" 2006 defaultstreamtype="${(e=i.defaultStreamType)!=null?e:!1}" 2007 hotkeys="${WC(i)||!1}" 2008 nohotkeys="${i.noHotKeys||!i.hasSrc||!1}" 2009 noautoseektolive="${!!((t=i.streamType)!=null&&t.includes(xe.LIVE))&&i.targetLiveWindow!==0}" 2010 novolumepref="${i.novolumepref||!1}" 2011 disabled="${!i.hasSrc||i.isDialogOpen}" 2012 audio="${(r=i.audio)!=null?r:!1}" 2013 style="${(s=EC({"--media-primary-color":i.primaryColor,"--media-secondary-color":i.secondaryColor,"--media-accent-color":i.accentColor}))!=null?s:!1}" 2014 defaultsubtitles="${!i.defaultHiddenCaptions}" 2015 forwardseekoffset="${(n=i.forwardSeekOffset)!=null?n:!1}" 2016 backwardseekoffset="${(a=i.backwardSeekOffset)!=null?a:!1}" 2017 playbackrates="${(o=i.playbackRates)!=null?o:!1}" 2018 defaultshowremainingtime="${(l=i.defaultShowRemainingTime)!=null?l:!1}" 2019 defaultduration="${(d=i.defaultDuration)!=null?d:!1}" 2020 hideduration="${(u=i.hideDuration)!=null?u:!1}" 2021 title="${(c=i.title)!=null?c:!1}" 2022 videotitle="${(h=i.videoTitle)!=null?h:!1}
2022" 2023 proudlydisplaymuxbadge="${(f=i.proudlyDisplayMuxBadge)!=null?f:!1}" 2024 exportparts="${qC}" 2025 onclose="${i.onCloseErrorDialog}" 2026 onfocusin="${i.onFocusInErrorDialog}" 2027 > 2028 <mux-video 2029 slot="media" 2030 target-live-window="${(m=i.targetLiveWindow)!=null?m:!1}" 2031 stream-type="${(p=_m(i.streamType))!=null?p:!1}" 2032 crossorigin="${(g=i.crossOrigin)!=null?g:""}" 2033 playsinline 2034 autoplay="${(v=i.autoplay)!=null?v:!1}" 2035 muted="${(b=i.muted)!=null?b:!1}" 2036 loop="${(y=i.loop)!=null?y:!1}" 2037 preload="${(A=i.preload)!=null?A:!1}" 2038 debug="${(_=i.debug)!=null?_:!1}" 2039 prefer-cmcd="${(C=i.preferCmcd)!=null?C:!1}" 2040 disable-tracking="${(x=i.disableTracking)!=null?x:!1}" 2041 disable-cookies="${(S=i.disableCookies)!=null?S:!1}" 2042 prefer-playback="${(P=i.preferPlayback)!=null?P:!1}" 2043 start-time="${i.startTime!=null?i.startTime:!1}" 2044 beacon-collection-domain="${(I=i.beaconCollectionDomain)!=null?I:!1}" 2045 player-init-time="${(M=i.playerInitTime)!=null?M:!1}" 2046 player-software-name="${($=i.playerSoftwareName)!=null?$:!1}" 2047 player-software-version="${(F=i.playerSoftwareVersion)!=null?F:!1}" 2048 env-key="${(Q=i.envKey)!=null?Q:!1}" 2049 custom-domain="${(Y=i.customDomain)!=null?Y:!1}" 2050 src="${i.src?i.src:i.playbackId?Tc(i):!1}" 2051 cast-src="${i.src?i.src:i.playbackId?Tc(i):!1}" 2052 cast-receiver="${(X=i.castReceiver)!=null?X:!1}" 2053 drm-token="${(de=(ue=i.tokens)==null?void 0:ue.drm)!=null?de:!1}" 2054 exportparts="video" 2055 > 2056 ${i.storyboard?Wl`<track label="thumbnails" default kind="metadata" src="${i.storyboard}" />`:Wl``} 2057 <slot></slot> 2058 </mux-video> 2059 <slot name="poster" slot="poster"> 2060 <media-poster-image 2061 part="poster" 2062 exportparts="poster, img" 2063 src="${i.poster?i.poster:!1}" 2064 placeholdersrc="${(K=i.placeholder)!=null?K:!1}" 2065 ></media-poster-image> 2066 </slot> 2067 </media-theme> 2068`},Db=i=>i.charAt(0).toUpperCase()+i.slice(1),zC=(i,e=!1)=>{var t,r;if(i.muxCode){let s=Db((t=i.errorCategory)!=null?t:"video"),n=Ud((r=i.errorCategory)!=null?r:Oe.VIDEO);if(i.muxCode===ee.NETWORK_OFFLINE)return Z("Your device appears to be offline",e);if(i.muxCode===ee.NETWORK_TOKEN_EXPIRED)return Z("{category} URL has expired",e).format({category:s});if([ee.NETWORK_TOKEN_SUB_MISMATCH,ee.NETWORK_TOKEN_AUD_MISMATCH,ee.NETWORK_TOKEN_AUD_MISSING,ee.NETWORK_TOKEN_MALFORMED].includes(i.muxCode))return Z("{category} URL is formatted incorrectly",e).format({category:s});if(i.muxCode===ee.NETWORK_TOKEN_MISSING)return Z("Invalid {categoryName} URL",e).format({categoryName:n});if(i.muxCode===ee.NETWORK_NOT_FOUND)return Z("{category} does not exist",e).format({category:s});if(i.muxCode===ee.NETWORK_NOT_READY){let a=i.streamType==="live"?"Live stream":"Video";return Z("{mediaType} is not currently available",e).format({mediaType:a})}}if(i.code){if(i.code===G.MEDIA_ERR_NETWORK)return Z("Network Error",e);if(i.code===G.MEDIA_ERR_DECODE)return Z("Media Error",e);if(i.code===G.MEDIA_ERR_SRC_NOT_SUPPORTED)return Z("Source Not Supported",e)}return Z("Error",e)},XC=(i,e=!1)=>{var t,r;if(i.muxCode){let s=Db((t=i.errorCategory)!=null?t:"video"),n=Ud((r=i.errorCategory)!=null?r:Oe.VIDEO);return i.muxCode===ee.NETWORK_OFFLINE?Z("Check your internet connection and try reloading this video.",e):i.muxCode===ee.NETWORK_TOKEN_EXPIRED?Z("The video’s secured {tokenNamePrefix}-token has expired.",e).format({tokenNamePrefix:n}):i.muxCode===ee.NETWORK_TOKEN_SUB_MISMATCH?Z("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",e).format({tokenNamePrefix:n}):i.muxCode===ee.NETWORK_TOKEN_MALFORMED?Z("{category} URL is formatted incorrectly",e).format({category:s}):[ee.NETWORK_TOKEN_AUD_MISMATCH,ee.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode)?Z("The {tokenNamePrefix}-token is formatted with incorrect information.",e).format({tokenNamePrefix:n}):[ee.NETWORK_TOKEN_MISSING,ee.NETWORK_INVALID_URL].includes(i.muxCode)?Z("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",e).format({tokenNamePrefix:n}):i.muxCode===ee.NETWORK_NOT_FOUND?"":i.message}return i.code&&(i.code===G.MEDIA_ERR_NETWORK||i.code===G.MEDIA_ERR_DECODE||(i.code,G.MEDIA_ERR_SRC_NOT_SUPPORTED)),i.message},QC=(i,e=!1)=>{let t=zC(i,e).toString(),r=XC(i,e).toString();return{title:t,message:r}},ZC=i=>{if(i.muxCode){if(i.muxCode===ee.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(i.muxCode===ee.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([ee.NETWORK_TOKEN_AUD_MISMATCH,ee.NETWORK_TOKEN_AUD_MISSING].includes(i.muxCode))return"403-incorrect-aud-value.md";if(i.muxCode===ee.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(i.muxCode===ee.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(i.muxCode===ee.NETWORK_NOT_FOUND)return"404-not-found.md";if(i.muxCode===ee.NETWORK_NOT_READY)return"412-not-playable.md"}if(i.code){if(i.code===G.MEDIA_ERR_NETWORK)return"";if(i.code===G.MEDIA_ERR_DECODE)return"media-decode-error.md";if(i.code===G.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""},e0=(i,e)=>{let t=ZC(i);return{message:i.message,context:i.context,file:t}},JC=`<template id="media-theme-gerwig"> 2069 <style>
2070 @keyframes pre-play-hide { 2071 0% { 2072 transform: scale(1); 2073 opacity: 1; 2074 } 2075 2076 30% { 2077 transform: scale(0.7); 2078 } 2079 2080 100% { 2081 transform: scale(1.5); 2082 opacity: 0; 2083 } 2084 } 2085 2086 :host { 2087 --_primary-color: var(--media-primary-color, #fff); 2088 --_secondary-color: var(--media-secondary-color, transparent); 2089 --_accent-color: var(--media-accent-color, #fa50b5); 2090 --_text-color: var(--media-text-color, #000); 2091 2092 --media-icon-color: var(--_primary-color); 2093 --media-control-background: var(--_secondary-color); 2094 --media-control-hover-background: var(--_accent-color); 2095 --media-time-buffered-color: rgba(255, 255, 255, 0.4); 2096 --media-preview-time-text-shadow: none; 2097 --media-control-height: 14px; 2098 --media-control-padding: 6px; 2099 --media-tooltip-container-margin: 6px; 2100 --media-tooltip-distance: 18px; 2101 2102 color: var(--_primary-color); 2103 display: inline-block; 2104 width: 100%; 2105 height: 100%; 2106 } 2107 2108 :host([audio]) { 2109 --_secondary-color: var(--media-secondary-color, black); 2110 --media-preview-time-text-shadow: none; 2111 } 2112 2113 :host([audio]) ::slotted([slot='media']) { 2114 height: 0px; 2115 } 2116 2117 :host([audio]) media-loading-indicator { 2118 display: none; 2119 } 2120 2121 :host([audio]) media-controller { 2122 background: transparent; 2123 } 2124 2125 :host([audio]) media-controller::part(vertical-layer) { 2126 background: transparent; 2127 } 2128 2129 :host([audio]) media-control-bar { 2130 width: 100%; 2131 background-color: var(--media-control-background); 2132 } 2133 2134 /* 2135 * 0.433s is the transition duration for VTT Regions. 2136 * Borrowed here, so the captions don't move too fast. 2137 */ 2138 media-controller { 2139 --media-webkit-text-track-transform: translateY(0) scale(0.98); 2140 --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s; 2141 } 2142 media-controller:is([mediapaused], :not([userinactive])) { 2143 --media-webkit-text-track-transform: translateY(-50px) scale(0.98); 2144 --media-webkit-text-track-transition: transform 0.15s ease; 2145 } 2146 2147 /* 2148 * CSS specific to iOS devices. 2149 * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757 2150 */ 2151 @supports (-webkit-touch-callout: none) { 2152 /* Disable subtitle adjusting for iOS Safari */ 2153 media-controller[mediaisfullscreen] { 2154 --media-webkit-text-track-transform: unset; 2155 --media-webkit-text-track-transition: unset; 2156 } 2157 } 2158 2159 media-time-range { 2160 --media-box-padding-left: 6px; 2161 --media-box-padding-right: 6px; 2162 --media-range-bar-color: var(--_accent-color); 2163 --media-time-range-buffered-color: var(--_primary-color); 2164 --media-range-track-color: transparent; 2165 --media-range-track-background: rgba(255, 255, 255, 0.4); 2166 --media-range-thumb-background: radial-gradient( 2167 circle, 2168 #000 0%, 2169 #000 25%, 2170 var(--_accent-color) 25%, 2171 var(--_accent-color) 2172 ); 2173 --media-range-thumb-width: 12px; 2174 --media-range-thumb-height: 12px; 2175 --media-range-thumb-transform: scale(0); 2176 --media-range-thumb-transition: transform 0.3s; 2177 --media-range-thumb-opacity: 1; 2178 --media-preview-background: var(--_primary-color); 2179 --media-box-arrow-background: var(--_primary-color); 2180 --media-preview-thumbnail-border: 5px solid var(--_primary-color); 2181 --media-preview-border-radius: 5px; 2182 --media-text-color: var(--_text-color); 2183 --media-control-hover-background: transparent; 2184 --media-preview-chapter-text-shadow: none; 2185 color: var(--_accent-color); 2186 padding: 0 6px; 2187 } 2188 2189 :host([audio]) media-time-range { 2190 --media-preview-time-padding: 1.5px 6px; 2191 --media-preview-box-margin: 0 0 -5px; 2192 } 2193 2194 media-time-range:hover { 2195 --media-range-thumb-transform: scale(1); 2196 } 2197 2198 media-preview-thumbnail { 2199 border-bottom-width: 0; 2200 } 2201 2202 [part~='menu'] { 2203 border-radius: 2px; 2204 border: 1px solid rgba(0, 0, 0, 0.1); 2205 bottom: 50px; 2206 padding: 2.5px 10px; 2207 } 2208 2209 [part~='menu']::part(indicator) { 2210 fill: var(--_accent-color); 2211 } 2212 2213 [part~='menu']::part(menu-item) { 2214 box-sizing: border-box; 2215 display: flex; 2216 align-items: center; 2217 padding: 6px 10px; 2218 min-height: 34px; 2219 } 2220 2221 [part~='menu']::part(checked) { 2222 font-weight: 700; 2223 } 2224 2225 media-captions-menu, 2226 media-rendition-menu, 2227 media-audio-track-menu, 2228 media-playback-rate-menu { 2229 position: absolute; /* ensure they don't take up space in DOM on load */ 2230 --media-menu-background: var(--_primary-color); 2231 --media-menu-item-checked-background: transparent; 2232 --media-text-color: var(--_text-color); 2233 --media-menu-item-hover-background: transparent; 2234 --media-menu-item-hover-outline: var(--_accent-color) solid 1px; 2235 } 2236 2237 media-rendition-menu { 2238 min-width: 140px; 2239 } 2240 2241 /* The icon is a circle so make it 16px high instead of 14px for more balance. */ 2242 media-audio-track-menu-button { 2243 --media-control-padding: 5px; 2244 --media-control-height: 16px; 2245 } 2246 2247 media-playback-rate-menu-button { 2248 --media-control-padding: 6px 3px; 2249 min-width: 4.4ch; 2250 } 2251 2252 media-playback-rate-menu { 2253 --media-menu-flex-direction: row; 2254 --media-menu-item-checked-background: var(--_accent-color); 2255 --media-menu-item-checked-indicator-display: none; 2256 margin-right: 6px; 2257 padding: 0; 2258 --media-menu-gap: 0.25em; 2259 } 2260 2261 media-playback-rate-menu[part~='menu']::part(menu-item) { 2262 padding: 6px 6px 6px 8px; 2263 } 2264 2265 media-playback-rate-menu[part~='menu']::part(checked) { 2266 color: #fff; 2267 } 2268 2269 :host(:not([audio])) media-time-range { 2270 /* Adding px is required here for calc() */ 2271 --media-range-padding: 0px; 2272 background: transparent; 2273 z-index: 10; 2274 height: 10px; 2275 bottom: -3px; 2276 width: 100%; 2277 } 2278 2279 media-control-bar :is([role='button'], [role='switch'], button) { 2280 line-height: 0; 2281 } 2282 2283 media-control-bar :is([part*='button'], [part*='range'], [part*='display']) { 2284 border-radius: 3px; 2285 } 2286 2287 .spacer { 2288 flex-grow: 1; 2289 background-color: var(--media-control-background, rgba(20, 20, 30, 0.7)); 2290 } 2291 2292 media-control-bar[slot~='top-chrome'] { 2293 min-height: 42px; 2294 pointer-events: none; 2295 } 2296 2297 media-control-bar { 2298 --gradient-steps: 2299 hsl(0 0% 0% / 0) 0%, hsl(0 0% 0% / 0.013) 8.1%, hsl(0 0% 0% / 0.049) 15.5%, hsl(0 0% 0% / 0.104) 22.5%, 2300 hsl(0 0% 0% / 0.175) 29%, hsl(0 0% 0% / 0.259) 35.3%, hsl(0 0% 0% / 0.352) 41.2%, hsl(0 0% 0% / 0.45) 47.1%, 2301 hsl(0 0% 0% / 0.55) 52.9%, hsl(0 0% 0% / 0.648) 58.8%, hsl(0 0% 0% / 0.741) 64.7%, hsl(0 0% 0% / 0.825) 71%, 2302 hsl(0 0% 0% / 0.896) 77.5%, hsl(0 0% 0% / 0.951) 84.5%, hsl(0 0% 0% / 0.987) 91.9%, hsl(0 0% 0%) 100%; 2303 } 2304 2305 :host([title]:not([audio])) media-control-bar[slot='top-chrome']::before { 2306 content: ''; 2307 position: absolute; 2308 width: 100%; 2309 padding-bottom: min(100px, 25%); 2310 background: linear-gradient(to top, var(--gradient-steps)); 2311 opacity: 0.8; 2312 pointer-events: none; 2313 } 2314 2315 :host(:not([audio])) media-control-bar[part~='bottom']::before { 2316 content: ''; 2317 position: absolute; 2318 width: 100%; 2319 bottom: 0; 2320 left: 0; 2321 padding-bottom: min(100px, 25%); 2322 background: linear-gradient(to bottom, var(--gradient-steps)); 2323 opacity: 0.8; 2324 z-index: 1; 2325 pointer-events: none; 2326 } 2327 2328 media-control-bar[part~='bottom'] > * { 2329 z-index: 20; 2330 } 2331 2332 media-control-bar[part~='bottom'] { 2333 padding: 6px 6px; 2334 } 2335 2336 media-control-bar[slot~='top-chrome'] > * { 2337 --media-control-background: transparent; 2338 --media-control-hover-background: transparent; 2339 position: relative; 2340 } 2341 2342 media-controller::part(vertical-layer) { 2343 transition: background-color 1s; 2344 } 2345 2346 media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) { 2347 background-color: var(--controls-backdrop-color, var(--controls, transparent)); 2348 transition: background-color 0.25s; 2349 } 2350
2351 .center-controls { 2352 --media-button-icon-width: 100%; 2353 --media-button-icon-height: auto; 2354 --media-tooltip-display: none; 2355 pointer-events: none; 2356 width: 100%; 2357 display: flex; 2358 flex-flow: row; 2359 align-items: center; 2360 justify-content: center; 2361 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2362 paint-order: stroke; 2363 stroke: rgba(102, 102, 102, 1); 2364 stroke-width: 0.3px; 2365 text-shadow: 2366 0 0 2px rgb(0 0 0 / 0.25), 2367 0 0 6px rgb(0 0 0 / 0.25); 2368 } 2369 2370 .center-controls media-play-button { 2371 --media-control-background: transparent; 2372 --media-control-hover-background: transparent; 2373 --media-control-padding: 0; 2374 width: 40px; 2375 } 2376 2377 [breakpointsm] .center-controls media-play-button { 2378 width: 90px; 2379 height: 90px; 2380 border-radius: 50%; 2381 transition: background 0.4s; 2382 padding: 24px; 2383 --media-control-background: #000; 2384 --media-control-hover-background: var(--_accent-color); 2385 } 2386 2387 .center-controls media-seek-backward-button, 2388 .center-controls media-seek-forward-button { 2389 --media-control-background: transparent; 2390 --media-control-hover-background: transparent; 2391 padding: 0; 2392 margin: 0 20px; 2393 width: max(33px, min(8%, 40px)
vendor: 26,664 bytes, lines 2393-2957
2393); 2394 } 2395 2396 [breakpointsm]:not([audio]) .center-controls.pre-playback { 2397 display: grid; 2398 align-items: initial; 2399 justify-content: initial; 2400 height: 100%; 2401 overflow: hidden; 2402 } 2403 2404 [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button { 2405 place-self: var(--_pre-playback-place, center); 2406 grid-area: 1 / 1; 2407 margin: 16px; 2408 } 2409 2410 /* Show and hide controls or pre-playback state */ 2411 2412 [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio]) 2413 .center-controls.pre-playback 2414 media-play-button { 2415 /* Using \`forwards\` would lead to a laggy UI after the animation got in the end state */ 2416 animation: 0.3s linear pre-play-hide; 2417 opacity: 0; 2418 pointer-events: none; 2419 } 2420 2421 .autoplay-unmute { 2422 --media-control-hover-background: transparent; 2423 width: 100%; 2424 display: flex; 2425 align-items: center; 2426 justify-content: center; 2427 filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25)); 2428 } 2429 2430 .autoplay-unmute-btn { 2431 --media-control-height: 16px; 2432 border-radius: 8px; 2433 background: #000; 2434 color: var(--_primary-color); 2435 display: flex; 2436 align-items: center; 2437 padding: 8px 16px; 2438 font-size: 18px; 2439 font-weight: 500; 2440 cursor: pointer; 2441 } 2442 2443 .autoplay-unmute-btn:hover { 2444 background: var(--_accent-color); 2445 } 2446 2447 [breakpointsm] .autoplay-unmute-btn { 2448 --media-control-height: 30px; 2449 padding: 14px 24px; 2450 font-size: 26px; 2451 } 2452 2453 .autoplay-unmute-btn svg { 2454 margin: 0 6px 0 0; 2455 } 2456 2457 [breakpointsm] .autoplay-unmute-btn svg { 2458 margin: 0 10px 0 0; 2459 } 2460 2461 media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) { 2462 display: none; 2463 } 2464 2465 media-error-dialog:not([mediaerrorcode]) { 2466 opacity: 0; 2467 } 2468 2469 media-loading-indicator { 2470 --media-loading-icon-width: 100%; 2471 --media-button-icon-height: auto; 2472 display: var(--media-control-display, var(--media-loading-indicator-display, flex)); 2473 pointer-events: none; 2474 position: absolute; 2475 width: min(15%, 150px); 2476 flex-flow: row; 2477 align-items: center; 2478 justify-content: center; 2479 } 2480 2481 /* Intentionally don't target the div for transition but the children 2482 of the div. Prevents messing with media-chrome's autohide feature. */ 2483 media-loading-indicator + div * { 2484 transition: opacity 0.15s; 2485 opacity: 1; 2486 } 2487 2488 media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * { 2489 opacity: 0; 2490 transition-delay: 400ms; 2491 } 2492 2493 media-volume-range { 2494 width: min(100%, 100px); 2495 --media-range-padding-left: 10px; 2496 --media-range-padding-right: 10px; 2497 --media-range-thumb-width: 12px; 2498 --media-range-thumb-height: 12px; 2499 --media-range-thumb-background: radial-gradient( 2500 circle, 2501 #000 0%, 2502 #000 25%, 2503 var(--_primary-color) 25%, 2504 var(--_primary-color) 2505 ); 2506 --media-control-hover-background: none; 2507 } 2508 2509 media-time-display { 2510 white-space: nowrap; 2511 } 2512 2513 /* Generic style for explicitly disabled controls */ 2514 media-control-bar[part~='bottom'] [disabled], 2515 media-control-bar[part~='bottom'] [aria-disabled='true'] { 2516 opacity: 60%; 2517 cursor: not-allowed; 2518 } 2519 2520 media-text-display { 2521 --media-font-size: 16px; 2522 --media-control-padding: 14px; 2523 font-weight: 500; 2524 } 2525 2526 media-play-button.animated *:is(g, path) { 2527 transition: all 0.3s; 2528 } 2529 2530 media-play-button.animated[mediapaused] .pause-icon-pt1 { 2531 opacity: 0; 2532 } 2533 2534 media-play-button.animated[mediapaused] .pause-icon-pt2 { 2535 transform-origin: center center; 2536 transform: scaleY(0); 2537 } 2538 2539 media-play-button.animated[mediapaused] .play-icon { 2540 clip-path: inset(0 0 0 0); 2541 } 2542 2543 media-play-button.animated:not([mediapaused]) .play-icon { 2544 clip-path: inset(0 0 0 100%); 2545 } 2546 2547 media-seek-forward-button, 2548 media-seek-backward-button { 2549 --media-font-weight: 400; 2550 } 2551 2552 .mute-icon { 2553 display: inline-block; 2554 } 2555 2556 .mute-icon :is(path, g) { 2557 transition: opacity 0.5s; 2558 } 2559 2560 .muted { 2561 opacity: 0; 2562 } 2563 2564 media-mute-button[mediavolumelevel='low'] :is(.volume-medium, .volume-high), 2565 media-mute-button[mediavolumelevel='medium'] :is(.volume-high) { 2566 opacity: 0; 2567 } 2568 2569 media-mute-button[mediavolumelevel='off'] .unmuted { 2570 opacity: 0; 2571 } 2572 2573 media-mute-button[mediavolumelevel='off'] .muted { 2574 opacity: 1; 2575 } 2576 2577 /** 2578 * Our defaults for these buttons are to hide them at small sizes 2579 * users can override this with CSS 2580 */ 2581 media-controller:not([breakpointsm]):not([audio]) { 2582 --bottom-play-button: none; 2583 --bottom-seek-backward-button: none; 2584 --bottom-seek-forward-button: none; 2585 --bottom-time-display: none; 2586 --bottom-playback-rate-menu-button: none; 2587 --bottom-pip-button: none; 2588 } 2589 2590 [part='mux-badge'] { 2591 position: absolute; 2592 bottom: 10px; 2593 right: 10px; 2594 z-index: 2; 2595 opacity: 0.6; 2596 transition: 2597 opacity 0.2s ease-in-out, 2598 bottom 0.2s ease-in-out; 2599 } 2600 2601 [part='mux-badge']:hover { 2602 opacity: 1; 2603 } 2604 2605 [part='mux-badge'] a { 2606 font-size: 14px; 2607 font-family: var(--_font-family); 2608 color: var(--_primary-color); 2609 text-decoration: none; 2610 display: flex; 2611 align-items: center; 2612 gap: 5px; 2613 } 2614 2615 [part='mux-badge'] .mux-badge-text { 2616 transition: opacity 0.5s ease-in-out; 2617 opacity: 0; 2618 } 2619 2620 [part='mux-badge'] .mux-badge-logo { 2621 width: 40px; 2622 height: auto; 2623 display: inline-block; 2624 } 2625 2626 [part='mux-badge'] .mux-badge-logo svg { 2627 width: 100%; 2628 height: 100%; 2629 fill: white; 2630 } 2631 2632 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'], 2633 media-controller:not([userinactive]) [part='mux-badge'], 2634 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2635 transition: bottom 0.1s ease-in-out; 2636 } 2637 2638 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2639 transition: bottom 0.2s ease-in-out 0.62s; 2640 } 2641 2642 media-controller:not([userinactive]) [part='mux-badge'] .mux-badge-text, 2643 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] .mux-badge-text { 2644 opacity: 1; 2645 } 2646 2647 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] .mux-badge-text { 2648 opacity: 0; 2649 } 2650 2651 media-controller[userinactive]:not([mediapaused]) [part='mux-badge'] { 2652 bottom: 10px; 2653 } 2654 2655 media-controller:not([userinactive]):not([mediahasplayed]) [part='mux-badge'] { 2656 bottom: 10px; 2657 } 2658 2659 media-controller:not([userinactive])[mediahasplayed] [part='mux-badge'], 2660 media-controller[mediahasplayed][mediapaused] [part='mux-badge'] { 2661 bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2); 2662 } 2663 </style> 2664 2665 <template partial="TitleDisplay"> 2666 <template if="videotitle"> 2667 <template if="videotitle != true"> 2668 <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display> 2669 </template> 2670 </template> 2671 <template if="!videotitle"> 2672 <template if="title"> 2673 <media-text-display part="top title display" class="title-display">{{title}}</media-text-display> 2674 </template> 2675 </template> 2676 </template> 2677 2678 <template partial="PlayButton"> 2679 <media-play-button 2680 part="{{section ?? 'bottom'}} play button" 2681 disabled="{{disabled}}" 2682 aria-disabled="{{disabled}}" 2683 class="animated" 2684 > 2685 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon"> 2686 <g class="play-icon"> 2687 <path 2688 d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z" 2689 /> 2690 </g> 2691 <g class="pause-icon"> 2692 <path 2693 class="pause-icon-pt1" 2694 d="M5.90709 0H2.96889C2.46857 0 2.06299 0.405585 2.06299 0.9059V13.0941C2.06299 13.5944 2.46857 14 2.96889 14H5.90709C6.4074 14 6.81299 13.5944 6.81299 13.0941V0.9059C6.81299 0.405585 6.4074 0 5.90709 0Z" 2695 /> 2696 <path 2697 class="pause-icon-pt2" 2698 d="M15.1571 0H12.2189C11.7186 0 11.313 0.405585 11.313 0.9059V13.0941C11.313 13.5944 11.7186 14 12.2189 14H15.1571C15.6574 14 16.063 13.5944 16.063 13.0941V0.9059C16.063 0.405585 15.6574 0 15.1571 0Z" 2699 /> 2700 </g> 2701 </svg> 2702 </media-play-button> 2703 </template> 2704 2705 <template partial="PrePlayButton"> 2706 <media-play-button 2707 part="{{section ?? 'center'}} play button pre-play" 2708 disabled="{{disabled}}" 2709 aria-disabled="{{disabled}}" 2710 > 2711 <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)"> 2712 <path 2713 d="M15.5987 6.2911L3.45577 0.110898C2.83667 -0.204202 2.06287 0.189698 2.06287 0.819798V13.1802C2.06287 13.8103 2.83667 14.2042 3.45577 13.8891L15.5987 7.7089C16.2178 7.3938 16.2178 6.6061 15.5987 6.2911Z" 2714 /> 2715 </svg> 2716 </media-play-button> 2717 </template> 2718 2719 <template partial="SeekBackwardButton"> 2720 <media-seek-backward-button 2721 seekoffset="{{backwardseekoffset}}" 2722 part="{{section ?? 'bottom'}} seek-backward button" 2723 disabled="{{disabled}}" 2724 aria-disabled="{{disabled}}" 2725 > 2726 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2727 <path 2728 d="M3.65 2.07888L0.0864 6.7279C-0.0288 6.87812 -0.0288 7.12188 0.0864 7.2721L3.65 11.9211C3.7792 12.0896 4 11.9703 4 11.7321V2.26787C4 2.02968 3.7792 1.9104 3.65 2.07888Z" 2729 /> 2730 <text transform="translate(6 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2731 {{backwardseekoffset}} 2732 </text> 2733 </svg> 2734 </media-seek-backward-button> 2735 </template> 2736 2737 <template partial="SeekForwardButton"> 2738 <media-seek-forward-button 2739 seekoffset="{{forwardseekoffset}}" 2740 part="{{section ?? 'bottom'}} seek-forward button" 2741 disabled="{{disabled}}" 2742 aria-disabled="{{disabled}}" 2743 > 2744 <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon"> 2745 <g> 2746 <text transform="translate(-1 12)" style="font-size: 14px; font-family: 'ArialMT', 'Arial'"> 2747 {{forwardseekoffset}} 2748 </text> 2749 <path 2750 d="M18.35 11.9211L21.9136 7.2721C22.0288 7.12188 22.0288 6.87812 21.9136 6.7279L18.35 2.07888C18.2208 1.91041 18 2.02968 18 2.26787V11.7321C18 11.9703 18.2208 12.0896 18.35 11.9211Z" 2751 /> 2752 </g> 2753 </svg> 2754 </media-seek-forward-button> 2755 </template> 2756 2757 <template partial="MuteButton"> 2758 <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2759 <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true"> 2760 <g class="unmuted"> 2761 <path 2762 d="M6.76786 1.21233L3.98606 3.98924H1.19937C0.593146 3.98924 0.101743 4.51375 0.101743 5.1607V6.96412L0 6.99998L0.101743 7.03583V8.83926C0.101743 9.48633 0.593146 10.0108 1.19937 10.0108H3.98606L6.76773 12.7877C7.23561 13.2547 8 12.9007 8 12.2171V1.78301C8 1.09925 7.23574 0.745258 6.76786 1.21233Z" 2763 /> 2764 <path 2765 class="volume-low" 2766 d="M10 3.54781C10.7452 4.55141 11.1393 5.74511 11.1393 6.99991C11.1393 8.25471 10.7453 9.44791 10 10.4515L10.7988 11.0496C11.6734 9.87201 12.1356 8.47161 12.1356 6.99991C12.1356 5.52821 11.6735 4.12731 10.7988 2.94971L10 3.54781Z" 2767 /> 2768 <path 2769 class="volume-medium" 2770 d="M12.3778 2.40086C13.2709 3.76756 13.7428 5.35806 13.7428 7.00026C13.7428 8.64246 13.2709 10.233 12.3778 11.5992L13.2106 12.1484C14.2107 10.6185 14.739 8.83796 14.739 7.00016C14.739 5.16236 14.2107 3.38236 13.2106 1.85156L12.3778 2.40086Z" 2771 /> 2772 <path 2773 class="volume-high" 2774 d="M15.5981 0.75L14.7478 1.2719C15.7937 2.9919 16.3468 4.9723 16.3468 7C16.3468 9.0277 15.7937 11.0082 14.7478 12.7281L15.5981 13.25C16.7398 11.3722 17.343 9.211 17.343 7C17.343 4.789 16.7398 2.6268 15.5981 0.75Z" 2775 /> 2776 </g> 2777 <g class="muted"> 2778 <path 2779 fill-rule="evenodd" 2780 clip-rule="evenodd" 2781 d="M4.39976 4.98924H1.19937C1.19429 4.98924 1.17777 4.98961 1.15296 5.01609C1.1271 5.04369 1.10174 5.09245 1.10174 5.1607V8.83926C1.10174 8.90761 1.12714 8.95641 1.15299 8.984C1.17779 9.01047 1.1943 9.01084 1.19937 9.01084H4.39977L7 11.6066V2.39357L4.39976 4.98924ZM7.47434 1.92006C7.4743 1.9201 7.47439 1.92002 7.47434 1.92006V1.92006ZM6.76773 12.7877L3.98606 10.0108H1.19937C0.593146 10.0108 0.101743 9.48633 0.101743 8.83926V7.03583L0 6.99998L0.101743 6.96412V5.1607C0.101743 4.51375 0.593146 3.98924 1.19937 3.98924H3.98606L6.76786 1.21233C7.23574 0.745258 8 1.09925 8 1.78301V12.2171C8 12.9007 7.23561 13.2547 6.76773 12.7877Z" 2782 /> 2783 <path 2784 fill-rule="evenodd" 2785 clip-rule="evenodd" 2786 d="M15.2677 9.30323C15.463 9.49849 15.7796 9.49849 15.9749 9.30323C16.1701 9.10796 16.1701 8.79138 15.9749 8.59612L14.2071 6.82841L15.9749 5.06066C16.1702 4.8654 16.1702 4.54882 15.9749 4.35355C15.7796 4.15829 15.4631 4.15829 15.2678 4.35355L13.5 6.1213L11.7322 4.35348C11.537 4.15822 11.2204 4.15822 11.0251 4.35348C10.8298 4.54874 10.8298 4.86532 11.0251 5.06058L12.7929 6.82841L11.0251 8.59619C10.8299 8.79146 10.8299 9.10804 11.0251 9.3033C11.2204 9.49856 11.537 9.49856 11.7323 9.3033L13.5 7.53552L15.2677 9.30323Z" 2787 /> 2788 </g> 2789 </svg> 2790 </media-mute-button> 2791 </template> 2792 2793 <template partial="PipButton"> 2794 <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2795 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2796 <path 2797 d="M15.9891 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.989C0 13.0996 0.9004 14 2.011 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0ZM17 11.9891C17 12.5465 16.5465 13 15.9891 13H2.011C1.4536 13 1.0001 12.5465 1.0001 11.9891V2.0109C1.0001 1.4535 1.4536 0.9999 2.011 0.9999H15.9891C16.5465 0.9999 17 1.4535 17 2.0109V11.9891Z" 2798 /> 2799 <path 2800 d="M15.356 5.67822H8.19523C8.03253 5.67822 7.90063 5.81012 7.90063 5.97282V11.3836C7.90063 11.5463 8.03253 11.6782 8.19523 11.6782H15.356C15.5187 11.6782 15.6506 11.5463 15.6506 11.3836V5.97282C15.6506 5.81012 15.5187 5.67822 15.356 5.67822Z" 2801 /> 2802 </svg> 2803 </media-pip-button> 2804 </template> 2805 2806 <template partial="CaptionsMenu"> 2807 <media-captions-menu-button part="bottom captions button"> 2808 <svg aria-hidden="true" viewBox="0 0 18 14" slot="on"> 2809 <path 2810 d="M15.989 0H2.011C0.9004 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9004 14 2.011 14H15.989C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.989 0ZM4.2292 8.7639C4.5954 9.1902 5.0935 9.4031 5.7233 9.4031C6.1852 9.4031 6.5544 9.301 6.8302 9.0969C7.1061 8.8933 7.2863 8.614 7.3702 8.26H8.4322C8.3062 8.884 8.0093 9.3733 7.5411 9.7273C7.0733 10.0813 6.4703 10.2581 5.732 10.2581C5.108 10.2581 4.5699 10.1219 4.1168 9.8489C3.6637 9.5759 3.3141 9.1946 3.0685 8.7058C2.8224 8.2165 2.6994 7.6511 2.6994 7.009C2.6994 6.3611 2.8224 5.7927 3.0685 5.3034C3.3141 4.8146 3.6637 4.4323 4.1168 4.1559C4.5699 3.88 5.108 3.7418 5.732 3.7418C6.4703 3.7418 7.0733 3.922 7.5411 4.2818C8.0094 4.6422 8.3062 5.1461 8.4322 5.794H7.3702C7.2862 5.4283 7.106 5.1368 6.8302 4.921C6.5544 4.7052 6.1852 4.5968 5.7233 4.5968C5.0934 4.5968 4.5954 4.8116 4.2292 5.2404C3.8635 5.6696 3.6804 6.259 3.6804 7.009C3.6804 7.7531 3.8635 8.3381 4.2292 8.7639ZM11.0974 8.7639C11.4636 9.1902 11.9617 9.4031 12.5915 9.4031C13.0534 9.4031 13.4226 9.301 13.6984 9.0969C13.9743 8.8933 14.1545 8.614 14.2384 8.26H15.3004C15.1744 8.884 14.8775 9.3733 14.4093 9.7273C13.9415 10.0813 13.3385 10.2581 12.6002 10.2581C11.9762 10.2581 11.4381 10.1219 10.985 9.8489C10.5319 9.5759 10.1823 9.1946 9.9367 8.7058C9.6906 8.2165 9.5676 7.6511 9.5676 7.009C9.5676 6.3611 9.6906 5.7927 9.9367 5.3034C10.1823 4.8146 10.5319 4.4323 10.985 4.1559C11.4381 3.88 11.9762 3.7418 12.6002 3.7418C13.3385 3.7418 13.9415 3.922 14.4093 4.2818C14.8776 4.6422 15.1744 5.1461 15.3004 5.794H14.2384C14.1544 5.4283 13.9742 5.1368 13.6984 4.921C13.4226 4.7052 13.0534 4.5968 12.5915 4.5968C11.9616 4.5968 11.4636 4.8116 11.0974 5.2404C10.7317 5.6696 10.5486 6.259 10.5486 7.009C10.5486 7.7531 10.7317 8.3381 11.0974 8.7639Z" 2811 /> 2812 </svg> 2813 <svg aria-hidden="true" viewBox="0 0 18 14" slot="off"> 2814 <path 2815 d="M5.73219 10.258C5.10819 10.258 4.57009 10.1218 4.11699 9.8488C3.66389 9.5758 3.31429 9.1945 3.06869 8.7057C2.82259 8.2164 2.69958 7.651 2.69958 7.0089C2.69958 6.361 2.82259 5.7926 3.06869 5.3033C3.31429 4.8145 3.66389 4.4322 4.11699 4.1558C4.57009 3.8799 5.10819 3.7417 5.73219 3.7417C6.47049 3.7417 7.07348 3.9219 7.54128 4.2817C8.00958 4.6421 8.30638 5.146 8.43238 5.7939H7.37039C7.28639 5.4282 7.10618 5.1367 6.83039 4.9209C6.55459 4.7051 6.18538 4.5967 5.72348 4.5967C5.09358 4.5967 4.59559 4.8115 4.22939 5.2403C3.86369 5.6695 3.68058 6.2589 3.68058 7.0089C3.68058 7.753 3.86369 8.338 4.22939 8.7638C4.59559 9.1901 5.09368 9.403 5.72348 9.403C6.18538 9.403 6.55459 9.3009 6.83039 9.0968C7.10629 8.8932 7.28649 8.6139 7.37039 8.2599H8.43238C8.30638 8.8839 8.00948 9.3732 7.54128 9.7272C7.07348 10.0812 6.47049 10.258 5.73219 10.258Z" 2816 /> 2817 <path 2818 d="M12.6003 10.258C11.9763 10.258 11.4382 10.1218 10.9851 9.8488C10.532 9.5758 10.1824 9.1945 9.93685 8.7057C9.69075 8.2164 9.56775 7.651 9.56775 7.0089C9.56775 6.361 9.69075 5.7926 9.93685 5.3033C10.1824 4.8145 10.532 4.4322 10.9851 4.1558C11.4382 3.8799 11.9763 3.7417 12.6003 3.7417C13.3386 3.7417 13.9416 3.9219 14.4094 4.2817C14.8777 4.6421 15.1745 5.146 15.3005 5.7939H14.2385C14.1545 5.4282 13.9743 5.1367 13.6985 4.9209C13.4227 4.7051 13.0535 4.5967 12.5916 4.5967C11.9617 4.5967 11.4637 4.8115 11.0975 5.2403C10.7318 5.6695 10.5487 6.2589 10.5487 7.0089C10.5487 7.753 10.7318 8.338 11.0975 8.7638C11.4637 9.1901 11.9618 9.403 12.5916 9.403C13.0535 9.403 13.4227 9.3009 13.6985 9.0968C13.9744 8.8932 14.1546 8.6139 14.2385 8.2599H15.3005C15.1745 8.8839 14.8776 9.3732 14.4094 9.7272C13.9416 10.0812 13.3386 10.258 12.6003 10.258Z" 2819 /> 2820 <path 2821 d="M15.9891 1C16.5465 1 17 1.4535 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H2.0109C1.4535 13 1 12.5465 1 11.9891V2.0109C1 1.4535 1.4535 0.9999 2.0109 0.9999L15.9891 1ZM15.9891 0H2.0109C0.9003 0 0 0.9003 0 2.0109V11.9891C0 13.0997 0.9003 14 2.0109 14H15.9891C17.0997 14 18 13.0997 18 11.9891V2.0109C18 0.9003 17.0997 0 15.9891 0Z" 2822 /> 2823 </svg> 2824 </media-captions-menu-button> 2825 <media-captions-menu 2826 hidden 2827 anchor="auto" 2828 part="bottom captions menu" 2829 disabled="{{disabled}}" 2830 aria-disabled="{{disabled}}" 2831 exportparts="menu-item" 2832 > 2833 <div slot="checked-indicator"> 2834 <style> 2835 .indicator { 2836 position: relative; 2837 top: 1px; 2838 width: 0.9em; 2839 height: auto; 2840 fill: var(--_accent-color); 2841 margin-right: 5px; 2842 } 2843 2844 [aria-checked='false'] .indicator { 2845 display: none; 2846 } 2847 </style> 2848 <svg viewBox="0 0 14 18" class="indicator"> 2849 <path 2850 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 2851 fill-rule="evenodd" 2852 /> 2853 </svg></div 2854 ></media-captions-menu> 2855 </template> 2856 2857 <template partial="AirplayButton"> 2858 <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2859 <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon"> 2860 <path 2861 d="M16.1383 0H1.8618C0.8335 0 0 0.8335 0 1.8617V10.1382C0 11.1664 0.8335 12 1.8618 12H3.076C3.1204 11.9433 3.1503 11.8785 3.2012 11.826L4.004 11H1.8618C1.3866 11 1 10.6134 1 10.1382V1.8617C1 1.3865 1.3866 0.9999 1.8618 0.9999H16.1383C16.6135 0.9999 17.0001 1.3865 17.0001 1.8617V10.1382C17.0001 10.6134 16.6135 11 16.1383 11H13.9961L14.7989 11.826C14.8499 11.8785 14.8798 11.9432 14.9241 12H16.1383C17.1665 12 18.0001 11.1664 18.0001 10.1382V1.8617C18 0.8335 17.1665 0 16.1383 0Z" 2862 /> 2863 <path 2864 d="M9.55061 8.21903C9.39981 8.06383 9.20001 7.98633 9.00011 7.98633C8.80021 7.98633 8.60031 8.06383 8.44951 8.21903L4.09771 12.697C3.62471 13.1838 3.96961 13.9998 4.64831 13.9998H13.3518C14.0304 13.9998 14.3754 13.1838 13.9023 12.697L9.55061 8.21903Z" 2865 /> 2866 </svg> 2867 </media-airplay-button> 2868 </template> 2869 2870 <template partial="FullscreenButton"> 2871 <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2872 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2873 <path 2874 d="M1.00745 4.39539L1.01445 1.98789C1.01605 1.43049 1.47085 0.978289 2.02835 0.979989L6.39375 0.992589L6.39665 -0.007411L2.03125 -0.020011C0.920646 -0.023211 0.0176463 0.874489 0.0144463 1.98509L0.00744629 4.39539H1.00745Z" 2875 /> 2876 <path 2877 d="M17.0144 2.03431L17.0076 4.39541H18.0076L18.0144 2.03721C18.0176 0.926712 17.1199 0.0237125 16.0093 0.0205125L11.6439 0.0078125L11.641 1.00781L16.0064 1.02041C16.5638 1.02201 17.016 1.47681 17.0144 2.03431Z" 2878 /> 2879 <path 2880 d="M16.9925 9.60498L16.9855 12.0124C16.9839 12.5698 16.5291 13.022 15.9717 13.0204L11.6063 13.0078L11.6034 14.0078L15.9688 14.0204C17.0794 14.0236 17.9823 13.1259 17.9855 12.0153L17.9925 9.60498H16.9925Z" 2881 /> 2882 <path 2883 d="M0.985626 11.9661L0.992426 9.60498H-0.0074737L-0.0142737 11.9632C-0.0174737 13.0738 0.880226 13.9767 1.99083 13.98L6.35623 13.9926L6.35913 12.9926L1.99373 12.98C1.43633 12.9784 0.983926 12.5236 0.985626 11.9661Z" 2884 /> 2885 </svg> 2886 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2887 <path 2888 d="M5.39655 -0.0200195L5.38955 2.38748C5.38795 2.94488 4.93315 3.39708 4.37565 3.39538L0.0103463 3.38278L0.00744629 4.38278L4.37285 4.39538C5.48345 4.39858 6.38635 3.50088 6.38965 2.39028L6.39665 -0.0200195H5.39655Z" 2889 /> 2890 <path 2891 d="M12.6411 2.36891L12.6479 0.0078125H11.6479L11.6411 2.36601C11.6379 3.47651 12.5356 4.37951 13.6462 4.38271L18.0116 4.39531L18.0145 3.39531L13.6491 3.38271C13.0917 3.38111 12.6395 2.92641 12.6411 2.36891Z" 2892 /> 2893 <path 2894 d="M12.6034 14.0204L12.6104 11.613C12.612 11.0556 13.0668 10.6034 13.6242 10.605L17.9896 10.6176L17.9925 9.61759L13.6271 9.60499C12.5165 9.60179 11.6136 10.4995 11.6104 11.6101L11.6034 14.0204H12.6034Z" 2895 /> 2896 <path 2897 d="M5.359 11.6315L5.3522 13.9926H6.3522L6.359 11.6344C6.3622 10.5238 5.4645 9.62088 4.3539 9.61758L-0.0115043 9.60498L-0.0144043 10.605L4.351 10.6176C4.9084 10.6192 5.3607 11.074 5.359 11.6315Z" 2898 /> 2899 </svg> 2900 </media-fullscreen-button> 2901 </template> 2902 2903 <template partial="CastButton"> 2904 <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2905 <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter"> 2906 <path 2907 d="M16.0072 0H2.0291C0.9185 0 0.0181 0.9003 0.0181 2.011V5.5009C0.357 5.5016 0.6895 5.5275 1.0181 5.5669V2.011C1.0181 1.4536 1.4716 1 2.029 1H16.0072C16.5646 1 17.0181 1.4536 17.0181 2.011V11.9891C17.0181 12.5465 16.5646 13 16.0072 13H8.4358C8.4746 13.3286 8.4999 13.6611 8.4999 13.9999H16.0071C17.1177 13.9999 18.018 13.0996 18.018 11.989V2.011C18.0181 0.9003 17.1178 0 16.0072 0ZM0 6.4999V7.4999C3.584 7.4999 6.5 10.4159 6.5 13.9999H7.5C7.5 9.8642 4.1357 6.4999 0 6.4999ZM0 8.7499V9.7499C2.3433 9.7499 4.25 11.6566 4.25 13.9999H5.25C5.25 11.1049 2.895 8.7499 0 8.7499ZM0.0181 11V14H3.0181C3.0181 12.3431 1.675 11 0.0181 11Z" 2908 /> 2909 </svg> 2910 <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit"> 2911 <path 2912 d="M15.9891 0H2.01103C0.900434 0 3.35947e-05 0.9003 3.35947e-05 2.011V5.5009C0.338934 5.5016 0.671434 5.5275 1.00003 5.5669V2.011C1.00003 1.4536 1.45353 1 2.01093 1H15.9891C16.5465 1 17 1.4536 17 2.011V11.9891C17 12.5465 16.5465 13 15.9891 13H8.41773C8.45653 13.3286 8.48183 13.6611 8.48183 13.9999H15.989C17.0996 13.9999 17.9999 13.0996 17.9999 11.989V2.011C18 0.9003 17.0997 0 15.9891 0ZM-0.0180664 6.4999V7.4999C3.56593 7.4999 6.48193 10.4159 6.48193 13.9999H7.48193C7.48193 9.8642 4.11763 6.4999 -0.0180664 6.4999ZM-0.0180664 8.7499V9.7499C2.32523 9.7499 4.23193 11.6566 4.23193 13.9999H5.23193C5.23193 11.1049 2.87693 8.7499 -0.0180664 8.7499ZM3.35947e-05 11V14H3.00003C3.00003 12.3431 1.65693 11 3.35947e-05 11Z" 2913 /> 2914 <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" /> 2915 </svg> 2916 </media-cast-button> 2917 </template> 2918 2919 <template partial="LiveButton"> 2920 <media-live-button part="{{section ?? 'top'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}"> 2921 <span slot="text">Live</span> 2922 </media-live-button> 2923 </template> 2924 2925 <template partial="PlaybackRateMenu"> 2926 <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button> 2927 <media-playback-rate-menu 2928 hidden 2929 anchor="auto" 2930 rates="{{playbackrates}}" 2931 exportparts="menu-item" 2932 part="bottom playback-rate menu" 2933 disabled="{{disabled}}" 2934 aria-disabled="{{disabled}}" 2935 ></media-playback-rate-menu> 2936 </template> 2937 2938 <template partial="VolumeRange"> 2939 <media-volume-range 2940 part="bottom volume range" 2941 disabled="{{disabled}}" 2942 aria-disabled="{{disabled}}" 2943 ></media-volume-range> 2944 </template> 2945 2946 <template partial="TimeDisplay"> 2947 <media-time-display 2948 remaining="{{defaultshowremainingtime}}" 2949 showduration="{{!hideduration}}" 2950 part="bottom time display" 2951 disabled="{{disabled}}" 2952 aria-disabled="{{disabled}}" 2953 ></media-time-display> 2954 </template> 2955 2956 <template partial="TimeRange"> 2957 <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}"
2957> 2958 <media-preview-thumbnail slot="preview"></media-preview-thumbnail> 2959 <media-preview-chapter-display slot="preview"></media-preview-chapter-display> 2960 <media-preview-time-display slot="preview"></media-preview-time-display> 2961 <div slot="preview" part="arrow"></div> 2962 </media-time-range> 2963 </template> 2964 2965 <template partial="AudioTrackMenu"> 2966 <media-audio-track-menu-button part="bottom audio-track button"> 2967 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16"> 2968 <path d="M9 15A7 7 0 1 1 9 1a7 7 0 0 1 0 14Zm0 1A8 8 0 1 0 9 0a8 8 0 0 0 0 16Z" /> 2969 <path 2970 d="M5.2 6.3a.5.5 0 0 1 .5.5v2.4a.5.5 0 1 1-1 0V6.8a.5.5 0 0 1 .5-.5Zm2.4-2.4a.5.5 0 0 1 .5.5v7.2a.5.5 0 0 1-1 0V4.4a.5.5 0 0 1 .5-.5ZM10 5.5a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5Zm2.4-.8a.5.5 0 0 1 .5.5v5.6a.5.5 0 0 1-1 0V5.2a.5.5 0 0 1 .5-.5Z" 2971 /> 2972 </svg> 2973 </media-audio-track-menu-button> 2974 <media-audio-track-menu 2975 hidden 2976 anchor="auto" 2977 part="bottom audio-track menu" 2978 disabled="{{disabled}}" 2979 aria-disabled="{{disabled}}" 2980 exportparts="menu-item" 2981 > 2982 <div slot="checked-indicator"> 2983 <style> 2984 .indicator { 2985 position: relative; 2986 top: 1px; 2987 width: 0.9em; 2988 height: auto; 2989 fill: var(--_accent-color); 2990 margin-right: 5px; 2991 } 2992 2993 [aria-checked='false'] .indicator { 2994 display: none; 2995 } 2996 </style> 2997 <svg viewBox="0 0 14 18" class="indicator"> 2998 <path 2999 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 3000 fill-rule="evenodd" 3001 /> 3002 </svg> 3003 </div> 3004 </media-audio-track-menu> 3005 </template> 3006 3007 <template partial="RenditionMenu"> 3008 <media-rendition-menu-button part="bottom rendition button"> 3009 <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14"> 3010 <path 3011 d="M2.25 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM9 9a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm6.75 0a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" 3012 /> 3013 </svg> 3014 </media-rendition-menu-button> 3015 <media-rendition-menu 3016 hidden 3017 anchor="auto" 3018 part="bottom rendition menu" 3019 disabled="{{disabled}}" 3020 aria-disabled="{{disabled}}" 3021 > 3022 <div slot="checked-indicator"> 3023 <style> 3024 .indicator { 3025 position: relative; 3026 top: 1px; 3027 width: 0.9em; 3028 height: auto; 3029 fill: var(--_accent-color); 3030 margin-right: 5px; 3031 } 3032 3033 [aria-checked='false'] .indicator { 3034 opacity: 0; 3035 } 3036 </style> 3037 <svg viewBox="0 0 14 18" class="indicator"> 3038 <path 3039 d="M12.252 3.48c-.115.033-.301.161-.425.291-.059.063-1.407 1.815-2.995 3.894s-2.897 3.79-2.908 3.802c-.013.014-.661-.616-1.672-1.624-.908-.905-1.702-1.681-1.765-1.723-.401-.27-.783-.211-1.176.183a1.285 1.285 0 0 0-.261.342.582.582 0 0 0-.082.35c0 .165.01.205.08.35.075.153.213.296 2.182 2.271 1.156 1.159 2.17 2.159 2.253 2.222.189.143.338.196.539.194.203-.003.412-.104.618-.299.205-.193 6.7-8.693 6.804-8.903a.716.716 0 0 0 .085-.345c.01-.179.005-.203-.062-.339-.124-.252-.45-.531-.746-.639a.784.784 0 0 0-.469-.027" 3040 fill-rule="evenodd" 3041 /> 3042 </svg> 3043 </div> 3044 </media-rendition-menu> 3045 </template> 3046 3047 <template partial="MuxBadge"> 3048 <div part="mux-badge"> 3049 <a href="https://www.mux.com/player" target="_blank"> 3050 <span class="mux-badge-text">Powered by</span> 3051 <div class="mux-badge-logo"> 3052 <svg
3053 viewBox="0 0 1600 500" 3054 style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2" 3055 > 3056 <g> 3057 <path 3058 d="M994.287,93.486c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m0,-93.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,68.943 -56.09,125.033 -125.032,125.033c-68.942,-0 -125.03,-56.09 -125.03,-125.033l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486c-34.509,-0 -62.484,27.976 -62.484,62.486l0,187.511c0,137.853 112.149,250.003 249.999,250.003c137.851,-0 250.001,-112.15 250.001,-250.003l0,-187.511c0,-34.51 -27.976,-62.486 -62.485,-62.486" 3059 style="fill-rule: nonzero" 3060 ></path> 3061 <path 3062 d="M1537.51,468.511c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m-275.883,-218.509l-143.33,143.329c-24.402,24.402 -24.402,63.966 0,88.368c24.402,24.402 63.967,24.402 88.369,-0l143.33,-143.329l143.328,143.329c24.402,24.4 63.967,24.402 88.369,-0c24.403,-24.402 24.403,-63.966 0.001,-88.368l-143.33,-143.329l0.001,-0.004l143.329,-143.329c24.402,-24.402 24.402,-63.965 0,-88.367c-24.402,-24.402 -63.967,-24.402 -88.369,-0l-143.329,143.328l-143.329,-143.328c-24.402,-24.401 -63.967,-24.402 -88.369,-0c-24.402,24.402 -24.402,63.965 0,88.367l143.329,143.329l0,0.004Z" 3063 style="fill-rule: nonzero" 3064 ></path> 3065 <path 3066 d="M437.511,468.521c-17.121,-0 -31,-13.879 -31,-31c0,-17.121 13.879,-31 31,-31c17.121,-0 31,13.879 31,31c0,17.121 -13.879,31 -31,31m23.915,-463.762c-23.348,-9.672 -50.226,-4.327 -68.096,13.544l-143.331,143.329l-143.33,-143.329c-17.871,-17.871 -44.747,-23.216 -68.096,-13.544c-23.349,9.671 -38.574,32.455 -38.574,57.729l0,375.026c0,34.51 27.977,62.486 62.487,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-224.173l80.843,80.844c24.404,24.402 63.965,24.402 88.369,-0l80.843,-80.844l0,224.173c0,34.51 27.976,62.486 62.486,62.486c34.51,-0 62.486,-27.976 62.486,-62.486l0,-375.026c0,-25.274 -15.224,-48.058 -38.573,-57.729" 3067 style="fill-rule: nonzero" 3068 ></path> 3069 </g> 3070 </svg> 3071 </div> 3072 </a> 3073 </div> 3074 </template> 3075 3076 <media-controller 3077 part="controller" 3078 defaultstreamtype="{{defaultstreamtype ?? 'on-demand'}}" 3079 breakpoints="sm:470" 3080 gesturesdisabled="{{disabled}}" 3081 hotkeys="{{hotkeys}}" 3082 nohotkeys="{{nohotkeys}}" 3083 novolumepref="{{novolumepref}}" 3084 audio="{{audio}}" 3085 noautoseektolive="{{noautoseektolive}}" 3086 defaultsubtitles="{{defaultsubtitles}}" 3087 defaultduration="{{defaultduration ?? false}}" 3088 keyboardforwardseekoffset="{{forwardseekoffset}}" 3089 keyboardbackwardseekoffset="{{backwardseekoffset}}" 3090 exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer" 3091 style="--_pre-playback-place:{{preplaybackplace ?? 'center'}}" 3092 > 3093 <slot name="media" slot="media"></slot> 3094 <slot name="poster" slot="poster"></slot> 3095 3096 <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator> 3097 <media-error-dialog slot="dialog" noautohide></media-error-dialog> 3098 3099 <template if="!audio"> 3100 <!-- Pre-playback UI --> 3101 <!-- same for both on-demand and live --> 3102 <div slot="centered-chrome" class="center-controls pre-playback"> 3103 <template if="!breakpointsm">{{>PlayButton section="center"}}</template> 3104 <template if="breakpointsm">{{>PrePlayButton section="center"}}</template> 3105 </div> 3106 3107 <!-- Mux Badge --> 3108 <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template> 3109 3110 <!-- Autoplay centered unmute button --> 3111 <!-- 3112 todo: figure out how show this with available state variables 3113 needs to show when: 3114 - autoplay is enabled 3115 - playback has been successful 3116 - audio is muted 3117 - in place / instead of the pre-plaback play button 3118 - not to show again after user has interacted with this button 3119 - OR user has interacted with the mute button in the control bar 3120 --> 3121 <!-- 3122 There should be a >MuteButton to the left of the "Unmute" text, but a templating bug 3123 makes it appear even if commented out in the markup, add it back when code is un-commented 3124 --> 3125 <!-- <div slot="centered-chrome" class="autoplay-unmute"> 3126 <div role="button" class="autoplay-unmute-btn">Unmute</div> 3127 </div> --> 3128 3129 <template if="streamtype == 'on-demand'"> 3130 <template if="breakpointsm"> 3131 <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar> 3132 </template> 3133 {{>TimeRange}} 3134 <media-control-bar part="control-bar bottom"> 3135 {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}} 3136 {{>VolumeRange}} 3137 <div class="spacer"></div> 3138 {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} 3139 {{>CastButton}} {{>PipButton}} {{>FullscreenButton}} 3140 </media-control-bar> 3141 </template> 3142 3143 <template if="streamtype == 'live'"> 3144 <media-control-bar part="control-bar top" slot="top-chrome"> 3145 {{>LiveButton}} 3146 <template if="breakpointsm"> {{>TitleDisplay}} </template> 3147 </media-control-bar> 3148 <template if="targetlivewindow > 0">{{>TimeRange}}</template> 3149 <media-control-bar part="control-bar bottom"> 3150 {{>PlayButton}} 3151 <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template> 3152 {{>MuteButton}} {{>VolumeRange}} 3153 <div class="spacer"></div> 3154 {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}} 3155 {{>FullscreenButton}} 3156 </media-control-bar> 3157 </template> 3158 </template> 3159 3160 <template if="audio"> 3161 <template if="streamtype == 'on-demand'"> 3162 <template if="title"> 3163 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3164 </template> 3165 <media-control-bar part="control-bar bottom"> 3166 {{>PlayButton}} 3167 <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3168 {{>MuteButton}} 3169 <template if="breakpointsm">{{>VolumeRange}}</template> 3170 {{>TimeDisplay}} {{>TimeRange}} 3171 <template if="breakpointsm">{{>PlaybackRateMenu}}</template> 3172 {{>AirplayButton}} {{>CastButton}} 3173 </media-control-bar> 3174 </template> 3175 3176 <template if="streamtype == 'live'"> 3177 <template if="title"> 3178 <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar> 3179 </template> 3180 <media-control-bar part="control-bar bottom"> 3181 {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}} 3182 <template if="breakpointsm"> 3183 {{>VolumeRange}} 3184 <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template> 3185 </template> 3186 <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template> 3187 <template if="!targetlivewindow"><div class="spacer"></div></template> 3188 {{>AirplayButton}} {{>CastButton}} 3189 </media-control-bar> 3190 </template> 3191 </template> 3192 3193 <slot></slot> 3194 </media-controller> 3195</template> 3196`,Uh=Tm.createElement("template");"innerHTML"in Uh&&(Uh.innerHTML=JC);var t0,i0,Cb=class extends eu{};Cb.template=(i0=(t0=Uh.content)==null?void 0:t0.children)==null?void 0:i0[0];xi.customElements.get("media-theme-gerwig")||xi.customElements.define("media-theme-gerwig",Cb);var eM="gerwig",Ki={SRC:"src",POSTER:"poster"},U={STYLE:"style",DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",ACCENT_COLOR:"accent-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",P
vendor: 4,392 bytes, lines 3196-3208
3196LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",DRM_TOKEN:"drm-token",STORYBOARD_SRC:"storyboard-src",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio",NOHOTKEYS:"nohotkeys",HOTKEYS:"hotkeys",PLAYBACK_RATES:"playbackrates",DEFAULT_SHOW_REMAINING_TIME:"default-show-remaining-time",DEFAULT_DURATION:"default-duration",TITLE:"title",VIDEO_TITLE:"video-title",PLACEHOLDER:"placeholder",THEME:"theme",DEFAULT_STREAM_TYPE:"default-stream-type",TARGET_LIVE_WINDOW:"target-live-window",EXTRA_SOURCE_PARAMS:"extra-source-params",NO_VOLUME_PREF:"no-volume-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge"},Fh=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","proudlydisplaymuxbadge"];function tM(i,e){var t,r;return{src:!i.playbackId&&i.src,playbackId:i.playbackId,hasSrc:!!i.playbackId||!!i.src||!!i.currentSrc,poster:i.poster,storyboard:i.storyboard,storyboardSrc:i.getAttribute(U.STORYBOARD_SRC),placeholder:i.getAttribute("placeholder"),themeTemplate:rM(i),thumbnailTime:!i.tokens.thumbnail&&i.thumbnailTime,autoplay:i.autoplay,crossOrigin:i.crossOrigin,loop:i.loop,noHotKeys:i.hasAttribute(U.NOHOTKEYS),hotKeys:i.getAttribute(U.HOTKEYS),muted:i.muted,paused:i.paused,preload:i.preload,envKey:i.envKey,preferCmcd:i.preferCmcd,debug:i.debug,disableTracking:i.disableTracking,disableCookies:i.disableCookies,tokens:i.tokens,beaconCollectionDomain:i.beaconCollectionDomain,maxResolution:i.maxResolution,minResolution:i.minResolution,programStartTime:i.programStartTime,programEndTime:i.programEndTime,assetStartTime:i.assetStartTime,assetEndTime:i.assetEndTime,renditionOrder:i.renditionOrder,metadata:i.metadata,playerInitTime:i.playerInitTime,playerSoftwareName:i.playerSoftwareName,playerSoftwareVersion:i.playerSoftwareVersion,startTime:i.startTime,preferPlayback:i.preferPlayback,audio:i.audio,defaultStreamType:i.defaultStreamType,targetLiveWindow:i.getAttribute(D.TARGET_LIVE_WINDOW),streamType:_m(i.getAttribute(D.STREAM_TYPE)),primaryColor:i.getAttribute(U.PRIMARY_COLOR),secondaryColor:i.getAttribute(U.SECONDARY_COLOR),accentColor:i.getAttribute(U.ACCENT_COLOR),forwardSeekOffset:i.forwardSeekOffset,backwardSeekOffset:i.backwardSeekOffset,defaultHiddenCaptions:i.defaultHiddenCaptions,defaultDuration:i.defaultDuration,defaultShowRemainingTime:i.defaultShowRemainingTime,hideDuration:sM(i),playbackRates:i.getAttribute(U.PLAYBACK_RATES),customDomain:(t=i.getAttribute(D.CUSTOM_DOMAIN))!=null?t:void 0,title:i.getAttribute(U.TITLE),videoTitle:(r=i.getAttribute(U.VIDEO_TITLE))!=null?r:i.getAttribute(U.TITLE),novolumepref:i.hasAttribute(U.NO_VOLUME_PREF),proudlyDisplayMuxBadge:i.hasAttribute(U.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:i.castReceiver,...e,extraSourceParams:i.extraSourceParams}}var iM=Iy.formatErrorMessage;Iy.formatErrorMessage=i=>{var e,t;if(i instanceof G){let r=QC(i,!1);return` 3197 ${r!=null&&r.title?`<h3>${r.title}</h3>`:""} 3198 ${r!=null&&r.message||r!=null&&r.linkUrl?`<p> 3199 ${r==null?void 0:r.message} 3200 ${r!=null&&r.linkUrl?`<a 3201 href="${r.linkUrl}" 3202 target="_blank" 3203 rel="external noopener" 3204 aria-label="${(e=r.linkText)!=null?e:""} ${Z("(opens in a new window)")}" 3205 >${(t=r.linkText)!=null?t:r.linkUrl}</a 3206 >`:""} 3207 </p>`:""} 3208 `}return iM(i)};function rM(i){var e,t;let r=i.theme;if(r){let s=(t=(e=i.getRootNode())==null?void 0:e.getElementById)==null?void 0:t.call(e,r);if(s&&s instanceof HTMLTemplateElement)return s;r.startsWith("media-theme-")||(r=`media-theme-${r}`);let n=xi.customElements.get(r);if(n!=null&&n.template)return n.template}}function sM(i){var e;let t=(e=i.mediaController)==null?void 0:e.querySelector("media-time-display");return t&&getComputedStyle(t).getPropertyValue("--media-duration-display-display").trim()==="none"}function r0(i){let e=i.videoTitle?{video_title:i.videoTitle}:{};return i.getAttributeNames().filter(t=>t.startsWith("metadata-")).reduce((t,r)=>{let s=i.getAttribute(r);return s!==null&&(t[r.replace(/^metadata-/,"").replace(/-/g,"_")
vendor: 4,271 bytes, line 3208
3208]=s),t},e)}var nM=Object.values(D),aM=Object.values(Ki),oM=Object.values(U),s0=Rb(),n0="mux-player",a0={isDialogOpen:!1},lM={redundant_streams:!0},Yl,ql,jl,es,zl,En,Ve,pr,Mb,$h,ts,o0,l0,d0,u0,dM=class extends Qg{constructor(){super(),ii(this,Ve),ii(this,Yl),ii(this,ql,!1),ii(this,jl,{}),ii(this,es,!0),ii(this,zl,new RC(this,"hotkeys")),ii(this,En,{...a0,onCloseErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&Ze(this,Ve,$h).call(this,{isDialogOpen:!1})},onFocusInErrorDialog:i=>{var e;((e=i.composedPath()[0])==null?void 0:e.localName)==="media-error-dialog"&&(Sb(this,Tm.activeElement)||i.preventDefault())}}),Mi(this,Yl,rE()),this.attachShadow({mode:"open"}),Ze(this,Ve,Mb).call(this),this.isConnected&&Ze(this,Ve,pr).call(this)}static get NAME(){return n0}static get VERSION(){return s0}static get observedAttributes(){var i;return[...(i=Qg.observedAttributes)!=null?i:[],...aM,...nM,...oM]}get mediaTheme(){var i;return(i=this.shadowRoot)==null?void 0:i.querySelector("media-theme")}get mediaController(){var i,e;return(e=(i=this.mediaTheme)==null?void 0:i.shadowRoot)==null?void 0:e.querySelector("media-controller")}connectedCallback(){let i=this.media;i&&(i.metadata=r0(this))}attributeChangedCallback(i,e,t){switch(Ze(this,Ve,pr).call(this),super.attributeChangedCallback(i,e,t),i){case U.HOTKEYS:Re(this,zl).value=t;break;case U.THUMBNAIL_TIME:{t!=null&&this.tokens.thumbnail&&qi(Z("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break}case U.THUMBNAIL_TOKEN:{if(t){let r=cn(t);if(r){let{aud:s}=r,n=xa.THUMBNAIL;s!==n&&qi(Z("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:s,expectedAud:n,tokenNamePrefix:"thumbnail"}))}}break}case U.STORYBOARD_TOKEN:{if(t){let r=cn(t);if(r){let{aud:s}=r,n=xa.STORYBOARD;s!==n&&qi(Z("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:s,expectedAud:n,tokenNamePrefix:"storyboard"}))}}break}case U.DRM_TOKEN:{if(t){let r=cn(t);if(r){let{aud:s}=r,n=xa.DRM;s!==n&&qi(Z("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:s,expectedAud:n,tokenNamePrefix:"drm"}))}}break}case D.PLAYBACK_ID:{t!=null&&t.includes("?token")&&Gt(Z("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:t}));break}case D.STREAM_TYPE:t&&![xe.LIVE,xe.ON_DEMAND,xe.UNKNOWN].includes(t)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=t.includes("dvr")?Number.POSITIVE_INFINITY:0:Ib({file:"invalid-stream-type.md",message:Z("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):t===xe.LIVE?this.getAttribute(U.TARGET_LIVE_WINDOW)==null&&(this.targetLiveWindow=0):this.targetLiveWindow=Number.NaN}[D.PLAYBACK_ID,Ki.SRC,U.PLAYBACK_TOKEN].includes(i)&&e!==t&&Mi(this,En,{...Re(this,En),...a0}),Ze(this,Ve,ts).call(this,{[xC(i)]:t})}async requestFullscreen(i){var e;if(!(!this.mediaController||this.mediaController.hasAttribute(T.MEDIA_IS_FULLSCREEN)))return(e=this.mediaController)==null||e.dispatchEvent(new xi.CustomEvent(j.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((t,r)=>{var s;(s=this.mediaController)==null||s.addEventListener(Ji.MEDIA_IS_FULLSCREEN,()=>t(),{once:!0})})}async exitFullscreen(){var i;if(!(!this.mediaController||!this.mediaController.hasAttribute(T.MEDIA_IS_FULLSCREEN)))return(i=this.mediaController)==null||i.dispatchEvent(new xi.CustomEvent(j.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var r;(r=this.mediaController)==null||r.addEventListener(Ji.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var i;return(i=this.getAttribute(D.PREFER_CMCD))!=null?i:void 0}set preferCmcd(i){i!==this.preferCmcd&&(i?cd.includes(i)?this.setAttribute(D.PREFER_CMCD,i):qi(`Invalid value for preferCmcd. Must be one of ${cd.join()}`):this.removeAttribute(D.PREFER_CMCD))}get hasPlayed(){var i,e;return(e=(i=this.mediaController)==null?void 0:i.hasAttribute(T.MEDIA_HAS_P
vendor: 10,158 bytes, line 3208
3208LAYED))!=null?e:!1}get inLiveWindow(){var i;return(i=this.mediaController)==null?void 0:i.hasAttribute(T.MEDIA_TIME_IS_LIVE)}get _hls(){var i;return(i=this.media)==null?void 0:i._hls}get mux(){var i;return(i=this.media)==null?void 0:i.mux}get theme(){var i;return(i=this.getAttribute(U.THEME))!=null?i:eM}set theme(i){this.setAttribute(U.THEME,`${i}`)}get themeProps(){let i=this.mediaTheme;if(!i)return;let e={};for(let t of i.getAttributeNames()){if(Fh.includes(t))continue;let r=i.getAttribute(t);e[_b(t)]=r===""?!0:r}return e}set themeProps(i){var e,t;Ze(this,Ve,pr).call(this);let r={...this.themeProps,...i};for(let s in r){if(Fh.includes(s))continue;let n=i==null?void 0:i[s];typeof n=="boolean"||n==null?(e=this.mediaTheme)==null||e.toggleAttribute(Nh(s),!!n):(t=this.mediaTheme)==null||t.setAttribute(Nh(s),n)}}get playbackId(){var i;return(i=this.getAttribute(D.PLAYBACK_ID))!=null?i:void 0}set playbackId(i){i?this.setAttribute(D.PLAYBACK_ID,i):this.removeAttribute(D.PLAYBACK_ID)}get src(){var i,e;return this.playbackId?(i=Gr(this,Ki.SRC))!=null?i:void 0:(e=this.getAttribute(Ki.SRC))!=null?e:void 0}set src(i){i?this.setAttribute(Ki.SRC,i):this.removeAttribute(Ki.SRC)}get poster(){var i;let e=this.getAttribute(Ki.POSTER);if(e!=null)return e;let{tokens:t}=this;if(t.playback&&!t.thumbnail){qi("Missing expected thumbnail token. No poster image will be shown");return}if(this.playbackId&&!this.audio)return _C(this.playbackId,{customDomain:this.customDomain,thumbnailTime:(i=this.thumbnailTime)!=null?i:this.startTime,programTime:this.programStartTime,token:t.thumbnail})}set poster(i){i||i===""?this.setAttribute(Ki.POSTER,i):this.removeAttribute(Ki.POSTER)}get storyboardSrc(){var i;return(i=this.getAttribute(U.STORYBOARD_SRC))!=null?i:void 0}set storyboardSrc(i){i?this.setAttribute(U.STORYBOARD_SRC,i):this.removeAttribute(U.STORYBOARD_SRC)}get storyboard(){let{tokens:i}=this;if(this.storyboardSrc&&!i.storyboard)return this.storyboardSrc;if(!(this.audio||!this.playbackId||!this.streamType||[xe.LIVE,xe.UNKNOWN].includes(this.streamType)||i.playback&&!i.storyboard))return AC(this.playbackId,{customDomain:this.customDomain,token:i.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(U.AUDIO)}set audio(i){if(!i){this.removeAttribute(U.AUDIO);return}this.setAttribute(U.AUDIO,"")}get hotkeys(){return Re(this,zl)}get nohotkeys(){return this.hasAttribute(U.NOHOTKEYS)}set nohotkeys(i){if(!i){this.removeAttribute(U.NOHOTKEYS);return}this.setAttribute(U.NOHOTKEYS,"")}get thumbnailTime(){return Ct(this.getAttribute(U.THUMBNAIL_TIME))}set thumbnailTime(i){this.setAttribute(U.THUMBNAIL_TIME,`${i}`)}get videoTitle(){var i,e;return(e=(i=this.getAttribute(U.VIDEO_TITLE))!=null?i:this.getAttribute(U.TITLE))!=null?e:""}set videoTitle(i){i!==this.videoTitle&&(i?this.setAttribute(U.VIDEO_TITLE,i):this.removeAttribute(U.VIDEO_TITLE))}get placeholder(){var i;return(i=Gr(this,U.PLACEHOLDER))!=null?i:""}set placeholder(i){this.setAttribute(U.PLACEHOLDER,`${i}`)}get primaryColor(){var i,e;let t=this.getAttribute(U.PRIMARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=xi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_primary-color"))==null?void 0:e.trim(),t))return t}set primaryColor(i){this.setAttribute(U.PRIMARY_COLOR,`${i}`)}get secondaryColor(){var i,e;let t=this.getAttribute(U.SECONDARY_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=xi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_secondary-color"))==null?void 0:e.trim(),t))return t}set secondaryColor(i){this.setAttribute(U.SECONDARY_COLOR,`${i}`)}get accentColor(){var i,e;let t=this.getAttribute(U.ACCENT_COLOR);if(t!=null||this.mediaTheme&&(t=(e=(i=xi.getComputedStyle(this.mediaTheme))==null?void 0:i.getPropertyValue("--_accent-color"))==null?void 0:e.trim(),t))return t}set accentColor(i){this.setAttribute(U.ACCENT_COLOR,`${i}`)}get defaultShowRemainingTime(){return this.hasAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(i){i?this.setAttribute(U.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(U.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(U.PLAYBACK_RATES))return this.getAttribute(U.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(i=>Number(i)).filter(i=>!Number.isNaN(i)).sort((i,e)=>i-e)}set playbackRates(i){if(!i){this.removeAttribute(U.PLAYBACK_RATES);return}this.setAttribute(U.PLAYBACK_RATES,i.join(" "))}get forwardSeekOffset(){var i;return(i=Ct(this.getAttribute(U.FORWARD_SEEK_OFFSET)))!=null?i:10}set forwardSeekOffset(i){this.setAttribute(U.FORWARD_SEEK_OFFSET,`${i}`)}get backwardSeekOffset(){var i;return(i=Ct(this.getAttribute(U.BACKWARD_SEEK_OFFSET)))!=null?i:10}set backwardSeekOffset(i){this.setAttribute(U.BACKWARD_SEEK_OFFSET,`${i}`)}get defaultHiddenCaptions(){return this.hasAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(i){i?this.setAttribute(U.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(U.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return Ct(this.getAttribute(U.DEFAULT_DURATION))}set defaultDuration(i){i==null?this.removeAttribute(U.DEFAULT_DURATION):this.setAttribute(U.DEFAULT_DURATION,`${i}`)}get playerInitTime(){return this.hasAttribute(D.PLAYER_INIT_TIME)?Ct(this.getAttribute(D.PLAYER_INIT_TIME)):Re(this,Yl)}set playerInitTime(i){i!=this.playerInitTime&&(i==null?this.removeAttribute(D.PLAYER_INIT_TIME):this.setAttribute(D.PLAYER_INIT_TIME,`${+i}`))}get playerSoftwareName(){var i;return(i=this.getAttribute(D.PLAYER_SOFTWARE_NAME))!=null?i:n0}get playerSoftwareVersion(){var i;return(i=this.getAttribute(D.PLAYER_SOFTWARE_VERSION))!=null?i:s0}get beaconCollectionDomain(){var i;return(i=this.getAttribute(D.BEACON_COLLECTION_DOMAIN))!=null?i:void 0}set beaconCollectionDomain(i){i!==this.beaconCollectionDomain&&(i?this.setAttribute(D.BEACON_COLLECTION_DOMAIN,i):this.removeAttribute(D.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var i;return(i=this.getAttribute(D.MAX_RESOLUTION))!=null?i:void 0}set maxResolution(i){i!==this.maxResolution&&(i?this.setAttribute(D.MAX_RESOLUTION,i):this.removeAttribute(D.MAX_RESOLUTION))}get minResolution(){var i;return(i=this.getAttribute(D.MIN_RESOLUTION))!=null?i:void 0}set minResolution(i){i!==this.minResolution&&(i?this.setAttribute(D.MIN_RESOLUTION,i):this.removeAttribute(D.MIN_RESOLUTION))}get renditionOrder(){var i;return(i=this.getAttribute(D.RENDITION_ORDER))!=null?i:void 0}set renditionOrder(i){i!==this.renditionOrder&&(i?this.setAttribute(D.RENDITION_ORDER,i):this.removeAttribute(D.RENDITION_ORDER))}get programStartTime(){return Ct(this.getAttribute(D.PROGRAM_START_TIME))}set programStartTime(i){i==null?this.removeAttribute(D.PROGRAM_START_TIME):this.setAttribute(D.PROGRAM_START_TIME,`${i}`)}get programEndTime(){return Ct(this.getAttribute(D.PROGRAM_END_TIME))}set programEndTime(i){i==null?this.removeAttribute(D.PROGRAM_END_TIME):this.setAttribute(D.PROGRAM_END_TIME,`${i}`)}get assetStartTime(){return Ct(this.getAttribute(D.ASSET_START_TIME))}set assetStartTime(i){i==null?this.removeAttribute(D.ASSET_START_TIME):this.setAttribute(D.ASSET_START_TIME,`${i}`)}get assetEndTime(){return Ct(this.getAttribute(D.ASSET_END_TIME))}set assetEndTime(i){i==null?this.removeAttribute(D.ASSET_END_TIME):this.setAttribute(D.ASSET_END_TIME,`${i}`)}get extraSourceParams(){return this.hasAttribute(U.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(U.EXTRA_SOURCE_PARAMS)).entries()].reduce((i,[e,t])=>(i[e]=t,i),{}):lM}set extraSourceParams(i){i==null?this.removeAttribute(U.EXTRA_SOURCE_PARAMS):this.setAttribute(U.EXTRA_SOURCE_PARAMS,new URLSearchParams(i).toString())}get customDomain(){var i;return(i=this.getAttribute(D.CUSTOM_DOMAIN))!=null?i:void 0}set customDomain(i){i!==this.customDomain&&(i?this.setAttribute(D.CUSTOM_DOMAIN,i):this.removeAttribute(D.CUSTOM_DOMAIN))}get envKey(){var i;return(i=Gr(this,D.ENV_KEY))!=null?i:void 0}set envKey(i){this.setAttribute(D.ENV_KEY,`${i}`)}get noVolumePref(){return this.hasAttribute(U.NO_VOLUME_PREF)}set noVolumePref(i){i?this.setAttribute(U.NO_VOLUME_PREF,""):this.removeAttribute(U.NO_VOLUME_PREF)}get debug(){return Gr(this,D.DEBUG)!=null}set debug(i){i?this.setAttribute(D.DEBUG,""):this.removeAttribute(D.DEBUG)}get disableTracking(){return Gr(this,D.DISABLE_TRACKING)!=null}set disableTracking(i){this.toggleAttribute(D.DISABLE_TRACKING,!!i)}get disableCookies(){return Gr(this,D.DISABLE_COOKIES)!=null}set disableCookies(i){i?this.setAttribute(D.DISABLE_COOKIES,""):this.removeAttribute(D.DISABLE_COOKIES)}get streamType(){var i,e,t;return(t=(e=this.getAttribute(D.STREAM_TYPE))!=null?e:(i=this.media)==null?void 0:i.streamType)!=null?t:xe.UNKNOWN}set streamType(i){this.setAttribute(D.STREAM_TYPE,`${i}`)}get defaultStreamType(){var i,e,t;return(t=(e=this.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?e:(i=this.mediaController)==null?void 0:i.getAttribute(U.DEFAULT_STREAM_TYPE))!=null?t:xe.ON_DEMAND}set defaultStreamType(i){i?this.setAttribute(U.DEFAULT_STREAM_TYPE,i):this.removeAttribute(U.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var i,e;return this.hasAttribute(U.TARGET_LIVE_WINDOW)?+this.getAttribute(U.TARGET_LIVE_WINDOW):(e=(i=this.media)==null?void 0:i.targetLiveWindow)!=null?e:Number.NaN}set targetLiveWindow(i){i==this.targetLiveWindow||Number.isNaN(i)&&Number.isNaN(this.targetLiveWindow)||(i==null?this.removeAttribute(U.TARGET_LIVE_WINDOW):this.setAttribute(U.TARGET_LIVE_WINDOW,`${+i}`))}get liveEdgeStart(){var i;return(i=this.media)==null?void 0:i.liveEdgeStart}get startTime(){return Ct(Gr(this,D.START_TIME))}set startTime(i){this.setAttribute(D.START_TIME,`${i}`)}get preferPlayback(){let i=this.getAttribute(D.PREFER_PLAYBACK);if(i===Ii.MSE||i===Ii.NATIVE)return i}set preferPlayback(i){i!==this.preferPlayback&&(i===Ii.MSE||i===Ii.NATIVE?this.setAttribute(D.PREFER_PLAYBACK,i):this.removeAttribute(D.PREFER_PLAYBACK))}get metadata(){var i;return(i=this.media)==null?void 0:i.metadata}set metadata(i){if(Ze(this,Ve,pr).call(this),!this.media){Gt("underlying media element missing when trying to set metadata. metadata will not be set.");return}this.media.metadata={...r0(this),...i}}
vendor: 4,116 bytes, line 3208
3208get _hlsConfig(){var i;return(i=this.media)==null?void 0:i._hlsConfig}set _hlsConfig(i){if(Ze(this,Ve,pr).call(this),!this.media){Gt("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");return}this.media._hlsConfig=i}async addCuePoints(i){var e;if(Ze(this,Ve,pr).call(this),!this.media){Gt("underlying media element missing when trying to addCuePoints. cuePoints will not be added.");return}return(e=this.media)==null?void 0:e.addCuePoints(i)}get activeCuePoint(){var i;return(i=this.media)==null?void 0:i.activeCuePoint}get cuePoints(){var i,e;return(e=(i=this.media)==null?void 0:i.cuePoints)!=null?e:[]}addChapters(i){var e;if(Ze(this,Ve,pr).call(this),!this.media){Gt("underlying media element missing when trying to addChapters. chapters will not be added.");return}return(e=this.media)==null?void 0:e.addChapters(i)}get activeChapter(){var i;return(i=this.media)==null?void 0:i.activeChapter}get chapters(){var i,e;return(e=(i=this.media)==null?void 0:i.chapters)!=null?e:[]}getStartDate(){var i;return(i=this.media)==null?void 0:i.getStartDate()}get currentPdt(){var i;return(i=this.media)==null?void 0:i.currentPdt}get tokens(){let i=this.getAttribute(U.PLAYBACK_TOKEN),e=this.getAttribute(U.DRM_TOKEN),t=this.getAttribute(U.THUMBNAIL_TOKEN),r=this.getAttribute(U.STORYBOARD_TOKEN);return{...Re(this,jl),...i!=null?{playback:i}:{},...e!=null?{drm:e}:{},...t!=null?{thumbnail:t}:{},...r!=null?{storyboard:r}:{}}}set tokens(i){Mi(this,jl,i??{})}get playbackToken(){var i;return(i=this.getAttribute(U.PLAYBACK_TOKEN))!=null?i:void 0}set playbackToken(i){this.setAttribute(U.PLAYBACK_TOKEN,`${i}`)}get drmToken(){var i;return(i=this.getAttribute(U.DRM_TOKEN))!=null?i:void 0}set drmToken(i){this.setAttribute(U.DRM_TOKEN,`${i}`)}get thumbnailToken(){var i;return(i=this.getAttribute(U.THUMBNAIL_TOKEN))!=null?i:void 0}set thumbnailToken(i){this.setAttribute(U.THUMBNAIL_TOKEN,`${i}`)}get storyboardToken(){var i;return(i=this.getAttribute(U.STORYBOARD_TOKEN))!=null?i:void 0}set storyboardToken(i){this.setAttribute(U.STORYBOARD_TOKEN,`${i}`)}addTextTrack(i,e,t,r){var s;let n=(s=this.media)==null?void 0:s.nativeEl;if(n)return cf(n,i,e,t,r)}removeTextTrack(i){var e;let t=(e=this.media)==null?void 0:e.nativeEl;if(t)return JR(t,i)}get textTracks(){var i;return(i=this.media)==null?void 0:i.textTracks}get castReceiver(){var i;return(i=this.getAttribute(U.CAST_RECEIVER))!=null?i:void 0}set castReceiver(i){i!==this.castReceiver&&(i?this.setAttribute(U.CAST_RECEIVER,i):this.removeAttribute(U.CAST_RECEIVER))}get castCustomData(){var i;return(i=this.media)==null?void 0:i.castCustomData}set castCustomData(i){if(!this.media){Gt("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");return}this.media.castCustomData=i}get noTooltips(){return this.hasAttribute(U.NO_TOOLTIPS)}set noTooltips(i){if(!i){this.removeAttribute(U.NO_TOOLTIPS);return}this.setAttribute(U.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(i){i?this.setAttribute(U.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(U.PROUDLY_DISPLAY_MUX_BADGE)}};Yl=new WeakMap,ql=new WeakMap,jl=new WeakMap,es=new WeakMap,zl=new WeakMap,En=new WeakMap,Ve=new WeakSet,pr=function(){var i,e,t,r;if(!Re(this,ql)){Mi(this,ql,!0),Ze(this,Ve,ts).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof xi.HTMLElement))throw""}catch{Gt("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch{Gt("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof $k))throw""}catch{Gt("<media-controller> failed to upgrade!")}Ze(this,Ve,o0).call(this),Ze(this,Ve,l0).call(this),Ze(this,Ve,d0).call(this),Mi(this,es,(e=(i=this.mediaController)==null?void 0:i.hasAttribute(J.USER_INACTIVE))!=null?e:!0),Ze(this,Ve,u0).call(this),(t=this.media)==null||t.addEventListener("streamtypechange",()=>Ze(this,Ve,ts).call(this)),(r=this.media)==null||r.addEventListener("loadstart",()=>
3208Ze(this,Ve,ts).call(this))}},Mb=function(){var i,e;try{(i=window==null?void 0:window.CSS)==null||i.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),(e=window==null?void 0:window.CSS)==null||e.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch{}},$h=function(i){Object.assign(Re(this,En),i),Ze(this,Ve,ts).call(this)},ts=function(i={}){GC(VC(tM(this,{...Re(this,En),...i})),this.shadowRoot)},o0=function(){let i=e=>{var t,r;if(!(e!=null&&e.startsWith("theme-")))return;let s=e.replace(/^theme-/,"");if(Fh.includes(s))return;let n=this.getAttribute(e);n!=null?(t=this.mediaTheme)==null||t.setAttribute(s,n):(r=this.mediaTheme)==null||r.removeAttribute(s)};new MutationObserver(e=>{for(let{attributeName:t}of e)i(t)}).observe(this,{attributes:!0}),this.getAttributeNames().forEach(i)},l0=function(){let i=e=>{var t;let r=(t=this.media)==null?void 0:t.error;if(!(r instanceof G)){let{message:n,code:a}=r??{};r=new G(n,a)}if(!(r!=null&&r.fatal)){qi(r),r.data&&qi(`${r.name} data:`,r.data);return}let s=e0(r);s.message&&Ib(s),Gt(r),r.data&&Gt(`${r.name} data:`,r.data),Ze(this,Ve,$h).call(this,{isDialogOpen:!0})};this.addEventListener("error",i),this.media&&(this.media.errorTranslator=(e={})=>{var t,r,s;if(!(((t=this.media)==null?void 0:t.error)instanceof G))return e;let n=e0((r=this.media)==null?void 0:r.error);return{player_error_code:(s=this.media)==null?void 0:s.error.code,player_error_message:n.message?String(n.message):e.player_error_message,player_error_context:n.context?String(n.context):e.player_error_context}})},d0=function(){var i,e,t,r;let s=()=>Ze(this,Ve,ts).call(this);(e=(i=this.media)==null?void 0:i.textTracks)==null||e.addEventListener("addtrack",s),(r=(t=this.media)==null?void 0:t.textTracks)==null||r.addEventListener("removetrack",s)},u0=function(){var i,e;if(!/Firefox/i.test(navigator.userAgent))return;let t,r=new WeakMap,s=()=>this.streamType===xe.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,n=(l,d,u=!1)=>{s()||Array.from(l&&l.activeCues||[]).forEach(c=>{if(!(!c.snapToLines||c.line<-5||c.line>=0&&c.line<10))if(!d||this.paused){let h=c.text.split(` 3209`).length,f=-3;this.streamType===xe.LIVE&&(f=-2);let m=f-h;if(c.line===m&&!u)return;r.has(c)||r.set(c,c.line),c.line=m}else setTimeout(()=>{c.line=r.get(c)||"auto"},500)})},a=()=>{var l,d;n(t,(d=(l=this.mediaController)==null?void 0:l.hasAttribute(J.USER_INACTIVE))!=null?d:!1)},o=()=>{var l,d;let u=Array.from(((d=(l=this.mediaController)==null?void 0:l.media)==null?void 0:d.textTracks)||[]).filter(c=>["subtitles","captions"].includes(c.kind)&&c.mode==="showing")[0];u!==t&&(t==null||t.removeEventListener("cuechange",a)),t=u,t==null||t.addEventListener("cuechange",a),n(t,Re(this,es))};o(),(i=this.textTracks)==null||i.addEventListener("change",o),(e=this.textTracks)==null||e.addEventListener("addtrack",o),this.addEventListener("userinactivechange",()=>{var l,d;let u=(d=(l=this.mediaController)==null?void 0:l.hasAttribute(J.USER_INACTIVE))!=null?d:!0;Re(this,es)!==u&&(Mi(this,es,u),n(t,Re(this,es)))})};function Gr(i,e){return i.media?i.media.getAttribute(e):i.getAttribute(e)}var c0=dM,Ob=class{addEventListener(){}removeEventListener(){}dispatchEvent(i){return!0}};if(typeof DocumentFragment>"u"){class i extends Ob{}globalThis.DocumentFragment=i}var uM=class extends Ob{},cM={get(i){},define(i,e,t){},getName(i){return null},upgrade(i){},whenDefined(i){return Promise.resolve(uM)}},hM={customElements:cM},fM=typeof window>"u"||typeof globalThis.customElements>"u",Qu=fM?hM:globalThis;Qu.customElements.get("mux-player")||(Qu.customElements.define("mux-player",c0),Qu.MuxPlayerElement=c0);const mM=["playback-id","asset-start-time","asset-end-time"],pM=Yb({__name:"Video",props:{playsinline:{type:Boolean,default:!0},restrict:{type:Boolean,default:!0},controls:{type:Boolean,default:!0},type:{},playbackId:{},startTime:{},endTime:{},transcript:{}},setup(i){const e=i,t=ro(0),r=ro(!1),s=ro(null),n=ro(null),a=c=>{var h;!n.value&&c&&(n.value=c),!s.value&&((h=c==null?void 0:c.media)!=null&&h.nativeEl)&&(s.value=c.media.nativeEl)},o=qb(),l=eT(),d=()=>{var h,f,m;if(e.controls)return;const c=n.value;if(c)try{l.value==="reduce"?(c.removeAttribute("autoplay"),c.pause()):(c.setAttribute("autoplay",""),(m=(f=(h=c.play)==null?void 0:h.call(c))==null?void 0:f.catch)==null||m.call(f,()=>{}))}catch(p){console.warn("Failed to apply reduced-motion state:",p)}},u=jb(()=>e.restrict&&(o!=null&&o.controllist)?"nofullscreen nodownload noremoteplayback":void 0);return Om(s,c=>{if(c){const h=s.value;h.style.width="100%",h.style.height="100%",h.style.objectFit="cover",u.value&&h.setAttribute("controllist",u.value),setTimeout(()=>{t.value=1},500),d()}Pm(s,"pause",()=>{try{n.value.style.setProperty("--controls","none"),r.value=!1}catch(h){console.warn("Failed to hide video controls:",h)}}),Pm(s,"play",()=>{d();try{r.value=!0,n.value.style.removeProperty("--controls")}catch(h){console.warn("Failed to show video controls:",h)}})},{immediate:!0}),Om(l,d),(c,h)=>(Xb(),zb("mux-player",{lang:"en","data-chromatic":"ignore",style:Jb({opacity:su(t)}),class:Qb(("cn"in c?c.cn:su(Zb))("mux-player",{playing:su(r)}
3209,c.controls?"":"hide-controls")),"playback-id":c.playbackId,"accent-color":"var(--theme-impact-background)","asset-start-time":c.startTime,"asset-end-time":c.endTime,playsinline:"",ref:a},null,14,mM))}}),kM=Object.assign(pM,{__name:"ResolversVideo"});export{kM as _};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.