PageSourceSearch

https://darkmofo.net.au/_next/static/chunks/bdeeb87ca032f19a.js?dpl=dpl_G69Bjy9A374CpyofFbroBhBNjUUf

js darkmofo.net.au collected 2026-10-02 04:40:37 UTC 1,171,544 bytes, 6 lines download raw bytes

1
2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="47db62e5-2bc5-5508-8db2-f7922bb83859")}catch(e){}}();
3(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,605697,e=>{"use strict";let t,i,r,n,a,s,o,l,d,u;e.s(["default",()=>SM],605697);var h=e.i(149950),c=Object.create,m=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p=Object.getOwnPropertyNames,g=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,E=function(e,t){return function(){return e&&(t=e(e=0)),t}},y=function(e,t){return function(){return t||e((t={exports:{}}).exports,t),t.exports}},b=function(e,t,i,r){if(t&&"object"==typeof t||"function"==typeof t)for(var n,a=p(t),s=0,o=a.length;s<o;s++)n=a[s],v.call(e,n)||n===i||m(e,n,{get:(function(e){return t[e]}).bind(null,n),enumerable:!(r=f(t,n))||r.enumerable});return e},T=function(e,t,i){return i=null!=e?c(g(e)):{},b(!t&&e&&e.__esModule?i:m(i,"default",{value:e,enumerable:!0}),e)},A=y(function(t,i){i.exports="undefined"!=typeof window?window:e.g});function S(e,t){return null!=t&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):S(e,t)}var R=E(function(){R()});function k(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}var I=E(function(){}),L=y(function(e,t){var i=Array.prototype.slice;t.exports=function(e,t){for(("length"in e)||(e=[e]),e=i.call(e);e.length;){var r=e.shift(),n=t(r);if(n)return n;r.childNodes&&r.childNodes.length&&(e=i.call(r.childNodes).concat(e))}}}),D=y(function(e,t){function i(e,t){if(!S(this,i))return new i(e,t);this.data=e,this.nodeValue=e,this.length=e.length,this.ownerDocument=t||null}R(),t.exports=i,i.prototype.nodeType=8,i.prototype.nodeName="#comment",i.prototype.toString=function(){return"[object Comment]"}}),w=y(function(e,t){function i(e,t){if(!S(this,i))return new i(e);this.data=e||"",this.length=this.data.length,this.ownerDocument=t||null}R(),t.exports=i,i.prototype.type="DOMTextNode",i.prototype.nodeType=3,i.prototype.nodeName="#text",i.prototype.toString=function(){return this.data},i.prototype.replaceData=function(e,t,i){var r=this.data,n=r.substring(0,e),a=r.substring(e+t,r.length);this.data=n+i+a,this.length=this.data.length}}),C=y(function(e,t){t.exports=function(e){var t=this,i=e.type;e.target||(e.target=t),t.listeners||(t.listeners={});var r=t.listeners[i];if(r)return r.forEach(function(i){e.currentTarget=t,"function"==typeof i?i(e):i.handleEvent(e)});t.parentNode&&t.parentNode.dispatchEvent(e)}}),M=y(function(e,t){t.exports=function(e,t){this.listeners||(this.listeners={}),this.listeners[e]||(this.listeners[e]=[]),-1===this.listeners[e].indexOf(t)&&this.listeners[e].push(t)}}),P=y(function(e,t){t.exports=function(e,t){if(this.listeners&&this.listeners[e]){var i=this.listeners[e],r=i.indexOf(t);-1!==r&&i.splice(r,1)}}}),O=y(function(e,t){I(),t.exports=function e(t){switch(t.nodeType){case 3:return n(t.data);case 8:return"<!--"+t.data+"-->";default:var a,s,o;return s=[],o=(a=t).tagName,"http://www.w3.org/1999/xhtml"===a.namespaceURI&&(o=o.toLowerCase()),s.push("<"+o+function(e){var t=[];for(var i in e)(function(e,t){var i=k(e[t]);return"style"===t&&Object.keys(e.style).length>0||e.hasOwnProperty(t)&&("string"===i||"boolean"===i||"number"===i)&&"nodeName"!==t&&"className"!==t&&"tagName"!==t&&"textContent"!==t&&"innerText"!==t&&"namespaceURI"!==t&&"innerHTML"!==t})(e,i)&&t.push({name:i,value:e[i]});for(var n in e._attributes)for(var a in e._attributes[n]){var s=e._attributes[n][a],o=(s.prefix?s.prefix+":":"")+a;t.push({name:o,value:s.value})}return e.className&&t.push({name:"class",value:e.className}),t.length?r(t):""}(a)+function(e){var t=e.dataset,i=[];for(var n in t)i.push({name:"data-"+n,value:t[n]});return i.length?r(i):""}(a)),i.indexOf(o)>-1?s.push(" />"):(s.push(">"),a.childNodes.length?s.push.apply(s,a.childNodes.map(e)):a.textContent||a.innerText?s.push(n(a.textContent||a.innerText)):a.innerHTML&&s.push(a.innerHTML),s.push("</"+o+">")),s.join("")}};var i=["area","base","br","col","embed","hr","img","input","keygen","link","menuitem","meta","param","source","track","wbr"];function r(e){var t=[];return e.forEach(function(e){var i=e.name,r=e.value;"style"===i&&(r=function(e){if("string"==typeof e)return e;var t="";return Object.keys(e).forEach(function(i){var r=e[i];i=i.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}),t+=i+":"+r+";"}),t}(r)),t.push(i+'="'+n(r).replace(/"/g,"&quot;")+'"')}),t.length?" "+t.join(" "):""}function n(e){var t="";return"string"==typeof e?t=e:e&&(t=e.toString()),t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}}),x=y(function(e,t){R();var i=L(),r=C(),n=M(),a=P(),s=O(),o="http://www.w3.org/1999/xhtml";function l(e,t,i){if(!S(this,l))return new l(e);var r=void 0===i?o:i||null;this.tagName=r===o?String(e).toUpperCase():e,this.nodeName=this.tagName,this.className="",this.dataset={},this.childNodes=[],this.parentNode=null,this.style={},this.ownerDocument=t||null,this.namespaceURI=r,this._attributes={}
3,"INPUT"===this.tagName&&(this.type="text")}t.exports=l,l.prototype.type="DOMElement",l.prototype.nodeType=1,l.prototype.appendChild=function(e){return e.parentNode&&e.parentNode.removeChild(e),this.childNodes.push(e),e.parentNode=this,e},l.prototype.replaceChild=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=this.childNodes.indexOf(t);return t.parentNode=null,this.childNodes[i]=e,e.parentNode=this,t},l.prototype.removeChild=function(e){var t=this.childNodes.indexOf(e);return this.childNodes.splice(t,1),e.parentNode=null,e},l.prototype.insertBefore=function(e,t){e.parentNode&&e.parentNode.removeChild(e);var i=null==t?-1:this.childNodes.indexOf(t);return i>-1?this.childNodes.splice(i,0,e):this.childNodes.push(e),e.parentNode=this,e},l.prototype.setAttributeNS=function(e,t,i){var r=null,n=t,a=t.indexOf(":");(a>-1&&(r=t.substr(0,a),n=t.substr(a+1)),"INPUT"===this.tagName&&"type"===t)?this.type=i:(this._attributes[e]||(this._attributes[e]={}))[n]={value:i,prefix:r}},l.prototype.getAttributeNS=function(e,t){var i=this._attributes[e],r=i&&i[t]&&i[t].value;return"INPUT"===this.tagName&&"type"===t?this.type:"string"!=typeof r?null:r},l.prototype.removeAttributeNS=function(e,t){var i=this._attributes[e];i&&delete i[t]},l.prototype.hasAttributeNS=function(e,t){var i=this._attributes[e];return!!i&&t in i},l.prototype.setAttribute=function(e,t){return this.setAttributeNS(null,e,t)},l.prototype.getAttribute=function(e){return this.getAttributeNS(null,e)},l.prototype.removeAttribute=function(e){return this.removeAttributeNS(null,e)},l.prototype.hasAttribute=function(e){return this.hasAttributeNS(null,e)},l.prototype.removeEventListener=a,l.prototype.addEventListener=n,l.prototype.dispatchEvent=r,l.prototype.focus=function(){},l.prototype.toString=function(){return s(this)},l.prototype.getElementsByClassName=function(e){var t=e.split(" "),r=[];return i(this,function(e){if(1===e.nodeType){var i=(e.className||"").split(" ");t.every(function(e){return -1!==i.indexOf(e)})&&r.push(e)}}),r},l.prototype.getElementsByTagName=function(e){e=e.toLowerCase();var t=[];return i(this.childNodes,function(i){1===i.nodeType&&("*"===e||i.tagName.toLowerCase()===e)&&t.push(i)}),t},l.prototype.contains=function(e){return i(this,function(t){return e===t})||!1}}),N=y(function(e,t){R();var i=x();function r(e){if(!S(this,r))return new r;this.childNodes=[],this.parentNode=null,this.ownerDocument=e||null}t.exports=r,r.prototype.type="DocumentFragment",r.prototype.nodeType=11,r.prototype.nodeName="#document-fragment",r.prototype.appendChild=i.prototype.appendChild,r.prototype.replaceChild=i.prototype.replaceChild,r.prototype.removeChild=i.prototype.removeChild,r.prototype.toString=function(){return this.childNodes.map(function(e){return String(e)}).join("")}}),U=y(function(e,t){function i(e){}t.exports=i,i.prototype.initEvent=function(e,t,i){this.type=e,this.bubbles=t,this.cancelable=i},i.prototype.preventDefault=function(){}}),F=y(function(e,t){R();var i=L(),r=D(),n=w(),a=x(),s=N(),o=U(),l=C(),d=M(),u=P();function h(){if(!S(this,h))return new h;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}t.exports=h;var c=h.prototype;c.createTextNode=function(e){return new n(e,this)},c.createElementNS=function(e,t){return new a(t,this,null===e?null:String(e))},c.createElement=function(e){return new a(e,this)},c.createDocumentFragment=function(){return new s(this)},c.createEvent=function(e){return new o(e)},c.createComment=function(e){return new r(e,this)},c.getElementById=function(e){return e=String(e),i(this.childNodes,function(t){if(String(t.id)===e)return t})||null},c.getElementsByClassName=a.prototype.getElementsByClassName,c.getElementsByTagName=a.prototype.getElementsByTagName,c.contains=a.prototype.contains,c.removeEventListener=u,c.addEventListener=d,c.dispatchEvent=l}),B=y(function(e,t){t.exports=new(F())}),G=y(function(t,i){var r,n=e.g,a=B();"undefined"!=typeof document?r=document:(r=n["__GLOBAL_DOCUMENT_CACHE@4"])||(r=n["__GLOBAL_DOCUMENT_CACHE@4"]=a),i.exports=r});function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,r=Array(t);i<t;i++)r[i]=e[i];return r}function K(e,t){if(e){if("string"==typeof e)return H(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);if("Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i)return Array.from(i);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return H(e,t)}}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var r,n,a=[],s=!0,o=!1;try{for(i=i.call(e);!(s=(r=i.next()).done)&&(a.push(r.value),!(t&&a.length===t));s=!0);}catch(e){o=!0,n=e}finally{try{s||null==i.return||i.return()}finally{if(o)throw n}}return a}}(e,t)||K(e,t)||function(){throw TypeError("Invalid attempt to de
3structure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var V=T(A()),q=T(A()),Y=T(A()),j={now:function(){var e=Y.default.performance,t=e&&e.timing,i=t&&t.navigationStart;return Math.round("number"==typeof i&&"function"==typeof e.now?i+e.now():Date.now())}},z=function(){if("function"==typeof(null==(e=q.default.crypto)?void 0:e.getRandomValues)){i=new Uint8Array(32),q.default.crypto.getRandomValues(i);for(var e,t,i,r=0;r<32;r++)i[r]=i[r]%16}else{i=[];for(var n=0;n<32;n++)i[n]=16*Math.random()|0}var a=0;t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t="x"===e?i[a]:3&i[a]|8;return a++,t.toString(16)});var s=j.now(),o=null==s?void 0:s.toString(16).substring(3);return o?t.substring(0,28)+o:t},Q=function(){return("000000"+(0x81bf1000*Math.random()|0).toString(36)).slice(-6)},X=function(e){var t;if(e&&void 0!==e.nodeName)return e.muxId||(e.muxId=Q()),e.muxId;try{t=document.querySelector(e)}catch(e){}return t&&!t.muxId&&(t.muxId=e),(null==t?void 0:t.muxId)||e},Z=function(e){e&&void 0!==e.nodeName?e=X(t=e):t=document.querySelector(e);var t,i=t&&t.nodeName?t.nodeName.toLowerCase():"";return[t,e,i]};function J(e){return function(e){if(Array.isArray(e))return H(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||K(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var $={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4},ee=function(e){var t,i,r,n,a,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,o=e?[console,e]:[console],l=(t=console.trace).bind.apply(t,J(o)),d=(i=console.info).bind.apply(i,J(o)),u=(r=console.debug).bind.apply(r,J(o)),h=(n=console.warn).bind.apply(n,J(o)),c=(a=console.error).bind.apply(a,J(o)),m=s;return{trace:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>$.TRACE))return l.apply(void 0,J(t))},debug:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>$.DEBUG))return u.apply(void 0,J(t))},info:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>$.INFO))return d.apply(void 0,J(t))},warn:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>$.WARN))return h.apply(void 0,J(t))},error:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];if(!(m>$.ERROR))return c.apply(void 0,J(t))},get level(){return m},set level(_){_!==this.level&&(m=null!=_?_:s)}}}("[mux]"),et=T(A());function ei(){return"1"===(et.default.doNotTrack||et.default.navigator&&et.default.navigator.doNotTrack)}function er(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function en(e,t){if(!S(e,t))throw TypeError("Cannot call a class as a function")}function ea(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function es(e,t,i){return t&&ea(e.prototype,t),i&&ea(e,i),e}function eo(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ed(e,t,i){return(ed="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=el(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i||e):n.value}})(e,t,i||e)}function eu(e,t){return(eu=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}R(),I();var eh=function(e){return ec(e)[0]},ec=function(e){if("string"!=typeof e||""===e)return["localhost"];var t,i=(e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/)||[])[4];return i&&(t=(i.match(/[^\.]+\.[^\.]+$/)||[])[0]),[i,t]},em=T(A()),ef={exists:function(){var e=em.default.performance;return void 0!==(e&&e.timing)},domContentLoadedEventEnd:function(){var e=em.default.performance,t=e&&e.t
3iming;return t&&t.domContentLoadedEventEnd},navigationStart:function(){var e=em.default.performance,t=e&&e.timing;return t&&t.navigationStart}};function ep(e,t,i){i=void 0===i?1:i,e[t]=e[t]||0,e[t]+=i}function eg(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},r=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),r.forEach(function(t){eo(e,t,i[t])})}return e}function ev(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);i.push.apply(i,r)}return i})(Object(t)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(t,i))}),e}var eE=["x-request-id","cf-ray","x-amz-cf-id","x-akamai-request-id"],ey=["x-cdn","content-type"].concat(eE);function eb(e){var t={};return(e=e||"").trim().split(/[\r\n]+/).forEach(function(e){if(e){var i=e.split(": "),r=i.shift();r&&(ey.indexOf(r.toLowerCase())>=0||0===r.toLowerCase().indexOf("x-litix-"))&&(t[r]=i.join(": "))}}),t}function eT(e){if(e){var t=eE.find(function(t){return void 0!==e[t]});return t?e[t]:void 0}}var e_=function(e){var t={};for(var i in e){var r=e[i];-1!==r["DATA-ID"].search("io.litix.data.")&&(t[r["DATA-ID"].replace("io.litix.data.","")]=r.VALUE)}return t},eA=function(e){if(!e)return{};var t=ef.navigationStart(),i=e.loading,r=i?i.start:e.trequest,n=i?i.first:e.tfirst,a=i?i.end:e.tload;return{bytesLoaded:e.total,requestStart:Math.round(t+r),responseStart:Math.round(t+n),responseEnd:Math.round(t+a)}},eS=function(e){if(!(!e||"function"!=typeof e.getAllResponseHeaders))return eb(e.getAllResponseHeaders())},eR=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=arguments.length>4?arguments[4]:void 0,n=e.log,a=e.utils.secondsToMs,s=function(e){var t,i=parseInt(r.version);return 1===i&&null!==e.programDateTime&&(t=e.programDateTime),0===i&&null!==e.pdt&&(t=e.pdt),t};if(!ef.exists())return void n.warn("performance timing not supported. Not tracking HLS.js.");var o=function(i,r){return e.emit(t,i,r)},l=function(e,t){var i=t.levels,r=t.audioTracks,n=t.url,a=t.stats,s=t.networkDetails,l=t.sessionData,d={},u={};i.forEach(function(e,t){d[t]={width:e.width,height:e.height,bitrate:e.bitrate,attrs:e.attrs}}),r.forEach(function(e,t){u[t]={name:e.name,language:e.lang,bitrate:e.bitrate}});var h=eA(a),c=h.bytesLoaded,m=h.requestStart,f=h.responseStart,p=h.responseEnd;o("requestcompleted",ev(eg({},e_(l)),{request_event_type:e,request_bytes_loaded:c,request_start:m,request_response_start:f,request_response_end:p,request_type:"manifest",request_hostname:eh(n),request_response_headers:eS(s),request_rendition_lists:{media:d,audio:u,video:{}}}))};i.on(r.Events.MANIFEST_LOADED,l);var d=function(e,t){var i=t.details,r=t.level,n=t.networkDetails,l=eA(t.stats),d=l.bytesLoaded,u=l.requestStart,h=l.responseStart,c=l.responseEnd,m=i.fragments[i.fragments.length-1],f=s(m)+a(m.duration);o("requestcompleted",{request_event_type:e,request_bytes_loaded:d,request_start:u,request_response_start:h,request_response_end:c,request_current_level:r,request_type:"manifest",request_hostname:eh(i.url),request_response_headers:eS(n),video_holdback:i.holdBack&&a(i.holdBack),video_part_holdback:i.partHoldBack&&a(i.partHoldBack),video_part_target_duration:i.partTarget&&a(i.partTarget),video_target_duration:i.targetduration&&a(i.targetduration),video_source_is_live:i.live,player_manifest_newest_program_time:isNaN(f)?void 0:f})};i.on(r.Events.LEVEL_LOADED,d);var u=function(e,t){var i=t.details,r=t.networkDetails,n=eA(t.stats);o("requestcompleted",{request_event_type:e,request_bytes_loaded:n.bytesLoaded,request_start:n.requestStart,request_response_start:n.responseStart,request_response_end:n.responseEnd,request_type:"manifest",request_hostname:eh(i.url),request_response_headers:eS(r)})};i.on(r.Events.AUDIO_TRACK_LOADED,u);var h=function(e,t){var r=t.stats,n=t.networkDetails,a=t.frag,s=eA(r=r||a.stats),l=s.bytesLoaded,d=s.requestStart,u=s.responseStart,h=s.responseEnd,c=n?eS(n):void 0,m={request_event_type:e,request_bytes_loaded:l,request_start:d,request_response_start:u,request_response_end:h,request_hostname:n?eh(n.responseURL):void 0,request_id:c?eT(c):void 0,request_response_headers:c,request_media_duration:a.duration,request_url:null==n?void 0:n.responseURL};"main"===a.type?(m.request_type="media",m.request_current_level=a.level,m.request_video_width=(i.levels[a.level]||{}).width,m.request_video_height=(i.levels[a.level]||{}).height,m.request_labeled_bitrate=(i.levels[a.level]||{}).bitrate):m.request_type=a.type,o("requestcompleted",m)};i.on(r.Events.FRAG_LOADED,h);var c=function(e,t){var i=t.frag,r=i.start;o("fragmentchange",{currentFragmentPDT:s(i),currentFragmentStart:a(r)})};i.on(r.Events.FRAG_CHANGED,c);var m=function(e,t){var i,n=t.type,a=t.details,s=t.response,l=t.fatal,d=t.frag,u=t.networkDetails,h=(null==d?void 0:d.url)||t.url||"",c=u?eS(u):void 0;(a===r.ErrorDetails.MANIFEST_LOAD_ERROR||a===r.ErrorDetails.MANIFEST_LOAD_TIMEOUT||a===r.ErrorDetails.FRAG_LOAD_ERROR||a===r.ErrorDetails.FRAG_LOAD_TIMEOUT||a===r.ErrorDetails.LEVEL_LOAD_ERROR||a===r.ErrorDetails.LEVEL_LOAD_TIMEOUT||a===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||a===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT||a===r.ErrorDetails.SUBTITLE_LOAD_ERROR||a===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT||a===r.ErrorDetails.KEY_LOAD_ERROR||a===r.ErrorDetails.KEY_LOAD_TIMEOUT)&&o("requestfailed",{request_error:a,request_url:h,request_hostname:eh(h),request_id:c?eT(c):void 0,request_type:a===r.ErrorDetails.FRAG_LOAD_ERROR||a===r.ErrorDetails.FRAG_LOAD_TIMEOUT?"media":a===r.ErrorDetails.AUDIO_TRACK_LOAD_ERROR||a===r.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT?"audio":a===r.ErrorDetails.SUBTITLE_LOAD_ERROR||a===r.ErrorDetails.SUBTITLE_LOAD_TIMEOUT?"subtitle":a===r.ErrorDetails.KEY_LOAD_ERROR||a===r.ErrorDetails.KEY_LOAD_TIMEOUT?"encryption":"manifest",request_error_code:null==s?void 0:s.code,request_error_text:null==s?void 0:s.text}),l&&o("error",{player_error_code:n,player_error_message:a,player_error_context:"".concat(h?"url: ".concat(h,"\n"):"")+"".concat(s&&(s.code||s.text)?"response: ".concat(s.code,", ").concat(s.text,"\n"):"")+"".concat(t.reason?"failure reason: ".concat(t.reason,"\n"):"")+"".concat(t.level?"level: ".concat(t.level,"\n"):"")+"".concat(t.parent?"parent stream controller: ".concat(t.parent,"\n"):"")+"".concat(t.buffer?"buffer length: ".concat(t.buffer,"\n"):"")+"".concat(t.error?"error: ".concat(t.error,"\n"):"")+"".concat(t.event?"event: ".concat(t.event,"\n"):"")+"".concat(t.err?"error message: ".concat(null==(i=t.err)?void 0:i.message,"\n"):"")})};i.on(r.Events.ERROR,m);var f=function(e,t){var i=t.frag,r=i&&i._url||"";o("requestcanceled",{request_event_type:e,request_url:r,request_type:"media",request_hostname:eh(r)})};i.on(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,f);var p=function(e,t){var r=t.level,a=i.levels[r];if(a&&a.attrs&&a.attrs.BANDWIDTH){var s,l=a.attrs.BANDWIDTH,d=parseFloat(a.attrs["FRAME-RATE"]);isNaN(d)||(s=d),l?o("renditionchange",{video_source_fps:s,video_source_bitrate:l,video_source_width:a.width,video_source_height:a.height,video_source_rendition_name:a.name,video_source_codec:null==a?void 0:a.videoCodec}):n.warn("missing BANDWIDTH from HLS manifest parsed by HLS.js")}};i.on(r.Events.LEVEL_SWITCHED,p),i._stopMuxMonitor=function(){i.off(r.Events.MANIFEST_LOADED,l),i.off(r.Events.LEVEL_LOADED,d),i.off(r.Events.AUDIO_TRACK_LOADED,u),i.off(r.Events.FRAG_LOADED,h),i.off(r.Events.FRAG_CHANGED,c),i.off(r.Events.ERROR,m),i.off(r.Events.FRAG_LOAD_EMERGENCY_ABORTED,f),i.off(r.Events.LEVEL_SWITCHED,p),i.off(r.Events.DESTROYING,i._stopMuxMonitor),delete i._stopMuxMonitor},i.on(r.Events.DESTROYING,i._stopMuxMonitor)},ek=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eI=function(e,t){if(!e||!e.requestEndDate)return{};var i,r=eh(e.url),n=e.url,a=e.bytesLoaded,s=new Date(e.requestStartDate).getTime(),o=new Date(e.firstByteDate).getTime(),l=new Date(e.requestEndDate).getTime(),d=isNaN(e.duration)?0:e.duration,u="function"==typeof t.getMetricsFor?t.getMetricsFor(e.mediaType).HttpList:t.getDashMetrics().getHttpRequests(e.mediaType);u.length>0&&(i=eb(u[u.length-1]._responseHeaders||""));var h=i?eT(i):void 0;return{requestStart:s,requestResponseStart:o,requestResponseEnd:l,requestBytesLoaded:a,requestResponseHeaders:i,requestMediaDuration:d,requestHostname:r,requestUrl:n,requestId:h}},eL=function(e,t){if("function"==typeof t.getCurrentRepresentationForType){var i=t.getCurrentRepresentationForType(e);return i?{currentLevel:i.absoluteIndex,renditionWidth:i.width||null,renditionHeight:i.height||null,renditionBitrate:i.bandwidth}:{}}var r=t.getQualityFor(e),n=t.getCurrentTrackFor(e).bitrateList;return n?{currentLevel:r,renditionWidth:n[r].width||null,renditionHeight:n[r].height||null,renditionBitrate:n[r].bandwidth}:{}},eD=function(e){var t;return null==(t=e.match(/.*codecs\*?="(.*)"/))?void 0:t[1]},ew=function(e){try{var t,i;return null==(i=e.getVersion)||null==(t=i.call(e))?void 0:t.split(".").map(function(e){return parseInt(e)})[0]}catch(e){return!1}},eC=function(e,t,i){arguments.length>3&&void 0!==arguments[3]&&arguments[3];var r=e.log;if(!i||!i.on)return void r.warn("Invalid dash.js player reference. Monitoring blocked.");var n=ew(i),a=function(i,r){return e.emit(t,i,r)},s=function(e){var t=e.type,i=(e.data||{}).url;a("requestcompleted",{request_event_type:t,request_start:0,request_response_start:0,request_response_end:0,request_bytes_loaded:-1,request_type:"manifest",request_hostname:eh(i),request_url:i})};i.on("manifestLoaded",s);var o={},l=function(e){if("function"!=typeof e.getRequests)return null;var t=e.getRequests({state:"executed"});return 0===t.length?null:t[t.length-1]},d=function(e){var t=e.type,r=e.chunk,n=e.request,s=(r||{}).mediaInfo||{},l=s.type,d=s.bitrateList,u={};
3(d=d||[]).forEach(function(e,t){u[t]={},u[t].width=e.width,u[t].height=e.height,u[t].bitrate=e.bandwidth,u[t].attrs={}}),"video"===l?o.video=u:"audio"===l?o.audio=u:o.media=u;var h=eI(n,i),c=h.requestStart,m=h.requestResponseStart,f=h.requestResponseEnd,p=h.requestResponseHeaders,g=h.requestMediaDuration,v=h.requestHostname,E=h.requestUrl;a("requestcompleted",{request_event_type:t,request_start:c,request_response_start:m,request_response_end:f,request_bytes_loaded:-1,request_type:l+"_init",request_response_headers:p,request_hostname:v,request_id:h.requestId,request_url:E,request_media_duration:g,request_rendition_lists:o})};n>=4?i.on("initFragmentLoaded",d):i.on("initFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;d({type:t,request:l(i),chunk:r})});var u=function(e){var t=e.type,r=e.chunk,n=e.request,s=r||{},o=s.mediaInfo,l=s.start,d=(o||{}).type,u=eI(n,i),h=u.requestStart,c=u.requestResponseStart,m=u.requestResponseEnd,f=u.requestBytesLoaded,p=u.requestResponseHeaders,g=u.requestMediaDuration,v=u.requestHostname,E=u.requestUrl,y=u.requestId,b=eL(d,i),T=b.currentLevel,A=b.renditionWidth,S=b.renditionHeight;a("requestcompleted",{request_event_type:t,request_start:h,request_response_start:c,request_response_end:m,request_bytes_loaded:f,request_type:d,request_response_headers:p,request_hostname:v,request_id:y,request_url:E,request_media_start_time:l,request_media_duration:g,request_current_level:T,request_labeled_bitrate:b.renditionBitrate,request_video_width:A,request_video_height:S})};n>=4?i.on("mediaFragmentLoaded",u):i.on("mediaFragmentLoaded",function(e){var t=e.type,i=e.fragmentModel,r=e.chunk;u({type:t,request:l(i),chunk:r})});var h={video:void 0,audio:void 0,totalBitrate:void 0},c=function(){if(h.video&&"number"==typeof h.video.bitrate){if(!(h.video.width&&h.video.height))return void r.warn("have bitrate info for video but missing width/height");var e=h.video.bitrate;if(h.audio&&"number"==typeof h.audio.bitrate&&(e+=h.audio.bitrate),e!==h.totalBitrate)return h.totalBitrate=e,{video_source_bitrate:e,video_source_height:h.video.height,video_source_width:h.video.width,video_source_codec:eD(h.video.codec)}}},m=function(e,t,n){var s=e.mediaType;if("audio"===s||"video"===s){if("function"==typeof i.getRepresentationsByType)if(e.newRepresentation)o={bitrate:e.newRepresentation.bandwidth,width:e.newRepresentation.width,height:e.newRepresentation.height,qualityIndex:e.newRepresentation.absoluteIndex};else{var o,l=i.getRepresentationsByType(s);if(l&&"number"==typeof e.newQuality){var d=l.find(function(t){return t.absoluteIndex===e.newQuality||t.index===e.newQuality});d&&(o={bitrate:d.bandwidth,width:d.width,height:d.height,qualityIndex:e.newQuality})}}else{if("number"!=typeof e.newQuality)return void r.warn("missing evt.newQuality in qualityChangeRendered event",e);o=i.getBitrateInfoListFor(s).find(function(t){return t.qualityIndex===e.newQuality})}if(!(o&&"number"==typeof o.bitrate))return void r.warn("missing bitrate info for ".concat(s));h[s]=ev(eg({},o),{codec:i.getCurrentTrackFor(s).codec});var u=c();u&&a("renditionchange",u)}};i.on("qualityChangeRendered",m);var f=function(e){var t=e.request,i=e.mediaType;a("requestcanceled",{request_event_type:(t=t||{}).type+"_"+t.action,request_url:t.url,request_type:i,request_hostname:eh(t.url)})};i.on("fragmentLoadingAbandoned",f);var p=function(e){var t,i,r=e.error,n=(null==r||null==(t=r.data)?void 0:t.request)||{},s=(null==r||null==(i=r.data)?void 0:i.response)||{};(null==r?void 0:r.code)===27&&a("requestfailed",{request_error:n.type+"_"+n.action,request_url:n.url,request_hostname:eh(n.url),request_type:n.mediaType,request_error_code:s.status,request_error_text:s.statusText});var o="".concat(null!=n&&n.url?"url: ".concat(n.url,"\n"):"")+"".concat(null!=s&&s.status||null!=s&&s.statusText?"response: ".concat(null==s?void 0:s.status,", ").concat(null==s?void 0:s.statusText,"\n"):"");a("error",{player_error_code:null==r?void 0:r.code,player_error_message:null==r?void 0:r.message,player_error_context:o})};i.on("error",p),i._stopMuxMonitor=function(){i.off("manifestLoaded",s),i.off("initFragmentLoaded",d),i.off("mediaFragmentLoaded",u),i.off("qualityChangeRendered",m),i.off("error",p),i.off("fragmentLoadingAbandoned",f),delete i._stopMuxMonitor}},eM=function(e){e&&"function"==typeof e._stopMuxMonitor&&e._stopMuxMonitor()},eP=0,eO=function(){function e(){en(this,e),eo(this,"_listeners",void 0)}return es(e,[{key:"on",value:function(e,t,i){return t._eventEmitterGuid=t._eventEmitterGuid||++eP,this._listeners=this._listeners||{},this._listeners[e]=this._listeners[e]||[],i&&(t=t.bind(i)),this._listeners[e].push(t),t}},{key:"off",value:function(e,t){var i=this._listeners&&this._listeners[e];
3i&&i.forEach(function(e,r){e._eventEmitterGuid===t._eventEmitterGuid&&i.splice(r,1)})}},{key:"one",value:function(e,t,i){var r=this;t._eventEmitterGuid=t._eventEmitterGuid||++eP;var n=function(){r.off(e,n),t.apply(i||this,arguments)};n._eventEmitterGuid=t._eventEmitterGuid,this.on(e,n)}},{key:"emit",value:function(e,t){var i=this;if(this._listeners){t=t||{};var r=this._listeners["before"+e]||[],n=this._listeners["before*"]||[],a=this._listeners[e]||[],s=this._listeners["after"+e]||[],o=function(t,r){(t=t.slice()).forEach(function(t){t.call(i,{type:e},r)})};o(r,t),o(n,t),o(a,t),o(s,t)}}}]),e}(),ex=T(A()),eN=function(){function e(t){var i=this;en(this,e),eo(this,"_playbackHeartbeatInterval",void 0),eo(this,"_playheadShouldBeProgressing",void 0),eo(this,"pm",void 0),this.pm=t,this._playbackHeartbeatInterval=null,this._playheadShouldBeProgressing=!1,t.on("playing",function(){i._playheadShouldBeProgressing=!0}),t.on("play",this._startPlaybackHeartbeatInterval.bind(this)),t.on("playing",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adbreakstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplay",this._startPlaybackHeartbeatInterval.bind(this)),t.on("adplaying",this._startPlaybackHeartbeatInterval.bind(this)),t.on("devicewake",this._startPlaybackHeartbeatInterval.bind(this)),t.on("viewstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("rebufferstart",this._startPlaybackHeartbeatInterval.bind(this)),t.on("pause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("ended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("viewend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("error",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("aderror",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adpause",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adended",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("adbreakend",this._stopPlaybackHeartbeatInterval.bind(this)),t.on("seeked",function(){t.data.player_is_paused?i._stopPlaybackHeartbeatInterval():i._startPlaybackHeartbeatInterval()}),t.on("timeupdate",function(){null!==i._playbackHeartbeatInterval&&t.emit("playbackheartbeat")}),t.on("devicesleep",function(e,r){null!==i._playbackHeartbeatInterval&&(ex.default.clearInterval(i._playbackHeartbeatInterval),t.emit("playbackheartbeatend",{viewer_time:r.viewer_time}),i._playbackHeartbeatInterval=null)})}return es(e,[{key:"_startPlaybackHeartbeatInterval",value:function(){var e=this;null===this._playbackHeartbeatInterval&&(this.pm.emit("playbackheartbeat"),this._playbackHeartbeatInterval=ex.default.setInterval(function(){e.pm.emit("playbackheartbeat")},this.pm.playbackHeartbeatTime))}},{key:"_stopPlaybackHeartbeatInterval",value:function(){this._playheadShouldBeProgressing=!1,null!==this._playbackHeartbeatInterval&&(ex.default.clearInterval(this._playbackHeartbeatInterval),this.pm.emit("playbackheartbeatend"),this._playbackHeartbeatInterval=null)}}]),e}(),eU=function e(t){var i=this;en(this,e),eo(this,"viewErrored",void 0),t.on("viewinit",function(){i.viewErrored=!1}),t.on("error",function(e,r){try{var n=t.errorTranslator({player_error_code:r.player_error_code,player_error_message:r.player_error_message,player_error_context:r.player_error_context,player_error_severity:r.player_error_severity,player_error_business_exception:r.player_error_business_exception});n&&(t.data.player_error_code=n.player_error_code||r.player_error_code,t.data.player_error_message=n.player_error_message||r.player_error_message,t.data.player_error_context=n.player_error_context||r.player_error_context,t.data.player_error_severity=n.player_error_severity||r.player_error_severity,t.data.player_error_business_exception=n.player_error_business_exception||r.player_error_business_exception,i.viewErrored=!0)}catch(e){t.mux.log.warn("Exception in error translator callback.",e),i.viewErrored=!0}}),t.on("aftererror",function(){var e,i,r,n,a;null==(e=t.data)||delete e.player_error_code,null==(i=t.data)||delete i.player_error_message,null==(r=t.data)||delete r.player_error_context,null==(n=t.data)||delete n.player_error_severity,null==(a=t.data)||delete a.player_error_business_exception})},eF=function(){function e(t){en(this,e),eo(this,"_watchTimeTrackerLastCheckedTime",void 0),eo(this,"pm",void 0),this.pm=t,this._watchTimeTrackerLastCheckedTime=null,t.on("playbackheartbeat",this._updateWatchTime.bind(this)),t.on("playbackheartbeatend",this._clearWatchTimeState.bind(this))}return es(e,[{key:"_updateWatchTime",value:function(e,t){var i=t.viewer_time;null===this._watchTimeTrackerLastCheckedTime&&(this._watchTimeTrackerLastCheckedTime=i),ep(this.pm.data,"view_watch_time",i-this._watchTimeTrackerLastCheckedTime),this._watchTimeTrackerLastCheckedTime=i}},{key:"_clearWatchTimeState",value:function(e,t){this._updateWatchTime(e,t),this._watchTimeTrackerLastCheckedTime=null}}]),e}(),eB=function(){function e(t){var i=this;en(this,e),eo(this,"_playbackTimeTrackerLastPlayheadPosition",void 0),eo(this,"_lastTime",void 0),eo(this,"_isAdPlaying",void 0),eo(this,"_callbackUpdatePlaybackTime",void 0),eo(this,"pm",void 0),this.pm=t,this._playbackTimeTrackerLastPlayheadPosition=-1,this._lastTime=j.now(),this._isAdPlaying=!1,this._callbackUpdatePlaybackTime=null,t.on("viewinit",function(){i.pm.data.view_playing_time_ms_cumulative=0});var r=this._startPlaybackTimeTracking.bind(this);t.on("playing",r),t.on("adplaying",r);var n=function(){i.pm.data.player_is_paused||r()};t.on("seeked",n),t.on("rebufferend",n);var a=this._stopPlaybackTimeTracking.bind(this);t.on("playbackheartbeatend",a),t.on("seeking",a),t.on("rebufferstart",a),t.on("adplaying",function(){i._isAdPlaying=!0}),t.on("adended",function(){i._isAdPlaying=!1}),t.on("adpause",function(){i._isAdPlaying=!1}),t.on("adbreakstart",function(){i._isAdPlaying=!1}),t.on("adbreakend",function(){i._isAdPlaying=!1}),t.on("adplay",function(){i._isAdPlaying=!1}),t.on("viewinit",function(){i._playbackTimeTrackerLastPlayheadPosition=-1,i._lastTime=j.now(),i._isAdPlaying=!1,i._callbackUpdatePlaybackTime=null})}return es(e,[{key:"_startPlaybackTimeTracking",value:function(){null===this._callbackUpdatePlaybackTime&&(this._callbackUpdatePlaybackTime=this._updatePlaybackTime.bind(this),this._playbackTimeTrackerLastPlayheadPosition=this.pm.data.player_playhead_time,this._lastTime=j.now(),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||0,t=j.now(),i=t-this._lastTime,r=-1;this._playbackTimeTrackerLastPlayheadPosition>=0&&e>
3this._playbackTimeTrackerLastPlayheadPosition?r=e-this._playbackTimeTrackerLastPlayheadPosition:this._isAdPlaying&&(r=i),r>0&&r<=1e3&&ep(this.pm.data,"view_content_playback_time",r),null!==this._callbackUpdatePlaybackTime&&i>0&&i<=1e3&&(this._isAdPlaying&&ep(this.pm.data,"ad_playing_time_ms_cumulative",i),ep(this.pm.data,"view_playing_time_ms_cumulative",i)),this._playbackTimeTrackerLastPlayheadPosition=e,this._lastTime=t}}]),e}(),eG=function(){function e(t){en(this,e),eo(this,"pm",void 0),this.pm=t;var i=this._updatePlayheadTime.bind(this);t.on("playbackheartbeat",i),t.on("playbackheartbeatend",i),t.on("timeupdate",i),t.on("destroy",function(){t.off("timeupdate",i)})}return es(e,[{key:"_updateMaxPlayheadPosition",value:function(){this.pm.data.view_max_playhead_position=void 0===this.pm.data.view_max_playhead_position?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 i=this,r=function(){i.pm.currentFragmentPDT&&i.pm.currentFragmentStart&&(i.pm.data.player_program_time=i.pm.currentFragmentPDT+i.pm.data.player_playhead_time-i.pm.currentFragmentStart)};if(t&&t.player_playhead_time)this.pm.data.player_playhead_time=t.player_playhead_time,r(),this._updateMaxPlayheadPosition();else if(this.pm.getPlayheadTime){var n=this.pm.getPlayheadTime();void 0!==n&&(this.pm.data.player_playhead_time=n,r(),this._updateMaxPlayheadPosition())}}}]),e}(),eH=function e(t){if(en(this,e),!t.disableRebufferTracking){var i,r=function(e,t){n(t),i=void 0},n=function(e){if(i){var r=e.viewer_time-i;ep(t.data,"view_rebuffer_duration",r),i=e.viewer_time,t.data.view_rebuffer_duration>3e5&&(t.emit("viewend"),t.send("viewend"),t.mux.log.warn("Ending view after rebuffering for longer than ".concat(3e5,"ms, future events will be ignored unless a programchange or videochange occurs.")))}t.data.view_watch_time>=0&&t.data.view_rebuffer_count>0&&(t.data.view_rebuffer_frequency=t.data.view_rebuffer_count/t.data.view_watch_time,t.data.view_rebuffer_percentage=t.data.view_rebuffer_duration/t.data.view_watch_time)};t.on("playbackheartbeat",function(e,t){return n(t)}),t.on("rebufferstart",function(e,n){i||(ep(t.data,"view_rebuffer_count",1),i=n.viewer_time,t.one("rebufferend",r))}),t.on("viewinit",function(){i=void 0,t.off("rebufferend",r)})}},eK=function(){function e(t){var i=this;en(this,e),eo(this,"_lastCheckedTime",void 0),eo(this,"_lastPlayheadTime",void 0),eo(this,"_lastPlayheadTimeUpdatedTime",void 0),eo(this,"_rebuffering",void 0),eo(this,"pm",void 0),this.pm=t,t.disableRebufferTracking||t.disablePlayheadRebufferTracking||(this._lastCheckedTime=null,this._lastPlayheadTime=null,this._lastPlayheadTimeUpdatedTime=null,t.on("playbackheartbeat",this._checkIfRebuffering.bind(this)),t.on("playbackheartbeatend",this._cleanupRebufferTracker.bind(this)),t.on("seeking",function(){i._cleanupRebufferTracker(null,{viewer_time:j.now()})}))}return es(e,[{key:"_checkIfRebuffering",value:function(e,t){if(this.pm.seekingTracker.isSeeking||this.pm.adTracker.isAdBreak||!this.pm.playbackHeartbeat._playheadShouldBeProgressing)return void this._cleanupRebufferTracker(e,t);if(null===this._lastCheckedTime)return void this._prepareRebufferTrackerState(t.viewer_time);if(this._lastPlayheadTime!==this.pm.data.player_playhead_time)return void this._cleanupRebufferTracker(e,t,!0);var i=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.sustainedRebufferThreshold&&i>=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 i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._rebuffering)this._rebuffering=!1,this.pm.emit("rebufferend",{viewer_time:t.viewer_time});else{if(null===this._lastCheckedTime)return;var r=this.pm.data.player_playhead_time-this._lastPlayheadTime,n=t.viewer_time-this._lastPlayheadTimeUpdatedTime;"number"==typeof this.pm.minimumRebufferDuration&&r>0&&n-r>this.pm.minimumRebufferDuration&&(this._lastCheckedTime=null,this.pm.emit("rebufferstart",{viewer_time:this._lastPlayheadTimeUpdatedTime}),this.pm.emit("rebufferend",{viewer_time:this._lastPlayheadTimeUpdatedTime+n-r}))}i?this._prepareRebufferTrackerState(t.viewer_time):this._clearRebufferTrackerState()}}]),e}(),eW=function(){function e(t){var i=this;en(this,e),eo(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){var e=t.data,r=e.view_id;if(!e.view_program_changed){var n=function(e,n){var a=n.viewer_time;"playing"===e.type&&void 0===t.data.view_time_to_first_frame?i.calculateTimeToFirstFrame(a||j.now(),r):"adplaying"===e.type&&(void 0===t.data.view_time_to_first_frame||i._inPrerollPosition())&&i.calculateTimeToFirstFrame(a||j.now(),r)};t.one("playing",n),t.one("adplaying",n),t.one("viewend",function(){t.off("playing",n),t.off("adplaying",n)})}})}return es(e,[{key:"_inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||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.pm.pageLoadInitTime&&(this.pm.data.view_aggregate_startup_time=this.pm.data.view_start+this.pm.data.view_watch_time-this.pm.pageLoadInitTime))}}]),e}(),eV=function e(t){var i=this;en(this,e),eo(this,"_lastPlayerHeight",void 0),eo(this,"_lastPlayerWidth",void 0),eo(this,"_lastPlayheadPosition",void 0),eo(this,"_lastSourceHeight",void 0),eo(this,"_lastSourceWidth",void 0),t.on("viewinit",function(){i._lastPlayheadPosition=-1}),["pause","rebufferstart","seeking","error","adbreakstart","hb","renditionchange","orientationchange","viewend","playbackmodechange"].forEach(function(e){t.on(e,function(){if(i._lastPlayheadPosition>=0&&t.data.player_playhead_time>=0&&i._lastPlayerWidth>=0&&i._lastSourceWidth>0&&i._lastPlayerHeight>=0&&i._lastSourceHeight>0){var e=t.data.player_playhead_time-i._lastPlayheadPosition;if(e<0){i._lastPlayheadPosition=-1;return}var r=Math.min(i._lastPlayerWidth/i._lastSourceWidth,i._lastPlayerHeight/i._lastSourceHeight),n=Math.max(0,r-1),a=Math.max(0,1-r);t.data.view_max_upscale_percentage=Math.max(t.data.view_max_upscale_percentage||0,n),t.data.view_max_downscale_percentage=Math.max(t.data.view_max_downscale_percentage||0,a),ep(t.data,"view_total_content_playback_time",e),ep(t.data,"view_total_upscaling",n*e),ep(t.data,"view_total_downscaling",a*e)}i._lastPlayheadPosition=-1})}),["playing","hb","renditionchange","orientationchange","playbackmodechange"].forEach(function(e){t.on(e,function(){i._lastPlayheadPosition=t.data.player_playhead_time,i._lastPlayerWidth=t.data.player_width,i._lastPlayerHeight=t.data.player_height,i._lastSourceWidth=t.data.video_source_width,i._lastSourceHeight=t.data.video_source_height})})},eq=function e(t){var i=this;en(this,e),eo(this,"isSeeking",void 0),this.isSeeking=!1;var r=-1,n=function(){var e=j.now(),n=(t.data.viewer_time||e)-(r||e);ep(t.data,"view_seek_duration",n),t.data.view_max_seek_time=Math.max(t.data.view_max_seek_time||0,n),i.isSeeking=!1,r=-1};t.on("seeking",function(e,a){if(Object.assign(t.data,a),i.isSeeking&&a.viewer_time-r<=2e3){r=a.viewer_time;return}i.isSeeking&&n(),i.isSeeking=!0,r=a.viewer_time,ep(t.data,"view_seek_count",1),t.send("seeking")}),t.on("seeked",function(){n()}),t.on("viewend",function(){i.isSeeking&&(n(),t.send("seeked")),i.isSeeking=!1,r=-1})},eY=function(e,t){e.push(t),e.sort(function(e,t){return e.viewer_time-t.viewer_time})},ej=["adbreakstart","adrequest","adresponse","adplay","adplaying","adpause","adended","adbreakend","aderror","adclicked","adskipped"],ez=function(){function e(t){var i=this;en(this,e),eo(this,"_adHasPlayed",void 0),eo(this,"_adRequests",void 0),eo(this,"_adResponses",void 0),eo(this,"_currentAdRequestNumber",void 0),eo(this,"_currentAdResponseNumber",void 0),eo(this,"_prerollPlayTime",void 0),eo(this,"_wouldBeNewAdPlay",void 0),eo(this,"isAdBreak",void 0),eo(this,"pm",void 0),this.pm=t,t.on("viewinit",function(){i.isAdBreak=!1,i._currentAdRequestNumber=0,i._currentAdResponseNumber=0,i._adRequests=[],i._adResponses=[],i._adHasPlayed=!1,i._wouldBeNewAdPlay=!0,i._prerollPlayTime=void 0}
3),ej.forEach(function(e){return t.on(e,i._updateAdData.bind(i))});var r=function(){i.isAdBreak=!1};t.on("adbreakstart",function(){i.isAdBreak=!0}),t.on("play",r),t.on("playing",r),t.on("viewend",r),t.on("adrequest",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdRequestNumber++},r),eY(i._adRequests,r),ep(t.data,"view_ad_request_count"),i.inPrerollPosition()&&(t.data.view_preroll_requested=!0,i._adHasPlayed||ep(t.data,"view_preroll_request_count"))}),t.on("adresponse",function(e,r){r=Object.assign({ad_request_id:"generatedAdRequestId"+i._currentAdResponseNumber++},r),eY(i._adResponses,r);var n=i.findAdRequest(r.ad_request_id);n&&ep(t.data,"view_ad_request_time",Math.max(0,r.viewer_time-n.viewer_time))}),t.on("adplay",function(e,r){i._adHasPlayed=!0,i._wouldBeNewAdPlay&&(i._wouldBeNewAdPlay=!1,ep(t.data,"view_ad_played_count")),i.inPrerollPosition()&&!t.data.view_preroll_played&&(t.data.view_preroll_played=!0,i._adRequests.length>0&&(t.data.view_preroll_request_time=Math.max(0,r.viewer_time-i._adRequests[0].viewer_time)),t.data.view_start&&(t.data.view_startup_preroll_request_time=Math.max(0,r.viewer_time-t.data.view_start)),i._prerollPlayTime=r.viewer_time)}),t.on("adplaying",function(e,r){i.inPrerollPosition()&&void 0===t.data.view_preroll_load_time&&void 0!==i._prerollPlayTime&&(t.data.view_preroll_load_time=r.viewer_time-i._prerollPlayTime,t.data.view_startup_preroll_load_time=r.viewer_time-i._prerollPlayTime)}),t.on("adclicked",function(e,r){i._wouldBeNewAdPlay||ep(t.data,"view_ad_clicked_count")}),t.on("adskipped",function(e,r){i._wouldBeNewAdPlay||ep(t.data,"view_ad_skipped_count")}),t.on("adended",function(){i._wouldBeNewAdPlay=!0}),t.on("aderror",function(){i._wouldBeNewAdPlay=!0})}return es(e,[{key:"inPrerollPosition",value:function(){return void 0===this.pm.data.view_content_playback_time||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 i=W(ec(t.ad_tag_url),2),r=i[0],n=i[1];this.pm.data.view_preroll_ad_tag_domain=n,this.pm.data.view_preroll_ad_tag_hostname=r}if(!this.pm.data.view_preroll_ad_asset_hostname&&t.ad_asset_url){var a=W(ec(t.ad_asset_url),2),s=a[0],o=a[1];this.pm.data.view_preroll_ad_asset_domain=o,this.pm.data.view_preroll_ad_asset_hostname=s}this.pm.data.ad_type="preroll"}this.pm.data.ad_asset_url=null==t?void 0:t.ad_asset_url,this.pm.data.ad_tag_url=null==t?void 0:t.ad_tag_url,this.pm.data.ad_creative_id=null==t?void 0:t.ad_creative_id,this.pm.data.ad_id=null==t?void 0:t.ad_id,this.pm.data.ad_universal_id=null==t?void 0:t.ad_universal_id,null!=t&&t.ad_type&&(this.pm.data.ad_type=null==t?void 0:t.ad_type)}}]),e}(),eQ=function e(t){var i=this;en(this,e),eo(this,"lastWallClockTime",void 0);var r=function(){i.lastWallClockTime=j.now(),t.on("before*",n)},n=function(e){var r=j.now(),n=i.lastWallClockTime;i.lastWallClockTime=r,r-n>3e4&&(t.emit("devicesleep",{viewer_time:n}),Object.assign(t.data,{viewer_time:n}),t.send("devicesleep"),t.emit("devicewake",{viewer_time:r}),Object.assign(t.data,{viewer_time:r}),t.send("devicewake"))};t.one("playbackheartbeat",r),t.on("playbackheartbeatend",function(){t.off("before*",n),t.one("playbackheartbeat",r)})},eX=T(A()),eZ=function(){var e=function(){for(var e=0,t={};e<arguments.length;e++){var i=arguments[e];for(var r in i)t[r]=i[r]}return t};return function t(i){function r(t,n,a){var s;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(a=e({path:"/"},r.defaults,a)).expires){var o=new Date;o.setMilliseconds(o.getMilliseconds()+864e5*a.expires),a.expires=o}try{s=JSON.stringify(n),/^[\{\[]/.test(s)&&(n=s)}catch(e){}return n=i.write?i.write(n,t):encodeURIComponent(String(n)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),t=(t=(t=encodeURIComponent(String(t))).replace(/%(23|24|26|2B|5E|60|7C)/g,decode
3URIComponent)).replace(/[\(\)]/g,escape),document.cookie=t+"="+n+(a.expires?"; expires="+a.expires.toUTCString():"")+(a.path?"; path="+a.path:"")+(a.domain?"; domain="+a.domain:"")+(a.secure?"; secure":"")}t||(s={});for(var l=document.cookie?document.cookie.split("; "):[],d=/(%[0-9A-Z]{2})+/g,u=0;u<l.length;u++){var h=l[u].split("="),c=h.slice(1).join("=");'"'===c.charAt(0)&&(c=c.slice(1,-1));try{var m=h[0].replace(d,decodeURIComponent);if(c=i.read?i.read(c,m):i(c,m)||c.replace(d,decodeURIComponent),this.json)try{c=JSON.parse(c)}catch(e){}if(t===m){s=c;break}t||(s[m]=c)}catch(e){}}return s}}return r.set=r,r.get=function(e){return r.call(r,e)},r.getJSON=function(){return r.apply({json:!0},[].slice.call(arguments))},r.defaults={},r.remove=function(t,i){r(t,"",e(i,{expires:-1}))},r.withConverter=t,r}(function(){})}(),eJ="muxData",e$=function(){var e;try{e=(eZ.get(eJ)||"").split("&").reduce(function(e,t){var i=W(t.split("="),2),r=i[0],n=i[1],a=+n;return e[r]=n&&a==n?a:n,e},{})}catch(t){e={}}return e},e0=function(e){try{eZ.set(eJ,Object.entries(e).map(function(e){var t=W(e,2),i=t[0],r=t[1];return"".concat(i,"=").concat(r)}).join("&"),{expires:365})}catch(e){}},e1=function(){var e=e$();return e.mux_viewer_id=e.mux_viewer_id||z(),e.msn=e.msn||Math.random(),e0(e),{mux_viewer_id:e.mux_viewer_id,mux_sample_number:e.msn}},e2=function(){var e=e$(),t=j.now();return e.session_start&&(e.sst=e.session_start,delete e.session_start),e.session_id&&(e.sid=e.session_id,delete e.session_id),e.session_expires&&(e.sex=e.session_expires,delete e.session_expires),(!e.sex||e.sex<t)&&(e.sid=z(),e.sst=t),e.sex=t+15e5,e0(e),{session_id:e.sid,session_start:e.sst,session_expires:e.sex}},e3=e5({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"}),e4=e5({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",cm:"cmcd",cn:"config",co:"count",ce:"counter",cp:"complete",cq:"creator",cr:"creative",cs:"captions",ct:"content",cu:"current",cv:"cumulative",cx:"connection",cz:"context",da:"data",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",lw:"low",ls:"lists",lt:"latency",ma:"max",md:"media",me:"message",mf:"manifest",mi:"mime",ml:"midroll",mm:"min",mn:"manufacturer",mo:"model",mp:"mode",ms:"ms",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",pv:"previous",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"});function e5(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[e[i]]=i);return t}function e8(e){var t={},i={};return Object.keys(e).forEach(function(r){var n=!1;if(e.hasOwnProperty(r)&&void 0!==e[r]){var a=r.split("_"),s=a[0],o=e3[s];o||(ee.info("Data key word `"+a[0]+"` not expected in "+r),o=s+"_"),a.splice(1).forEac
3h(function(e){"url"===e&&(n=!0),e4[e]?o+=e4[e]:Number.isInteger(Number(e))?o+=e:(ee.info("Data key word `"+e+"` not expected in "+r),o+="_"+e+"_")}),n?i[o]=e[r]:t[o]=e[r]}}),Object.assign(t,i)}var e6=T(A()),e9=T(G()),e7={maxBeaconSize:300,maxQueueLength:3600,baseTimeBetweenBeacons:1e4,maxPayloadKBSize:500},te=["hb","requestcompleted","requestfailed","requestcanceled"],tt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._beaconUrl=e||"https://img.litix.io",this._eventQueue=[],this._postInFlight=!1,this._resendAfterPost=!1,this._failureCount=0,this._sendTimeout=!1,this._options=Object.assign({},e7,t)};tt.prototype.queueEvent=function(e,t){var i=Object.assign({},t);return(this._eventQueue.length<=this._options.maxQueueLength||"eventrateexceeded"===e)&&(this._eventQueue.push(i),this._sendTimeout||this._startBeaconSending(),this._eventQueue.length<=this._options.maxQueueLength)},tt.prototype.flushEvents=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&1===this._eventQueue.length)return void this._eventQueue.pop();this._eventQueue.length&&this._sendBeaconQueue(),this._startBeaconSending()},tt.prototype.destroy=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.destroyed=!0,e?this._clearBeaconQueue():this.flushEvents(),e6.default.clearTimeout(this._sendTimeout)},tt.prototype._clearBeaconQueue=function(){var e=this._eventQueue.length>this._options.maxBeaconSize?this._eventQueue.length-this._options.maxBeaconSize:0,t=this._eventQueue.slice(e);e>0&&Object.assign(t[t.length-1],e8({mux_view_message:"event queue truncated"}));var i=this._createPayload(t);tr(this._beaconUrl,i,!0,function(){})},tt.prototype._sendBeaconQueue=function(){var e=this;if(this._postInFlight){this._resendAfterPost=!0;return}var t=this._eventQueue.slice(0,this._options.maxBeaconSize);this._eventQueue=this._eventQueue.slice(this._options.maxBeaconSize),this._postInFlight=!0;var i=this._createPayload(t),r=j.now();tr(this._beaconUrl,i,!1,function(i,n){n?(e._eventQueue=t.concat(e._eventQueue),e._failureCount+=1,ee.info("Error sending beacon: "+n)):e._failureCount=0,e._roundTripTime=j.now()-r,e._postInFlight=!1,e._resendAfterPost&&(e._resendAfterPost=!1,e._eventQueue.length>0&&e._sendBeaconQueue())})},tt.prototype._getNextBeaconTime=function(){if(!this._failureCount)return this._options.baseTimeBetweenBeacons;var e=Math.pow(2,this._failureCount-1);return(1+(e*=Math.random()))*this._options.baseTimeBetweenBeacons},tt.prototype._startBeaconSending=function(){var e=this;e6.default.clearTimeout(this._sendTimeout),this.destroyed||(this._sendTimeout=e6.default.setTimeout(function(){e._eventQueue.length&&e._sendBeaconQueue(),e._startBeaconSending()},this._getNextBeaconTime()))},tt.prototype._createPayload=function(e){var t=this,i={transmission_timestamp:Math.round(j.now())};this._roundTripTime&&(i.rtt_ms=Math.round(this._roundTripTime));var r,n,a,s=function(){a=(r=JSON.stringify({metadata:i,events:n||e})).length/1024},o=function(){return a<=t._options.maxPayloadKBSize};return s(),o()||(ee.info("Payload size is too big ("+a+" kb). Removing unnecessary events."),n=e.filter(function(e){return -1===te.indexOf(e.e)}),s()),o()||(ee.info("Payload size still too big ("+a+" kb). Cropping fields.."),n.forEach(function(e){for(var t in e){var i=e[t];"string"==typeof i&&i.length>51200&&(e[t]=i.substring(0,51200))}}),s()),r};var ti="function"==typeof e9.default.exitPictureInPicture?function(e){return e.length<=57344}:function(e){return!1},tr=function(e,t,i,r){if(i&&navigator&&navigator.sendBeacon&&navigator.sendBeacon(e,t))return void r();if(e6.default.fetch)return void e6.default.fetch(e,{method:"POST",body:t,headers:{"Content-Type":"text/plain"},keepalive:ti(t)}).then(function(e){return r(null,e.ok?null:"Error")}).catch(function(e){return r(null,e)});if(e6.default.XMLHttpRequest){var n=new e6.default.XMLHttpRequest;n.onreadystatechange=function(){if(4===n.readyState)return r(null,200!==n.status?"error":void 0)},n.open("POST",e),n.setRequestHeader("Content-Type","text/plain"),n.send(t);return}r()},tn=["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","view_playing_time_ms_cumulative","ad_playing_time_ms_cumulative"],ta=["adplay","adplaying","adpause","adfirstquartile","admidpoint","adthirdquartile","adended","adresponse","adrequest"],ts=["ad_id","ad_creative_id","ad_universal_id"],to=["viewstart","error","ended","viewend"],tl=function(){function e(t,i){var r,n,a,s,o,l,d,u,h,c,m,f,p,g,v,E,y,b,T,A=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};en(this,e),eo(this,"mux",void 0),eo(this,"envKey",void 0),eo(this,"options",void 0),eo(this,"eventQueue",void 0),eo(this,"sampleRate",void 0),eo(this,"disableCookies",void 0),eo(this,"respectDoNotTrack",void 0),eo(this,"previousBeaconData",void 0),eo(this,"lastEventTime",void 0),eo(this,"rateLimited",void 0),eo(this,"pageLevelData",void 0),eo(this,"viewerData",void 0),this.mux=t,this.envKey=i,this.options=A,this.previousBeaconData=null,this.lastEventTime=0,this.rateLimited=!1,this.eventQueue=new tt((r=this.envKey,a=(n=this.options).beaconCollectionDomain,s=n.beaconDomain,a?(/localhost(?::\d+)?$/.test(a)?"http://":"https://")+a:(r=r||"inferred").match(/^[a-z0-9]+$/)?"https://"+r+"."+(s||"litix.io"):"https://img.litix.io/a.gif")),this.sampleRate=null!=(y=this.options.sampleRate)?y:1,this.disableCookies=null!=(b=this.options.disableCookies)&&b,this.respectDoNotTrack=null!=(T=this.options.respectDoNotTrack)&&T,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:null==(o=this.options.platform)?void 0:o.name,viewer_application_version:null==(l=this.options.platform)?void 0:l.version,viewer_application_engine:null==(d=this.options.platform)?void 0:d.layout,viewer_device_name:null==(u=this.options.platform)?void 0:u.product,viewer_device_category:"",viewer_device_manufacturer:null==(h=this.options.platform)?void 0:h.manufacturer,viewer_os_family:null==(m=this.options.platform)||null==(c=m.os)?void 0:c.family,viewer_os_architecture:null==(p=this.options.platform)||null==(f=p.os)?void 0:f.architecture,viewer_os_version:null==(v=this.options.platform)||null==(g=v.os)?void 0:g.version,page_url:null===eX.default||void 0===eX.default||null==(E=eX.default.location)?void 0:E.href},this.viewerData=this.disableCookies?{}:e1()}return es(e,[{key:"send",value:function(e,t){if(!(!e||!(null!=t&&t.view_id))){if(this.respectDoNotTrack&&ei())return ee.info("Not sending `"+e+"` because Do Not Track is enabled");if(!t||"object"!=typeof t)return ee.error("A data object was expected in send() but was not provided");var i=this.disableCookies?{}:e2(),r=ev(eg({},this.pageLevelData,t,i,this.viewerData),{event:e,env_key:this.envKey});r.user_id&&(r.viewer_user_id=r.user_id,delete r.user_id);var n,a=(null!=(n=r.mux_sample_number)?n:0)>=this.sampleRate,s=e8(this._deduplicateBeaconData(e,r));if(this.lastEventTime=this.mux.utils.now(),a)return ee.info("Not sending event due to sample rate restriction",e,r,s);
3if(this.envKey||ee.info("Missing environment key (envKey) - beacons will be dropped if the video source is not a valid mux video URL",e,r,s),!this.rateLimited)if(ee.info("Sending event",e,r,s),this.rateLimited=!this.eventQueue.queueEvent(e,s),this.mux.WINDOW_UNLOADING&&"viewend"===e)this.eventQueue.destroy(!0);else{if(this.mux.WINDOW_HIDDEN&&"hb"===e)this.eventQueue.flushEvents(!0);else if(to.indexOf(e)>=0){if("error"===e&&"warning"===t.player_error_severity)return;this.eventQueue.flushEvents()}if(this.rateLimited)return r.event="eventrateexceeded",s=e8(r),this.eventQueue.queueEvent(r.event,s),ee.error("Beaconing disabled due to rate limit.")}}}},{key:"destroy",value:function(){this.eventQueue.destroy(!1)}},{key:"_deduplicateBeaconData",value:function(e,t){var i=this,r={},n=t.view_id;if("-1"===n||"viewstart"===e||"viewend"===e||!this.previousBeaconData||this.mux.utils.now()-this.lastEventTime>=6e5)r=eg({},t),n&&(this.previousBeaconData=r),n&&"viewend"===e&&(this.previousBeaconData=null);else{var a=0===e.indexOf("request");Object.entries(t).forEach(function(t){var n=W(t,2),s=n[0],o=n[1];i.previousBeaconData&&(o!==i.previousBeaconData[s]||tn.indexOf(s)>-1||i.objectHasChanged(a,s,o,i.previousBeaconData[s])||i.eventRequiresKey(e,s))&&(r[s]=o,i.previousBeaconData[s]=o)})}return r}},{key:"objectHasChanged",value:function(e,t,i,r){return!!e&&0===t.indexOf("request_")&&("request_response_headers"===t||"object"!=typeof i||"object"!=typeof r||Object.keys(i||{}).length!==Object.keys(r||{}).length)}},{key:"eventRequiresKey",value:function(e,t){return!!("renditionchange"===e&&0===t.indexOf("video_source_")||ts.includes(t)&&ta.includes(e)||"playbackmodechange"===e&&0===t.indexOf("player_playback_mode"))}}]),e}(),td=function e(t){en(this,e);var i=0,r=0,n=0,a=0,s=0,o=0,l=0;t.on("requestcompleted",function(e,o){var l,d,u=o.request_start,h=o.request_response_start,c=o.request_response_end,m=o.request_bytes_loaded;if(a++,h?(l=h-(null!=u?u:0),d=(null!=c?c:0)-h):d=(null!=c?c:0)-(null!=u?u:0),d>0&&m&&m>0){var f=m/d*8e3;s++,r+=m,n+=d,t.data.view_min_request_throughput=Math.min(t.data.view_min_request_throughput||1/0,f),t.data.view_average_request_throughput=r/n*8e3,t.data.view_request_count=a,l>0&&(i+=l,t.data.view_max_request_latency=Math.max(t.data.view_max_request_latency||0,l),t.data.view_average_request_latency=i/s)}}),t.on("requestfailed",function(e,i){a++,o++,t.data.view_request_count=a,t.data.view_request_failed_count=o}),t.on("requestcanceled",function(e,i){a++,l++,t.data.view_request_count=a,t.data.view_request_canceled_count=l})},tu=function e(t){var i=this;en(this,e),eo(this,"_lastEventTime",void 0),t.on("before*",function(e,r){var n=r.viewer_time,a=j.now(),s=i._lastEventTime;if(i._lastEventTime=a,s&&a-s>36e5){var o=Object.keys(t.data).reduce(function(e,i){return 0===i.indexOf("video_")?Object.assign(e,eo({},i,t.data[i])):e},{});t.mux.log.info("Received event after at least an hour inactivity, creating a new view");var l=t.playbackHeartbeat._playheadShouldBeProgressing;t._resetView(Object.assign({viewer_time:n},o)),t.playbackHeartbeat._playheadShouldBeProgressing=l,t.playbackHeartbeat._playheadShouldBeProgressing&&"play"!==e.type&&"adbreakstart"!==e.type&&(t.emit("play",{viewer_time:n}),"playing"!==e.type&&t.emit("playing",{viewer_time:n}))}})};function th(e,t){return(null==e?void 0:e.toLowerCase())===(null==t?void 0:t.toLowerCase())}var tc=function e(t){en(this,e);var i=function(e){var i,r,n,o=null!=(i=e)&&i.request_type&&("media"===i.request_type||"video"===i.request_type)&&null!=(r=i.request_response_headers)&&r["x-cdn"]?i.request_response_headers["x-cdn"]:null!=i&&i.video_cdn?i.video_cdn:null,l=null!=(n=e)&&n.request_start?n.request_start:null!=n&&n.viewer_time?n.viewer_time:Date.now();null!=o&&!th(o,a)&&s<=l&&(a=o,s=l,t.emit("cdnchange",{video_cdn:o}))},r=null,n=null,a=null,s=0;t.on("viewinit",function(){r=null,n=null,a=null,s=0}),t.on("beforecdnchange",function(e,t){var i=null==t?void 0:t.video_cdn;i&&(void 0===t.video_previous_cdn||null===t.video_previous_cdn)&&(th(i,n)?t.video_previous_cdn=null!=r?r:void 0:(t.video_previous_cdn=null!=n?n:void 0,r=n,n=i))}),t.on("requestcompleted",function(e,t){i(t)})},tm=function(e){try{return JSON.parse(e),!0}catch(e){return!1}},tf=function e(t){var i=this;en(this,e),eo(this,"_emittingAutomaticEvent",!1),eo(this,"_hasInitialized",!1),eo(this,"_currentMode","standard"),t.on("viewstart",function(){i._hasInitialized||(i._hasInitialized=!0,i._currentMode=t.data.player_playback_mode||"standard",i._emittingAutomaticEvent=!0,t.emit("playbackmodechange",{player_playback_mode:i._currentMode,player_playback_mode_data:"{}"}),i._emittingAutomaticEvent=!1)}),t.on("viewend",function(){i._hasInitialized=!1}),t.on("playbackmodechange",function(e,r){i._emittingAutomaticEvent||(r.player_playback_mode_data?tm(r.player_playback_mode_data)||(t.mux.log.warn("Invalid JSON string for player_playback_mode_data"),r.player_playback_mode_data="{}"):r.player_playback_mode_data="{}",t.data.player_playback_mode_data=r.player_playback_mode_data,t.data.player_playback_mode=r.player_playback_mode,i._currentMode=r.player_playback_mode)})},tp=function(){function e(t){en(this,e),eo(this,"pm",void 0),eo(this,"_currentRangeStart",void 0),eo(this,"_lastPlayheadTime",void 0),this.pm=t,this._currentRangeStart=null,this._lastPlayheadTime=null,t.on("playbackheartbeat",this._updatePlaybackRange.bind(this)),t.on("playbackheartbeatend",this._endPlaybackRange.bind(this))}return es(e,[{key:"_updateLastRangeEnd",value:function(){var e=this.pm.data.video_playback_ranges;if(e&&e.length>0){var t=this.pm.data.player_playhead_time||0;e[e.length-1][1]=t}}},{key:"_updatePlaybackRange",value:function(){var e,t=this.pm.data.player_playhead_time||0;if(!(!this.pm.disableAdPlaybackRangeFiltering&&null!=(e=this.pm.adTracker)&&e.isAdBreak&&null!==this._lastPlayheadTime&&t<this._lastPlayheadTime)){if(null!==this._lastPlayheadTime&&null!==this._currentRangeStart&&Math.abs(t-this._lastPlayheadTime)>1e3){var i=this.pm.data.video_playback_ranges;i&&i.length>0&&(i[i.length-1][1]=this._lastPlayheadTime),this._currentRangeStart=null}if(null===this._currentRangeStart){var r=this.pm.data.video_playback_ranges||[];r.length>0&&r[r.length-1][1]===t?this._currentRangeStart=r[r.length-1][0]:(this._currentRangeStart=t,r.push([t,t])),this.pm.data.video_playback_ranges=r}else this._updateLastRangeEnd();this._lastPlayheadTime=t}}},{key:"_endPlaybackRange",value:function(){null!==this._currentRangeStart&&(this._updateLastRangeEnd(),this._currentRangeStart=null,this._lastPlayheadTime=null)}}]),e}(),tg=Object.freeze({CELLULAR:"cellular",WIFI:"wifi",WIRED:"wired",OTHER:"other",NO_CONNECTION:"no_connection",UNKNOWN:"unknown"}),tv=function(e){if(!e)return tg.UNKNOWN;switch(e){case"cellular":case"wimax":return tg.CELLULAR;case"wifi":return tg.WIFI;case"ethernet":return tg.WIRED;case"none":return tg.NO_CONNECTION;case"bluetooth":case"other":default:return tg.OTHER;case"unknown":return tg.UNKNOWN}},tE=T(A()),ty=function(){function e(t){var i=this;en(this,e),eo(this,"pm",void 0),eo(this,"lastType",void 0),eo(this,"lastLowDataMode",void 0),this.pm=t,this.pm.one("viewinit",function(){var t,r=i.emit.bind(i);r(),tE.default.addEventListener("online",r),tE.default.addEventListener("offline",r),null==(t=e.connection)||t.addEventListener("change",r),i.pm.on("destroy",function(){var t;null==(t=e.connection)||t.removeEventListener("change",r),tE.default.removeEventListener("online",r),tE.default.removeEventListener("offline",r)})})}return es(e,[{key:"type",get:function(){var t,i;return(null==(t=tE.default.navigator)?void 0:t.onLine)===!1?tg.NO_CONNECTION:null!=(i=e.connection)&&i.type?tv(e.connection.type):tg.UNKNOWN}},{key:"lowDataMode",get:function(){var t;return null==(t=e.connection)?void 0:t.saveData}},{key:"emit",value:function(){var e=this.type,t=this.lowDataMode;e===this.lastType&&t===this.lastLowDataMode||(this.lastType=e,this.lastLowDataMode=t,this.pm.emit("networkchange",eg({viewer_connection_type:e},void 0!==t&&{viewer_connection_low_data_mode:t})))}}
3],[{key:"connection",get:function(){var e;return"object"==typeof(e=tE.default.navigator)&&"connection"in e&&"object"==typeof e.connection?tE.default.navigator.connection:null}}]),e}(),tb=["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","networkchange","cdnchange","playbackmodechange"],tT=new Set(["requestcompleted","requestfailed","requestcanceled"]),t_=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&eu(r,e);var t,i=(t=function(){if("undefined"==typeof Reflect||!Reflect.construct||Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}(),function(){var e,i=el(r);return e=t?Reflect.construct(i,arguments,el(this).constructor):i.apply(this,arguments),e&&("object"===k(e)||"function"==typeof e)?e:er(this)});function r(e,t,n){en(this,r),eo(er(a=i.call(this)),"pageLoadEndTime",void 0),eo(er(a),"pageLoadInitTime",void 0),eo(er(a),"_destroyed",void 0),eo(er(a),"_heartBeatTimeout",void 0),eo(er(a),"adTracker",void 0),eo(er(a),"dashjs",void 0),eo(er(a),"data",void 0),eo(er(a),"disablePlayheadRebufferTracking",void 0),eo(er(a),"disableRebufferTracking",void 0),eo(er(a),"disableAdPlaybackRangeFiltering",void 0),eo(er(a),"errorTracker",void 0),eo(er(a),"errorTranslator",void 0),eo(er(a),"emitTranslator",void 0),eo(er(a),"getAdData",void 0),eo(er(a),"getPlayheadTime",void 0),eo(er(a),"getStateData",void 0),eo(er(a),"stateDataTranslator",void 0),eo(er(a),"hlsjs",void 0),eo(er(a),"id",void 0),eo(er(a),"longResumeTracker",void 0),eo(er(a),"minimumRebufferDuration",void 0),eo(er(a),"mux",void 0),eo(er(a),"playbackEventDispatcher",void 0),eo(er(a),"playbackHeartbeat",void 0),eo(er(a),"playbackHeartbeatTime",void 0),eo(er(a),"playheadTime",void 0),eo(er(a),"seekingTracker",void 0),eo(er(a),"sustainedRebufferThreshold",void 0),eo(er(a),"watchTimeTracker",void 0),eo(er(a),"currentFragmentPDT",void 0),eo(er(a),"currentFragmentStart",void 0),a.pageLoadInitTime=ef.navigationStart(),a.pageLoadEndTime=ef.domContentLoadedEventEnd(),a.mux=e,a.id=t,null!=n&&n.beaconDomain&&a.mux.log.warn("The `beaconDomain` setting has been deprecated in favor of `beaconCollectionDomain`. Please change your integration to use `beaconCollectionDomain` instead of `beaconDomain`."),(n=Object.assign({debug:!1,minimumRebufferDuration:250,sustainedRebufferThreshold:1e3,playbackHeartbeatTime:25,beaconDomain:"litix.io",sampleRate:1,disableCookies:!1,respectDoNotTrack:!1,disableRebufferTracking:!1,disablePlayheadRebufferTracking:!1,disableAdPlaybackRangeFiltering:!1,errorTranslator:function(e){return e},emitTranslator:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return t},stateDataTranslator:function(e){return e}},n)).data=n.data||{},n.data.property_key&&(n.data.env_key=n.data.property_key,delete n.data.property_key),ee.level=n.debug?$.DEBUG:$.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.disableAdPlaybackRangeFiltering=n.disableAdPlaybackRangeFiltering,a.errorTranslator=n.errorTranslator,a.emitTranslator=n.emitTranslator,a.stateDataTranslator=n.stateDataTranslator,a.playbackEventDispatcher=new tl(e,n.data.env_key,n),a.data={player_instance_id:z(),mux_sample_rate:n.sampleRate,beacon_domain:n.beaconCollectionDomain||n.beaconDomain},a.data.view_sequence_number=1,a.data.player_sequence_number=1;var a,s=(function(){void 0===this.data.view_start&&(this.data.view_start=this.mux.utils.now(),this.emit
3("viewstart"),this.emit("renditionchange"))}).bind(er(a));if(a.on("viewinit",function(e,t){this._resetVideoData(),this._resetViewData(),this._resetErrorData(),this._updateStateData(),Object.assign(this.data,t),this._initializeViewData(),this.one("play",s),this.one("adbreakstart",s)}),a.on("videochange",function(e,t){this._resetView(t)}),a.on("programchange",function(e,t){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(t,{view_program_changed:!0})),s(),this.emit("play"),this.emit("playing")}),a.on("fragmentchange",function(e,t){this.currentFragmentPDT=t.currentFragmentPDT,this.currentFragmentStart=t.currentFragmentStart}),a.on("destroy",a.destroy),"undefined"!=typeof window&&"function"==typeof window.addEventListener&&"function"==typeof window.removeEventListener){var o=function(){var e=void 0!==a.data.view_start;a.mux.WINDOW_HIDDEN="hidden"===document.visibilityState,e&&a.mux.WINDOW_HIDDEN&&(a.data.player_is_paused||a.emit("hb"))};window.addEventListener("visibilitychange",o,!1);var l=function(e){e.persisted||a.destroy()};window.addEventListener("pagehide",l,!1),a.on("destroy",function(){window.removeEventListener("visibilitychange",o),window.removeEventListener("pagehide",l)})}return a.on("playerready",function(e,t){Object.assign(this.data,t)}),tb.forEach(function(e){a.on(e,function(t,i){0!==e.indexOf("ad")&&this._updateStateData(),Object.assign(this.data,i),this._sanitizeData()}),a.on("after"+e,function(){("error"!==e||this.errorTracker.viewErrored)&&this.send(e)})}),a.on("viewend",function(e,t){Object.assign(a.data,t)}),a.one("playerready",function(e){var t=this.mux.utils.now();this.data.player_init_time&&(this.data.player_startup_time=t-this.data.player_init_time),this.pageLoadInitTime=this.data.page_load_init_time||this.pageLoadInitTime,this.pageLoadEndTime=this.data.page_load_end_time||this.pageLoadEndTime,!this.mux.PLAYER_TRACKED&&this.pageLoadInitTime&&(this.mux.PLAYER_TRACKED=!0,(this.data.player_init_time||this.pageLoadEndTime)&&(this.data.page_load_time=Math.min(this.data.player_init_time||1/0,this.pageLoadEndTime||1/0)-this.pageLoadInitTime)),this.send("playerready"),delete this.data.player_startup_time,delete this.data.page_load_time}),a.longResumeTracker=new tu(er(a)),a.errorTracker=new eU(er(a)),new eQ(er(a)),a.seekingTracker=new eq(er(a)),a.playheadTime=new eG(er(a)),a.playbackHeartbeat=new eN(er(a)),new eV(er(a)),a.watchTimeTracker=new eF(er(a)),new eB(er(a)),new tp(er(a)),a.adTracker=new ez(er(a)),new eK(er(a)),new eH(er(a)),new eW(er(a)),new td(er(a)),new tc(er(a)),new tf(er(a)),new ty(er(a)),n.hlsjs&&a.addHLSJS(n),n.dashjs&&a.addDashJS(n),a.emit("viewinit",n.data),a}return es(r,[{key:"emit",value:function(e,t){var i,n=Object.assign({viewer_time:this.mux.utils.now()},t),a=[e,n];if(this.emitTranslator)try{a=this.emitTranslator(e,n)}catch(e){this.mux.log.warn("Exception in emit translator callback.",e)}null!=a&&a.length&&(i=ed(el(r.prototype),"emit",this)).call.apply(i,[this].concat(J(a)))}},{key:"destroy",value:function(){this._destroyed||(this._destroyed=!0,void 0!==this.data.view_start&&(this.emit
3("viewend"),this.send("viewend")),this.playbackEventDispatcher.destroy(),this.removeHLSJS(),this.removeDashJS(),window.clearTimeout(this._heartBeatTimeout))}},{key:"send",value:function(e){if(this.data.view_id){var t=Object.assign({},this.data);if(void 0===t.video_source_is_live&&(t.player_source_duration===1/0||t.video_source_duration===1/0?t.video_source_is_live=!0:(t.player_source_duration>0||t.video_source_duration>0)&&(t.video_source_is_live=!1)),t.video_source_is_live||["player_program_time","player_manifest_newest_program_time","player_live_edge_program_time","player_program_time","video_holdback","video_part_holdback","video_target_duration","video_part_target_duration"].forEach(function(e){t[e]=void 0}),t.video_source_url=t.video_source_url||t.player_source_url,t.video_source_url){var i=W(ec(t.video_source_url),2),r=i[0];t.video_source_domain=i[1],t.video_source_hostname=r}delete t.ad_request_id,t.video_playback_ranges&&(t.video_playback_range=JSON.stringify(t.video_playback_ranges.filter(function(e){return e[0]!==e[1]}).map(function(e){return"".concat(e[0],":").concat(e[1])})),delete t.video_playback_ranges),this.playbackEventDispatcher.send(e,t),this.data.view_sequence_number++,this.data.player_sequence_number++,tT.has(e)||this._restartHeartBeat(),"viewend"===e&&delete this.data.view_id}}},{key:"_resetView",value:function(e){this.emit("viewend"),this.send("viewend"),this.emit("viewinit",e)}},{key:"_updateStateData",value:function(){var e,t=this.getStateData();if("function"==typeof this.stateDataTranslator)try{t=this.stateDataTranslator(t)}catch(e){this.mux.log.warn("Exception in stateDataTranslator translator callback.",e)}null!=(e=this.data)&&e.video_cdn&&null!=t&&t.video_cdn&&(t.video_cdn,t=function(e,t){if(null==e)return{};var i,r,n=function(e,t){if(null==e)return{};var i,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)i=a[r],t.indexOf(i)>=0||(n[i]=e[i]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)i=a[r],!(t.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}(t,["video_cdn"])),Object.assign(this.data,t),this.playheadTime._updatePlayheadTime(),this._sanitizeData()}},{key:"_sanitizeData",value:function(){var e=this;["player_width","player_height","video_source_width","video_source_height","player_playhead_time","video_source_bitrate"].forEach(function(t){var i=parseInt(e.data[t],10);e.data[t]=isNaN(i)?void 0:i}),["player_source_url","video_source_url"].forEach(function(t){if(e.data[t]){var i=e.data[t].toLowerCase();(0===i.indexOf("data:")||0===i.indexOf("blob:"))&&(e.data[t]="MSE style URL")}})}},{key:"_resetVideoData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("video_")&&delete e.data[t]})}},{key:"_resetViewData",value:function(){var e=this;Object.keys(this.data).forEach(function(t){0===t.indexOf("view_")&&delete e.data[t]}),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 e=this,t=this.data.view_id=z(),i=function(){t===e.data.view_id&&ep(e.data,"player_view_count",1)};this.data.player_is_paused?this.one("play",i):i()}},{key:"_restartHeartBeat",value:function(){var e=this;window.clearTimeout(this._heartBeatTimeout),this._heartBeatTimeout=window.setTimeout(function(){e.data.player_is_paused||e.emit("hb")},1e4)}},{key:"addHLSJS",value:function(e){return e.hlsjs?this.hlsjs?void this.mux.log.warn("An instance of HLS.js is already being monitored for this player."):void(this.hlsjs=e.hlsjs,eR(this.mux,this.id,e.hlsjs,{},e.Hls||window.Hls)):void this.mux.log.warn("You must pass a valid hlsjs instance in order to track it.")}},{key:"removeHLSJS",value:function(){this.hlsjs&&(ek(this.hlsjs),this.hlsjs=void 0)}},{key:"addDashJS",value:function(e){return e.dashjs?this.dashjs?void this.mux.log.warn("An instance of Dash.js is already being monitored for this player."):void(this.dashjs=e.dashjs,eC(this.mux,this.id,e.dashjs)):void this.mux.log.warn("You must pass a valid dashjs instance in order to track it.")}},{key:"removeDashJS",value:function(){this.dashjs&&(eM(this.dashjs),this.dashjs=void 0)}}]),r}(eO),tA=T(G());function tS(){return tA.default&&!!(tA.default.fullscreenElement||tA.default.webkitFullscreenElement||tA.default.mozFullScreenElement||tA.default.msFullscreenElement)}var tR,tk=["loadstart","pause","play","playing","seeking","seeked","timeupdate","ratechange","stalled","waiting","error","ended"],tI={1:"MEDIA_ERR_ABORTED",2:"MEDIA_ERR_NETWORK",3:"MEDIA_ERR_DECODE",4:"MEDIA_ERR_SRC_NOT_SUPPORTED"},tL=T(A());tL.default&&tL.default.WeakMap&&(tR=new WeakMap);var tD={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:"#
3EXT-X-SESSION-DATA"},tw=function(e){return this.buffer="",this.manifest={segments:[],serverControl:{},sessionData:{}},this.currentUri={},this.process(e),this.manifest};tw.prototype.process=function(e){var t;for(this.buffer+=e,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.processLine(this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},tw.prototype.processLine=function(e){var t=e.indexOf(":"),i=tU(e,t),r=i[0],n=2===i.length?tP(i[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 tD.TARGET_DURATION:if(!isFinite(n)||n<0)return;this.manifest.targetDuration=n,this.setHoldBack();break;case tD.PART_INF:tC(this.manifest,i),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),this.setHoldBack();break;case tD.SERVER_CONTROL:tC(this.manifest,i),this.setHoldBack();break;case tD.INF:0===n?this.currentUri.duration=.01:n>0&&(this.currentUri.duration=n);break;case tD.PROGRAM_DATE_TIME:var 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 tD.VERSION:tC(this.manifest,i);break;case tD.SESSION_DATA:var s=e_(tF(i[1]));Object.assign(this.manifest.sessionData,s)}},tw.prototype.setHoldBack=function(){var e=this.manifest,t=e.serverControl,i=e.targetDuration,r=e.partTargetDuration;if(t){var n="holdBack",a="partHoldBack",s=i&&3*i,o=r&&2*r;i&&!t.hasOwnProperty(n)&&(t[n]=s),s&&t[n]<s&&(t[n]=s),r&&!t.hasOwnProperty(a)&&(t[a]=3*r),r&&t[a]<o&&(t[a]=o)}};var tC=function(e,t){var i,r=tM(t[0].replace("#EXT-X-",""));tN(t[1])?(i={},i=Object.assign(tx(t[1]),i)):i=tP(t[1]),e[r]=i},tM=function(e){return e.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})},tP=function(e){if("yes"===e.toLowerCase()||"no"===e.toLowerCase())return"yes"===e.toLowerCase();var t=-1!==e.indexOf(":")?e:parseFloat(e);return isNaN(t)?e:t},tO=function(e){var t={},i=e.split("=");return i.length>1&&(t[tM(i[0])]=tP(i[1])),t},tx=function(e){for(var t=e.split(","),i={},r=0;t.length>r;r++)i=Object.assign(tO(t[r]),i);return i},tN=function(e){return e.indexOf("=")>-1},tU=function(e,t){return -1===t?[e]:[e.substring(0,t),e.substring(t+1)]},tF=function(e){var t={};if(e){var i=e.search(",");return[e.slice(0,i),e.slice(i+1)].forEach(function(e,i){for(var r=e.replace(/['"]+/g,"").split("="),n=0;n<r.length;n++)"DATA-ID"===r[n]&&(t["DATA-ID"]=r[1-n]),"VALUE"===r[n]&&(t.VALUE=r[1-n])}),{data:t}}},tB={safeCall:function(e,t,i,r){var n=r;if(e&&"function"==typeof e[t])try{n=e[t].apply(e,i)}catch(e){ee.info("safeCall error",e)}return n},safeIncrement:ep,getComputedStyle:function(e,t){var i;return e&&t&&tL.default&&"function"==typeof tL.default.getComputedStyle?(tR&&tR.has(e)&&(i=tR.get(e)),i||(i=tL.default.getComputedStyle(e,null),tR&&tR.set(e,i)),i.getPropertyValue(t)):""},secondsToMs:function(e){return Math.floor(1e3*e)},assign:Object.assign,headersStringToObject:eb,cdnHeadersToRequestId:eT,extractHostnameAndDomain:ec,extractHostname:eh,manifestParser:tw,generateShortID:Q,generateUUID:z,now:j.now,findMediaElement:Z},tG={},tH=function(e){var t=arguments;"string"==typeof e?tH.hasOwnProperty(e)?V.default.setTimeout(function(){t=Array.prototype.splice.call(t,1),tH[e].apply(null,t)},0):ee.warn("`"+e+"` is an unknown task"):"function"==typeof e?V.default.setTimeout(function(){e(tH)},0):ee.warn("`"+e+"` is invalid.")},tK={loaded:j.now(),NAME:"mux-embed",VERSION:"5.18.1",API_VERSION:"2.1",PLAYER_TRACKED:!1,monitor:function(e,t){return function(e,t,i){var r=W(Z(t),3),n=r[0],a=r[1],s=r[2],o=e.log,l=e.utils.getComputedStyle,d=e.utils.secondsToMs;if(!n)return o.error("No element was found with the `"+a+"` query selector.");if("video"!==s&&"audio"!==s)return o.error("The element of `"+a+"` was not a media element.");n.mux&&(n.mux.destroy(),delete n.mux,o.warn("Already monitoring this video element, replacing existing event listeners")),(i=Object.assign({automaticErrorTracking:!0},i,{getPlayheadTime:function(){return d(n.currentTime)},getStateData:function(){var e,t,i=(null==(e=this.getPlayheadTime)?void 0:e.call(this))||d(n.currentTime),r=this.hlsjs&&this.hlsjs.url,a=this.dashjs&&"function"==typeof this.dashjs.getSource&&this.dashjs.getSource(),s={player_is_paused:n.paused,player_width:parseInt(l(n,"width")),player_height:parseInt(l(n,"height")),player_autoplay_on:n.autoplay,player_preload_on:n.preload,player_language_code:n.lang,player_is_fullscreen:tS(),video_poster_url:n.poster,video_source_url:r||a||n.currentSrc,video_source_duration:d(n.duration),video_source_height:n.videoHeight,video_source_width:n.videoWidth,view_dropped_frame_count:null==n||null==(t=n.getVideoPlaybackQuality)?void 0:t.call(n).droppedVideoFrames};if(n.getStartDate&&i>
30){var o=n.getStartDate();if(o&&"function"==typeof o.getTime&&o.getTime()){var u=o.getTime();s.player_program_time=u+i,n.seekable.length>0&&(s.player_live_edge_program_time=u+n.seekable.end(n.seekable.length-1))}}return s}})).data=Object.assign({player_software:"HTML5 Video Element",player_mux_plugin_name:"VideoElementMonitor",player_mux_plugin_version:e.VERSION},i.data),n.mux=n.mux||{},n.mux.deleted=!1,n.mux.emit=function(t,i){e.emit(a,t,i)},n.mux.updateData=function(e){n.mux.emit("hb",e)};var u=function(){o.error("The monitor for this video element has already been destroyed.")};n.mux.destroy=function(){Object.keys(n.mux.listeners).forEach(function(e){n.removeEventListener(e,n.mux.listeners[e],!1)}),delete n.mux.listeners,n.mux.fullscreenChangeListener&&(document.removeEventListener("fullscreenchange",n.mux.fullscreenChangeListener,!1),delete n.mux.fullscreenChangeListener),n.mux.destroy=u,n.mux.swapElement=u,n.mux.emit=u,n.mux.addHLSJS=u,n.mux.addDashJS=u,n.mux.removeHLSJS=u,n.mux.removeDashJS=u,n.mux.updateData=u,n.mux.setEmitTranslator=u,n.mux.setStateDataTranslator=u,n.mux.setGetPlayheadTime=u,n.mux.deleted=!0,e.emit(a,"destroy")},n.mux.swapElement=function(t){var i=W(Z(t),3),r=i[0],a=i[1],s=i[2];return r?"video"!==s&&"audio"!==s?e.log.error("The element of `"+a+"` was not a media element."):void(r.muxId=n.muxId,delete n.muxId,r.mux=r.mux||{},r.mux.listeners=Object.assign({},n.mux.listeners),delete n.mux.listeners,Object.keys(r.mux.listeners).forEach(function(e){n.removeEventListener(e,r.mux.listeners[e],!1),r.addEventListener(e,r.mux.listeners[e],!1)}),r.mux.fullscreenChangeListener=n.mux.fullscreenChangeListener,delete n.mux.fullscreenChangeListener,r.mux.swapElement=n.mux.swapElement,r.mux.destroy=n.mux.destroy,delete n.mux,n=r):e.log.error("No element was found with the `"+a+"` query selector.")},n.mux.addHLSJS=function(t){e.addHLSJS(a,t)}
3,n.mux.addDashJS=function(t){e.addDashJS(a,t)},n.mux.removeHLSJS=function(){e.removeHLSJS(a)},n.mux.removeDashJS=function(){e.removeDashJS(a)},n.mux.setEmitTranslator=function(t){e.setEmitTranslator(a,t)},n.mux.setStateDataTranslator=function(t){e.setStateDataTranslator(a,t)},n.mux.setGetPlayheadTime=function(t){t||(t=i.getPlayheadTime),e.setGetPlayheadTime(a,t)},e.init(a,i),e.emit(a,"playerready"),n.paused||(e.emit(a,"play"),n.readyState>2&&e.emit(a,"playing")),n.mux.listeners={},tk.forEach(function(t){("error"!==t||i.automaticErrorTracking)&&(n.mux.listeners[t]=function(){var i={};if("error"===t){if(!n.error||1===n.error.code)return;i.player_error_code=n.error.code,i.player_error_message=tI[n.error.code]||n.error.message}e.emit(a,t,i)},n.addEventListener(t,n.mux.listeners[t],!1))}),n.mux.listeners.enterpictureinpicture=function(){e.emit(a,"playbackmodechange",{player_playback_mode:"pip",player_playback_mode_data:"{}"})},n.mux.listeners.leavepictureinpicture=function(){var t=tS()?"fullscreen":"standard";e.emit(a,"playbackmodechange",{player_playback_mode:t,player_playback_mode_data:"{}"})},n.addEventListener("enterpictureinpicture",n.mux.listeners.enterpictureinpicture,!1),n.addEventListener("leavepictureinpicture",n.mux.listeners.leavepictureinpicture,!1),n.mux.fullscreenChangeListener=function(){var t=tS(),i=document.fullscreenElement;if(t&&(i===n||null!=i&&i.contains(n)))e.emit(a,"playbackmodechange",{player_playback_mode:"fullscreen",player_playback_mode_data:"{}"});else if(!t){var r=document.pictureInPictureElement===n;e.emit(a,"playbackmodechange",{player_playback_mode:r?"pip":"standard",player_playback_mode_data:"{}"})}},document.addEventListener("fullscreenchange",n.mux.fullscreenChangeListener,!1)}(tH,e,t)},destroyMonitor:function(e){var t=W(Z(e),1)[0];t&&t.mux&&"function"==typeof t.mux.destroy?t.mux.destroy():ee.error("A video element monitor for `"+e+"` has not been initialized via `mux.monitor`.")},addHLSJS:function(e,t){var i=X(e);tG[i]?tG[i].addHLSJS(t):ee.error("A monitor for `"+i+"` has not been initialized.")},addDashJS:function(e,t){var i=X(e);tG[i]?tG[i].addDashJS(t):ee.error("A monitor for `"+i+"` has not been initialized.")},removeHLSJS:function(e){var t=X(e);tG[t]?tG[t].removeHLSJS():ee.error("A monitor for `"+t+"` has not been initialized.")},removeDashJS:function(e){var t=X(e);tG[t]?tG[t].removeDashJS():ee.error("A monitor for `"+t+"` has not been initialized.")},init:function(e,t){ei()&&t&&t.respectDoNotTrack&&ee.info("The browser's Do Not Track flag is enabled - Mux beaconing is disabled.");var i=X(e);tG[i]=new t_(tH,i,t)},emit:function(e,t,i){var r=X(e);tG[r]?(tG[r].emit(t,i),"destroy"===t&&delete tG[r]):ee.error("A monitor for `"+r+"` has not been initialized.")},updateData:function(e,t){var i=X(e);tG[i]?tG[i].emit("hb",t):ee.error("A monitor for `"+i+"` has not been initialized.")},setEmitTranslator:function(e,t){var i=X(e);tG[i]?tG[i].emitTranslator=t:ee.error("A monitor for `"+i+"` has not been initialized.")},setStateDataTranslator:function(e,t){var i=X(e);tG[i]?tG[i].stateDataTranslator=t:ee.error("A monitor for `"+i+"` has not been initialized.")},setGetPlayheadTime:function(e,t){var i=X(e);tG[i]?tG[i].getPlayheadTime=t:ee.error("A monitor for `"+i+"` has not been initialized.")},checkDoNotTrack:ei,log:ee,utils:tB,events:{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",PLAYBACK_MODE_CHANGE:"playbackmodechange",NETWORK_CHANGE:"networkchange",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"},WINDOW_HIDDEN:!1,WINDOW_UNLOADING:!1};Object.assign(tH,tK),void 0!==V.default&&"function"==typeof V.default.addEventListener&&V.default.addEventListener("pagehide",function(e){e.persisted||(tH.WINDOW_UNLOADING=!0)},!1);let tW=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},tV=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=tq},tq=Number.MAX_SAFE_INTEGER||0x1fffffffffffff,tY=function(e){return e.NETWORK_E
3RROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),tj=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",e.LEVEL_LOAD_ERROR="levelLoadError",e.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",e.LEVEL_PARSING_ERROR="levelParsingError",e.LEVEL_SWITCH_ERROR="levelSwitchError",e.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",e.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",e.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",e.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",e.FRAG_LOAD_ERROR="fragLoadError",e.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",e.FRAG_DECRYPT_ERROR="fragDecryptError",e.FRAG_PARSING_ERROR="fragParsingError",e.FRAG_GAP="fragGap",e.REMUX_ALLOC_ERROR="remuxAllocError",e.KEY_LOAD_ERROR="keyLoadError",e.KEY_LOAD_TIMEOUT="keyLoadTimeOut",e.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",e.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",e.BUFFER_APPEND_ERROR="bufferAppendError",e.BUFFER_APPENDING_ERROR="bufferAppendingError",e.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",e.BUFFER_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",e.UNKNOWN="unknown",e}({}),tz=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="hl
3sSubtitleFragProcessed",e.CUES_PARSED="hlsCuesParsed",e.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",e.INIT_PTS_FOUND="hlsInitPtsFound",e.FRAG_LOADING="hlsFragLoading",e.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",e.FRAG_LOADED="hlsFragLoaded",e.FRAG_DECRYPTED="hlsFragDecrypted",e.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",e.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",e.FRAG_PARSING_METADATA="hlsFragParsingMetadata",e.FRAG_PARSED="hlsFragParsed",e.FRAG_BUFFERED="hlsFragBuffered",e.FRAG_CHANGED="hlsFragChanged",e.FPS_DROP="hlsFpsDrop",e.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",e.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",e.ERROR="hlsError",e.DESTROYING="hlsDestroying",e.KEY_LOADING="hlsKeyLoading",e.KEY_LOADED="hlsKeyLoaded",e.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",e.BACK_BUFFER_REACHED="hlsBackBufferReached",e.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",e.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({});var tQ={exports:{}},tX=function(){var e,t,i,r,n;return d2?tQ.exports:(d2=1,e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,t=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,tQ.exports=n={buildAbsoluteURL:function(e,i,r){if(r=r||{},e=e.trim(),!(i=i.trim())){if(!r.alwaysNormalize)return e;var a=n.parseURL(e);if(!a)throw Error("Error trying to parse base URL.");return a.path=n.normalizePath(a.path),n.buildURLFromParts(a)}var s=n.parseURL(i);if(!s)throw Error("Error trying to parse relative URL.");if(s.scheme)return r.alwaysNormalize?(s.path=n.normalizePath(s.path),n.buildURLFromParts(s)):i;var o=n.parseURL(e);if(!o)throw Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=t.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var d={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(d.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var u=o.path,h=u.substring(0,u.lastIndexOf("/")+1)+s.path;d.path=n.normalizePath(h)}else d.path=o.path,!s.params&&(d.params=o.params,s.query||(d.query=o.query));return null===d.path&&(d.path=r.alwaysNormalize?n.normalizePath(s.path):s.path),n.buildURLFromParts(d)},parseURL:function(t){var i=e.exec(t);return i?{scheme:i[1]||"",netLoc:i[2]||"",path:i[3]||"",params:i[4]||"",query:i[5]||"",fragment:i[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(i,"");e.length!==(e=e.replace(r,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},tQ.exports)}();class tZ{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}}}let tJ=function(e){return e.MANIFEST="manifest",e.LEVEL="level",e.AUDIO_TRACK="audioTrack",e.SUBTITLE_TRACK="subtitleTrack",e.MEDIA_FRAGMENT="media-fragment",e.KEY="key",e.STEERING_MANIFEST="steering-manifest",e.SERVER_CERTIFICATE="server-certificate",e.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",e}({}),t$=function(e){return e.MAIN="main",e.AUDIO="audio",e.SUBTITLE="subtitle",e}({});var t0={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class t1{setByteRange(e,t){let i,r=e.split("@",2);i=1===r.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]}get baseurl(){return this.base.url}get byteRange(){return null===this._byteRange?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return null===this._streams&&(this._streams={[t0.AUDIO]:null,[t0.VIDEO]:null,[t0.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return null!==this._stats}
3get hasStreams(){return null!==this._streams}get stats(){return null===this._stats&&(this._stats=new tZ),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=tX.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){let{elementaryStreams:e}=this;e[t0.AUDIO]=null,e[t0.VIDEO]=null,e[t0.AUDIOVIDEO]=null,this.url=null}constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,function(e,t){let i=function e(t,i){let r=Object.getPrototypeOf(t);if(r){let t=Object.getOwnPropertyDescriptor(r,i);return t||e(r,i)}}(e,t);i&&(i.enumerable=!0,Object.defineProperty(e,t,i))}(this,"stats")}}function t2(e){return"initSegment"!==e.sn}function t3(e,t){return e.sn===(null==t?void 0:t.sn)&&e.level===t.level}function t4(e,t){return e.sn===(null==t?void 0:t.sn)&&e.level===t.level&&e.cc===t.cc}class t5 extends t1{get byteLength(){if(this.hasStats){let e=this.stats.total;if(e)return e}if(this.byteRange.length){let e=this.byteRange[0],t=this.byteRange[1];if(tW(e)&&tW(t))return t-e}return null}get bitrate(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;let{levelkeys:t}=this;if(!t||t.NONE)return null;if(t.identity)this._decryptdata||(this._decryptdata=t.identity.getDecryptData(this.sn));else if(!(null!=(e=this._decryptdata)&&e.keyId)){let e=Object.keys(t);if(1===e.length){let i=this._decryptdata=t[e[0]]||null;i&&(this._decryptdata=i.getDecryptData(this.sn,t))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;let e=tW(this.duration)?this.duration:0;return this.programDateTime+1e3*e}get encrypted(){var e,t;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){let e=Object.keys(this.levelkeys),i=e.length;if(i>1||1===i&&null!=(t=this.levelkeys[e[0]])&&t.encrypted)return!0}return!1}get programDateTime(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!tW(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return t2(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){let t=this.levelkeys;if(t){var i;let r=t[e];r&&!(null!=(i=this._decryptdata)&&i.keyId)&&(this._decryptdata=r.getDecryptData(this.sn,t))}}abortRequests(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()}setElementaryStreamInfo(e,t,i,r,n){let a=arguments.length>5&&void 0!==arguments[5]&&arguments[5],{elementaryStreams:s}=this,o=s[e];if(!o){s[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:n,partial:a};return}o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)}constructor(e,t){super(t),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=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.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,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}}class t8 extends t1{get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){let{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===t$.SUBTITLE&&this.stats.loading.end>0)}constructor(e,t,i,r,n){super(i),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=r;let a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,n),n&&(this.fragOffset=n.fragOffset+n.duration)}}function t6(){return(t6=Object.assign.bind()).apply(null,arguments)}function t9(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,r)}return i}function t7(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};
3t%2?t9(Object(i),!0).forEach(function(t){var r,n;r=t,n=i[t],(r=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):t9(Object(i)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))})}return e}function ie(e,t){if(null==e)return{};var i,r,n=function(e,t){if(null==e)return{};var i={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)i=a[r],-1===t.indexOf(i)&&({}).propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function it(e){switch(e.details){case tj.FRAG_LOAD_TIMEOUT:case tj.KEY_LOAD_TIMEOUT:case tj.LEVEL_LOAD_TIMEOUT:case tj.MANIFEST_LOAD_TIMEOUT:case tj.AUDIO_TRACK_LOAD_TIMEOUT:case tj.SUBTITLE_TRACK_LOAD_TIMEOUT:case tj.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function ii(e){return e.details.startsWith("key")}function ir(e){return ii(e)&&!!e.frag&&!e.frag.decryptdata}function ia(e,t){let i=it(t);return e.default["".concat(i?"timeout":"error","Retry")]}function is(e,t){return Math.min(("linear"===e.backoff?1:Math.pow(2,t))*e.retryDelayMs,e.maxRetryDelayMs)}function io(e){return t7(t7({},e),{errorRetry:null,timeoutRetry:null})}function il(e,t,i,r){var n;if(!e)return!1;let a=null==r?void 0:r.code,s=t<e.maxNumRetry&&(id(n=a)||!!n&&(n<400||n>499)||!!i);return e.shouldRetry?e.shouldRetry(e,t,i,r,s):s}function id(e){return 0===e&&!1===navigator.onLine}function iu(e,t){return t>0&&e.loadError>0&&0!==e.loadErrorTime&&self.performance.now()-e.loadErrorTime>t}class ih{sample(e,t){let i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){let e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}constructor(e,t=0,i=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}}class ic{update(e,t){let{slow_:i,fast_:r,ttfb_:n}=this;i.halfLife!==e&&(this.slow_=new ih(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new ih(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.ttfb_=new ih(e,n.getEstimate(),n.getTotalWeight()))}sample(e,t){if(t<=0)return;let i=Math.max(e,Math.min(this.minDelayMs_,t/1e5))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)}sampleTTFB(e){let t=Math.sqrt(2)*Math.exp(-Math.pow(e/1e3,2)/2);this.ttfb_.sample(t,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_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}constructor(e,t,i,r=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_
3=new ih(e),this.fast_=new ih(t),this.defaultTTFB_=r,this.ttfb_=new ih(e)}}class im{constructor(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;let i="[".concat(e,"]:");this.trace=ip,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)}}let ip=function(){},ig={trace:ip,debug:ip,log:ip,warn:ip,info:ip,error:ip};function iv(){return t6({},ig)}function iE(e,t,i){return t[e]?t[e].bind(t):function(e,t){let i=self.console[e];return i?i.bind(self.console,"".concat(t?"["+t+"] ":"","[").concat(e,"] >")):ip}(e,i)}let iy=iv();function ib(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if("undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function iT(e,t){let i=Object.keys(e),r=Object.keys(t),n=i.length,a=r.length;return!n||!a||n===a&&!i.some(e=>-1===r.indexOf(e))}function i_(e){return e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer}let iA="utf-16be",iS="utf-16le",iR="utf-8";function ik(){try{return crypto.randomUUID()}catch(e){try{let e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(t){let e=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?i:3&i|8).toString(16)})}}}function iI(e,t){return t+10<=e.length&&73===e[t]&&68===e[t+1]&&51===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1}function iL(e,t){return(127&e[t])<<21|(127&e[t+1])<<14|(127&e[t+2])<<7|127&e[t+3]}function iD(e,t){return t+10<=e.length&&51===e[t]&&68===e[t+1]&&73===e[t+2]&&e[t+3]<255&&e[t+4]<255&&e[t+6]<128&&e[t+7]<128&&e[t+8]<128&&e[t+9]<128||!1}function iw(e,t){let i=t,r=0;for(;iI(e,t);)r+=10,r+=iL(e,t+6),iD(e,t+10)&&(r+=10),t+=r;if(r>0)return e.subarray(i,i+r)}function iC(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1/0;return function(e,t,i,r){var n,a;let s=i_(n=e)?n:n.buffer,o=1;"BYTES_PER_ELEMENT"in r&&(o=r.BYTES_PER_ELEMENT);let l=(a=e)&&i_(a.buffer)&&void 0!==a.byteLength&&void 0!==a.byteOffset?e.byteOffset:0,d=(l+e.byteLength)/o,u=Math.floor(Math.max(0,Math.min((l+t)/o,d)));return new r(s,u,Math.floor(Math.min(u+Math.max(i,0),d))-u)}(e,t,i,Uint8Array)}function iM(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t?e.indexOf(0):e.length,r=function(e){let t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=i_(e)?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength);let n=0,{encoding:a}=r;if(!a){let e=t.getUint8(0),i=t.getUint8(1);239==e&&187==i&&191==t.getUint8(2)?(a=iR,n=3):254==e&&255==i?(a=iA,n=2):255==e&&254==i?(a=iS,n=2):a=iR}if("undefined"!=typeof TextDecoder)return new TextDecoder(a).decode(t);let{byteLength:s}=t,o=a!==iA,l="";for(;n<s;){switch(a){case iR:if((i=t.getUint8(n))<128)n++;else if(i>=194&&i<=223)if(n+1<s){let e=t.getUint8(n+1);e>=128&&e<=191?(i=(31&i)<<6|63&e,n+=2):n++}else n++;else if(i>=224&&i<=239)if(n+2<=s-1){let e=t.getUint8(n+1),r=t.getUint8(n+2);e>=128&&e<=191&&r>=128&&r<=191?(i=(15&i)<<12|(63&e)<<6|63&r,n+=3):n++}else n++;else if(i>=240&&i<=244)if(n+3<=s-1){let e=t.getUint8(n+1),r=t.getUint8(n+2),a=t.getUint8(n+3);e>=128&&e<=191&&r>=128&&r<=191&&a>=128&&a<=191?(i=(7&i)<<18|(63&e)<<12|(63&r)<<6|63&a,n+=4):n++}else n++;else n++;break;case iA:case"utf-16":case iS:i=t.getUint16(n,o),n+=2}l+=String.fromCodePoint(i)}return l}(new DataView(e.buffer,e.byteOffset,i),{encoding:iR});return t?r:r.replace(/\0/g,"")}function iP(e){let t=0,i=[];for(;iI(e,t);){let r=iL(e,t+6);e[t+5]>>6&1&&(t+=10);let n=(t+=10)+r;for(;t+10<n;){let r=function(e){let t=String.fromCharCode(e[0],e[1],e[2],e[3]),i=iL(e,4);return{type:t,size:i,data:e.subarray(10,10+i)}}(e.subarray(t)),n=function(e){if("PRIV"===e.type){if(e.size<2)return;let t=iM(e.data,!0),i=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:i.buffer}}if("W"===e.type[0]){if("WXXX"===e.type){if(e.size<2)return;let t=1,i=iM(e.data.subarray(t),!0);t+=i.length+1;let r=iM(e.data.subarray(t));return{key:e.type,info:i,data:r}}let t=iM(e.data);return{key:e.type,info:"",data:t}}return"APIC"===e.type?function(e){let t,i={key:e.type,description:"",data:"",mimeType:null,pictureType:null};if(e.size<2)return;if(3!==e.data[0])return void console.log("Ignore frame with unrecognized character encoding");let r=e.data.subarray(1).indexOf(0);if(-1===r)return;let n=iM(iC(e.data,1,r)),a=e.data[2+r],s=e.data.subarray(3+r).indexOf(0);if(-1===s)return;let o=iM(iC(e.data,3+r,s));if("-->"===n)t=iM(iC(e.data,4+r+s));else{var l;t=i_(l=e.data.subarray(4+r+s))?l:0==l.byteOffset&&l.byteLength==l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer}return i.mimeType=n,i.pictureType=a,i.description=o,i.data=t,i}(e):function(e){if(e.size<2)return;if("TXXX"===e.type){let t=1,{data:i}=e,r=iM(i.subarray(t),!0);t+=r.length+1;let n=iM(i.subarray(t));return{key:e.type,info:r,data:n}}let t=iM(e.data.subarray(1));return{key:e.type,info:"",data:t}}(e)}(r);n&&i.push(n),t+=r.size+10}iD(e,t)&&(t+=10)}return i}function iO(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info}function ix(e){for(let t of iP(e))if(iO(t))return function(e){if(8===e.data.byteLength){let t=new Uint8Array(e.data),i=1&t[3],r=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return r/=45,i&&(r+=47721858.84),Math.round(r)}}(t)}function iN(e){let t="";for(let i=0;i<e.length;i++){let r=e[i].toString(16);r.length<2&&(r="0"+r),t+=r}return t}function iU(e){return Uint8Array.from(e.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function iF(e){return Uint8Array.from(atob(e),e=>e.charCodeAt(0))}function iB(e){return String.fromCharCode.apply(null,e)}let iG={avc1:0x61766331,avcC:0x61766343,hvc1:0x68766331,hvcC:0x68766343,btrt:0x62747274,dinf:0x64696e66,dref:0x64726566,esds:0x65736473,free:0x66726565,ftyp:0x66747970,hdlr:0x68646c72,mdat:0x6d646174,mdhd:0x6d646864,mdia:0x6d646961,mfhd:0x6d666864,minf:0x6d696e66,moof:0x6d6f6f66,moov:0x6d6f6f76,mp4a:0x6d703461,".mp3":0x2e6d7033,dac3:0x64616333,"ac-3":0x61632d33,mvex:0x6d766578,mvhd:0x6d766864,pasp:0x70617370,sdtp:0x73647470,stbl:0x7374626c,stco:0x7374636f,stsc:0x73747363,stsd:0x73747364,stsz:0x7374737a,stts:0x73747473,tfdt:0x74666474,tfhd:0x74666864,traf:0x74726166,trak:0x7472616b,trun:0x7472756e,trex:0x74726578,tkhd:0x746b6864,vmhd:0x766d6864,smhd:0x736d6864},iH={video:1,audio:2,id3:3,text:4};function iK(e,t){let i=e[t]<<8|e[t+1];return i<0?65536+i:i}function iW(e,t){let i=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return i<0?0x100000000+i:i}function iV(e,t){let i=iW(e,t);return i*=0x100000000,i+=iW(e,t+4)}function iq(e,t){let i="";for(let r=t;r<e.length;r++)if(i+=String.fromCharCode(e[r]),0===e[r])return i;return null}function iY(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function ij(e,t,i){e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function iz(e,t,i){let r=t.byteOffset-e.byteOffset-8,n=8+i,a=t.byteLength+8-n;
3a<8||(ij(e,r,n),ij(e,r+n,a),ij(e,r+n+4,iG.free))}function iQ(e,t){return[e.byteOffset-t-8,e.byteOffset-t+e.byteLength]}function iX(e,t){t.sort((e,t)=>e[0]-t[0]);let i=t.reduce((e,t)=>{let[i,r]=t;return e+r-i},0),r=new Uint8Array(e.byteLength-i),n=0,a=0;for(let i=0;i<t.length;i++){let[s,o]=t[i];r.set(e.subarray(n,s),a),a+=s-n,n=o}return r.set(e.subarray(n),a),{result:r,dropped:i,droppedBefore:e=>t.reduce((t,i)=>{let[r,n]=i;return n<=e?t+n-r:t},0)}}function iZ(e,t){let i=[];return t.length&&function e(t,i,r,n,a,s){let o=i[r];if((null==o?void 0:o.length)!==4)return;let l=o.charCodeAt(0),d=o.charCodeAt(1),u=o.charCodeAt(2),h=o.charCodeAt(3),c=i.length-1;for(let o=n;o<a;){let n=o+8<=a,m=o+4<=a?0x1000000*t[o]+(t[o+1]<<16|t[o+2]<<8|t[o+3]):iW(t,o),f=m>1?o+m:a;if(n&&t[o+4]===l&&t[o+5]===d&&t[o+6]===u&&t[o+7]===h){let n=Math.min(f,a);r===c?s.push(t.subarray(o+8,n)):e(t,i,r+1,o+8,n,s)}o=f}}(e,t,0,0,e.byteLength,i),i}function iJ(e){let t=[],i=iZ(e,["moov","trak"]);for(let e=0;e<i.length;e++){let r=i[e],n=iZ(r,["tkhd"])[0];if(n){let e=n[0],i=iW(n,0===e?12:20),a=iZ(r,["mdia","mdhd"])[0];if(a){e=a[0];let n=iW(a,0===e?12:20),s=iZ(r,["mdia","hdlr"])[0];if(s){let e=iB(s.subarray(8,12)),a={soun:t0.AUDIO,vide:t0.VIDEO}[e],o=function(e){let t,i=e.subarray(8),r=i.subarray(86),n=iB(i.subarray(4,8)),a=n,s="enca"===n||"encv"===n;if(s){let e=iZ(i,[n])[0].subarray("enca"===n?28:78);iZ(e,["sinf"]).forEach(e=>{let t=iZ(e,["schm"])[0];if(t){let i=iB(t.subarray(4,8));if("cbcs"===i||"cenc"===i){let t=iZ(e,["frma"])[0];t&&(a=iB(t))}}})}let o=a;switch(a){case"avc1":case"avc2":case"avc3":case"avc4":{let e=iZ(r,["avcC"])[0];e&&e.length>3&&(a+="."+i1(e[1])+i1(e[2])+i1(e[3]),t=i$("avc1"===o?"dva1":"dvav",r));break}case"mp4a":{let e=iZ(i,[n])[0],t=iZ(e.subarray(28),["esds"])[0];if(t&&t.length>7){let e=4;if(3!==t[e++])break;e=i0(t,e)+2;let i=t[e++];if(128&i&&(e+=2),64&i&&(e+=t[e++]),4!==t[e++])break;e=i0(t,e);let r=t[e++];if(64===r)a+="."+i1(r);else break;if(e+=12,5!==t[e++])break;e=i0(t,e);let n=t[e++],s=(248&n)>>3;31===s&&(s+=1+((7&n)<<3)+((224&t[e])>>5)),a+="."+s}break}case"hvc1":case"hev1":{let e=iZ(r,["hvcC"])[0];if(e&&e.length>12){let t=e[1],i=["","A","B","C"][t>>6],r=iW(e,2),n=e[12],s=e.subarray(6,12);a+="."+i+(31&t),a+="."+(function(e){let t=0;for(let i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0})(r).toString(16).toUpperCase(),a+="."+((32&t)>>5?"H":"L")+n;let o="";for(let e=s.length;e--;){let t=s[e];(t||o)&&(o="."+t.toString(16).toUpperCase()+o)}a+=o}t=i$("hev1"==o?"dvhe":"dvh1",r);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":a=i$(a,r)||a;break;case"vp09":{let e=iZ(r,["vpcC"])[0];if(e&&e.length>6){let t=e[4],i=e[5],r=e[6]>>4&15;a+="."+i2(t)+"."+i2(i)+"."+i2(r)}break}case"av01":{let e=iZ(r,["av1C"])[0];if(e&&e.length>2){let i=e[1]>>>5,n=31&e[1],s=e[2]>>>7?"H":"M",o=(64&e[2])>>6,l=(32&e[2])>>5,d=(16&e[2])>>4,u=(8&e[2])>>3,h=(4&e[2])>>2,c=3&e[2];a+="."+i+"."+i2(n)+s+"."+i2(2===i&&o?l?12:10:o?10:8)+"."+d+"."+u+h+c+"."+i2(1)+"."+i2(1)+"."+i2(1)+".0",t=i$("dav1",r)}}}return{codec:a,encrypted:s,supplemental:t}}(iZ(r,["mdia","minf","stbl","stsd"])[0]);a?(t[i]={timescale:n,type:a,stsd:o},t[a]=t7({timescale:n,id:i},o)):t[i]={timescale:n,type:e,stsd:o}}}}}return iZ(e,["moov","mvex","trex"]).forEach(e=>{let i=t[iW(e,4)];i&&(i.default={duration:iW(e,12),sampleSize:iW(e,16),flags:iW(e,20)})}),t}function i$(e,t){let i=iZ(t,["dvvC"]),r=i.length?i[0]:iZ(t,["dvcC"])[0];if(r){let t=r[2]>>1&127,i=r[2]<<5&32|r[3]>>3&31;return e+"."+i2(t)+"."+i2(i)}}function i0(e,t){let i=t+5;for(;128&e[t++]&&t<i;);return t}function i1(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function i2(e){return(e<10?"0":"")+e}function i3(e,t){iZ(e,["moov","trak"]).forEach(e=>{let i=iZ(e,["mdia","minf","stbl","stsd"])[0];if(!i)return;let r=i.subarray(8),n=iZ(r,["enca"]),a=n.length>0;a||(n=iZ(r,["encv"])),n.forEach(e=>{iZ(a?e.subarray(28):e.subarray(78),["sinf"]).forEach(e=>{let i=i4(e);i&&t(i,a)})})})}function i4(e){let t=iZ(e,["schm"])[0];if(t){let i=iB(t.subarray(4,8));if("cbcs"===i||"cenc"===i){let t=iZ(e,["schi","tenc"])[0];if(t)return t}}}function i5(e,t,i,r,n){let a={},s=!1,o=function(e){let t=e.byteLength,i=[];for(let r=0;r<t;){let n=r+8<=t,a=r+4<=t?0x1000000*e[r]+(e[r+1]<<16|e[r+2]<<8|e[r+3]):iW(e,r),s=a>1?r+a:t;if(n&&109===e[r+4]&&111===e[r+5]&&111===e[r+6]&&102===e[r+7]){let n=Math.min(s,t);for(let t=r+8;t<n;){let a=t+8<=n,s=t+4<=n?0x1000000*e[t]+(e[t+1]<<16|e[t+2]<<8|e[t+3]):iW(e,t),o=s>1?t+s:n;if(a&&116===e[t+4]&&114===e[t+5]&&97===e[t+6]&&102===e[t+7]){let a,s,l=Math.min(o,n),d=[];for(let i=t+8;i<l;){let t=i+8<=l,r=i+4<=l?0x1000000*e[i]+(e[i+1]<<16|e[i+2]<<8|e[i+3]):iW(e,i),n=r>1?i+r:l;if(t&&116===e[i+4]){let t=Math.min(n,l);102===e[i+5]&&104===e[i+6]&&100===e[i+7]?s||(s=e.subarray(i+8,t)):102===e[i+5]&&100===e[i+6]&&116===e[i+7]?a||(a=e.subarray(i+8,t)):114===e[i+5]&&117===e[i+6]&&110===e[i+7]&&d.push(e.subarray(i+8,t))}i=n}i.push({moofOffset:e.byteOffset+r,tfdt:a,tfhd:s,truns:d})}t=o}}r=s}return i}(e),l=e.byteLength;for(let h=0;h<o.length;
3h++){let c,m,{moofOffset:f,tfdt:p,tfhd:g,truns:v}=o[h],E=iW(g,4),y=t[E];if(!y)continue;let b=a[E]||(a[E]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:y.timescale,type:y.type});if(p){let e=p[0];c=iW(p,4),1===e&&(0xffffffff===c?i.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(c*=0x100000000,c+=iW(p,8))),tW(c)&&(!tW(b.start)||c<b.start)&&(b.start=c),n&&tW(c)&&(n.timeOffset=c/n.timescale)}let T=(null==n?void 0:n.trackId)===E&&y.type===t0.VIDEO,A=y.default,S=0xffffff&iW(g,0),R=(null==A?void 0:A.duration)||0,k=(null==A?void 0:A.sampleSize)||0,I=8;1&S&&(I+=8),2&S&&(I+=4),8&S&&(R=iW(g,I),m=g.byteOffset-e.byteOffset+I,I+=4),16&S&&(k=iW(g,I));let L=0,D=(1&S)!=0,w=!D&&(131072&S)!=0;D?L=0x100000000*iW(g,8)+iW(g,12):w&&(L=f);let C=c||0,M=0,P=R;for(let t=0;t<v.length;t++){let i,a,s,o=v[t],h=iW(o,4),c=b.sampleCount;b.sampleCount+=h;let f=1&o[3],p=0,g=4&o[3],E=1&o[2],y=2&o[2],A=4&o[2],S=8&o[2],I=8;f&&(p=iY(o,I),I+=4),g&&(1&o[I+1]||void 0!==b.keyFrameIndex||(b.keyFrameIndex=c),I+=4);let D=L+p;if(!r&&0===o[1]&&6===o[2]&&1===o[3]){var d,u;let t=C,i=D,r=I,a=-1,s=0,c=0,m=null!=(d=null==n?void 0:n.timeOffset)?d:0,f=R/(null!=(u=null==n?void 0:n.timescale)?u:1),p=(null==n?void 0:n.isHEVCFlavor)===!0,g=p?2:1;for(let t=0;t<h;
3t++){let i=0===o[I]?o[I+1]<<16|o[I+2]<<8|o[I+3]:iW(o,I),r=-1===a&&void 0===b.keyFrameIndex&&(1&o[I+5])==0;I+=8;let l=D+i;if(T){if(i>0){let t=D;do{let i=0===e[t]?e[t+1]<<16|e[t+2]<<8|e[t+3]:iW(e,t),r=e[t+=4],a=p?r>>1&63:31&r;(p?39===a||40===a:6===a)&&i7(e.subarray(t,t+i),g,m,n.samples),t+=i}while(t<l)}m+=f}D=l,r&&(a=t,s=D)}if(D<=l)c=h;else{let e=i,t=r;for(let i=0;i<h&&!((e+=0===o[t]?o[t+1]<<16|o[t+2]<<8|o[t+3]:iW(o,t))>l);i++)c=i+1,t+=8}if(T&&(n.timeOffset=m),-1!==a&&s<=l&&void 0===b.keyFrameIndex&&(b.keyFrameIndex=a,b.keyFrameStart=t+a*R),c){(!tW(b.ptsMin)||t<b.ptsMin)&&(b.ptsMin=t);let e=t+c*R;(!tW(b.ptsMax)||e>b.ptsMax)&&(b.ptsMax=e)}let v=R*h;C=t+v,M+=v;continue}r&&(a={sampleOffset:D,samples:i=[],defaultSampleDurationOffset:m},D<=l&&b.trun.push(a));for(let t=0;t<h;t++){let d,u,h;E?(r&&(d=o.byteOffset-e.byteOffset+I),P=iW(o,I),I+=4):P=R,y?(s=iW(o,I),I+=4):s=k,A&&(h=1&o[I+1]?1:0,r&&(u={isNonSync:h,dependsOn:(3&o[I])==1?1:2}),I+=4);let c=0;if(S&&(c=0===o[0]?iW(o,I):iY(o,I),I+=4),T){let t=D,i=0;for(;i<s;){let r=iW(e,t);t+=4,i9(n.isHEVCFlavor,e[t])&&i7(e.subarray(t,t+r),n.isHEVCFlavor?2:1,n.timeOffset+c/n.timescale,n.samples),t+=r,i+=r+4}n.timeOffset+=P/n.timescale}if((D+=s)<=l){a&&void 0!==d&&(a.lastSampleDurationOffset=d),0===h&&void 0===b.keyFrameIndex&&(b.keyFrameIndex=t,b.keyFrameStart=C);let e=C+c;(!tW(b.ptsMin)||e<b.ptsMin)&&(b.ptsMin=e),(!tW(b.ptsMax)||e+P>b.ptsMax)&&(b.ptsMax=e+P),i&&(i[t]={cts:c,duration:P,flags:u,size:s})}C+=P,M+=P}!M&&R&&(M+=R*h)}b.duration+=M,b.duration&&(s=!0)}if(!s){let t=1/0,i=0,r=iZ(e,["sidx"]);for(let e=0;e<r.length;e++){let n=function(e){let t=[],i=e[0],r=8,n=iW(e,8);r+=4;let a=0,s=0;0===i?(a=iW(e,r),s=iW(e,r+4),r+=8):(a=iV(e,r),s=iV(e,r+8),r+=16),r+=2;let o=e.length+s,l=iK(e,r);r+=2;for(let i=0;i<l;i++){let i=r,a=iW(e,i);i+=4;let s=0x7fffffff&a;if(1==(0x80000000&a)>>>31)return iy.warn("SIDX has hierarchical references (not supported)"),null;let l=iW(e,i);i+=4,t.push({referenceSize:s,subsegmentDuration:l,info:{duration:l/n,start:o,end:o+s-1}}),o+=s,i+=4,r=i}return{earliestPresentationTime:a,timescale:n,version:i,referencesCount:l,references:t}}(r[e]);if(null!=n&&n.references){t=Math.min(t,n.earliestPresentationTime/n.timescale);let e=n.references.reduce((e,t)=>e+t.info.duration||0,0);i=Math.max(i,e+n.earliestPresentationTime/n.timescale)}}i&&tW(i)&&Object.keys(a).forEach(e=>{a[e].duration||(a[e].duration=i*a[e].timescale-a[e].start)})}return a}function i8(e,t){let i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function i6(e){if(!e)return!1;let t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function i9(e,t){if(!e)return 6==(31&t);{let e=t>>1&63;return 39===e||40===e}}function i7(e,i,r,n){let a,s=re(e);a=0+i;let o=0,l=0,d=0;for(;a<s.length;){o=0;do{if(a>=s.length)break;o+=d=s[a++]}while(255===d)l=0;do{if(a>=s.length)break;l+=d=s[a++]}while(255===d)let e=s.length-a,i=a;if(l<e)a+=l;else if(l>e){iy.error("Malformed SEI payload. ".concat(l," is too small, only ").concat(e," bytes left to parse."));break}if(4===o){if(181===s[i++]){let e=iK(s,i);if(i+=2,49===e){let e=iW(s,i);if(i+=4,0x47413934===e){let e=s[i++];if(3===e){let t=s[i++],a=31&t,l=64&t,d=l?2+3*a:0,u=new Uint8Array(d);if(l){u[0]=t;for(let e=1;e<d;e++)u[e]=s[i++]}n.push({type:e,payloadType:o,pts:r,bytes:u})}}}}}else if(5===o&&l>16){let e=[];for(let t=0;t<16;t++){let r=s[i++].toString(16);e.push(1==r.length?"0"+r:r),(3===t||5===t||7===t||9===t)&&e.push("-")}let a=l-16,d=new Uint8Array(a);for(let e=0;e<a;e++)d[e]=s[i++];n.push({payloadType:o,pts:r,uuid:e.join(""),userData:"undefined"==typeof TextDecoder?iM(d):(t||(t=new TextDecoder("utf-8"))).decode(d).replace(/\0/g,""),userDataBytes:d})}}}function re(e){let t,i=e.byteLength,r=e.indexOf(3,3);for(;-1!==r;)0===e[r-1]&&0===e[r-2]&&(t||(t=[])).push(r),r=e.indexOf(3,r+1);if(!t)return e;let n=i-t.length,a=new Uint8Array(n),s=0,o=0;for(let i=0;i<n;o++,i++)o===t[s]&&(o++,s++),a[i]=e[o];return a}function rt(e){let t=[];if(e instanceof ArrayBuffer){let i=e.byteLength,r=0;for(;r+32<i;){let i=function(e){let t=e.getUint32(0),i=e.byteOffset,r=e.byteLength;if(r<t)return{offset:i,size:r};if(0x70737368!==e.getUint32(4))return{offset:i,size:t};let n=e.getUint32(8)>>>24;if(0!==n&&1!==n)return{offset:i,size:t};let a=e.buffer,s=iN(new Uint8Array(a,i+12,16)),o=null,l=null,d=0;
3if(0===n)d=28;else{let n=e.getUint32(28);if(!n||r<32+16*n)return{offset:i,size:t};o=[];for(let e=0;e<n;e++)o.push(new Uint8Array(a,i+32+16*e,16));d=32+16*n}if(!d)return{offset:i,size:t};let u=e.getUint32(d);return t-32<u?{offset:i,size:t}:(l=new Uint8Array(a,i+d+4,u),0===n&&(o=function(e){let t=[];for(let i=0;i<e.length;){let r=e[i++],n=7&r;if(0===n){for(;128&e[i++];);continue}if(2!==n){i+=1===n?8:4;continue}let a=0;for(let t=0,r=128;128&r;t+=7)a|=(127&(r=e[i++]))<<t;if(r>>3==2)if(32===a){let r=new Uint8Array(16);for(let t=0;t<16;t++)r[t]=parseInt(String.fromCharCode(e[i+2*t],e[i+2*t+1]),16);t.push(r)}else 16===a&&t.push(e.subarray(i,i+16));i+=a}return t}(l)),{version:n,systemId:s,kids:o,data:l,offset:i,size:t})}(new DataView(e,r));t.push(i),r+=i.size}}return t}let ri=rn("userAgent"),rr=rn("vendor");function rn(e){try{return navigator[e]||""}catch(e){}return""}function ra(){if(void 0===i){let e=ri.match(/Chrome\/(\d+)/i);i=e?parseInt(e[1]):0}return i}function rs(){return/\(Windows.+Firefox\//i.test(ri)}let ro={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,dav1:.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,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function rl(e,t){let i=ro[t];return!!i&&!!i[e.slice(0,4)]}function rd(e,t){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2];return!e.split(",").some(e=>!ru(e,t,i))}function ru(e,t){var i;let r=!(arguments.length>2)||void 0===arguments[2]||arguments[2],n=ib(r);return null!=(i=null==n?void 0:n.isTypeSupported(rh(e,t)))&&i}function rh(e,t){return"".concat(t,"/mp4;codecs=").concat(e)}function rc(e){if(e){let t=e.substring(0,4);return ro.video[t]}return 2}function rm(e){let t=rs();return e.split(",").reduce((e,i)=>{let r=t&&i6(i)?9:ro.video[i];return r?(2*r+e)/(e?3:2):(ro.audio[i]+e)/(e?2:1)},0)}let rf={},rp=/flac|opus|mp4a\.40\.34/i;function rg(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return e.replace(rp,e=>(function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(rf[e])return rf[e];let i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e];for(let n=0;n<i.length;n++){var r;if(ru(i[n],"audio",t))return rf[e]=i[n],i[n];if("mp3"===i[n]&&null!=(r=ib(t))&&r.isTypeSupported("audio/mpeg"))return""}return e})(e.toLowerCase(),t))}function rv(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e))&&(rE(e,"audio")||rE(e,"video")))return e;if(t){let i=t.split(",");if(i.length>1){if(e){for(let t=i.length;t--;)if(i[t].substring(0,4)===e.substring(0,4))return i[t]}return i[0]}}return t||e}function rE(e,t){return rl(e,t)&&ru(e,t)}function ry(e){let t=ib(e)||{isTypeSupported:()=>!1};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function rb(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}let rT={supported:!1,smooth:!1,powerEfficient:!1},r_={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function rA(e,t){return{supported:!1,configurations:t,decodingInfoResults:[rT],error:e}}function rS(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},n=e.videoCodec;if(!n&&!e.audioCodec||!i)return Promise.resolve(r_);let a=[],s=function(e){var t;let i=null==(t=e.videoCodec)?void 0:t.split(","),r=rk(e),n=e.width||640,a=e.height||480,s=e.frameRate||30,o=e.videoRange.toLowerCase();return i?i.map(e=>{let t={contentType:rh(function(e){if(e.startsWith("av01.")){let t=e.split("."),i=["0","111","01","01","01","0"];for(let e=t.length;e>4&&e<10;e++)t[e]=i[e-4];return t.join(".")}return e}(e),"video"),width:n,height:a,bitrate:r,framerate:s};return"sdr"!==o&&(t.transferFunction=o),t}):[]}(e),o=s.length,l=function(e,t,i){var r;let n=null==(r=e.audioCodec)?void 0:r.split(","),a=rk(e);return n&&e.audioGroups?e.audioGroups.reduce((e,r)=>{var s;let o=r?null==(s=t.groups[r])?void 0:s.tracks:null;return o?o.reduce((e,t)=>
3{if(t.groupId===r){let r=parseFloat(t.channels||"");n.forEach(t=>{let n={contentType:rh(t,"audio"),bitrate:i?rR(t,a):a};r&&(n.channels=""+r),e.push(n)})}return e},e):e},[]):[]}(e,t,o>0),d=l.length;for(let e=o||+d||1;e--;){let t={type:"media-source"};if(o&&(t.video=s[e%o]),d){t.audio=l[e%d];let i=t.audio.bitrate;t.video&&i&&(t.video.bitrate-=i)}a.push(t)}if(n){let e=navigator.userAgent;if(n.split(",").some(e=>i6(e))&&rs())return Promise.resolve(rA(Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (".concat(e,")")),a))}return Promise.all(a.map(e=>{let t=function(e){let t="",{audio:i,video:r}=e;if(r){let e=rb(r.contentType);t+="".concat(e,"_r").concat(r.height,"x").concat(r.width,"f").concat(Math.ceil(r.framerate)).concat(r.transferFunction||"sd","_").concat(Math.ceil(r.bitrate/1e5))}if(i){let e=rb(i.contentType);t+="".concat(r?"_":"").concat(e,"_c").concat(i.channels)}return t}(e);return r[t]||(r[t]=i.decodingInfo(e))})).then(e=>({supported:!e.some(e=>!e.supported),configurations:a,decodingInfoResults:e})).catch(e=>({supported:!1,configurations:a,decodingInfoResults:[],error:e}))}function rR(e,t){if(t<=1)return 1;let i=128e3;return"ec-3"===e?i=768e3:"ac-3"===e&&(i=64e4),Math.min(t/2,i)}function rk(e){return 1e3*Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)/1e3)||1}function rI(e,t,i){let r=encodeURIComponent(t),n="".concat(r,"=").concat(encodeURIComponent(i)),a=!1,s=[];e.search.substring(1).split("&").forEach(e=>{e===r||e.startsWith(r+"=")?a||(s.push(n),a=!0):e&&s.push(e)}),a||s.push(n),e.search=s.join("&")}let rL=["NONE","TYPE-0","TYPE-1",null],rD=["SDR","PQ","HLG"];var rw={No:"",Yes:"YES",v2:"v2"};function rC(e){let{canSkipUntil:t,canSkipDateRanges:i,age:r}=e;return t&&r<t/2?i?rw.v2:rw.Yes:rw.No}class rM{addDirectives(e){let t=new self.URL(e);return void 0!==this.msn&&rI(t,"_HLS_msn",this.msn.toString()),void 0!==this.part&&rI(t,"_HLS_part",this.part.toString()),this.skip&&rI(t,"_HLS_skip",this.skip),t.href}constructor(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}}class rP{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 rO(this._audioGroups,e)}hasSubtitleGroup(e){return rO(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,t){if(t){if("audio"===e){let e=this._audioGroups;e||(e=this._audioGroups=[]),-1===e.indexOf(t)&&e.push(t)}else if("text"===e){let e=this._subtitleGroups;e||(e=this._subtitleGroups=[]),-1===e.indexOf(t)&&e.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 null==(e=this.audioGroups)?void 0:e[0]}get textGroupId(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}addFallback(){}constructor(e){if(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.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=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,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(e=>!!e).map(e=>e.substring(0,4)).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;let i=null==(t=e.supplemental)?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=",".concat(i.substring(0,4)))}
3"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}}function rO(e,t){return!!t&&!!e&&-1!==e.indexOf(t)}let rx=(e,t)=>JSON.stringify(e,(e=>{let t=new WeakSet;return(i,r)=>{if(e&&(r=e(i,r)),"object"==typeof r&&null!==r){if(t.has(r))return;t.add(r)}return r}})(t));function rN(e,t){iy.log('[abr] start candidates with "'.concat(e,'" ignored because ').concat(t))}function rU(e){return e.reduce((e,t)=>{let i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);let r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function rF(e){if(!e)return e;let{lang:t,assocLang:i,characteristics:r,channels:n,audioCodec:a}=e;return{lang:t,assocLang:i,characteristics:r,channels:n,audioCodec:a}}function rB(e,t,i){if("attrs"in e){let i=t.indexOf(e);if(-1!==i)return i}for(let r=0;r<t.length;r++)if(rG(e,t[r],i))return r;return -1}function rG(e,t,i){let{groupId:r,name:n,lang:a,assocLang:s,default:o}=e,l=e.forced;return(void 0===r||t.groupId===r)&&(void 0===n||t.name===n)&&(void 0===a||function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"--";return e.length===t.length?e===t:e.startsWith(t)||t.startsWith(e)}(a,t.lang))&&(void 0===s||t.assocLang===s)&&(void 0===o||t.default===o)&&(void 0===l||t.forced===l)&&(!("characteristics"in e)||function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=e.split(","),r=t.split(",");return i.length===r.length&&!i.some(e=>-1===r.indexOf(e))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function rH(e,t){let{audioCodec:i,channels:r}=e;return(void 0===i||(t.audioCodec||"").substring(0,4)===i.substring(0,4))&&(void 0===r||r===(t.channels||"2"))}function rK(e,t,i){for(let r=t;r>-1;r--)if(i(e[r]))return r;for(let r=t+1;r<e.length;r++)if(i(e[r]))return r;return -1}function rW(e,t){var i;return!!e&&e!==(null==(i=t.loadLevelObj)?void 0:i.uri)}function rV(e,t){return!t||-1!==t.indexOf(e)}function rq(e,t){if(t||e){let i=t6({},t);return e&&(e.videoCodec&&(i.videoCodec=e.videoCodec),e.videoRange&&(i.allowedVideoRanges=[e.videoRange])),i}}let rY={search:function(e,t){let i=0,r=e.length-1,n=null,a=null;for(;i<=r;){let s=t(a=e[n=(i+r)/2|0]);if(s>0)i=n+1;else{if(!(s<0))return a;r=n-1}}return null}};function rj(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:.005,a=null;if(e){a=t[1+e.sn-t[0].sn]||null;let r=e.endDTS-i;r>0&&r<15e-7&&(i+=15e-7),a&&e.level!==a.level&&a.end<=e.end&&(a=t[2+e.sn-t[0].sn]||null)}else 0===i&&0===t[0].start&&(a=t[0]);if(a&&((!e||e.level===a.level)&&0===rz(i,r,a)||function(e,t,i){if((null==t?void 0:t.start)===0&&t.level<e.level&&(t.endPTS||0)>0){let r=t.tagList.reduce((e,t)=>("INF"===t[0]&&(e+=parseFloat(t[1])),e),i);return e.start<=r}return!1}(a,e,Math.min(n,r))))return a;let s=rY.search(t,rz.bind(null,i,r));return s&&(s!==e||!a)?s:a}function rz(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0;if(i.start<=e&&i.start+i.duration>e)return 0;let r=Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return i.start+i.duration-r<=e?1:i.start-r>e&&i.start?-1:0}function rQ(e,t,i){if(e&&e.startCC<=t&&e.endCC>=t){let r,n=e.fragments,{fragmentHint:a}=e;return a&&(n=n.concat(a)),rY.search(n,e=>e.cc<t?1:e.cc>t?-1:(r=e,e.end<=i)?1:e.start>i?-1:0),r||null}return null}function rX(e,t){return t===e.endSN&&e.fragmentHint?e.fragmentHint:e.fragments[1+t-e.startSN]||null}var rZ={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},rJ={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8,ResetMediaSource:16};function r$(e){let t=e.details;return!(t!==tj.BUFFER_ADD_CODEC_ERROR&&t!==tj.MEDIA_SOURCE_REQUIRES_RESET&&(t!==tj.BUFFER_APPEND_ERROR||r0(e)))}function r0(e){return e.details===tj.BUFFER_APPEND_ERROR&&("QuotaExceededError"===e.error.name||"InvalidStateError"===e.error.name)}function r1(e){let t={action:rZ.DoNothing,flags:rJ.None};return e&&(t.resolved=!0),t}var r2={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class r3{_registerListeners(){let{hls:e}=this;e&&(e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tz.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tz.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,t){let i=this.activePartLists[t];if(i)for(let t=i.length;t--;){let r=i[t];if(!r)break;
3if(r.start<=e&&e<=r.end&&r.loaded)return r}return this.getBufferedFrag(e,t)}getBufferedFrag(e,t){return this.getFragAtPos(e,t,!0)}getFragAtPos(e,t,i){let{fragments:r}=this,n=Object.keys(r);for(let a=n.length;a--;){let s=r[n[a]];if((null==s?void 0:s.body.type)===t&&(!i||s.buffered)){let t=s.body;if(t.start<=e&&e<=t.end)return t}}return null}detectEvictedFragments(e,t,i,r,n,a){this.timeRanges&&(this.timeRanges[e]=t);let s=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach(n=>{let o=this.fragments[n];if(!o||!this.hls)return;let l=o.body;if(s>=l.sn)return;if(!o.buffered&&(!o.loaded||a)){l.type===i&&this.removeFragment(l);return}let d=o.range[e];if(d){if(0===d.time.length)return void this.removeFragment(l);if(d.time.some(e=>{let i=!this.isTimeBuffered(e.startPTS,e.endPTS,t);return i&&this.removeFragment(l),i}),r&&r!==l&&ra()){let e=r.endPTS,t=l.startPTS;if(e&&t&&o.range.video){let i=t-e;i<0&&i>-.1&&(this.removeFragment(l),this.hls.trigger(tz.BUFFER_FLUSHING,{startOffset:e+.004,endOffset:1/0,type:"video"}))}}}})}detectPartialFragments(e){let t=this.timeRanges,{frag:i,part:r,id:n}=e;if(!t||!t2(i))return;let a=r5(i),s=this.fragments[a];if(!s||s.buffered&&i.gap)return;let o=!i.relurl;Object.keys(t).forEach(e=>{let a=i.elementaryStreams[e];if(!a)return;let l=t[e],d=o||!0===a.partial;s.range[e]=this.getBufferedTimes(i,r,d,l),this.detectEvictedFragments(e,l,n,i,r)}),s.loaded=null;let l=Object.keys(s.range);if(l.length){if(this.bufferedEnd(s,i),r4(s)||this.removeParts(i.sn-1,i.type),!r){let e=Math.min(.004,i.duration);l.some(t=>{var r;let n=null==(r=s.range[t])?void 0:r.time,a=0===n.length||1===n.length&&n[0].endPTS-n[0].startPTS<e;return a&&this.addAsGap(i),a})}}else this.removeFragment(i)}addAsGap(e){e.gap=!0,this.removeFragment(e),this.fragBuffered(e,!0)}bufferedEnd(e,t){e.buffered=!0,(e.body.endList=t.endList||e.body.endList)&&!t.gap&&(this.endListFragments[e.body.type]=e)}removeParts(e,t){let i=this.activePartLists[t];i&&(this.activePartLists[t]=r8(i,t=>t.fragment.sn>=e))}fragBuffered(e,t){let i=r5(e),r=this.fragments[i];return!r&&t&&(r=this.fragments[i]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),r&&(r.loaded=null,this.bufferedEnd(r,e)),r}getBufferedTimes(e,t,i,r){let n={time:[],partial:i},a=e.start,s=e.end,o=e.minEndPTS||s,l=e.maxStartPTS||a;for(let e=0;e<r.length;e++){let t=r.start(e)-this.bufferPadding,i=r.end(e)+this.bufferPadding;if(l>=t&&o<=i){n.time.push({startPTS:Math.max(a,r.start(e)),endPTS:Math.min(s,r.end(e))});break}if(a<i&&s>t){let t=Math.max(a,r.start(e)),i=Math.min(s,r.end(e));i>t&&(n.partial=!0,n.time.push({startPTS:t,endPTS:i}))}else if(s<=t)break}return n}getPartialFragment(e){let t,i,r,n=null,a=0,{bufferPadding:s,fragments:o}=this;return Object.keys(o).forEach(l=>{let d=o[l];d&&r4(d)&&(i=d.body.start-s,r=d.body.end+s,e>=i&&e<=r&&a<=(t=Math.min(e-i,r-e))&&(n=d.body,a=t))}),n}isEndListAppended(e){let t=this.endListFragments[e];return void 0!==t&&(t.buffered||r4(t))}getState(e){let t=r5(e),i=this.fragments[t];if(i)if(!i.buffered)return r2.APPENDING;else if(r4(i))return r2.PARTIAL;else return r2.OK;return r2.NOT_LOADED}isTimeBuffered(e,t,i){let r,n;for(let a=0;a<i.length;a++){if(r=i.start(a)-this.bufferPadding,n=i.end(a)+this.bufferPadding,e>=r&&t<=n)return!0;if(t<=r)break}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,t){if(!t2(t.frag)||t.frag.bitrateTest)return;let i=t.frag,r=t.part?null:t,n=r5(i);this.fragments[n]={body:i,appendedPTS:null,loaded:r,buffered:!1,range:Object.create(null)}}onBufferAppended(e,t){let{frag:i,part:r,timeRanges:n}=t;if(!t2(i))return;let a=i.type;if(r){let e=this.activePartLists[a];e||(this.activePartLists[a]=e=[]),e.push(r)}this.timeRanges=n}onFragBuffered(e,t){this.detectPartialFragments(t)}hasFragment(e){let t=r5(e);return!!this.fragments[t]}hasFragments(e){let{fragments:t}=this,i=Object.keys(t);if(!e)return i.length>0;for(let r=i.length;r--;){let n=t[i[r]];if((null==n?void 0:n.body.type)===e)return!0}return!1}hasParts(e){var t;return!!(null!=(t=this.activePartLists[e])&&t.length)}getBackBufferEvictionEnd(e,t,i){let{fragments:r}=this,n=0,a=0,s=Object.keys(r);for(let o=0;o<s.length;o++){let l=r[s[o]];if(!l||!l.buffered||l.body.type!==t)continue;let d=l.body;if(d.gap)return 0;let u=d.hasStats&&d.stats.loaded||d.byteLength||d.bitrate&&8*d.bitrate*d.duration;if(d.end<=e&&u&&(n+=u,a=Math.max(a,d.end),n>=i))return a}return a>0?a:0}removeFragmentsInRange(e,t,i,r,n){(!r||this.hasGaps)&&Object.keys(this.fragments).forEac
3h(a=>{let s=this.fragments[a];if(!s)return;let o=s.body;o.type===i&&(!r||o.gap)&&o.start<t&&o.end>e&&(s.buffered||n)&&this.removeFragment(o)})}removeFragment(e){let t=r5(e);e.clearElementaryStreamInfo();let i=this.activePartLists[e.type];if(i){let t=e.sn;this.activePartLists[e.type]=r8(i,e=>e.fragment.sn!==t)}delete this.fragments[t],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;let t=null==(e=this.hls)||null==(e=e.latestLevelDetails)?void 0:e.partList;t&&t.forEach(e=>e.clearElementaryStreamInfo())}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()}}function r4(e){var t,i,r,n;return e.buffered&&!!(e.body.gap||null!=(t=e.range.video)&&t.partial||null!=(i=e.range.audio)&&i.partial||null!=(r=e.range.audiovideo)&&r.partial||null!=(n=e.range.subs)&&n.partial)}function r5(e){return"".concat(e.type,"_").concat(e.level,"_").concat(e.sn)}function r8(e,t){return e.filter(e=>{let i=t(e);return i||e.clearElementaryStreamInfo(),i})}var r6={cbc:0,ctr:1};class r9{decrypt(e,t){switch(this.aesMode){case r6.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},t,e);case r6.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},t,e);default:throw Error("[AESCrypto] invalid aes mode ".concat(this.aesMode))}}constructor(e,t,i){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=t,this.aesMode=i}}class r7{uint8ArrayToUint32Array_(e){let t=new DataView(e),i=new Uint32Array(4);for(let e=0;e<4;e++)i[e]=t.getUint32(4*e);return i}initTable(){let e=this.sBox,t=this.invSBox,i=this.subMix,r=i[0],n=i[1],a=i[2],s=i[3],o=this.invSubMix,l=o[0],d=o[1],u=o[2],h=o[3],c=new Uint32Array(256),m=0,f=0,p=0;for(p=0;p<256;p++)p<128?c[p]=p<<1:c[p]=p<<1^283;for(p=0;p<256;p++){let i=f^f<<1^f<<2^f<<3^f<<4;i=i>>>8^255&i^99,e[m]=i,t[i]=m;let o=c[m],p=c[o],g=c[p],v=257*c[i]^0x1010100*i;r[m]=v<<24|v>>>8,n[m]=v<<16|v>>>16,a[m]=v<<8|v>>>24,s[m]=v,v=0x1010101*g^65537*p^257*o^0x1010100*m,l[i]=v<<24|v>>>8,d[i]=v<<16|v>>>16,u[i]=v<<8|v>>>24,h[i]=v,m?(m=o^c[c[c[g^o]]],f^=c[c[f]]):m=f=1}}expandKey(e){let t,i,r,n,a=this.uint8ArrayToUint32Array_(e),s=!0,o=0;for(;o<a.length&&s;)s=a[o]===this.key[o],o++;if(s)return;this.key=a;let l=this.keySize=a.length;if(4!==l&&6!==l&&8!==l)throw Error("Invalid aes key size="+l);let d=this.ksRows=(l+6+1)*4,u=this.keySchedule=new Uint32Array(d),h=this.invKeySchedule=new Uint32Array(d),c=this.sBox,m=this.rcon,f=this.invSubMix,p=f[0],g=f[1],v=f[2],E=f[3];for(t=0;t<d;t++){if(t<l){r=u[t]=a[t];continue}n=r,t%l==0?n=(c[(n=n<<8|n>>>24)>>>24]<<24|c[n>>>16&255]<<16|c[n>>>8&255]<<8|c[255&n])^m[t/l|0]<<24:l>6&&t%l==4&&(n=c[n>>>24]<<24|c[n>>>16&255]<<16|c[n>>>8&255]<<8|c[255&n]),u[t]=r=(u[t-l]^n)>>>0}for(i=0;i<d;i++)t=d-i,n=3&i?u[t]:u[t-4],i<4||t<=4?h[i]=n:h[i]=p[c[n>>>24]]^g[c[n>>>16&255]]^v[c[n>>>8&255]]^E[c[255&n]],h[i]=h[i]>>>0}networkToHostOrderSwap(e){return e<<24|(65280&e)<<8|(0xff0000&e)>>8|e>>>24}decrypt(e,t,i){let r,n,a,s,o,l,d,u,h,c,m,f,p,g,v=this.keySize+6,E=this.invKeySchedule,y=this.invSBox,b=this.invSubMix,T=b[0],A=b[1],S=b[2],R=b[3],k=this.uint8ArrayToUint32Array_(i),I=k[0],L=k[1],D=k[2],w=k[3],C=new Int32Array(e),M=new Int32Array(C.length),P=this.networkToHostOrderSwap;for(;t<C.length;){for(g=1,h=P(C[t]),c=P(C[t+1]),m=P(C[t+2]),f=P(C[t+3]),o=h^E[0],l=f^E[1],d=m^E[2],u=c^E[3],p=4;g<v;g++)r=T[o>>>24]^A[l>>16&255]^S[d>>8&255]^R[255&u]^E[p],n=T[l>>>24]^A[d>>16&255]^S[u>>8&255]^R[255&o]^E[p+1],a=T[d>>>24]^A[u>>16&255]^S[o>>8&255]^R[255&l]^E[p+2],s=T[u>>>24]^A[o>>16&255]^S[l>>8&255]^R[255&d]^E[p+3],o=r,l=n,d=a,u=s,p+=4;r=y[o>>>24]<<24^y[l>>16&255]<<16^y[d>>8&255]<<8^y[255&u]^E[p],n=y[l>>>24]<<24^y[d>>16&255]<<16^y[u>>8&255]<<8^y[255&o]^E[p+1],a=y[d>>>24]<<24^y[u>>16&255]<<16^y[o>>8&255]<<8^y[255&l]^E[p+2],s=y[u>>>24]<<24^y[o>>16&255]<<16^y[l>>8&255]<<8^y[255&d]^E[p+3],M[t]=P(r^I),M[t+1]=P(s^L),M[t+2]=P(a^D),M[t+3]=P(n^w),I=h,L=c,D=m,w=f,t+=4}return M.buffer}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()}}class ne{expandKey(){let e=function(e){switch(e){case r6.cbc:return"AES-CBC";case r6.ctr:return"AES-CTR";default:throw Error("[FastAESKey] invalid aes mode ".concat(e))}}(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}constructor(e,t,i){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=t,this.aesMode=i}}class nt{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(){let{currentResult:e,remainderData:t}=this;if(!e||t)return this.reset(),null;let i=new Uint8Array(e);this.reset();let r=this.decryptRange;if(r)return 0===r.start&&r.end>=i.length?i:i.slice(r.start,r.end);let n=i.byteLength,a=n&&new DataView(i.buffer).getUint8(n-1);return a?i.slice(0,n-a):i}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,t,i,r,n){return(this.decryptRange=n,this.useSoftware||n)?new Promise((n,a)=>{let s=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(s,t,i,r);let o=this.flush();o?n(o.buffer):a(Error("[softwareDecrypt] Failed to decrypt data"))}
3):this.webCryptoDecrypt(new Uint8Array(e),t,i,r)}softwareDecrypt(e,t,i,r){let{currentIV:n,currentResult:a,remainderData:s}=this;if(r!==r6.cbc||16!==t.byteLength)return iy.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),s&&(e=i8(s,e),this.remainderData=null);let o=this.getValidChunk(e);if(!o.length)return null;n&&(i=n);let l=this.softwareDecrypter;return(l||(l=this.softwareDecrypter=new r7),l.expandKey(t),this.currentResult=l.decrypt(o.buffer,0,i),this.currentIV=o.slice(-16).buffer,a)?a:null}webCryptoDecrypt(e,t,i,r){if(this.key!==t||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,t,i,r));this.key=t,this.fastAesKey=new ne(this.subtle,t,r)}return this.fastAesKey.expandKey().then(t=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new r9(this.subtle,new Uint8Array(i),r).decrypt(e.buffer,t)):Promise.reject(Error("web crypto not initialized"))).catch(n=>(iy.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, ".concat(n.name,": ").concat(n.message)),this.onWebCryptoError(e,t,i,r)))}onWebCryptoError(e,t,i,r){let n=this.enableSoftwareAES;if(n){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,t,i,r);let n=this.flush();if(n)return n.buffer}throw Error("WebCrypto"+(n?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let t=e,i=e.length-e.length%16;return i!==e.length&&(t=e.slice(0,i),this.remainderData=e.slice(i)),t}logOnce(e){this.logEnabled&&(iy.log("[decrypter]: ".concat(e)),this.logEnabled=!1)}constructor(e,t){if(this.logEnabled=!0,this.decryptRange=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.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,!0!==t)try{let e=self.crypto;e&&(this.subtle=e.subtle||e.webkitSubtle)}catch(e){}this.useSoftware=!this.subtle}}class ni{destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,t,i,r){let n=e.url;if(!n)return Promise.reject(new ns({type:tY.NETWORK_ERROR,details:tj.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:Error("Fragment does not have a ".concat(n?"part list":"url")),networkDetails:null}));this.abort();let a=this.config,s=a.fLoader,o=a.loader;return new Promise((l,d)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(e=>"GAP"===e[0]))return void d(na(e));else e.gap=!1;let u=this.loader=s?new s(a):new o(a),h=nr(e,null,t);e.loader=u;let c=io(a.fragLoadPolicy.default),m={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===e.sn?1/0:131072};u.stats.retry=e.stats.retry,e.stats=u.stats;let f={onSuccess:(t,i,r,n)=>{this.resetLoader(e,u);let a=t.data;r.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(a.slice(0,16)),a=a.slice(16)),l({frag:e,part:null,payload:a,networkDetails:n})},onError:(t,i,r,a)=>{this.resetLoader(e,u),d(new ns({type:tY.NETWORK_ERROR,details:tj.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:t7({url:n,data:void 0},t),error:Error("HTTP Error ".concat(t.code," ").concat(t.text)),networkDetails:r,stats:a}))},onAbort:(t,i,r)=>{this.resetLoader(e,u),d(new ns({type:tY.NETWORK_ERROR,details:tj.INTERNAL_ABORTED,fatal:!1,frag:e,error:Error("Aborted"),networkDetails:r,stats:t}))},onTimeout:(t,i,r)=>{this.resetLoader(e,u),d(new ns({type:tY.NETWORK_ERROR,details:tj.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:Error("Timeout after ".concat(m.timeout,"ms")),networkDetails:r,stats:t}))}};if(i){let t=this.gateProgress(i,r);f.onProgress=(i,r,n,a)=>t({frag:e,part:null,payload:n,networkDetails:a})}u.load(h,m,f)})}gateProgress(e,t){let i=e;if(t){let r=[],n=!1;t.then(()=>{n=!0,r.forEach(t=>e(t)),r.length=0}).catch(()=>{}),i=t=>{n?e(t):r.push(t)}}return i}loadPart(e,t,i){this.abort();let r=this.config,n=r.fLoader,a=r.loader;return new Promise((s,o)=>{if(this.loader&&this.loader.destroy(),e.gap||t.gap)return void o(na(e,t));let l=this.loader=n?new n(r):new a(r),d=nr(e,t);e.loader=l;let u=io(r.fragLoadPolicy.default),h={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:131072};t.stats=l.stats,l.load(d,h,{onSuccess:(r,n,a,o)=>{this.resetLoader(e,l),this.updateStatsFromPart(e,t);let d={frag:e,part:t,payload:r.data,networkDetails:o};i(d),s(d)},onError:(i,r,n,a)=>
3{this.resetLoader(e,l),o(new ns({type:tY.NETWORK_ERROR,details:tj.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:t,response:t7({url:d.url,data:void 0},i),error:Error("HTTP Error ".concat(i.code," ").concat(i.text)),networkDetails:n,stats:a}))},onAbort:(i,r,n)=>{e.stats.aborted=t.stats.aborted,this.resetLoader(e,l),o(new ns({type:tY.NETWORK_ERROR,details:tj.INTERNAL_ABORTED,fatal:!1,frag:e,part:t,error:Error("Aborted"),networkDetails:n,stats:i}))},onTimeout:(i,r,n)=>{this.resetLoader(e,l),o(new ns({type:tY.NETWORK_ERROR,details:tj.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:t,error:Error("Timeout after ".concat(h.timeout,"ms")),networkDetails:n,stats:i}))}})})}updateStatsFromPart(e,t){let i=e.stats,r=t.stats,n=r.total;if(i.loaded+=r.loaded,n){let r=Math.round(e.duration/t.duration),a=Math.min(Math.round(i.loaded/n),r),s=(r-a)*Math.round(i.loaded/a);i.total=i.loaded+s}else i.total=Math.max(i.loaded,i.total);let a=i.loading,s=r.loading;a.start?a.first+=s.first-s.start:(a.start=s.start,a.first=s.first),a.end=s.end}resetLoader(e,t){e.loader=null,e.url=null,this.loader===t&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),t.destroy()}constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}}function nr(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,r=t||e,n={type:tJ.MEDIA_FRAGMENT,frag:e,part:t,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},a=nn(e,t,i);return a.resetIV&&(n.resetIV=!0),a.byteRange&&(n.rangeStart=a.byteRange.start,n.rangeEnd=a.byteRange.end),n}function nn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0,r={},n=t||e,a=n.byteRangeStartOffset,s=n.byteRangeEndOffset;if(tW(a)&&tW(s)){var o,l;if(("initSegment"===e.sn||i)&&("AES-128"===(l=null==(o=e.decryptdata)?void 0:o.method)||"AES-256"===l)){let e=16*Math.floor(a/16),t=16*Math.ceil(s/16);r.decryptRange={start:a-e,end:s-e},e>=16&&(r.resetIV=!0,e-=16),r.byteRange={start:e,end:t}}else r.byteRange={start:a,end:s}}return r}function na(e,t){let i=Error("GAP ".concat(e.gap?"tag":"attribute"," found")),r={type:tY.MEDIA_ERROR,details:tj.FRAG_GAP,fatal:!1,frag:e,error:i,networkDetails:null};return t&&(r.part=t),(t||e).stats.aborted=!0,new ns(r)}
3class ns extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class no extends im{destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount?(this.doTick(),this._tickCallCount>1&&this.tickImmediate()):this.log("possible exception thrown in task-loop (".concat(this.constructor.name,".doTick)")),this._tickCallCount=0}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}constructor(e,t){super(e,t),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}}class nl{constructor(e,t,i,r=0,n=-1,a=!1,s,o,l){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.iframe=void 0,this.duration=void 0,this.decryptRange=void 0,this.transmuxing=nd(),this.buffering={audio:nd(),video:nd(),audiovideo:nd()},this.level=e,this.sn=t,this.id=i,this.size=r,this.part=n,this.partial=a,this.duration=s||0,this.decryptRange=l,this.iframe=o||!1}}function nd(){return{start:0,executeStart:0,executeEnd:0,end:0}}let nu={length:0,start:()=>0,end:()=>0};class nh{static isBuffered(e,t){if(e){let i=nh.getBuffered(e);for(let e=i.length;e--;)if(t>=i.start(e)&&t<=i.end(e))return!0}return!1}static bufferedRanges(e){if(e){let t=nh.getBuffered(e);return nh.timeRangesToArray(t)}return[]}static timeRangesToArray(e){let t=[];for(let i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}static bufferInfo(e,t,i){if(e){let r=nh.bufferedRanges(e);if(r.length)return nh.bufferedInfo(r,t,i)}return{len:0,start:t,end:t,bufferedIndex:-1}}static bufferedInfo(e,t,i){let r;t=Math.max(0,t),e.length>1&&e.sort((e,t)=>e.start-t.start||t.end-e.end);let n=-1,a=[];if(i)for(let r=0;r<e.length;r++){t>=e[r].start&&t<=e[r].end&&(n=r);let s=a.length;if(s){let t=a[s-1].end;e[r].start-t<i?e[r].end>t&&(a[s-1].end=e[r].end):a.push(e[r])}else a.push(e[r])}else a=e;let s=0,o=t,l=t;for(let e=0;e<a.length;e++){let d=a[e].start,u=a[e].end;if(-1===n&&t>=d&&t<=u&&(n=e),t+i>=d&&t<u)o=d,s=(l=u)-t;else if(t+i<d){r=d;break}}return{len:s,start:o||0,end:l||0,nextStart:r,buffered:e,bufferedIndex:n}}static getBuffered(e){try{return e.buffered||nu}catch(e){return iy.log("failed to get media.buffered",e),nu}}}let nc=/\{\$([a-zA-Z0-9-_]+)\}/g;function nm(e){return nc.lastIndex=0,nc.test(e)}function nf(e,t){if(null!==e.variableList||e.hasVariableRefs){let i=e.variableList;return t.replace(nc,t=>{let r=t.substring(2,t.length-1),n=null==i?void 0:i[r];return void 0===n?(e.playlistParsingError||(e.playlistParsingError=Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'.concat(r,'"'))),t):n})}return t}function np(e,t,i){let r,n,a=e.variableList;if(a||(e.variableList=a={}),"QUERYPARAM"in t){r=t.QUERYPARAM;try{let e=new self.URL(i).searchParams;if(e.has(r))n=e.get(r);else throw Error('"'.concat(r,'" does not match any query parameter in URI: "').concat(i,'"'))}catch(t){e.playlistParsingError||(e.playlistParsingError=Error("EXT-X-DEFINE QUERYPARAM: ".concat(t.message)))}}else r=t.NAME,n=t.VALUE;r in a?e.playlistParsingError||(e.playlistParsingError=Error('EXT-X-DEFINE duplicate Variable Name declarations: "'.concat(r,'"'))):a[r]=n||""}let ng=/^(\d+)x(\d+)$/,nv=/(.+?)=(".*?"|.*?)(?:,|$)/g;class nE{get clientAttrs(){return Object.keys(this).filter(e=>"X-"===e.substring(0,2))}decimalInteger(e){let 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),i=new Uint8Array((t=(1&t.length?"0":"")+t).length/2);for(let e=0;e<t.length/2;e++)i[e]=parseInt(t.slice(2*e,2*e+2),16);return i}return null}hexadecimalIntegerAsNumber(e){let t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){let i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}enumeratedStringList(e,t){let i=this[e];return(i?i.split(/[ ,]+/):[]).reduce((e,t)=>
3(e[t.toLowerCase()]=!0,e),t)}bool(e){return"YES"===this[e]}decimalResolution(e){let t=ng.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e,t){let i,r={};for(nv.lastIndex=0;null!==(i=nv.exec(e));){let n=i[1].trim(),a=i[2],s=0===a.indexOf('"')&&a.lastIndexOf('"')===a.length-1,o=!1;if(s)a=a.slice(1,-1);else switch(n){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":o=!0}if(t&&(s||o))a=nf(t,a);else if(!o&&!s)switch(n){case"CLOSED-CAPTIONS":if("NONE"===a)break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":iy.warn("".concat(e,": attribute ").
3concat(n," is missing quotes"))}r[n]=a}return r}constructor(e,t){"string"==typeof e&&(e=nE.parseAttrList(e,t)),t6(this,e)}}class ny{get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){let e=this._cue;return void 0===e?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){let{tagAnchor:e}=this;return null===e||null===e.programDateTime?(iy.warn('Expected tagAnchor Fragment with PDT set for DateRange "'.concat(this.id,'": ').concat(e)),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){let e=this._endDate||this._dateAtEnd;if(e)return e;let t=this.duration;return null!==t?this._dateAtEnd=new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){let e=this.attr.decimalFloatingPoint("DURATION");if(tW(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 isInterstitial(){return"com.apple.hls.interstitial"===this.class}get isValid(){return!!this.id&&!this._badValueForSameId&&tW(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}get invalidReason(){return this.id?this._badValueForSameId?"Date range ".concat(this._badValueForSameId," mismatch"):tW(this.startDate.getTime())?this.isInterstitial&&!("X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)?"Interstitial Date range missing X-ASSET-(LIST|URI)":this.isValid?null:"Unknown (check DURATION(|END|NEXT), CLASS, and CUE)":"Date range invalid start date":"Missing ID"}constructor(e,t,i=0){var r;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(null==t?void 0:t.tagAnchor)||null,this.tagOrder=null!=(r=null==t?void 0:t.tagOrder)?r:i,t){let i=t.attr;for(let t in i)if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==i[t]){iy.warn('DATERANGE tag attribute: "'.concat(t,'" does not match for tags with ID: "').concat(e.ID,'"')),this._badValueForSameId=t;break}e=t6(new nE({}),i,e)}if(this.attr=e,t?(this._startDate=t._startDate,this._cue=t._cue,this._endDate=t._endDate,this._dateAtEnd=t._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in e){let i=(null==t?void 0:t.endDate)||new Date(e["END-DATE"]);tW(i.getTime())&&(this._endDate=i)}}}class nb{reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}let t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&i>0,this.updated||this.advanced?this.misses=0:this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(t=>{let i=t.decryptdata;return i||(t.setKeyFormat(e.keyFormat),i=t.decryptdata),!!i&&e.matches(i)})}get hasProgramDateTime(){return!!this.fragments.length&&tW(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}
3get drift(){let e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){let e=this.partList;if(e){let t=this.lastPartIndex;if(-1!==t){for(let i=e.length;i--;)if(e[i].index>t)return e[i].index;return t}}return 0}get lastPartSn(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){let e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}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.dateRangeTagCount=0,this.live=!0,this.iframesOnly=!1,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!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.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}}function nT(e,t){return e.length===t.length&&!e.some((e,i)=>e!==t[i])}function n_(e,t){return!e&&!t||!!e&&!!t&&nT(e,t)}function nA(e){return"AES-128"===e||"AES-256"===e||"AES-256-CTR"===e}function nS(e){switch(e){case"AES-128":case"AES-256":return r6.cbc;case"AES-256-CTR":return r6.ctr;default:throw Error("invalid full segment method ".concat(e))}}function nR(e){return Uint8Array.from(unescape(encodeURIComponent(e)),e=>e.charCodeAt(0))}function nk(e){let t=function(e,t,i){let r=e[t];e[t]=e[i],e[i]=r};t(e,0,3),t(e,1,2),t(e,4,5),t(e,6,7)}function nI(e){let t=e.split(":"),i=null;if("data"===t[0]&&2===t.length){let e=t[1].split(";"),r=e[e.length-1].split(",");if(2===r.length){let t="base64"===r[0],n=r[1];t?(e.splice(-1,1),i=iF(n)):i=function(e){let t=nR(e).subarray(0,16),i=new Uint8Array(16);return i.set(t,16-t.length),i}(n)}}return i}let nL="undefined"!=typeof self?self:void 0;var nD={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},nw={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function nC(e){switch(e){case nw.FAIRPLAY:return nD.FAIRPLAY;case nw.PLAYREADY:return nD.PLAYREADY;case nw.WIDEVINE:return nD.WIDEVINE;case nw.CLEARKEY:return nD.CLEARKEY}}var nM={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function nP(e){switch(e){case nD.FAIRPLAY:return nw.FAIRPLAY;case nD.PLAYREADY:return nw.PLAYREADY;case nD.WIDEVINE:return nw.WIDEVINE;case nD.CLEARKEY:return nw.CLEARKEY}}function nO(e){let{drmSystems:t,widevineLicenseUrl:i}=e,r=t?[nD.FAIRPLAY,nD.WIDEVINE,nD.PLAYREADY,nD.CLEARKEY].filter(e=>!!t[e]):[];return!r[nD.WIDEVINE]&&i&&r.push(nD.WIDEVINE),r}let nx=function(e){return null!=nL&&null!=(e=nL.navigator)&&e.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function nN(e){let t=iB(new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2)),i=t.substring(t.indexOf("<"),t.length),r=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(r){let e=r.childNodes[0]?r.childNodes[0].nodeValue:r.getAttribute("VALUE");if(e){let t=iF(e).subarray(0,16);return nk(t),t}}return null}let nU={};class nF{static clearKeyUriToKeyIdMap(){nU={}}static setKeyIdForUri(e,t){nU[e]=t}static addKeyIdForUri(e){let t=Object.keys(nU).length%Number.MAX_SAFE_INTEGER,i=new Uint8Array(16);return new DataView(i.buffer,12,4).setUint32(0,t),nU[e]=i,i}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&nT(e.keyFormatVersions,this.keyFormatVersions)&&n_(e.iv,this.iv)&&n_(e.keyId,this.keyId)}isSupported(){if(this.method){if(nA(this.method)||"NONE"===this.method)return!0;
3if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method;switch(this.keyFormat){case nw.FAIRPLAY:case nw.WIDEVINE:case nw.PLAYREADY:case nw.CLEARKEY:return -1!==["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(e,t){var i,r;if(!this.encrypted||!this.uri)return null;if(nA(this.method)){let t=this.iv;return t||("number"!=typeof e&&(iy.warn('missing IV for initialization segment with method="'.concat(this.method,'" - compliance issue')),e=0),t=function(e){let t=new Uint8Array(16);for(let i=12;i<16;i++)t[i]=e>>8*(15-i)&255;return t}(e)),new nF(this.method,this.uri,"identity",this.keyFormatVersions,t)}if(this.keyId){let e=nU[this.uri];if(e&&!nT(this.keyId,e)&&nF.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}let n=nI(this.uri);if(n)switch(this.keyFormat){case nw.WIDEVINE:if(this.pssh=n,!this.keyId){let e=rt(n.buffer).filter(e=>e.systemId===nM.WIDEVINE);if(e.length){let t=e[0];this.keyId=null!=(r=t.kids)&&r.length?t.kids[0]:null}}this.keyId||(this.keyId=nB(t));break;case nw.PLAYREADY:{let e=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=function(e,t,i){let r,n;if(16!==e.byteLength)throw RangeError("Invalid system id");r=new Uint8Array,n=new Uint8Array;let a=new Uint8Array(4);return i.byteLength>0&&new DataView(a.buffer).setUint32(0,i.byteLength,!1),function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];let n=i.length,a=8,s=n;for(;s--;)a+=i[s].byteLength;let o=new Uint8Array(a);for(o[0]=a>>24&255,o[1]=a>>16&255,o[2]=a>>8&255,o[3]=255&a,o.set(e,4),s=0,a=8;s<n;s++)o.set(i[s],a),a+=i[s].byteLength;return o}([112,115,115,104],new Uint8Array([0,0,0,0]),e,n,r,a,i)}(e,0,n),this.keyId=nN(n);break}default:{let e=n.subarray(0,16);if(16!==e.length){let t=new Uint8Array(16);t.set(e,16-e.length),e=t}this.keyId=e}}if((null==(i=this.keyId)?void 0:i.byteLength)!==16){let e;!(e=function(e){let t=null==e?void 0:e[nw.WIDEVINE];return t?t.keyId:null}(t))&&((e=nB(t))||(e=nU[this.uri])),e&&(this.keyId=e,nF.setKeyIdForUri(this.uri,e))}return this}constructor(e,t,i,r=[1],n=null,a){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.scheme=void 0,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=r,this.iv=n,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&!nA(e),null!=a&&a.startsWith("0x")&&(this.keyId=new Uint8Array(iU(a)))}}function nB(e){let t=null==e?void 0:e[nw.PLAYREADY];if(t){let e=nI(t.uri);if(e)return nN(e)}return null}let nG=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(I-FRAME-STREAM-INF|SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)(?:[\r\n]+|$)/g,nH=/#EXT-X-MEDIA:(.*)/g,nK=/^#EXT(?:INF|-X-TARGETDURATION):/m,nW=RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),nV=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|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|I-FRAMES-ONLY)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class nq{static findGroup(e,t){for(let i=0;i<e.length;i++){let r=e[i];if(r.id===t)return r}}static resolve(e,t){return tX.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return nK.test(e)}static parseMasterPlaylist(e,t){let i,r={contentSteering:null,levels:[],iframeVariants:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:nm(e)},n=[];if(nG.lastIndex=0,!e.startsWith("#EXTM3U"))return r.playlistParsingError=Error("no EXTM3U delimiter"),r;for(;null!=(i=nG.exec(e));)if(i[1]){let e=nY(new nE(i[1],r),i[2],t,r,n);e&&r.levels.push(e)}else if(i[3]){let e=i[3],a=i[4];switch(e){case"I-FRAME-STREAM-INF":{let e=new nE(a,r),i=nY(e,e.URI,t,r,n,!0);i&&r.iframeVariants.push(i)}break;case"SESSION-DATA":{let e=new nE(a,r),t=e["DATA-ID"];t&&(null===r.sessionData&&(r.sessionData={}),r.sessionData[t]=e);break}case"SESSION-KEY":{let e=nz(a,t,r);e.encrypted&&e.isSupported()?(null===r.sessionKeys&&(r.sessionKeys=[]),r.sessionKeys.push(e)):iy.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'.concat(a,'"'));break}case"DEFINE":{let e=new nE(a,r);np(r,e,t)}break;case"CONTENT-STEERING":{let e=new nE(a,r);r.contentSteering={uri:nq.resolve(e["SERVER-URI"],t),pathwayId:e["PATHWAY-ID"]||"."};break}case"START":r.startTimeOffset=nQ(a)}}let a=n.length>0&&n.length<r.levels.length;return r.levels=a?n:r.levels,0===r.levels.length&&(r.playlistParsingError=Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(e,t,i){let r,n={},a=i.levels,s={AUDIO:a.map(e=>({id:e.attrs.AUDIO,audioCodec:e.audioCodec})),SUBTITLES:a.map(e=>({id:e.attrs.SUBTITLES,textCodec:e.textCodec})),"CLOSED-CAPTIONS":[]},o=0;for(nH.lastIndex=0;null!==(r=nH.exec(e));){let e=new nE(r[1],i),a=e.TYPE;if(a){let i=s[a],r=n[a]||[];n[a]=r;let l=e.LANGUAGE,d=e["ASSOC-LANGUAGE"],u=e.CHANNELS,h=e.CHARACTERISTICS,c=e["INSTREAM-ID"],m={attrs:e,bitrate:0,id:o++,groupId:e["GROUP-ID"]||"",name:e.NAME||l||"",type:a,default:e.bool("DEFAULT"),autoselect:e.bool("AUTOSELECT"),forced:e.bool("FORCED"),lang:l,url:e.URI?nq.resolve(e.URI,t):""};if(d&&(m.assocLang=d),u&&(m.channels=u),h&&(m.characteristics=h),c&&(m.instreamId=c),null!=i&&i.length){let e=nq.findGroup(i,m.groupId)||i[0];nZ(m,e,"audioCodec"),nZ(m,e,"textCodec")}r.push(m)}}return n}static parseLevelPlaylist(e,t,i,r,n,a){var s,o,l,d,u;let h,c,m,f,p={url:t},g=new nb(t),v=g.fragments,E=[],y=null,b=0,T=0,A=0,S=0,R=0,k=null,I=new t5(r,p),L=-1,D=!1,w=null;if(nW.lastIndex=0,g.m3u8=e,g.hasVariableRefs=nm(e),(null==(s=nW.exec(e))?void 0:s[0])!=="#EXTM3U")return g.playlistParsingError=Error("Missing format identifier #EXTM3U"),g;for(;null!==(h=nW.exec(e));){D&&(D=!1,(I=new t5(r,p)).playlistOffset=A,I.setStart(A),I.sn=b,I.cc=S,R&&(I.bitrate=R),I.level=i,y&&(I.initSegment=y,y.rawProgramDateTime&&(I.rawProgramDateTime=y.rawProgramDateTime,y.rawProgramDateTime=null),w&&(I.setByteRange(w),w=null)));let e=h[1];if(e){I.duration=parseFloat(e);let t=(" "+h[2]).slice(1);I.title=t||null,I.tagList.push(t?["INF",e,t]:["INF",e])}else if(h[3]){if(tW(I.duration)){I.playlistOffset=A,I.setStart(A),m&&n0(I,m,g),I.sn=b,I.level=i,I.cc=S;let e=(" "+h[3]).slice(1);I.relurl=nf(g,e),nJ(I,k,E),k=I,A+=I.duration,b++,T=0;let t=I.byteRange;if(2===t.length&&(I.bitrate=(t[1]-t[0])*8/I.duration|0),g.iframesOnly&&t[0]&&(null==(o=y)?void 0:o.cc)!==S){let e=new t5(r,p);e.relurl=I.relurl,e.setByteRange("".concat(Math.min(t[0],1316),"@0")),e.level=i,e.sn="initSegment",m&&(e.levelkeys=m,m.identity&&(e._decryptdata=m.identity.getDecryptData(0))),y=e,I.initSegment=y}v.push(I),D=!0}}
3else{if(!(h=h[0].match(nV))){iy.warn("No matches on slow regex match for level playlist!");continue}for(c=1;c<h.length&&void 0===h[c];c++);let e=(" "+h[c]).slice(1),n=(" "+h[c+1]).slice(1),s=h[c+2]?(" "+h[c+2]).slice(1):null;switch(e){case"BYTERANGE":k?I.setByteRange(n,k):I.setByteRange(n);break;case"PROGRAM-DATE-TIME":I.rawProgramDateTime=n,I.tagList.push(["PROGRAM-DATE-TIME",n]),-1===L&&(L=v.length);break;case"PLAYLIST-TYPE":g.type&&n1(g,e,h),g.type=n.toUpperCase();break;case"MEDIA-SEQUENCE":0!==g.startSN?n1(g,e,h):null!==k&&(l=g,d=e,u=h,l.playlistParsingError=Error("#EXT-X-".concat(d," must appear before the first Media Segment (").concat(u[0],")"))),g.startSN=parseInt(n),b=g.startSN+g.skippedSegments;break;case"SKIP":{g.skippedSegments&&n1(g,e,h);let t=new nE(n,g),i=t.decimalInteger("SKIPPED-SEGMENTS");if(tW(i)){g.skippedSegments+=i;for(let e=i;e--;)v.push(null);b+=i}let r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(g.recentlyRemovedDateranges=(g.recentlyRemovedDateranges||[]).concat(r.split("	")));break}case"TARGETDURATION":0!==g.targetduration&&n1(g,e,h),g.targetduration=Math.max(parseInt(n),1);break;case"VERSION":null!==g.version&&n1(g,e,h),g.version=parseInt(n);break;case"INDEPENDENT-SEGMENTS":break;case"I-FRAMES-ONLY":g.iframesOnly=!0;break;case"ENDLIST":g.live||n1(g,e,h),g.live=!1;break;case"#":(n||s)&&I.tagList.push(s?[n,s]:[n]);break;case"DISCONTINUITY":S++,I.tagList.push(["DIS"]);break;case"GAP":I.gap=!0,I.tagList.push([e]);break;case"BITRATE":I.tagList.push([e,n]),tW(R=1e3*parseInt(n))?I.bitrate=R:R=0;break;case"DATERANGE":{let e=new nE(n,g),t=new ny(e,g.dateRanges[e.ID],g.dateRangeTagCount);g.dateRangeTagCount++,t.isValid||g.skippedSegments?g.dateRanges[t.id]=t:iy.log("Ignoring invalid DATERANGE tag: ".concat(t.invalidReason,": ").concat(n)),I.tagList.push(["EXT-X-DATERANGE",n]);break}case"DEFINE":{let e=new nE(n,g);"IMPORT"in e?function(e,t,i){let r=t.IMPORT;if(i&&r in i){let t=e.variableList;t||(e.variableList=t={}),t[r]=i[r]}else e.playlistParsingError||(e.playlistParsingError=Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'.concat(r,'"')))}(g,e,a):np(g,e,t)}break;case"DISCONTINUITY-SEQUENCE":0!==g.startCC&&n1(g,e,h),g.startCC=S=parseInt(n),v.forEach(e=>e&&(e.cc=S));break;case"KEY":{let e=nz(n,t,g);if(e.isSupported()){if("NONE"===e.method){m=void 0;break}m||(m={});let t=m[e.keyFormat];null!=t&&t.matches(e)||(t&&(m=t6({},m)),m[e.keyFormat]=e)}else iy.warn('[Keys] Ignoring unsupported EXT-X-KEY tag: "'.concat(n,'"'));break}case"START":g.startTimeOffset=nQ(n);break;case"MAP":{let e=new nE(n,g);if(I.duration){let t=new t5(r,p);n$(t,e,i,m),y=t,I.initSegment=y,y.rawProgramDateTime&&!I.rawProgramDateTime&&(I.rawProgramDateTime=y.rawProgramDateTime)}else{let t=I.byteRangeEndOffset;if(t){let e=I.byteRangeStartOffset;w="".concat(t-e,"@").concat(e)}else w=null;n$(I,e,i,m),y=I,D=!0}y.cc=S;break}case"SERVER-CONTROL":f&&n1(g,e,h),g.canBlockReload=(f=new nE(n)).bool("CAN-BLOCK-RELOAD"),g.canSkipUntil=f.optionalFloat("CAN-SKIP-UNTIL",0),g.canSkipDateRanges=g.canSkipUntil>0&&f.bool("CAN-SKIP-DATERANGES"),g.partHoldBack=f.optionalFloat("PART-HOLD-BACK",0),g.holdBack=f.optionalFloat("HOLD-BACK",0);break;case"PART-INF":g.partTarget&&n1(g,e,h),g.partTarget=new nE(n).decimalFloatingPoint("PART-TARGET");break;case"PART":{let e=g.partList;e||(e=g.partList=[]);let t=T>0?e[e.length-1]:void 0,i=T++,r=new t8(new nE(n,g),I,p,i,t);e.push(r),I.duration+=r.duration;break}case"PRELOAD-HINT":{let e=new nE(n,g);g.preloadHint=e;break}case"RENDITION-REPORT":{let e=new nE(n,g);g.renditionReports=g.renditionReports||[],g.renditionReports.push(e);break}default:iy.warn("line parsed but not handled: ".concat(h))}}}k&&!k.relurl?(v.pop(),A-=k.duration,g.partList&&(g.fragmentHint=k)):g.partList&&(nJ(I,k,E),I.cc=S,g.fragmentHint=I,m&&n0(I,m,g)),g.targetduration||(g.playlistParsingError=Error("Missing Target Duration"));let C=v.length,M=v[0],P=v[C-1];if((A+=g.skippedSegments*g.targetduration)>0&&C&&P){g.averagetargetduration=A/C;let e=P.sn;g.endSN="initSegment"!==e?e:0,g.live||(P.endList=!0),L>0&&(function(e,t,i){if(i||(i=e[t]),i)for(let r=t;r--;){let t=e[r];if(!t)return;t.programDateTime=i.programDateTime-1e3*t.duration,i=t}}(v,L,L>C-1?I:null),M&&E.unshift(M))}return g.fragmentHint&&(A+=g.fragmentHint.duration),g.totalduration=A,E.length&&g.dateRangeTagCount&&M&&nj(E,g),g.endCC=S,g}}function nY(e,t,i,r,n,a){var s;if(void 0===t)return null;let o=nf(r,t),l={attrs:e,bitrate:e.decimalInteger("BANDWIDTH")||e.decimalInteger("AVERAGE-BANDWIDTH"),name:e.NAME,url:nq.resolve(o,i)},d=e.decimalResolution("RESOLUTION");d&&(l.width=d.width,l.height=d.height),nX(e.CODECS,l);let u=e["SUPPLEMENTAL-CODECS"];return u&&(l.supplemental={},nX(u,l.supplemental)),null!=(s=l.unknownCodecs)&&s.length||n.push(l),a&&(l.iframes=!0),l}function nj(e,t){let i=e.length;if(!i)if(!t.hasProgramDateTime)return;else{let r=t.fragments[t.fragments.length-1];e.push(r),i++}let r=e[i-1],n=t.live?1/0:t.totalduration,a=Object.keys(t.dateRanges);for(let o=a.length;o--;){let l=t.dateRanges[a[o]],d=l.startDate.getTime();l.tagAnchor=r.ref;for(let r=i;r--;){var s;if((null==(s=e[r])?void 0:s.sn)<t.startSN)break;let i=function(e,t,i,r,n){let a=i[r];if(a){let o=a.programDateTime;if(t>=o||0===r){var s;if(t<=o+1e3*(((null==(s=i[r+1])?void 0:s.start)||n)-a.start)){let n=a.sn-e.startSN,s=e.fragments;if(n>=0&&n<s.length){if(s.length>i.length){let a=Math.min((i[r+1]||s[s.length-1]).sn-e.startSN,s.length-1);for(let e=a;e>n;e--){let i=s[e].programDateTime;if(t>=i&&t<i+1e3*s[e].duration)return s[e]}}return s[n]}}}}return null}(t,d,e,r,n);if(i){l.tagAnchor=i.ref;break}}}}function nz(e,t,i){var r,n;let a=new nE(e,i),s=null!=(r=a.METHOD)?r:"",o=a.URI,l=a.hexadecimalInteger("IV"),d=a.KEYFORMATVERSIONS,u=null!=(n=a.KEYFORMAT)?n:"identity";return o&&a.IV&&!l&&iy.error("Invalid IV: ".concat(a.IV)),new nF(s,o?nq.resolve(o,t):"",u,(d||"1").split("/").map(Number).filter(Number.isFinite),l,a.KEYID)}function nQ(e){let t=new nE(e).decimalFloatingPoint("TIME-OFFSET");return tW(t)?t:null}function nX(e,t){let i=(e||"").split(/[ ,]+/).filter(e=>e);
3["video","audio","text","image"].forEach(e=>{let r=i.filter(t=>rl(t,e));r.length&&(t["".concat(e,"Codec")]=r.map(e=>e.split("/")[0]).join(","),i=i.filter(e=>-1===r.indexOf(e)))}),t.unknownCodecs=i}function nZ(e,t,i){let r=t[i];r&&(e[i]=r)}function nJ(e,t,i){e.rawProgramDateTime?i.push(e):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime)}function n$(e,t,i,r){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=i,e.sn="initSegment",r&&(e.levelkeys=r),e.initSegment=null}function n0(e,t,i){e.levelkeys=t;let{encryptedFragments:r}=i;(!r.length||r[r.length-1].levelkeys!==t)&&Object.keys(t).some(e=>t[e].isCommonEncryption)&&r.push(e)}function n1(e,t,i){e.playlistParsingError=Error("#EXT-X-".concat(t," must not appear more than once (").concat(i[0],")"))}function n2(e,t){let i=t.startPTS;if(tW(i)){let r,n=0;t.sn>e.sn?(n=i-e.start,r=e):(n=e.start-i,r=t),r.duration!==n&&r.setDuration(n)}else t.sn>e.sn?e.cc===t.cc&&e.minEndPTS?t.setStart(e.start+(e.minEndPTS-e.start)):t.setStart(e.start+e.duration):t.setStart(Math.max(e.start-t.duration,0))}function n3(e,t,i,r,n,a,s,o){let l;r-i<=0&&(o.warn("Fragment should have a positive duration",t),r=i+t.duration,a=n+t.duration);let d=i,u=r,h=t.startPTS,c=t.endPTS;if(tW(h)){let s=Math.abs(h-i);e&&s>e.totalduration?o.warn("media timestamps and playlist times differ by ".concat(s,"s for level ").concat(t.level," ").concat(e.url)):tW(t.deltaPTS)?t.deltaPTS=Math.max(s,t.deltaPTS):t.deltaPTS=s,d=Math.max(i,h),i=Math.min(i,h),n=void 0!==t.startDTS?Math.min(n,t.startDTS):n,u=Math.min(r,c),r=Math.max(r,c),a=void 0!==t.endDTS?Math.max(a,t.endDTS):a}let m=i-t.start;0!==t.start&&t.setStart(i),t.setDuration(r-t.start),t.startPTS=i,t.maxStartPTS=d,t.startDTS=n,t.endPTS=r,t.minEndPTS=u,t.endDTS=a;let f=t.sn;if(!e||f<e.startSN||f>e.endSN)return 0;let p=f-e.startSN,g=e.fragments;for(g[p]=t,l=p;l>0;l--)n2(g[l],g[l-1]);for(l=p;l<g.length-1;l++)n2(g[l],g[l+1]);return e.fragmentHint&&n2(g[g.length-1],e.fragmentHint),e.PTSKnown=e.alignedSliding=!0,m}function n4(e,t,i,r,n){return Error("".concat(e," ").concat(n.url,"\nPlaylist starting @").concat(t.startSN,"\n").concat(t.m3u8,"\n\nPlaylist starting @").concat(i.startSN,"\n").concat(i.m3u8))}function n5(e,t){let i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=arguments.length>3?arguments[3]:void 0,n=t.startSN+t.skippedSegments-e.startSN,a=e.fragments,s=n>=0,o=0;if(s&&n<a.length)o=a[n].start,null==r||r.log("Aligning playlists based on SN ".concat(t.startSN," (diff: ").concat(o,")"));else if(s&&t.startSN===e.endSN+1)o=e.fragmentEnd,null==r||r.log("Aligning playlists based on first/last SN ".concat(t.startSN," (diff: ").concat(o,")"));else if(s&&i)o=e.fragmentStart+n*t.levelTargetDuration;else{if(t.skippedSegments||0!==t.fragmentStart)return o;o=e.fragmentStart,null==r||r.log("Aligning playlists based on first SN ".concat(t.startSN," (diff: ").concat(o,")"))}return function(e,t){if(t){let i=e.fragments;for(let r=e.skippedSegments;r<i.length;r++)i[r].addStart(t);e.fragmentHint&&e.fragmentHint.addStart(t)}}(t,o),o}function n8(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0,i=1e3*e.targetduration;if(e.updated){let r=e.fragments;if(r.length&&4*i>t){let e=1e3*r[r.length-1].duration;e>0&&e<i&&(i=e)}}else i/=2;return Math.round(i)}function n6(e,t,i){var r;if(!e)return null;let n=e.fragments[t-e.startSN];return n||(null==(r=n=e.fragmentHint)?void 0:r.sn)===t?n:i&&t<e.startSN&&i.sn===t?i:null}function n9(e,t,i){return e?n7(e.partList,t,i):null}function n7(e,t,i){if(e)for(let r=e.length;r--;){let n=e[r];if(n.index===i&&n.fragment.sn===t)return n}return null}function ae(e){e.forEach((e,t)=>{var i;null==(i=e.details)||i.fragments.forEach(e=>{e.level=t,e.initSegment&&(e.initSegment.level=t)})})}function at(e){return e.replace(/\?[^?]*$/,"")}function ai(e,t){for(let r=0,n=e.length;r<n;r++){var i;if((null==(i=e[r])?void 0:i.cc)===t)return e[r]}return null}function ar(e,t){let i=e.start+t;e.setStart(i)}function an(e,t){let i=t.fragments;for(let t=0,r=i.length;t<r;t++)ar(i[t],e);t.fragmentHint&&ar(t.fragmentHint,e),t.alignedSliding=!0}function aa(e,t,i){e&&(function(e,t,i){if((!t||!(e.startCC<t.endCC)||!(e.endCC>t.startCC))&&1)return;let r=Math.min(t.endCC,e.endCC),n=ai(t.fragments,r),a=ai(e.fragments,r);if(!n||!a)return;let s=n.start-a.start;i.log("Aligning playlists using dicontinuity sequence ".concat(r," (diff: ").concat(s,")")),an(s,e)}(t,e,i),t.alignedSliding||function(e,t,i){let r,n;if(!e.hasProgramDateTime||!t.hasProgramDateTime)return;let a=e.fragments,s=t.fragments;if(!a.length||!s.length)return;let o=Math.min(t.endCC,e.endCC);t.startCC<o&&e.startCC<o&&(r=ai(s,o),n=ai(a,o)),r&&n||(n=ai(a,(r=s[Math.floor(s.length/2)]||s.filter(e=>!!e)[0]).cc)||a[Math.floor(a.length/2)]);let l=r.programDateTime,d=n.programDateTime;if(!l||!d)return;let u=(d-l)/1e3;if(Math.abs(u)>Math.max(60,e.totalduration))return i.log("Cannot align playlists using PDT without overlap (".concat(Math.abs(u)," > ").concat(e.totalduration,")"));let h=u-(n.start-r.start);i.log("Aligning playlists using PDT (diff: ".concat(h,")")),an(h,e)}(t,e,i),t.alignedSliding||t.skippedSegments||n5(e,t,!1,i))}function as(e,t,i){ao(e,t,i),e.addEventListener(t,i)}function ao(e,t,i){e.removeEventListener(t,i)}function al(e){let t="",i=e.length;for(let r=0;r<i;r++)t+="[".concat(e.start(r).toFixed(3),"-").concat(e.end(r).toFixed(3),"]");return t}let ad={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 au extends no{registerListeners(){let{hls:e}=this;
3e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===ad.STOPPED)return;this.fragmentLoader.abort(),this.initFragmentLoader.abort(),this.keyLoader.abort(this.playlistType);let e=this.fragCurrent;null!=e&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=ad.STOPPED}get startPositionValue(){let{nextLoadPosition:e,startPosition:t}=this;if(-1===t&&e){let t=this.getLevelDetails();return null!=t&&t.live?(this.hls.liveSyncPosition||t.fragmentStart)+this.timelineOffset:e}return t}get bufferingEnabled(){return this.buffering}get backtrackFragment(){}set backtrackFragment(e){}get couldBacktrack(){return!1}set couldBacktrack(e){}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,t){if(t.live||!this.media)return!1;let i=e.end||0,r=this.config.timelineOffset||0;if(i<=r)return!1;let n=e.buffered;this.config.maxBufferHole&&n&&n.length>1&&(e=nh.bufferedInfo(n,e.start,0));let a=e.nextStart;if(a&&a>r&&a<t.edge||this.media.currentTime<e.start)return!1;let s=t.partList;if(null!=s&&s.length){let e=s[s.length-1];return nh.isBuffered(this.media,e.start+e.duration/2)}let o=t.fragments[t.fragments.length-1];return this.fragmentTracker.isEndListAppended(o.type)}getLevelDetails(){if(this.levels&&null!==this.levelLastLoaded)return this.levelLastLoaded.details}get timelineOffset(){let e=this.config.timelineOffset;if(e){var t;return(null==(t=this.getLevelDetails())?void 0:t.appliedTimelineOffset)||e}return 0}onMediaAttached(e,t){let i=this.media=this.mediaBuffer=t.media;as(i,"seeking",this.onMediaSeeking),as(i,"ended",this.onMediaEnded);let r=this.config;this.levels&&r.autoStartLoad&&this.state===ad.STOPPED&&this.startLoad(r.startPosition)}onMediaDetaching(e,t){this.fragPlaying=null;let i=!!t.transferMedia,r=this.media;if(null!==r){if(r.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),ao(r,"seeking",this.onMediaSeeking),ao(r,"ended",this.onMediaEnded),this.media=this.mediaBuffer=null,this.loopSn=void 0,i){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.fragPlaying=this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=0,this.startPosition=-1,this.startFragRequested=!1}onError(e,t){}onManifestLoaded(e,t){this.startTimeOffset=t.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=ad.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.initFragmentLoader&&this.initFragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.decrypter=this.keyLoader=null,this.fragmentLoader=this.initFragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,t,i){this.startFragRequested=!0,this._loadFragForPlayback(e,t,i)}_loadFragForPlayback(e,t,i){let r=e=>{let t=e.frag;if(this.fragContextChanged(t)){this.warn("".concat(t.type," sn: ").concat(t.sn).concat(e.part?" part: "+e.part.index:""," of ").concat(this.fragInfo(t,!1,e.part)," was dropped during download.")),this.fragmentTracker.removeFragment(t);return}let i=++t.stats.chunkCount;this.log("load progress ".concat(t.type," sn: ").concat(t.sn).concat(e.part?" part: "+e.part.index:""," of ").concat(this.fragInfo(t,!1,e.part)," chunk: ").concat(i)),this._handleFragmentLoadProgress(e)};this._doFragLoad(e,t,i,r).then(e=>{if(!e)return;let t=this.state,i=e.frag;if(this.fragContextChanged(i)){t!==ad.FRAG_LOADING&&(this.fragCurrent||t!==ad.PARSING)||(this.fragmentTracker.removeFragment(i),this.state=ad.IDLE);return}"payload"in e&&(this.log("Loaded ".concat(i.type," sn: ").concat(i.sn," of ").concat(this.playlistLabel()," ").concat(i.level," (bytes ").concat(i.stats.loaded,")")),this.hls.trigger(tz.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e)}).catch(t=>{this.state!==ad.STOPPED&&this.state!==ad.ERROR&&(this.log("Frag error ".concat(e.type," sn:").concat(e.sn," cc:").concat(e.cc,": ").concat((null==t?void 0:t.message)||t)),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var t;let{fragmentTracker:i}=this;if(i.getState(e)===r2.APPENDING){let t=e.type,r=this.getFwdBufferInfo(this.mediaBuffer,t),n=Math.max(e.duration,r?r.len:this.config.maxBufferLength),a=this.backtrackFragment;(1==(a?e.sn-a.sn:0)||this.reduceMaxBufferLength(n,e.duration))&&i.removeFragment(e)}else(null==(t=this.mediaBuffer)?void 0:t.buffered.length)===0?i.removeAllFragments():i.hasParts(e.type)&&(i.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),i.getState(e)===r2.PARTIAL&&i.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){let t=this.fragmentTracker,i=e.fragments[e.fragments.length-1];if(i.endList&&!t.isEndListAppended(this.playlistType)){let e=t.getPartialFragment(i.end);e&&(t.removeFragment(e),t.fragBuffered(i,!0))}t.detectPartialFragments({frag:i,part:null,stats:i.stats,id:i.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){let t=e.details;return(null==t?void 0:t.live)&&"EVENT"!==t.type&&(this.levelLastLoaded!==e||t.expired)}flushMainBuffer(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e-t&&this.hls.trigger(tz.BUFFER_FLUSHING,{startOffset:e,endOffset:t,type:i})}_loadInitSegment(e){let{hls:t}=this;return this.initFragmentLoader.abort(),t.trigger(tz.FRAG_LOADING,{frag:e,targetBufferTime:0}),this.initFragmentLoader.load(e).then(e=>{var t;let i=e.frag;if(!this.levels||!t4(i,null==(t=this.fragCurrent)?void 0:t.initSegment))throw new ns({type:tY.NETWORK_E
3RROR,details:tj.INTERNAL_ABORTED,error:Error("init load aborted"),fatal:!1,frag:i,networkDetails:null});return e}).then(e=>{let{frag:i,payload:r}=e,n=i.decryptdata;if(r&&r.byteLength>0&&null!=n&&n.key&&n.iv&&nA(n.method)){let a=self.performance.now(),{decryptRange:s}=nn(i,null,this.iframesOnly);return this.decrypter.decrypt(new Uint8Array(r),n.key.buffer,n.iv.buffer,nS(n.method),s).catch(e=>{throw t.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:i}),this.fragmentLoader.abort(),e}).then(r=>{let n=self.performance.now();return t.trigger(tz.FRAG_DECRYPTED,{frag:i,part:null,payload:r,stats:{tstart:a,tdecrypt:n}}),e.payload=r,this.completeInitSegmentLoad(e)})}return this.completeInitSegmentLoad(e)})}completeInitSegmentLoad(e){let t=e.frag.stats;e.frag.data=new Uint8Array(e.payload),t.parsing.start=t.buffering.start=self.performance.now(),t.parsing.end=t.buffering.end=self.performance.now()}loadInitSegmentIfNeeded(e){let{initSegment:t}=e;if(!this.bitrateTest&&t2(e)&&t&&!t.data){var i;return(t.encrypted&&!(null!=(i=t.decryptdata)&&i.key)?this.keyLoader.load(t).then(()=>this._loadInitSegment(t)):this._loadInitSegment(t)).catch(t=>{if(this.state===ad.STOPPED||this.state===ad.ERROR)throw t;throw"data"in t&&(t.data.frag=e,this.fragmentLoader.abort(),this.handleFragLoadError(t)),this.resetFragmentLoading(e),t})}}unhandledEncryptionError(e,t){var i,r;let n=e.tracks;if(n&&!t.encrypted&&(null!=(i=n.audio)&&i.encrypted||null!=(r=n.video)&&r.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){let e=this.media,i=Error("Encrypted track with no key in ".concat(this.fragInfo(t)," (media ").concat(e?"attached mediaKeys: "+e.mediaKeys:"detached",")"));return this.warn(i.message),!!e&&!e.mediaKeys&&(this.hls.trigger(tz.ERROR,{type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_NO_KEYS,fatal:!1,error:i,frag:t}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){let{fragCurrent:t}=this;return!e||!t4(e,t)}fragBufferedComplete(e,t){let i=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.fragInfo(e,!1,t)," > buffer:").concat(i?al(nh.getBuffered(i)):"(detached)",")")),t2(e)){var r;if(e.type!==t$.SUBTITLE){let t=e.elementaryStreams;if(!Object.keys(t).some(e=>!!t[e])){this.state=ad.IDLE;return}}let i=null==(r=this.levels)?void 0:r[e.level];null!=i&&i.fragmentError&&(t||this.fragmentTracker.getState(e)!==r2.PARTIAL)&&(this.log("Resetting level fragment error count of ".concat(i.fragmentError," on frag buffered")),i.fragmentError=0,e.stats.retry=0)}this.state=ad.IDLE}_handleFragmentLoadComplete(e){let{transmuxer:t}=this;if(!t)return;let i=e.frag,{part:r,partsLoaded:n}=e,a=!n||0===n.length||n.some(e=>!e),{decryptRange:s}=nn(i,r),o=new nl(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a,i.duration,this.iframesOnly,s);this.log("load complete ".concat(i.type," sn: ").concat(i.sn).concat(r?" part: "+r.index:""," of ").concat(this.fragInfo(i,!1,r))),t.flush(o)}_handleFragmentLoadProgress(e){}loadKeyFor(e,t,i){var r;let n=null;return e.encrypted&&!(null!=(r=e.decryptdata)&&r.key)?(this.log("Loading key for ".concat(e.sn," of [").concat(t.startSN,"-").concat(t.endSN,"], ").concat(this.playlistLabel()," ").concat(e.level)),this.state=ad.KEY_LOADING,n=this.keyLoader.load(e,i).then(e=>{if(!this.fragContextChanged(e.frag))return this.hls.trigger(tz.KEY_LOADED,e),this.state===ad.KEY_LOADING&&(this.state=ad.IDLE),e}),this.hls.trigger(tz.KEY_LOADING,{frag:e})):!e.encrypted&&(n=this.keyLoader.loadClear(e,t.encryptedFragments,this.startFragRequested))&&this.log("[eme] blocking frag sn: ".concat(e.sn," load until media-keys acquired")),n}_doFragLoad(e,t){var i,r;let n,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3?arguments[3]:void 0;this.fragCurrent=e;let o=t.details;if(!this.levels||!o)throw Error("frag load aborted, missing level".concat(o?"":" detail","s"));let l=this.fragPrevious;if(!t3(e,l)){let i=this.shouldLoadParts(t.details,e.end);i!==this.loadingParts&&(this.log("LL-Part loading ".concat(i?"ON":"OFF"," loading sn ").concat(null==l?void 0:l.sn,"->").concat(e.sn)),this.loadingParts=i)}if(a=Math.max(e.start,a||0),this.loadingParts){let i=o.partList;if(i&&s){a>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);let r=this.getNextPart(i,e,a);if(r>-1){let n,d=i[r];if(!t3(e=this.fragCurrent=d.fragment,l)&&!this.shouldLoadParts(t.details,e.end))return this.log("LL-Part loading OFF @".concat(this.playhead," next part: ").concat(this.fragInfo(e,!1,d))),this.loadingParts=!1,Promise.resolve(null);if(!this.filterReplacedPrimary(d,t.details))return Promise.resolve(null);let u=this.loadKeyFor(e,o);if(this.fragContextChanged(e))return Promise.resolve(null);this.log("Loading ".concat(e.type," sn: ").concat(e.sn," part: ").concat(d.index," (").concat(r,"/").concat(i.length-1,") of ").concat(this.fragInfo(e,!1,d)," cc: ").concat(e.cc," [").concat(o.startSN,"-").concat(o.endSN,"], target: ").concat(a).concat(d.byteRange.length?" range:".concat(d.byteRange.join("-")):"")),this.nextLoadPosition=d.start+d.duration,this.state=ad.FRAG_LOADING;let h=this.loadInitSegmentIfNeeded(e);if(u||h){let i=!!u;n=Promise.all([u,h]).then(r=>{let[n]=r;return i&&(!n||this.fragContextChanged(n.frag))?null:this.doFragPartsLoad(e,d,t,s)}).catch(e=>this.handleFragLoadError(e))}else n=this.doFragPartsLoad(e,d,t,s).catch(e=>this.handleFragLoadError(e));return(this.hls.trigger(tz.FRAG_LOADING,{frag:e,part:d,targetBufferTime:a}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING parts")):n}if(!e.url||this.loadedEndOfParts(i,a))return Promise.resolve(null)}}if(this.loadingParts)this.log("LL-Part loading OFF after next part miss @".concat(a," Check buffer at sn: ").concat(e.sn," loaded parts: ").concat(null==(i=o.partList)?void 0:i.filter(e=>e.loaded).map(e=>"[".concat(e.start,"-").concat(e.end,"]")))),this.loadingParts=!1;else if(!e.url)return Promise.resolve(null);if(!this.filterReplacedPrimary(e,t.details))return Promise.resolve(null);let d=this.loadInitSegmentIfNeeded(e),u=this.loadKeyFor(e,o,d);if(this.fragContextChanged(e))return this.log("Context changed in KEY_LOADING sn: ".concat(e.sn," ").concat(e.relurl," > ").concat(null==(r=this.fragCurrent)?void 0:r.relurl)),null==d||d.catch(()=>null),null==u||u.catch(()=>null),Promise.resolve(null);this.log("Loading ".concat(e.type," sn: ").concat(e.sn," of ").concat(this.fragInfo(e,!1)," cc: ").concat(e.cc," ").concat("["+o.startSN+"-"+o.endSN+"]",", target: ").concat(a).concat(e.byteRange.length?" range:".concat(e.byteRange.join("-")):"")),tW(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=ad.FRAG_LOADING;let h=this.config.progressive&&e.type!==t$.SUBTITLE;return(n=h&&u?u.then(t=>!t||this.fragContextChanged(t.frag)?null:this.fragmentLoader.load(e,this.iframesOnly,s,d)).catch(e=>this.handleFragLoadError(e)):Promise.all([this.fragmentLoader.load(e,this.iframesOnly,h?s:void 0,h?d:void 0),u,d]).then(e=>{let[t]=e;return!h&&s&&s(t),t}).catch(e=>this.handleFragLoadError(e)),this.hls.trigger(tz.FRAG_LOADING,{frag:e,targetBufferTime:a}),null===this.fragCurrent)?Promise.reject(Error("frag load aborted, context changed in FRAG_LOADING")):Promise.all([n,d]).then(e=>{let[t]=e;return t})}doFragPartsLoad(e,t,i,r){return new Promise((n,a)=>{var s;let o=[],l=null==(s=i.details)?void 0:s.partList,d=t=>{this.fragmentLoader.loadPart(e,t,r).then(r=>{o[t.index]=r;let a=r.part;this.hls.trigger(tz.FRAG_LOADED,r);let s=n9(i.details,e.sn,t.index+1)||n7(l,e.sn,t.index+1);if(!s)return n({frag:e,part:a,partsLoaded:o});d(s)}).catch(a)};d(t)})}handleFragLoadError(e){if("data"in e){let t=e.data;t.frag&&t.details===tj.INTERNAL_ABORTED?this.handleFragLoadAborted(t.frag,t.part):t.frag&&t.type===tY.KEY_SYSTEM_ERROR&&!t.fatal&&(t.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(t.frag)),this.hls.trigger(tz.ERROR,t)}else this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){let t=this.getCurrentContext(e);if(!t||this.state!==ad.PARSING){this.fragCurrent||this.state===ad.STOPPED||this.state===ad.ERROR||(this.state=ad.IDLE);return}let{frag:i,part:r,level:n}=t,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a);let s=this.getLevelDetails(),o=s&&i.sn>s.endSN||this.shouldLoadParts(s,i.end);o!==this.loadingParts&&(this.log("LL-Part loading ".concat(o?"ON":"OFF"," after parsing segment ending @").concat(i.end)),this.loadingParts=o),this.updateLevelTiming(i,r,n,e)}shouldLoadParts(e,t){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList&&!this.iframesOnly){var i;let r=e.partList[0];if(t>=r.end+((null==(i=e.fragmentHint)?void 0:i.duration)||0)&&this.playhead>r.start-r.fragment.duration)return!0}}return!1}getCurrentContext(e){let{levels:t,fragCurrent:i}=this,{level:r,sn:n,part:a}=e;if(!(null!=t&&t[r]))return this.warn("Levels object was unset while buffering fragment ".concat(n," of ").concat(this.playlistLabel()," ").concat(r,". The current chunk will not be buffered.")),null;let s=t[r],o=s.details,l=a>-1?n9(o,n,a):null,d=l?l.fragment:n6(o,n,i);return d?(i&&i!==d&&(d.stats=i.stats),{frag:d,part:l,level:s}):null}bufferFragmentData(e,t,i,r,n){if(this.state!==ad.PARSING)return;t2(t)&&!this.fragContextChanged(t)&&(this.fragPrevious=t);let{data1:a,data2:s}=e,o=a;if(s&&(o=i8(a,s)),!o.length)return;let l=this.initPTS[t.cc],d=l?-l.baseTime/l.timescale:void 0,u={type:e.type,frag:t,part:i,chunkMeta:r,offset:d,parent:t.type,data:o};if(this.hls.trigger(tz.BUFFER_APPENDING,u),e.dropped&&e.independent&&!i){if(n)return;this.flushBufferGap(t)}}flushBufferGap(e){let t=this.media;if(!t)return;if(!nh.isBuffered(t,t.currentTime))return void this.flushMainBuffer(0,e.start);let i=t.currentTime,r=nh.bufferInfo(t,i,0),n=e.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),s=Math.max(Math.min(e.start-a,r.end-a),i+a);e.start-s>a&&this.flushMainBuffer(s,e.start)}getFwdBufferInfo(e,t){var i;let r=this.playhead,n=this.lastCurrentTime>r||null!=(i=this.media)&&i.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,r,t,n)}getFwdBufferInfoAtPos(e,t,i,r){let n=nh.bufferInfo(e,t,r);if(0===n.len&&void 0!==n.nextStart){let a=this.fragmentTracker.getBufferedFrag(t,i);if(a&&(n.nextStart<=a.end||a.gap)){let i=Math.max(Math.min(n.nextStart,a.end)-t,r);return nh.bufferInfo(e,t,i)}}return n}
3getMaxBufferLength(e){let{config:t}=this;return Math.min(e?Math.max(8*t.maxBufferSize/e,t.maxBufferLength):t.maxBufferLength,t.maxMaxBufferLength)}exceedsMaxBuffer(e,t,i){let r=e.nextStart;if(r&&i.start>r){let r=e.buffered;if(r){let n=e.len,a=e.bufferedIndex;for(let e=r.length-1;e>a;e--)r[e].start<i.start&&(n+=r[e].end-r[e].start);return n>=t}}return!1}reduceMaxBufferLength(e,t){let i=this.config,r=Math.max(Math.min(e-t,i.maxBufferLength),t/2),n=Math.max(e-3*t,i.maxMaxBufferLength/2,r);return n>=r&&(i.maxMaxBufferLength=n,this.warn("Reduce max buffer length to ".concat(n,"s")),!0)}getAppendedFrag(e){let t=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,this.playlistType):null;return t&&"fragment"in t?t.fragment:t}getNextFragment(e,t){let i=t.fragments,r=i.length;if(!r)return null;let{config:n}=this,a=t.fragmentStart,s=n.lowLatencyMode&&!!t.partList,o=null;if(t.live){let i=n.initialLiveManifestSize;if(r<i)return this.warn("Not enough fragments to start playback (have: ".concat(r,", need: ").concat(i,")")),null;if(this.startFragRequested||!s||this.loadingParts||(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),!t.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||e<a){var l;let i,r;o=this.getInitialLiveFragment(t);let n=this.config.startPosition,s=this.hls.startPosition,d=this.hls.liveSyncPosition,u=(null==(l=o)?void 0:l.start)||0;if(-1!==s&&s>=a?(i=s,r=s===n?"config":"next load start"):d?(i=d,r="live edge"):(i=e,r="buffer pos"),i<u&&(i=u,r="live frag start"),i<a&&(i=a,r="playlist start"),this.startPosition!=i||this.nextLoadPosition!=i){let l=t.live&&!this.filterReplacedPrimary(o,t)?-1:i;this.log("Setting startPosition to ".concat(l," next load ").concat(i," ").concat(-1===s?"":"(from ".concat(n,") "),"based on ").concat(r,". live edge: ").concat(d," live frag start: ").concat(u," playlist start: ").concat(a," buffer pos: ").concat(e)),this.startPosition=l,this.nextLoadPosition=i}}}else e<=a&&(o=i[0]);if(!o){let i=this.loadingParts?t.partEnd:t.fragmentEnd;o=this.getFragmentAtPosition(e,i,t)}let d=this.filterReplacedPrimary(o,t);return!d&&o&&(d=rX(t,o.sn))&&(this.nextLoadPosition=d.start),d}isLoopLoading(e,t){if(this.nextLoadPosition<=t)return!1;let i=this.fragmentTracker.getState(e);return i===r2.OK||i===r2.PARTIAL&&(!!e.gap||!!(e.stats.retry>1))||!1}getNextFragmentLoopLoading(e,t,i,r,n){let a=null;if(e.gap&&(a=this.getNextFragment(this.nextLoadPosition,t))&&!a.gap&&i.nextStart){let e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,i.nextStart,r,0);if(null!==e&&i.len+e.len>=n){let e=a.sn;return this.loopSn!==e&&(this.log('buffer full after gaps in "'.concat(r,'" playlist starting at sn: ').concat(e)),this.loopSn=e),null}}return this.loopSn=void 0,a}get primaryPrefetch(){if(ac(this.config)){var e;if(null==(e=this.hls.interstitialsManager)||null==(e=e.playingItem)?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,t){if(!e)return e;if(ac(this.config)&&("type"in e?e:e.fragment).type!==t$.SUBTITLE){let i=this.hls.interstitialsManager,r=null==i?void 0:i.bufferingItem;if(r){let i=r.event;if(i){if(!i.appendInPlace&&(Math.abs(e.start-r.start)>1||0===r.start))return null}else if(e.end<=r.start&&(null==t?void 0:t.live)===!1||e.start>=r.end&&r.nextEvent&&(r.nextEvent.appendInPlace&&!r.nextEvent.hasPlayed||e.start-r.end>1))return null}if(ah(e,null==i?void 0:i.playerQueue,this.playhead))return null}return e}getNextPart(e,t,i){let r=-1,n=!1,a=!0;for(let s=0,o=e.length;s<o;s++){let o=e[s];if(a=a&&!o.independent,r>-1&&i<o.start)break;let l=o.loaded||o.gap;l?r=-1:(n||(o.independent||a)&&o.fragment===t)&&(r=s),n=l&&!o.gap}let s=e[r];return s&&s.fragment!==t&&this.log("Need buffer at ".concat(i," but next unloaded part starts at ").concat(s.start," (sn: ").concat(t.sn," -> ").concat(s.fragment.sn,")")),r}loadedEndOfParts(e,t){let i;for(let r=e.length;r--&&(i=e[r]).loaded;)if(t>i.start)return!0;return!1}getInitialLiveFragment(e){let t=e.fragments,i=this.fragPrevious,r=null;if(i){if(e.hasProgramDateTime&&(r=function(e,t,i){if(null===t||!Array.isArray(e)||!e.length||!tW(t)||t<(e[0].programDateTime||0)||t>=(e[e.length-1].endProgramDateTime||0))return null;for(let r=0;r<e.length;++r){let n=e[r];if(function(e,t,i){let r=1e3*Math.min(t,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>e}(t,i,n))return n}return null}(t,i.endProgramDateTime,this.config.maxFragLookUpTolerance))&&this.log("Live playlist, switching playlist, load frag with same PDT: ".concat(i.programDateTime)),!r){let n=i.sn+1;if(n>=e.startSN&&n<=e.endSN){let a=t[n-e.startSN];i.cc===a.cc&&(r=a,this.log("Live playlist, switching playlist, load frag with next SN: ".concat(r.sn)))}!r&&(r=rQ(e,i.cc,i.end))&&this.log("Live playlist, switching playlist, load frag with same CC: ".concat(r.sn))}}else{let t=this.hls.liveSyncPosition;null!==t&&(r=this.getFragmentAtPosition(t,this.bitrateTest?e.fragmentEnd:e.edge,e))}return r}getFragmentAtPosition(e,t,i){let r,{config:n}=this,{fragPrevious:a}=this,{fragments:s,endSN:o}=i,{fragmentHint:l}=i,{maxFragLookUpTolerance:d}=n,u=i.partList,h=!!(this.loadingParts&&null!=u&&u.length&&l);if(h&&!this.bitrateTest&&u[u.length-1].fragment.sn===l.sn&&(s=s.concat(l),o=l.sn),a&&this.fragmentTracker.getState(a)===r2.NOT_LOADED&&(a=null),e<t){var c;let i=e<this.lastCurrentTime||e>t-d||null!=(c=this.media)&&c.paused||!this.startFragRequested?0:d;r=rj(a,s,e,i)}else r=s[s.length-1];if(r){let e=r.sn-i.startSN,t=this.fragmentTracker.getState(r);
3if((t===r2.OK||t===r2.PARTIAL&&r.gap)&&(a=r),t3(r,a)&&(!h||u[0].fragment.sn>r.sn||!i.live)){let t=s[e+1];r=r.sn<o&&this.fragmentTracker.getState(t)!==r2.OK?t:null}}return r}alignPlaylists(e,t,i){let r=e.fragments.length;if(!r)return this.warn("No fragments in live playlist"),0;let n=e.fragmentStart,a=!t,s=e.alignedSliding&&tW(n);if(a||!s&&!n){aa(i,e,this);let n=e.fragmentStart;return this.log("Live playlist sliding: ".concat(n," start-sn: ").concat(t?t.startSN:"na","->").concat(e.startSN," fragments: ").concat(r)),n}return n}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,3*e.partTarget)}setStartPosition(e,t){let i=this.startPosition;i<t&&(i=-1);let r=this.timelineOffset;if(-1===i){let n=null!==this.startTimeOffset,a=n?this.startTimeOffset:e.startTimeOffset;if(null!==a&&tW(a))i=t+a,a<0&&(i+=e.edge),i=Math.min(Math.max(t,i),t+e.totalduration),this.log("Setting startPosition to ".concat(i," for start time offset ").concat(a," found in ").concat(n?"multivariant":"media"," playlist")),this.startPosition=i;else if(e.live){let e=this.hls.liveSyncPosition;i=e||t,this.log("Setting startPosition to -1 to start at ".concat(e?"live edge":"playlist start"," ").concat(i)),this.startPosition=-1}else this.log("setting startPosition to 0 by default"),this.startPosition=i=0;this.lastCurrentTime=i+r}this.nextLoadPosition=i+r}getLoadPosition(){var e;let{media:t}=this,i=0;return null!=(e=this.hls)&&e.hasEnoughToStart&&t&&!this.iframesOnly?i=t.currentTime:this.nextLoadPosition>=0&&(i=this.nextLoadPosition),i}get playhead(){var e,t;if(null!=(e=this.hls)&&e.hasEnoughToStart){let e=null==(t=this.media)?void 0:t.currentTime;return tW(e)?e:this.lastCurrentTime}return this.getLoadPosition()}get iframesOnly(){var e;if(this.playlistType!==t$.MAIN)return!1;let t=this.getLevelDetails();return t?t.iframesOnly:null==(e=this.levelLastLoaded)?void 0:e.iframes}handleFragLoadAborted(e,t){this.transmuxer&&e.type===this.playlistType&&t2(e)&&e.stats.aborted&&(this.log("Fragment ".concat(e.sn).concat(t?" part "+t.index:""," of ").concat(this.playlistLabel()," ").concat(e.level," was aborted")),this.resetFragmentLoading(e))}resetFragmentLoading(e){this.fragCurrent&&(this.fragContextChanged(e)||this.state===ad.FRAG_LOADING_WAITING_RETRY)||(this.state=ad.IDLE)}onFragmentOrKeyLoadError(e,t){var i,r;if(t.chunkMeta&&!t.frag){let e=this.getCurrentContext(t.chunkMeta);e&&(t.frag=e.frag)}let{frag:n,part:a}=t;if(!n||!this.levels||n.type!==e)return;if(this.fragContextChanged(n))return void this.warn("Frag load error must match current frag to retry ".concat(n.relurl," > ").concat(null==(i=this.fragCurrent)?void 0:i.relurl));let s=t.details===tj.FRAG_GAP;s&&this.fragmentTracker.addAsGap(n);let o=t.errorAction;if(!o){this.state=ad.ERROR;return}let{action:l,flags:d,retryCount:u=0,retryConfig:h}=o,c=!!h,m=c&&l===rZ.RetryRequest,f=c&&!o.resolved&&d&rJ.MoveAllAlternatesMatchingHost,p=this.hls.latestLevelDetails,g=null==p?void 0:p.live;if(!m&&f&&t2(n)&&g&&n.sn<p.endSN&&!ir(t))this.resetFragmentErrors(e),a?a.gap=!0:this.treatAsGap(n),o.resolved=!0;else if((m||f)&&u<h.maxNumRetry){let i=id(null==(r=t.response)?void 0:r.code),a=is(h,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+a,this.state=ad.FRAG_LOADING_WAITING_RETRY,o.resolved=!0,i){this.log("Waiting for connection (offline)"),this.retryDate=1/0,t.reason="offline";return}this.warn("Fragment ".concat(n.sn," of ").concat(e," ").concat(n.level," errored with ").concat(t.details,", retrying loading ").concat(u+1,"/").concat(h.maxNumRetry," in ").concat(a,"ms"))}else if(h){if(this.resetFragmentErrors(e),!(u<h.maxNumRetry))return void this.warn("".concat(t.details," reached or exceeded max retry (").concat(u,")"));s||l===rZ.RemoveAlternatePermanently||(o.resolved=!0)}else l===rZ.SendAlternateToPenaltyBox?this.state=ad.WAITING_LEVEL:this.state=ad.ERROR;this.tickImmediate()}checkRetryDate(){let e=self.performance.now(),t=this.retryDate,i=t===1/0;(!t||e>=t||i&&!id(0))&&(i&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=ad.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===ad.PARSING||this.state===ad.PARSED){let t=e.frag,i=e.parent,r=this.getFwdBufferInfo(this.mediaBuffer,i),n=r&&r.len>.5;n&&this.reduceMaxBufferLength(r.len,(null==t?void 0:t.duration)||10);let a=!n;return a?this.warn("Buffer full error while media.currentTime (".concat(this.playhead,") is not buffered, flush ").concat(i," buffer")):r.nextStart&&t&&r.nextStart>t.start&&this.flushMainBuffer(r.nextStart,1/0,i===t$.AUDIO?i:void 0),t&&(this.fragmentTracker.removeFragment(t),this.nextLoadPosition=t.start),this.resetLoadingState(),a}return!1}resetFragmentErrors(e){e===t$.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==ad.STOPPED&&(this.state=ad.IDLE)}afterBufferFlushed(e,t){if(!e)return;let i=nh.getBuffered(e);this.fragmentTracker.detectEvictedFragments(t,i,this.playlistType),this.state===ad.ENDED&&this.resetLoadingState()}
3resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==ad.STOPPED&&(this.state=ad.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;let e=this.getLevelDetails();null!=e&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log("Loading context changed while buffering sn ".concat(e.sn," of ").concat(this.playlistLabel()," ").concat(-1===e.level?"<removed>":e.level,". This chunk will not be buffered.")),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,t,i,r){let n=i.details;if(!n)return void this.warn("level.details undefined");if(this.log("update level timing ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.fragInfo(e,!1,t))),!Object.keys(e.elementaryStreams).reduce((t,a)=>{let s=e.elementaryStreams[a];if(s){let o=s.endPTS-s.startPTS;if(o<=0)return this.warn("Could not parse fragment ".concat(e.sn," ").concat(a," duration reliably (").concat(o,")")),t||!1;let l=r.partial?0:n3(n,e,s.startPTS,s.endPTS,s.startDTS,s.endDTS,this.iframesOnly,this);return this.hls.trigger(tz.LEVEL_PTS_UPDATED,{details:n,level:i,drift:l,type:a,frag:e,start:s.startPTS,end:s.endPTS}),!0}return t},!1)){var a,s,o,l;let r=(null==(a=this.transmuxer)?void 0:a.error)===null,n=(null==(s=this.transmuxer)?void 0:s.error)!=null,d=(null!=(o=null==(l=this.levels)?void 0:l.length)?o:0)>1;if((0===i.fragmentError||r&&(i.fragmentError<2||e.endList)||n&&d)&&this.treatAsGap(e,i),r){let r=Error("Found no media in ".concat(this.playlistLabel()," ").concat(e.level," ").concat(t?"part: ".concat(t.index," of "):"","sn: ").concat(e.sn," at playlist time: ").concat(e.start,". Resetting transmuxer to fallback to playlist timing"));if(this.warn(r.message),this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,fatal:!1,error:r,frag:e,reason:"Found no media in msn ".concat(e.sn," of ").concat(this.playlistLabel(),' "').concat(i.url,'"')}),!this.hls)return;this.resetTransmuxer()}}this.state=ad.PARSED,this.log("Parsed ".concat(e.type," sn: ").concat(e.sn).concat(t?" part: "+t.index:""," of ").concat(this.fragInfo(e,!1,t))),this.hls.trigger(tz.FRAG_PARSED,{frag:e,part:t,chunkMeta:r})}playlistLabel(){return"".concat(this.playlistType," playlist")}fragInfo(e){var t,i;let r=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=arguments.length>2?arguments[2]:void 0;return"".concat(this.playlistLabel()," ").concat(e.level," (").concat(n?"part":"frag",":[").concat(null!=(t=r&&!n?e.startPTS:(n||e).start)?t:NaN,"-").concat(null!=(i=r&&!n?e.endPTS:(n||e).end)?i:NaN,"]").concat(n&&"main"===e.type?"INDEPENDENT="+(n.independent?"YES":"NO"):"",")")}treatAsGap(e,t){t&&t.fragmentError++,this.fragmentTracker.addAsGap(e)}resetTransmuxer(){var e;null==(e=this.transmuxer)||e.reset()}isFragmentNearlyDownloaded(e){var t;let i=null==(t=e.loader)?void 0:t.stats;if(!i)return!1;let r=i.loading.first>0,n=(i.total-i.loaded)/(this.hls.bandwidthEstimate||this.hls.config.abrEwmaDefaultEstimate);return r&&n<=.15}recoverWorkerError(e){"demuxerWorker"===e.event&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){let t=this._state;t!==e&&(this._state=e,this.log("".concat(t,"->").concat(e)))}get state(){return this._state}calculateOptimalSwitchPoint(e,t){let i=0,{hls:r,media:n,config:a,levels:s,playlistType:o}=this,l=this.getLevelDetails();if(n&&!n.paused&&s){var d;let t=o===t$.AUDIO?rR(e.audioCodec,128e3):e.maxBitrate,n=1+r.ttfbEstimate/1e3,s=r.bandwidthEstimate*a.abrBandWidthUpFactor;i=n+t*(l&&(this.loadingParts?l.partTarget:l.averagetargetduration)||(null==(d=this.fragCurrent)?void 0:d.duration)||6)/s,e.details||(i+=n)}let u=this.playhead,h=!(null!=l&&l.live)||t.end-u>1.5*i;return{fetchdelay:i,okToFlushForwardBuffer:h}}scheduleTrackSwitch(e,t,i){let{media:r,playlistType:n}=this;if(!r||!e)return;let a=i?this.getBufferedFrag(this.playhead+t):null;if(a){let e=this.followingBufferedFrag(a);if(e){var s;this.abortCurrentFrag();let t=e.maxStartPTS?e.maxStartPTS:e.start,i=e.duration,r=Math.max(a.end,t+Math.min(Math.max(i-this.config.maxFragLookUpTolerance,i*(this.couldBacktrack?.5:.125)),i*(this.couldBacktrack?.75:.25)));if(((null==(s=this.getLevelDetails())?void 0:s.fragmentStart)||0)>r)return;let o=n===t$.MAIN?null:"audio";this.flushMainBuffer(r,1/0,o),this.cleanupBackBuffer()}}}cleanupBackBuffer(){let{media:e,playlistType:t}=this;if(!e)return;let i=this.getAppendedFrag(this.playhead);if(i&&i.start>1){let e=t===t$.AUDIO;this.flushMainBuffer(0,i.start-!e,e?"audio":null)}}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,this.playlistType)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}abortCurrentFrag(){let e=this.fragCurrent;switch(this.fragCurrent=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case ad.KEY_LOADING:case ad.FRAG_LOADING:case ad.FRAG_LOADING_WAITING_RETRY:case ad.PARSING:case ad.PARSED:this.state=ad.IDLE}this.nextLoadPosition=this.playhead}checkFragPlaying(){let e=this.media,t=null;if(e&&e.readyState>1&&!1===e.seeking){let i=e.currentTime;if(nh.isBuffered(e,i)?t=this.getAppendedFrag(i):nh.isBuffered(e,i+.
31)&&(t=this.getAppendedFrag(i+.1)),t&&(this.backtrackFragment=void 0,!t3(t,this.fragPlaying)))return this.fragPlaying=t,!0}return!1}getBufferOutput(){return null}nextLevelSwitch(){let{levels:e,media:t,hls:i,config:r,playlistType:n}=this;if(null!=t&&t.readyState&&e&&i&&r){let t=this.getBufferOutput(),r=this.getFwdBufferInfo(t,n);if(!r)return;let a=e[n===t$.AUDIO?i.nextAudioTrack:i.nextLoadLevel],{fetchdelay:s,okToFlushForwardBuffer:o}=this.calculateOptimalSwitchPoint(a,r);this.scheduleTrackSwitch(r,s,o)}this.tickImmediate()}constructor(e,t,i,r,n){super(r,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragPlaying=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=ad.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=-1,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.initFragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{let{config:e,fragCurrent:t,media:i,mediaBuffer:r,state:n}=this,a=i?i.currentTime:0,s=nh.bufferInfo(r||i,a,e.maxBufferHole),o=s.len;if(this.log("Media seeking to ".concat(a,", state: ").concat(n,", ").concat(o?"in":"out of"," buffer")),this.state===ad.ENDED)this.resetLoadingState();else if(t){let i=e.maxFragLookUpTolerance,r=t.start-i,n=t.start+t.duration+i;if(!o||n<s.start||r>s.end){let e=a<r,i=a>n;(e||i)&&(t.loader&&(i||!this.isFragmentNearlyDownloaded(t))?(this.log("Cancelling fragment load for seek (sn: ".concat(t.sn,") - ").concat(e?"backward":"forward"," seek")),t.abortRequests(),this.resetLoadingState()):this.fragPrevious=null)}}if(i&&(this.fragmentTracker.removeFragmentsInRange(a,1/0,this.playlistType,!0),a>this.lastCurrentTime&&(this.lastCurrentTime=a),!this.loadingParts)){let e=Math.max(s.end,a),t=this.shouldLoadParts(this.getLevelDetails(),e);t&&(this.log("LL-Part loading ON after seeking to ".concat(a," with buffer @").concat(e)),this.loadingParts=t)}let l=!nh.isBuffered(i,a);(!this.hls.hasEnoughToStart||l)&&(this.log("Setting ".concat(l?"startPosition":"nextLoadPosition"," to ").concat(a," for seek without enough to start")),this.nextLoadPosition=a,l&&(this.startPosition=a)),o<1&&this.state===ad.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=n,this.hls=e,this.fragmentLoader=new ni(e.config),this.initFragmentLoader=new ni(e.config),this.keyLoader=i,this.fragmentTracker=t,this.config=e.config,this.decrypter=new nt(e.config)}}function ah(e,t,i){if(t)for(let r=t.length;r--;){let n=t[r].interstitial,a=n.startTime,s=Math.min(a+n.duration,n.resumeTime);if(n.appendInPlace&&(e.start>=a&&e.end<=s||i>e.start&&e.end>a&&e.start<s))return!0}return!1}function ac(e){return!!e.interstitialsController&&!1!==e.enableInterstitialPlayback}class am{push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){let e,{chunks:t,dataLength:i}=this;return t.length?(e=1===t.length?t[0]:function(e,t){let i=new Uint8Array(t),r=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,r),r+=n.length}return i}(t,i),this.reset(),e):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}constructor(){this.chunks=[],this.dataLength=0}}var af={exports:{}},ap=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}((d3||(d3=1,!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function a(e,t,r,a,s){if("function"!=typeof r)throw TypeError("The listener must be a function");var o=new n(r,a||e,s),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(i=!1)),o.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,a=r.length,s=Array(a);n<a;n++)s[n]=r[n].fn;return s},o.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,n,a,s){var o=i?i+e:e;if(!this._events[o])return!1;var l,d,u=this._events[o],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,n),!0;case 5:return u.fn.call(u.context,t,r,n,a),!0;case 6:return u.fn.call(u.context,t,r,n,a,s),!0}for(d=1,l=Array(h-1);d<h;d++)l[d-1]=arguments[d];u.fn.apply(u.context,l)}else{var c,m=u.length;for(d=0;d<m;d++)switch(u[d].once&&this.removeListener(e,u[d].fn,void 0,!0),h){case 1:u[d].fn.call(u[d].context);break;case 2:u[d].fn.call(u[d].context,t);break;case 3:u[d].fn.call(u[d].context,t,r);break;case 4:u[d].fn.call(u[d].context,t,r,n);break;default:if(!l)for(c=1,l=Array(h-1);c<h;c++)l[c-1]=arguments[c];u[d].fn.apply(u[d].context,l)}}return!0},o.prototype.on=function(e,t,i){return a(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return a(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,r,n){var a=i?i+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn!==t||n&&!o.once||r&&o.context!==r||s(this,a);else{for(var l=0,d=[],u=o.length;l<u;l++)(o[l].fn!==t||n&&!o[l].once||r&&o[l].context!==r)&&d.push(o[l]);d.length?this._events[a]=1===d.length?d[0]:d:s(this,a)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&s(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,e.exports=o}(af)),af.exports));let ag="1.7.3",av={};function aE(e,t){return 255===e[t]&&(246&e[t+1])==240}function ay(e,t){return 1&e[t+1]?7:9}function ab(e,t){return(3&e[t+3])<<11|e[t+4]<<3|(224&e[t+5])>>>5}function aT(e,t){return t+1<e.length&&aE(e,t)}function a_(e,t,i,r,n){if(!e.samplerate){let a=function(e,t,i,r){let n,a=t[i+2],s=a>>2&15;if(s>12){let t=Error("invalid ADTS sampling index:".concat(s));e.emit(tz.ERROR,tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,fatal:!0,error:t,reason:t.message});return}let o=(a>>6&3)+1,l=t[i+3]>>6&3|(1&a)<<2,d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350][s],u=s;(5===o||29===o)&&(u-=3);let h=(14&u)>>1,c=(1&u)<<7|l<<3,m=0;if(1===o&&s>=6){let e=s-3;n=[(m=5)<<3|h,c|(14&e)>>1,(1&e)<<7|8,0]}else n=[o<<3|h,c];let f="mp4a.40."+(m||o);return iy.log("manifest codec:".concat(r,", parsed codec:").concat(f,", channels:").concat(l,", rate:").concat(d," (ADTS object type:").concat(o," sampling index:").concat(s," esds config:[").concat(n.join(","),"])")),{config:n,samplerate:d,channelCount:l,codec:f,parsedCodec:f,manifestCodec:r}}(t,i,r,n);a&&t6(e,a)}}function aA(e,t,i,r,n){let a,s=r+n*(9216e4/e.samplerate),o=function(e,t){let i=ay(e,t);if(t+i<=e.length){let r=ab(e,t)-i;if(r>0)return{headerLength:i,frameLength:r}}}(t,i);if(o){let{frameLength:r,headerLength:n}=o,l=n+r,d=Math.max(0,i+l-t.length);d?(a=new Uint8Array(l-n)).set(t.subarray(i+n,t.length),0):a=t.subarray(i+n,i+l);let u={unit:a,pts:s};return d||e.samples.push(u),{sample:u,length:l,missing:d}}let l=t.length-i;return(a=new Uint8Array(l)).set(t.subarray(i,t.length),0),{sample:{unit:a,pts:s},length:l,missing:-1}}let aS=function(e){return e.audioId3="org.id3",e.dateRange="com.apple.quicktime.HLS",e.emsg="https://aomedia.org/emsg/ID3",e.misbklv="urn:misb:KLV:bin:1910.1",e}({});function aR(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:9e4;return{type:e,id:-1,pid:-1,inputTimeScale:t,sequenceNumber:-1,samples:[],dropped:0}}class ak{resetInitSegment(e,t,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,t){return!1}appendFrame(e,t,i){}demux(e,t){let i;this.cachedData&&(e=i8(this.cachedData,e),this.cachedData=null);let r=iw(e,0),n=r?r.length:0,a=this._audioTrack,s=this._id3Track,o=r?ix(r):void 0,l=e.length;
3for((null===this.basePTS||0===this.frameIndex&&tW(o))&&(this.basePTS=aI(o,t,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),r&&r.length>0&&s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:aS.audioId3,duration:1/0});n<l;){if(this.canParse(e,n)){let t=this.appendFrame(a,e,n);t?(this.frameIndex++,this.lastPTS=t.sample.pts,n+=t.length,i=n):n=l}else{var d,u;iI(d=e,u=n)&&iL(d,u+6)+10<=d.length-u?(r=iw(e,n),s.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:aS.audioId3,duration:1/0}),n+=r.length,i=n):n++}if(n===l&&i!==l){let t=e.slice(i);this.cachedData?this.cachedData=i8(this.cachedData,t):this.cachedData=t}}return{audioTrack:a,videoTrack:aR(),id3Track:s,textTrack:aR()}}demuxSampleAes(e,t,i){return Promise.reject(Error("[".concat(this,"] This demuxer does not support Sample-AES decryption")))}flush(e){let t=this.cachedData;return t&&(this.cachedData=null,this.demux(t,0)),{audioTrack:this._audioTrack,videoTrack:aR(),id3Track:this._id3Track,textTrack:aR()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}}let aI=(e,t,i)=>tW(e)?90*e:9e4*t+(i?9e4*i.baseTime/i.timescale:0),aL=[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],aD=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],aw=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],aC=[0,1,1,4];function aM(e,t,i,r,n){if(i+24>t.length)return;let a=aP(t,i);if(a&&i+a.frameLength<=t.length){let s=r+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:t.subarray(i,i+a.frameLength),pts:s,dts:s};return e.config=[],e.channelCount=a.channelCount,e.samplerate=a.sampleRate,e.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}function aP(e,t){let i=e[t+1]>>3&3,r=e[t+1]>>1&3,n=e[t+2]>>4&15,a=e[t+2]>>2&3;if(1!==i&&0!==n&&15!==n&&3!==a){let s=e[t+2]>>1&1,o=e[t+3]>>6,l=1e3*aL[14*(3===i?3-r:3===r?3:4)+n-1],d=aD[3*(3===i?0:2===i?1:2)+a],u=aw[i][r],h=aC[r],c=Math.floor(u*l/d+s)*h,m=ra();return m&&m<=87&&2===r&&l>=224e3&&0===o&&(e[t+3]=128|e[t+3]),{sampleRate:d,channelCount:3===o?1:2,frameLength:c,samplesPerFrame:8*u*h}}}function aO(e,t){return 255===e[t]&&(224&e[t+1])==224&&(6&e[t+1])!=0}function ax(e,t){return t+1<e.length&&aO(e,t)}function aN(e,t){if(t+1<e.length&&aO(e,t)){let i=aP(e,t),r=4;null!=i&&i.frameLength&&(r=i.frameLength);let n=t+r;
3return n===e.length||ax(e,n)}return!1}class aU{decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,r6.cbc,{start:0,end:e.byteLength})}decryptAacSample(e,t,i){let r=e[t].unit;if(r.length<=16)return;let n=r.subarray(16,r.length-r.length%16),a=n.buffer.slice(n.byteOffset,n.byteOffset+n.length);this.decryptBuffer(a).then(n=>{let a=new Uint8Array(n);r.set(a,16),this.decrypter.isSync()||this.decryptAacSamples(e,t+1,i)}).catch(i)}decryptAacSamples(e,t,i){for(;;t++){if(t>=e.length)return void i();if(!(e[t].unit.length<32)&&(this.decryptAacSample(e,t,i),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){let t=new Int8Array(16*Math.floor((e.length-48)/160)+16),i=0;for(let r=32;r<e.length-16;r+=160,i+=16)t.set(e.subarray(r,r+16),i);return t}getAvcDecryptedUnit(e,t){let i=new Uint8Array(t),r=0;for(let t=32;t<e.length-16;t+=160,r+=16)e.set(i.subarray(r,r+16),t);return e}decryptAvcSample(e,t,i,r,n){let a=re(n.data),s=this.getAvcEncryptedData(a);this.decryptBuffer(s.buffer).then(s=>{n.data=this.getAvcDecryptedUnit(a,s),this.decrypter.isSync()||this.decryptAvcSamples(e,t,i+1,r)}).catch(r)}decryptAvcSamples(e,t,i,r){if(e instanceof Uint8Array)throw Error("Cannot decrypt samples of type Uint8Array");for(;;t++,i=0){if(t>=e.length)return void r();let n=e[t].units;for(;!(i>=n.length);i++){let a=n[i];if(!(a.data.length<=48)&&(1===a.type||5===a.type)&&(this.decryptAvcSample(e,t,i,r,a),!this.decrypter.isSync()))return}}}constructor(e,t,i){this.keyData=void 0,this.decrypter=void 0,this.keyData=i,this.decrypter=new nt(t,!0)}}let aF=(e,t)=>{let i=0,r=5;t+=5;let n=new Uint32Array(1),a=new Uint32Array(1),s=new Uint8Array(1);for(;r>0;){s[0]=e[t];let o=Math.min(r,8),l=8-o;a[0]=0xff000000>>>24+l<<l,n[0]=(s[0]&a[0])>>l,i=i?i<<o|n[0]:n[0],t+=1,r-=o}return i};function aB(e,t,i,r,n){if(i+8>t.length||11!==t[i]||119!==t[i+1])return -1;let a=t[i+4]>>6;if(a>=3)return -1;let s=[48e3,44100,32e3][a],o=63&t[i+4],l=2*[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][3*o+a];if(i+l>t.length)return -1;let d=t[i+6]>>5,u=0;2===d?u+=2:(1&d&&1!==d&&(u+=2),4&d&&(u+=2));let h=(t[i+6]<<8|t[i+7])>>12-u&1,c=[2,1,2,3,3,4,4,5][d]+h,m=t[i+5]>>3,f=7&t[i+5],p=new Uint8Array([a<<6|m<<1|f>>2,(3&f)<<6|d<<3|h<<2|o>>4,o<<4&224]),g=t.subarray(i,i+l);return e.config=p,e.channelCount=c,e.samplerate=s,e.samples.push({unit:g,pts:r+1536/s*9e4*n}),l}let aG=/\/emsg[-/]ID3/i;function aH(e,t){return tW(e.presentationTime)?e.presentationTime/e.timeScale:t+e.presentationTimeDelta/e.timeScale}class aK{createVideoSample(e,t,i){return{key:e,frame:!1,pts:t,dts:i,units:[],length:0}}getLastNalUnit(e){var t;let i,r=this.VideoSample;if(r&&0!==r.units.length||(r=e[e.length-1]),null!=(t=r)&&t.units){let e=r.units;i=e[e.length-1]}return i}pushAccessUnit(e,t){if(e.units.length&&e.frame){if(void 0===e.pts){let i=t.samples,r=i.length;if(!r)return void t.dropped++;{let t=i[r-1];e.pts=t.pts,e.dts=t.dts}}t.samples.push(e)}}parseNALu(e,t,i){let r=t.byteLength;if(0===r)return[];let n=e.naluState||0,a=-1===n?0:n,s=[],o=0,l=0,d=-1,u=0;for(-1===n&&(d=0,u=this.getNALuType(t,0),l=1);l<r;){let i=t.indexOf(1,l);if(-1===i)break;l=i+1;let n=i;for(;n>0&&0===t[n-1];)n--;if(!(i-n+(0===n?a:0)<2)){if(d>=0)s.push({data:t.subarray(d,n),type:u});else{let i=this.getLastNalUnit(e.samples);i&&(n>0?i.data=i8(i.data,t.subarray(0,n)):a>0&&(i.data=i.data.subarray(0,i.data.byteLength-a)),i.state=0)}if(l<r)d=l,u=this.getNALuType(t,l);else{o=-1,d=-1;break}}}if(-1!==o){let e=r;for(;e>0&&0===t[e-1];)e--;o=r-e+(0===e?a:0)}if(d>=0)s.push({data:t.subarray(d),type:u,state:o});else if(0===s.length&&-1!==o){let i=this.getLastNalUnit(e.samples);i&&(i.data=i8(i.data,t),i.state=o)}return e.naluState=o,s}constructor(){this.VideoSample=null}}class aW{loadWord(){let e=this.data,t=this.bytesAvailable,i=e.byteLength-t,r=new Uint8Array(4),n=Math.min(4,t);if(0===n)throw Error("no bytes available");r.set(e.subarray(i,i+n)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n}skipBits(e){let t;e=Math.min(e,8*this.bytesAvailable+this.bitsAvailable),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),i=this.word>>>32-t;if(e>32&&iy.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 Error("no bits available");return(t=e-t)>0&&this.bitsAvailable?i<<t|this.readBits(t):i}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if((this.word&0x80000000>>>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(){let e=this.skipLZ();return this.readBits(e+1)-1}readEG(){let e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}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}}class aV extends aK{parsePES(e,t,i,r,n){let a,s=n.iframe,o=this.parseNALu(e,i.data,r),l=this.VideoSample,d=!1;i.data=null,l&&o.length&&!e.audFound&&(this.pushAccessUnit(l,e),l=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts)),o.forEach(r=>{var n,o,u,h,c;switch(r.type){case 1:{if(s)break;let t=!1;a=!0;let n=r.data;if(d&&n.length>4){let e=this.readSliceType(n);(2===e||4===e||7===e||9===e)&&(t=!0)}t&&null!=(u=l)&&u.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),l.frame=!0,l.key=t;break}case 5:a=!0,null!=(n=l)&&n.frame&&!l.key&&(this.pushAccessUnit(l,e),l=this.VideoSample=null),l||(l=this.VideoSample=this.createVideoSample(!0,i.pts,i.dts)),l.key=!0,l.frame=!0;break;case 6:if(s)break;a=!0,i7(r.data,1,i.pts,t.samples);break;case 7:{a=!0,d=!0;let t=r.data,i=this.readSPS(t);if(!e.sps||e.width!==i.width||e.height!==i.height||(null==(h=e.pixelRatio)?void 0:h[0])!==i.pixelRatio[0]||(null==(c=e.pixelRatio)?void 0:c[1])!==i.pixelRatio[1]){e.width=i.width,e.height=i.height,e.pixelRatio=i.pixelRatio,e.sps=[t];let r=t.subarray(1,4),n="avc1.";for(let e=0;e<3;e++){let t=r[e].toString(16);t.length<2&&(t="0"+t),n+=t}e.codec=n}break}case 8:a=!0,e.pps=[r.data];break;case 9:a=!0,e.audFound=!0,null!=(o=l)&&o.frame&&(this.pushAccessUnit(l,e),l=null),l||(l=this.VideoSample=this.createVideoSample(!1,i.pts,i.dts));break;case 12:a=!0;break;default:a=!1}l&&a&&l.units.push(r)}),r&&l&&(this.pushAccessUnit(l,e),this.VideoSample=null)}
3getNALuType(e,t){return 31&e[t]}readSliceType(e){let t=new aW(e);return t.readUByte(),t.readUEG(),t.readUEG()}skipScalingList(e,t){let i=8,r=8;for(let n=0;n<e;n++)0!==r&&(r=(i+t.readEG()+256)%256),i=0===r?i:r}readSPS(e){let t,i,r,n=new aW(e),a=0,s=0,o=0,l=0,d=n.readUByte.bind(n),u=n.readBits.bind(n),h=n.readUEG.bind(n),c=n.readBoolean.bind(n),m=n.skipBits.bind(n),f=n.skipEG.bind(n),p=n.skipUEG.bind(n),g=this.skipScalingList.bind(this);d();let v=d();if(u(5),m(3),d(),p(),100===v||110===v||122===v||244===v||44===v||83===v||86===v||118===v||128===v){let e=h();if(3===e&&m(1),p(),p(),m(1),c())for(r=0,i=3!==e?8:12;r<i;r++)c()&&g(r<6?16:64,n)}p();let E=h();if(0===E)h();else if(1===E)for(m(1),f(),f(),t=h(),r=0;r<t;r++)f();p(),m(1);let y=h(),b=h(),T=u(1);0===T&&m(1),m(1),c()&&(a=h(),s=h(),o=h(),l=h());let A=[1,1];if(c()&&c())switch(d()){case 1:A=[1,1];break;case 2:A=[12,11];break;case 3:A=[10,11];break;case 4:A=[16,11];break;case 5:A=[40,33];break;case 6:A=[24,11];break;case 7:A=[20,11];break;case 8:A=[32,11];break;case 9:A=[80,33];break;case 10:A=[18,11];break;case 11:A=[15,11];break;case 12:A=[64,33];break;case 13:A=[160,99];break;case 14:A=[4,3];break;case 15:A=[3,2];break;case 16:A=[2,1];break;case 255:A=[d()<<8|d(),d()<<8|d()]}return{width:Math.ceil((y+1)*16-2*a-2*s),height:(2-T)*(b+1)*16-(T?2:4)*(o+l),pixelRatio:A}}}class aq extends aK{parsePES(e,t,i,r){let n,a=this.parseNALu(e,i.data,r),s=this.VideoSample,o=!1;i.data=null;let l=e=>s=this.VideoSample=this.createVideoSample(e,i.pts,i.dts);a.forEach((r,a)=>{var d,u,h;switch(this.startsNewAccessUnit(s,e,r,a)&&(this.pushAccessUnit(s,e),s=l(r.type>=16&&r.type<=23),o=!1),r.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:s||(s=l(!1)),s.frame=!0,n=!0;break;case 16:case 17:case 18:case 21:case 22:case 23:n=!0,o&&null!=(h=s)&&h.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=l(!0)),s.key=!0,s.frame=!0;break;case 19:case 20:n=!0,null!=(d=s)&&d.frame&&!s.key&&(this.pushAccessUnit(s,e),s=this.VideoSample=null),s||(s=l(!0)),s.key=!0,s.frame=!0;break;case 39:n=!0,i7(r.data,2,i.pts,t.samples);break;case 32:n=!0,e.vps||("object"!=typeof e.params&&(e.params={}),e.params=t6(e.params,this.readVPS(r.data)),this.initVPS=r.data),e.vps=[r.data];break;case 33:if(n=!0,o=!0,void 0===e.vps||e.vps[0]===this.initVPS||void 0===e.sps||this.matchSPS(e.sps[0],r.data)||(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){let t=this.readSPS(r.data);for(let i in e.width=t.width,e.height=t.height,e.pixelRatio=t.pixelRatio,e.codec=t.codecString,e.sps=[],"object"!=typeof e.params&&(e.params={}),t.params)e.params[i]=t.params[i]}this.pushParameterSet(e.sps,r.data,e.vps),s||(s=l(!1));break;case 34:if(n=!0,"object"==typeof e.params){if(!e.pps){e.pps=[];let t=this.readPPS(r.data);for(let i in t)e.params[i]=t[i]}this.pushParameterSet(e.pps,r.data,e.vps)}break;case 35:n=!0,e.audFound=!0,null!=(u=s)&&u.frame&&(this.pushAccessUnit(s,e),s=null),s||(s=l(!1));break;default:n=!1}s&&n&&s.units.push(r)}),r&&s&&(this.pushAccessUnit(s,e),this.VideoSample=null)}pushParameterSet(e,t,i){(!i||i[0]!==this.initVPS)&&(i||e.length)||e.push(t)}startsNewAccessUnit(e,t,i,r){if(!e)return!1;if(!t.audFound&&0===r)return!0;if(!e.frame)return!1;let{type:n,data:a}=i;return n>=32&&n<=35||39===n||n>=41&&n<=44||n>=48&&n<=55||n<=31&&a.length>2&&(128&a[2])!=0}getNALuType(e,t){return(126&e[t])>>>1}ebsp2rbsp(e){let t=new Uint8Array(e.byteLength),i=0;for(let r=0;r<e.byteLength;r++)(!(r>=2)||3!==e[r]||0!==e[r-1]||0!==e[r-2])&&(t[i]=e[r],i++);return new Uint8Array(t.buffer,0,i)}pushAccessUnit(e,t){super.pushAccessUnit(e,t),this.initVPS&&(this.initVPS=null)}readVPS(e){let t=new aW(e);return t.readUByte(),t.readUByte(),t.readBits(4),t.skipBits(2),t.readBits(6),{numTemporalLayers:t.readBits(3)+1,temporalIdNested:t.readBoolean()}}readSPS(e){let t=new aW(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.readBits(4);let i=t.readBits(3);t.readBoolean();let r=t.readBits(2),n=t.readBoolean(),a=t.readBits(5),s=t.readUByte(),o=t.readUByte(),l=t.readUByte(),d=t.readUByte(),u=t.readUByte(),h=t.readUByte(),c=t.readUByte(),m=t.readUByte(),f=t.readUByte(),p=t.readUByte(),g=t.readUByte(),v=[],E=[];for(let e=0;e<i;e++)v.push(t.readBoolean()),E.push(t.readBoolean());if(i>0)for(let e=i;e<8;e++)t.readBits(2);for(let e=0;e<i;e++)v[e]&&(t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte(),t.readUByte()),E[e]&&t.readUByte();t.readUEG();let y=t.readUEG();3==y&&t.skipBits(1);let b=t.readUEG(),T=t.readUEG(),A=t.readBoolean(),S=0,R=0,k=0,I=0;A&&(S+=t.readUEG(),R+=t.readUEG(),k+=t.readUEG(),I+=t.readUEG());let L=t.readUEG(),D=t.readUEG(),w=t.readUEG(),C=t.readBoolean();for(let e=C?0:i;e<=i;e++)t.skipUEG(),t.skipUEG(),t.skipUEG();if(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG(),t.readBoolean()&&t.readBoolean())for(let e=0;e<4;e++)for(let i=0;i<(3===e?2:6);i++)if(t.readBoolean()){let i=Math.min(64,1<<4+(e<<1));e>1&&t.readEG();for(let e=0;e<i;e++)t.readEG()}else t.readUEG();t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.skipUEG(),t.skipUEG(),t.readBoolean());let M=t.readUEG(),P=0;for(let e=0;e<M;e++){let i=!1;if(0!==e&&(i=t.readBoolean()),i){e===M&&t.readUEG(),t.readBoolean(),t.readUEG();let i=0;for(let e=0;e<=P;e++){let e=t.readBoolean(),r=!1;e||(r=t.readBoolean()),(e||r)&&i++}P=i}else{let e=t.readUEG(),i=t.readUEG();P=e+i;for(let i=0;i<e;i++)t.readUEG(),t.readBoolean();for(let e=0;e<i;e++)t.readUEG(),t.readBoolean()}}if(t.readBoolean()){let e=t.readUEG();for(let i=0;i<e;i++){for(let e=0;e<w+4;e++)t.readBits(1);t.readBits(1)}}let O=0,x=1,N=1,U=!0,F=1,B=0;t.readBoolean(),t.readBoolean();if(t.readBoolean()){if(t.readBoolean()){let e=t.readUByte();e>0&&e<16?(x=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2][e-1],N=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1][e-1]):255===e&&(x=t.readBits(16),N=t.readBits(16))}if(t.readBoolean()&&t.readBoolean(),t.readBoolean()&&(t.readBits(3),t.readBoolean(),t.readBoolean()&&(t.readUByte(),t.readUByte(),t.readUByte())),t.readBoolean()&&(t.readUEG(),t.readUEG()),t.readBoolean(),t.readBoolean(),t.readBoolean(),t.readBoolean()&&(t.skipUEG(),t.skipUEG(),t.skipUEG(),t.skipUEG()),t.readBoolean()&&(F=t.readBits(32),B=t.readBits(32),t.readBoolean()&&t.readUEG(),t.readBoolean())){let e=t.readBoolean(),r=t.readBoolean(),n=!1;(e||r)&&((n=t.readBoolean())&&(t.readUByte(),t.readBits(5),t.readBoolean(),t.readBits(5)),t.readBits(4),t.readBits(4),n&&t.readBits(4),t.readBits(5),t.readBits(5),t.readBits(5));for(let a=0;a<=i;a++){let i=(U=t.readBoolean())||t.readBoolean(),a=!1;i?t.readEG():a=t.readBoolean();let s=a?1:t.readUEG()+1;if(e)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),n&&(t.readUEG(),t.readUEG()),t.skipBits(1);if(r)for(let e=0;e<s;e++)t.readUEG(),t.readUEG(),n&&(t.readUEG(),t.readUEG()),t.skipBits(1)}}t.readBoolean()&&(t.readBoolean(),t.readBoolean(),t.readBoolean(),O=t.readUEG())}let G=b,H=T;if(A){let e=1,t=1;1===y?e=t=2:2==y&&(e=2),G=b-e*R-e*S,H=T-t*I-t*k}let K=r?["A","B","C"][r]:"",W=s<<24|o<<16|l<<8|d,V=0;for(let e=0;e<32;e++)V=(V|(W>>e&1)<<31-e)>>>0;let q=V.toString(16);return 1===a&&"2"===q&&(q="6"),{codecString:"hvc1.".concat(K).concat(a,".").concat(q,".").concat(n?"H":"L").concat(g,".B0"),params:{general_tier_flag:n,general_profile_idc:a,general_profile_space:r,general_profile_compatibility_flags:[s,o,l,d],general_constraint_indicator_flags:[u,h,c,m,f,p],general_level_idc:g,bit_depth:L+8,bit_depth_luma_minus8:L,bit_depth_chroma_minus8:D,min_spatial_segmentation_idc:O,chroma_format_idc:y,frame_rate:{fixed:U,fps:B/F}},width:G,height:H,pixelRatio:[x,N]}}readPPS(e){let t=new aW(this.ebsp2rbsp(e));t.readUByte(),t.readUByte(),t.skipUEG(),t.skipUEG(),t.skipBits(2),t.skipBits(3),t.skipBits(2),t.skipUEG(),t.skipUEG(),t.skipEG(),t.skipBits(2),t.readBoolean()&&t.skipUEG(),t.skipEG(),t.skipEG(),t.skipBits(4);let i=t.readBoolean(),r=t.readBoolean(),n=1;return r&&i?n=0:r?n=3:i&&(n=2),{parallelismType:n}}matchSPS(e,t){return iB(e).substring(3)===iB(t).substring(3)}constructor(...e){super(...e),this.initVPS=null}}class aY{static probe(e,t){let i=aY.syncOffset(e);return i>
30&&t.warn("MPEG2-TS detected but first sync word found @ offset ".concat(i)),-1!==i}static syncOffset(e){let t=e.length,i=Math.min(940,t-188)+1,r=0;for(;r<i;){let n=!1,a=-1,s=0;for(let o=r;o<t;o+=188)if(71===e[o]&&(t-o==188||71===e[o+188])){if(s++,-1===a&&0!==(a=o)&&(i=Math.min(a+18612,e.length-188)+1),n||(n=0===aj(e,o)),n&&s>1&&(0===a&&s>2||o+188>i))return a}else if(s)return -1;else break;r++}return -1}static createTrack(e,t){return{container:"video"===e||"audio"===e?"video/mp2t":void 0,type:e,id:iH[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===e?t:void 0}}resetInitSegment(e,t,i,r,n,a){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=aY.createTrack("video"),this._videoTrack.duration=r,this.videoIntegrityChecker="skip"===this.config.handleMpegTsVideoIntegrityErrors?new aZ(this.logger):null,this._audioTrack=aY.createTrack("audio",r),this._id3Track=aY.createTrack("id3"),this._txtTrack=aY.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=t,this.videoCodec=i,e&&this.demux(e,0,a,(null==n?void 0:n.method)==="SAMPLE-AES")}resetTimeStamp(){}resetContiguity(){let{_audioTrack:e,_videoTrack:t,_id3Track:i}=this;e&&(e.pesData=null),t&&(t.pesData=null),i&&(i.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,t,i){let r,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];n||(this.sampleAes=null);let s=this._videoTrack,o=this.videoIntegrityChecker,l=this._audioTrack,d=this._id3Track,u=this._txtTrack,h=i.iframe,c=s.pid,m=s.pesData,f=l.pid,p=d.pid,g=this._klvPid,v=l.pesData,E=d.pesData,y=null,b=null,T=this.pmtParsed,A=this._pmtId,S=e.length;if(this.remainderData&&(S=(e=i8(this.remainderData,e)).length,this.remainderData=null),S<188&&!a)return this.remainderData=e,{audioTrack:l,videoTrack:s,id3Track:d,textTrack:u};let R=Math.max(0,aY.syncOffset(e));(S-=(S-R)%188)<e.byteLength&&!a&&(this.remainderData=new Uint8Array(e.buffer,S,e.buffer.byteLength-S));let k=0;for(let t=R;t<S;t+=188)if(71===e[t]){let a,S=!!(64&e[t+1]),k=aj(e,t);if((48&e[t+3])>>4>1){if((a=t+5+e[t+4])===t+188)continue}else a=t+4;switch(k){case c:S&&(m&&!(null!=o&&o.isCorrupted)&&(r=aX(m,this.logger))&&(this.readyVideoParser(s.segmentCodec),null!==this.videoParser&&this.videoParser.parsePES(s,u,r,!1,i)),m={data:[],size:0},null==o||o.reset(c)),null==o||o.handlePacket(e.subarray(t)),m&&(m.data.push(e.subarray(a,t+188)),m.size+=t+188-a);break;case f:if(h)break;if(S){if(v&&(r=aX(v,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,r,i);break;case"mp3":this.parseMPEGPES(l,r);break;case"ac3":this.parseAC3PES(l,r)}v={data:[],size:0}}v&&(v.data.push(e.subarray(a,t+188)),v.size+=t+188-a);break;case p:if(h)break;S&&(E&&(r=aX(E,this.logger))&&this.parseID3PES(d,r),E={data:[],size:0}),E&&(E.data.push(e.subarray(a,t+188)),E.size+=t+188-a);break;case g:if(h)break;S&&(y&&(r=aX(y,this.logger))&&this.parseKlvPES(d,r),y={data:[],size:0}),y&&(y.data.push(e.subarray(a,t+188)),y.size+=t+188-a);break;case 0:var I,L;S&&(a+=e[a]+1),A=this._pmtId=(31&(I=e)[(L=a)+10])<<8|I[L+11];break;case A:{S&&(a+=e[a]+1);let r=function(e,t,i,r,n,a,s,o){let l={audioPid:-1,videoPid:-1,id3Pid:-1,klvPid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},d=(15&e[t+1])<<8|e[t+2],u=t+3+d-4,h=(15&e[t+10])<<8|e[t+11];for(t+=12+h;t<u;){let d=aj(e,t),u=(15&e[t+3])<<8|e[t+4];switch(e[t]){case 207:if(!r){aQ("ADTS AAC",a);break}case 15:-1===l.audioPid&&(l.audioPid=d);break;case 21:-1===l.id3Pid&&(l.id3Pid=d);break;case 219:if(!r){aQ("H.264",a);break}case 27:-1===l.videoPid&&(l.videoPid=d);break;case 3:case 4:i.mpeg||i.mp3?-1===l.audioPid&&(l.audioPid=d,l.segmentAudioCodec="mp3"):a.log("MPEG audio found, not supported in this browser");break;case 193:if(!r){aQ("AC-3",a);break}case 129:i.ac3?-1===l.audioPid&&(l.audioPid=d,l.segmentAudioCodec="ac3"):a.log("AC-3 audio found, not supported in this browser");break;case 6:if(u>0){let r=t+5,n=u;for(;n>2;){switch(e[r]){case 106:-1===l.audioPid&&(!0!==i.ac3?a.log("AC-3 audio found, not supported in this browser for now"):(l.audioPid=d,l.segmentAudioCodec="ac3"));break;case 5:-1===l.klvPid&&s.enableEmsgKLVMetadata&&(l.klvPid=d,a.log("KLV metadata PID found: ".concat(d)))}let t=e[r+1]+2;r+=t,n-=t}}break;case 194:case 135:return az(n,Error("Unsupported EC-3 in M2TS found"),o,void 0,a),l;case 36:-1===l.videoPid&&(l.videoPid=d,l.segmentVideoCodec="hevc",a.log("HEVC in M2TS found"))}t+=u+5}return l}
3(e,a,this.typeSupported,n,this.observer,this.logger,this.config,i);(c=r.videoPid)>0&&(s.pid=c,s.segmentCodec=r.segmentVideoCodec),(f=r.audioPid)>0&&(l.pid=f,l.segmentCodec=r.segmentAudioCodec),(p=r.id3Pid)>0&&(d.pid=p),(g=r.klvPid)>0&&(this._klvPid=g),null===b||T||(this.logger.warn("MPEG-TS PMT found at ".concat(t," after unknown PID '").concat(b,"'. Backtracking to sync byte @").concat(R," to parse all TS packets.")),b=null,t=R-188),T=this.pmtParsed=!0;break}case 17:case 8191:break;default:b=k}}else k++;k>0&&az(this.observer,Error("Found ".concat(k," TS packet/s that do not start with 0x47")),i,void 0,this.logger),s.pesData=m,l.pesData=v,d.pesData=E;let D={audioTrack:l,videoTrack:s,id3Track:d,textTrack:u};return a&&this.extractRemainingSamples(D,i),D}flush(e,t){let i,{remainderData:r}=this;return(this.remainderData=null,i=r?this.demux(r,0,t,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(i,t),this.sampleAes)?this.decrypt(i,this.sampleAes):i}extractRemainingSamples(e,t){let i,{audioTrack:r,videoTrack:n,id3Track:a,textTrack:s}=e,o=n.pesData,l=r.pesData,d=a.pesData,u=this.videoIntegrityChecker;if(o&&!(null!=u&&u.isCorrupted)&&(i=aX(o,this.logger))?(this.readyVideoParser(n.segmentCodec),null!==this.videoParser&&(this.videoParser.parsePES(n,s,i,!0,t),n.pesData=null)):n.pesData=o,l&&(i=aX(l,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,i,t);break;case"mp3":this.parseMPEGPES(r,i);break;case"ac3":this.parseAC3PES(r,i)}r.pesData=null}else null!=l&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=l;d&&(i=aX(d,this.logger))?(this.parseID3PES(a,i),a.pesData=null):a.pesData=d}demuxSampleAes(e,t,i,r){let n=this.demux(e,i,r,!0,!this.config.progressive),a=this.sampleAes=new aU(this.observer,this.config,t);return this.decrypt(n,a)}readyVideoParser(e){null===this.videoParser&&("avc"===e?this.videoParser=new aV:"hevc"===e&&(this.videoParser=new aq))}decrypt(e,t){return new Promise(i=>{let{audioTrack:r,videoTrack:n}=e;r.samples&&"aac"===r.segmentCodec?t.decryptAacSamples(r.samples,0,()=>{n.samples?t.decryptAvcSamples(n.samples,0,0,()=>{i(e)}):i(e)}):n.samples&&t.decryptAvcSamples(n.samples,0,0,()=>{i(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0,this.videoIntegrityChecker=null}parseAACPES(e,t,i){let r,n,a,s,o=0,l=this.aacOverFlow,d=t.data;if(l){this.aacOverFlow=null;let t=l.missing,i=l.sample.unit.byteLength;-1===t?d=i8(l.sample.unit,d):(l.sample.unit.set(d.subarray(0,t),i-t),e.samples.push(l.sample),o=l.missing)}for(r=o,n=d.length;r<n-1&&!aT(d,r);r++);if(r!==o){let e,t=r<n-1;if(e=t?"AAC PES did not start with ADTS header,offset:".concat(r):"No ADTS header found in AAC PES",az(this.observer,Error(e),i,t,this.logger),!t)return}if(a_(e,this.observer,d,r,this.audioCodec),void 0!==t.pts)a=t.pts;else{if(!l)return void this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");let t=9216e4/e.samplerate;a=l.sample.pts+t}let u=0;for(;r<n;){if(s=aA(e,d,r,a,u),r+=s.length,s.missing){this.aacOverFlow=s;break}for(u++;r<n-1&&!aT(d,r);r++);}}parseMPEGPES(e,t){let i=t.data,r=i.length,n=0,a=0,s=t.pts;if(void 0===s)return void this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");for(;a<r;)if(ax(i,a)){let t=aM(e,i,a,s,n);if(t)a+=t.length,n++;else break}else a++}parseAC3PES(e,t){{let i,r=t.data,n=t.pts;if(void 0===n)return void this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");let a=r.length,s=0,o=0;for(;o<a&&(i=aB(e,r,o,n,s++))>0;)o+=i}}parseID3PES(e,t){if(void 0===t.pts)return void this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");let i=t6({},t,{type:this._videoTrack?aS.emsg:aS.audioId3,duration:1/0});e.samples.push(i)}parseKlvPES(e,t){var i,r;let n=null!=(i=t.pts)?i:t.dts;if(void 0===n)return void this.logger.warn("[tsdemuxer]: KLV PES unknown PTS and DTS");let a=t.data;if(a.length<16)return void this.logger.warn("[tsdemuxer]: KLV PES payload too short");let s=0;for(;s<a.length&&!(s+16>a.length);){let i=s;if((s+=16)>=a.length)break;let o=a[s];s+=1;let l=0;if(128&o){let e=127&o;if(0===e||e>4||s+e>a.length){this.logger.warn("[tsdemuxer]: Invalid KLV length encoding");break}for(let t=0;t<e;t++)l=l<<8|a[s+t];s+=e}else l=o;if(s+l>a.length){this.logger.warn("[tsdemuxer]: KLV value extends beyond PES payload");break}let d=s+l,u=a.subarray(i,d),h={data:u,len:u.byteLength,pts:n,dts:null!=(r=t.dts)?r:n,type:aS.misbklv,duration:1/0};e.samples.push(h),s=d}}constructor(e,t,i,r){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupp
3orted=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this._klvPid=-1,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.videoIntegrityChecker=null,this.observer=e,this.config=t,this.typeSupported=i,this.logger=r,this.videoParser=null}}function aj(e,t){return((31&e[t+1])<<8)+e[t+2]}function az(e,t,i,r,n){n.warn("parsing error: ".concat(t.message)),e.emit(tz.ERROR,tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,chunkMeta:i,error:t,reason:t.message})}function aQ(e,t){t.log("".concat(e," with AES-128-CBC encryption found in unencrypted stream"))}function aX(e,t){let i,r,n,a,s,o=0,l=e.data;if(!e||0===e.size)return null;for(;l[0].length<19&&l.length>1;)l[0]=i8(l[0],l[1]),l.splice(1,1);if(1===((i=l[0])[0]<<16)+(i[1]<<8)+i[2]){if((r=(i[4]<<8)+i[5])&&r>e.size-6)return null;let d=i[7];192&d&&(a=(14&i[9])*0x20000000+(255&i[10])*4194304+(254&i[11])*16384+(255&i[12])*128+(254&i[13])/2,64&d?a-(s=(14&i[14])*0x20000000+(255&i[15])*4194304+(254&i[16])*16384+(255&i[17])*128+(254&i[18])/2)>54e5&&(t.warn("".concat(Math.round((a-s)/9e4),"s delta between PTS and DTS, align them")),a=s):s=a);let u=(n=i[8])+9;if(e.size<=u)return null;e.size-=u;let h=new Uint8Array(e.size);for(let e=0,t=l.length;e<t;e++){let t=(i=l[e]).byteLength;if(u)if(u>t){u-=t;continue}else i=i.subarray(u),t-=u,u=0;h.set(i,o),o+=t}return r&&(r-=n+3),{data:h,pts:a,dts:s,len:r}}return null}class aZ{get isCorrupted(){return"ok"!==this.integrityState}reset(e){this.pid=e,this.lastContinuityCounter=-1,this.integrityState="ok"}handlePacket(e){if(e.byteLength<4)return;let t=aj(e,0);if(t!==this.pid)return void this.logger.debug("Packet PID mismatch, expected ".concat(this.pid," got ").concat(t));let i=(48&e[3])>>4;if(0===i)return;let r=15&e[3],n=this.lastContinuityCounter;if(this.lastContinuityCounter=r,(2&i)!=0&&0!=e[4]&&(128&e[5])!=0||n<0)return;let a=(1&i)!=0?n+1&15:n;if(r!==a){this.logger.warn("MPEG-TS Continuity Counter check failed for PID='".concat(t,"', CC=").concat(r,", Expected-CC=").concat(a," Last-CC=").concat(n)),this.integrityState="cc-failed";return}if((128&e[1])!=0){this.logger.warn("MPEG-TS Packet had TEI flag set for PID='".concat(t,"'")),this.integrityState="tei-bit";return}}constructor(e){this.logger=void 0,this.pid=0,this.lastContinuityCounter=-1,this.integrityState="ok",this.logger=e}}class aJ{static getSilentFrame(e,t){if("mp4a.40.2"===e){if(1===t)return new Uint8Array([0,200,0,128,35,128]);if(2===t)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);else if(4===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);else if(5===t)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);else if(6===t)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])}else{if(1===t)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(2===t)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(3===t)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])}}}let a$={video: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]),audio: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])},a0=new Uint8Array([0,0,0,0,0,0,0,0]),a1=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),a2=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),a3=new Uint8Array([0,0,0,0,0,0,0,0]),a4=new Uint8Array([0,0,0,0,0,0,0,1]),a5=new Uint8Array([105,115,111,109]),a8=new 
3Uint8Array([97,118,99,49]),a6=new Uint8Array([0,0,0,1]);class a9{static box(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];let n=8,a=i.length,s=a;for(;a--;)n+=i[a].byteLength;let o=new Uint8Array(n);for(ij(o,0,n),ij(o,4,e),a=0,n=8;a<s;a++)o.set(i[a],n),n+=i[a].byteLength;return o}static hdlr(e){return a9.box(iG.hdlr,a$[e])}static mdat(e){return a9.box(iG.mdat,e)}static mdhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000);return a9.box(iG.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,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}static mdia(e){return a9.box(iG.mdia,a9.mdhd(e.timescale||0,e.duration||0),a9.hdlr(e.type),a9.minf(e))}static mfhd(e){return a9.box(iG.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}static minf(e){return"audio"===e.type?a9.box(iG.minf,a9.box(iG.smhd,a3),a9.DINF,a9.stbl(e)):a9.box(iG.minf,a9.box(iG.vmhd,a2),a9.DINF,a9.stbl(e))}static moof(e,t,i){return a9.box(iG.moof,a9.mfhd(e),a9.traf(i,t))}static moov(e){let t=e.length,i=[];for(;t--;)i[t]=a9.trak(e[t]);return a9.box.apply(null,[iG.moov,a9.mvhd(e[0].timescale||0,e[0].duration||0)].concat(i).concat(a9.mvex(e)))}static mvex(e){let t=e.length,i=[];for(;t--;)i[t]=a9.trex(e[t]);return a9.box.apply(null,[iG.mvex,...i])}static mvhd(e,t){let i=Math.floor((t*=e)/0x100000000),r=Math.floor(t%0x100000000),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,255&e,i>>24,i>>16&255,i>>8&255,255&i,r>>24,r>>16&255,r>>8&255,255&r,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 a9.box(iG.mvhd,n)}static sdtp(e){let t,i,r=e.samples||[],n=new Uint8Array(4+r.length);for(t=0;t<r.length;t++)i=r[t].flags,n[t+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return a9.box(iG.sdtp,n)}static stbl(e){return a9.box(iG.stbl,a9.stsd(e),a9.box(iG.stts,a0),a9.box(iG.stsc,a0),a9.box(iG.stsz,a1),a9.box(iG.stco,a0))}static avc1(e){let t,i,r,n=[],a=[];for(t=0;t<e.sps.length;t++)r=(i=e.sps[t]).byteLength,n.push(r>>>8&255),n.push(255&r),n=n.concat(Array.prototype.slice.call(i));for(t=0;t<e.pps.length;t++)r=(i=e.pps[t]).byteLength,a.push(r>>>8&255),a.push(255&r),a=a.concat(Array.prototype.slice.call(i));let s=a9.box(iG.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(a))),o=e.width,l=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return a9.box(iG.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,o>>8&255,255&o,l>>8&255,255&l,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]),s,a9.box(iG.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),a9.box(iG.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,u>>24,u>>16&255,u>>8&255,255&u])))}static esds(e){let t=e.config,i=t.length;return new Uint8Array([0,0,0,0,3,23+i,0,1,0,4,15+i,64,21,0,0,0,0,0,0,0,0,0,0,0,5,i,...t,6,1,2])}static audioStsd(e){let t=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,t>>8&255,255&t,0,0])}static mp4a(e){return a9.box(iG.mp4a,a9.audioStsd(e),a9.box(iG.esds,a9.esds(e)))}static mp3(e){return a9.box(iG[".mp3"],a9.audioStsd(e))}static ac3(e){return a9.box(iG["ac-3"],a9.audioStsd(e),a9.box(iG.dac3,e.config))}static stsd(e){let{segmentCodec:t}=e;if("audio"===e.type){if("aac"===t)return a9.box(iG.stsd,a4,a9.mp4a(e));if("ac3"===t&&e.config)return a9.box(iG.stsd,a4,a9.ac3(e));if("mp3"===t&&"mp3"===e.codec)return a9.box(iG.stsd,a4,a9.mp3(e))}else if(e.pps&&e.sps){if("avc"===t)return a9.box(iG.stsd,a4,a9.avc1(e));if("hevc"===t&&e.vps)return a9.box(iG.stsd,a4,a9.hvc1(e))}else throw Error("video track missing pps or sps");throw Error("unsupported ".concat(e.type," segment codec (").concat(t,"/").concat(e.codec,")"))}static tkhd(e){let t=e.id,i=(e.duration||0)*(e.timescale||0),r=e.width||0,n=e.height||0,a=Math.floor(i/0x100000000),s=Math.floor(i%0x100000000);return a9.box(iG.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,255&t,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,s>>24,s>>16&255,s>>8&255,255&s,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,r>>8&255,255&r,0,0,n>>8&255,255&n,0,0]))}static traf(e,t){let i=a9.sdtp(e),r=e.id,n=Math.floor(t/0x100000000),a=Math.floor(t%0x100000000);return a9.box(iG.traf,a9.box(iG.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),a9.box(iG.tfdt,new Uint8Array([1,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a])),a9.trun(e,i.length+16+20+8+16+8+8),i)}static trak(e){return e.duration=e.duration||0xffffffff,a9.box(iG.trak,a9.tkhd(e),a9.mdia(e))}static trex(e){let t=e.id;return a9.box(iG.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,t){let i,r,n,a,s,o,l=e.samples||[],d=l.length,u=12+16*d,h=new Uint8Array(u);for(t+=8+u,h.set([+("video"===e.type),0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,t>>>24&255,t>>>16&255,t>>>8&255,255&t],0),i=0;i<d;i++)n=(r=l[i]).duration,a=r.size,s=r.flags,o=r.cts,h.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,o>>>24&255,o>>>16&255,o>>>8&255,255&o],12+16*i);return a9.box(iG.trun,h)}static initSegment(e){let t=a9.moov(e);return i8(a9.FTYP,t)}
3static hvc1(e){let t=e.params,i=[e.vps,e.sps,e.pps],r=new Uint8Array([1,t.general_profile_space<<6|32*!!t.general_tier_flag|t.general_profile_idc,t.general_profile_compatibility_flags[0],t.general_profile_compatibility_flags[1],t.general_profile_compatibility_flags[2],t.general_profile_compatibility_flags[3],t.general_constraint_indicator_flags[0],t.general_constraint_indicator_flags[1],t.general_constraint_indicator_flags[2],t.general_constraint_indicator_flags[3],t.general_constraint_indicator_flags[4],t.general_constraint_indicator_flags[5],t.general_level_idc,240|t.min_spatial_segmentation_idc>>8,255&t.min_spatial_segmentation_idc,252|t.parallelismType,252|t.chroma_format_idc,248|t.bit_depth_luma_minus8,248|t.bit_depth_chroma_minus8,0,parseInt(t.frame_rate.fps),3|t.temporal_id_nested<<2|t.num_temporal_layers<<3|64*!!t.frame_rate.fixed,i.length]),n=r.length;for(let e=0;e<i.length;e+=1){n+=3;for(let t=0;t<i[e].length;t+=1)n+=2+i[e][t].length}let a=new Uint8Array(n);a.set(r,0),n=r.length;let s=i.length-1;for(let e=0;e<i.length;e+=1){a.set(new Uint8Array([32+e|128*(e===s),0,i[e].length]),n),n+=3;for(let t=0;t<i[e].length;t+=1)a.set(new Uint8Array([i[e][t].length>>8,255&i[e][t].length]),n),n+=2,a.set(i[e][t],n),n+=i[e][t].length}let o=a9.box(iG.hvcC,a),l=e.width,d=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return a9.box(iG.hvc1,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,255&l,d>>8&255,255&d,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,a9.box(iG.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),a9.box(iG.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,h>>24,h>>16&255,h>>8&255,255&h])))}}function a7(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=e*t*i;return r?Math.round(n):n}function se(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return a7(e,1e3,11111111111111112e-21,t)}function st(e){let{baseTime:t,timescale:i,trackId:r}=e;return"".concat(t/i," (").concat(t,"/").concat(i,") trackId: ").concat(r)}function si(e,t,i,r){return{duration:t,size:i,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:e?2:1,isNonSync:+!e,paddingValue:0}}}a9.FTYP=a9.box(iG.ftyp,a5,a6,a5,a8),a9.DINF=a9.box(iG.dinf,a9.box(iG.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])));class sr extends im{destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){let t=this._initPTS;t&&e&&e.trackId===t.trackId&&e.baseTime===t.baseTime&&e.timescale===t.timescale||this.log("Reset initPTS: ".concat(t?st(t):t," > ").concat(e?st(e):e)),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let t=!1,i=e[0].pts,r=e.reduce((e,r)=>{let n=r.pts,a=n-e;return(a<-0x100000000&&(t=!0,a=(n=sn(n,i))-e),a>0)?e:n},i);return t&&this.debug("PTS rollover detected"),r}remux(e,t,i,r,n,a,s,o,l){let d,u,h,c,m,f,p=n,g=n,v=!l.iframe&&e.pid>-1,E=t.pid>-1,y=t.samples.length,b=e.samples.length>0,T=s&&y>0||y>1;if((!v||b)&&(!E||T)||this.ISGenerated||s){let i;if(this.ISGenerated){var A,S,R,k;let e=this.videoTrackConfig;(e&&(t.width!==e.width||t.height!==e.height||(null==(A=t.pixelRatio)?void 0:A[0])!==(null==(S=e.pixelRatio)?void 0:S[0])||(null==(R=t.pixelRatio)?void 0:R[1])!==(null==(k=e.pixelRatio)?void 0:k[1]))||!e&&T||null===this.nextAudioTs&&b)&&this.resetInitSegment()}this.ISGenerated||(h=this.generateIS(e,t,n,a));let r=this.isVideoContiguous,s=-1;if(T&&(s=function(e){for(let t=0;t<e.length;t++)if(e[t].key)return t;return -1}(t.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,s>0){this.warn("Dropped ".concat(s," out of ").concat(y," video samples due to a missing keyframe"));let e=this.getVideoStartPts(t.samples);t.samples=t.samples.slice(s),t.dropped+=s,g+=(t.samples[0].pts-e)/t.inputTimeScale,i=g}else -1===s&&(this.warn("No keyframe found out of ".concat(y," video samples")),f=!1);if(this.ISGenerated){if(b&&T&&n){let i=this.getVideoStartPts(t.samples),r=(sn(e.samples[0].pts,i)-i)/t.inputTimeScale;p+=Math.max(0,r),g+=Math.max(0,-r)}if(b){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),h=this.generateIS(e,t,n,a)),u=this.remuxAudio(e,p,this.isAudioContiguous,a,E||T||o===t$.AUDIO?g:void 0,l),T){let i=u?u.endPTS-u.startPTS:0;t.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),h=this.generateIS(e,t,n,a)),d=this.remuxVideo(t,g,r,i,l)}}else T&&(d=this.remuxVideo(t,g,r,0,l));d&&(d.firstKeyFrame=s,d.independent=-1!==s,d.firstKeyFramePTS=i)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(i.samples.length&&(m=sa(i,n,this._initPTS,this._initDTS)),r.samples.length&&(c=ss(r,n,this._initPTS))),{audio:u,video:d,initSegment:h,independent:f,text:c,id3:m}}computeInitPts(e,t,i,r){let n=Math.round(i*t),a=sn(e,n);if(a<n)for(this.log("Adjusting PTS for rollover in timeline near ".concat((n-a)/t," ").concat(r));a<n;)a+=0x200000000;return a-n}generateIS(e,t,i,r){let n,a,s,o=e.samples,l=t.samples,d=this.typeSupp
3orted,u={},h=this._initPTS,c=!h||r,m="audio/mp4",f=-1;if(c&&(n=a=1/0),e.config&&o.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":d.mpeg?(m="audio/mpeg",e.codec=""):d.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3"}if(u.audio={id:"audio",container:m,codec:e.codec,initSegment:"mp3"===e.segmentCodec&&d.mpeg?new Uint8Array(0):a9.initSegment([e]),metadata:{channelCount:e.channelCount}},c){f=e.id,s=e.inputTimeScale;let t=this.computeInitPts(o[0].pts,s,i,"audio");(!h||s!==h.timescale||0===i&&t<h.baseTime)&&(n=a=t)}}if(t.sps&&t.pps&&l.length){if(t.timescale=t.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:t.codec,initSegment:a9.initSegment([t]),metadata:{width:t.width,height:t.height}},c){f=t.id,s=t.inputTimeScale;let e=this.getVideoStartPts(l),r=sn(l[0].dts,e),o=this.computeInitPts(r,s,i,"video"),d=this.computeInitPts(e,s,i,"video");(!h||s!==h.timescale||tW(n)||0===i&&d<h.baseTime)&&(a=Math.min(a,o),n=Math.min(n,o))}this.videoTrackConfig={width:t.width,height:t.height,pixelRatio:t.pixelRatio}}if(Object.keys(u).length)return this.ISGenerated=!0,c&&tW(n)?(h&&this.warn("Timestamps at playlist time: ".concat(r?"":"~").concat(i," ").concat(n/s," != initPTS: ").concat(h.baseTime/h.timescale," (").concat(h.baseTime,"/").concat(h.timescale,") trackId: ").concat(h.trackId)),this.log("Found initPTS at playlist time: ".concat(i," offset: ").concat(n/s," (").concat(n,"/").concat(s,") trackId: ").concat(f)),this._initPTS={baseTime:n,timescale:s,trackId:f},this._initDTS={baseTime:a,timescale:s,trackId:f}):n=s=void 0,{tracks:u,initPTS:n,timescale:s,trackId:f}}remuxVideo(e,t,i,r,a){let s,o,l,d=e.inputTimeScale,u=e.samples,h=[],c=u.length,m=this._initPTS,f=m.baseTime*d/m.timescale,p=this.nextVideoTs,g=8,v=this.videoSampleDuration,E=1/0,y=-1/0,b=!1;if(!i||null===p){let e=f+t*d,r=u[0].pts-sn(u[0].dts,u[0].pts);ra()&&null!==p&&15e3>Math.abs(e-r-(p+f))?i=!0:p=e-r-f}let T=p+f;for(let e=0;e<c;e++){let t=u[e];t.pts=sn(t.pts,T),t.dts=sn(t.dts,T),t.dts<u[e>0?e-1:e].dts&&(b=!0)}b&&u.sort(function(e,t){let i=e.dts-t.dts,r=e.pts-t.pts;return i||r}),s=u[0].dts;let A=(o=u[u.length-1].dts)-s,S=A?Math.round(A/(c-1)):v||e.inputTimeScale/30;if(i){let i=s-T,r=i>S,n=i<-1;if((r||n)&&(r?this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(se(i,!0)," ms (").concat(i,"dts) hole between fragments detected at ").concat(t.toFixed(3))):this.warn("".concat((e.segmentCodec||"").toUpperCase(),": ").concat(se(-i,!0)," ms (").concat(i,"dts) overlapping between fragments detected at ").concat(t.toFixed(3))),!n||T>=u[0].pts||ra())){s=T;let e=u[0].pts-i;if(r)u[0].dts=s,u[0].pts=e;else{let t=!0;for(let r=0;r<u.length&&(!(u[r].dts>e)||!t);r++){let e=u[r].pts;if(u[r].dts-=i,u[r].pts-=i,r<u.length-1){let i=u[r+1].pts;t=i<=u[r].pts==i<=e}}}this.log("Video: Initial PTS/DTS adjusted: ".concat(se(e,!0),"/").concat(se(s,!0),", delta: ").concat(se(i,!0)," ms"))}}let R=0,k=0,I=s=Math.max(0,s);for(let e=0;e<c;e++){let t=u[e],i=t.units,r=i.length,n=0;for(let e=0;e<r;e++)n+=i[e].data.length;k+=n,R+=r,t.length=n,t.dts<I?(t.dts=I,I+=S/4|0||1):I=t.dts,E=Math.min(t.pts,E),y=Math.max(t.pts,y)}o=u[c-1].dts;let L=k+4*R+8;try{l=new Uint8Array(L)}catch(e){this.observer.emit(tz.ERROR,tz.ERROR,{type:tY.MUX_ERROR,details:tj.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:a,error:e,bytes:L,reason:"fail allocating video mdat ".concat(L)});return}ij(l,0,L),ij(l,4,iG.mdat);let D=!1,w=1/0,C=1/0,M=-1/0,P=-1/0;for(let e=0;e<c;e++){let t,n=u[e],s=n.units,o=0;for(let e=0,t=s.length;e<t;e++){let t=s[e],i=t.data,r=t.data.byteLength;ij(l,g,r),g+=4,l.set(i,g),g+=r,o+=4+r}if(e<c-1)v=u[e+1].dts-n.dts,t=u[e+1].pts-n.pts;else{let i=this.config,a=e>0?n.dts-u[e-1].dts:S;if(t=e>0?n.pts-u[e-1].pts:S,i.stretchShortVideoTrack&&null!==this.nextAudioTs){let e=Math.floor(i.maxBufferHole*d),t=(r?E+r*d:this.nextAudioTs+f)-n.pts;t>e?((v=t-a)<0?v=a:D=!0,this.log("It is approximately ".concat(t/90," ms to the next segment; using duration ").concat(v/90," ms for the last video frame."))):v=a}else v=a}let m=Math.round(n.pts-n.dts);if(w=Math.min(w,v),M=Math.max(M,v),C=Math.min(C,t),P=Math.max(P,t),!i&&0===e&&m>v){let e=Math.round(m/S)*S;e-m==1&&(this.log("pad first CTS ".concat(m," -> ").concat(e," of sn: ").concat(a.sn)),m=e)}h.push(si(n.key,v,o,m))}if(h.length){let e=ra();if(e){if(e<70){let e=h[0].flags;e.dependsOn=2,e.isNonSync=0}}else if(function(){if(void 0===n){let e=ri.match(/Safari\/(\d+)/i);n=e?parseInt(e[1]):0}return n}()&&P-C<M-w&&S/M<.025&&0===h[0].cts){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let e=s;for(let t=0,i=h.length;t<i;t++){let r=e+h[t].duration,n=e+h[t].cts;if(t<i-1){let e=r+h[t+1].cts;h[t].duration=e-n}else h[t].duration=t?h[t-1].duration:S;h[t].cts=0,e=r}}}let O=o+(v=D||!v?S:v);this.nextVideoTs=p=O-f,this.videoSampleDuration=v,this.isVideoContiguous=!0,a.iframe&&(1===h.length?(h[0].duration=v=a.duration*d,this.nextVideoTs=p=s+v-f):this.warn("Not adjusting IFrame duration (sample count ".concat(h.length,")")));let x={data1:a9.moof(a.sn,s,t6(e,{samples:h})),data2:l,startPTS:(E-f)/d,endPTS:(y+v-f)/d,startDTS:(s-f)/d,endDTS:p/d,type:"video",hasAudio:!1,hasVideo:!0,nb:h.length,dropped:e.dropped};return e.samples=[],e.dropped=0,x}
3getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(e,t,i,r,n,a){let s,o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,d=o/l,u=this.getSamplesPerFrame(e),h=u*d,c=this._initPTS,m="mp3"===e.segmentCodec&&this.typeSupported.mpeg,f=[],p=void 0!==n,g=e.samples,v=8*!m,E=this.nextAudioTs||-1,y=c.baseTime*o/c.timescale,b=y+t*o;if(this.isAudioContiguous=i=i||g.length&&E>0&&(r&&9e3>Math.abs(b-(E+y))||Math.abs(sn(g[0].pts,b)-(E+y))<20*h),g.forEach(function(e){e.pts=sn(e.pts,b)}),!i||E<0){let e=g.length;if(e!==(g=g.filter(e=>e.pts>=0)).length&&this.warn("Removed ".concat(g.length-e," of ").concat(e," samples (initPTS ").concat(y," / ").concat(o,")")),!g.length)return;E=0===n?0:r&&!p?Math.max(0,b-y):g[0].pts-y}if("aac"===e.segmentCodec){let t=this.config.maxAudioFramesDrift;for(let i=0,r=E+y;i<g.length;i++){let n=g[i],a=n.pts,s=a-r,l=Math.abs(1e3*s/o);if(s<=-t*h&&p)0===i&&(this.warn("Audio frame @ ".concat((a/o).toFixed(3),"s overlaps marker by ").concat(Math.round(1e3*s/o)," ms.")),this.nextAudioTs=E=a-y,r=a);else if(s>=t*h&&l<1e4&&p){let t=Math.round(s/h);for(r=a-t*h;r<0&&t&&h;)t--,r+=h;0===i&&(this.nextAudioTs=E=r-y),this.warn("Injecting ".concat(t," audio frames @ ").concat(((r-y)/o).toFixed(3),"s due to ").concat(Math.round(1e3*s/o)," ms gap."));for(let a=0;a<t;a++){let t=aJ.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);t||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),t=n.unit.subarray()),g.splice(i,0,{unit:t,pts:r}),r+=h,i++}}n.pts=r,r+=h}}let T=null,A=null,S=0,R=g.length;for(;R--;)S+=g[R].unit.byteLength;for(let t=0,r=g.length;t<r;t++){let r=g[t],n=r.unit,o=r.pts;if(null!==A)f[t-1].duration=Math.round((o-A)/d);else{if(i&&"aac"===e.segmentCodec&&(o=E+y),T=o,!(S>0))return;S+=v;try{s=new Uint8Array(S)}catch(e){this.observer.emit(tz.ERROR,tz.ERROR,{type:tY.MUX_ERROR,details:tj.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:a,error:e,bytes:S,reason:"fail allocating audio mdat ".concat(S)});return}m||(ij(s,0,S),ij(s,4,iG.mdat))}s&&s.set(n,v);let l=n.byteLength;v+=l,f.push(si(!0,u,l,0)),A=o}let k=f.length;if(!k)return;let I=f[f.length-1];E=A-y,this.nextAudioTs=E+d*I.duration;let L=m?new Uint8Array(0):a9.moof(e.sequenceNumber++,T/d,t6({},e,{samples:f}));e.samples=[];let D=(T-y)/o,w=this.nextAudioTs/o,C={data1:L,data2:s,startPTS:D,endPTS:w,startDTS:D,endDTS:w,type:"audio",hasAudio:!0,hasVideo:!1,nb:k};return this.isAudioContiguous=!0,C}constructor(e,t,i,r){super("mp4-remuxer",r),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=t,this.typeSupported=i,this.ISGenerated=!1}}function sn(e,t){let i;if(null===t)return e;for(i=t<e?-0x200000000:0x200000000;Math.abs(e-t)>0x100000000;)e+=i;return e}function sa(e,t,i,r){let n=e.samples.length;if(!n)return;let a=e.inputTimeScale;for(let s=0;s<n;s++){let n=e.samples[s];n.pts=sn(n.pts-i.baseTime*a/i.timescale,t*a)/a,n.dts=sn(n.dts-r.baseTime*a/r.timescale,t*a)/a}let s=e.samples;return e.samples=[],{samples:s}}function ss(e,t,i){let r=e.samples.length;if(!r)return;let n=e.inputTimeScale;for(let a=0;a<r;a++){let r=e.samples[a];r.pts=sn(r.pts-i.baseTime*n/i.timescale,t*n)/n}e.samples.sort((e,t)=>e.pts-t.pts);let a=e.samples;return e.samples=[],{samples:a}}function so(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return(null==e?void 0:e.start)!==void 0?(e.start+(i?e.duration:0))/e.timescale:t}function sl(e,t,i){let r=e.codec;return r&&r.length>4?r:t===t0.AUDIO?"ec-3"===r||"ac-3"===r||"alac"===r?r:"fLaC"===r||"Opus"===r?rg(r,!1):(i.warn('Unhandled audio codec "'.concat(r,'" in mp4 MAP')),r||"mp4a"):"mjpg"===r?r:(i.warn('Unhandled video codec "'.concat(r,'" in mp4 MAP')),r||"avc1")}try{a=self.performance.now.bind(self.performance)}catch(e){a=Date.now}let sd=[{demux:class{resetTimeStamp(){}resetInitSegment(e,t,i,r){let n=this.videoTrack=aR("video",1),a=this.audioTrack=aR("audio",1),s=this.txtTrack=aR("text",1);if(this.id3Track=aR("id3",1),this.initData=void 0,this.timeOffset=0,!(null!=e&&e.byteLength))return;let o=this.initData=iJ(e);if(o.video){let{id:e,timescale:t,codec:i,supplemental:r}=o.video;n.id=e,n.timescale=s.timescale=t,n.codec=i,n.supplemental=r}if(o.audio){let{id:e,timescale:t,codec:i}=o.audio;a.id=e,a.timescale=t,a.codec=i}s.id=iH.text,n.sampleDuration=0,n.duration=a.duration=r}resetContiguity(){this.remainderData=null}static probe(e){let t=e.byteLength;for(let i=0;i<t;){let r=iW(e,i);if(r>8&&iW(e,i+4)===iG.moof)return!0;
3i=r>1?i+r:t}return!1}demux(e,t,i){this.timeOffset=t;let r=e,n=this.videoTrack,a=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=i8(this.remainderData,e));let t=function(e){let t={valid:null,remainder:null},i=iZ(e,["moof"]);if(i.length<2)return t.remainder=e,t;let r=i[i.length-1];return t.valid=e.slice(0,r.byteOffset-8),t.remainder=e.slice(r.byteOffset-8),t}(r);this.remainderData=t.remainder,n.samples=t.valid||new Uint8Array}else n.samples=r;let s=this.extractID3Track(n,t),o=this.parseFragment(n,a,t,i);return{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack,initData:this.initData,sampleData:o}}flush(e,t){let i=this.timeOffset,r=this.videoTrack,n=this.txtTrack;r.samples=this.remainderData||new Uint8Array,this.remainderData=null;let a=this.extractID3Track(r,this.timeOffset),s=this.parseFragment(r,n,i,t);return{videoTrack:r,audioTrack:aR(),id3Track:a,textTrack:aR(),initData:this.initData,sampleData:s}}parseFragment(e,t,i,r){let n=this.initData;if(n&&r){let{samples:a,sampleData:s}=function(e,t,i,r){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],a=[],s=i5(t.samples,i,r,n,{isHEVCFlavor:i6(t.codec),samples:a,timeOffset:e,timescale:t.timescale,trackId:t.id});return{samples:a,sampleData:{includeSampleDetails:n,tracks:s}}}(i,e,n,this.logger,r.iframe);return t.samples=a,s}t.samples=function(e,t){let i=[],r=t.samples,n=t.timescale,a=t.id,s=!1;return iZ(r,["moof"]).map(o=>{let l=o.byteOffset-8;iZ(o,["traf"]).map(o=>{let d=iZ(o,["tfdt"]).map(e=>{let t=e[0],i=iW(e,4);return 1===t&&(i*=0x100000000,i+=iW(e,8)),i/n})[0];return void 0!==d&&(e=d),iZ(o,["tfhd"]).map(d=>{let u=iW(d,4),h=0xffffff&iW(d,0),c=(1&h)!=0,m=0,f=0,p=0,g=8;u===a&&(c?(m=iW(d,g),g+=4,m*=0x100000000,m+=iW(d,g),g+=4):c||(131072&h)==0||(m=l),(2&h)!=0&&(g+=4),(8&h)!=0&&(f=iW(d,g),g+=4),(16&h)!=0&&(p=iW(d,g),g+=4),(32&h)!=0&&(g+=4),"video"===t.type&&(s=i6(t.codec)),iZ(o,["trun"]).map(a=>{let o=a[0],l=0xffffff&iW(a,0),d=0,u=(256&l)!=0,h=0,c=(512&l)!=0,g=0,v=(1024&l)!=0,E=(2048&l)!=0,y=0,b=iW(a,4),T=8;(1&l)!=0&&(d=iW(a,T),T+=4),(4&l)!=0&&(T+=4);let A=m+d;for(let l=0;l<b;l++){if(u?(h=iW(a,T),T+=4):h=f,c?(g=iW(a,T),T+=4):g=p,v&&(T+=4),E&&(y=0===o?iW(a,T):iY(a,T),T+=4),t.type===t0.VIDEO){let t=0;for(;t<g;){let a=iW(r,A);A+=4,i9(s,r[A])&&i7(r.subarray(A,A+a),s?2:1,e+y/n,i),A+=a,t+=a+4}}e+=h/n}}))})})}),i}(i,e)}extractID3Track(e,t){let i=this.id3Track;return e.samples.length&&iZ(e.samples,["emsg"]).forEach(e=>{let r=function(e){let t,i=e[0],r="",n="",a=0,s=0,o=0,l=0,d=4;if(0===i){let t=iq(e,d),i=null!==t?iq(e,d+t.length):null;null!==t&&null!==i?(r=t,n=i,d+=t.length+i.length,a=iW(e,d),d+=4,s=iW(e,d),d+=4,o=iW(e,d),d+=4,l=iW(e,d),d+=4):(iy.warn("Unterminated ".concat(null===t?"scheme_id_uri":"value"," in parsing emsg box: version 0 box ends inside a string, dropping all of its fields")),d=e.length)}else if(1===i){a=iW(e,d);let i=iW(e,d+=4),s=iW(e,d+=4);d+=4,tV(t=0x100000000*i+s)||(t=Number.MAX_SAFE_INTEGER,iy.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=iW(e,d),d+=4,l=iW(e,d);let u=iq(e,d+=4),h=null!==u?iq(e,d+u.length):null;null!==u&&(r=u,d+=u.length),null!==h?(n=h,d+=h.length):(iy.warn("Unterminated ".concat(null===u?"scheme_id_uri":"value"," in parsing emsg box: version 1 box ends inside a string, dropping its ").concat(null===u?"strings and payload":"value and payload")),d=e.length)}return{schemeIdUri:r,value:n,timeScale:a,presentationTime:t,presentationTimeDelta:s,eventDuration:o,id:l,payload:e.subarray(d,e.byteLength)}}(e);if(aG.test(r.schemeIdUri)){let e=aH(r,t),n=0xffffffff===r.eventDuration?1/0:r.eventDuration/r.timeScale;n<=.001&&(n=1/0);let a=r.payload;i.samples.push({data:a,len:a.byteLength,dts:e,pts:e,type:aS.emsg,duration:n})}else if(this.config.enableEmsgKLVMetadata){let e=this.config.emsgKLVSchemaUri||aS.misbklv;if(r.schemeIdUri.startsWith(e)){let e=aH(r,t);i.samples.push({data:r.payload,len:r.payload.byteLength,dts:e,pts:e,type:aS.misbklv,duration:1/0})}}}),i}demuxSampleAes(e,t,i){return Promise.reject(Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0,this.initData=void 0}constructor(e,t,i,r=iy){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.initData=void 0,this.logger=void 0,this.config=t,this.logger=r}},remux:class extends im{destroy(){this.observer&&this.observer.removeAllListeners(),this.observer=null}resetTimeStamp(e){this.lastEndTime=null;let t=this.initPTS;t&&e&&t.baseTime===e.baseTime&&t.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,t,i,r){this.audioCodec=t,this.videoCodec=i,this.decryptdata=r,this.pendingInitSegment=e,this.videoOnlyRemux=!1,this.initTracks=void 0,this.initData=void 0,this.emitInitSegment=!0}generateInitSegment(e,t,i){this.videoOnlyRemux=!1;let{audioCodec:r,videoCodec:n}=this;if(!(null!=e&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}let{audio:a,video:s}=this.initData=i||iJ(e);if(t)!function(e,t){if(!e||!t)return;let i=t.keyId;(null==i?void 0:i.byteLength)===16&&t.isCommonEncryption&&i3(e,(e,t)=>{let r=e.subarray(8,24);r.some(e=>0!==e)||(iy.log("[eme] Patching keyId in 'enc".concat(t?"a":"v",">sinf>>tenc' box: ").concat(iN(r)," -> ").concat(iN(i))),e.set(i,8))})}(e,t);else{let e=a||s;null!=e&&e.encrypted&&this.warn('Init segment with encrypted track with has no key ("'.concat(e.codec,'")!'))}a&&(r=sl(a,t0.AUDIO,this)),s&&(n=sl(s,t0.VIDEO,this));let o={};a&&s?o.audiovideo={container:"video/mp4",codec:r+","+n,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:a?o.audio={container:"audio/mp4",codec:r,encrypted:a.encrypted,initSegment:e,id:"audio"}:s?o.video={container:"video/mp4",codec:n,supplemental:s.supplemental,encrypted:s.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=o}remux(e,t,i,r,n,a,s,o,l,d,u){var h,c,m,f;let p,g,{initPTS:v,lastEndTime:E}=this,y={audio:void 0,video:void 0,text:void 0,id3:i,initSegment:void 0};tW(E)||(E=this.lastEndTime=n||0);let b=t.samples;if(!b.length)return y;let T=this.pendingInitSegment;T&&(this.pendingInitSegment=void 0,this.generateInitSegment(T,this.decryptdata,d));let A={initPTS:void 0,timescale:void 0,trackId:void 0},S=this.initData;if(null!=(h=S)&&h.length||(this.generateInitSegment(b),S=this.initData),!(null!=(c=S)&&c.length))return this.warn("Failed to generate initSegment."),y;if(l.iframe&&S.audio&&S.video){let e=null==(m=this.initTracks)||null==(m
3=m.audiovideo)?void 0:m.initSegment,t=e?function(e){let t=iZ(e,["moov"]);if(1!==t.length||iZ(e,["moof"]).length)return null;let i=e.byteOffset,r=[],n=[],a=!1,s=iZ(t[0],["trak"]);for(let e=0;e<s.length;e++){let t=s[e],o=iZ(t,["mdia","hdlr"])[0];if("vide"===(o?iB(o.subarray(8,12)):"")){a=!0;continue}let l=iZ(t,["tkhd"])[0];if(!l)return null;let d=l[0];n.push(iW(l,0===d?12:20)),r.push(iQ(t,i))}if(!a||!r.length)return null;let o=iZ(t[0],["mvex"])[0],l=0;if(o){let e=iZ(o,["trex"]);for(let t=0;t<e.length;t++){let a=e[t];-1!==n.indexOf(iW(a,4))&&(r.push(iQ(a,i)),l+=a.byteLength+8)}}let{result:d,dropped:u,droppedBefore:h}=iX(e,r);if(ij(d,t[0].byteOffset-i-8,t[0].byteLength+8-u),o&&l){let e=o.byteOffset-i-8;ij(d,e-h(e),o.byteLength+8-l)}return d}(e):null;t&&(this.log("Converted muxed init segment to video-only for I-Frame playback"),this.generateInitSegment(t,this.decryptdata),null!=(f=this.initData)&&f.length&&(S=this.initData,this.emitInitSegment=!0,this.videoOnlyRemux=!0))}this.emitInitSegment&&(A.tracks=this.initTracks,y.initSegment=A,this.emitInitSegment=!1);let R=l.iframe,k=u&&(!R||u.includeSampleDetails)?u.tracks:function(e,t,i,r){let n=!(arguments.length>4)||void 0===arguments[4]||arguments[4];return i5(e,t,r,n)}(b,S,l,this,R),I=S.audio?k[S.audio.id]:null,L=S.video?k[S.video.id]:null,D=!!S.audio,w=!!S.video,C="";D&&(C+="audio"),w&&(C+="video");let M=so(L,1/0),P=so(I,1/0),O=so(L,0,!0),x=so(I,0,!0),N=n,U=0;L&&I&&S.audio&&(P>O||M>x)&&this.warn("audio and video track sample timestamps do not overlap. v: ".concat(M,"-").concat(O," a: ").concat(P,"-").concat(x,"}"),L,I);let F=!!I&&(!L||!v&&P<M||!!v&&v.trackId===S.audio.id),B=F?I:L;if(!B)return this.log("No media samples found in ".concat(o," ").concat(l.level," ").concat(-1===l.part?"":"part: ".concat(l.part," of")," sn: ").concat(l.sn," at playlist time: ").concat(n)),y;let G=b;if(L&&L.sampleCount>=1&&S.video&&l.iframe){let{trun:e,start:t}=L,i=1===e.length,r=e.length?i?e[0].samples:e[0].samples.concat(...e.slice(1).map(e=>e.samples)):[];if(r.length){let n=e[0],a=n;for(let t=e.length;t--;)if(e[t].samples.length){a=e[t];break}let s=a.lastSampleDurationOffset,{defaultSampleDurationOffset:o}=n,d=Math.abs(l.duration-(O-M))>.05,u=r.length<L.sampleCount;if(d||u||this.videoOnlyRemux||!i){let e=u?a.sampleOffset+a.samples.reduce((e,t)=>e+t.size,0):void 0,i=d?l.duration:O-M,n=function(e,t,i,r){if(void 0!==i){let r=e[e.length-1],n=t;for(let t=0;t<e.length-1;t++)n-=e[t].duration;return n<=0&&(n=r.duration),r.duration=n,{durationOffset:i,value:n}}if(void 0===r)return;let n=Math.round(t/e.length);for(let t=0;t<e.length;t++)e[t].duration=n;return{durationOffset:r,value:n}}(r,i*S.video.timescale,s,o),h=function(e,t,i,r,n){if(i<1)return null;let a=iZ(e,["moof"]);if(1!==a.length)return null;let s=a[0],o=e.byteOffset,l=[],d=[],u=iZ(s,["traf"]),h=!0;for(let e=0;e<u.length;e++){let i=u[e],r=iZ(i,["tfhd"])[0];if(!r)return null;iW(r,4)===t?(l.push(i),131072&iW(r,0)||(h=!1)):d.push(iQ(i,o))}if(!l.length||d.length&&!h)return null;if(void 0!==r){let t=i;for(let i=0;i<l.length;i++){let r=l[i],n=0,a=iZ(r,["trun"]);for(let i=0;i<a.length;i++){let r=a[i],s=Math.min(t,iW(r,4));if(s){ij(e,r.byteOffset-o+4,s);let t=0xffffff&iW(r,0),i=(256&t?4:0)+(512&t?4:0)+(1024&t?4:0)+(2048&t?4:0);iz(e,r,8+(1&t?4:0)+(4&t?4:0)+s*i)}else ij(e,r.byteOffset-o-4,iG.free);t-=s,n+=s}let s=iZ(r,["senc"])[0];s&&ij(e,s.byteOffset-o+4,n);let d=iZ(r,["saiz"])[0];if(d){let t=d[1]<<16|d[2]<<8|d[3],i=4;1&t&&(i+=8);let r=d[i];i+=1,ij(e,d.byteOffset-o+i,n),iz(e,d,i+4+(0===r?n:0))}}let n=iZ(e,["mdat"]);if(1===n.length){let t=n[0].byteOffset-o-8;ij(e,t,r-t)}}let c=e,m=0,f=()=>0;if(d.length){({result:c,dropped:m,droppedBefore:f}=iX(e,d)),ij(c,s.byteOffset-o-8,s.byteLength+8-m);for(let e=0;e<l.length;e++){let t=l[e],i=f(t.byteOffset-o),r=iZ(t,["trun"]);for(let e=0;e<r.length;e++){let t=r[e];1&iW(t,0)&&ij(c,t.byteOffset-o-i+8,iW(t,8)-m)}if(i){let e=iZ(t,["saio"]);for(let t=0;t<e.length;t++){let r=e[t],n=0===r[0]?4:8,a=1&iW(r,0)?12:4,s=iW(r,a);for(a+=4;s--;a+=n){let e=a+n-4;ij(c,r.byteOffset-o-i+e,iW(r,e)-i)}}}}}if(n){let{durationOffset:e,value:t}=n;ij(c,e-f(e),t)}return void 0!==r?c.subarray(0,r-m):c}(b,S.video.id,r.length,e,n);h?(G=h,g=function(e,t){let i=e,r=e;for(let e=0;e<t.length;e++){let{cts:n,duration:a}=t[e];
3r=Math.max(r,i+(n||0)+a),i+=a}return r}(t,r)):this.warn("IFrame remux skipped (sn ".concat(l.sn,"); using native sample duration")),U=h&&n?i:O-M}else U=O-M}else this.warn("Could not remux IFrame track fragment (no samples in range, trun count ".concat(e.length,")")),U=O-M}else U=F?x-P:O-M;if(this.videoOnlyRemux&&G===b)return this.warn("Dropping muxed I-Frame fragment that could not be remuxed to video-only (sn: ".concat(l.sn,")")),y;let H=B.timescale,K=B.start-n*H,W=F?S.audio.id:S.video.id;if(N=B.start/H,(a||!v)&&(function(e,t,i,r){if(null===e)return!0;let n=Math.max(r,1);return Math.abs(t-e.baseTime/e.timescale-i)>=n}(v,N,n,U)||H!==v.timescale)){let e=!1,t=F?"audio":"video";if(v){let i=0!==n?N/n:1+N/1;e=N>=0&&.001>Math.abs(1-i),this.log("".concat(t," timestamps in track ").concat(W," at playlist time: ").concat(a?"":"~").concat(n," maps to ").concat(N," with initPTS: ").concat(v.baseTime/v.timescale," (").concat(K/H-v.baseTime/v.timescale,"s diff) (").concat(C,") drift estimate: ").concat(i," ").concat(e?"(ignoring drift)":"remapping timestamps (initPTS)"))}e||(this.log("Found initPTS in ".concat(t," track ").concat(W," at playlist time: ").concat(n," offset: ").concat(N-n," (").concat(K,"/").concat(H,")")),v=null,A.initPTS=K,A.timescale=H,A.trackId=W)}v?(A.initPTS=v.baseTime,A.timescale=v.timescale,A.trackId=v.trackId):(A.timescale&&void 0!==A.trackId&&void 0!==A.initPTS||(this.warn("Could not set initPTS"),A.initPTS=N,A.timescale=1,A.trackId=-1),this.initPTS=v={baseTime:A.initPTS,timescale:A.timescale,trackId:A.trackId});let V=N-v.baseTime/v.timescale,q=V+U,Y=w&&(null==B?void 0:B.ptsMin)!==void 0?B.ptsMin/B.timescale-v.baseTime/v.timescale:V,j=void 0!==g&&L?g/L.timescale-v.baseTime/v.timescale:w&&null!=B&&B.ptsMax?B.ptsMax/B.timescale-v.baseTime/v.timescale:q;U>0?this.lastEndTime=q:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());let z={data1:G,data2:p,startPTS:Y,startDTS:V,endPTS:j,endDTS:q,type:C,hasAudio:D,hasVideo:w,nb:1,dropped:0,encrypted:!!S.audio&&S.audio.encrypted||!!S.video&&S.video.encrypted};y.audio=D&&!w?z:void 0,y.video=w?z:void 0;let Q=this.isVideoContiguous,X=null==L?void 0:L.sampleCount;if(X){let e=L.keyFrameIndex,t=-1!==e;z.nb=X,z.dropped=0===e||Q?0:t?e:X,z.independent=t,z.firstKeyFrame=e,t&&L.keyFrameStart&&(z.firstKeyFramePTS=(L.keyFrameStart-v.baseTime)/v.timescale),Q||(y.independent=t),this.isVideoContiguous||(this.isVideoContiguous=t),z.dropped&&this.warn("fmp4 does not start with IDR: firstIDR ".concat(e,"/").concat(X," dropped: ").concat(z.dropped," start: ").concat(z.firstKeyFramePTS||"NA"))}return y.initSegment=A,y.id3=sa(i,n,v,v),r.samples.length&&(y.text=ss(r,n,v)),y}constructor(e,t,i,r){super("passthrough-remuxer",r),this.observer=void 0,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,this.isVideoContiguous=!1,this.videoOnlyRemux=!1,this.decryptdata=null,this.pendingInitSegment=void 0,this.observer=e}}},{demux:aY,remux:sr},{demux:class extends ak{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e,t){if(!e)return!1;let i=iw(e,0),r=(null==i?void 0:i.length)||0;if(aN(e,r))return!1;for(let i=e.length;r<i;r++)if(function(e,t){if(aT(e,t)){let i=ay(e,t);if(t+i>=e.length)return!1;let r=ab(e,t);if(r<=i)return!1;let n=t+r;return n===e.length||aT(e,n)}return!1}(e,r))return t.log("ADTS sync word found !"),!0;return!1}canParse(e,t){return t+5<e.length&&aE(e,t)&&ab(e,t)<=e.length-t}appendFrame(e,t,i){a_(e,this.observer,t,i,e.manifestCodec);let r=aA(e,t,i,this.basePTS,this.frameIndex);if((null==r?void 0:r.missing)===0)return r}demuxSampleAes(e,t,i){let r=this.demux(e,i),n=this.sampleAes=new aU(this.observer,this.config,t);return new Promise(e=>{n.decryptAacSamples(r.audioTrack.samples,0,()=>{e(r)})})}constructor(e,t){super(),this.observer=void 0,this.config=void 0,this.sampleAes=null,this.observer=e,this.config=t}},remux:sr},{demux:class extends ak{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;let t=iw(e,0),i=(null==t?void 0:t.length)||0;
3if(t&&11===e[i]&&119===e[i+1]&&void 0!==ix(t)&&16>=aF(e,i))return!1;for(let t=e.length;i<t;i++)if(aN(e,i))return iy.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,t){return aO(e,t)&&4<=e.length-t}appendFrame(e,t,i){if(null!==this.basePTS)return aM(e,t,i,this.basePTS,this.frameIndex)}},remux:sr}];sd.splice(2,0,{demux:class extends ak{resetInitSegment(e,t,i,r){super.resetInitSegment(e,t,i,r),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:t,duration:r,inputTimeScale:9e4,dropped:0}}canParse(e,t){return t+64<e.length}appendFrame(e,t,i){let r=aB(e,t,i,this.basePTS,this.frameIndex);if(-1!==r)return{sample:e.samples[e.samples.length-1],length:r,missing:0}}static probe(e){if(!e)return!1;let t=iw(e,0);if(!t)return!1;let i=t.length;if(11===e[i]&&119===e[i+1]&&void 0!==ix(t)){if(16>aF(e,i))return!0;throw Error("Containerless ec-3 is not supported")}return!1}constructor(e){super(),this.observer=void 0,this.observer=e}},remux:sr});class su{configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,t,i,r){var n,s;let o;if(!this.observer)return sh(i);let l=i.transmuxing;l.executeStart=a();let d=new Uint8Array(e),{currentTransmuxState:u,transmuxConfig:h}=this;r&&(this.currentTransmuxState=r);let{contiguous:c,discontinuity:m,trackSwitch:f,accurateTimeOffset:p,timeOffset:g,initSegmentChange:v}=r||u,{audioCodec:E,videoCodec:y,defaultInitPts:b,duration:T,initSegmentData:A}=h,S=(n=d,s=t,o=null,n.byteLength>0&&(null==s?void 0:s.key)!=null&&null!==s.iv&&null!=s.method&&(o=s),o);if(S&&nA(S.method)){let e=this.getDecrypter(),t=nS(S.method);return this.asyncResult=!0,this.decryptionPromise=e.decrypt(d,S.key.buffer,S.iv.buffer,t,i.decryptRange).then(e=>{let t=this.push(e,null,i);return this.decryptionPromise=null,t}),this.decryptionPromise}let R=this.needsProbing(m,f);if(R){let e=i.iframe&&A&&aY.probe(A,this.logger)?A:d,t=this.configureTransmuxer(e);if(t)return this.logger.warn("[transmuxer] ".concat(t.message)),this.observer.emit(tz.ERROR,tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),l.executeEnd=a(),sh(i)}(m||f||v||R)&&this.resetInitSegment(A,E,y,T,t,i),(m||v||R)&&this.resetInitialTimestamp(b),c||this.resetContiguity();let k=this.transmux(d,S,g,p,i);this.asyncResult=sc(k);let I=this.currentTransmuxState;return I.contiguous=!0,I.discontinuity=!1,I.trackSwitch=!1,l.executeEnd=a(),k}flush(e){let t=e.transmuxing;t.executeStart=a();let{decrypter:i,currentTransmuxState:r,decryptionPromise:n}=this;if(n)return this.asyncResult=!0,n.then(()=>this.flush(e));let s=[],{timeOffset:o}=r;if(i){let t=i.flush();t&&s.push(this.push(t.buffer,null,e))}let{demuxer:l,remuxer:d}=this;if(!l||!d){t.executeEnd=a();let i=[sh(e)];return this.asyncResult?Promise.resolve(i):i}let u=l.flush(o,e);return sc(u)?(this.asyncResult=!0,u.then(t=>(this.flushRemux(s,t,e),s))):(this.flushRemux(s,u,e),this.asyncResult)?Promise.resolve(s):s}flushRemux(e,t,i){if(!this.remuxer)return;let{audioTrack:r,videoTrack:n,id3Track:s,textTrack:o}=t,{accurateTimeOffset:l,timeOffset:d}=this.currentTransmuxState;this.logger.log("[transmuxer.ts]: Flushed ".concat(this.id," sn: ").concat(i.sn).concat(i.part>-1?" part: "+i.part:""," of ").concat(this.id," playlist ").concat(i.level));let u=this.remuxer.remux(r,n,s,o,d,l,!0,this.id,i,t.initData,t.sampleData);e.push({remuxResult:u,chunkMeta:i}),i.transmuxing.executeEnd=a()}resetInitialTimestamp(e){let{demuxer:t,remuxer:i}=this;t&&i&&(t.resetTimeStamp(e),i.resetTimeStamp(e))}resetContiguity(){let{demuxer:e,remuxer:t}=this;e&&t&&(e.resetContiguity(),t.resetNextTimestamp())}resetInitSegment(e,t,i,r,n,a){let{demuxer:s,remuxer:o}=this;s&&o&&(s.resetInitSegment(e,t,i,r,n,a),o.resetInitSegment(e,t,i,n))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0),this.observer&&this.observer.removeAllListeners(),this.decryptionPromise=null,this.decrypter=this.observer=void 0,this.logger=this.config=this.probe=void 0}transmux(e,t,i,r,n){return(null==t?void 0:t.method)==="SAMPLE-AES"?this.transmuxSampleAes(e,t,i,r,n):this.transmuxUnencrypted(e,i,r,n)}transmuxUnencrypted(e,t,i,r){let{demuxer:n,remuxer:a}=this;if(!n||!a)return sh(r);let s=n.demux(e,t,r,!1,!this.config.progressive),{audioTrack:o,videoTrack:l,id3Track:d,textTrack:u}=s;return{remuxResult:a.remux(o,l,d,u,t,i,!1,this.id,r,s.initData,s.sampleData),chunkMeta:r}}transmuxSampleAes(e,t,i,r,n){return this.demuxer?this.demuxer.demuxSampleAes(e,t,i,n).then(e=>({remuxResult:this.remuxer.remux(e.audioTrack,e.videoTrack,e.id3Track,e.textTrack,i,r,!1,this.id,n,e.initData,e.sampleData),chunkMeta:n})):Promise.reject(Error("no demuxer"))}
3configureTransmuxer(e){let t,{config:i,observer:r,typeSupported:n}=this;if(!r)return;try{for(let i=0,r=sd.length;i<r;i++){var a;if(null!=(a=sd[i].demux)&&a.probe(e,this.logger)){t=sd[i];break}}}catch(e){return e}if(!t)return Error("Failed to find demuxer by probing fragment data");let s=this.demuxer,o=this.remuxer,l=t.demux,d=t.remux;s&&s instanceof l||(this.logger.log("Using ".concat(l.name)),this.demuxer=new l(r,i,n,this.logger),this.probe=l.probe),o&&o instanceof d||(this.logger.log("Using ".concat(d.name)),this.remuxer=new d(r,i,n,this.logger))}needsProbing(e,t){return!this.demuxer||!this.remuxer||e||t}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new nt(this.config)),e}constructor(e,t,i,r,n,a){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=t,this.config=i,this.id=n,this.logger=a}}let sh=e=>({remuxResult:{},chunkMeta:e});function sc(e){return"then"in e&&e.then instanceof Function}class sm{constructor(e,t,i,r,n){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=t,this.initSegmentData=i,this.duration=r,this.defaultInitPts=n||null}}class sf{constructor(e,t,i,r,n,a){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=t,this.accurateTimeOffset=i,this.trackSwitch=r,this.timeOffset=n,this.initSegmentChange=a}}let sp=0;class sg{reset(){if(this.frag=null,this.part=null,this.workerContext){let e=this.instanceNo;this.instanceNo=sp++;let t=this.hls.config,i=ry(t.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:i,id:this.id,c
3onfig:rx(t)})}}terminateWorker(){if(this.workerContext){let{worker:t}=this.workerContext;this.workerContext=null,t.removeEventListener("message",this.onWorkerMessage),t.removeEventListener("error",this.onWorkerError);var e=this.hls.config.workerPath;let i=av[e||ag];if(i&&1==i.clientCount--){let{worker:t,objectURL:r}=i;delete av[e||ag],r&&self.URL.revokeObjectURL(r),t.terminate()}}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{let e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}let e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,t,i,r,n,a,s,o,l,d){var u,h;l.transmuxing.start=self.performance.now();let{instanceNo:c,transmuxer:m}=this,f=a?a.start:n.start,p=n.decryptdata,g=this.frag,v=!g||n.cc!==g.cc,E=!g||l.level!==g.level,y=g?l.sn-g.sn:-1,b=this.part?l.part-this.part.index:-1,T=0===y&&l.id>1&&l.id===(null==g?void 0:g.stats.chunkCount),A=!E&&(1===y||0===y&&(1===b||T&&b<=0)),S=self.performance.now();(E||y||0===n.stats.parsing.start)&&(n.stats.parsing.start=S),a&&(b||!A)&&(a.stats.parsing.start=S);let R=!(g&&(null==(u=n.initSegment)?void 0:u.url)===(null==(h=g.initSegment)?void 0:h.url)),k=new sf(v,A,o,E,f,R);if(!A||v||R){this.hls.logger.log("[transmuxer-interface]: Starting new transmux session for ".concat(n.type," sn: ").concat(l.sn).concat(l.part>-1?" part: "+l.part:""," ").concat(this.id," playlist: ").concat(l.level," id: ").concat(l.id,"\n        discontinuity: ").concat(v,"\n        trackSwitch: ").concat(E,"\n        contiguous: ").concat(A,"\n        accurateTimeOffset: ").concat(o,"\n        timeOffset: ").concat(f,"\n        initSegmentChange: ").concat(R));let e=new sm(i,r,t,s,d);this.configureTransmuxer(e)}if(this.frag=n,this.part=a,this.workerContext)this.workerContext.worker.postMessage({instanceNo:c,cmd:"demux",data:e,decryptdata:p,chunkMeta:l,state:k},e instanceof ArrayBuffer?[e]:[]);else if(m){let t=m.push(e,p,l,k);sc(t)?t.then(e=>{this.handleTransmuxComplete(e)}).catch(e=>{this.transmuxerError(e,l,"transmuxer-interface push error")}):this.handleTransmuxComplete(t)}}flush(e){e.transmuxing.start=self.performance.now();let{instanceNo:t,transmuxer:i}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:t,cmd:"flush",chunkMeta:e});else if(i){let t=i.flush(e);sc(t)?t.then(t=>{this.handleFlushResult(t,e)}).catch(t=>{this.transmuxerError(t,e,"transmuxer-interface flush error")}):this.handleFlushResult(t,e)}}transmuxerError(e,t,i){this.hls&&(this.error=e,this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,chunkMeta:t,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:i}))}handleFlushResult(e,t){e.forEach(e=>{this.handleTransmuxComplete(e)}),this.onFlush(t)}configureTransmuxer(e){let{instanceNo:t,transmuxer:i}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:t,cmd:"configure",config:e}):i&&i.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}constructor(e,t,i,r){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=sp++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=e=>{let t=e.data,i=this.hls;if(i&&null!=t&&t.event&&t.instanceNo===this.instanceNo)switch(t.event){case"init":{var r;let e=null==(r=this.workerContext)?void 0:r.objectURL;e&&self.URL.revokeObjectURL(e);break}case"transmuxComplete":this.handleTransmuxComplete(t.data);break;case"flush":this.onFlush(t.data);break;case"workerLog":i.logger[t.data.logType]&&i.logger[t.data.logType](t.data.message);break;default:t.data=t.data||{},t.data.frag=this.frag,t.data.part=this.part,t.data.id=this.id,i.trigger(t.event,t.data)}},this.onWorkerError=e=>{if(!this.hls)return;let t=Error("".concat(e.message,"  (").concat(e.filename,":").concat(e.lineno,")"));this.hls.config.enableWorker=!1,this.hls.logger.warn('Error in "'.concat(this.id,'" Web Worker, fallback to inline')),this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:t})};let n=e.config;this.hls=e,this.id=t,this.useWorker=!!n.enableWorker,this.onTransmuxComplete=i,this.onFlush=r;let a=(e,t)=>{(t=t||{}).frag=this.frag||void 0,e===tz.ERROR&&(t.parent=this.id,t.part=this.part,this.error=t.error),this.hls.trigger(e,t)};this.observer=new ap,this.observer.on(tz.FRAG_DECRYPTED,a),this.observer.on(tz.ER
3ROR,a);let s=ry(n.preferManagedMediaSource);if(this.useWorker&&"undefined"!=typeof Worker){let i=this.hls.logger;if(n.workerPath||"function"==typeof __HLS_WORKER_BUNDLE__){try{n.workerPath?(i.log("loading Web Worker ".concat(n.workerPath,' for "').concat(t,'"')),this.workerContext=function(e){let t=av[e];if(t)return t.clientCount++,t;let i=new self.URL(e,self.location.href).href,r={worker:new self.Worker(i),scriptURL:i,clientCount:1};return av[e]=r,r}(n.workerPath)):(i.log('injecting Web Worker for "'.concat(t,'"')),this.workerContext=function(){let e=av[ag];if(e)return e.clientCount++,e;let t=new self.Blob(["var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(".concat(__HLS_WORKER_BUNDLE__.toString(),")(true);")],{type:"text/javascript"}),i=self.URL.createObjectURL(t),r={worker:new self.Worker(i),objectURL:i,clientCount:1};return av[ag]=r,r}());let{worker:e}=this.workerContext;e.addEventListener("message",this.onWorkerMessage),e.addEventListener("error",this.onWorkerError),e.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:s,id:t,config:rx(n)})}catch(r){i.warn('Error setting up "'.concat(t,'" Web Worker, fallback to inline'),r),this.terminateWorker(),this.error=null,this.transmuxer=new su(this.observer,s,n,"",t,e.logger)}return}}this.transmuxer=new su(this.observer,s,n,"",t,e.logger)}}class sv extends im{destroy(){this.clearTimer(),this.hls=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,t,i){let r=null==t?void 0:t.renditionReports;if(r){let n=-1;for(let i=0;i<r.length;i++){let a,s=r[i];try{a=new self.URL(s.URI,t.url).href}catch(e){this.warn("Could not construct new URL for Rendition Report: ".concat(e)),a=s.URI||""}if(a===e){n=i;break}a===e.substring(0,a.length)&&(n=i)}if(-1!==n){let e=r[n],a=parseInt(e["LAST-MSN"])||t.lastPartSn,s=parseInt(e["LAST-PART"])||t.lastPartIndex;if(this.hls.config.lowLatencyMode){let e=Math.min(t.age-t.partTarget,t.targetduration);s>=0&&e>t.partTarget&&(s+=1)}return new rM(a,s>=0?s:void 0,i&&rC(i))}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,t){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,t){if(t)try{return t.addDirectives(e)}catch(e){this.warn("Could not construct new URL with HLS Delivery Directives: ".concat(e))}return e}playlistLoaded(e,t,i){let{details:r,stats:n}=t,a=r.fragments,s=self.performance.now(),o=n.loading.first?Math.max(0,Math.floor(s-n.loading.first)):0;r.advancedDateTime=Date.now()-o;let l=this.hls.config.timelineOffset;if(l!==r.appliedTimelineOffset){let e=Math.max(l||0,0);r.appliedTimelineOffset=e,a.forEach(t=>{null==t||t.setStart(t.playlistOffset+e)})}if(r.live||null!=i&&i.live){var d;let l,u,h,c="levelInfo"in t?t.levelInfo:t.track;r.reloaded(i);let m=null==(d=a[a.length-1])?void 0:d.type;if(r.misses>=this.hls.config.liveMaxUnchangedPlaylistRefresh){let e=Error("".concat(m," playlist ").concat(c.id," hit max allowed unchanged reloads."));this.warn(e);let{networkDetails:i,context:a}=t;this.hls.trigger(tz.ERROR,{type:tY.NETWORK_ERROR,details:tj.PLAYLIST_UNCHANGED_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level,parent:m,context:a,networkDetails:i,stats:n});return}if(i){!function(e,t,i){let r;if(e===t)return;let n=null,a=e.fragments;for(let e=a.length-1;e>=0;e--){let t=a[e].initSegment;if(t){n=t;break}}e.fragmentHint&&delete e.fragmentHint.endPTS,function(e,t,i){var r,n,a;let s=t.skippedSegments,o=Math.max(e.startSN,t.startSN)-t.startSN,l=+!!e.fragmentHint+(s?t.endSN:Math.min(e.endSN,t.endSN))-t.startSN,d=t.startSN-e.startSN,u=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,h=null!=(r=e.fragmentHint)&&r.duration?e.fragments.concat(e.fragmentHint):e.fragments;for(let r=o;r<=l;r++){let o=h[d+r],l=u[r];if(s&&!l&&o&&(l=t.fragments[r]=o),o&&l){i(o,l,r,u);let s=o.relurl,d=l.relurl;if(s&&(n=s)!==(a=d)&&a&&at(n)!==at(a)){t.playlistParsingError=n4("media sequence mismatch ".concat(l.sn,":"),e,t,o,l);return}if(o.cc!==l.cc){t.playlistParsingError=n4("discontinuity sequence mismatch (".concat(o.cc,"!=").concat(l.cc,")"),e,t,o,l);return}}}}(e,t,(e,i,a,s)=>{if((!t.startCC||t.skippedSegments)&&i.cc!==e.cc){let r=e.cc-i.cc;for(let e=a;
3e<s.length;e++)s[e].cc+=r;t.endCC=s[s.length-1].cc}tW(e.startPTS)&&tW(e.endPTS)&&(i.setStart(i.startPTS=e.startPTS),i.startDTS=e.startDTS,i.maxStartPTS=e.maxStartPTS,i.endPTS=e.endPTS,i.endDTS=e.endDTS,i.minEndPTS=e.minEndPTS,i.setDuration(e.endPTS-e.startPTS),i.duration&&(r=i),t.PTSKnown=t.alignedSliding=!0),e.hasStreams&&(i.elementaryStreams=e.elementaryStreams),i.loader=e.loader,e.hasStats&&(i.stats=e.stats),e.initSegment&&(i.initSegment=e.initSegment,n=e.initSegment)});let s=t.fragments,o=t.fragmentHint?s.concat(t.fragmentHint):s;if(n&&o.forEach(e=>{var t;e&&(!e.initSegment||e.initSegment.relurl===(null==(t=n)?void 0:t.relurl))&&(e.initSegment=n)}),t.skippedSegments){if(t.deltaUpdateFailed=s.some(e=>!e),t.deltaUpdateFailed){i.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let e=t.skippedSegments;e--;)s.shift();t.startSN=s[0].sn}else{t.canSkipDateRanges&&(t.dateRanges=function(e,t,i){let{dateRanges:r,recentlyRemovedDateranges:n}=t,a=t6({},e);n&&n.forEach(e=>{delete a[e]});let s=Object.keys(a).length;return s?(Object.keys(r).forEach(e=>{let t=a[e],n=new ny(r[e].attr,t);n.isValid?(a[e]=n,t||(n.tagOrder+=s)):i.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'.concat(rx(r[e].attr),'"'))}),a):r}(e.dateRanges,t,i));let r=e.fragments.filter(e=>e.rawProgramDateTime);if(e.hasProgramDateTime&&!t.hasProgramDateTime)for(let e=1;e<o.length;e++)null===o[e].programDateTime&&nJ(o[e],o[e-1],r);nj(r,t)}t.endCC=s[s.length-1].cc}if(!t.startCC){var l;let i=n6(e,t.startSN-1);t.startCC=null!=(l=null==i?void 0:i.cc)?l:s[0].cc}if(function(e,t,i){if(e&&t){let r=0;for(let n=0,a=e.length;n<a;n++){let a=e[n],s=t[n+r];a&&s&&a.index===s.index&&a.fragment.sn===s.fragment.sn?i(a,s):r--}}}(e.partList,t.partList,(e,t)=>{t.elementaryStreams=e.elementaryStreams,t.stats=e.stats,t.gap=e.gap||t.gap}),r){let e=t.iframesOnly&&r.type===t$.MAIN;n3(t,r,r.startPTS,r.endPTS,r.startDTS,r.endDTS,e,i)}else n5(e,t);s.length&&(t.totalduration=t.edge-s[0].start),t.driftStartTime=e.driftStartTime,t.driftStart=e.driftStart;let d=t.advancedDateTime;if(t.advanced&&d){let e=t.edge;t.driftStart||(t.driftStartTime=d,t.driftStart=e),t.driftEndTime=d,t.driftEnd=e}else t.driftEndTime=e.driftEndTime,t.driftEnd=e.driftEnd,t.advancedDateTime=e.advancedDateTime;-1===t.requestScheduled&&(t.requestScheduled=e.requestScheduled)}(i,r,this);let e=r.playlistParsingError;if(e){this.warn(e);let i=this.hls;if(!i.config.ignorePlaylistParsingErrors){let{networkDetails:a}=t;i.trigger(tz.ERROR,{type:tY.NETWORK_ERROR,details:tj.LEVEL_PARSING_ERROR,fatal:!1,url:r.url,error:e,reason:e.message,level:t.level,parent:m,networkDetails:a,stats:n});return}r.playlistParsingError=null}}-1===r.requestScheduled&&(r.requestScheduled=n.loading.start);let f=this.hls.mainForwardBufferInfo,p=f?f.end-f.len:0,g=(r.edge-p)*1e3,v=n8(r,g);r.requestScheduled+v<s?r.requestScheduled=s:r.requestScheduled<=s&&(r.requestScheduled+=v);let E=t.deliveryDirectives;if(this.log("live playlist ".concat(e," ").concat(r.advanced?"REFRESHED ".concat(r.lastPartSn," - ").concat(r.lastPartIndex):r.updated?"UPDATED":"MISSED (received ".concat(r.lastPartSn," - ").concat(r.lastPartIndex).concat(E?" | requested ".concat(E.msn," - ").concat(E.part):"",")"))),!this.canLoad||!r.live)return;if(r.canBlockReload&&r.advanced){let e=this.hls.config.lowLatencyMode,n=r.lastPartSn,a=r.endSN,o=r.lastPartIndex,d=n===a;-1!==o?d?(u=a+1,h=e?0:o):(u=n,h=e?o+1:r.maxPartIndex):u=a+1;let m=r.age,f=m+r.ageHeader,p=Math.min(f-r.partTarget,1.5*r.targetduration);if(p>0){if(f>3*r.targetduration)this.log("Playlist last advanced ".concat(m.toFixed(2),"s ago. Omitting segment and part directives.")),u=void 0,h=void 0;else if(null!=i&&i.tuneInGoal&&f-r.partTarget>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: ".concat(i.tuneInGoal," to: ").concat(p," with playlist age: ").concat(r.age)),p=0;else{let e=Math.floor(p/r.targetduration);u+=e,void 0!==h&&(h+=Math.round(p%r.targetduration/r.partTarget)),this.log("CDN Tune-in age: ".concat(r.ageHeader,"s last advanced ").concat(m.toFixed(2),"s goal: ").concat(p," skip sn ").concat(e," to part ").concat(h))}r.tuneInGoal=p}if(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,h),e||!d){r.requestScheduled=s,this.loadingPlaylist(c,l);return}}else(r.canBlockReload||r.canSkipUntil)&&(l=this.getDeliveryDirectives(r,t.deliveryDirectives,u,h));l&&void 0!==u&&r.canBlockReload&&(r.requestScheduled=n.loading.first+Math.max(v-2*o,v/2)),this.scheduleLo
3ading(c,l,r)}else this.clearTimer()}scheduleLoading(e,t,i){let r=i||e.details;if(!r)return void this.loadingPlaylist(e,t);let n=self.performance.now(),a=r.requestScheduled;if(n>=a&&!this.loadingSync){this.loadingSync=!0,this.loadingPlaylist(e,t),this.loadingSync=!1;return}let s=Math.max(a-n,0);this.log("reload live playlist ".concat(e.name||e.bitrate+"bps"," in ").concat(Math.round(s)," ms")),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,t),s)}getDeliveryDirectives(e,t,i,r){let n=rC(e);return null!=t&&t.skip&&e.deltaUpdateFailed&&(i=t.msn,r=t.part,n=rw.No),new rM(i,r,n)}checkRetry(e){let t=e.details,i=it(e),r=e.errorAction,{action:n,retryCount:a=0,retryConfig:s}=r||{},o=!!r&&!!s&&(n===rZ.RetryRequest||!r.resolved&&n===rZ.SendAlternateToPenaltyBox);if(o){var l,d;if(a>=s.maxNumRetry)return!1;if(i&&null!=(l=e.context)&&l.deliveryDirectives)this.warn("Retrying playlist loading ".concat(a+1,"/").concat(s.maxNumRetry,' after "').concat(t,'" without delivery-directives')),this.loadPlaylist();else{let i=id(null==(d=e.response)?void 0:d.code);if(this.clearTimer(),i)this.log("Waiting for connection (offline)"),e.reason="offline",this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3);else{let e=is(s,a);this.warn("Retrying playlist loading ".concat(a+1,"/").concat(s.maxNumRetry,' after "').concat(t,'" in ').concat(e,"ms")),this.timer=self.setTimeout(()=>this.loadPlaylist(),e)}}e.levelRetry=!0,r.resolved=!0}return o}checkOfflineStatus(){this.clearTimer(),id(0)?this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3):(this.log("Connection restored (online)"),this.loadPlaylist())}constructor(e,t){super(t,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.loadingSync=!1,this.hls=e}}function sE(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(!sy(e[i].attrs,t[i].attrs))return!1;return!0}function sy(e,t,i){let r=e["STABLE-RENDITION-ID"];return r&&!i?r===t["STABLE-RENDITION-ID"]:!(i||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(i=>e[i]!==t[i])}class sb{destroy(){this.tracks=this.queues=null}append(e,t,i){if(null===this.queues||null===this.tracks)return;let r=this.queues[t];r.push(e),1!==r.length||i||this.executeNext(t)}appendBlocker(e){return new Promise(t=>{this.append({label:"async-blocker",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}},e)})}prependBlocker(e){return new Promise(t=>{this.queues&&this.queues[e].unshift({label:"async-blocker-prepend",execute:t,onStart:()=>{},onComplete:()=>{},onError:()=>{}})})}removeBlockers(){null!==this.queues&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var t;let i=null==(t=e[0])?void 0:t.label;"async-blocker"===i||"async-blocker-prepend"===i?(e[0].execute(),e.splice(0,1)):"block-audio"===i&&e.splice(0,1)})}insertNext(e,t){null!==this.queues&&this.queues[t].splice(1,0,...e)}unblockAudio(){var e;null!==this.queues&&(null==(e=this.current("audio"))?void 0:e.label)==="block-audio"&&this.shiftAndExecuteNext("audio")}audioBlocking(){return null!==this.queues&&this.queues.audio.some(e=>"block-audio"===e.label)}executeNext(e){if(null===this.queues||null===this.tracks)return;let t=this.queues[e];if(t.length){let r=t[0];try{r.execute()}catch(n){var i;if(r.onError(n),null===this.queues||null===this.tracks)return;let t=null==(i=this.tracks[e])?void 0:i.buffer;null!=t&&t.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){null!==this.queues&&(this.queues[e].shift(),this.executeNext(e))}current(e){var t;return(null==(t=this.queues)?void 0:t[e][0])||null}toString(){let{queues:e,tracks:t}=this;return null===e||null===t?"<destroyed>":"\n".concat(this.list("video"),"\n").concat(this.list("audio"),"\n").concat(this.list("audiovideo"),"}")}list(e){var t,i;return null!=(t=this.queues)&&t[e]||null!=(i=this.tracks)&&i[e]?"".concat(e,": (").concat(this.listSbInfo(e),") ").concat(this.listOps(e)):""}listSbInfo(e){var t;let i=null==(t=this.tracks)?void 0:t[e],r=null==i?void 0:i.buffer;return r?"SourceBuffer".concat(r.updating?" updating":"").concat(i.ended?" ended":"").concat(i.ending?" ending":""):"none"}listOps(e){var t;return(null==(t=this.queues)?void 0:t[e].map(e=>e.label).join(", "))||""}constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}}let sT=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,s_="HlsJsTrackRemovedError";
3class sA extends Error{constructor(e){super(e),this.name=s_}}function sS(e){let t=e.querySelectorAll("source");[].slice.call(t).forEach(t=>{e.removeChild(t)})}function sR(e){return+("audio"===e)}function sk(e,t){return"".concat(e?"":" - triggering recovery").concat(t?" with HTMLMediaElement Error: "+t.message:"")}function sI(e){return"".concat(e.type,"_").concat(e.sn,"_").concat(e.level)}function sL(e,t){let{start:i,end:r}=t,n=0;for(let t=0;t<e.length;t++){let a=e[t];if(a.start>=r)break;let s=Math.max(i,a.start),o=Math.min(r,a.end);o>s&&(n+=o-s)}return n}function sD(e,t){return t.duration-e<=.05}class sw{setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),(this.timer||this.observer)&&this.stopCapping(),this.media=this.clientRect=this.hls=null,this.streamController=void 0}registerListeners(){let{hls:e}=this;e&&(e.on(tz.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tz.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this))}unregisterListener(){let{hls:e}=this;e&&(e.off(tz.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(tz.MEDIA_ATTA
3CHING,this.onMediaAttaching,this),e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tz.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this))}onFpsDropLevelCapping(e,t){if(!this.hls)return;let i=this.hls.levels[t.droppedLevel];this.isLevelAllowed(i)&&this.restrictedLevels.push({bitrate:i.bitrate,height:i.height,width:i.width})}onMediaAttaching(e,t){let i=t.media;this.clientRect=null,this.hls&&(i instanceof HTMLVideoElement?(this.media=i,this.hls.config.capLevelToPlayerSize&&this.observe()):this.media=null,(this.timer||this.observer)&&this.hls.levels.length>1&&this.detectPlayerSize())}onManifestParsed(e,t){this.restrictedLevels=[],t.video&&this.startCapping(),this.onLevelsUpdated()}onLevelsUpdated(){if(this.hls){if((this.timer||this.observer)&&(tW(this.autoLevelCapping)||this.clientRect))this.detectPlayerSize();else if(void 0===this.observer&&void 0===this.timer){let e=this.hls.levels;e.length>1&&e.some(e=>!!e.videoCodec)&&this.startCapping()}}}onBufferCodecs(e,t){t.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0||!this.hls){this.clientRect=null;return}let e=this.hls.levels;if(e.length>1){let t=this.hls,i=this.getMaxLevel(e.length-1);i!==this.autoLevelCapping&&t.logger.log("Setting autoLevelCapping to ".concat(i,": ").concat(e[i].height,"p@").concat(e[i].bitrate," for media ").concat(this.mediaWidth,"x").concat(this.mediaHeight)),t.autoLevelCapping=i,t.autoLevelEnabled&&t.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=t.autoLevelCapping}else 1===e.length&&this.stopCapping()}}getMaxLevel(e){if(!this.hls)return -1;let t=this.hls.levels;if(!t.length)return -1;let i=t.filter((t,i)=>this.isLevelAllowed(t)&&i<=e);return this.observer||(this.clientRect=null),sw.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)}observe(){let e=self.ResizeObserver;e&&(this.observer=new e(e=>{var t;let i=null==(t=e[0])?void 0:t.contentRect;i&&(this.clientRect=i,this.detectPlayerSize())})),this.observer&&this.media&&this.observer.observe(this.media)}startCapping(){var e;this.timer||this.observer||null==(e=this.hls)||!e.config.capLevelToPlayerSize||(self.clearInterval(this.timer),this.timer=void 0,this.autoLevelCapping=1/0,this.observe(),this.observer||(this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3)),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.autoLevelCapping=1/0,this.timer&&(self.clearInterval(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;let e=this.media,t={width:0,height:0};if(e){let i=e.getBoundingClientRect();t.width=i.width,t.height=i.height,t.width||t.height||(t.width=i.right-i.left||e.width||0,t.height=i.bottom-i.top||e.height||0)}return this.clientRect=t,t}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls)return e;let{ignoreDevicePixelRatio:t,maxDevicePixelRatio:i}=this.hls.config;if(!t)try{e=self.devicePixelRatio}catch(e){}return Math.min(e,i)}isLevelAllowed(e){return!this.restrictedLevels.some(t=>e.bitrate===t.bitrate&&e.width===t.width&&e.height===t.height)}static getMaxLevelByMediaSize(e,t,i){if(!(null!=e&&e.length))return -1;let r=(e,t)=>!t||e.width!==t.width||e.height!==t.height,n=e.length-1,a=Math.max(t,i);for(let t=0;t<e.length;t+=1){let i=e[t];if((i.width>=a||i.height>=a)&&r(i,e[t+1])){n=t;break}}return n}constructor(e){this.hls=null,this.autoLevelCapping=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.observer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=1/0,this.media=null,this.restrictedLevels=[],this.clientRect=null,this.registerListeners()}}var sC=class e{constructor(t,i){Array.isArray(t)&&(t=t.map(t=>t instanceof e?t:new e(t))),this.value=t,this.params=i}};let sM="Bare Item",sP=/[\x00-\x1f\x7f]+/;var sO=class{constructor(e){this.description=e}};
3function sx(e,t,i){return Error("failed to ".concat("serialize",' "').concat(Array.isArray(e)?JSON.stringify(e):e instanceof Map?"Map{}":e instanceof Set?"Set{}":"object"==typeof e?JSON.stringify(e):String(e),'" as ').concat(t),{cause:i})}function sN(e){if(e<-0x38d7ea4c67fff||0x38d7ea4c67fff<e)throw sx(e,"Integer");return e.toString()}function sU(e){let t=e.description||e.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(t))throw sx(t,"Token");return t}function sF(e){switch(typeof e){case"number":if(!tW(e))throw sx(e,sM);if(Number.isInteger(e))return sN(e);let t=function e(t,i){if(t<0)return-e(-t,i);let r=Math.pow(10,i);if(!(Math.abs(t*r%1-.5)<Number.EPSILON))return Math.round(t*r)/r;{let e=Math.floor(t*r);return(e%2==0?e:e+1)/r}}(e,3);if(Math.floor(Math.abs(t)).toString().length>12)throw sx(e,"Decimal");let i=t.toString();return i.includes(".")?i:"".concat(i,".0");case"string":if(sP.test(e))throw sx(e,"String");return'"'.concat(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"');case"symbol":return sU(e);case"boolean":if("boolean"!=typeof e)throw sx(e,"Boolean");return e?"?1":"?0";case"object":if(e instanceof Date)return"@".concat(sN(e.getTime()/1e3));if(e instanceof Uint8Array){if(!1===ArrayBuffer.isView(e))throw sx(e,"Byte Sequence");return":".concat(btoa(String.fromCharCode(...e)),":")}if(e instanceof sO)return sU(e);default:throw sx(e,sM)}}function sB(e){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(e))throw sx(e,"Key");return e}function sG(e){return null==e?"":Object.entries(e).map(e=>{let[t,i]=e;return!0===i?";".concat(sB(t)):";".concat(sB(t),"=").concat(sF(i))}).join("")}function sH(e){return e instanceof sC?"".concat(sF(e.value)).concat(sG(e.params)):sF(e)}function sK(e,t){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{whitespace:!0};if("object"!=typeof e||null==e)throw sx(e,"Dict");let i=e instanceof Map?e.entries():Object.entries(e),r=null!=t&&t.whitespace?" ":"";return Array.from(i).map(e=>{let[t,i]=e;i instanceof sC==!1&&(i=new sC(i));let r=sB(t);if(!0===i.value)r+=sG(i.params);else if(r+="=",Array.isArray(i.value)){var n;r+=(n=i,"(".concat(n.value.map(sH).join(" "),")").concat(sG(n.params)))}else r+=sH(i);return r}).join(",".concat(r))}(e,t)}let sW=["url"],sV=["version","eventTargets","sid","transmissionMode"],sq=["customData","headers"],sY=e=>e instanceof sC?new sC(Math.round(e.value),e.params):Math.round(e),sj=e=>Array.isArray(e)?e.map(sY):sY(e),sz=(e,t)=>Array.isArray(e)?e.map(e=>sz(e,t)):e instanceof sC&&"string"==typeof e.value?new sC(sz(e.value,t),e.params):(t.baseUrl&&(e=function(e,t){let i;try{i=new URL(e)}catch(t){return e}let r=new URL(t);if(i.origin!==r.origin)return e;let n=i.pathname.split("/").slice(1),a=r.pathname.split("/").slice(1,-1),s=Math.min(n.length,a.length);for(let e=0;e<s&&n[e]===a[e];e++)n.shift(),a.shift();for(;a.length;)a.shift(),n.unshift("..");return n.join("/")+i.search+i.hash}(e,function(e){let t="string"==typeof e?new URL(e):e;return t.origin+t.pathname.substring(0,t.pathname.lastIndexOf("/")+1)}(t.baseUrl))),1===t.version?encodeURIComponent(e):e),sQ=e=>e instanceof sC?new sC(100*Math.round(e.value/100),e.params):100*Math.round(e/100),sX=e=>Array.isArray(e)?e.map(sQ):sQ(e),sZ={br:sj,d:sj,bl:sX,dl:sX,mtp:sX,nor:(e,t)=>{let i=e;return t.version>=2&&(e instanceof sC&&"string"==typeof e.value?i=new sC([e]):"string"==typeof e&&(i=[e])),sz(i,t)},rtp:sX,tb:sj},sJ={BITRATE_CHANGE:"bc",ERROR:"e",RESPONSE_RECEIVED:"rr",CUSTOM_EVENT:"ce"},s$=new Map([["ps","sta"],["pr","pr"],["c","cid"],["b","bg"],["bc","br"]]),s0="event",s1="request",s2=["cen","e","h","ts"],s3=["ab","bg","bl","br","bs","bsa","bsd","bsda","cdn","cid","cs","d","dfa","dl","ec","lab","lb","ltc","msd","mtp","nor","nr","ot","pb","pr","pt","rtp","sf","sid","sn","st","sta","su","tab","tb","tbl","tpb","v"],s4=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function s5(e){return s4.test(e)}let s8=new Set(s3);function s6(e){return s8.has(e)||s5(e)}let s9=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],s7=new Set(s9),oe=new Set(s2),ot=new Set(["ab","bl","br","bsa","bsd","bsda","lab","lb","mtp","pb","tab","tb","tbl","tpb"]),oi=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","
3sf","sid","st","su","tb","v"],or=new Set(oi);function on(e){return or.has(e)||s5(e)}let oa=new Set(["ot","sf","st","e","sta"]),os={[s0]:function(e){return s6(e)||s7.has(e)||oe.has(e)},[s1]:s6};function oo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={};if(null==e||"object"!=typeof e)return i;let r=t.version||e.v||2,n=t.reportingMode||s1,a=1===r?function(e){let t={};for(let[r,n]of Object.entries(e)){if(null==n){t[r]=n;continue}if("nor"===r){let e=(Array.isArray(n)?n:[n])[0];if(e instanceof sC){var i;t.nor=e.value,null!=(i=e.params)&&i.r&&(t.nrr=e.params.r)}else t.nor=e}else ot.has(r)?t[r]=function e(t,i){if(Array.isArray(t)){let r;return i&&(r=t.find(e=>{var t;return(null==(t=e.params)?void 0:t.ot)===i})),r||(r=t[0]),e(r)}return t instanceof sC?t.value:t}(n,e.ot):t[r]=n}return t}(e):e,s=1===r?on:os[n],o=Object.keys(a).filter(s);a.e&&"rr"!==a.e&&(o=o.filter(e=>!s7.has(e)));let l=t.filter;"function"==typeof l&&(o=o.filter(l));let d=n===s0;if(d){let e=a.e;o.includes("e")||null==e||o.push("e"),o.includes("ts")||o.push("ts"),o.includes("cen")||null==a.cen||"ce"!==e||o.push("cen");let t=e?s$.get(e):void 0;t&&null!=a[t]&&!o.includes(t)&&o.push(t)}if(0===o.length)return i;r>1&&!o.includes("v")&&o.push("v");let u={version:r,reportingMode:n,baseUrl:t.baseUrl};for(let e of(o.sort(),o)){var h,c,m;let n=a[e],s=null!=(h=null==(c=t.formatters)?void 0:c[e])?h:sZ[e];if("function"==typeof s&&(n=s(n,u)),"v"===e)if(1===r)continue;else n=r;if("pr"===e&&1===n&&!(d&&"pr"===a.e))continue;d&&"ts"===e&&!tW(n)&&(n=Date.now());let o=d&&!1===n&&"bg"===e&&"b"===a.e;(("number"==typeof(m=n)?tW(m):null!=m&&""!==m&&!1!==m)||o)&&(oa.has(e)&&"string"==typeof n&&(n=new sO(n)),i[e]=n)}return i}let ol="CMCD-Object",od="CMCD-Request",ou="CMCD-Session",oh="CMCD-Status",oc={REQUEST:od},om={ab:ol,br:ol,d:ol,lab:ol,lb:ol,ot:ol,tab:ol,tb:ol,tpb:ol,bl:od,cs:od,dfa:od,dl:od,ltc:od,mtp:od,nor:od,nrr:od,pb:od,sn:od,sta:od,su:od,tbl:od,cid:ou,msd:ou,sf:ou,sid:ou,st:ou,v:ou,bg:oh,bs:oh,bsa:oh,bsd:oh,bsda:oh,cdn:oh,ec:oh,nr:oh,pr:oh,pt:oh,rtp:oh},of="CMCD";function op(e){return sK(e,{whitespace:!1})}let og=[...oi,...s3,...s9,...s2].filter((e,t,i)=>i.indexOf(e)===t),ov={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",TIMED_TEXT:"tt"},oE={STARTING:"s",PLAYING:"p",SEEKING:"k",REBUFFERING:"r",PAUSED:"a",ENDED:"e",FATAL_ERROR:"f",PRELOADING:"d"},oy="query",ob="headers";function oT(e,t,i){var r;let n=new Set(null!=(r=t.enabledKeys)?r:[]);return{version:t.version||2,reportingMode:e,filter:e=>n.has(e),baseUrl:i}}let o_=Object.is,oA=e=>e,oS=Array.from(s$,e=>{let[t,i]=e;return"br"===i?{event:t,field:i,equal:(e,t)=>void 0===e||void 0===t?e===t:function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],n=t[i];if(r===n)continue;if("number"==typeof r||"number"==typeof n||r.value!==n.value)return!1;let a=r.params,s=n.params,o=a&&Object.keys(a)[0],l=s&&Object.keys(s)[0];if(o!==l||void 0!==o&&void 0!==l&&a&&s&&a[o]!==s[l])return!1}return!0}(e,t),snapshot:e=>e.slice()}:{event:t,field:i,equal:o_,snapshot:oA}}),oR=new Map(oS.map(e=>[e.event,e]));function ok(e){let{url:t}=e;return fetch(t,ie(e,sW))}var oI=class{start(){this.eventTargets.forEach((e,t)=>{if(this.disarmInterval(e),0===t.interval||!t.events.includes("t"))return;let i=()=>{this.recordTargetEvent(e,t,"t"),this.processEventTargets()};e.intervalId=setInterval(i,1e3*t.interval),i()})}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&this.flush(),this.eventTargets.forEach(e=>{this.disarmInterval(e)})}flush(){this.processEventTargets(!0)}update(e){for(let t of(e.sid&&e.sid!==this.data.sid&&this.resetSession(),e.msd&&!isNaN(e.msd)&&(this.msd=e.msd),this.data=t7(t7(t7({},this.data),e),{},{msd:void 0}),oS))t.field in e&&!t.equal(this.data[t.field],this.lastEmitted[t.field])&&this.recordEvent(t.event)}recordEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=oR.get(e);if(i){let e=i.field,r=t[e];void 0!==r&&t6(this.data,{[e]:r});let n=this.data[e];if(void 0===n||i.equal(n,this.lastEmitted[e]))return;t6(this.lastEmitted,{[e]:i.snapshot(n)})}
3this.eventTargets.forEach((i,r)=>{this.recordTargetEvent(i,r,e,t)}),this.processEventTargets()}recordTargetEvent(e,t,i){var r;let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!t.events.includes(i))return;let a=t7(t7(t7({},this.data),n),{},{e:i,ts:null!=(r=n.ts)?r:Date.now(),sn:e.sn++});isNaN(this.msd)||e.msdSent||(a.msd=this.msd,e.msdSent=!0),e.queue.push(a)}recordResponseReceived(e){var t,i,r;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{request:a}=e,s=null!=(t=n.url)?t:null==a?void 0:a.url;if(!s)return;let o=new URL(s);o.searchParams.delete(of);let l={url:o.toString(),rc:e.status},d=e.resourceTiming;d&&(null!=d.startTime&&(l.ts=Math.round(this.timeOrigin+d.startTime),null!=d.responseStart&&(l.ttfb=Math.round(d.responseStart-d.startTime))),null!=d.duration&&(l.ttlb=Math.round(d.duration)));let u=null!=(i=null==(r=a.customData)?void 0:r.cmcd)?i:{};this.recordEvent("rr",t7(t7(t7({},u),l),n))}applyRequestReport(e){var t;return null!=(t=this.createRequestReport(e))?t:e}isRequestReportingEnabled(){var e;return!!(null!=(e=this.config.enabledKeys)&&e.length)}createRequestReport(e,t){var i;let{customData:r={},headers:n={}}=e,a=t7(t7({},ie(e,sq)),{},{headers:t7({},n),customData:t7(t7({},r),{},{cmcd:{}})});if(!(null!=(i=this.config.enabledKeys)&&i.length)||!a.url)return a;let s=new URL(a.url),o=t7(t7(t7({},this.data),t),{},{sn:this.requestTarget.sn++}),l=oT(s1,this.config,a.url);isNaN(this.msd)||this.requestTarget.msdSent||(o.msd=this.msd,this.requestTarget.msdSent=!0);let d=a.customData.cmcd=oo(o,l);switch(this.config.transmissionMode){case oy:let u=op(d);u&&(s.searchParams.set(of,u),a.url=s.toString());break;case ob:t6(a.headers,function(e,t){let i={};for(let[r,n]of Object.entries(function(e,t){var i;let r={};if(!e)return r;let n=Object.keys(e),a=t?Object.keys(t).reduce((e,i)=>{var r;return null==(r=t[i])||r.forEach(t=>e[t]=i),e},{}):{};for(let t of n){let n=om[t]||a[t]||oc.REQUEST;(null!=(i=r[n])?i:r[n]={})[t]=e[t]}return r}(e,t))){let e=sK(n,{whitespace:!1});e&&(i[r]=e)}return i}(d,l.customHeaderMap))}return a}processEventTargets(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=!1;this.eventTargets.forEach((i,r)=>{let{queue:n}=i;if(!n.length||n.length<r.batchSize&&!e)return;let a=e?n.length:r.batchSize,s=n.splice(0,a);this.sendEventReport(r,s).catch(()=>{i.queue.unshift(...s)}),t||(t=n.length>0)}),t&&this.processEventTargets()}async sendEventReport(e,t){let i=oT(s0,e),{status:r}=await this.requester({url:e.url,method:"POST",headers:{"Content-Type":"application/cmcd"},body:t.map(e=>(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e?op(oo(e,t)):""})(e,i)).join("\n")+"\n"});if(410===r)this.disposeEventTarget(e);else if(429===r||r>499&&r<600)throw Error("Event report failed with status ".concat(r))}disarmInterval(e){clearInterval(e.intervalId),e.intervalId=void 0}disposeEventTarget(e){let t=this.eventTargets.get(e);t&&(this.disarmInterval(t),this.eventTargets.delete(e))}resetSession(){this.eventTargets.forEach(e=>e.sn=0),this.requestTarget.sn=0,this.lastEmitted={}}constructor(e,t=ok){var i;for(let r of(this.timeOrigin=performance.timeOrigin||(null==(i=performance.timing)?void 0:i.fetchStart)||Date.now()-performance.now(),this.data={},this.msd=NaN,this.eventTargets=new Map,this.lastEmitted={},this.requestTarget={sn:0,msdSent:!1},this.config=function(e){let{version:t=2,eventTargets:i=[],sid:r=ik(),transmissionMode:n=oy}=e;return t7(t7({},ie(e,sV)),{},{version:t,transmissionMode:n,sid:r,eventTargets:i.reduce((e,t)=>{var i,r,n;return null!=t&&t.url&&null!=(i=t.events)&&i.length&&e.push({version:t.version||2,enabledKeys:(null==(r=t.enabledKeys)?void 0:r.slice())||[],url:t.url,events:t.events.slice(),interval:null!=(n=t.interval)?n:30,batchSize:t.batchSize||1}),e},[])})}(e),this.data={cid:this.config.cid,sid:this.config.sid,v:this.config.version},this.requester=t,this.config.eventTargets))this.eventTargets.set(r,{intervalId:void 0,sn:0,msdSent:!1,queue:[]})}};let oL={HLS:"h"},oD={VOD:"v",LIVE:"l",LOW_LATENCY:"ll"},ow=["includeKeys"];function oC(e){return Object.keys(e).every(s5)}function oM(e,t,i,r){e&&Object.keys(t).forEach(n=>{let a=e.filter(e=>e.groupId===n).map(e=>{let a=t6({},e);return a.details=void 0,a.attrs=new nE(a.attrs),a.url=a.attrs.URI=oP(e.url,e.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",i),a.groupId=a.attrs["GROUP-ID"]=t[n],a.attrs["PATHWAY-ID"]=r,a});e.push(...a)})}function oP(e,t,i,r){if(t){let{[i]:e}=r;if(e){let i=e[t];if(i)return i}}let{HOST:n,PARAMS:a}=r,s=new self.URL(e);
3return n&&(s.hostname=n),a&&Object.keys(a).sort().forEach(e=>{e&&rI(s,e,a[e])}),s.href}class oO{get errored(){return this.error}set errored(e){this.error=e,this.emitter.eventNames().length&&this.emitter.emit("error",e)}get hasListeners(){return this.emitter.eventNames().length>0}get resolved(){return this.ok}resolve(){this.ok=!0,this.emitter.emit("resolved")}get useable(){return this.ok?Promise.resolve():this.error?Promise.reject(this.error):new Promise((e,t)=>{this.emitter.on("error",t),this.emitter.on("resolved",e)})}reset(){this.emitter.removeAllListeners();let e=this.licenseXhr;e&&(e.readyState!==XMLHttpRequest.DONE&&e.abort(),this.licenseXhr=void 0),this.onmessage=this.onkeystatuseschange=void 0}constructor(){this.status="initialized",this.requestErrors=[],this.licenseXhr=void 0,this.onmessage=void 0,this.onkeystatuseschange=void 0,this.emitter=new ap,this.error=void 0,this.ok=void 0}}class ox extends Error{constructor(e,t){super(t),this.data=void 0,e.error||(e.error=Error(t)),this.data=e,e.err=e.error}}class oN extends im{destroy(){this.onDestroying(),this.onMediaDetached();let e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){let{hls:e}=this;
3e&&(e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHED,this.onMediaDetached,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.DESTROYING,this.onDestroying,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHED,this.onMediaDetached,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.DESTROYING,this.onDestroying,this))}attemptKeySystemAccess(e){if(!this.hls)return Promise.reject(Error("destroyed"));let t=this.hls.levels,i=(e,t,i)=>!!e&&i.indexOf(e)===t,r=t.map(e=>e.audioCodec).filter(i),n=t.map(e=>e.videoCodec).filter(i);return r.length+n.length===0&&n.push("avc1.42e01e"),new Promise((t,i)=>{let a=e=>{let s=e.shift();this.getMediaKeysPromise(s,r,n).then(e=>t({keySystem:s,mediaKeys:e})).catch(t=>{e.length?a(e):t instanceof ox?i(t):i(new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_NO_ACCESS,error:t,fatal:!0},t.message))})};a(e)})}requestMediaKeySystemAccess(e,t){let{requestMediaKeySystemAccessFunc:i}=this.config;if("function"!=typeof i){let e="Configured requestMediaKeySystemAccess is not a function ".concat(i);return null===nx&&"http:"===self.location.protocol&&(e="navigator.requestMediaKeySystemAccess is not available over insecure protocol ".concat(location.protocol)),Promise.reject(Error(e))}return i(e,t)}getMediaKeysPromise(e,t,i){var r;let n=function(e,t,i,r){var n,a,s,o;let l;switch(e){case nD.FAIRPLAY:l=["cenc","sinf"];break;case nD.WIDEVINE:case nD.PLAYREADY:l=["cenc"];break;case nD.CLEARKEY:l=["cenc","keyids"];break;default:throw Error("Unknown key-system: ".concat(e))}return n=l,a=t,s=i,[{initDataTypes:n,persistentState:(o=r).persistentState||"optional",distinctiveIdentifier:o.distinctiveIdentifier||"optional",sessionTypes:o.sessionTypes||[o.sessionType||"temporary"],audioCapabilities:a.map(e=>({contentType:"audio/mp4; codecs=".concat(e),robustness:o.audioRobustness||"",encryptionScheme:o.audioEncryptionScheme||null})),videoCapabilities:s.map(e=>({contentType:"video/mp4; codecs=".concat(e),robustness:o.videoRobustness||"",encryptionScheme:o.videoEncryptionScheme||null}))}]}(e,t,i,this.config.drmSystemOptions||{}),a=this.keySystemAccessPromises[e],s=null==(r=a)?void 0:r.keySystemAccess;if(!s){this.log('Requesting encrypted media "'.concat(e,'" key-system access with config: ').concat(rx(n))),s=this.requestMediaKeySystemAccess(e,n);let t=a=this.keySystemAccessPromises[e]={keySystemAccess:s};return s.catch(t=>{this.log('Failed to obtain access to key-system "'.concat(e,'": ').concat(t))}),s.then(i=>{this.throwIfDestroyed(),this.log('Access for key-system "'.concat(i.keySystem,'" obtained'));let r=this.fetchServerCertificate(e);this.log('Create media-keys for "'.concat(e,'"'));let n=t.mediaKeys=i.createMediaKeys().then(i=>(this.log('Media-keys created for "'.concat(e,'"')),t.hasMediaKeys=!0,r.then(t=>t?this.setMediaKeysServerCertificate(i,e,t):i)));return n.catch(t=>{this.error('Failed to create media-keys for "'.concat(e,'"}: ').concat(t))}),n})}return s.then(()=>a.mediaKeys)}getMediaKeySessionContext(e,t,i,r){let{mediaKeySessions:n}=this,a=' key-session "'.concat(e,'" keyId: ').concat(iN(i.keyId||[])," keyUri: ").concat(i.uri,' for "').concat(r,'"');for(let e=0;e<n.length;e++){let t=n[e];if(!t.initialized&&t.createdFor.levelKey.uri===i.uri)return this.log("Reusing".concat(a)),t}this.log("Creating".concat(a));let s=t.createSession(),o={keySystem:e,mediaKeys:t,mediaKeysSession:s,keyRequests:{},keyStatuses:{},createdFor:{levelKey:i,reason:r},initialized:!1};return n.push(o),o}resetMediaKeys(){var e;let t=null==(e=this.mediaKeySessions[0])?void 0:e.keySystem,i=this.keySystemAccessPromises[t];i&&(this.log("reset mediaKeys"),this.mediaKeys=null,i.hasMediaKeys=!1,delete i.mediaKeys,delete this.keySystemAccessPromises[t])}updateKeySession(e,t,i){let r=e.mediaKeysSession;return this.log('Updating key-session "'.concat(r.sessionId,'" for keyId ').concat(iN(t.keyId||[]),"\n      } (data length: ").concat(i.byteLength,")")),r.update(i)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(e=>{let{hasMediaKeys:t}=e;return!!t}).map(e=>{let{keySystem:t}=e;return nP(t)}).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(e=>{let{keySystem:t,mediaKeys:i}=e;return this.attemptSetMediaKeys(t,i)})}selectKeySystem(e){return this.getKeySystemSelectionPromise(e).then(e=>{let{keySystem:t}=e,i=nP(t);if(!i)throw Error('Unable to find format for key-system "'.concat(t,'"'));return i})}selectKeySystemFormat(e){let t=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log("Selecting key-system from fragment (sn: ".concat(e.sn," ").concat(e.type,": ").concat(e.level,") key formats ").concat(t.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(t)),this.keyFormatPromise}getKeyFormatPromise(e){let t=nO(this.config),i=e.map(nC).filter(e=>!!e&&-1!==t.indexOf(e));return this.selectKeySystem(i)}loadClear(e,t,i){if(this.config.emeEnabled&&!this.getSelectedKeySystemFormats().length){if(t.length)for(let r=0,n=t.length;r<n;r++){let a=t[r];if(e.cc<=a.cc&&(!t2(e)||!t2(a)||e.sn<a.sn)||!i&&r==n-1)return this.selectKeySystemFormat(a).then(e=>{if(!this.hls)return;a.setKeyFormat(e);let t=nC(e);if(t)return this.getKeySystemAccess([t])})}if(this.config.requireKeySystemAccessOnStart){let e=nO(this.config);if(e.length)return this.getKeySystemAccess(e)}}return null}getKeyStatus(e){let{mediaKeySessions:t}=this;for(let i=0;i<t.length;i++){let r=oU(e,t[i]);if(r)return r}}loadKey(e){let t=e.decryptdata,i=this.getKeyStatus(t);if("internal-error"===i){let r=oF(i,t);return r.data.frag=e,this.error("".concat(r.message," (").concat(iN(t.keyId||[]),")")),Promise.reject(r)}let r=e.type,n=this.activeKeys,a=n[r];a&&!t.matches(a.decryptdata)&&(n.previous||(n.previous=[]),n.previous.push(a),delete n[r]),n[r]||(n[r]=e);for(let e=this.mediaKeySessions.length;e--;){let i=this.mediaKeySessions[e];if(t.keyId&&"expired"===i.keyStatuses[iN(t.keyId)])return this.renewKeySession(t,i)}return this.updateUsablePromise(t,"playlist-key",e)}renewKeySession(e,t){return this.resetMediaKeys(),this.removeSession(t).then(()=>(this.throwIfDestroyed(),this.updateUsablePromise(e,"expired")))}updateUsablePromise(e,t,i){let r=this.getSessionForKey(e,t);return r.catch(e=>this.handleError(e,i)),r.then(t=>e)}getSessionForKey(e,t){let i,r=this.findContextForKey(e);if(void 0!==r)return Promise.resolve(r);let n=e.uri,a=this.sessionSetupByUri[n];i=void 0===a?this.resolveSessionForKey(e,t):a.catch(()=>void 0).then(()=>(this.throwIfDestroyed(),this.resolveSessionForKey(e,t))),this.sessionSetupByUri[n]=i;let s=()=>{this.sessionSetupByUri[n]===i&&delete this.sessionSetupByUri[n]};return i.then(s,s),i}findContextForKey(e){let{mediaKeySessions:t}=this;for(let i=t.length;i--;){let r=t[i];if(oU(e,r))return r}}resolveSessionForKey(e,t){return this.getKeySystemForKeyPromise(e).then(i=>{let{keySystem:r,mediaKeys:n}=i;this.throwIfDestroyed();for(let i=this.mediaKeySessions.length;i--;){let r=this.mediaKeySessions[i];if(oU(e,r))return r;let n=this.getUsableKeyPromise(r,e,t);if(n)return n}return this.attemptSetMediaKeys(r,n).then(()=>(this.throwIfDestroyed(),this.getMediaKeySessionContext(r,n,e,t))).then(i=>{this.throwIfDestroyed();let r=e.scheme||"cenc",n=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(i,e,r,n,t)})})}getUsableKeyPromise(e,t,i){let r=e.keyRequests[t.uri];if(r)return this.log("Waiting for usable key (".concat(i," keyId: ").concat(function(e){if(e.keyFormat===nw.FAIRPLAY)return e.uri;if(null===e.keyId)throw Error("keyId is null");return iN(e.keyId)}(t),' format: "').concat(t.keyFormat,'" URI: ').concat(t.uri,")")),r.useable.then(()=>e)}throwIfDestroyed(){if(arguments.length>0&&void 0!==arguments[0]&&arguments[0],!this.hls)throw Error("invalid state")}handleError(e,t){if(this.hls)if(e instanceof ox){t&&(e.data.frag=t);let i=e.data.decryptdata;this.error("".concat(e.message).concat(i?" (".concat(iN(i.keyId||[]),")"):"")),this.hls.trigger(tz.ERROR,e.data)}else this.error(e.message),this.hls.trigger(tz.ERROR,{type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}
3getKeySystemForKeyPromise(e){let t=nC(e.keyFormat),i=t?[t]:nO(this.config);return this.attemptKeySystemAccess(i)}getKeySystemSelectionPromise(e){if(e.length||(e=nO(this.config)),0===e.length)throw new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},"Missing key-system license configuration options ".concat(rx({drmSystems:this.config.drmSystems})));return this.attemptKeySystemAccess(e)}activeLevelKeys(){let e=this.activeKeys,t=(e.previous||[]).map(e=>e.decryptdata);return e.audio&&t.unshift(e.audio.decryptdata),e.main&&t.unshift(e.main.decryptdata),t}attemptSetMediaKeys(e,t){if(this.mediaResolved=void 0,this.mediaKeys===t)return Promise.resolve();let i=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'.concat(e,'"'));let r=Promise.all(i).then(()=>this.media?this.media.setMediaKeys(t):new Promise((e,i)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return i(Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=t,this.media.setMediaKeys(t).then(e).catch(i)}}));return this.mediaKeys=t,this.setMediaKeysQueue.push(r),r.then(()=>{this.log('Media-keys set for "'.concat(e,'"')),i.push(r),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(e=>-1===i.indexOf(e))})}filterInitData(e,t,i,r,n){var a,s;let o=null==(a=this.config.drmSystems)||null==(a=a[e.keySystem])?void 0:a.generateRequest;if(o)try{let a=o.call(this.hls,i,r,t6({},e,{decryptdata:t,reason:n}),n);if(!a)throw Error("Invalid response from configured generateRequest filter");t.scheme=a.initDataType?a.initDataType:"cenc";let s=a.initData?a.initData:null;return t.pssh=s?new Uint8Array(s):null,a}catch(e){if(this.warn(e.message),null!=(s=this.hls)&&s.config.debug)throw e}return{initDataType:i,initData:r}}generateRequestWithPreferredKeySession(e,t,i,r,n){let a=this.getUsableKeyPromise(e,t,n);if(a)return a;let s=this.filterInitData(e,t,i,r,n);if(s&&(r=s.initData?s.initData:null,i=s.initDataType),null===r)if(n.startsWith("encrypted-event"))return Promise.reject(Error('missing initialization data for "'.concat(n,'"')));else return this.log('Skipping key-session request for "'.concat(n,'" (no initData)')),Promise.resolve(e);let o=t.uri,l=new oO;e.keyRequests[o]=l;let d=i=>{let r=e.mediaKeysSession;if(!r){l.errored=Error("invalid state");return}let{messageType:n,message:a}=i;l.status=n,this.log('"'.concat(n,'" message event for session "').concat(r.sessionId,'" message size: ').concat(a.byteLength)),"license-request"===n||"license-renewal"===n?this.renewLicense(e,t,a).catch(t=>{l.errored=t,l.hasListeners||this.handleError(t),this.removeSession(e)}):"license-release"===n?e.keySystem===nD.FAIRPLAY&&this.updateKeySession(e,t,nR("acknowledged")).then(()=>this.removeSession(e)).catch(e=>this.handleError(e)):this.warn('unhandled media key message type "'.concat(n,'"'))};return l.onmessage=d,as(e.mediaKeysSession,"message",d),this.generateRequest(e,t,i,r,n,!1)}generateRequest(e,t,i,r,n,a){if(a){let a=this.filterInitData(e,t,i,r,n);a&&(r=a.initData?a.initData:r,i=a.initDataType)}let s=t.uri,o=e.keyRequests[s],l=iN(t.keyId||[]),d=e=>{let i;e.startsWith("usable")?o.resolve():"internal-error"===e||"output-restricted"===e||"output-downscaled"===e?i=oF(e,t):"expired"===e?i=Error("key expired (keyId: ".concat(l,")")):"released"===e?i=Error("key released"):"status-pending"===e||this.warn('unhandled key status change "'.concat(e,'" (keyId: ').concat(l,")")),i&&(o.errored=i,o.hasListeners||this.handleError(i))},u=i=>{var r,n;if(!e.mediaKeysSession){o.errored=Error("invalid state");return}let a=e.keyStatuses=this.getKeyStatuses(e);if(!Object.keys(a).some(e=>"status-pending"!==a[e]))return;let s=this.activeLevelKeys();for(let i=0;i<s.length;i++)if("expired"===a[iN(s[i].keyId||[])]){this.log("Expired key ".concat(rx(a),' in key-session "').concat(null==(r=e.mediaKeysSession)?void 0:r.sessionId,'"')),this.renewKeySession(t,e).catch(e=>this.handleError(e));break}let u=a[l];u?d(u):(e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(n=e.keyStatusTimeouts)[l]||(n[l]=self.setTimeout(()=>{var i,r;if(!e.mediaKeysSession)return;let n=this.getKeyStatus(t);if(n&&"status-pending"!==n)return this.log("No status for keyId ".concat(l,' in key-session "').concat(null==(r=e.mediaKeysSession)?void 0:r.sessionId,'". Using session key-status ').concat(n," from other session.")),d(n);this.log("key status for ".concat(l,' in key-session "').concat(null==(i=e.mediaKeysSession)?void 0:i.sessionId,'" timed out after ').concat(1e3,"ms")),d(u="internal-error")},1e3)),this.log("No status for keyId ".concat(l," (").concat(rx(a),").")))};o.onkeystatuseschange=u,as(e.mediaKeysSession,"keystatuseschange",u);let h=o.useable;return this.log('Generating key-session request for "'.concat(n,'" keyId: ').concat(l," URI: ").concat(s," (init data type: ").concat(i," length: ").concat(r.byteLength,")")),o.status="started",e.initialized=!0,e.mediaKeysSession.generateRequest(i,r).then(()=>{var t;o.status="generated",this.log('Request generated for key-session "'.concat(null==(t=e.mediaKeysSession)?void 0:t.sessionId,'" keyId: ').concat(l," URI: ").concat(s))}).catch(e=>{throw this.log("mediaKeysSession.generateRequest failed: ".concat(e)),new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_NO_SESSION,error:e,decryptdata:t,fatal:!1},"Error generating key-session request: ".concat(e))}).then(()=>h).catch(t=>{var i;this.log("mediaKeysSession.generateRequest failed: ".concat(t));let r=null==(i=t.data)?void 0:i.details;return(r===tj.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED||r===tj.KEY_SYSTEM_STATUS_INTERNAL_ERROR)&&Object.keys(e.keyStatuses).some(t=>"usable"===e.keyStatuses[t])?(this.handleError(t),e):this.removeSession(e).then(()=>{throw t})}).then(()=>e)}getKeyStatuses(e){let t={},i=e.mediaKeysSession.sessionId;
3return e.mediaKeysSession.keyStatuses.forEach((r,n)=>{if("string"==typeof n&&"object"==typeof r){let e=n;n=r,r=e}let a="buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n);e.keySystem===nD.PLAYREADY&&16===a.length&&(t[iN(a)]=r,nk(a));let s=iN(a);this.log('key status change "'.concat(r,'" for keyStatuses keyId: ').concat(s,' key-session "').concat(i,'"')),t[s]=r}),t}fetchServerCertificate(e){let t=this.config,i=new t.loader(t),r=function(e,t){let{drmSystems:i}=t,r=null==i?void 0:i[e];if(r)return r.serverCertificateUrl}(e,t);return r?(this.log('Fetching server certificate for "'.concat(e,'"')),new Promise((n,a)=>{let s={type:tJ.SERVER_CERTIFICATE,responseType:"arraybuffer",url:r},o=t.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};i.load(s,l,{onSuccess:(e,t,i,r)=>{n(e.data)},onError:(t,i,n,o)=>{a(new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:t7({url:s.url,data:void 0},t)},'"'.concat(e,'" certificate request failed (').concat(r,"). Status: ").concat(t.code," (").concat(t.text,")")))},onTimeout:(t,i,n)=>{a(new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:s.url,data:void 0}},'"'.concat(e,'" certificate request timed out (').concat(r,")")))},onAbort:(e,t,i)=>{a(Error("aborted"))}})})):(this.log('No Server Certificate in config.drmSystems["'.concat(e,'"]')),Promise.resolve())}setMediaKeysServerCertificate(e,t,i){return new Promise((r,n)=>{e.setServerCertificate(i).then(n=>{this.log("setServerCertificate ".concat(n?"success":"not supported by CDM"," (").concat(i.byteLength,') on "').concat(t,'"')),r(e)}).catch(e=>{n(new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:e,fatal:!0},e.message))})})}renewLicense(e,t,i){return this.requestLicense(e,t,new Uint8Array(i)).then(i=>this.updateKeySession(e,t,new Uint8Array(i)).catch(e=>{throw new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:t,error:e,fatal:!1},e.message)}))}unpackPlayReadyKeyMessage(e,t){let i=iB(new Uint16Array(t.buffer));if(!i.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),t;let r=new DOMParser().parseFromString(i,"application/xml"),n=r.querySelectorAll("HttpHeader");if(n.length>0){let t;for(let i=0,r=n.length;i<r;i++){var a,s;let r=null==(a=(t=n[i]).querySelector("name"))?void 0:a.textContent,o=null==(s=t.querySelector("value"))?void 0:s.textContent;r&&o&&e.setRequestHeader(r,o)}}let o=r.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw Error("Cannot find <Challenge> in key message");return nR(atob(l))}setupLicenseXHR(e,t,i,r,n){let a=this.config.licenseXhrSetup;return a?Promise.resolve().then(()=>(this.throwIfDestroyed(),a.call(this.hls,e,t,t7(t7({},i),{},{decryptdata:r}),n))).catch(s=>{if(!i.mediaKeysSession)throw s;return e.open("POST",t,!0),a.call(this.hls,e,t,t7(t7({},i),{},{decryptdata:r}),n)}).then(i=>(e.readyState||e.open("POST",t,!0),{xhr:e,licenseChallenge:i||n})):(e.open("POST",t,!0),Promise.resolve({xhr:e,licenseChallenge:n}))}requestLicense(e,t,i){return new Promise((r,n)=>{let a=function(e,t){let{drmSystems:i,widevineLicenseUrl:r}=t,n=null==i?void 0:i[e];return n?n.licenseUrl:e===nD.WIDEVINE&&r?r:void 0}(e.keySystem,this.config);if(!a)return n(Error('no license server URL configured for key-system "'.concat(e.keySystem,'"')));let s=e.keyRequests[t.uri];if(!s)return n(Error("License emitter removed"));this.log("Sending license request to URL: ".concat(a));let o=this.config.keyLoadPolicy.default,l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return n(Error("invalid state"));if(4===l.readyState)if(200===l.status){s.requestErrors=[];let i=l.response;this.log("License received ".concat(i instanceof ArrayBuffer?i.byteLength:i));let n=this.config.licenseResponseCallback;if(n)try{i=n.call(this.hls,l,a,t7(t7({},e),{},{decryptdata:t}))}catch(e){this.error(e)}r(i)}else{let d=o.errorRetry,u=d?d.maxNumRetry:0;if(s.requestErrors.push({status:l.status,message:l.statusText}),s.requestErrors.length>u||l.status>=400&&l.status<500)n(new ox({type:tY.KEY_SYSTEM_ERROR,details:tj.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:t,fatal:!0,networkDetails:l,response:{url:a,data:void 0,code:l.status,text:l.statusText}},"License Request XHR failed (".concat(a,"). Status: ").concat(l.status," (").concat(l.statusText,")")));else{let a=u-s.requestErrors.length;this.warn("Retrying license request, ".concat(a," attempts left")),this.requestLicense(e,t,i).then(r,n)}}},s.licenseXhr&&s.licenseXhr.readyState!==XMLHttpRequest.DONE&&s.licenseXhr.abort(),s.licenseXhr=l,this.setupLicenseXHR(l,a,e,t,i).then(t=>{let{xhr:i,licenseChallenge:r}=t;e.keySystem==nD.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(i,r)),i.send(r)}).catch(n)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,t){if(!this.config.emeEnabled)return;let i=t.media;this.media=i,as(i,"encrypted",this.onMediaEncrypted),as(i,"waitingforkey",this.onWaitingForKey);let r=this.mediaResolved;r?r():this.mediaKeys=i.mediaKeys}onMediaDetached(){let e=this.media;e&&(ao(e,"encrypted",this.onMediaEncrypted),ao(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this.keyFormatPromise=null,this.keySystemAccessPromises={},this.activeKeys={},this.sessionSetupByUri={};let t=this.mediaResolved;if(t&&t(),!this.mediaKeys&&!this.mediaKeySessions.length)return;let i=this.media,r=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,nF.clearKeyUriToKeyIdMap();let n=r.length;oN.CDMCleanupPromise=Promise.all(r.map(e=>this.removeSession(e)).concat((null==i||null==(e=i.setMediaKeys(null))?void 0:e.catch(e=>
3{this.log("Could not clear media keys: ".concat(e)),this.hls&&this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:Error("Could not clear media keys: ".concat(e))})}))||Promise.resolve())).catch(e=>{this.log("Could not close sessions and clear media keys: ".concat(e)),this.hls&&this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error("Could not close sessions and clear media keys: ".concat(e))})}).then(()=>{n&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear(),this.keyFormatPromise=null}onManifestLoaded(e,t){let{sessionKeys:i}=t;if(i&&this.config.emeEnabled&&!this.keyFormatPromise){let e=i.reduce((e,t)=>(-1===e.indexOf(t.keyFormat)&&e.push(t.keyFormat),e),[]);this.log("Selecting key-system from session-keys ".concat(e.join(", "))),this.keyFormatPromise=this.getKeyFormatPromise(e),this.keyFormatPromise.catch(()=>{})}}removeSession(e){let{mediaKeysSession:t}=e;if(t){var i;this.log('Remove licenses and keys and close session "'.concat(t.sessionId,'"')),Object.keys(e.keyRequests).forEach(i=>{let r=e.keyRequests[i];r.onmessage&&t.removeEventListener("message",r.onmessage),r.onkeystatuseschange&&t.removeEventListener("keystatuseschange",r.onkeystatuseschange),r.reset(),e.keyRequests[i]=void 0}),e.mediaKeysSession=void 0;let r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);let{keyStatusTimeouts:n}=e;n&&Object.keys(n).forEach(e=>self.clearTimeout(n[e]));let{drmSystemOptions:a}=this.config;return(a&&("persistent-license"===a.sessionType||null!=(i=a.sessionTypes)&&i.some(e=>"persistent-license"===e))?new Promise((e,i)=>{self.setTimeout(()=>i(Error("MediaKeySession.remove() timeout")),8e3),t.remove().then(e).catch(i)}):Promise.resolve()).catch(e=>{this.log("Could not remove session: ".concat(e)),this.hls&&this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:Error("Could not remove session: ".concat(e))})}).then(()=>t.close()).then(()=>t.closed).catch(e=>{this.log("Could not close session: ".concat(e)),this.hls&&this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:Error("Could not close session: ".concat(e))})})}return Promise.resolve()}constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this.sessionSetupByUri={},this.mediaKeySessions=[],this.activeKeys={},this.mediaKeys=null,this.setMediaKeysQueue=oN.CDMCleanupPromise?[oN.CDMCleanupPromise]:[],this.onMediaEncrypted=e=>{let{initDataType:t,initData:i}=e,r='"'.concat(e.type,'" event: init data type: "').concat(t,'"');if(this.log(r),null!==i){if(!this.keyFormatPromise){let e=Object.keys(this.keySystemAccessPromises);e.length||(e=nO(this.config));let t=e.map(nP).filter(e=>!!e);this.keyFormatPromise=this.getKeyFormatPromise(t)}this.keyFormatPromise.then(n=>{var a,s,o;let l,d,u=nC(n),h=this.activeLevelKeys();if(u===nD.FAIRPLAY&&"sinf"===t)try{let e=iB(new Uint8Array(i)),t=iF(JSON.parse(e).sinf),r=i4(t);if(!r)throw Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(r.subarray(8,24))}catch(e){this.warn("".concat(r," Failed to parse sinf: ").concat(e));return}else if(u===nD.PLAYREADY)l=nN(new Uint8Array(i));else if(u===nD.WIDEVINE){let e=rt(i).filter(e=>e.systemId===nM.WIDEVINE);if(e.length){let t=e[0];l=null!=(a=t.kids)&&a.length?t.kids[0]:null}}if(l){let e=iN(l);for(let r=0;r<h.length;r++){let n=h[r];if(n.keyId&&(nT(l,n.keyId)||-1!==n.uri.replace(/-/g,"").indexOf(e))){n.pssh||(n.scheme=t,n.pssh=new Uint8Array(i),n.keyId=l,nF.setKeyIdForUri(n.uri,l)),d=this.getSessionForKey(n,"encrypted-event-key-match");break}}}if(!d){if(h.length)return(s=h[0]).scheme||(s.scheme=t),(o=h[0]).pssh||(o.pssh=new Uint8Array(i)),this.getSessionForKey(h[0],"encrypted-event-no-match");if(l)throw Error("Key ID ".concat(iN(l)," not encountered in playlist"));this.log('Ignoring "'.concat(e.type,'" event - could not determine keyId'))}return d}).catch(e=>this.handleError(e))}},this.onWaitingForKey=e=>{this.log('"'.concat(e.type,'" event'))},this.hls=e,this.config=e.config,this.registerListeners()}}function oU(e,t){let i=e.keyId,r=t.mediaKeysSession;if(i&&r){let e=t.mediaKeysSession.keyStatuses;if(e.size)return e.has(i)?e.get(i):t.keyStatuses[iN(i)]}}function oF(e,t){let i="output-restricted"===e,r=i?tj.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:tj.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new ox({type:tY.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:t},i?"HDCP level output restricted":'key status changed to "'.concat(e,'"'))}oN.CDMCleanupPromise=void 0;var oB=function(){if(null!=nL&&nL.VTTCue)return self.VTTCue;let e=["","lr","rl"],t=["start","middle","end","left","right"];function i(e,t){if("string"!=typeof t||!Array.isArray(e))return!1;let i=t.toLowerCase();return!!~e.indexOf(i)&&i}function r(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];let n=1;for(;n<arguments.length;n++){let t=arguments[n];for(let i in t)e[i]=t[i]}return e}function n(n,a,s){let o={enumerable:!0};this.hasBeenReset=!1;let l="",d=!1,u=n,h=a,c=s,m=null,f="",p=!0,g="auto",v="start",E=50,y="middle",b=50,T="middle";Object.defineProperty(this,"id",r({},o,{get:function(){return l},set:function(e){l=""+e}})),Object.defineProperty(this,"pauseOnExit",r({},o,{get:function(){return d}
3,set:function(e){d=!!e}})),Object.defineProperty(this,"startTime",r({},o,{get:function(){return u},set:function(e){if("number"!=typeof e)throw TypeError("Start time must be set to a number.");u=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"endTime",r({},o,{get:function(){return h},set:function(e){if("number"!=typeof e)throw TypeError("End time must be set to a number.");h=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"text",r({},o,{get:function(){return c},set:function(e){c=""+e,this.hasBeenReset=!0}})),Object.defineProperty(this,"region",r({},o,{get:function(){return m},set:function(e){m=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"vertical",r({},o,{get:function(){return f},set:function(t){let r=i(e,t);if(!1===r)throw SyntaxError("An invalid or illegal string was specified.");f=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"snapToLines",r({},o,{get:function(){return p},set:function(e){p=!!e,this.hasBeenReset=!0}})),Object.defineProperty(this,"line",r({},o,{get:function(){return g},set:function(e){if("number"!=typeof e&&"auto"!==e)throw SyntaxError("An invalid number or illegal string was specified.");g=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"lineAlign",r({},o,{get:function(){return v},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");v=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"position",r({},o,{get:function(){return E},set:function(e){if(e<0||e>100)throw Error("Position must be between 0 and 100.");E=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"positionAlign",r({},o,{get:function(){return y},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");y=r,this.hasBeenReset=!0}})),Object.defineProperty(this,"size",r({},o,{get:function(){return b},set:function(e){if(e<0||e>100)throw Error("Size must be between 0 and 100.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(this,"align",r({},o,{get:function(){return T},set:function(e){let r=i(t,e);if(!r)throw SyntaxError("An invalid or illegal string was specified.");T=r,this.hasBeenReset=!0}})),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},n}();class oG{decode(e,t){if(!e)return"";if("string"!=typeof e)throw Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function oH(e){function t(e,t,i,r){return(0|e)*3600+(0|t)*60+(0|i)+parseFloat(r||0)}let i=e.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?t(i[2],i[3],0,i[4]):t(i[1],i[2],i[3],i[4]):null}class oK{set(e,t){this.get(e)||""===t||(this.values[e]=t)}get(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t}has(e){return e in this.values}alt(e,t,i){for(let r=0;r<i.length;++r)if(t===i[r]){this.set(e,t);break}}integer(e,t){/^-?\d+$/.test(t)&&this.set(e,parseInt(t,10))}percent(e,t){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(t)){let i=parseFloat(t);if(i>=0&&i<=100)return this.set(e,i),!0}return!1}constructor(){this.values=Object.create(null)}}function oW(e,t,i,r){let n=r?e.split(r):[e];for(let e in n){if("string"!=typeof n[e])continue;let r=n[e].split(i);if(2===r.length)t(r[0],r[1])}}let oV=new oB(0,0,""),oq="middle"===oV.align?"middle":"center";function oY(e){return e.replace(/<br(?: \/)?>/gi,"\n")}class oj{parse(e){let t=this;function i(){let e=t.buffer,i=0;for(e=oY(e);i<e.length&&"\r"!==e[i]&&"\n"!==e[i];)++i;let r=e.slice(0,i);return"\r"===e[i]&&++i,"\n"===e[i]&&++i,t.buffer=e.slice(i),r}e&&(t.buffer+=t.decoder.decode(e,{stream:!0}));try{let e="";if("INITIAL"===t.state){if(!/\r\n|\n/.test(t.buffer))return this;let r=(e=i()).match(/^()?WEBVTT([ \t].*)?$/);if(!(null!=r&&r[0]))throw Error("Malformed WebVTT signature.");t.state="HEADER"}let n=!1;for(;t.buffer&&/\r\n|\n/.test(t.buffer);)switch(n?n=!1:e=i(),t.state){case"HEADER":if(/:/.test(e)){var r;r=e,oW(r,function(e,t){},/:/)}else e||(t.state="ID");continue;case"NOTE":e||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(e)){t.state="NOTE";break}if(!e)continue;if(t.cue=new oB(0,0,""),t.state="CUE",-1===e.indexOf("-->")){t.cue.id=e;continue}case"CUE":if(!t.cue){t.state="BADCUE";continue}try{!function(e,t,i){let r=e;
3function n(){let t=oH(e);if(null===t)throw Error("Malformed timestamp: "+r);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=n(),a(),"-->"!==e.slice(0,3))throw Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);e=e.slice(3),a(),t.endTime=n(),a();var s=e;let o=new oK;oW(s,function(e,t){let r;switch(e){case"region":for(let r=i.length-1;r>=0;r--)if(i[r].id===t){o.set(e,i[r].region);break}break;case"vertical":o.alt(e,t,["rl","lr"]);break;case"line":r=t.split(","),o.integer(e,r[0]),o.percent(e,r[0])&&o.set("snapToLines",!1),o.alt(e,r[0],["auto"]),2===r.length&&o.alt("lineAlign",r[1],["start",oq,"end"]);break;case"position":r=t.split(","),o.percent(e,r[0]),2===r.length&&o.alt("positionAlign",r[1],["start",oq,"end","line-left","line-right","auto"]);break;case"size":o.percent(e,t);break;case"align":o.alt(e,t,["start",oq,"end","left","right"])}},/:/,/\s/),t.region=o.get("region",null),t.vertical=o.get("vertical","");let l=o.get("line","auto");"auto"===l&&-1===oV.line&&(l=-1),t.line=l,t.lineAlign=o.get("lineAlign","start"),t.snapToLines=o.get("snapToLines",!0),t.size=o.get("size",100),t.align=o.get("align",oq);let d=o.get("position","auto");"auto"===d&&50===oV.position&&(d="start"===t.align||"left"===t.align?0:"end"===t.align||"right"===t.align?100:50),t.position=d}(e,t.cue,t.regionList)}catch(e){t.cue=null,t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":{let i=-1!==e.indexOf("-->");if(!e||i&&(n=!0)){t.oncue&&t.cue&&t.oncue(t.cue),t.cue=null,t.state="ID";continue}if(null===t.cue)continue;t.cue.text&&(t.cue.text+="\n"),t.cue.text+=e}continue;case"BADCUE":e||(t.state="ID")}}catch(e){"CUETEXT"===t.state&&t.cue&&t.oncue&&t.oncue(t.cue),t.cue=null,t.state="INITIAL"===t.state?"BADWEBVTT":"BADCUE"}return this}flush(){try{if((this.cue||"HEADER"===this.state)&&(this.buffer+="\n\n",this.parse()),"INITIAL"===this.state||"BADWEBVTT"===this.state)throw Error("Malformed WebVTT signature.")}catch(e){this.onparsingerror&&this.onparsingerror(e)}return this.onflush&&this.onflush(),this}constructor(){this.state="INITIAL",this.buffer="",this.decoder=new oG,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}}function oz(e){let t=5381,i=e.length;for(;i;)t=33*t^e.charCodeAt(--i);return(t>>>0).toString()}let oQ=/\r\n|\n\r|\n|\r/g,oX="Missing initPTS for VTT ",oZ=function(e){let t=parseInt(e.slice(-3)),i=parseInt(e.slice(-6,-4)),r=parseInt(e.slice(-9,-7)),n=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!tW(t)||!tW(i)||!tW(r)||!tW(n))throw Error("Malformed X-TIMESTAMP-MAP: Local:".concat(e));return t+=1e3*i,t+=6e4*r,t+=36e5*n};function oJ(e,t,i){return oz(e.toString())+oz(t.toString())+oz(i)}let o$="stpp.ttml.im1t",o0=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,o1=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,o2={left:"start",center:"center",right:"end",start:"start",end:"end"};function o3(e,t,i,r){let n=iZ(new Uint8Array(e),["mdat"]);if(0===n.length)return void r(Error("Could not parse IMSC1 mdat"));let a=n.map(e=>iM(e)),s=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return a7(e,t,1/i,r)}(t.baseTime,1,t.timescale);try{a.forEach(e=>i(function(e,t){let i=new DOMParser().parseFromString(e,"text/xml").getElementsByTagName("tt")[0];if(!i)throw Error("Invalid ttml");let r={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:1},n=Object.keys(r).reduce((e,t)=>(e[t]=i.getAttribute("ttp:".concat(t))||r[t],e),{});!i.getAttribute("ttp:tickRate")&&i.getAttribute("ttp:frameRate")&&(n.tickRate=Number(n.frameRate)*Number(n.subFrameRate));let a="preserve"!==i.getAttribute("xml:space"),s=o5(o4(i,"styling","style")),o=o5(o4(i,"layout","region")),l=o4(i,"body","[begin]");return[].map.call(l,e=>{let i=function e(t,i){return[].slice.call(t.childNodes).reduce((t,r,n)=>{var a;return"br"===r.nodeName&&n?t+"\n":null!=(a=r.childNodes)&&a.length?e(r,i):i?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent},"")}(e,a);if(!i||!e.hasAttribute("begin"))return null;let r=o9(e.getAttribute("begin"),n),l=o9(e.getAttribute("dur"),n),d=o9(e.getAttribute("end"),n);if(null===r)throw o6(e);if(null===d){if(null===l)throw o6(e);d=r+l}let u=new oB(r-t,d-t,i);u.id=oJ(u.startTime,u.endTime,u.text);let h=o[e.getAttribute("region")],c=function(e,t,i){let r="http://www.w3.org/ns/ttml#styling",n=null,a=null!=e&&e.hasAttribute("style")?e.getAttribute("style"):null;return a&&i.hasOwnProperty(a)&&(n=i[a]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce((i,a)=>{let s=o8(t,r,a)||o8(e,r,a)||o8(n,r,a);return s&&(i[a]=s),i},{})}(h,s[e.getAttribute("style")],s),{textAlign:m}=c;if(m){let e=o2[m];e&&(u.lineAlign=e),u.align=m}return t6(u,c),u}).filter(e=>null!==e)}(e,s)))}catch(e){r(e)}}function o4(e,t,i){let r=e.getElementsByTagName(t)[0];return r?[].slice.call(r.querySelectorAll(i)):[]}function o5(e){return e.reduce((e,t)=>
3{let i=t.getAttribute("xml:id");return i&&(e[i]=t),e},{})}function o8(e,t,i){return e&&e.hasAttributeNS(t,i)?e.getAttributeNS(t,i):null}function o6(e){return Error("Could not parse ttml timestamp ".concat(e))}function o9(e,t){if(!e)return null;let i=oH(e);return null===i&&(o0.test(e)?i=function(e,t){let i=o0.exec(e),r=(0|i[4])+(0|i[5])/t.subFrameRate;return(0|i[1])*3600+(0|i[2])*60+(0|i[3])+r/t.frameRate}(e,t):o1.test(e)&&(i=function(e,t){let i=o1.exec(e),r=Number(i[1]);switch(i[2]){case"h":return 3600*r;case"m":return 60*r;case"ms":return r/1e3;case"f":return r/t.frameRate;case"t":return r/t.tickRate}return r}(e,t))),i}function o7(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"disabled",a=e.ownerDocument.createElement("track");return a.kind=t,a.label=i,r&&(a.srclang=r),a.src="data:,WEBVTT",a.track.mode=n,e.appendChild(a),a}function le(e,t){let i=e.mode;if("disabled"===i&&(e.mode="hidden"),e.cues&&!e.cues.getCueById(t.id))try{if(e.addCue(t),!e.cues.getCueById(t.id))throw Error("addCue is failed for: ".concat(t))}catch(i){iy.debug("[texttrack-utils]: ".concat(i));try{let i=new self.TextTrackCue(t.startTime,t.endTime,t.text);i.id=t.id,e.addCue(i)}catch(e){iy.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: ".concat(e))}}"disabled"===i&&(e.mode=i)}function lt(e,t,i,r){let n=e.mode;if("disabled"===n&&(e.mode="hidden"),e.cues&&e.cues.length>0){let n=function(e,t,i){let r=[],n=function(e,t){let i;if(t<=e[0].startTime)return 0;let r=e.length-1;if(t>e[r].endTime)return -1;let n=0,a=r;for(;n<=a;)if(t<e[i=Math.floor((a+n)/2)].startTime)a=i-1;else{if(!(t>e[i].startTime)||!(n<r))return i;n=i+1}return e[n].startTime-t<t-e[a].startTime?n:a}(e,t);if(n>-1)for(let a=n,s=e.length;a<s;a++){let n=e[a];if(n.startTime>=t&&n.endTime<=i)r.push(n);else if(n.startTime>i)break}return r}(e.cues,t,i);for(let t=0;t<n.length;t++)(!r||r(n[t]))&&e.removeCue(n[t])}"disabled"===n&&(e.mode=n)}function li(e,t){let i=lr(e.main);if(i&&i.start<=t)return i;let r=lr(e.audio);return r&&r.start<=t?r:null}function lr(e){if(!e)return null;switch(e.state){case ad.IDLE:case ad.STOPPED:case ad.ENDED:case ad.ERROR:return null}return e.frag}function ln(e,t){return t.getAppendedFrag(e,t$.MAIN)||t.getPartialFragment(e)}function la(e,t,i,r){let n=r.latestLevelDetails,a=ln(t,i);if(ac(r.config)&&!e.nextStart&&n&&a&&r.interstitialsManager){let i="type"in a?a:a.fragment,s=rX(n,i.sn);(null==s?void 0:s.level)===i.level&&ah(s,r.interstitialsManager.playerQueue,t)&&(e.nextStart=s.start)}}function ls(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function lo(e,t,i,r,n){let a=new e(t,i,"");try{a.value=r,n&&(a.type=n)}catch(s){a=new e(t,i,rx(n?t7({type:n},r):r))}return a}let ll=(()=>{let e=ls();try{e&&new e(0,1/0,"")}catch(e){return Number.MAX_VALUE}return 1/0})();function ld(){return self.SourceBuffer||self.WebKitSourceBuffer}function lu(){if(!ib())return!1;let e=ld();return!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove}var lh={DISABLED:0,SWITCHING:1,SWITCHED:2};class lc extends au{registerListeners(){super.registerListeners();let{hls:e}=this;e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.LEVEL_LOADING,this.onLevelLoading,this),e.on(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tz.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tz.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(tz.BUFFER_CREATED,this.onBufferCreated,this),e.on(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tz.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tz.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(tz.BUFFER_CREATED,this.onBufferCreated,this),e.off(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}
3startLoad(e,t){if(this.levels){let{lastCurrentTime:i,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let e=r.startLevel;-1===e&&(r.config.testBandwidth&&this.levels.length>1?(e=0,this.bitrateTest=!0):e=r.firstAutoLevel),r.nextLoadLevel=e,this.level=r.loadLevel,this._hasEnoughToStart=!!t}i>0&&-1===e&&!t&&this.initPTS.length&&(this.log("Override startPosition with lastCurrentTime @".concat(i)),e=i),this.state=ad.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,t||this.fragmentTracker.hasFragments(this.playlistType)||(this._hasEnoughToStart=this.startFragRequested=!1),this.tick()}else this._forceStartLoad=!0,this.state=ad.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case ad.WAITING_LEVEL:{let{levels:e,level:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;if(!r||r.live&&(this.levelLastLoaded!==i||this.waitForLive(i)))this.hls.nextLoadLevel!==this.level&&(this.state=ad.IDLE);else{if(this.waitForCdnTuneIn(r))break;this.state=ad.IDLE}break}case ad.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate()}this.state===ad.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),null!=(e=this.media)&&e.readyState&&!1===this.media.seeking&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){let{hls:e,levelLastLoaded:t,levels:i,media:r}=this;if(null===t||!r&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;let n=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(null!=i&&i[n]))return;let a=i[n],s=this.getMainFwdBufferInfo();if(null===s)return;let o=this.getLevelDetails();if(o&&this._streamEnded(s,o)){let e={type:this.targetBufferType()};this.hls.trigger(tz.BUFFER_EOS,e),this.state=ad.ENDED;return}if(!this.buffering)return;e.loadLevel!==n&&-1===e.manualLevel&&this.log("Adapting to level ".concat(n," from level ").concat(this.level)),this.level=e.nextLoadLevel=n;let l=a.details;if(!l||this.state===ad.WAITING_LEVEL||this.waitForLive(a)){this.level=n,this.state=ad.WAITING_LEVEL,this.startFragRequested=!1;return}let d=s.len,u=this.getMaxBufferLength(a.maxBitrate);if(d>=u)return;this.backtrackFragment&&this.backtrackFragment.start>s.end&&(this.backtrackFragment=void 0);let h=this.backtrackFragment?this.backtrackFragment.start:s.end,c=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&c&&t2(c)&&this.fragmentTracker.getState(c)!==r2.OK){var m;let e=(null!=(m=this.backtrackFragment)?m:c).sn-l.startSN,t=l.fragments[e-1];t&&c.cc===t.cc&&(c=t,this.fragmentTracker.removeFragment(t))}else this.backtrackFragment&&s.len&&(this.backtrackFragment=void 0);if(c&&this.isLoopLoading(c,h)){if(!c.gap){let e=this.audioOnly&&!this.altAudio?t0.AUDIO:t0.VIDEO,t=(e===t0.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;t&&this.afterBufferFlushed(t,e)}c=this.getNextFragmentLoopLoading(c,l,s,t$.MAIN,u)}c&&(this.exceedsMaxBuffer(s,u,c)||this.loadFragment(c,a,h))}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);r===r2.NOT_LOADED||r===r2.PARTIAL?this.bitrateTest?(this.log("Fragment ".concat(e.sn," of level ").concat(e.level," is being downloaded to test bitrate and will not be buffered")),this._loadBitrateTestFrag(e,t)):super.loadFragment(e,t,i):this.clearTrackerIfNeeded(e)}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,1/0),this.altAudio!==lh.DISABLED){var e;((null==(e=this.getLevelDetails())?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,1/0,"audio")}}getBufferOutput(){return this.mediaBuffer&&this.altAudio===lh.SWITCHED?this.mediaBuffer:this.media}checkFragmentChanged(){let e=this.fragPlaying;if(!this.checkFragPlaying())return!1;let t=this.fragPlaying;if(t){let i=t.level;this.hls.trigger(tz.FRAG_CHANGED,{frag:t,previousFrag:e}),(null==e?void 0:e.level)!==i&&this.hls.trigger(tz.LEVEL_SWITCHED,{level:i})}return!0}get backtrackFragment(){return this._backtrackFragment}set backtrackFragment(e){this._backtrackFragment=e}get couldBacktrack(){return this._couldBacktrack}set couldBacktrack(e){this._couldBacktrack=e}abortCurrentFrag(){this.backtrackFragment=void 0,super.abortCurrentFrag()}flushMainBuffer(e,t){super.flushMainBuffer(e,t,this.targetBufferType())}targetBufferType(){return this.altAudio!==lh.SWITCHED||this.audioOnly?null:"video"}onMediaAttached(e,t){super.onMediaAttached(e,t);let i=t.media;as(i,"playing",this.onMediaPlaying),as(i,"seeked",this.onMediaSeeked)}onMediaDetaching(e,t){let{media:i}=this;i&&(ao(i,"playing",this.onMediaPlaying),ao(i,"seeked",this.onMediaSeeked)),this.videoBuffer=null,super.onMediaDetaching(e,t),t.transferMedia||(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(tz.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.backtrackFragment=void 0,this.altAudio=lh.DISABLED,this.audioOnly=!1}onManifestParsed(e,t){let i=!1,r=!1;for(let e=0;e<t.levels.length;e++){let n=t.levels[e].audioCodec;n&&(i=i||-1!==n.indexOf("mp4a.40.2"),r=r||-1!==n.indexOf("mp4a.40.5"))}this.audioCodecSwitch=i&&r&&!function(){var e;let t=ld();return"function"==typeof(null==t||null==(e=t.prototype)?void 0:e.changeType)}(),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){let{levels:i}=this;if(!i||this.state!==ad.IDLE)return;let r=t.levelInfo;(!r.details||r.details.live&&(this.levelLastLoaded!==r||r.details.expired)||this.waitForCdnTuneIn(r.details))&&(this.state=ad.WAITING_LEVEL)}onLevelLoaded(e,t){var i,r;let{levels:n,startFragRequested:a}=this,s=t.level,o=t.details,l=o.totalduration;if(!n)return void this.warn("Levels were reset while loading level ".concat(s));this.log("Level ".concat(s," loaded [").concat(o.startSN,",").concat(o.endSN,"]").concat(o.lastPartSn?"[part-".concat(o.lastPartSn,"-").concat(o.lastPartIndex,"]"):"",", cc [").concat(o.startCC,", ").concat(o.endCC,"] duration:").concat(l));let d=t.levelInfo,u=this.fragCurrent;u&&(this.state===ad.FRAG_LOADING||this.state===ad.FRAG_LOADING_WAITING_RETRY)&&u.level!==t.level&&u.loader&&this.abortCurrentFrag();let h=0;if(o.live||null!=(i=d.details)&&i.live){if(this.checkLiveUpdate(o),o.deltaUpdateFailed)return;h=this.alignPlaylists(o,d.details,null==(r=this.levelLastLoaded)?void 0:r.details)}if(d.details=o,this.levelLastLoaded=d,a||this.setStartPosition(o,h),this.hls.trigger(tz.LEVEL_UPDATED,{details:o,level:s}),this.state===ad.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=ad.IDLE}a&&o.live&&this.synchronizeToLiveEdge(o),this.initPTS.some((e,t)=>{if(t>=o.startCC)return!0;delete this.initPTS[t]}),this.tick()}
3synchronizeToLiveEdge(e){let{config:t,media:i}=this;if(!i)return;let r=this.hls.liveSyncPosition,n=this.playhead,a=e.fragmentStart,s=e.edge,o=n>=a-t.maxFragLookUpTolerance&&n<=s;if(null!==r&&i.duration>r&&(n<r||!o)){let a=void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:t.liveMaxLatencyDurationCount*e.targetduration;if((!o&&i.readyState<4||n<s-a)&&(this._hasEnoughToStart||(this.nextLoadPosition=r),i.readyState))if(this.warn("Playback: ".concat(n," is located too far from the end of live sliding playlist: ").concat(s,", reset currentTime to : ").concat(r)),"buffered"===this.config.liveSyncMode){var l;let e=nh.bufferInfo(i,r,0);if(!(null!=(l=e.buffered)&&l.length)||e.start<=n){i.currentTime=r;return}let{nextStart:t}=nh.bufferedInfo(e.buffered,n,0);t&&(i.currentTime=t)}else i.currentTime=r}}_handleFragmentLoadProgress(e){var t;let i=e.frag,{part:r,payload:n}=e,{levels:a}=this;if(!a)return void this.warn("Levels were reset while fragment load was in progress. Fragment ".concat(i.sn," of level ").concat(i.level," will not be buffered"));let s=a[i.level];if(!s)return void this.warn("Level ".concat(i.level," not found on progress"));let o=s.details;if(!o){this.warn("Dropping fragment ".concat(i.sn," of level ").concat(i.level," after level details were reset")),this.fragmentTracker.removeFragment(i);return}let l=s.videoCodec,d=o.PTSKnown||!o.live,u=null==(t=i.initSegment)?void 0:t.data,h=this._getAudioCodec(s),c=this.transmuxer=this.transmuxer||new sg(this.hls,t$.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,{decryptRange:f,byteRange:p}=nn(i,r,this.iframesOnly),g=new nl(i.level,i.sn,i.stats.chunkCount,p?p.end-p.start:n.byteLength,m,-1!==m,i.duration,this.iframesOnly,f),v=this.initPTS[i.cc];c.push(n,u,h,l,i,r,o.totalduration,d,g,v)}onAudioTrackSwitching(e,t){let i=this.hls,r=this.altAudio!==lh.DISABLED;if(rW(t.url,i))this.altAudio=lh.SWITCHING;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;let e=this.fragCurrent;e&&(this.log("Switching to main audio track, cancel main fragment load"),e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(r){this.altAudio=lh.DISABLED,this.fragmentTracker.removeAllFragments(),i.once(tz.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(tz.AUDIO_TRACK_SWITCHED,t)}),i.trigger(tz.BUFFER_FLUSHING,{startOffset:0,endOffset:1/0,type:null});return}i.trigger(tz.AUDIO_TRACK_SWITCHED,t)}}onAudioTrackSwitched(e,t){let i=rW(t.url,this.hls);if(i){let e=this.videoBuffer;e&&this.mediaBuffer!==e&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=e)}this.altAudio=i?lh.SWITCHED:lh.DISABLED,this.tick()}onBufferCreated(e,t){let i,r,n=t.tracks,a=!1;for(let e in n){let t=n[e];if("main"===t.id){if(r=e,i=t,"video"===e){let t=n[e];t&&(this.videoBuffer=t.buffer)}}else a=!0}a&&i?(this.log("Alternate track found, use ".concat(r,".buffered to schedule main fragment loading")),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media}onFragBuffered(e,t){let{frag:i,part:r}=t,n=i.type===t$.MAIN;if(n){if(this.fragContextChanged(i)){this.warn("Fragment ".concat(i.sn).concat(r?" p: "+r.index:""," of level ").concat(i.level," finished buffering, but was aborted. state: ").concat(this.state)),this.state===ad.PARSED&&(this.state=ad.IDLE);return}let e=!1;if(t2(i)&&(e=!!i.gap&&!i.tagList.some(e=>"GAP"===e[0])),this.fragBufferedComplete(i,r),e){var a;i.stats.retry++;let e=null==(a=this.levels)?void 0:a[i.level];e&&e.fragmentError++}}let s=this.media;s&&(!this._hasEnoughToStart&&nh.getBuffered(s).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),n&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,t){var i;if(t.fatal){this.state=ad.ERROR;return}switch(t.details){case tj.FRAG_GAP:case tj.FRAG_PARSING_ERROR:case tj.FRAG_DECRYPT_ERROR:case tj.FRAG_LOAD_ERROR:case tj.FRAG_LOAD_TIMEOUT:case tj.KEY_LOAD_ERROR:case tj.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(t$.MAIN,t);break;case tj.LEVEL_LOAD_ERROR:case tj.LEVEL_LOAD_TIMEOUT:case tj.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==ad.WAITING_LEVEL||(null==(i=t.context)?void 0:i.type)!==tJ.LEVEL||(this.state=ad.IDLE);break;case tj.BUFFER_APPEND_NO_PROGRESS:if("main"!==t.parent)return;t.frag&&(t.appendsWithoutProgress||0)>
3=this.config.appendErrorMaxRetry&&(this.warn("Marking fragment ".concat(t.frag.sn," of level ").concat(t.frag.level," as a gap after ").concat(t.appendsWithoutProgress," appends without buffered range growth, to prevent loop loading")),this.fragmentTracker.addAsGap(t.frag));break;case tj.BUFFER_ADD_CODEC_ERROR:case tj.BUFFER_APPEND_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&this.resetLoadingState();break;case tj.BUFFER_FULL_ERROR:if("main"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,1/0));break;case tj.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onFragLoadEmergencyAborted(){this.state=ad.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,t){let{type:i}=t;if(i!==t0.AUDIO||!this.altAudio){let e=(i===t0.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;e&&(this.afterBufferFlushed(e,i),this.tick())}}onLevelsUpdated(e,t){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,-1===this.level&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=t.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){let{media:e}=this;if(!e)return;let t=e.currentTime,i=this.startPosition;if(i>=0&&t<i){if(e.seeking)return void this.log("could not seek to ".concat(i,", already seeking at ").concat(t));let r=this.timelineOffset;r&&i&&(i+=r);let n=this.getLevelDetails(),a=nh.getBuffered(e),s=a.length?a.start(0):0,o=s-i,l=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||o>0&&(o<l||this.loadingParts&&o<2*((null==n?void 0:n.partTarget)||0)))&&(this.log("adjusting start position by ".concat(o," to match buffer start")),i+=o,this.startPosition=i),t<i&&(this.log("seek to target start position ".concat(i," from current time ").concat(t," buffer start ").concat(s)),e.currentTime=i)}}_getAudioCodec(e){let t=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&t&&(this.log("Swapping audio codec"),t=-1!==t.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),t}_loadBitrateTestFrag(e,t){e.bitrateTest=!0,this._doFragLoad(e,t).then(e=>{let{hls:i}=this,r=null==e?void 0:e.frag;if(!r||this.fragContextChanged(r))return;t.fragmentError=0,this.state=ad.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;let n=r.stats;n.parsing.start=n.parsing.end=n.buffering.start=n.buffering.end=self.performance.now(),i.trigger(tz.FRAG_LOADED,e),r.bitrateTest=!1}).catch(t=>{this.state!==ad.STOPPED&&this.state!==ad.ERROR&&(this.warn(t),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){let t=this.playlistType,{hls:i}=this,{remuxResult:r,chunkMeta:n}=e,a=this.getCurrentContext(n);if(!a)return void this.resetWhenMissingContext(n);let{frag:s,part:o,level:l}=a,{video:d,text:u,id3:h,initSegment:c}=r,{details:m}=l,f=this.altAudio?void 0:r.audio;if(this.fragContextChanged(s))return void this.fragmentTracker.removeFragment(s);if(this.state=ad.PARSING,c){let e=c.tracks;if(e){let r=s.initSegment||s;if(this.unhandledEncryptionError(c,s))return;this._bufferInitSegment(l,e,r,n),i.trigger(tz.FRAG_PARSING_INIT_SEGMENT,{frag:r,id:t,tracks:e})}let r=c.initPTS,a=c.timescale,o=this.initPTS[s.cc];if(tW(r)&&(!o||o.baseTime!==r||o.timescale!==a)){let e=c.trackId;this.initPTS[s.cc]={baseTime:r,timescale:a,trackId:e};let n=this.initPTS.slice(0);i.trigger(tz.INIT_PTS_FOUND,{timestampOffsets:n,frag:s,id:t,initPTS:r,timescale:a,trackId:e})}}if(d&&m){f&&"audiovideo"===d.type&&this.logMuxedErr(s);let e=m.fragments[s.sn-1-m.startSN],t=s.sn===m.startSN,i=!e||s.cc>e.cc;if(!1!==r.independent){let{startPTS:e,endPTS:r,startDTS:a,endDTS:l}=d;if(o)o.elementaryStreams[d.type]={startPTS:e,endPTS:r,startDTS:a,endDTS:l};else if(d.firstKeyFrame&&d.independent&&1===n.id&&!i&&(this.couldBacktrack=!0),d.dropped&&d.independent){let n=this.getMainFwdBufferInfo(),a=(n?n.end:this.getLoadPosition())+this.config.maxBufferHole,o=d.firstKeyFramePTS?d.firstKeyFramePTS:e;if(!t&&a<o-this.config.maxBufferHole&&!i)return void this.backtrack(s);i&&(s.gap=!0),s.setElementaryStreamInfo(d.type,s.start,r,s.start,l,!0)}
3else t&&e-(m.appliedTimelineOffset||0)>2&&(s.gap=!0);s.setElementaryStreamInfo(d.type,e,r,a,l),this.backtrackFragment&&(this.backtrackFragment=s),this.bufferFragmentData(d,s,o,n,t||i)}else{if(!t&&!i)return void this.backtrack(s);s.gap=!0}}if(f){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=f;o&&(o.elementaryStreams[t0.AUDIO]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),s.setElementaryStreamInfo(t0.AUDIO,e,t,i,r),this.bufferFragmentData(f,s,o,n)}if(m&&null!=h&&h.samples.length){let e={id:t,frag:s,details:m,samples:h.samples};i.trigger(tz.FRAG_PARSING_METADATA,e)}if(m&&u){let e={id:t,frag:s,details:m,samples:u.samples};i.trigger(tz.FRAG_PARSING_USERDATA,e)}}logMuxedErr(e){this.warn("".concat(t2(e)?"Media":"Init"," segment with muxed audiovideo where only video expected: ").concat(e.url))}_bufferInitSegment(e,t,i,n){if(this.state!==ad.PARSING)return;this.audioOnly=!!t.audio&&!t.video,this.altAudio&&!this.audioOnly&&(delete t.audio,t.audiovideo&&this.logMuxedErr(i));let{audio:a,video:s,audiovideo:o}=t;if(a){let i=e.audioCodec,n=rv(a.codec,i);if("mp4a"===n&&(n="mp4a.40.5"),this.audioCodecSwitch){n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");let e=a.metadata;e&&"channelCount"in e&&1!==(e.channelCount||1)&&!function(){if(void 0===r){let e=ri.match(/Firefox\/(\d+)/i);r=e?parseInt(e[1]):0}return r}()&&(n="mp4a.40.5")}n&&-1!==n.indexOf("mp4a.40.5")&&/Android/.test(ri)&&"audio/mpeg"!==a.container&&(n="mp4a.40.2",this.log("Android: force audio codec to ".concat(n))),i&&i!==n&&this.log('Swapping manifest audio codec "'.concat(i,'" for "').concat(n,'"')),a.levelCodec=n,a.id=t$.MAIN,this.log("Init audio buffer, container:".concat(a.container,", codecs[selected/level/parsed]=[").concat(n||"","/").concat(i||"","/").concat(a.codec,"]")),delete t.audiovideo}if(s){s.levelCodec=e.videoCodec,s.id=t$.MAIN;let i=s.codec;if((null==i?void 0:i.length)===4)switch(i){case"hvc1":case"hev1":s.codec="hvc1.1.6.L120.90";break;case"av01":s.codec="av01.0.04M.08";break;case"avc1":s.codec="avc1.42e01e"}this.log("Init video buffer, container:".concat(s.container,", codecs[level/parsed]=[").concat(e.videoCodec||"","/").concat(i,"]").concat(s.codec!==i?" parsed-corrected="+s.codec:"").concat(s.supplemental?" supplemental="+s.supplemental:"")),delete t.audiovideo}o&&(this.iframesOnly&&this.logMuxedErr(i),this.log("Init audiovideo buffer, container:".concat(o.container,", codecs[level/parsed]=[").concat(e.codecs,"/").concat(o.codec,"]")),delete t.video,delete t.audio);let l=Object.keys(t);if(l.length){if(this.hls.trigger(tz.BUFFER_CODECS,t),!this.hls)return;l.forEach(e=>{let r=t[e].initSegment;null!=r&&r.byteLength&&this.hls.trigger(tz.BUFFER_APPENDING,{type:e,data:r,frag:i,part:null,chunkMeta:n,parent:i.type})})}this.tickImmediate()}getMainFwdBufferInfo(){let e=this.getBufferOutput();return this.getFwdBufferInfo(e,t$.MAIN)}get maxBufferLength(){let{levels:e,level:t}=this,i=null==e?void 0:e[t];return i?this.getMaxBufferLength(i.maxBitrate):this.config.maxBufferLength}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=ad.IDLE}get nextLevel(){let e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;let t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;return tW(t)?this.getAppendedFrag(t):null}get currentProgramDateTime(){var e;let t=(null==(e=this.media)?void 0:e.currentTime)||this.lastCurrentTime;if(tW(t)){let e=this.getLevelDetails(),i=this.currentFrag||(e?rj(null,e.fragments,t):null);if(i){let e=i.programDateTime;if(null!==e)return new Date(e+(t-i.start)*1e3)}}return null}get currentLevel(){let e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){let e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}constructor(e,t,i){super(e,t,i,"stream-controller",t$.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=lh.DISABLED,this.audioOnly=!1,this._couldBacktrack=!1,this._backtrackFragment=void 0,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{let e=this.media,t=e?e.currentTime:null;if(null===t||!tW(t)||(this.log("Media seeked to ".concat(t)),!this.getBufferedFrag(t)))return;let i=this.getFwdBufferInfoAtPos(e,t,t$.MAIN,0);if(!i||0===i.len)return void this.log("Main buffer empty at ".concat(t,' on "seeked" event: ').concat(i?i.len:i));this.tick()},this.registerListeners()}}class lm extends lc{setInitPts(e){this.initPTS=e.slice()}loadMediaAt(e,t){if(!this.hls)return;let{seekOnAppend:i}=t,r=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=r,this.startPosition=e,this.state){case ad.STOPPED:case ad.ENDED:case ad.ERROR:this.state=ad.IDLE}this.state===ad.IDLE?(this.hls.resumeBuffering(),this.tick(),this.currentOp=[r,t]):this.nextOp=[r,t],this.hls.off(tz.BUFFERED_TO_END,this.onBufferedToEnd);let n=this.media;i&&n&&this.seekTo(r)&&(this.currentOp=[r,t],this.nextOp=void 0,this.flushPipeline(r,!0))}seekTo(e){let t=this.media;if(t){var i;let r=null==(i=this.getLevelDetails())?void 0:i.edge,n=void 0!==r?r:t.duration;if(e>=n&&(e=n-.01),nh.bufferInfo(t,e,0).len>0&&this.getBufferedAt(e))return t.currentTime=e,!0}return!1}getBufferedAt(e){return this.fragmentTracker.getBufferedFrag(e,t$.MAIN)}cacheSet(e,t){if(!this.hls)return;e.data=t;let i=this.cached;i.push(e),this.cachedSize+=t.buffer.byteLength;let r=this.hls.config.iframeCacheLimit;for(;this.cachedSize>r&&i.length>1;){let e=i.shift();if(e.data)this.cachedSize-=e.data.byteLength,e.data=void 0;else{this.cached=i.filter(e=>!!e.data),this.cachedSize=i.reduce((e,t)=>
3{let{data:i}=t;return i?i.buffer.byteLength:0},0);break}}}onHandlerDestroying(){this.cached.length=0,this.cachedSize=0,super.onHandlerDestroying()}_handleFragmentLoadProgress(e){let t=e.frag,{part:i,payload:r}=e;this.cacheFragmentData&&!i&&null!=r&&r.byteLength&&!t.data&&t2(t)&&this.cacheSet(t,new Uint8Array(r.slice(0))),super._handleFragmentLoadProgress(e)}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);if((r===r2.NOT_LOADED||r===r2.PARTIAL)&&this.canReplayCached(e))return void this.replayCachedFragment(e);super.loadFragment(e,t,i)}canReplayCached(e){var t;if(!this.cacheFragmentData||!(null!=(t=e.data)&&t.byteLength))return!1;let i=e.decryptdata;return(null==i?void 0:i.keyFormat)!=="identity"||!!i.key}replayCachedFragment(e){let t=e.data.slice().buffer;this.log("Buffering cached ".concat(e.type," sn: ").concat(e.sn," of level ").concat(e.level," (").concat(t.byteLength," bytes)")),this.fragCurrent=e,this.startFragRequested=!0;let i=e.stats=new tZ;i.loading.start=i.loading.first=i.loading.end=self.performance.now(),i.loaded=i.total=t.byteLength,i.chunkCount=1,this.state=ad.FRAG_LOADING;let r={frag:e,part:null,payload:t,networkDetails:null};this._handleFragmentLoadProgress(r),this.hls.trigger(tz.FRAG_LOADED,r),this._handleFragmentLoadComplete(r)}fragBufferedComplete(e,t){super.fragBufferedComplete(e,t);let{currentOp:i,nextOp:r}=this;this.currentOp=this.nextOp=void 0,this.state=ad.STOPPED,null!=i&&i[1].seekOnAppend&&(this.flushPipeline(i[0],!r),this.seekTo(i[0])||this.log("Could not seek to ".concat(i[0]," after fragment buffered (superseded or flushed) buffer: ").concat(this.media?al(nh.getBuffered(this.media)):"none"))),r&&this.loadMediaAt.apply(this,r)}flushPipeline(e,t){if(t){let t=this.media;if(t){let i=nh.bufferInfo(t,e,0),r=i.len?i.nextStart:0;r&&(this.fragmentTracker.removeFragmentsInRange(r,1/0,t$.MAIN),this.flushMainBuffer(r,1/0))}this.hls.once(tz.BUFFERED_TO_END,this.onBufferedToEnd)}this.hls.trigger(tz.BUFFER_EOS,{type:"video"})}get playhead(){return this.nextLoadPosition}startLoad(){if(!this.startFragRequested){let e=this.hls;
3e.nextLoadLevel=-1===e.startLevel?0:e.firstAutoLevel}}seekToStartPos(){}setStartPosition(){}alignPlaylists(e,t,i){let r=this.initDetails;return this.initDetails=null,super.alignPlaylists(e,t,i||r||void 0)}getMainFwdBufferInfo(){let e=this.playhead,t=this.getBufferedAt(e);if(t){let i=t.duration;return{len:i,start:e,end:e+i,bufferedIndex:-1}}return{len:0,start:e,end:e,bufferedIndex:-1}}_streamEnded(){let e=this.playhead,t=this.fragmentTracker.getBufferedFrag(e,t$.MAIN);return!!(null!=t&&t.endList)}constructor(...e){super(...e),this.currentOp=void 0,this.nextOp=void 0,this.cached=[],this.cachedSize=0,this.cacheFragmentData=!0,this.initDetails=void 0,this.onBufferedToEnd=()=>{let e=this.media;null!=e&&e.seeking&&(e.currentTime=e.currentTime)},this.onMediaSeeking=()=>{}}}class lf extends lm{get image(){return this._img}set image(e){var t;let i=null==(t=this._img)?void 0:t.src;i&&self.URL.revokeObjectURL(i),this._img=e}loadMediaAt(e){if(!this.hls)return;let t=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=t,this.startPosition=e,this.state){case ad.STOPPED:case ad.ENDED:case ad.ERROR:this.state=ad.IDLE}if(this.state===ad.IDLE){if(this.hls.resumeBuffering(),this.media||(this.media={}),this.tick(),this.state===ad.IDLE){let t=this.getBufferedAt(e);t&&(this.fragCurrent=t,this.updateImage(t,null))}}else{let i=this.fragCurrent;(!i||e>=i.start&&e<i.end)&&(this.queued=[t])}}updateImage(e,t,i){let r=e.data;r||this.fragmentTracker.removeFragment(e);let n=this._img;if(n&&r){let a=self.performance.now();(t?t.stats:e.stats).buffering.start=e.stats.buffering.start=a,n.onload=()=>{if(!this.hls)return;let r=this.hls.levels[e.level];null!=r&&r.fragmentError&&(r.fragmentError=0,e.stats.retry=0);let n=self.performance.now(),a=t?t.stats:e.stats;a.buffering.end=e.stats.buffering.end=n,this.hls.trigger(tz.FRAG_BUFFERED,{frag:e,part:t,stats:a,id:e.type,chunkMeta:i})},n.onerror=()=>{this.handleError("Image decode error",e,t,i)};let s=n.src;s&&self.URL.revokeObjectURL(s);let o=new Blob([r],{type:"image/jpeg"});n.src=self.URL.createObjectURL(o)}else this.state=ad.STOPPED,this.processQueued()}processQueued(){let e=this.queued;this.queued=void 0,e&&this.loadMediaAt.apply(this,e)}handleError(e,t,i,r){if(!this.hls)return;let n=Error(e);this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_PARSING_ERROR,chunkMeta:r,frag:t,part:i,fatal:!1,error:n,err:n})}_bufferInitSegment(){}bufferFragmentData(e,t,i,r){super.bufferFragmentData(e,t,i,r,!0);let n=iZ(new Uint8Array(e.data1),["mdat"]);if(0===n.length)return void this.handleError("Could not find I-Frame mdat",t,i,r);this.cacheSet(t,n[0]),this.updateImage(t,i,r)}fragBufferedComplete(e,t){this.fragmentTracker.fragBuffered(e,!0),super.fragBufferedComplete(e,t),this.processQueued()}checkFragPlaying(){var e;let t=null==(e=this.fragPrevious)?void 0:e.start;if(void 0!==t){let e=this.getAppendedFrag(t);if(e&&!t3(e,this.fragPlaying))return this.fragPlaying=e,!0}return!1}getMainFwdBufferInfo(){return{len:0,start:this.playhead,end:this.playhead,bufferedIndex:-1}}constructor(...e){super(...e),this._img=void 0,this.queued=void 0,this.cacheFragmentData=!1}}let lp={seekOnAppend:!0},lg=function(e){return e[e.Point=0]="Point",e[e.Range=1]="Range",e}({});class lv{setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,null==(e=this.assetListLoader)||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var t;if(e>0&&e>=this.assetList.length)return!0;let i=this.playoutLimit;return!(e<=0||isNaN(i))&&(0===i||((null==(t=this.assetList[e])?void 0:t.startOffset)||0)>i)}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){let e=this.dateRange.startTime;if(this.snapOptions.out){let t=this.dateRange.tagAnchor;if(t)return ly(t,e)?lE(e,t):e}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(0===this.startTime||this.snapOptions.out)return!0;let e=this.dateRange.tagAnchor;if(e){let t=this.dateRange.startTime,i=lE(t,e);return t-i<.1}return!1}get resumptionOffset(){let e=this.resumeOffset,t=tW(e)?e:this.duration;return this.cumulativeDuration+t}get resumeTime(){let e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){let t=this.resumeAnchor;if(t)return ly(t,e)?lE(e,t):e}return e}get appendInPlace(){return!!this.appendInPlaceStarted||!this.appendInPlaceDisabled&&!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&.025>Math.abs(this.resumeOffset-this.duration)))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return null!==this._timelineStart?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){let e,t=this.playoutLimit;return e=null!==this._duration?this._duration:this.dateRange.duration?this.dateRange.duration:this.dateRange.plannedDuration||0,!isNaN(t)&&t<e&&(e=t),e}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return"RANGE"===this.dateRange.attr["X-TIMELINE-OCCUPIES"]?lg.Range:lg.Point}get supplementsPrimary(){return"PRIMARY"===this.dateRange.attr["X-TIMELINE-STYLE"]}get contentMayVary(){return"NO"!==this.dateRange.attr["X-CONTENT-MAY-VARY"]}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||null!==this.assetListResponse}toString(){var e;return e=this,'["'.concat(e.identifier,'" ').concat(e.cue.pre?"<pre>":e.cue.post?"<post>":"").concat(e.timelineStart.toFixed(2),"-").concat(e.resumeTime.toFixed(2),"]")}constructor(e,t){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=t,this.dateRange=e,this.setDateRange(e)}}function lE(e,t){return e-t.start<t.duration/2&&!(.025>Math.abs(e-(t.start+t.duration)))?t.start:t.start+t.duration}function ly(e,t){return t>e.start-.025&&t<e.start+e.duration+.025}function lb(e,t,i){let r=new self.URL(e,i);return"data:"!==r.protocol&&rI(r,"_HLS_primary_id",t),r}function lT(e,t){for(;null!=(i=e.assetList[++t])&&i.error;)var i;return t}function l_(e){let t=e.timelineStart,i=e.duration||0;return'["'.concat(e.identifier,'" ').concat(t.toFixed(2),"-").concat((t+i).toFixed(2),"]")}class lA{get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){let e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let t=this.assetItem.uri;try{t=lb(t,e.config.primarySessionId||"").href}catch(e){}e.loadSource(t)}}bufferedInPlaceToEnd(e,t){var i;if(!this.appendInPlace)return!1;if(null!=(i=this.hls)&&i.bufferedToEnd)return!0;
3if(!e)return!1;let r=Math.min(this._bufferedEosTime||1/0,this.duration),n=this.timelineOffset+(t||0),a=nh.bufferInfo(e,n,.02);return this.getAssetTime(a.end)>=r-.02}reachedPlayout(e){let t=this.interstitial.playoutLimit;return this.startOffset+e>=t}get destroyed(){var e;return!(null!=(e=this.hls)&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return(null==(e=this.hls)?void 0:e.media)||null}get bufferedEnd(){let e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;let t=nh.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(t.end)}get currentTime(){let e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){let e=this.assetItem.duration;if(!e)return 0;let t=this.interstitial.playoutLimit;if(t){let i=t-this.startOffset;if(i>0&&i<e)return i}return e}get remaining(){let e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return(null==(e=this.hls)?void 0:e.config.timelineOffset)||0}set timelineOffset(e){let t=this.timelineOffset;if(e!==t&&Math.abs(e-t)>1/9e4&&this.hls){if(this.hasDetails)throw Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}getAssetTime(e){return Math.min(Math.max(0,e-this.timelineOffset),this.duration)}removeMediaListeners(){let e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;null!=(e=this.hls)&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var t;this.loadSource(),null==(t=this.hls)||t.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,null==(e=this.hls)||e.detachMedia()}resumeBuffering(){var e;null==(e=this.hls)||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.hls)||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),(null==(e=this.hls)?void 0:e.transferMedia())||null}resetDetails(){let e=this.hls;if(e&&this.hasDetails){e.stopLoad();let t=e=>delete e.details;e.levels.forEach(t),e.allAudioTracks.forEach(t),e.allSubtitleTracks.forEach(t),this.hasDetails=!1}}on(e,t,i){var r;null==(r=this.hls)||r.on(e,t)}once(e,t,i){var r;null==(r=this.hls)||r.once(e,t)}off(e,t,i){var r;null==(r=this.hls)||r.off(e,t)}toString(){var e;return"HlsAssetPlayer: ".concat(l_(this.assetItem)," ").concat(null==(e=this.hls)?void 0:e.sessionId," ").concat(this.appendInPlace?"append-in-place":"")}constructor(e,t,i,r){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(tz.PLAYOUT_LIMIT_REACHED,{})};let n=this.hls=new e(t);this.interstitial=i,this.assetItem=r;let a=()=>{this.hasDetails=!0};n.once(tz.LEVEL_LOADED,a),n.once(tz.AUDIO_TRACK_LOADED,a),n.once(tz.SUBTITLE_TRACK_LOADED,a),n.on(tz.MEDIA_ATTA
3CHING,(e,t)=>{let{media:i}=t;this.removeMediaListeners(),this.mediaAttached=i,this.interstitial.playoutLimit&&(i.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&n.on(tz.BUFFER_APPENDED,()=>{let e=this.bufferedEnd;this.reachedPlayout(e)&&(this._bufferedEosTime=e,n.trigger(tz.BUFFERED_TO_END,void 0))}))})}}class lS extends im{destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,t){return this.events?this.events.reduce((i,r)=>e<=r.startOffset&&t>r.startOffset?(delete r.error,i+1):i,0):0}get duration(){let e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,t){if(e.event)return this.findEventIndex(e.event.identifier);let i=-1;e.nextEvent?i=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(i=this.findEventIndex(e.previousEvent.identifier)+1);let r=this.items;if(r)for(r[i]||(void 0===t&&(t=e.start),i=this.findItemIndexAtTime(t));i>=0&&null!=(n=r[i])&&n.event;){var n;i--}return i}findItemIndexAtTime(e,t){let i=this.items;if(i)for(let r=0;r<i.length;r++){let n=i[r];t&&"primary"!==t&&(n=n[t]);let a=n.start,s=i[r].event,o=null!=s&&s.cue.pre?s.duration:n.end;if(e===a||e>a&&e<o)return r}return -1}findJumpRestrictedIndex(e,t){let i=this.items;if(i)for(let r=e;r<=t&&i[r];r++){let e=i[r].event;if(null!=e&&e.restrictions.jump&&!e.appendInPlace)return r}return -1}findEventIndex(e){let t=this.items;if(t)for(let r=t.length;r--;){var i;if((null==(i=t[r].event)?void 0:i.identifier)===e)return r}return -1}findAssetIndex(e,t){let i=e.assetList,r=i.length;if(r>1)for(let e=0;e<r;e++){let n=i[e];if(!n.error){let i=n.timelineStart;if(t===i||t>i&&(t<i+(n.duration||0)||e===r-1))return e}}return 0}get assetIdAtEnd(){var e;let t=null==(e=this.items)||null==(e=e[this.length-1])?void 0:e.event;if(t){let e=t.assetList,i=e[e.length-1];if(i)return i.identifier}return null}parseInterstitialDateRanges(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=e.main.details,{dateRanges:n}=r,a=this.events,s=this.parseDateRanges(n,{url:r.url},t),o=Object.keys(n),l=a?a.filter(e=>-1===o.indexOf(e.identifier)):[];s.length&&s.sort((e,t)=>{let i=e.cue.pre,r=e.cue.post,n=t.cue.pre,a=t.cue.post;if(i&&!n)return -1;if(n&&!i||r&&!a)return 1;if(a&&!r)return -1;if(!i&&!n&&!r&&!a){let i=e.startTime,r=t.startTime;if(i!==r)return i-r}return e.dateRange.tagOrder-t.dateRange.tagOrder}),this.events=s,l.forEach(e=>{this.removeEvent(e)}),this.updateSchedule(e,l,i)}updateSchedule(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=this.events||[];
3if(n.length||t.length||this.length<2){let a=this.items,s=this.parseSchedule(n,e,i);(r||t.length||(null==a?void 0:a.length)!==s.length||s.some((e,t)=>Math.abs(e.playout.start-a[t].playout.start)>.005||Math.abs(e.playout.end-a[t].playout.end)>.005))&&(this.items=s,this.onScheduleUpdate(t,a))}}parseDateRanges(e,t,i){let r=[],n=Object.keys(e);for(let a=0;a<n.length;a++){let s=n[a],o=e[s];if(o.isInterstitial){let e=this.eventMap[s];e?e.setDateRange(o):(e=new lv(o,t),this.eventMap[s]=e,!1===i&&(e.appendInPlace=i)),r.push(e)}}return r}parseSchedule(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[],n=t.main.details,a=n.live?1/0:n.edge,s=0;if((e=e.filter(e=>!e.error&&!(e.cue.once&&e.hasPlayed))).length){this.resolveOffsets(e,t);let l=0,d=0;if(e.forEach((t,o)=>{let u=t.cue.pre,h=t.cue.post,c=e[o-1]||null,m=t.appendInPlace,f=h?a:t.startOffset,p=t.duration,g=t.timelineOccupancy===lg.Range?p:0,v=u&&n.live?i+(t.resumeOffset||0):0,E=v||t.resumptionOffset,y=(null==c?void 0:c.startTime)===f,b=f+t.cumulativeDuration,T=m?b+p:f+E;if(u||!h&&f<=0){let e=d;d+=g,t.timelineStart=b;let i=s;s+=p,r.push({event:t,start:b,end:T,playout:{start:i,end:s},integrated:{start:e,end:d}})}else{if(!(f<=a))return;if(!y){let i=f-l;if(i>.033){let n=l,a=d;d+=i;let u=s;s+=i;let h={previousEvent:e[o-1]||null,nextEvent:t,start:n,end:n+i,playout:{start:u,end:s},integrated:{start:a,end:d}};r.push(h)}else i>0&&c&&(c.cumulativeDuration+=i,r[r.length-1].end=f)}h&&(T=b),t.timelineStart=b;let i=d;d+=g;let n=s;s+=p,r.push({event:t,start:b,end:T,playout:{start:n,end:s},integrated:{start:i,end:d}})}let A=v||t.resumeTime;l=h||A>a?a:!u&&T&&t.appendInPlaceStarted&&A-T>.033?T:A}),l<a){var o;let e=l,t=d,i=a-l;d+=i;let n=s;s+=i,r.push({previousEvent:(null==(o=r[r.length-1])?void 0:o.event)||null,nextEvent:null,start:l,end:e+i,playout:{start:n,end:s},integrated:{start:t,end:d}})}this.setDurations(a,s,d)}else r.push({previousEvent:null,nextEvent:null,start:0,end:a,playout:{start:0,end:a},integrated:{start:0,end:a}}),this.setDurations(a,a,a);return r}setDurations(e,t,i){this.durations={primary:e,playout:t,integrated:i}}resolveOffsets(e,t){let i=t.main.details,r=i.live?1/0:i.edge,n=0,a=-1;e.forEach((s,o)=>{let l=s.cue.pre,d=s.cue.post,u=l?0:d?r:s.startTime;this.updateAssetDurations(s),a===u?s.cumulativeDuration=n:(n=0,a=u),!d&&s.snapOptions.in&&(s.resumeAnchor=rj(null,i.fragments,s.startOffset+s.resumptionOffset,0,0)||void 0),s.appendInPlace&&!s.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(s,t)||(s.appendInPlace=!1)),!s.appendInPlace&&o+1<e.length&&e[o+1].startTime-e[o].resumeTime<.033&&(e[o+1].appendInPlace=!1,e[o+1].appendInPlace&&this.warn("Could not change append strategy for abutting event ".concat(s)));let h=tW(s.resumeOffset)?s.resumeOffset:s.duration;n+=h})}primaryCanResumeInPlaceAt(e,t){let i=e.resumeTime,r=e.startTime+e.resumptionOffset;return Math.abs(i-r)>.025?(this.log('"'.concat(e.identifier,'" resumption ').concat(i," not aligned with estimated timeline end ").concat(r)),!1):!Object.keys(t).some(r=>{let n=t[r].details,a=n.edge;if(i>=a)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," past ").concat(r," playlist end ").concat(a)),!1;let s=rj(null,n.fragments,i);if(!s)return this.log('"'.concat(e.identifier,'" resumption ').concat(i," does not align with any fragments in ").concat(r," playlist (").concat(n.fragStart,"-").concat(n.fragmentEnd,")")),!0;let o=.175*("audio"===r);return!(Math.abs(s.start-i)<.025+o||Math.abs(s.end-i)<.025+o)&&(this.log('"'.concat(e.identifier,'" resumption ').concat(i," not aligned with ").concat(r," fragment bounds (").concat(s.start,"-").concat(s.end," sn: ").concat(s.sn," cc: ").concat(s.cc,")")),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;let t=e.timelineStart,i=0,r=!1,n=!1;for(let a=0;a<e.assetList.length;a++){let s=e.assetList[a],o=t+i;s.startOffset=i,s.timelineStart=o,r||(r=null===s.duration),n||(n=!!s.error),i+=s.error?0:s.duration||0}r&&!n?e.duration=Math.max(i,e.duration):e.duration=i}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}constructor(e,t){super("interstitials-sched",t),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}}
3function lR(e){return"[".concat(e.event?'"'+e.event.identifier+'"':"primary",": ").concat(e.start.toFixed(2),"-").concat(e.end.toFixed(2),"]")}class lk{destroy(){this.hls=null}loadAssetList(e,t){let i,r=e.assetListUrl;try{i=lb(r,this.hls.sessionId,e.baseUrl)}catch(i){let t=this.assignAssetListError(e,tj.ASSET_LIST_LOAD_ERROR,i,r);this.hls.trigger(tz.ERROR,t);return}t&&"data:"!==i.protocol&&rI(i,"_HLS_start_offset",""+t);let n=this.hls.config,a=new n.loader(n),s={type:tJ.INTERSTITIAL_ASSET_LIST,responseType:"json",url:i.href},o=n.interstitialAssetListLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};return a.load(s,l,{onSuccess:(t,i,r,n)=>{let a=t.data;if(!Array.isArray(null==a?void 0:a.ASSETS)){let t=this.assignAssetListError(e,tj.ASSET_LIST_PARSING_ERROR,Error("Invalid interstitial asset list"),r.url,i,n);this.hls.trigger(tz.ERROR,t);return}e.assetListResponse=a,this.hls.trigger(tz.ASSET_LIST_LOADED,{event:e,assetListResponse:a,networkDetails:n})},onError:(t,i,r,n)=>{let a=this.assignAssetListError(e,tj.ASSET_LIST_LOAD_ERROR,Error("Error loading X-ASSET-LIST: HTTP status ".concat(t.code," ").concat(t.text," (").concat(i.url,")")),i.url,n,r);this.hls.trigger(tz.ERROR,a)},onTimeout:(t,i,r)=>{let n=this.assignAssetListError(e,tj.ASSET_LIST_LOAD_TIMEOUT,Error("Timeout loading X-ASSET-LIST (".concat(i.url,")")),i.url,t,r);this.hls.trigger(tz.ERROR,n)}}),this.hls.trigger(tz.ASSET_LIST_LOADING,{event:e}),a}assignAssetListError(e,t,i,r,n,a){return e.error=i,{type:tY.NETWORK_ERROR,details:t,fatal:!1,interstitial:e,url:r,error:i,networkDetails:a,stats:n}}constructor(e){this.hls=void 0,this.hls=e}}function lI(e){var t;null==e||null==(t=e.play())||t.catch(()=>{})}function lL(e,t){return"[".concat(e,"] Advancing timeline position to ").concat(t)}class lD{constructor(e){this.buffered=void 0;let t=(t,i,r)=>{if((i>>>=0)>r-1)throw new DOMException("Failed to execute '".concat(t,"' on 'TimeRanges': The index provided (").concat(i,") is greater than the maximum bound (").concat(r,")"));return e[i][t]};this.buffered={get length(){return e.length},end:i=>t("end",i,e.length),start:i=>t("start",i,e.length)}}}let lw={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},lC=e=>String.fromCharCode(lw[e]||e),lM={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},lP={17:2,18:4,21:6,22:8,23:10,19:13,20:15},lO={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},lx={25:2,26:4,29:6,30:8,31:10,27:13,28:15},lN=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class lU{log(e,t){if(this.verboseLevel>=e){let i="function"==typeof t?t():t;iy.log("".concat(this.time," [").concat(e,"] ").concat(i))}}constructor(){this.time=null,this.verboseLevel=0}}let lF=function(e){let t=[];for(let i=0;i<e.length;i++)t.push(e[i].toString(16));return t},lB=Object.freeze({foreground:"white",underline:!1,italics:!1,background:"black",flash:!1});class lG{get foreground(){return this.styles.foreground}set foreground(e){let t=this.styles;this.styles={foreground:e,underline:t.underline,italics:t.italics,background:t.background,flash:t.flash}}get underline(){return this.styles.underline}set underline(e){let t=this.styles;this.styles={foreground:t.foreground,underline:e,italics:t.italics,background:t.background,flash:t.flash}}get italics(){return this.styles.italics}set italics(e){let t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:e,background:t.background,flash:t.flash}}get background(){return this.styles.background}set background(e){let t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:e,flash:t.flash}}get flash(){return this.styles.flash}set flash(e){let t=this.styles;this.styles={foreground:t.foreground,underline:t.underline,italics:t.italics,background:t.background,flash:e}}reset(){this.styles=lB}setStyles(e){let t=this.styles,i=Object.prototype.hasOwnProperty;this.styles={foreground:i.call(e,"foreground")?e.foreground:t.foreground,underline:i.call(e,"underline")?e.underline:t.underline,italics:i.call(e,"italics")?e.italics:t.italics,background:i.call(e,"background")?e.background:t.background,flash:i.call(e,"flash")?e.flash:t.flash}}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}constructor(){this.styles=lB}}class lH{reset(){this.uchar=" ",this.penState.reset()}setChar(e,t){this.uchar=e,this.penState.styles=t.styles}setPenState(e){this.penState.styles=e.styles}copy(e){this.uchar=e.uchar,this.penState.styles=e.penState.styles}constructor(){this.uchar=" ",this.penState=new lG}}class lK{equals(e){let t=this.chars,i=e.chars;for(let e=0;e<42;e++){let r=t[e],n=i[e];if(r.uchar!==n.uchar)return!1;let a=r.penState.styles,s=n.penState.styles;if(a!==s&&(a.foreground!==s.foreground||a.underline!==s.underline||a.italics!==s.italics||a.background!==s.background||a.flash!==s.flash))return!1}return!0}copy(e){for(let t=0;t<42;t++)this.chars[t].copy(e.chars[t])}isEmpty(){let e=this.chars;for(let t=0;t<42;t++){let i=e[t];if(" "!==i.uchar)return!1;let r=i.penState.styles;if(r!==lB&&("white"!==r.foreground||r.underline||r.italics||"black"!==r.background||r.flash))return!1}return!0}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>=42&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=41)}moveCursor(e){let t=Math.min(this.pos+e,42);if(e>1)for(let e=this.pos+1;e<t;e++)this.chars[e].setPenState(this.currPenState);this.setCursor(t)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();let t=lC(e);if(this.pos>=42)return void this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+t+") at position "+this.pos+". Skipping it!");this.chars[this.pos].setChar(t,this.currPenState),this.moveCursor(1)}clearFromPos(e){let t;for(t=e;t<42;t++)this.chars[t].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){let e=[],t=!0;for(let i=0;i<42;i++){let r=this.chars[i].uchar;" "!==r&&(t=!1),e.push(r)}return t?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}constructor(e){this.chars=[],this.pos=0,this.currPenState=new lG,this.cueStartTime=null,this.logger=void 0;for(let e=0;e<42;e++)this.chars.push(new lH);this.logger=e}}class lW{reset(){for(let e=0;e<15;e++)this.rows[e].clear();this.currRow=14}equals(e){let t=!0;for(let i=0;i<15;i++)if(!this.rows[i].equals(e.rows[i])){t=!1;break}return t}copy(e){for(let t=0;t<15;t++){let i=this.rows[t].chars,r=e.rows[t].chars;for(let e=0;e<42;e++){let t=i[e],n=r[e];t.uchar=n.uchar,t.penState.styles=n.penState.styles}}}isEmpty(){let e=!0;for(let t=0;t<15;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 = "+rx(e));let t=e.row-1;if(this.nrRollUpRows&&t<this.nrRollUpRows-1&&(t=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==t){for(let e=0;e<15;e++)this.rows[e].clear();let e=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){let r=i.rows[e].cueStartTime,n=this.logger.time;if(null!==r&&null!==n&&r<n)for(let r=0;r<this.nrRollUpRows;r++)this.rows[t-this.nrRollUpRows+r+1].copy(i.rows[e+r])}}this.currRow=t;let i=this.rows[this.currRow];if(null!==e.indent){let t=Math.max(e.indent-1,0);i.setCursor(e.indent),e.color=i.chars[t].penState.foreground}let r={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(r)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+rx(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,()=>this.getDisplayText());let 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;let t=[],i="",r=-1;for(let i=0;i<15;i++){let n=this.rows[i].getTextString();n&&(r=i+1,e?t.push("Row "+r+": '"+n+"'"):t.push(n.trim()))}return t.length>0&&(i=e?"["+t.join(" | ")+"]":t.join("\n")),i}getTextAndFormat(){return this.rows}constructor(e){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let t=0;t<15;t++)this.rows.push(new lK(e));this.logger=e}}class lV{reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],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),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let t=0;t<e.length;t++)this.writeScreen.insertChar(e[t]);let t=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>t+": "+this.writeScreen.getDisplayText(!0)),("MODE_PAINT-ON"===this.mode||"MODE_ROLL-UP"===this.mode)&&(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"),"MODE_TEXT"!==this.mode&&(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})}
3ccRDC(){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"),"MODE_POP-ON"===this.mode){let 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){let t={flash:!1};(t.underline=e%2==1,t.italics=e>=46,t.italics)?t.foreground="white":t.foreground=["white","green","blue","cyan","red","yellow","magenta"][Math.floor(e/2)-16],this.logger.log(2,"MIDROW: "+rx(t)),this.writeScreen.setPen(t)}outputDataUpdate(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.logger.time;null!==t&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?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.cueStartTime=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)}constructor(e,t,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=t,this.mode=null,this.verbose=0,this.displayedMemory=new lW(i),this.nonDisplayedMemory=new lW(i),this.lastOutputScreen=new lW(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}}class lq{getHandler(e){return this.outputFilters[e]}setHandler(e,t){var i;this.outputFilters[e]=t,null==(i=this.channels[e])||i.setHandler(t)}getChannel(e){let t=this.channels[e];return t||(t=this.channels[e]=new lV(this.field+e-1,this.outputFilters[e],this.logger)),t}addData(e,t){this.logger.time=e;for(let e=0;e<t.length;e+=2){var i,r,n,a,s,o,l,d;let u=127&t[e],h=127&t[e+1],c=!1,m=null;if(0===u&&0===h)continue;this.logger.log(3,()=>"["+lF([t[e],t[e+1]])+"] -> ("+lF([u,h])+")");let f=this.cmdHistory;if(u>=16&&u<=31){if(i=u,r=h,(n=f).a===i&&n.b===r){(a=f).a=null,a.b=null,this.logger.log(3,()=>"Repeated command ("+lF([u,h])+") is dropped");continue}s=u,o=h,(l=this.cmdHistory).a=s,l.b=o,(c=this.parseCmd(u,h))||(c=this.parseMidrow(u,h)),c||(c=this.parsePAC(u,h)),c||(c=this.parseBackgroundAttributes(u,h))}else{(d=f).a=null,d.b=null}if(!c&&(m=this.parseChars(u,h))){let e=this.currentChannel;e&&e>0?this.getChannel(e).insertChars(m):this.logger.log(2,"No channel found yet. TEXT-MODE?")}c||m||this.logger.log(2,()=>"Couldn't parse cleaned data "+lF([u,h])+" orig: "+lF([t[e],t[e+1]]))}}parseCmd(e,t){if(!((20===e||28===e||21===e||29===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=33&&t<=35))return!1;let i=20===e||21===e||23===e?1:2,r=this.getChannel(i);return 20===e||21===e||28===e||29===e?32===t?r.ccRCL():33===t?r.ccBS():34===t?r.ccAOF():35===t?r.ccAON():36===t?r.ccDER():37===t?r.ccRU(2):38===t?r.ccRU(3):39===t?r.ccRU(4):40===t?r.ccFON():41===t?r.ccRDC():42===t?r.ccTR():43===t?r.ccRTD():44===t?r.ccEDM():45===t?r.ccCR():46===t?r.ccENM():47===t&&r.ccEOC():r.ccTO(t-32),this.currentChannel=i,!0}parseMidrow(e,t){let i=0;if((17===e||25===e)&&t>=32&&t<=47){if((i=17===e?1:2)!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;let r=this.channels[i];return!!r&&(r.ccMIDROW(t),this.logger.log(3,()=>"MIDROW ("+lF([e,t])+")"),!0)}return!1}parsePAC(e,t){let i,r=(e>=17&&e<=23||e>=25&&e<=31)&&t>=64&&t<=127,n=(16===e||24===e)&&t>=64&&t<=95;if(!(r||n))return!1;let a=e<=23?1:2;return i=t>=64&&t<=95?1===a?lM[e]:lO[e]:1===a?lP[e]:lx[e],this.getChannel(a).setPAC(this.interpretPAC(i,t)),this.currentChannel=a,!0}interpretPAC(e,t){let i,r={color:null,italics:!1,indent:null,underline:!1,row:e};return r.underline=(1&(i=t>95?t-96:t-64))==1,i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r}parseChars(e,t){let i,r=null,n=null;if(e>=25?(i=2,n=e-8):(i=1,n=e),n>=17&&n<=19){let e;e=17===n?t+80:18===n?t+112:t+144,this.logger.log(2,()=>"Special char '"+lC(e)+"' in channel "+i),r=[e]}else e>=32&&e<=127&&(r=0===t?[e]:[e,t]);return r&&this.logger.log(3,()=>"Char codes =  "+lF(r).join(",")),r}
3parseBackgroundAttributes(e,t){if(!((16===e||24===e)&&t>=32&&t<=47||(23===e||31===e)&&t>=45&&t<=47))return!1;let i={};return 16===e||24===e?(i.background=lN[Math.floor((t-32)/2)],t%2==1&&(i.background=i.background+"_semi")):45===t?i.background="transparent":(i.foreground="black",47===t&&(i.underline=!0)),this.getChannel(e<=23?1:2).setBkgData(i),!0}reset(){var e;for(let e=0;e<Object.keys(this.channels).length;e++){let t=this.channels[e];t&&t.reset()}(e=this.cmdHistory).a=null,e.b=null}cueSplitAtTime(e){for(let t=0;t<this.channels.length;t++){let i=this.channels[t];i&&i.cueSplitAtTime(e)}}constructor(e,t,i){this.channels=[null,null,null],this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0,this.field=void 0,this.outputFilters=void 0,this.logger=new lU,this.field=e,this.outputFilters=[null,t,i]}}class lY{dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,t,i){(null===this.startTime||this.startTime>e)&&(this.startTime=e),this.endTime=t,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}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}}function lj(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}let lz=/\s/,lQ={newCue(e,t,i,r){let n,a,s,o,l,d=[],u=self.VTTCue||self.TextTrackCue;for(let c=0;c<r.rows.length;c++)if(n=r.rows[c],s=!0,o=0,l="",!n.isEmpty()){var h;for(let e=0;e<n.chars.length;e++)lz.test(n.chars[e].uchar)&&s?o++:(l+=n.chars[e].uchar,s=!1);n.cueStartTime=t,t===i&&(i+=1e-4),o>=16?o--:o++;let r=oY(l.trim()),m=oJ(t,i,r);null!=e&&null!=(h=e.cues)&&h.getCueById(m)||((a=new u(t,i,r)).id=m,a.line=c+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*o/32)),d.push(a))}return e&&d.length&&(d.sort((e,t)=>"auto"===e.line||"auto"===t.line?0:e.line>8&&t.line>8?t.line-e.line:e.line-t.line),d.forEach(t=>le(e,t))),d}};class lX{destroy(){this.callbacks=this.context=this.config=null,this.abortInternal(),this.stats=null}load(e,t,i){let r=this.stats;if(r.loading.start)throw Error("Loader can only be used once.");r.loading.start=self.performance.now(),this.context=e,this.config=t,this.callbacks=i,this.loadInternal()}abort(){var e;this.abortInternal(),null!=(e=this.callbacks)&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.getNetworkDetails())}loadtimeout(){if(!this.config)return;let e=this.config.loadPolicy.timeoutRetry;if(il(e,this.stats.retry,!0))this.retry(e);else{var t;iy.warn("timeout while loading ".concat(null==(t=this.context)?void 0:t.url));let e=this.callbacks;e&&(this.abortInternal(),e.onTimeout(this.stats,this.context,this.getNetworkDetails()))}}retry(e){let{context:t,stats:i}=this;this.retryDelay=is(e,i.retry),i.retry++,iy.warn("".concat(status?"HTTP Status "+status:"Timeout"," while loading ").concat(null==t?void 0:t.url,", retrying ").concat(i.retry,"/").concat(e.maxNumRetry," in ").concat(this.retryDelay,"ms")),this.abortInternal(),this.resetInternalLoader(),self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(()=>this.loadInternal(),this.retryDelay)}constructor(){this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=0,this.config=null,this.callbacks=null,this.context=null,this.stats=new tZ}}let lZ=/(\d+)-(\d+)\/(\d+)/;class lJ extends lX{destroy(){this.request=null,super.destroy(),this.response=null,this.controller=null,this.fetchSetup=null}abortInternal(){self.clearTimeout(this.retryTimeout),this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}getNetworkDetails(){return this.response}resetInternalLoader(){this.response=null}loadInternal(){let{config:e,context:t,stats:i}=this;if(!e||!t)return;i.loading.first=0,i.loaded=0,i.aborted=!1,this.controller=new self.AbortController;let r=function(e,t){let i={method:"GET",mode:"cors",credentials:"same-origin",signal:t,headers:new self.Headers(t6({},e.headers))};return e.rangeEnd&&i.headers.set("Range","bytes="+e.rangeStart+"-"+String(e.rangeEnd-1)),i}(t,this.controller.signal),n="arraybuffer"===t.responseType,a=n?"byteLength":"length",{maxTimeToFirstByteMs:s,maxLoadTimeMs:o}=e.loadPolicy;this.request=this.fetchSetup(t,r),self.clearTimeout(this.requestTimeout),e.timeout=s&&tW(s)?s:o,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()}
3,e.timeout),(sc(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(r=>{var a;this.response=r;let s=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=o,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},o-(s-i.loading.start)),!r.ok){let{status:e,statusText:t}=r;throw new l0(t||"fetch, bad network response",e,r)}i.loading.first=s,i.total=function(e){let t=e.get("Content-Range");if(t){let e=function(e){let t=lZ.exec(e);if(t)return parseInt(t[2])-parseInt(t[1])+1}(t);if(tW(e))return e}let i=e.get("Content-Length");if(i)return parseInt(i)}(r.headers)||i.total;let l=null==(a=this.callbacks)?void 0:a.onProgress;return l&&tW(e.highWaterMark)?this.loadProgressively(r,i,t,e.highWaterMark,l):n?r.arrayBuffer():"json"===t.responseType?r.json():r.text()}).then(r=>{var n,s;let o=this.response;if(!o)throw Error("loader destroyed");self.clearTimeout(this.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);let l=r[a];l&&(i.loaded=i.total=l);let d={url:o.url,data:r,code:o.status},u=null==(n=this.callbacks)?void 0:n.onProgress;u&&!tW(e.highWaterMark)&&u(i,t,r,o),null==(s=this.callbacks)||s.onSuccess(d,i,t,o)}).catch(r=>{if(self.clearTimeout(this.requestTimeout),i.aborted)return;let n=r&&r.code||0,a=r?r.message:null,s=e.loadPolicy.errorRetry;if(il(s,i.retry,!1,{url:t.url,data:void 0,code:n}))this.retry(s);else{var o;iy.error("".concat(n," while loading ").concat(t.url)),null==(o=this.callbacks)||o.onError({code:n,text:a},t,r?r.details:null,i)}})}getCacheAge(){let e=null;if(this.response){let t=this.response.headers.get("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4?arguments[4]:void 0,a=new am,s=e.body.getReader(),o=()=>s.read().then(s=>{if(s.done)return a.dataLength&&n(t,i,a.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));let l=s.value,d=l.length;return t.loaded+=d,d<r||a.dataLength?(a.push(l),a.dataLength>=r&&n(t,i,a.flush().buffer,e)):n(t,i,l.buffer,e),o()}).catch(()=>Promise.reject());return o()}constructor(e){super(),this.fetchSetup=void 0,this.request=null,this.response=null,this.controller=null,this.fetchSetup=e.fetchSetup||l$}}function l$(e,t){return new self.Request(e.url,t)}class l0 extends Error{constructor(e,t,i){super(e),this.code=void 0,this.details=void 0,this.code=t,this.details=i}}let l1=/^age:\s*[\d.]+\s*$/im;class l2 extends lX{destroy(){super.destroy(),this.loader=null,this.xhrSetup=null}abortInternal(){let e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,4!==e.readyState&&(this.stats.aborted=!0,e.abort()))}getNetworkDetails(){return this.loader}resetInternalLoader(){this.loader=null}loadInternal(){let{config:e,context:t}=this;if(!e||!t)return;let i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0,r.aborted=!1;let n=this.xhrSetup;n?Promise.resolve().then(()=>{if(this.loader===i&&!this.stats.aborted)return n.call(this,i,t.url,t)}).catch(e=>{if(this.loader===i&&!this.stats.aborted)return i.open("GET",t.url,!0),n.call(this,i,t.url,t)}).then(()=>{this.loader!==i||this.stats.aborted||this.openAndSendXhr(i,t,e)}).catch(e=>{var n;null==(n=this.callbacks)||n.onError({code:i.status,text:e.message},t,i,r)}):this.openAndSendXhr(i,t,e)}openAndSendXhr(e,t,i){e.readyState||e.open("GET",t.url,!0);let r=t.headers,{maxTimeToFirstByteMs:n,maxLoadTimeMs:a}=i.loadPolicy;if(r)for(let t in r)e.setRequestHeader(t,r[t]);t.rangeEnd&&e.setRequestHeader("Range","bytes=".concat(t.rangeStart,"-").concat(t.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=t.responseType,self.clearTimeout(this.requestTimeout),i.timeout=n&&tW(n)?n:a,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.timeout),e.send()}readystatechange(){let{context:e,loader:t,stats:i}=this;if(!e||!t)return;let r=t.readyState,n=this.config;if(!i.aborted&&r>=2&&(0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start),n.timeout!==n.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),n.timeout=n.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),n.loadPolicy.maxLoadTimeMs-(i.loading.first-i.loading.start)))),4===r)){var a,s,o;self.clearTimeout(this.requestTimeout),t.onreadystatechange=null,t.onprogress=null;let r=t.status,l="text"===t.responseType?t.responseText:null;if(r>=200&&r<300){let n=null!=l?l:t.response;if(null!=n){i.loading.end=Math.max(self.performance.now(),i.loading.first);let o="arraybuffer"===t.responseType?n.byteLength:n.length;i.loaded=i.total=o,i.bwEstimate=8e3*i.total/(i.loading.end-i.loading.first);let l=null==(a=this.callbacks)?void 0:a.onProgress;l&&l(i,e,n,t);let d={url:t.responseURL,data:n,code:r};e.rangeEnd&&o!==e.rangeEnd-e.rangeStart&&iy.warn("Payload length ".concat(o," does not match requested Range: bytes=").concat(e.rangeStart,"-").concat(e.rangeEnd-1)),null==(s=this.callbacks)||s.onSuccess(d,i,e,t);return}}let d=n.loadPolicy.errorRetry;il(d,i.retry,!1,{url:e.url,data:void 0,code:r})?this.retry(d):(iy.error("".concat(r," while loading ").concat(e.url)),null==(o=this.callbacks)||o.onError({code:r,text:t.statusText},e,t,i))}}loadprogress(e){let t=this.stats;t.loaded=e.loaded,e.lengthComputable&&(t.total=e.total)}getCacheAge(){let e=null;if(this.loader&&l1.test(this.loader.getAllResponseHeaders())){let t=this.loader.getResponseHeader("age");e=t?parseFloat(t):null}return e}getResponseHeader(e){return this.loader&&RegExp("^".concat(e,":\\s*[\\d.]+\\s*$"),"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}constructor(e){super(),this.xhrSetup=void 0,this.loader=null,this.xhrSetup=e.xhrSetup||null}}let l3=t7(t7({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:1/0,preferManagedMediaSource:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,loopBackBufferFlush:void 0,startOnSegmentBoundary:!1,nextAudioTrackBufferFlushForwardOffset:.25,maxBufferSize:6e7,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,skipBufferHolePadding:.1,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveMaxUnchangedPlaylistRefresh:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftw
vendor: 4,945 bytes, line 3
3areAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,appendTimeout:1/0,ignorePlaylistParsingErrors:!1,loader:l2,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,handleMpegTsVideoIntegrityErrors:"process",abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,abrSwitchInterval:0,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:nx,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,emsgKLVSchemaUri:void 0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,iframeCacheLimit:2097152,useMediaCapabilities:!0,preserveManualLevelOnError:!1,errorPenaltyExpireMs:0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},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}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,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,streamController:lc,abrController:class extends im{resetEstimator(e){this.hls&&(e&&(this.log("setting initial bwe to ".concat(e)),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator())}initEstimator(){let e=this.hls.config;return new ic(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){let e=this.hls;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.FRAG_LOADING,this.onFragLoading,this),e.on(tz.FRAG_LOADED,this.onFragLoaded,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tz.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(tz.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.FRAG_LOADING,this.onFragLoading,this),e.off(tz.FRAG_LOADED,this.onFragLoaded,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tz.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(tz.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.audioTracksByGroup=this.codecTiers=this.fragCurrent=this.partCurrent=null}onManifestLoading(e,t){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this.lastLevelLoadSec=0,this.supportedCache={},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){let i=t.frag;
3if(!this.ignoreFragment(i)){if(!i.bitrateTest){var r;this.fragCurrent=i,this.partCurrent=null!=(r=t.part)?r: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 tj.BUFFER_ADD_CODEC_ERROR:case tj.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case tj.FRAG_LOAD_TIMEOUT:{let e=t.frag,{fragCurrent:i,partCurrent:r}=this;if(e&&t4(e,i)){let t=performance.now(),i=r?r.stats:e.stats,n=t-i.loading.start,a=i.loading.first?i.loading.first-i.loading.start:-1;if(i.loaded&&a>-1){let e=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(n-Math.min(e,a),i.loaded)}else this.bwEstimator.sampleTTFB(n)}}}}getTimeToLoadFrag(e,t,i,r){let n=r?e+this.lastLevelLoadSec:0;return e+i/t+n}onLevelLoaded(e,t){let i=this.hls.config,{loading:r}=t.stats,n=r.end-r.first;tW(n)&&(this.lastLevelLoadSec=n/1e3),t.details.live?this.bwEstimator.update(i.abrEwmaSlowLive,i.abrEwmaFastLive):this.bwEstimator.update(i.abrEwmaSlowVoD,i.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(t.levelInfo)}onFragLoaded(e,t){var i;let{frag:r,part:n}=t,a=n?n.stats:r.stats;if(r.type===t$.MAIN&&this.bwEstimator.sampleTTFB(a.loading.first-a.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,null!=(i=this.hls)&&i.config.abrMaxWithRealBitrate){let e=n?n.duration:r.duration,t=this.hls.levels[r.level],i=(t.loaded?t.loaded.bytes:0)+a.loaded,s=(t.loaded?t.loaded.duration:0)+e;t.loaded={bytes:i,duration:s},t.realBitrate=Math.round(8*i/s)}if(r.bitrateTest){let e={stats:a,frag:r,part:n,id:r.type};this.onFragBuffered(tz.FRAG_BUFFERED,e),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}}onFragBuffered(e,t){let{frag:i,part:r}=t,n=null!=r&&r.stats.loaded?r.stats:i.stats;if(n.aborted||this.ignoreFragment(i))return;let a=((i.bitrate||0)>=1e5?n.parsing.end:n.loading.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(),i.bitrateTest?this.bitrateTestDelay=a/1e3:(this.bitrateTestDelay=0,this.firstAutoFloor>-1&&this.bwEstimator.canEstimate()&&(this.firstAutoFloor=-1))}ignoreFragment(e){return e.type!==t$.MAIN||"initSegment"===e.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){let{hls:e}=this;if(!e)return 0;let{maxAutoLevel:t,minAutoLevel:i}=e,r=this.getBwEstimate(),n=this.getStarvationDelay(),a=e.config.maxStarvationDelay,s=this.findBestLevel(r,i,t,n/2,a,1,1);if(s>-1)return s;let o=e.firstLevel,l=Math.min(Math.max(o,i),t,-1===this.firstAutoFloor?1/0:this.firstAutoFloor);return this.warn("Could not find best starting auto level. Defaulting to first in playlist ".concat(o," clamped to ").concat(l)),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){if(!this.hls)return -1;let e=this.forcedAutoLevel,t=this.bwEstimator.canEstimate(),i=this.lastLoadedFragLevel>-1;if(-1!==e&&(!t||!i||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;let r=t&&i?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==e){let t=this.hls.levels;if(t.length>Math.max(e,r)&&t[e].loadError<=t[r].loadError)return e}return this._nextAutoLevel=r,this.nextAutoLevelKey=this.getAutoLevelKey(),r}getAutoLevelKey(){return"".concat(this.getBwEstimate(),"_").concat(this.getStarvationDelay().toFixed(2))}getNextABRAutoLevel(){let{fragCurrent:e,partCurrent:t,hls:i}=this;if(!i)return -1;if(i.levels.length<=1)return i.loadLevel;let{maxAutoLevel:r,config:n,minAutoLevel:a}=i,s=t?t.duration:e?e.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay(),d=n.abrBandWidthFactor,u=n.abrBandWidthUpFactor;if(l){let e=this.findBestLevel(o,a,r,l,0,d,u);if(e>=0)return this.rebufferNotice=-1,e}let h=s?Math.min(s,n.maxStarvationDelay):n.maxStarvationDelay;if(!l){let e=this.bitrateTestDelay;e&&(h=(s?Math.min(s,n.maxLoadingDelay):n.maxLoadingDelay)-e,this.info("bitrate test took ".concat(Math.round(1e3*e),"ms, set first fragment max fetchDuration to ").concat(Math.round(1e3*h)," ms")),d=u=1)}let c=this.findBestLevel(o,a,r,l,h,d,u);if(this.rebufferNotice!==c&&(this.rebufferNotice=c,this.info("".concat(l?"rebuffering expected":"buffer is empty",", optimal quality level ").concat(c))),c>-1)return c;let m=i.levels[a],f=i.loadLevelObj;return f&&(null==m?void 0:m.bitrate)<f.bitrate?a:i.loadLevel}getStarvationDelay(){let e=this.hls,t=null==e?void 0:e.media;if(!t)return 1/0;let i=t&&0!==t.playbackRate?Math.abs(t.playbackRate):1,r=e.mainForwardBufferInfo;return(r?r.len:0)/i}getBwEstimate(){return this.bwEstimator.getEstimate()}findBestLevel(e,t,i,r,n,a,s){var o;let l,{hls:d,lastLoadedFragLevel:u,fragCurrent:h,partCurrent:c}=this;if(!d)return -1;let m=r+n,f=-1===u?d.firstLevel:u,{levels:p,allAudioTracks:g,loadLevel:v,latestLevelDetails:E,config:y}=d;if(1===p.length)return 0;let b=p[f],T=!!(null!=E&&E.live),A=-1===v||-1===u,S="SDR",R=(null==b?void 0:b.frameRate)||0,{audioPreference:k,videoPreference:I}=y,L=this.audioTracksByGroup||(this.audioTracksByGroup=rU(g)),D=-1;if(A){if(-1!==this.firstSelection)return this.firstSelection;let r=function(e,t,i,r,n){let a=Object.keys(e),s=null==r?void 0:r.channels,o=null==r?void 0:r.audioCodec,l=null==n?void 0:n.videoCodec,d=s&&2===parseInt(s),u=!1,h=!1,c=1/0,m=1/0,f=1/0,p=1/0,g=0,v=[],{preferHDR:E,allowedVideoRanges:y}=function(e,t){let i=!1,r=[];if(e&&(i="SDR"!==e,r=[e]),t){let e="SDR"!==(r=t.allowedVideoRanges||rD.slice(0)).join("")&&!t.videoCodec;(i=void 0!==t.preferHDR?t.preferHDR:e&&function(){if("function"==typeof matchMedia){let e=matchMedia("(dynamic-range: high)"),t=matchMedia("bad query");if(e.media!==t.media)return!0===e.matches}return!1}())||(r=["SDR"])}return{preferHDR:i,allowedVideoRanges:r}}(t,n);for(let t=a.length;t--;){let i=e[a[t]];u||(u=i.channels[2]>0),c=Math.min(c,i.minHeight),m=Math.min(m,i.minFramerate),f=Math.min(f,i.minBitrate),y.filter(e=>i.videoRanges[e]>0).length>0&&(h=!0)}c=tW(c)?c:0,m=tW(m)?m:0;let b=Math.max(1080,c),T=Math.max(30,m);i=Math.max(f=tW(f)?f:i,i),h||(t=void 0);let A=a.length>1;return{codecSet:a.reduce((t,r)=>{let n=e[r];if(r===t)return t;if(v=h?y.filter(e=>n.videoRanges[e]>0):[],A){if(n.minBitrate>i)return rN(r,"min bitrate of ".concat(n.minBitrate," > current estimate of ").concat(i)),t;if(!n.hasDefaultAudio)return rN(r,"no renditions with default or auto-select sound found"),t;if(o&&r.indexOf(o.substring(0,4))%5!=0)return rN(r,'audio codec preference "'.concat(o,'" not found')),t;if(s&&!d){if(!n.channels[s])return rN(r,"no renditions with ".concat(s," channel sound found (channels options: ").concat(Object.keys(n.channels),")")),t}else if((!o||d)&&u&&0===n.channels["2"])return rN(r,"no renditions with stereo sound found"),t;if(n.minHeight>b)return rN(r,"min resolution of ".concat(n.minHeight," > maximum of ").concat(b)),t;if(n.minFramerate>T)return rN(r,"min framerate of ".concat(n.minFramerate," > maximum of ").concat(T)),t;if(!v.some(e=>n.videoRanges[e]>0))return rN(r,"no variants with VIDEO-RANGE of ".concat(rx(v)," found")),t;if(l&&r.indexOf(l.substring(0,4))%5!=0)return rN(r,'video codec preference "'.concat(l,'" not found')),t;if(n.maxScore<g)return rN(r,"max score of ".concat(n.maxScore," < selected max of ").concat(g)),t}return t&&(rm(r)>=rm(t)||n.fragmentError>e[t].fragmentError)?t:(p=n.minIndex,g=n.maxScore,r)},void 0),videoRanges:v,preferHDR:E,minFramerate:m,minBitrate:f,minIndex:p}}(this.codecTiers||(this.codecTiers=p.slice(t,i+1).reduce((e,t,i)=>{if(!t.codecSet)return e;let r=t.audioGroups,n=e[t.codecSet];n||(e[t.codecSet]=n={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:i,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!r,fragmentError:0}
3),n.minBitrate=Math.min(n.minBitrate,t.bitrate);let a=Math.min(t.height,t.width);return n.minHeight=Math.min(n.minHeight,a),n.minFramerate=Math.min(n.minFramerate,t.frameRate),n.minIndex=Math.min(n.minIndex,i),n.maxScore=Math.max(n.maxScore,t.score),n.fragmentError+=t.fragmentError,n.videoRanges[t.videoRange]=(n.videoRanges[t.videoRange]||0)+1,r&&r.forEach(e=>{if(!e)return;let t=L.groups[e];t&&(n.hasDefaultAudio=n.hasDefaultAudio||L.hasDefaultAudio?t.hasDefault:t.hasAutoSelect||!L.hasDefaultAudio&&!L.hasAutoSelectAudio,Object.keys(t.channels).forEach(e=>{n.channels[e]=(n.channels[e]||0)+t.channels[e]}))}),e},{})),S,e,k,I),{codecSet:n,videoRanges:a,minFramerate:s,minBitrate:o,minIndex:d,preferHDR:u}=r;D=d,l=n,S=u?a[a.length-1]:a[0],R=s,e=Math.max(e,o),this.log("picked start tier ".concat(rx(r)))}else l=null==b?void 0:b.codecSet,S=null==b?void 0:b.videoRange;let w=c?c.duration:h?h.duration:0,C=this.bwEstimator.getEstimateTTFB()/1e3,M=[];for(let d=i;d>=t;d--){let t,h=p[d],g=d>f;if(!h)continue;if(y.useMediaCapabilities&&!h.supportedResult&&!h.supportedPromise){let t=navigator.mediaCapabilities;"function"==typeof(null==t?void 0:t.decodingInfo)&&function(e,t,i,r,n,a){let s=e.videoCodec,o=e.audioCodec?e.audioGroups:null,l=null==a?void 0:a.audioCodec,d=null==a?void 0:a.channels,u=d?parseInt(d):l?1/0:2,h=null;if(null!=o&&o.length)try{h=1===o.length&&o[0]?t.groups[o[0]].channels:o.reduce((e,i)=>{if(i){let r=t.groups[i];if(!r)throw Error("Audio track group ".concat(i," not found"));Object.keys(r.channels).forEach(t=>{e[t]=(e[t]||0)+r.channels[t]})}return e},{2:0})}catch(e){return!0}return void 0!==s&&(s.split(",").some(e=>i6(e))||e.width>1920&&e.height>1088||e.height>1920&&e.width>1088||e.frameRate>Math.max(r,30)||"SDR"!==e.videoRange&&e.videoRange!==i||e.bitrate>Math.max(n,8e6))||!!h&&tW(u)&&Object.keys(h).some(e=>parseInt(e)>u)}(h,L,S,R,e,k)?(h.supportedPromise=rS(h,L,t,this.supportedCache),h.supportedPromise.then(e=>{if(!this.hls)return;h.supportedResult=e;let t=this.hls.levels,i=t.indexOf(h);e.error?this.warn('MediaCapabilities decodingInfo error: "'.concat(e.error,'" for level ').concat(i," ").concat(rx(e))):e.supported?e.decodingInfoResults.some(e=>!1===e.smooth||!1===e.powerEfficient)&&this.log("MediaCapabilities decodingInfo for level ".concat(i," not smooth or powerEfficient: ").concat(rx(e))):(this.warn("Unsupported MediaCapabilities decodingInfo result for level ".concat(i," ").concat(rx(e))),i>-1&&t.length>1&&(this.log("Removing unsupported level ".concat(i)),this.hls.removeLevel(i),-1===this.hls.loadLevel&&(this.hls.nextLoadLevel=0)))}).catch(e=>{this.warn("Error handling MediaCapabilities decodingInfo: ".concat(e))})):h.supportedResult=r_}if((l&&h.codecSet!==l||S&&h.videoRange!==S||g&&R>h.frameRate||!g&&R>0&&R<h.frameRate||null!=(o=h.supportedResult)&&null!=(o=o.decodingInfoResults)&&o.some(e=>!1===e.smooth))&&(!A||d!==D)){M.push(d);continue}let E=h.details,b=(c?null==E?void 0:E.partTarget:null==E?void 0:E.averagetargetduration)||w||1;t=g?s*e:a*e;let I=w&&r>=2*w&&0===n?h.averageBitrate:h.maxBitrate,P=this.getTimeToLoadFrag(C,t,I*b,!E||E.live);if(t>=I&&(d===u||0===h.loadError&&0===h.fragmentError||iu(h,y.errorPenaltyExpireMs))&&(P<=C||!tW(P)||T&&!this.bitrateTestDelay||P<m)){let e=this.forcedAutoLevel;return d!==v&&(-1===e||e!==v)&&(M.length&&this.trace("Skipped level(s) ".concat(M.join(",")," of ").concat(i,' max with CODECS and VIDEO-RANGE:"').concat(p[M[0]].codecs,'" ').concat(p[M[0]].videoRange,'; not compatible with "').concat(l,'" ').concat(S)),this.info("switch candidate:".concat(f,"->").concat(d," adjustedbw(").concat(Math.round(t),")-bitrate=").concat(Math.round(t-I)," ttfb:").concat(C.toFixed(1)," avgDuration:").concat(b.toFixed(1)," maxFetchDuration:").concat(m.toFixed(1)," fetchDuration:").concat(P.toFixed(1)," firstSelection:").concat(A," codecSet:").concat(h.codecSet," videoRange:").concat(h.videoRange," hls.loadLevel:").concat(v))),A&&(this.firstSelection=d),d}}return -1}set nextAutoLevel(e){let t=this.deriveNextAutoLevel(e);this._nextAutoLevel!==t&&(this.nextAutoLevelKey="",this._nextAutoLevel=t)}deriveNextAutoLevel(e){if(!this.hls)return -1;let{maxAutoLevel:t,minAutoLevel:i}=this.hls;return Math.min(Math.max(e,i),t)}constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.co
3decTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=e=>{var t;let i,{fragCurrent:r,partCurrent:n,hls:a}=this;if(!a)return;let{autoLevelEnabled:s,media:o}=a;if(!r||!o)return;let l=performance.now(),d=n?n.stats:r.stats,u=n?n.duration:r.duration,h=l-d.loading.start,c=a.minAutoLevel,m=r.level,f=this._nextAutoLevel;if(d.aborted||d.loaded&&d.loaded===d.total||m<=c){this.clearTimer(),this._nextAutoLevel=-1;return}if(!s)return;let p=f>-1&&f!==m,g=!!e||p;if(!g&&(o.paused||!o.playbackRate||!o.readyState))return;let v=a.mainForwardBufferInfo;if(!g&&null===v)return;let E=this.bwEstimator.getEstimateTTFB(),y=Math.abs(o.playbackRate);if(h<=Math.max(E,u/(2*y)*1e3))return;let b=v?v.len/y:0,T=d.loading.first?d.loading.first-d.loading.start:-1,A=d.loaded&&T>-1,S=this.getBwEstimate(),R=a.levels,k=R[m],I=Math.max(d.loaded,Math.round(u*(r.bitrate||k.averageBitrate)/8)),L=A?h-T:h;L<1&&A&&(L=Math.min(h,8*d.loaded/S));let D=A?1e3*d.loaded/L:0,w=E/1e3,C=D?(I-d.loaded)/D:8*I/S+w;if(C<=b)return;let M=D?8*D:S,P=(null==(t=(null==e?void 0:e.details)||a.latestLevelDetails)?void 0:t.live)===!0,O=a.config.abrBandWidthUpFactor,x=1/0;for(i=m-1;i>c;i--){let e=R[i].maxBitrate,t=!R[i].details||P;if((x=this.getTimeToLoadFrag(w,M,u*e,t))<Math.min(b,u+w))break}if(x>=C||x>10*u)return;A?this.bwEstimator.sample(h-Math.min(E,T),d.loaded):this.bwEstimator.sampleTTFB(h);let N=R[i].maxBitrate;this.getBwEstimate()*O>N&&(this.firstAutoFloor=Math.min(i,a.firstLevel),this.resetEstimator(N));
3let U=this.findBestLevel(N,c,i,0,b,1,1);U>-1&&(i=U),this.warn("Fragment ".concat(r.sn).concat(n?" part "+n.index:""," of level ").concat(m," is loading too slowly;\n      Fragment duration: ").concat(r.duration.toFixed(3),"\n      Time to underbuffer: ").concat(b.toFixed(3)," s\n      Estimated load time for current fragment: ").concat(C.toFixed(3)," s\n      Estimated load time for down switch fragment: ").concat(x.toFixed(3)," s\n      TTFB estimate: ").concat(0|T," ms\n      Current BW estimate: ").concat(tW(S)?0|S:"Unknown"," bps\n      New BW estimate: ").concat(0|this.getBwEstimate()," bps\n      Switching to level ").concat(i," @ ").concat(0|N," bps")),a.nextLoadLevel=a.nextAutoLevel=i,this.clearTimer();let F=()=>{this.clearTimer();let e=this.hls;if(this.fragCurrent===r&&e.loadLevel===i&&i>0){let t=this.getStarvationDelay();if(this.warn("Aborting inflight request ".concat(i>0?"and switching down":"","\n      Fragment duration: ").concat(r.duration.toFixed(3)," s\n      Time to underbuffer: ").concat(t.toFixed(3)," s")),r.abortRequests(),this.fragCurrent=this.partCurrent=null,i>c){let r=this.findBestLevel(e.levels[c].bitrate,c,i,0,t,1,1);-1===r&&(r=c),e.nextLoadLevel=e.nextAutoLevel=r,this.firstAutoFloor=Math.min(r,e.firstLevel),this.resetEstimator(e.levels[r].bitrate)}}};p||C>2*x?F():this.timer=self.setInterval(F,1e3*x),a.trigger(tz.FRAG_LOAD_EMERGENCY_ABORTED,{frag:r,part:n,stats:d})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}},bufferController:class extends im{hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null,this._onMediaEmptied=this._onMediaError=null}registerListeners(){let{hls:e}=this;
3e.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.BUFFER_RESET,this.onBufferReset,this),e.on(tz.BUFFER_APPENDING,this.onBufferAppending,this),e.on(tz.BUFFER_CODECS,this.onBufferCodecs,this),e.on(tz.BUFFER_EOS,this.onBufferEos,this),e.on(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tz.FRAG_PARSED,this.onFragParsed,this),e.on(tz.FRAG_CHANGED,this.onFragChanged,this),e.on(tz.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.BUFFER_RESET,this.onBufferReset,this),e.off(tz.BUFFER_APPENDING,this.onBufferAppending,this),e.off(tz.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tz.BUFFER_EOS,this.onBufferEos,this),e.off(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tz.FRAG_PARSED,this.onFragParsed,this),e.off(tz.FRAG_CHANGED,this.onFragChanged,this),e.off(tz.ERROR,this.onError,this)}transferMedia(){let{media:e,mediaSource:t}=this;if(!e)return null;let i={};if(this.operationQueue){let e=this.isUpdating();e||this.operationQueue.removeBlockers();let t=this.isQueued();(e||t)&&this.warn("Transfering MediaSource with".concat(t?" operations in queue":"").concat(e?" updating SourceBuffer(s)":""," ").concat(this.operationQueue)),this.operationQueue.destroy()}let r=this.transferData;return r&&!this.sourceBufferCount&&r.mediaSource===t?t6(i,r.tracks):this.sourceBuffers.forEach(e=>{let[t]=e;t&&(i[t]=t6({},this.tracks[t]),this.removeBuffer(t)),e[0]=e[1]=null}),{media:e,mediaSource:t,tracks:i}}initTracks(){this.resetAppendProgress(),this.sourceBuffers=[[null,null],[null,null]],this.tracks={},this.resetQueue(),this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null,this.resetAppendErrors(),this.resetAppendProgress()}onManifestParsed(e,t){var i;let r=2;(!t.audio||t.video)&&t.altAudio||(r=1),this.bufferCodecEventsTotal=r,this.log("".concat(r," bufferCodec event(s) expected.")),null!=(i=this.transferData)&&i.mediaSource&&this.sourceBufferCount&&r&&this.bufferCreated()}onMediaAttaching(e,t){let i=this.media=t.media;this.transferData=this.overrides=void 0;let r=ib(this.appendSource);if(r){let e=!!t.mediaSource;(e||t.overrides)&&(this.transferData=t,this.overrides=t.overrides);let n=this.mediaSource=t.mediaSource||new r;if(this.assignMediaSource(n),e)this._objectUrl=i.src,this.attachTransferred();else{let e=this._objectUrl=self.URL.createObjectURL(n);if(this.appendSource)try{i.removeAttribute("src");let t=self.ManagedMediaSource;i.disableRemotePlayback=i.disableRemotePlayback||t&&n instanceof t,sS(i),function(e,t){let i=self.document.createElement("source");i.type="video/mp4",i.src=t,e.appendChild(i)}(i,e),i.load()}catch(t){i.src=e}else i.src=e}as(i,"emptied",this._onMediaEmptied),as(i,"error",this._onMediaError),this.appendSource&&as(i,"seeking",this._onStartStreaming)}}assignMediaSource(e){var t,i;this.log("".concat((null==(t=this.transferData)?void 0:t.mediaSource)===e?"transferred":"created"," media source: ").concat(null==(i=e.constructor)?void 0:i.name)),as(e,"sourceopen",this._onMediaSourceOpen),as(e,"sourceended",this._onMediaSourceEnded),as(e,"sourceclose",this._onMediaSourceClose),this.appendSource&&(as(e,"startstreaming",this._onStartStreaming),as(e,"endstreaming",this._onEndStreaming))}attachTransferred(){let e=this.media,t=this.transferData;if(!t||!e)return;let i=this.tracks,r=t.tracks,n=r?Object.keys(r):null,a=n?n.length:0,s=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(r&&n&&a){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log("attachTransferred: (bufferCodecEventsTotal ".concat(this.bufferCodecEventsTotal,")\nrequired tracks: ").concat(rx(i,(e,t)=>"initSegment"===e?void 0:t),";\ntransfer tracks: ").concat(rx(r,(e,t)=>"initSegment"===e?void 0:t),"}")),!iT(r,i)){t.mediaSource=null,t.tracks=void 0;let n=e.currentTime,a=this.details,s=Math.max(n,(null==a?void 0:a.fragments[0].start)||0);return s-n>1?void this.log("attachTransferred: waiting for playback to reach new tracks start time ".concat(n," -> ").concat(s)):(this.warn('attachTransferred: resetting MediaSource for incompatible tracks ("'.concat(Object.keys(r),'"->"').concat(Object.keys(i),'") start time: ').concat(s," currentTime: ").concat(n)),this.onMediaDetaching(tz.MEDIA_DETACHING,{}
3),this.onMediaAttaching(tz.MEDIA_ATTACHING,t),void(e.currentTime=s))}this.transferData=void 0,n.forEach(e=>{let t=r[e];if(t){let i=t.buffer;if(i){let r=this.fragmentTracker,n=t.id;if(r.hasFragments(n)||r.hasParts(n)){let t=nh.getBuffered(i);r.detectEvictedFragments(e,t,n,null,null,!0)}let a=sR(e),s=[e,i];this.sourceBuffers[a]=s,i.updating&&this.operationQueue&&this.operationQueue.prependBlocker(e),this.trackSourceBuffer(e,t)}}}),s(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),s()}get mediaSourceOpenOrEnded(){var e;let t=null==(e=this.mediaSource)?void 0:e.readyState;return"open"===t||"ended"===t}onMediaDetaching(e,t){let i=!!t.transferMedia;this.transferData=this.overrides=void 0;let{media:r,mediaSource:n,_objectUrl:a}=this;if(n){if(this.log("media source ".concat(i?"transferring":"detaching")),i)this.sourceBuffers.forEach(e=>{let[t]=e;t&&this.removeBuffer(t)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){let e="open"===n.readyState;try{let t=n.sourceBuffers;for(let i=t.length;i--;)e&&t[i].abort(),n.removeSourceBuffer(t[i]);e&&n.endOfStream()}catch(e){this.warn("onMediaDetaching: ".concat(e.message," while calling endOfStream"))}}this.sourceBufferCount&&this.onBufferReset()}ao(n,"sourceopen",this._onMediaSourceOpen),ao(n,"sourceended",this._onMediaSourceEnded),ao(n,"sourceclose",this._onMediaSourceClose),this.appendSource&&(ao(n,"startstreaming",this._onStartStreaming),ao(n,"endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}r&&(ao(r,"emptied",this._onMediaEmptied),ao(r,"error",this._onMediaError),ao(r,"seeking",this._onStartStreaming),i||(a&&self.URL.revokeObjectURL(a),this.mediaSrc===a?(r.removeAttribute("src"),this.appendSource&&sS(r),r.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null)}onBufferReset(){this.sourceBuffers.forEach(e=>{let[t]=e;t&&this.resetBuffer(t)}),this.initTracks()}resetBuffer(e){var t,i;let r=null==(t=this.tracks[e])?void 0:t.buffer;if(this.removeBuffer(e),r)try{null!=(i=this.mediaSource)&&i.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(t){this.warn("onBufferReset ".concat(e),t)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[sR(e)]=[null,null];let t=this.tracks[e];t&&(this.clearBufferAppendTimeoutId(t),t.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new sb(this.tracks)}onBufferCodecs(e,t){var i;let r=this.tracks,n=Object.keys(t);this.log('BUFFER_CODECS: "'.concat(n,'" (current SB count ').concat(this.sourceBufferCount,")"));let a="audiovideo"in t&&(r.audio||r.video)||r.audiovideo&&("audio"in t||"video"in t),s=!a&&this.sourceBufferCount&&this.media&&n.some(e=>!r[e]);if(a||s)return void this.warn('Unsupported transition between "'.concat(Object.keys(r),'" and "').concat(n,'" SourceBuffers'));n.forEach(e=>{var i,n;let{id:a,codec:s,levelCodec:o,container:l,metadata:d,supplemental:u}=t[e],h=r[e],c=null==(i=this.transferData)||null==(i=i.tracks)?void 0:i[e],m=null!=c&&c.buffer?c:h,f=(null==m?void 0:m.pendingCodec)||(null==m?void 0:m.codec),p=null==m?void 0:m.levelCodec;h||(h=r[e]={buffer:void 0,listeners:[],codec:s,supplemental:u,container:l,levelCodec:o,metadata:d,id:a});let g=rv(f,p),v=null==g?void 0:g.replace(sT,"$1"),E=rv(s,o),y=null==(n=E)?void 0:n.replace(sT,"$1");E&&g&&v!==y&&("audio"===e.slice(0,5)&&(E=rg(E,this.appendSource)),this.log("switching codec ".concat(f," to ").concat(E)),E!==(h.pendingCodec||h.codec)&&(h.pendingCodec=E),h.container=l,this.appendChangeType(e,l,E))}),(this.tracksReady||this.sourceBufferCount)&&(t.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(!(this.bufferCodecEventsTotal>1)||this.tracks.video||t.video||(null==(i=t.audio)?void 0:i.id)!=="main"||(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,t)=>{let i=this.tracks[t];return e[t]={id:i.id,container:i.container,codec:i.codec,levelCodec:i.levelCodec},e},{})}appendChangeType(e,t,i){let r="".concat(t,";codecs=").concat(i);this.append({label:"change-type=".concat(r),execute:()=>{let n=this.tracks[e];if(n){let a=n.buffer;null!=a&&a.changeType&&(this.log("changing ".concat(e," sourceBuffer type to ").concat(r)),a.changeType(r),n.c
3odec=i,n.container=t)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:t=>{this.warn("Failed to change ".concat(e," SourceBuffer type"),t)}},e,this.isPending(this.tracks[e]))}blockAudio(e){var t;let i=e.start,r=i+.05*e.duration;(null==(t=this.fragmentTracker.getAppendedFrag(i,t$.MAIN))?void 0:t.gap)!==!0&&this.append({label:"block-audio",execute:()=>{var e,t;(this.lastVideoAppendEnd>r||nh.isBuffered(null==(e=this.tracks.video)?void 0:e.buffer,r)||(null==(t=this.fragmentTracker.getAppendedFrag(r,t$.MAIN))?void 0:t.gap)===!0)&&this.unblockAudio()},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn("Error executing block-audio operation",e)}},"audio",!0)}unblockAudio(){this.operationQueue&&this.operationQueue.unblockAudio()}onBufferAppending(e,t){let{tracks:i}=this,{data:r,type:n,parent:a,frag:s,part:o,chunkMeta:l,offset:d}=t,u=l.buffering[n],h=t2(s)&&!o&&!s.gap&&!l.partial&&!l.iframe,c=null,m=!1,{sn:f,cc:p}=s,g=self.performance.now();u.start=g;let v=s.stats.buffering,E=o?o.stats.buffering:null;0===v.start&&(v.start=g),(null==E?void 0:E.start)===0&&(E.start=g);let y=i.audio,b=!1;"audio"===n&&(null==y?void 0:y.container)==="audio/mpeg"&&(b=!this.lastMpegAudioChunk||1===l.id||this.lastMpegAudioChunk.sn!==l.sn,this.lastMpegAudioChunk=l);let T=i.video,A=null==T?void 0:T.buffer;if(A&&"initSegment"!==f&&void 0!==d){let e=null==y?void 0:y.buffer,t=o||s;if("audio"===n&&"main"!==a&&!(T.ending||T.ended)&&e&&nh.getBuffered(e).length){let e=t.start+.05*t.duration,i=nh.getBuffered(A),r=this.currentOp("video");i.length||r?!nh.isBuffered(A,e)&&this.lastVideoAppendEnd<e&&this.blockAudio(t):this.blockAudio(t)}else if("video"===n){let e=t.end,i=this.lastVideoAppendEnd-e;this.lastVideoAppendEnd=e,i<0||i>t.duration?this.unblockAudio():this.isAudioBlocked()&&this.executeNext("audio")}}let S=(o||s).start,R={label:"append-".concat(n),execute:()=>{var e;u.executeStart=self.performance.now();let t=null==(e=this.tracks[n])?void 0:e.buffer;t&&(h&&(m=sD(sL(c=nh.timeRangesToArray(nh.getBuffered(t)),s),s)),b?this.updateTimestampOffset(t,S,.1,n,f,p):void 0!==d&&tW(d)&&this.updateTimestampOffset(t,d,1e-6,n,f,p)),this.appendExecutor(r,n)},onStart:()=>{},onComplete:()=>{this.clearBufferAppendTimeoutId(this.tracks[n]);let e=self.performance.now();u.executeEnd=u.end=e,0===v.first&&(v.first=e),(null==E?void 0:E.first)===0&&(E.first=e);let t={};if(this.sourceBuffers.forEach(e=>{let[i,r]=e;i&&(t[i]=nh.getBuffered(r))}),h){let e=this.getFragmentAppendProgress(s),i=t[n];if(i&&c){let t=sL(nh.timeRangesToArray(i),s);e.progressed||(e.progressed=t-sL(c,s)>.001);let r=m&&sD(t,s);e.fullyBuffered[n]=void 0===e.fullyBuffered[n]?r:e.fullyBuffered[n]&&r}}this.hls.trigger(tz.BUFFER_APPENDED,{type:n,frag:s,part:o,chunkMeta:l,parent:a,timeRanges:t})},onError:e=>{var t,i;this.clearBufferAppendTimeoutId(this.tracks[n]);let d=e.code===DOMException.QUOTA_EXCEEDED_ERR||"QuotaExceededError"==e.name||"quota"in e;if(d&&!this._quotaEvictionPending[n]){let e=this.getBackBufferEvictionTarget(n,r.byteLength,s.type);if(e>0){this._quotaEvictionPending[n]=!0,this.log('QuotaExceededError on "'.concat(n,'" append sn: ').concat(f," - evicting back buffer to ").concat(e.toFixed(3),"s and retrying"));let t=this.getFlushOp(n,0,e),i=this.getClearEvictionPendingOp(n);this.insertNext([t,R,i],n);return}this.warn('QuotaExceededError on "'.concat(n,'" sn: ').concat(f," - no back buffer available to evict"))}h&&(this.getFragmentAppendProgress(s).errored=!0);let u={type:tY.MEDIA_ERROR,parent:a,details:tj.BUFFER_APPEND_ERROR,sourceBufferName:n,frag:s,part:o,chunkMeta:l,error:e,err:e,fatal:!1},c=null==(t=this.media)?void 0:t.error;if(e.name!==s_||0!==this.sourceBufferCount||this.media&&0!==this.pendingTrackCount){d&&(u.details=tj.BUFFER_FULL_ERROR);let t=++this.appendErrors[n],r=this.hls.config.appendErrorMaxRetry;this.warn("Failed ".concat(t,"/").concat(r+1,' times to append segment in "').concat(n,'" sourceBuffer with error: ').concat(e.message)),t>=r&&(u.fatal=!d);let a=null==(i=this.mediaSource)?void 0:i.readyState;("ended"===a||"closed"===a||c)&&(this.warn('MediaSource readyState "'.concat(a,'" during SourceBuffer').concat(sk(u.fatal,c))),u.details=tj.MEDIA_SOURCE_REQUIRES_RESET)}else u.errorAction=r1(!0);this.appendError=u,this.hls.trigger(tz.ERROR,u),d&&this.hls&&this.trimBuffers(s.start,1)}};this.log('queuing "'.concat(n,'" append sn: ').concat(f).concat(o?" p: "+o.index:""," of ").concat(a," playlist ").concat(s.level," cc: ").concat(p," offset: ").concat(d," bytes: ").concat(r.byteLength)),this.append(R,n,this.isPending(this.tracks[n]))}getClearEvictionPendingOp(e){return{label:"clear",execute:()=>{this._quotaEvictionPending[e]=!1,this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:()=>{}}}getFlushOp(e,t,i){return this.log('queuing "'.concat(e,'" remove ').concat(t,"-").concat(i)),{label:"remove",execute:()=>{this.removeExecutor(e,t,i)},onStart:()=>{},onComplete:()=>{var r;let n=null==(r=this.tracks[e])?void 0:r.buffer;this.log("Remove request ".concat(t,"-").concat(i," from ").concat(e," Source Buffer complete > buffer: ").concat(n?al(nh.getBuffered(n)):"(detached)")),this.hls.trigger(tz.BUFFER_FLUSHED,{type:e,start:t,end:i})},onError:r=>{this.warn("Failed to remove ".concat(t,"-").concat(i,' from "').concat(e,'" SourceBuffer'),r),this.hls.trigger(tz.BUFFER_FLUSHED,{type:e,start:0,end:0,error:r})}}}onBufferFlushing(e,t){let{type:i,startOffset:r,endOffset:n}=t;i&&"audio"!==i||this.unblockAudio(),i?this.append(this.getFlushOp(i,r,n),i):this.sourceBuffers.forEac
3h(e=>{let[t]=e;t&&this.append(this.getFlushOp(t,r,n),t)})}onFragParsed(e,t){let{frag:i,part:r,chunkMeta:n}=t,a=[],s=r?r.elementaryStreams:i.elementaryStreams;s[t0.AUDIOVIDEO]?a.push("audiovideo"):(s[t0.AUDIO]&&a.push("audio"),s[t0.VIDEO]&&a.push("video"));let o=()=>{let e=self.performance.now();i.stats.buffering.end=e,r&&(r.stats.buffering.end=e);let t=r?r.stats:i.stats;this.checkAppendProgress(i,r,n,a),this.hls&&(this.hls.trigger(tz.FRAG_BUFFERED,{frag:i,part:r,stats:t,id:i.type,chunkMeta:n}),!r&&i.gap&&t.retry&&this.log("Nothing buffered for ".concat(i.type," level: ").concat(i.level," sn: ").concat(i.sn," retries ").concat(t.retry)))};0===a.length&&this.log("Fragments must have at least one ElementaryStreamType set. ".concat(i.type," ").concat(i.level," ").concat(r?"part: ".concat(r.index," of "):"","sn: ").concat(i.sn)),this.blockBuffers(o,a).catch(e=>{this.warn("Fragment buffered callback ".concat(e.message)),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,t){var i,r;let n=null==(i=this.hls)?void 0:i.config;if(!n)return;let{backBufferLength:a,frontBufferFlushThreshold:s}=n;this.trimBuffers(s,a,t.frag,t.previousFrag);let o=t.frag.elementaryStreams,{appendErrors:l}=this,d=null==(r=this.appendError)?void 0:r.sourceBufferName;Object.keys(o).forEach(e=>{o[e]&&(l[e]=0,e===d&&(this.appendError=void 0),"audio"===e||"video"===e?(l.audiovideo=0,"audiovideo"===d&&(this.appendError=void 0)):(l.audio=0,l.video=0,"audiovideo"!==d&&(this.appendError=void 0)))})}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(e=>{let[t]=e;if(t){let e=this.tracks[t];if(e)return!e.ended||e.ending}return!1})}onBufferEos(e,t){var i;this.sourceBuffers.forEach(e=>{let[i]=e;if(i){let e=this.tracks[i];(!t.type||t.type===i)&&(e.ending=!0,e.ended||(e.ended=!0,this.log("".concat(i," buffer reached EOS"))))}});let r=(null==(i=this.overrides)?void 0:i.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(e=>{var t;let[i]=e;return i&&!(null!=(t=this.tracks[i])&&t.ended)})?(this.unblockAudio(),r?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();let{mediaSource:e}=this;if((null==e?void 0:e.readyState)!=="open"){e&&this.log("Could not call mediaSource.endOfStream(). mediaSource.readyState: ".concat(e.readyState));return}this.log("Calling mediaSource.endOfStream()"),e.endOfStream(),this.hls.trigger(tz.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(tz.BUFFERED_TO_END,void 0))):"video"===t.type&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(e=>{let[t]=e;if(null!==t){let e=this.tracks[t];e&&(e.ending=!1)}})}onLevelUpdated(e,t){let{details:i}=t;i.fragments.length&&(this.details=i,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{let e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,t){if(t.details===tj.BUFFER_APPEND_ERROR&&t.frag){var i;let e=null==(i=t.errorAction)?void 0:i.nextAutoLevel;tW(e)&&e!==t.frag.level&&this.resetAppendErrors()}}getBackBufferEvictionTarget(e,t,i){let{media:r}=this;return r?this.fragmentTracker.getBackBufferEvictionEnd(r.currentTime,i,t):0}getFragmentAppendProgress(e){var t;let i=sI(e),r=this.fragmentAppendProgress[i];return(null==(t=r)?void 0:t.stats)!==e.stats&&(r={stats:e.stats,progressed:!1,errored:!1,fullyBuffered:Object.create(null)},this.fragmentAppendProgress[i]=r),r}checkAppendProgress(e,t,i,r){if(t||!t2(e)||e.gap||i.iframe||i.partial)return;let n=sI(e),a=this.fragmentAppendProgress[n];delete this.fragmentAppendProgress[n];let s=e.stats.buffering;if(s.start&&!s.first)return;let o=(null==a?void 0:a.stats)===e.stats?a:void 0;if(null!=o&&o.errored)return;let l=r.length>0&&r.every(e=>(null==o?void 0:o.fullyBuffered[e])===!0);if(null!=o&&o.progressed||l)return void delete this.appendsWithoutProgress[n];if(!o&&0===r.length)return;let d=(this.appendsWithoutProgress[n]||0)+1,u=this.hls;d>=u.config.appendErrorMaxRetry?delete this.appendsWithoutProgress[n]:this.appendsWithoutProgress[n]=d,this.warn("Fragment ".concat(e.sn," of ").concat(e.type," playlist ").concat(e.level," appended ").concat(d," time").concat(d>1?"s":""," without buffered range growth")),u.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_APPEND_NO_PROGRESS,fatal:!1,frag:e,chunkMeta:i,parent:e.type,appendsWithoutProgress:d,error:Error("Fragment append did not increase buffered coverage (".concat(d,")"))})}resetAppendProgress(){this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null)}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0}trimBuffers(e,t,i,r){let{hls:n,details:a,media:s}=this;if(!s||null===a||!this.sourceBufferCount)return;let o=n.config,l=s.currentTime,d=a.levelTargetDuration;t=a.live&&null!==o.liveBackBufferLength?o.liveBackBufferLength:t;let u=-1/0;if(tW(t)&&t>=0){let e=Math.max(t,d);u=Math.floor(l/d)*d-e}if(i){let e=this.getLoopBackBufferFlushEnd(i,null!=r?r:null);e>0&&(u=Math.max(u,e))}if(u>0&&this.flushBackBuffer(l,d,u),tW(e)&&e>0){let t=Math.max(Math.max(o.maxBufferLength,e),d),i=Math.floor(l/d)*d+t;this.flushFrontBuffer(l,d,i)}}getLoopBackBufferFlushEnd(e,t){var i;let{media:r}=this;if((null==(i=this.hls)?void 0:i.config.loopBackBufferFlush)===!1||!(null!=r&&r.loop)||!t||e.level<=t.level)return 0;let{video:n,audiovideo:a}=e.elementaryStreams;if(null!=n&&n.partial||null!=a&&a.partial)return 0;let s=this.getEarliestElementaryStreamStart(e)-.25;return s<=0?0:(this.log("Flushing lower quality back buffer for loop: level ".concat(e.level,", range [0-").concat(s.toFixed(3),"]")),s)}getEarliestElementaryStreamStart(e){let{audio:t,video:i,audiovideo:r}=e.elementaryStreams,n=e.start;return r?n=Math.min(n,r.startDTS):(t&&(n=Math.min(n,t.startDTS)),i&&(n=Math.min(n,i.startDTS))),n}
3flushBackBuffer(e,t,i){this.sourceBuffers.forEach(e=>{let[t,r]=e;if(r){let e=nh.getBuffered(r);if(e.length>0&&i>e.start(0)){var n,a,s;this.hls.trigger(tz.BACK_BUFFER_REACHED,{bufferEnd:i});let e=this.tracks[t];if(null!=(n=this.details)&&n.live)this.hls.trigger(tz.LIVE_BACK_BUFFER_REACHED,{bufferEnd:i});else if(null!=e&&e.ended&&!(null!=(a=this.media)&&a.loop&&(null==(s=this.hls)?void 0:s.config.loopBackBufferFlush)!==!1))return void this.log("Cannot flush ".concat(t," back buffer while SourceBuffer is in ended state"));this.hls.trigger(tz.BUFFER_FLUSHING,{startOffset:0,endOffset:i,type:t})}}})}flushFrontBuffer(e,t,i){this.sourceBuffers.forEach(t=>{let[r,n]=t;if(n){let t=nh.getBuffered(n),a=t.length;if(a<2)return;let s=t.start(a-1),o=t.end(a-1);if(i>s||e>=s&&e<=o)return;this.hls.trigger(tz.BUFFER_FLUSHING,{startOffset:s,endOffset:1/0,type:r})}})}getDurationAndRange(){var e;let{details:t,mediaSource:i}=this;if(!t||!this.media||(null==i?void 0:i.readyState)!=="open")return null;let r=t.edge;if(t.live&&this.hls.config.liveDurationInfinity){if(t.fragments.length&&i.setLiveSeekableRange){let e=Math.max(0,t.fragmentStart),i=Math.max(e,r);return{duration:1/0,start:e,end:i}}return{duration:1/0}}let n=null==(e=this.overrides)?void 0:e.duration;if(n)return tW(n)?{duration:n}:null;let a=this.media.duration;return r>(tW(i.duration)?i.duration:0)&&r>a||!tW(a)?{duration:r}:null}updateMediaSource(e){let{duration:t,start:i,end:r}=e,n=this.mediaSource;n&&this.media&&"open"===n.readyState&&(n.duration!==t&&(tW(t)&&this.log("Updating MediaSource duration to ".concat(t.toFixed(3))),n.duration=t),void 0!==i&&void 0!==r&&(this.log("MediaSource duration is set to ".concat(n.duration,". Setting seekable range to ").concat(i,"-").concat(r,".")),n.setLiveSeekableRange(i,r)))}get tracksReady(){let e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){let{bufferCodecEventsTotal:e,pendingTrackCount:t,tracks:i}=this;if(this.log("checkPendingTracks (pending: ".concat(t," codec events expected: ").concat(e,") ").concat(rx(i))),this.tracksReady){var r;let e=null==(r=this.transferData)?void 0:r.tracks;e&&Object.keys(e).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){let e={};this.sourceBuffers.forEach(t=>{let[i,r]=t;if(i){let t=this.tracks[i];e[i]={buffer:r,container:t.container,codec:t.codec,supplemental:t.supplemental,levelCodec:t.levelCodec,id:t.id,metadata:t.metadata}}}),this.hls.trigger(tz.BUFFER_CREATED,{tracks:e}),this.log("SourceBuffers created. Running queue: ".concat(this.operationQueue)),this.sourceBuffers.forEach(e=>{let[t]=e;this.executeNext(t)})}else{let e=Error("could not create source buffer for media codec(s)");this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){let{tracks:e,sourceBuffers:t,mediaSource:i}=this;if(!i)throw Error("createSourceBuffers called when mediaSource was null");for(let n in e){let a=e[n];if(this.isPending(a)){let e=this.getTrackCodec(a,n),s="".concat(a.container,";codecs=").concat(e);a.codec=e,this.log("creating sourceBuffer(".concat(s,")").concat(this.currentOp(n)?" Queued":""," ").concat(rx(a)));try{let e=i.addSourceBuffer(s),r=sR(n),o=[n,e];t[r]=o,a.buffer=e}catch(e){var r;this.error("error while trying to add sourceBuffer: ".concat(e.message)),this.shiftAndExecuteNext(n),null==(r=this.operationQueue)||r.removeBlockers(),delete this.tracks[n],this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:e,sourceBufferName:n,mimeType:s,parent:a.id});return}this.trackSourceBuffer(n,a)}}this.bufferCreated()}clearBufferAppendTimeoutId(e){e&&(self.clearTimeout(e.bufferAppendTimeoutId),e.bufferAppendTimeoutId=void 0)}getTrackCodec(e,t){let i=e.supplemental,r=e.codec;i&&("video"===t||"audiovideo"===t)&&rd(i,"video")&&(r=function(e,t){let i=[];if(e){let t=e.split(",");for(let e=0;e<t.length;e++)rl(t[e],"video")||i.push(t[e])}return t&&i.push(t),i.join(",")}(r,i));let n=rv(r,e.levelCodec);return n?"audio"===t.slice(0,5)?rg(n,this.appendSource):n:""}trackSourceBuffer(e,t){let i=t.buffer;if(!i)return;let r=this.getTrackCodec(t,e);this.tracks[e]={buffer:i,codec:r,container:t.container,levelCodec:t.levelCodec,supplemental:t.supplemental,metadata:t.metadata,id:t.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(e,t)=>{let i=t.removedRanges;null!=i&&i.length&&(this.log("".concat(e," buffer removed ").concat(al(i))),this.hls.trigger(tz.BUFFER_FLUSHED,{type:e,start:i.start(0),end:i.end(i.length-1)}))})}get mediaSrc(){var e,t;let i=(null==(e=this.media)||null==(t=e.querySelector)?void 0:t.call(e,"source"))||this.media;return null==i?void 0:i.src}onSBUpdateStart(e){let t=this.currentOp(e);t&&t.onStart()}onSBUpdateEnd(e){var t,i;if((null==(t=this.mediaSource)?void 0:t.readyState)==="closed")return void this.resetBuffer(e);let r=this.currentOp(e);if(r){if(r.onComplete(),null==(i=this.tracks[e])||null==(i=i.buffer)?void 0:i.updating){this.log("".concat(e,' SourceBuffer updating on "updateend"')),this.blockUntilOpen(()=>{this.shiftAndExecuteNext(e)});return}this.shiftAndExecuteNext(e)}}onSBUpdateError(e,t){var i;let r=null==(i=this.mediaSource)?void 0:i.readyState,n=Error("".concat(e," SourceBuffer error. MediaSource readyState: ").concat(r));this.error("".concat(n.message),t),this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:n,fatal:!1});let a=this.currentOp(e);a&&a.onError(n)}updateTimestampOffset(e,t,i,r,n,a){Math.abs(t-e.timestampOffset)>=i&&(this.log("Updating ".concat(r," SourceBuffer timestampOffset to ").concat(t," (sn: ").concat(n," cc: ").concat(a,")")),e.timestampOffset=t)}removeExecutor(e,t,i){let{media:r,mediaSource:n}=this,a=this.tracks[e],s=null==a?void 0:a.buffer;if(!r||!n||!s)throw Error("Attempting to remove from the ".concat(e," SourceBuffer, but it does not exist"));let o=tW(r.duration)?r.duration:1/0,l=tW(n.duration)?n.duration:1/0,d=Math.max(0,t);if(d>=l){var u;null==(u=this.currentOp(e))||u.onComplete(),this.shiftAndExecuteNext(e);return}let h=Math.min(i,o,l);if(h>d&&(!a.ending||a.ended))a.ended=!1,this.log("Removing [".concat(d,",").concat(h,"] from the ").concat(e," SourceBuffer")),s.remove(d,h);
3else throw Error("Cannot remove ".concat(h<=d?"invalid range (".concat(d," >= ").concat(h,") "):"","from the ").concat(e," SourceBuffer").concat(a.ending?" while track ending":""))}appendExecutor(e,t){let i=this.tracks[t],r=null==i?void 0:i.buffer;if(!r)throw new sA("Attempting to append to the ".concat(t," SourceBuffer, but it does not exist"));if(i.ending=!1,i.ended=!1,this.hls.config.appendTimeout!==1/0){let e=this.calculateAppendTimeoutTime(r);i.bufferAppendTimeoutId=self.setTimeout(()=>this.appendTimeoutHandler(t,r,e),e)}r.appendBuffer(e)}appendTimeoutHandler(e,t,i){this.log("Received timeout after ".concat(i,"ms for append on ").concat(e," source buffer. Aborting and triggering error."));try{t.abort()}catch(t){this.log("Failed to abort append on ".concat(e," source buffer after timeout."))}let r=this.currentOp(e);r&&r.onError(Error("".concat(e,"-append-timeout")))}calculateAppendTimeoutTime(e){let t=10;this.details&&(t=this.details.levelTargetDuration);let i=2*t*1e3;if(null===this.media)return i;let r=nh.bufferInfo(e,this.media.currentTime,0);return r.len?(i=Math.max(1e3*r.len,i),Math.max(this.hls.config.appendTimeout,i)):i}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(e=>{this.warn("SourceBuffer blocked callback ".concat(e)),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(e){this.warn("Callback run without blocking ".concat(this.operationQueue," ").concat(e))}}isUpdating(){return this.sourceBuffers.some(e=>{let[t,i]=e;return t&&i.updating})}isQueued(){return this.sourceBuffers.some(e=>{let[t]=e;return t&&!!this.currentOp(t)})}isPending(e){return!!e&&!e.buffer}isAudioBlocked(){var e;return(null==(e=this.currentOp("audio"))?void 0:e.label)==="block-audio"}isAudioBlocking(){return!!this.operationQueue&&this.operationQueue.audioBlocking()}blockBuffers(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.sourceBufferTypes;if(!t.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);let{operationQueue:i}=this;return Promise.all(2===t.length&&this.isAudioBlocking()?[this.appendBlocker("video")]:t.map(e=>this.appendBlocker(e))).then(t=>{i===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(e=>{var t;let i=null==(t=this.tracks[e])?void 0:t.buffer;!i||i.updating||"audio"===e&&this.isAudioBlocked()||this.shiftAndExecuteNext(e)})}append(e,t,i){this.operationQueue&&this.operationQueue.append(e,t,i)}insertNext(e,t){this.operationQueue&&this.operationQueue.insertNext(e,t)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,t)=>e+ +!!this.isPending(this.tracks[t]),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,t)=>{let[i]=t;return e+ +!!i},0)}get sourceBufferTypes(){return this.sourceBuffers.map(e=>{let[t]=e;return t}).filter(e=>!!e)}addBufferListener(e,t,i){let r=this.tracks[e];if(!r)return;let n=r.buffer;if(!n)return;let a=i.bind(this,e);r.listeners.push({event:t,listener:a}),as(n,t,a)}removeBufferListeners(e){let t=this.tracks[e];if(!t)return;let i=t.buffer;i&&(t.listeners.forEach(e=>{ao(i,e.event,e.listener)}),t.listeners.length=0)}constructor(e,t){var i;super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null),this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0,this._quotaEvictionPending={},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=e=>{var t;this.hls&&(null==(t=this.mediaSource)?void 0:t.readyState)==="open"&&this.media&&!this.media.seeking&&this.hls.pauseBuffer
3ing()},this._onStartStreaming=e=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=e=>{let{media:t,mediaSource:i}=this;e&&this.log("Media source opened"),t&&i&&(ao(i,"sourceopen",this._onMediaSourceOpen),ao(t,"emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(tz.MEDIA_ATTACHED,{media:t,mediaSource:i}),null!==this.mediaSource&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{if(this.log("Media source closed"),this.media){let e=this.media.error,{appendError:t,appendErrors:i}=this,r=!1;!t&&e&&(r=Math.max(++i.audio,++i.video,++i.audiovideo)>=this.hls.config.appendErrorMaxRetry);let n=Error("MediaSource closed while media attached".concat(sk(r,e)));this.warn(n),this.hls.trigger(tz.ERROR,t6({fatal:r},t,{type:tY.MEDIA_ERROR,details:tj.MEDIA_SOURCE_REQUIRES_RESET,error:n}))}},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{let{mediaSrc:e,_objectUrl:t}=this;e!==t&&this.error("Media element src was set while attaching MediaSource (".concat(t," > ").concat(e,")"))},this._onMediaError=()=>{let{media:e}=this;if(e){var t,i;this.log("Media error (code: ".concat(null==(t=e.error)?void 0:t.code,"): ").concat(null==(i=e.error)?void 0:i.message))}},this.hls=e,this.fragmentTracker=t,this.appendSource=(i=ib(e.config.preferManagedMediaSource),"undefined"!=typeof self&&i===self.ManagedMediaSource),this.initTracks(),this.registerListeners()}},capLevelController:sw,errorController:class extends im{registerListeners(){let e=this.hls;e.on(tz.ERROR,this.onError,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tz.ERROR,this.onError,this),e.off(tz.ERROR,this.onErrorOut,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(null==e?void 0:e.type)===t$.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;let t=this.hls,i=t.currentLevel;return null!=(e=t.loadLevelObj)&&e.details||-1===i?t.loadLevel:i}variantHasKey(e,t){if(e){var i;if(null!=(i=e.details)&&i.hasKey(t))return!0;let r=e.audioGroups;if(r)return this.hls.allAudioTracks.filter(e=>r.indexOf(e.groupId)>=0).some(e=>{var i;return null==(i=e.details)?void 0:i.hasKey(t)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,t){var i,r;if(t.fatal)return;let n=this.hls,a=t.context;switch(t.details){case tj.FRAG_LOAD_ERROR:case tj.FRAG_LOAD_TIMEOUT:case tj.KEY_LOAD_ERROR:case tj.KEY_LOAD_TIMEOUT:t.errorAction=this.getFragRetryOrSwitchAction(t);return;case tj.FRAG_PARSING_ERROR:if(null!=(i=t.frag)&&i.gap){t.errorAction=r1();return}case tj.FRAG_GAP:case tj.FRAG_DECRYPT_ERROR:t.errorAction=this.getFragRetryOrSwitchAction(t),t.errorAction.action=rZ.SendAlternateToPenaltyBox;return;case tj.PLAYLIST_UNCHANGED_ERROR:case tj.LEVEL_EMPTY_ERROR:case tj.LEVEL_PARSING_ERROR:{let e=t.parent===t$.MAIN?t.level:n.loadLevel;t.details===tj.LEVEL_EMPTY_ERROR&&null!=(r=t.context)&&null!=(r=r.levelDetails)&&r.live?t.errorAction=this.getPlaylistRetryOrSwitchAction(t,e):(t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e))}return;case tj.LEVEL_LOAD_ERROR:case tj.LEVEL_LOAD_TIMEOUT:"number"==typeof(null==a?void 0:a.level)&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,a.level));return;case tj.AUDIO_TRACK_LOAD_ERROR:case tj.AUDIO_TRACK_LOAD_TIMEOUT:case tj.SUBTITLE_LOAD_ERROR:case tj.SUBTITLE_TRACK_LOAD_TIMEOUT:if(a){let e=n.loadLevelObj;e&&(a.type===tJ.AUDIO_TRACK&&e.hasAudioGroup(a.groupId)||a.type===tJ.SUBTITLE_TRACK&&e.hasSubtitleGroup(a.groupId))&&(t.errorAction=this.getPlaylistRetryOrSwitchAction(t,n.loadLevel),t.errorAction.action=rZ.SendAlternateToPenaltyBox,t.errorAction.flags=rJ.MoveAllAlternatesMatchingHost)}return;case tj.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:t.errorAction={action:rZ.SendAlternateToPenaltyBox,flags:rJ.MoveAllAlternatesMatchingHDCP};return;case tj.KEY_SYSTEM_SESSION_UPDATE_FAILED:case tj.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case tj.KEY_SYSTEM_NO_SESSION:t.errorAction={action:rZ.SendAlternateToPenaltyBox,flags:rJ.MoveAllAlternatesMatchingKey};return;
3case tj.BUFFER_ADD_CODEC_ERROR:case tj.REMUX_ALLOC_ERROR:case tj.BUFFER_APPEND_ERROR:t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level));return;case tj.MEDIA_SOURCE_REQUIRES_RESET:t.errorAction||(t.errorAction=this.getLevelSwitchAction(t,t.level)),t.errorAction.flags|=rJ.ResetMediaSource|rJ.SwitchToSDR;return;case tj.INTERNAL_EXCEPTION:case tj.BUFFER_APPENDING_ERROR:case tj.BUFFER_APPEND_NO_PROGRESS:case tj.BUFFER_FULL_ERROR:case tj.LEVEL_SWITCH_ERROR:case tj.BUFFER_STALLED_ERROR:case tj.BUFFER_SEEK_OVER_HOLE:case tj.BUFFER_NUDGE_ON_STALL:t.errorAction=r1();return}t.type===tY.KEY_SYSTEM_ERROR&&(t.levelRetry=!1,t.errorAction=r1())}getPlaylistRetryOrSwitchAction(e,t){let i=ia(this.hls.config.playlistLoadPolicy,e),r=this.playlistError++;if(il(i,r,it(e),e.response))return{action:rZ.RetryRequest,flags:rJ.None,retryConfig:i,retryCount:r};let n=this.getLevelSwitchAction(e,t);return i&&(n.retryConfig=i,n.retryCount=r),n}getFragRetryOrSwitchAction(e){let t=this.hls,i=this.getVariantLevelIndex(e.frag),r=t.levels[i],{fragLoadPolicy:n,keyLoadPolicy:a}=t.config,s=ia(ii(e)?a:n,e),o=t.levels.reduce((e,t)=>e+t.fragmentError,0);if(r&&(e.details!==tj.FRAG_GAP&&r.fragmentError++,!ir(e))&&il(s,o,it(e),e.response))return{action:rZ.RetryRequest,flags:rJ.None,retryConfig:s,retryCount:o};let l=this.getLevelSwitchAction(e,i);return s&&(l.retryConfig=s,l.retryCount=o),l}getLevelSwitchAction(e,t){let i=this.hls;null==t&&(t=i.loadLevel);let r=this.hls.levels[t];if(r){var n,a,s,o;let t=e.details;r.loadError++,r.loadErrorTime=self.performance.now(),t===tj.BUFFER_APPEND_ERROR&&r.fragmentError++;let l=-1,{levels:d,loadLevel:u,minAutoLevel:h,maxAutoLevel:c}=i;i.autoLevelEnabled||i.config.preserveManualLevelOnError||(i.loadLevel=-1);let m=null==(n=e.frag)?void 0:n.type,f=(m===t$.AUDIO&&t===tj.FRAG_PARSING_ERROR||"audio"===e.sourceBufferName&&r$(e))&&d.some(e=>{let{audioCodec:t}=e;return r.audioCodec!==t}),p="video"===e.sourceBufferName&&r$(e)&&d.some(e=>{let{codecSet:t,audioCodec:i}=e;return r.codecSet!==t&&r.audioCodec===i}),{type:g,groupId:v}=null!=(a=e.context)?a:{};for(let n=d.length;n--;){let a=(n+u)%d.length;if(a!==u&&a>=h&&a<=c&&(0===d[a].loadError||iu(d[a],i.config.errorPenaltyExpireMs))){let i=d[a];if(t===tj.FRAG_GAP&&m===t$.MAIN&&e.frag){let t=d[a].details;if(t){let i=rj(e.frag,t.fragments,e.frag.start);if(null!=i&&i.gap)continue}}else if(g===tJ.AUDIO_TRACK&&i.hasAudioGroup(v)||g===tJ.SUBTITLE_TRACK&&i.hasSubtitleGroup(v))continue;else if(m===t$.AUDIO&&null!=(s=r.audioGroups)&&s.some(e=>i.hasAudioGroup(e))||m===t$.SUBTITLE&&null!=(o=r.subtitleGroups)&&o.some(e=>i.hasSubtitleGroup(e))||f&&r.audioCodec===i.audioCodec||p&&r.codecSet===i.codecSet||!f&&r.audioCodec!==i.audioCodec)continue;l=a;break}}if(l>-1&&i.loadLevel!==l)return e.levelRetry=!0,this.playlistError=0,{action:rZ.SendAlternateToPenaltyBox,flags:rJ.None,nextAutoLevel:l}}return{action:rZ.SendAlternateToPenaltyBox,flags:rJ.MoveAllAlternatesMatchingHost}}onErrorOut(e,t){var i,r;switch(null==(i=t.errorAction)?void 0:i.action){case rZ.DoNothing:break;case rZ.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(t),t.errorAction.resolved||t.details===tj.FRAG_GAP||t.details===tj.PLAYLIST_UNCHANGED_ERROR||r0(t)||(t.fatal=!0);case rZ.RetryRequest:}if(((null==(r=t.errorAction)?void 0:r.flags)||0)&rJ.ResetMediaSource&&this.hls.recoverMediaError(),t.fatal)return void this.hls.stopLoad()}sendAlternateToPenaltyBox(e){let t=this.hls,i=e.errorAction;if(!i)return;let r=i.nextAutoLevel;if(i.flags===rJ.None)this.switchLevel(e,r);else if(i.flags&rJ.SwitchToSDR){let e=this.hls.levels,t=e.length;for(let i=t;i--;)"SDR"!==e[i].videoRange?(e[i].fragmentError++,e[i].loadError++):void 0===r&&(r=i)}else if(i.flags&rJ.MoveAllAlternatesMatchingHDCP){let r=this.getVariantLevelIndex(e.frag),n=t.levels[r],a=null==n?void 0:n.attrs["HDCP-LEVEL"];i.hdcpLevel=a;let s="NONE"===a;a&&!s?(t.maxHdcpLevel=rL[rL.indexOf(a)-1],i.resolved=!0,this.warn('Restricting playback to HDCP-LEVEL of "'.concat(t.maxHdcpLevel,'" or lower'))):(s&&this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE"),i.flags|=rJ.MoveAllAlternatesMatchingKey)}if(i.flags&rJ.MoveAllAlternatesMatchingKey){let t=e.decryptdata;if(t){let r=this.hls.levels,s=r.length;for(let i=s;i--;)if(this.variantHasKey(r[i],t)){var n,a;this.log("Banned key found in level ".concat(i," (").concat(r[i].bitrate,'bps) or audio group "').concat(null==(n=r[i].audioGroups)?void 0:n.join(","),'" (').concat(null==(a=e.frag)?void 0:a.type," fragment) ").concat(iN(t.keyId||[]))),r[i].fragmentError++,r[i].loadError++,this.log("Removing level ".concat(i," with key error (").concat(e.error,")")),this.hls.removeLevel(i)}let o=e.frag;if(this.hls.levels.length<s)i.resolved=!0;else if(o&&o.type!==t$.MAIN){let e=o.decryptdata;e&&!t.matches(e)&&(i.resolved=!0)}}}i.resolved||this.switchLevel(e,r)}switchLevel(e,t){if(void 0!==t&&e.errorAction&&(this.warn("switching to level ".concat(t," after ").concat(e.details)),this.hls.nextAutoLevel=t,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===tj.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&"audiovideo"!==e.sourceBufferName)){let t=rb(e.mimeType),i=this.hls.levels;for(let r=i.length;r--;)i[r]["".concat(e.sourceBufferName,"Codec")]===t&&(this.log("Removing level ".concat(r," for ").concat(e.details,' ("').concat(t,'" not supported)')),this.hls.removeLevel(r))}}constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}},fpsController:class{setStreamController(e){this.streamController=e}
3registerListeners(){this.hls.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,t){let i=this.hls.config;if(i.capLevelOnFPSDrop){let e=t.media instanceof self.HTMLVideoElement?t.media:null;this.media=e,e&&"function"==typeof e.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,t,i){let r=performance.now();if(t){if(this.lastTime){let e=r-this.lastTime,n=i-this.lastDroppedFrames,a=t-this.lastDecodedFrames,s=1e3*n/e,o=this.hls;if(o.trigger(tz.FPS_DROP,{currentDropped:n,currentDecoded:a,totalDroppedFrames:i}),s>0&&n>o.config.fpsDroppedMonitoringThreshold*a){let e=o.currentLevel;o.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+e),e>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=e)&&(e-=1,o.trigger(tz.FPS_DROP_LEVEL_CAPPING,{level:e,droppedLevel:o.currentLevel}),o.autoLevelCapping=e,this.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=i,this.lastDecodedFrames=t}}checkFPSInterval(){let e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){let t=e.getVideoPlaybackQuality();this.checkFPS(e,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}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()}},id3TrackController:class{destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){let{hls:e}=this;
3e&&(e.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tz.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tz.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,t){this.media=t.media}onMediaAttached(){var e;let t=null==(e=this.hls)?void 0:e.latestLevelDetails;t&&this.updateDateRangeCues(t)}onMediaDetaching(e,t){this.media=null,t.transferMedia||(this.id3Track&&(this.id3Track.remove(),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){return o7(e,"metadata","id3","","hidden")}onFragParsingMetadata(e,t){if(!this.media||!this.hls)return;let{enableEmsgMetadataCues:i,enableID3MetadataCues:r}=this.hls.config;if(!i&&!r)return;let{samples:n}=t;this.id3Track||(this.id3Track=this.createTrack(this.media));let a=ls();if(a)for(let e=0;e<n.length;e++){let t=n[e].type;if(t===aS.emsg&&!i||!r)continue;let s=iP(n[e].data),o=n[e].pts,l=o+n[e].duration;l>ll&&(l=ll),l-o<=0&&(l=o+.25);for(let e=0;e<s.length;e++){let i=s[e];if(!iO(i)){this.updateId3CueEnds(o,t);let e=lo(a,o,l,i,t);e&&this.id3Track.track.addCue(e)}}}}updateId3CueEnds(e,t){var i;let r=null==(i=this.id3Track)?void 0:i.track.cues;if(r)for(let i=r.length;i--;){let n=r[i];n.type===t&&n.startTime<e&&n.endTime===ll&&(n.endTime=e)}}onBufferFlushing(e,t){let{startOffset:i,endOffset:r,type:n}=t,{id3Track:a,hls:s}=this;if(!s)return;let{config:{enableEmsgMetadataCues:o,enableID3MetadataCues:l}}=s;if(a&&(o||l)){let e;e="audio"===n?e=>e.type===aS.audioId3&&l:"video"===n?e=>e.type===aS.emsg&&o:e=>e.type===aS.audioId3&&l||e.type===aS.emsg&&o,lt(a.track,i,r,e)}}onLevelUpdated(e,t){let{details:i}=t;this.updateDateRangeCues(i,!0)}onLevelPtsUpdated(e,t){Math.abs(t.drift)>.01&&this.updateDateRangeCues(t.details)}updateDateRangeCues(e,t){var i,r;if(!this.hls||!this.media)return;let{assetPlayerId:n,timelineOffset:a,enableDateRangeMetadataCues:s,interstitialsController:o}=this.hls.config;if(!s)return;let l=ls();if(n&&a&&!o){let{fragmentStart:t,fragmentEnd:i}=e,r=this.assetCue;r?(r.startTime=t,r.endTime=i):l&&(r=this.assetCue=lo(l,t,i,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"))&&(r.id=n,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.track.addCue(r),r.addEventListener("enter",this.onEventCueEnter))}if(!e.hasProgramDateTime)return;let{id3Track:d}=this,{dateRanges:u}=e,h=Object.keys(u),c=this.dateRangeCuesAppended;if(d&&t)if(null!=(i=d.track.cues)&&i.length){let e=Object.keys(c).filter(e=>-1===h.indexOf(e));for(let t=e.length;t--;){let i=e[t],n=null==(r=c[i])?void 0:r.cues;delete c[i],n&&Object.keys(n).forEach(e=>{let t=n[e];if(t){t.removeEventListener("enter",this.onEventCueEnter);try{d.track.removeCue(t)}catch(e){}}})}}else c=this.dateRangeCuesAppended={};let m=e.fragments[e.fragments.length-1];if(0!==h.length&&tW(null==m?void 0:m.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let e=0;e<h.length;e++){let t=h[e],i=u[t],r=i.startTime,n=c[t],a=(null==n?void 0:n.cues)||{},s=(null==n?void 0:n.durationKnown)||!1,d=ll,{duration:m,endDate:f}=i;if(f&&null!==m)d=r+m,s=!0;else if(i.endOnNext&&!s){let e=h.reduce((e,t)=>{if(t!==i.id){let r=u[t];if(r.class===i.class&&r.startDate>i.startDate&&(!e||i.startDate<e.startDate))return r}return e},null);e&&(d=e.startTime,s=!0)}let p=Object.keys(i.attr);for(let e=0;e<p.length;e++){let u=p[e];if("ID"===u||"CLASS"===u||"CUE"===u||"START-DATE"===u||"DURATION"===u||"END-DATE"===u||"END-ON-NEXT"===u)continue;let h=a[u];if(h)s&&!(null!=n&&n.durationKnown)?h.endTime=d:Math.abs(h.startTime-r)>.01&&(h.startTime=r,h.endTime=d);else if(l){let e=i.attr[u];("SCTE35-OUT"===u||"SCTE35-IN"===u||"SCTE35-CMD"===u)&&(e=iU(e));let n=lo(l,r,d,{key:u,data:e},aS.dateRange);
3n&&(n.id=t,this.id3Track.track.addCue(n),a[u]=n,o&&("X-ASSET-LIST"===u||"X-ASSET-URL"===u)&&n.addEventListener("enter",this.onEventCueEnter))}}c[t]={cues:a,dateRange:i,durationKnown:s}}}}constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(tz.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}},gapController:class extends no{registerListeners(){let{hls:e}=this;e&&(e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,t){this.setInterval(100),this.mediaSource=t.mediaSource;let i=this.media=t.media;as(i,"playing",this.onMediaPlaying),as(i,"waiting",this.onMediaWaiting),as(i,"ended",this.onMediaEnded)}onMediaDetaching(e,t){this.clearInterval();let{media:i}=this;i&&(ao(i,"playing",this.onMediaPlaying),ao(i,"waiting",this.onMediaWaiting),ao(i,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,t){this.buffered=t.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}getCurrentTime(){var e;let t=(null==(e=this.hls)?void 0:e.config.timelineOffset)||0;return this.media?Math.max(this.media.currentTime,t):t}tick(){var e;if(!(null!=(e=this.media)&&e.readyState)||!this.hasBuffered)return;let t=this.getCurrentTime();this.media.currentTime<t||(this.poll(t,this.lastCurrentTime),this.lastCurrentTime=t)}poll(e,t){var i,r,n;let a=null==(i=this.hls)?void 0:i.config;if(!a)return;let s=this.media;if(!s)return;let{seeking:o}=s,l=this.seeking&&!o,d=!this.seeking&&o,u=s.paused&&!o||s.ended||0===s.playbackRate;if(this.seeking=o,e!==t){t&&(this.ended=0),this.moved=!0,!o&&(this.skipRetry=this.nudgeRetry=0,a.nudgeOnVideoHole&&!u&&e>t&&this.nudgeOnVideoHole(e,t)),0===this.waiting&&this.stallResolved(e);return}if(d||l){l&&this.stallResolved(e);return}if(u){this.skipRetry=this.nudgeRetry=0,this.stallResolved(e),!this.ended&&s.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(tz.MEDIA_ENDED,{stalled:!1}));return}if(!nh.getBuffered(s).length){this.skipRetry=this.nudgeRetry=0;return}let h=nh.bufferInfo(s,e,0),c=this.fragmentTracker;c&&this.hls&&la(h,e,c,this.hls);let m=h.nextStart||0;if(o&&c&&this.hls){let t=li(this.hls.inFlightFragments,e),i=h.len>2,r=!m||t||m-e>2&&!c.getPartialFragment(e);if(i||r)return;this.moved=!1}let f=null==(r=this.hls)?void 0:r.latestLevelDetails;if(!this.moved&&null!==this.stalled&&c){if(!(h.len>0)&&!m)return;let t=Math.max(m,h.start||0)-e,i=null!=f&&f.live?2*f.targetduration:2,r=ln(e,c);if(t>0&&(t<=i||r)){s.paused||this._trySkipBufferHole(r);return}}let p=a.detectStallWithCurrentTimeMs,g=self.performance.now(),v=this.waiting,E=this.stalled;if(null===E)if(v>0&&g-v<p)E=this.stalled=v;else{this.stalled=g;return}let y=g-E;if(!o&&(y>=p||v&&this.moved)&&this.hls){if((null==(n=this.mediaSource)?void 0:n.readyState)==="ended"&&!(null!=f&&f.live)&&1>Math.abs(e-((null==f?void 0:f.edge)||0))){if(this.ended)return;this.ended=e||1,this.hls.trigger(tz.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return;if(s.currentTime!==e){let t=e;e=s.currentTime,this.moved=!0,this.log("currentTime changed ".concat(t," > ").concat(e));return}}let b=nh.bufferInfo(s,e,a.maxBufferHole);this._tryFixBufferStall(b,y,e)}stallResolved(e){let t=this.stalled;if(t&&this.hls&&(this.stalled=null,this.stallReported)){let i=self.performance.now()-t;this.log("playback not stuck anymore @".concat(e,", after ").concat(Math.round(i),"ms")),this.stallReported=!1,this.waiting=0,this.hls.trigger(tz.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,t){var i;let r=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&null!=(i=this.buffered.audio)&&i.length&&r&&r.length>1&&e>r.end(0)){let i=nh.bufferedInfo(nh.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&t>=i.start){let i=nh.timeRangesToArray(r),n=nh.bufferedInfo(i,t,0).bufferedIndex;if(n>-1&&n<i.length-1){let t=nh.bufferedInfo(i,e,0).bufferedIndex,r=i[n].end,a=i[n+1].start;if((-1===t||t>n)&&a-r<1&&e-r<2){let i=Error("nudging playhead to flush pipeline after video hole. currentTime: ".concat(e," hole: ").concat(r," -> ").concat(a," buffered index: ").concat(t));this.warn(i.message),this.media.currentTime+=1e-6;let n=ln(e,this.fragmentTracker);n&&"fragment"in n?n=n.fragment:n||(n=void 0);let s=nh.bufferInfo(this.media,e,0);this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:i,reason:i.message,frag:n,buffer:s.len,bufferInfo:s})}}}}}_tryFixBufferStall(e,t,i){var r,n;let{fragmentTracker:a,media:s}=this,o=null==(r=this.hls)?void 0:r.config;if(!s||!a||!o)return;let l=null==(n=this.hls)?void 0:n.latestLevelDetails,d=ln(i,a);if((d||null!=l&&l.live&&i<l.fragmentStart)&&(this._trySkipBufferHole(d)||!this.media))return;let u=e.buffered,h=this.adjacentTraversal(e,i);(u&&u.length>1&&e.len>o.maxBufferHole||e.nextStart&&(e.nextStart-i<o.maxBufferHole||h))&&(t>1e3*o.highBufferWatchdogPeriod||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,t){let i=this.fragmentTracker,r=e.nextStart;if(i&&r){let e=i.getFragAtPos(t,t$.MAIN),n=i.getFragAtPos(r,t$.MAIN);if(e&&n)return n.sn-e.sn<2}return!1}_reportStall(e){let{hls:t,media:i,stallReported:r,stalled:n}=this;if(!r&&null!==n&&i&&t){this.stallReported=!0;let r=Error("Playback stalling at @".concat(i.currentTime," due to low buffer (").concat(rx(e),")"));this.warn(r.message),t.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_STALLED_ERROR,fatal:!1,error:r,buffer:e.len,bufferInfo:e,stalled:{start:n}})}}_trySkipBufferHole(e){let{fragmentTracker:t,media:i,hls:r}=this,n=null==r?void 0:r.config;if(!i||!t||!n)return 0;let a=i.currentTime,s=nh.bufferInfo(i,a,0);la(s,a,t,r);let o=a<s.start?s.start:s.nextStart;if(o){let d=s.len<=n.maxBufferHole,u=s.len>0&&s.len<1&&i.readyState<3,h=o-a;if(h>0&&(d||u)){if(h>n.maxBufferHole){let i=!1;if(0===a){let e=t.getAppendedFrag(0,t$.MAIN);e&&o<e.end&&(i=!0)}if(!i&&e){var l;if(!(null!=(l=r.loadLevelObj)&&l.details)||li(r.inFlightFragments,o))return 0;let i=!1,n=e.end;for(;n<o;){let e=ln(n,t),r=e?e.duration:0;if(r>0)n+=r;else{i=!0;break}}if(i)return 0}}let{nudgeMaxRetry:d,skipBufferHolePadding:u}=n,c=++this.skipRetry>d,m=Math.max(o,a)+u;if(c||(this.warn("skipping hole, adjusting currentTime from ".concat(a," to ").concat(m)),this.moved=!0,i.currentTime=m),!(null!=e&&e.gap)||c){let t=Error(c?"Playhead still not moving after seeking over buffer hole from ".concat(a," to ").concat(m," after ").concat(n.nudgeMaxRetry," attempts."):"fragment loaded with buffer holes, seeking from ".concat(a," to ").concat(m)),i={type:tY.MEDIA_ERROR,details:tj.BUFFER_SEEK_OVER_HOLE,fatal:c,error:t,reason:t.message,buffer:s.len,bufferInfo:s};e&&("fragment"in e?i.part=e:i.frag=e),r.trigger(tz.ERROR,i)}return m}}return 0}_tryNudgeBuffer(e){let{hls:t,media:i,nudgeRetry:r}=this,n=null==t?void 0:t.config;if(!i||!n)return 0;let a=i.currentTime;if(this.nudgeRetry++,r<n.nudgeMaxRetry){let s=a+(r+1)*n.nudgeOffset,o=Error("Nudging 'currentTime' from ".concat(a," to ").concat(s));this.warn(o.message),i.currentTime=s,t.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_NUDGE_ON_STALL,error:o,fatal:!1,buffer:e.len,bufferInfo:e})}else{let i=Error("Playhead still not moving while enough data buffered @".concat(a," after ").concat(n.nudgeMaxRetry," nudges"));this.error(i.message),t.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.BUFFER_STALLED_ERROR,error:i,fatal:!0,buffer:e.len,bufferInfo:e})}}constructor(e,t){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.skipRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=void 0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var e;null!=(e=this.media)&&e.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>
3{if(this.hls){var e;this.ended=(null==(e=this.media)?void 0:e.currentTime)||1,this.hls.trigger(tz.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=t,this.lastCurrentTime=this.getCurrentTime(),this.registerListeners()}},latencyController:class{get levelDetails(){var e;return(null==(e=this.hls)?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){var e;let t=null==(e=this.hls)?void 0:e.config;if(!t)return 0;if(void 0!==t.liveMaxLatencyDuration)return t.liveMaxLatencyDuration;let i=this.levelDetails;return i?t.liveMaxLatencyDurationCount*i.targetduration:0}get targetLatency(){let e=this.levelDetails;if(null===e||!this.hls)return null;let t=this.hls.config,{holdBack:i,partHoldBack:r,targetduration:n}=e,{liveSyncDuration:a,liveSyncDurationCount:s,lowLatencyMode:o}=t,l=this.hls.userConfig,d=o&&r||i;return(this._targetLatencyUpdated||l.liveSyncDuration||l.liveSyncDurationCount||0===d)&&(d=void 0!==a?a:s*n),d+Math.min(this.stallCount*t.liveSyncOnStallIncrease,n)}set targetLatency(e){this.hls&&(this.stallCount=0,this.hls.config.liveSyncDuration=e,this._targetLatencyUpdated=!0)}get liveSyncPosition(){let e=this.estimateLiveEdge(),t=this.targetLatency;if(null===e||null===t||!this.hls)return null;let i=this.levelDetails;if(null===i)return null;let r=i.edge,n=e-t-this.edgeStalled;return Math.min(Math.max(r-i.totalduration,n),r-(this.hls.config.lowLatencyMode&&i.partTarget||i.targetduration))}get drift(){let e=this.levelDetails;return null===e?1:e.drift}get edgeStalled(){let e=this.levelDetails;if(null===e||!this.hls)return 0;let t=3*(this.hls.config.lowLatencyMode&&e.partTarget||e.targetduration);return Math.max(e.age-t,0)}get forwardBufferLength(){let{media:e}=this,t=this.levelDetails;if(!e||!t)return 0;let i=e.buffered.length;return(i?e.buffered.end(i-1):t.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){let{hls:e}=this;
3e&&(e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tz.ERROR,this.onError,this),e.on(tz.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}unregisterListeners(){let{hls:e}=this;e&&(e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tz.ERROR,this.onError,this),e.off(tz.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}onMediaAttached(e,t){this.media=t.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,t){let{details:i}=t;i.advanced&&this.onTimeupdate(),!i.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onAssetStarted(e,t){var i;let r=this.hls,n=this.media||t.event.appendInPlace&&(null==r||null==(i=r.interstitialsManager)?void 0:i.playerQueue.reduce((e,t)=>e||t.media,null));r&&n&&n.playbackRate>1&&n.playbackRate<=r.config.maxLiveSyncPlaybackRate&&this.changeMediaPlaybackRate(n,1)}onError(e,t){var i;t.details===tj.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&null!=(i=this.levelDetails)&&i.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,t){var i,r;e.playbackRate!==t&&(null==(i=this.hls)||i.logger.debug("[latency-controller]: latency=".concat(this.latency.toFixed(3),", targetLatency=").concat(null==(r=this.targetLatency)?void 0:r.toFixed(3),", forwardBufferLength=").concat(this.forwardBufferLength.toFixed(3),": adjusting playback rate from ").concat(e.playbackRate," to ").concat(t)),e.playbackRate=t)}estimateLiveEdge(){let e=this.levelDetails;return null===e?null:e.edge+e.age}computeLatency(){let e=this.estimateLiveEdge();return null===e?null:e-this.currentTime}constructor(e){this.hls=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{var e;let{media:t}=this,i=this.levelDetails;if(!t||!i||!this.hls)return;this.currentTime=t.currentTime;let r=this.hls.config,n=this.computeLatency();if(null===n)return;this._latency=n;let{lowLatencyMode:a,maxLiveSyncPlaybackRate:s}=r;if(!a||1===s||!i.live)return;let o=this.targetLatency;if(null===o)return;let l=n-o,d=Math.min(this.maxLatency,o+i.targetduration),u=ac(r)&&!!(null!=(e=this.hls.interstitialsManager)&&null!=(e=e.playingItem)&&e.event);if(l<d&&l>.05&&this.forwardBufferLength>1&&!u){let e=Math.min(Math.min(2,Math.max(1,s)),Math.max(1,Math.round(2/(1+Math.exp(-.75*l-this.edgeStalled))*20)/20));this.changeMediaPlaybackRate(t,e)}else 1!==t.playbackRate&&0!==t.playbackRate&&this.changeMediaPlaybackRate(t,1)},this.hls=e,this.registerListeners()}}},{cueHandler:lQ,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}),{},{subtitleStreamController:class extends au{onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tz.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tz.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(tz.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tz.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(tz.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();let{hls:e}=this;e.off(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tz.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUp
3dated,this),e.off(tz.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(tz.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tz.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(tz.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,t){this.stopLoad(),this.state=ad.IDLE,this.setInterval(500),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,t){this.tracksBuffered=[],super.onMediaDetaching(e,t)}onLevelLoaded(e,t){this.mainDetails=t.details}onSubtitleFragProcessed(e,t){let i,{frag:r,part:n,success:a}=t;if(!a)return;let s=this.tracksBuffered[this.currentTrackId];if(!s)return;let o=(n||r).start;for(let e=0;e<s.length;e++)if(o>=s[e].start&&o<=s[e].end){i=s[e];break}let l=o+(n||r).duration;if(i?i.end=l:(i={start:o,end:l},s.push(i)),!n||l>=r.end){let e=this.fragmentTracker.fragBuffered(r);n&&e&&(e.range.subs={time:[{startPTS:r.start,endPTS:l}],partial:!0}),t2(r)&&!this.fragContextChanged(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,n),this.media&&this.tickImmediate()}}onBufferFlushing(e,t){let{startOffset:i,endOffset:r}=t;if(0===i&&r!==1/0){let e=r-1;if(e<=0)return;t.endOffsetSubtitles=Math.max(0,e),this.tracksBuffered.forEach(t=>{if(t)for(let i=0;i<t.length;){if(t[i].end<=e){t.shift();continue}if(t[i].start<e)t[i].start=e;else break;i++}}),this.fragmentTracker.removeFragmentsInRange(i,e,t$.SUBTITLE)}}onError(e,t){let i=t.frag;(null==i?void 0:i.type)===t$.SUBTITLE&&(t.details===tj.FRAG_GAP&&this.fragmentTracker.addAsGap(i),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==ad.STOPPED&&(this.state=ad.IDLE))}onSubtitleTracksUpdated(e,t){let{subtitleTracks:i}=t;if(this.levels&&sE(this.levels,i)){this.levels=i.map(e=>new rP(e));return}this.tracksBuffered=[],this.levels=i.map(e=>{let t=new rP(e);return this.tracksBuffered[t.id]=[],t}),this.fragmentTracker.removeFragmentsInRange(0,1/0,t$.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,t){var i;if(this.currentTrackId=t.id,this.abortCurrentFrag(),!(null!=(i=this.levels)&&i.length)||-1===this.currentTrackId)return void this.clearInterval();let r=this.levels[this.currentTrackId];if(!(null!=r&&r.details)){this.mediaBuffer=null;return}this.mediaBuffer=this.mediaBufferTimeRanges,this.state!==ad.STOPPED&&this.setInterval(500)}onSubtitleTrackLoaded(e,t){var i,r;let{currentTrackId:n,levels:a}=this,{details:s,id:o}=t;if(!a)return void this.warn("Subtitle tracks were reset while loading level ".concat(o));let l=a[o];if(o>=a.length||!l)return;this.log("Subtitle track ".concat(o," loaded [").concat(s.startSN,",").concat(s.endSN,"]").concat(s.lastPartSn?"[part-".concat(s.lastPartSn,"-").concat(s.lastPartIndex,"]"):"",",duration:").concat(s.totalduration)),this.mediaBuffer=this.mediaBufferTimeRanges;let d=this.mainDetails,u=0;if(s.live||null!=(i=l.details)&&i.live){if(s.deltaUpdateFailed)return;if(!d){this.startFragRequested=!1;return}l.details&&(u=this.alignPlaylists(s,l.details,null==(r=this.levelLastLoaded)?void 0:r.details)),s.alignedSliding||(aa(d,s,this),u=s.fragmentStart)}l.details=s,this.levelLastLoaded=l,d&&!this.startFragRequested&&this.setStartPosition(d,u),o===n&&(this.hls.trigger(tz.SUBTITLE_TRACK_UPDATED,{details:s,id:o,groupId:t.groupId}),this.tickImmediate())}_handleFragmentLoadProgress(e){let{frag:t,part:i,payload:r}=e;i&&null!=r&&r.byteLength&&this.shouldDecrypt(t)&&this.decryptPayload(r,t,i)}_handleFragmentLoadComplete(e){let{frag:t,payload:i}=e;!this.fragContextChanged(t)&&null!=i&&i.byteLength&&this.shouldDecrypt(t)&&this.decryptPayload(i,t,null)}shouldDecrypt(e){let t=e.decryptdata;return!!(null!=t&&t.key&&t.iv&&nA(t.method))}decryptPayload(e,t,i){let r=t.decryptdata,n=performance.now();this.decrypter.decrypt(new Uint8Array(e),r.key.buffer,r.iv.buffer,nS(r.method)).then(e=>{this.fragContextChanged(t)||this.hls.trigger(tz.FRAG_DECRYPTED,{frag:t,part:i,payload:e,stats:{tstart:n,tdecrypt:performance.now()}})}).catch(e=>{this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t,part:i}
3),i||(this.warn("".concat(e.name,": ").concat(e.message)),this.state=ad.IDLE)})}doTick(){if(this.state===ad.IDLE&&this.levels){var e,t;if(!this.media&&!this.primaryPrefetch&&(this.startFragRequested||!this.config.startFragPrefetch))return;let{currentTrackId:i,levels:r}=this,n=r[i],a=null==n?void 0:n.details;if(!a||this.waitForLive(n)||this.waitForCdnTuneIn(a)){this.startFragRequested=!1;return}let{config:s}=this,o=this.playhead,{end:l,len:d}=nh.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o,s.maxBufferHole);if(d>Math.max(this.hls.maxBufferLength+a.levelTargetDuration,(null==(e=this.hls.mainForwardBufferInfo)?void 0:e.len)||0)||d&&!this.buffering)return;let u=this.getNextFragment(l,a);if(u){if(t2(u)){let e=u.sn-a.startSN,i=a.fragments[e-1];u.cc!==(null==i?void 0:i.cc)||null!=(t=a.partList)&&t.length||this.fragmentTracker.getState(i)!==r2.NOT_LOADED||(u=i)}this.loadFragment(u,n,l)}}}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);(r===r2.NOT_LOADED||r===r2.PARTIAL)&&super.loadFragment(e,t,i)}get mediaBufferTimeRanges(){return new lD(this.tracksBuffered[this.currentTrackId]||[])}constructor(e,t,i){super(e,t,i,"subtitle-stream-controller",t$.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}},subtitleTrackController:class extends sv{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(){let{hls:e}=this;
3e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.LEVEL_LOADING,this.onLevelLoading,this),e.on(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tz.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(tz.ERROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.LEVEL_LOADING,this.onLevelLoading,this),e.off(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tz.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(tz.ERROR,this.onError,this)}createTracksInGroup(){var e;if(!this.media||!this.hls.config.renderTextTracksNatively)return;this.tracksInGroup.forEach(e=>{e.trackNode||(e.trackNode=o7(this.media,e.forced&&(rr.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(ri))?"forced":e.characteristics&&/transcribes-spoken-dialog/gi.test(e.characteristics)&&/describes-music-and-sound/gi.test(e.characteristics)?"captions":"subtitles",e.name,e.lang))});let t=null==(e=this.currentTrack)||null==(e=e.trackNode)?void 0:e.track;(null==t?void 0:t.mode)==="disabled"&&(t.mode=this._subtitleDisplay?"showing":"hidden")}onMediaAttached(e,t){let i=t.media;this.media=i;let r=this.trackId;this.queuedDefaultTrack>-1&&(r=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.setSubtitleTrack(r),this.createTracksInGroup(),this.useTextTrackPolling=!(i.textTracks&&"onchange"in i.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):i.textTracks.addEventListener("change",this.asyncPollTrackChange)}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,t){let i=this.media;if(!i)return;let r=!!t.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||i.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId,this.setSubtitleTrack(-1)),this.media=null,!r&&this.hls.config.renderTextTracksNatively&&this.tracksInGroup.forEach(e=>{let t=e.trackNode;t&&(t.track.mode="hidden",t.remove(),e.trackNode=void 0)})}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){let{id:i,groupId:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r)return void this.warn("Subtitle track with id:".concat(i," and group:").concat(r," not found in active group ").concat(null==a?void 0:a.groupId));let s=a.details;a.details=t.details,this.log("Subtitle track ".concat(i,' "').concat(a.name,'" lang:').concat(a.lang," group:").concat(r," loaded [").concat(n.startSN,"-").concat(n.endSN,"]")),i===this.trackId&&this.playlistLoaded(i,t,s)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.subtitleGroups||null,r=this.groupIds,n=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i;let e=[];
3if(this.tracks.forEach(t=>{(t.textCodec===o$?this.hls.config.enableIMSC1:this.hls.config.enableWebVTT)&&(!i||i.indexOf(t.groupId)>-1?(t.id=e.length,e.push(t)):t.trackNode&&(t.trackNode.remove(),t.trackNode=void 0))}),e.length===this.tracksInGroup.length){let t=!1;for(let i=0;i<e.length;i++)if(e[i]!==this.tracksInGroup[i]){t=!0;break}if(!t)return}e.length&&this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=e,this.trackId=-1,this.currentTrack=null;let t=this.hls.config.subtitlePreference;if(!n&&t){this.selectDefaultTrack=!1;let i=rB(t,e);if(i>-1)n=e[i];else{let e=rB(t,this.tracks);n=this.tracks[e]}}let r=this.findTrackId(n);-1===r&&n&&(r=this.findTrackId(null)),this.log("Updating subtitle tracks, ".concat(e.length,' track(s) found in "').concat(null==i?void 0:i.join(","),'" group-id')),this.hls.trigger(tz.SUBTITLE_TRACKS_UPDATED,{subtitleTracks:e}),this.setSubtitleTrack(r),this.createTracksInGroup()}}findTrackId(e){let t=this.tracksInGroup,i=this.selectDefaultTrack;for(let r=0;r<t.length;r++){let n=t[r];if((!i||n.default)&&(i||e)&&(!e||rG(n,e)))return r}if(e){for(let i=0;i<t.length;i++){let r=t[i];if(sy(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(sy(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}onError(e,t){!t.fatal&&t.context&&t.context.type===tJ.SUBTITLE_TRACK&&t.context.id===this.trackId&&rV(t.context.groupId,this.groupIds)&&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,!0)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(-1===e.id)return this.setSubtitleTrack(-1,!0),null;let t=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,t.length){let i=this.currentTrack;if(i&&rG(e,i))return i;let r=rB(e,this.tracksInGroup);if(r>-1){let e=this.tracksInGroup[r];return this.setSubtitleTrack(r,!0),e}{if(i)return null;let r=rB(e,t);if(r>-1)return t[r]}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,s=null==a?void 0:a.age;this.log("Loading subtitle ".concat(i,' "').concat(e.name,'" lang:').concat(e.lang," group:").concat(r).concat((null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"").concat(s&&a.live?" age "+s.toFixed(1)+(a.type?" "+a.type:""):""," ").concat(n)),this.hls.trigger(tz.SUBTITLE_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}toggleTrackModes(){if(!this.media||!this.hls.config.renderTextTracksNatively)return;let e=this.currentTrack;this.tracksInGroup.forEach(t=>{if(t.trackNode){let i=t===e?this._subtitleDisplay?"showing":"hidden":"disabled",r=t.trackNode.track;r.mode!==i&&(r.mode=i)}})}setSubtitleTrack(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=this.tracksInGroup;if(this.media||(this.queuedDefaultTrack=e),e<-1||e>=i.length||!tW(e))return void this.warn("Invalid subtitle track id: ".concat(e));let r=this.currentTrack,n=i[e]||null;if(this.trackId=e,this.currentTrack=n,t&&this.toggleTrackModes(),!n){r&&this.hls.trigger(tz.SUBTITLE_TRACK_SWITCH,{id:e});return}let a=!!n.details&&!n.details.live;if(n===r&&a)return;this.log("Switching to subtitle-track ".concat(e)+(n?' "'.concat(n.name,'" lang:').concat(n.lang," group:").concat(n.groupId):""));let{id:s,groupId:o="",name:l,type:d,url:u}=n;this.hls.trigger(tz.SUBTITLE_TRACK_SWITCH,{id:s,groupId:o,name:l,type:d,url:u});let h=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(h)}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.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{var e,t,i;if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let r=-1,n=!1;if(this.currentTrack){let t=null==(e=this.currentTrack.trackNode)?void 0:e.track.mode;"showing"===t?(r=this.trackId,n=!0):"hidden"===t&&(r=this.trackId)}if(!n)for(let e=0;e<this.tracksInGroup.length;e++){let i=null==(t=this.tracksInGroup[e].trackNode)?void 0:t.track.mode;if("showing"===i){r=e;break}r<0&&"hidden"===i&&(r=e)}r>-1&&(this._subtitleDisplay=(null==(i=this.tracksInGroup[r].trackNode)?void 0:i.track.mode)==="showing"),this.setSubtitleTrack(r,!0)},this.registerListeners()}},timelineController:class{destroy(){let{hls:e}=this;
3e.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(tz.FRAG_LOADING,this.onFragLoading,this),e.off(tz.FRAG_LOADED,this.onFragLoaded,this),e.off(tz.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(tz.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tz.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){let e=new lY(this,"textTrack1"),t=new lY(this,"textTrack2"),i=new lY(this,"textTrack3"),r=new lY(this,"textTrack4");this.cea608Parser1=new lq(1,e,t),this.cea608Parser2=new lq(3,i,r)}addCues(e,t,i,r,n){var a,s,o;let l=!1;for(let e=n.length;e--;){let r=n[e],o=(a=r[0],s=r[1],Math.min(s,i)-Math.max(a,t));if(o>=0&&(r[0]=Math.min(r[0],t),r[1]=Math.max(r[1],i),l=!0,o/(i-t)>.5))return}if(l||n.push([t,i]),this.config.renderTextTracksNatively){let n=this.cueCache[e];if(n){let e=this.Cues.newCue(null,t,i,r);e.length&&n.push.apply(n,e)}else{let n=this.captionsTracks[e].track;this.Cues.newCue(n,t,i,r)}}else{let n=this.Cues.newCue(null,t,i,r),a=null==(o=this.captionsProperties[e])?void 0:o.media;this.hls.trigger(tz.CUES_PARSED,{type:"captions",cues:n,track:e,closedCaptions:a})}}onInitPtsFound(e,t){let{id:i,timestampOffsets:r}=t,{unparsedVttFrags:n}=this;i===t$.MAIN&&(this.initPTS=r),n.length&&(this.unparsedVttFrags=[],n.forEach(e=>{this.initPTS[e.frag.cc]?this.onFragLoaded(tz.FRAG_LOADED,e):this.hls.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e.frag,part:null,error:Error("Subtitle discontinuity domain does not match main")})}))}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;let{captionsProperties:t,captionsTracks:i,cueCache:r,media:n}=this,{label:a,languageCode:s}=t[e];n&&(r[e]=[],i[e]=o7(n,"captions",a,s,"hidden"))}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;let t=this.captionsProperties[e];if(!t)return;let i={_id:e,label:t.label,kind:"captions",default:!!t.media&&!!t.media.default,closedCaptions:t.media};this.nonNativeCaptionsTracks[e]=i,this.hls.trigger(tz.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[i]})}onMediaAttaching(e,t){this.media=t.media}onMediaDetaching(e,t){let i=!!t.transferMedia;if(this.media=null,!i){if(this.config.renderTextTracksNatively){let{captionsTracks:e,cueCache:t}=this;for(let i in e)e[i].remove(),delete t[i]}this.cueCache={},this.captionsTracks={},this.nonNativeCaptionsTracks={}}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lj(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}onSubtitleTracksUpdated(e,t){let i=t.subtitleTracks||[];if(i.length&&!this.config.renderTextTracksNatively&&!sE(this.tracks,i)){let e=i.map(e=>({label:e.name,kind:e.type.toLowerCase(),default:e.default,subtitleTrack:e}));this.hls.trigger(tz.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:e})}this.tracks=i}onManifestLoaded(e,t){this.config.enableCEA708Captions&&t.captions&&t.captions.forEach(e=>{let t=/(?:CC|SERVICE)([1-4])/.exec(e.instreamId);if(!t)return;let i="textTrack".concat(t[1]),r=this.captionsProperties[i];r&&(r.label=e.name,e.lang&&(r.languageCode=e.lang),r.media=e)})}closedCaptionsForLevel(e){let t=this.hls.levels[e.level];return null==t?void 0:t.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,t){if(this.enabled&&t.frag.type===t$.MAIN){var i,r;let{cea608Parser1:e,cea608Parser2:n,lastSn:a}=this,{cc:s,sn:o}=t.frag,l=null!=(i=null==(r=t.part)?void 0:r.index)?i:-1;e&&n&&(o!==a+1||o===a&&l!==this.lastPartIndex+1||s!==this.lastCc)&&(e.reset(),n.reset()),this.lastCc=s,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(e,t){let{frag:i,payload:r}=t;if(i.level<this.tracks.length&&i.type===t$.SUBTITLE){var n;if(r.byteLength||null!=(n=i.initSegment)&&null!=(n=n.data)&&n.byteLength){let e=i.decryptdata,r="stats"in t;if(null==e||!e.encrypted||r){let e=this.tracks[i.level],r=this.vttCCs;r[i.cc]||(r[i.cc]={start:i.start,prevCC:this.prevCC,new:!0},this.prevCC=i.cc),(null==e?void 0:e.textCodec)===o$?this._parseIMSC1(t):this._parseVTTs(t)}}else{let e="part"in t?t.part:null;this.hls.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,part:e,error:Error("Empty subt
3itle payload")})}}}_parseIMSC1(e){let{frag:t,payload:i}=e,r="part"in e?e.part:null,n=this.hls;o3(i,this.initPTS[t.cc],e=>{this._appendCues(e,t.level),n.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t,part:r})},e=>{n.logger.log("Cannot parse IMSC1 (sn: ".concat(t.sn," @").concat(t.start,"): ").concat(e)),n.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,part:r,error:e})})}_parseVTTs(e){var t;let{frag:i,payload:r}=e,n="part"in e?e.part:null,{initPTS:a,unparsedVttFrags:s}=this,o=a.length-1;if(!a[i.cc]&&-1===o)return void s.push(e);let l=this.hls,d=null==(t=i.initSegment)?void 0:t.data;!function(e,t,i,r,n,a,s){let o,l=new oj,d=iM(new Uint8Array(e)).trim().replace(oQ,"\n").split("\n"),u=[],h=t?function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return a7(e,9e4,1/t)}(t.baseTime,t.timescale):0,c="00:00.000",m=0,f=0,p=!1,g=!0;l.oncue=function(e){let a=i[r],s=i.ccOffset,l=(m-h)/9e4;if(p){if(null!=a&&a.new&&(s=i.ccOffset=a.start),l){if(!t){o=Error(oX+"MPEGTS");return}s=l-i.presentationOffset}}else if(t)s=-t.baseTime/t.timescale;else{o=Error(oX+"without X-TIMESTAMP-MAP");return}let d=e.endTime-e.startTime,c=sn((e.startTime+s-f)*9e4,9e4*n)/9e4;e.startTime=Math.max(c,0),e.endTime=Math.max(c+d,0);let g=e.text.trim();e.text=decodeURIComponent(encodeURIComponent(g)),e.id?r&&(e.id="hlsjscc".concat(r,"_").concat(e.id)):e.id=oJ(e.startTime,e.endTime,g),e.endTime>0&&u.push(e)},l.onparsingerror=function(e){o=e},l.onflush=function(){if(o)return void s(o);a(u)},d.forEach(e=>{if(g)if(e.startsWith("X-TIMESTAMP-MAP=")){g=!1,p=!0,e.slice(16).split(",").forEach(e=>{e.startsWith("LOCAL:")?c=e.slice(6):e.startsWith("MPEGTS:")&&(m=parseInt(e.slice(7)))});try{f=oZ(c)/1e3}catch(e){o=e}return}else""===e&&(g=!1);l.parse(e+"\n")}),l.flush()}(d?i8(d,new Uint8Array(r)).buffer:r,this.initPTS[i.cc],this.vttCCs,i.cc,(n&&!d?n:i).start,e=>{this._appendCues(e,i.level),l.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:i,part:n})},t=>{let r=t.message.startsWith("Missing initPTS");if(l.logger.log("".concat(r?"Deferred parsing of":"Cannot parse"," VTT cue (sn: ").concat(i.sn," @").concat(i.start,"): ").concat(t)),r)return void s.push(e);this.config.enableIMSC1&&this._fallbackToIMSC1(e),l.trigger(tz.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i,part:n,error:t})})}_fallbackToIMSC1(e){let{frag:t,payload:i}=e,r=this.tracks[t.level];r.textCodec||o3(i,this.initPTS[t.cc],()=>{r.textCodec=o$,this._parseIMSC1(e)},()=>{r.textCodec="wvtt"})}_appendCues(e,t){let i=this.hls;if(this.config.renderTextTracksNatively){var r;let i=null==(r=this.tracks[t].trackNode)?void 0:r.track;if(!i||"disabled"===i.mode)return;e.forEach(e=>le(i,e))}else{let r=this.tracks[t];if(!r)return;let n=r.default?"default":"subtitles"+t;i.trigger(tz.CUES_PARSED,{type:"subtitles",cues:e,track:n,subtitleTrack:r})}}onFragDecrypted(e,t){let{frag:i}=t;i.type===t$.SUBTITLE&&this.onFragLoaded(tz.FRAG_LOADED,t)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,t){if(!this.enabled||!this.config.enableCEA708Captions)return;let{frag:i,samples:r}=t;if(i.type!==t$.MAIN||"NONE"!==this.closedCaptionsForLevel(i))for(let e=0;e<r.length;e++){let t=r[e].bytes;if(t){this.cea608Parser1||this.initCea608Parsers();let i=this.extractCea608Data(t);this.cea608Parser1.addData(r[e].pts,i[0]),this.cea608Parser2.addData(r[e].pts,i[1])}}}onBufferAppended(e,t){if(this.config.renderTextTracksNatively){var i;let{type:e,timeRanges:r}=t;if("video"===e&&null!=(i=r[e])&&i.length){let{captionsTracks:e,cueCache:t}=this;Object.keys(t).forEach(i=>{var r;let n=null==(r=e[i])?void 0:r.track;if(n){let e=t[i];for(let t=0;t<e.length;t++)le(n,e[t])}delete t[i]})}}}onBufferFlushing(e,t){let{startOffset:i,endOffset:r,endOffsetSubtitles:n,type:a}=t,{media:s}=this;if(s&&!(s.currentTime<r)){if(!a||"video"===a){let{captionsTracks:e,cueCache:t}=this;Object.keys(e).forEach(t=>lt(e[t].track,i,r)),Object.keys(t).forEach(e=>{let n=t[e];for(let e=n.length;e--;){let t=n[e];t.startTime>=i&&t.endTime<=r&&n.splice(e,1)}})}this.config.renderTextTracksNatively&&0===i&&void 0!==n&&this.tracks.forEach(e=>{var t;let r=null==(t=e.trackNode)?void 0:t.track;r&&lt(r,i,n)})}}extractCea608Data(e){let t=[[],[]],i=31&e[0],r=2;for(let n=0;n<i;n++){let i=e[r++],n=127&e[r++],a=127&e[r++];if((0!==n||0!==a)&&(4&i)!=0){let e=3&i;(0===e||1===e)&&(t[e].push(n),t[e].push(a))}}return t}constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.cueCache={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=lj(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.cueCache={},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}}
3,e.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(tz.FRAG_LOADING,this.onFragLoading,this),e.on(tz.FRAG_LOADED,this.onFragLoaded,this),e.on(tz.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(tz.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tz.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tz.BUFFER_FLUSHING,this.onBufferFlushing,this)}},audioStreamController:class extends au{onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();let{hls:e}=this;e.on(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tz.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tz.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tz.BUFFER_RESET,this.onBufferReset,this),e.on(tz.BUFFER_CREATED,this.onBufferCreated,this),e.on(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tz.FRAG_LOADING,this.onFragLoading,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){let{hls:e}=this;e&&(super.unregisterListeners(),e.off(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tz.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tz.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tz.BUFFER_RESET,this.onBufferReset,this),e.off(tz.BUFFER_CREATED,this.onBufferCreated,this),e.off(tz.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tz.FRAG_LOADING,this.onFragLoading,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,t){let{frag:i,id:r,initPTS:n,timescale:a,trackId:s,timestampOffsets:o}=t;if(r===t$.MAIN){let e=i.cc,t=this.fragCurrent;if(this.initPTS=o,this.log("InitPTS for cc: ".concat(e," found from main: ").concat(n/a," (").concat(n,"/").concat(a,") trackId: ").concat(s)),this.mainAnchor=i,this.state===ad.WAITING_INIT_PTS){let t=this.waitingData;(t||this.loadingParts)&&(!t||t.frag.cc===e)||this.syncWithAnchor(i,null==t?void 0:t.frag)}else!this.hls.hasEnoughToStart&&t&&t.cc!==e?(t.abortRequests(),this.syncWithAnchor(i,t)):this.state===ad.IDLE&&this.tick()}}getLoadPosition(){var e;return!this.startFragRequested&&this.nextLoadPosition>=0&&(null==(e=this.switchingTrack)?void 0:e.flushImmediate)!==!1?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,t){var i;let r=(null==(i=this.mainFragLoading)?void 0:i.frag)||null;if(t&&(null==r?void 0:r.cc)===t.cc)return;let n=(r||e).cc,a=rQ(this.getLevelDetails(),n,this.getLoadPosition());a&&(this.log("Syncing with main frag at ".concat(a.start," cc ").concat(a.cc)),this.startFragRequested=!1,this.nextLoadPosition=a.start,this.resetLoadingState(),this.state===ad.IDLE&&this.doTickIdle())}startLoad(e,t){if(!this.levels){this.startPosition=e,this.state=ad.STOPPED;return}let i=this.lastCurrentTime;this.stopLoad(),this.setInterval(100),i>0&&-1===e&&!t&&this.initPTS.length&&(this.log("Override startPosition with lastCurrentTime @".concat(i.toFixed(3))),e=i),this.state=ad.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=t?-1:e,t||this.fragmentTracker.hasFragments(this.playlistType)||(this.startFragRequested=!1),this.tick()}doTick(){switch(this.state){case ad.IDLE:this.doTickIdle();break;case ad.WAITING_TRACK:{let{levels:e,trackId:t}=this,i=null==e?void 0:e[t],r=null==i?void 0:i.details;
3if(r&&!this.waitForLive(i)){if(this.waitForCdnTuneIn(r))break;this.state=ad.WAITING_INIT_PTS}break}case ad.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break;case ad.WAITING_INIT_PTS:{let e=this.waitingData;if(e){let{frag:t,part:i,cache:r,complete:n}=e,a=this.mainAnchor;if(void 0!==this.initPTS[t.cc]){this.waitingData=null,this.state=ad.FRAG_LOADING;let e={frag:t,part:i,payload:r.flush().buffer,networkDetails:null};this._handleFragmentLoadProgress(e),n&&super._handleFragmentLoadComplete(e)}else a&&a.cc!==e.frag.cc&&this.syncWithAnchor(a,e.frag)}else this.state=ad.IDLE}}this.onTickEnd()}resetLoadingState(){let e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){let{media:e}=this;null!=e&&e.readyState&&(this.lastCurrentTime=e.currentTime,this.checkFragmentChanged())}doTickIdle(){var e;let{hls:t,levels:i,media:r,trackId:n}=this,a=t.config;if(!this.buffering||!r&&!this.primaryPrefetch&&(this.startFragRequested||!a.startFragPrefetch)||!(null!=i&&i[n]))return;let s=i[n],o=s.details;if(!o||this.waitForLive(s)||this.waitForCdnTuneIn(o)){this.state=ad.WAITING_TRACK,this.startFragRequested=!1;return}let l=this.getBufferOutput();this.bufferFlushed&&l&&(this.bufferFlushed=!1,this.afterBufferFlushed(l,t0.AUDIO));let d=this.getFwdBufferInfo();if(null===d)return;if(!this.switchingTrack&&this._streamEnded(d,o)){t.trigger(tz.BUFFER_EOS,{type:"audio"}),this.state=ad.ENDED;return}let u=d.len,h=t.maxBufferLength,c=o.fragments,m=c[0].start,f=this.getLoadPosition(),p=this.flushing||this.switchingTrack&&!this.switchingTrack.flushImmediate?f:d.end;if(this.switchingTrack&&r&&o.PTSKnown&&f<m&&f>=this.timelineOffset&&(d.end>m||d.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track ".concat(f," -> ").concat(m," + 0.05")),r.currentTime=m+.05),u>=h&&!this.switchingTrack&&p<c[c.length-1].start)return;let g=this.getNextFragment(p,o);if(g&&this.isLoopLoading(g,p)&&(g=this.getNextFragmentLoopLoading(g,o,d,t$.MAIN,h)),!g){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(d,h,g))return;let v=(null==(e=this.mainFragLoading)?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&v&&t2(g)&&!g.endList&&(!o.live||!this.loadingParts&&p<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(v)===r2.OK&&(this.mainFragLoading=v=null),v&&t2(v))){if(g.start>v.end){let e=this.fragmentTracker.getFragAtPos(p,t$.MAIN);e&&e.end>v.end&&(v=e,this.mainFragLoading={frag:e,targetBufferTime:null})}if(g.start>v.end)return}this.loadFragment(g,s,p)}onMediaDetaching(e,t){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,t)}onAudioTracksUpdated(e,t){let{audioTracks:i}=t;this.resetTransmuxer(),this.levels=i.map(e=>new rP(e))}onAudioTrackSwitching(e,t){let i=!!t.url;this.trackId=t.id;let{fragCurrent:r}=this;r&&(r.abortRequests(),this.removeUnbufferedFrags(r.start)),this.resetLoadingState(),i?(this.switchingTrack=t,t.flushImmediate||(this.nextTrackId=t.id,this.nextLevelSwitch()),this.flushAudioIfNeeded(t),this.state!==ad.STOPPED&&(this.setInterval(100),this.state=ad.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=t,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,t){this.mainDetails=t.details;let i=this.cachedTrackLoadedData;i&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(tz.AUDIO_TRACK_LOADED,i))}onAudioTrackLoaded(e,t){var i,r;let{levels:n}=this,{details:a,id:s,groupId:o,track:l}=t;if(!n)return void this.warn("Audio tracks reset while loading track ".concat(s,' "').concat(l.name,'" of "').concat(o,'"'));let d=this.mainDetails;if(!d||a.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=t,this.state!==ad.STOPPED&&(this.state=ad.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log("Audio track ".concat(s,' "').concat(l.name,'" of "').concat(o,'" loaded [').concat(a.startSN,",").concat(a.endSN,"]").concat(a.lastPartSn?"[part-".concat(a.lastPartSn,"-").concat(a.lastPartIndex,"]"):"",",duration:").concat(a.totalduration));let u=n[s],h=0;
3if(a.live||null!=(i=u.details)&&i.live){if(this.checkLiveUpdate(a),a.deltaUpdateFailed)return;u.details&&(h=this.alignPlaylists(a,u.details,null==(r=this.levelLastLoaded)?void 0:r.details)),a.alignedSliding||(aa(d,a,this),h=a.fragmentStart)}u.details=a,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,h),this.hls.trigger(tz.AUDIO_TRACK_UPDATED,{details:a,id:s,groupId:t.groupId}),this.state!==ad.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=ad.IDLE),this.tick()}_handleFragmentLoadProgress(e){var t;let i=e.frag,{part:r,payload:n}=e,{config:a,trackId:s,levels:o}=this;if(!o)return void this.warn("Audio tracks were reset while fragment load was in progress. Fragment ".concat(i.sn," of level ").concat(i.level," will not be buffered"));let l=o[s];if(!l)return void this.warn("Audio track is undefined on fragment load progress");let d=l.details;if(!d){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(i.start);return}let u=a.defaultAudioCodec||l.audioCodec||"mp4a.40.2",h=this.transmuxer;h||(h=this.transmuxer=new sg(this.hls,t$.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));let c=this.initPTS[i.cc],m=null==(t=i.initSegment)?void 0:t.data;if(void 0!==c){let e=r?r.index:-1,t=new nl(i.level,i.sn,i.stats.chunkCount,n.byteLength,e,-1!==e,i.duration);h.push(n,m,u,"",i,r,d.totalduration,!1,t,c)}else{this.log("Unknown video PTS for cc ".concat(i.cc,", waiting for video PTS before demuxing audio frag ").concat(i.sn," of [").concat(d.startSN," ,").concat(d.endSN,"],track ").concat(s));let{cache:e}=this.waitingData=this.waitingData||{frag:i,part:r,cache:new am,complete:!1};e.push(new Uint8Array(n)),this.state!==ad.STOPPED&&(this.state=ad.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,t){this.bufferFlushed=this.flushing=!1;let i=t.tracks.audio;i&&(this.mediaBuffer=i.buffer||null)}onFragLoading(e,t){!this.audioOnly&&t.frag.type===t$.MAIN&&t2(t.frag)&&(this.mainFragLoading=t,this.state===ad.IDLE&&this.tick())}onFragBuffered(e,t){let{frag:i,part:r}=t;if(i.type!==t$.AUDIO){this.audioOnly||i.type!==t$.MAIN||i.elementaryStreams.video||i.elementaryStreams.audiovideo||(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(i))return void this.warn("Fragment ".concat(i.sn).concat(r?" p: "+r.index:""," of level ").concat(i.level," finished buffering, but was aborted. state: ").concat(this.state,", audioSwitch: ").concat(this.switchingTrack?this.switchingTrack.name:"false"));if(t2(i)){let e=this.switchingTrack;e&&(this.bufferedTrack=e)}this.fragBufferedComplete(i,r),this.media&&this.tick()}getFwdBufferInfo(){let e=this.getBufferOutput();return super.getFwdBufferInfo(e,t$.AUDIO)}getBufferOutput(){return this.mediaBuffer?this.mediaBuffer:this.media}checkFragmentChanged(){let e=this.fragPlaying;if(!this.checkFragPlaying())return!1;let t=this.fragPlaying,i=null==e?void 0:e.level;return(!t||t.level!==i)&&(e&&this.cleanupBackBuffer(),this.switchingTrack&&this.completeAudioSwitch(this.switchingTrack)),!0}onError(e,t){var i;if(t.fatal){this.state=ad.ERROR;return}switch(t.details){case tj.FRAG_GAP:case tj.FRAG_PARSING_ERROR:case tj.FRAG_DECRYPT_ERROR:case tj.FRAG_LOAD_ERROR:case tj.FRAG_LOAD_TIMEOUT:case tj.KEY_LOAD_ERROR:case tj.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(t$.AUDIO,t);break;case tj.AUDIO_TRACK_LOAD_ERROR:case tj.AUDIO_TRACK_LOAD_TIMEOUT:case tj.LEVEL_PARSING_ERROR:t.levelRetry||this.state!==ad.WAITING_TRACK||(null==(i=t.context)?void 0:i.type)!==tJ.AUDIO_TRACK||(this.state=ad.IDLE);break;case tj.BUFFER_APPEND_NO_PROGRESS:if("audio"!==t.parent)return;t.frag&&(t.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn("Marking fragment ".concat(t.frag.sn," of track ").concat(t.frag.level," as a gap after ").concat(t.appendsWithoutProgress," appends without buffered range growth, to prevent loop loading")),this.fragmentTracker.addAsGap(t.frag));break;case tj.BUFFER_ADD_CODEC_ERROR:case tj.BUFFER_APPEND_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)||this.resetLoadingState();break;case tj.BUFFER_FULL_ERROR:if("audio"!==t.parent)return;this.reduceLengthAndFlushBuffer(t)&&(this.bufferedTrack=null,super.flushMainBuffer(0,1/0,"audio"));break;case tj.INTERNAL_EXCEPTION:this.recoverWorkerError(t)}}onBufferFlushing(e,t){let{type:i}=t;i!==t0.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,t){let{type:i}=t;if(i!==t0.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===ad.ENDED&&(this.state=ad.IDLE);let e=this.getBufferOutput();e&&(this.afterBufferFlushed(e,i),this.tick())}}_handleTransmuxComplete(e){var t;let i="audio",{hls:r}=this,{remuxResult:n,chunkMeta:a}=e,s=this.getCurrentContext(a);if(!s)return void this.resetWhenMissingContext(a);let{frag:o,part:l,level:d}=s,{details:u}=d,{audio:h,text:c,id3:m,initSegment:f}=n;if(this.fragContextChanged(o)||!u){this.fragmentTracker.removeFragment(o),null!=f&&f.tracks&&this.resetTransmuxer();return}if(this.state=ad.PARSING,h&&this.switchingTrack&&!this.switchingTrack.flushImmediate){let{config:e}=this,t=e.nextAudioTrackBufferFlushForwardOffset,i=Math.max(this.getLoadPosition()+t,o.start);super.flushMainBuffer(i,1/0,t$.AUDIO)}if(null!=f&&f.tracks){let e=o.initSegment||o;if(this.unhandledEncryptionError(f,o))return;this._bufferInitSegment(d,f.tracks,e,a),r.trigger(tz.FRAG_PARSING_INIT_SEGMENT,{frag:e,id:i,tracks:f.tracks})}if(h){let{startPTS:e,endPTS:t,startDTS:i,endDTS:r}=h;l&&(l.elementaryStreams[t0.AUDIO]={startPTS:e,endPTS:t,startDTS:i,endDTS:r}),o.setElementaryStreamInfo(t0.AUDIO,e,t,i,r),this.bufferFragmentData(h,o,l,a)}if(null!=m&&null!=(t=m.samples)&&t.length){let e=t6({id:i,frag:o,details:u},m);r.trigger(tz.FRAG_PARSING_METADATA,e)}if(c){let e=t6({id:i,frag:o,details:u},c);r.trigger(tz.FRAG_PARSING_USERDATA,e)}}_bufferInitSegment(e,t,i,r){if(this.state!==ad.PARSING||(t.video&&delete t.video,t.audiovideo&&delete t.audiovideo,!t.audio))return;let n=t.audio;n.id=t$.AUDIO;let a=e.audioCodec;this.log("Init audio buffer, container:".concat(n.container,", codecs[level/parsed]=[").concat(a,"/").concat(n.codec,"]")),(null==a?void 0:a.split(",").length)===1&&(n.levelCodec=a),this.hls.trigger(tz.BUFFER_CODECS,t);let s=n.initSegment;if(null!=s&&s.byteLength){let e={type:"audio",frag:i,part:null,chunkMeta:r,parent:i.type,data:s};this.hls.trigger(tz.BUFFER_APPENDING,e)}this.tickImmediate()}loadFragment(e,t,i){let r=this.fragmentTracker.getState(e);if(this.switchingTrack||r===r2.NOT_LOADED||r===r2.PARTIAL){var n;if(null!=(n=t.details)&&n.live&&!this.initPTS[e.cc]){this.log("Waiting for video PTS in continuity counter ".concat(e.cc," of live stream before loading audio fragment ").concat(e.sn," of level ").concat(this.trackId)),this.state=ad.WAITING_INIT_PTS;let i=this.mainDetails;i&&i.fragmentStart!==t.details.fragmentStart&&aa(i,t.details,this)}else super.loadFragment(e,t,i)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack&&e.flushImmediate){let{name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:s}=this.bufferedTrack;rG({name:t,lang:i,assocLang:r,characteristics:n,audioCodec:a,channels:s},e,rH)||(rW(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,1/0,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){let{hls:t}=this;this.bufferedTrack=e,this.switchingTrack=null,t.trigger(tz.AUDIO_TRACK_SWITCHED,t7({},e))}get nextAudioTrack(){return this.nextTrackId}constructor(e,t,i){super(e,t,i,"audio-stream-controller",t$.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.nextTrackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}},audioTrackController:class extends sv{registerListeners(){let{hls:e}=this;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.LEVEL_LOADING,this.onLevelLoading,this),e.on(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tz.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(tz.ER
3ROR,this.onError,this)}unregisterListeners(){let{hls:e}=this;e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.LEVEL_LOADING,this.onLevelLoading,this),e.off(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tz.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(tz.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){let{id:i,groupId:r,details:n}=t,a=this.tracksInGroup[i];if(!a||a.groupId!==r)return void this.warn("Audio track with id:".concat(i," and group:").concat(r," not found in active group ").concat(null==a?void 0:a.groupId));let s=a.details;a.details=t.details,this.log("Audio track ".concat(i,' "').concat(a.name,'" lang:').concat(a.lang," group:").concat(r," loaded [").concat(n.startSN,"-").concat(n.endSN,"]")),i===this.trackId&&this.playlistLoaded(i,t,s)}onLevelLoading(e,t){this.switchLevel(t.level)}onLevelSwitching(e,t){this.switchLevel(t.level)}switchLevel(e){let t=this.hls.levels[e];if(!t)return;let i=t.audioGroups||null,r=this.groupIds,n=this.currentTrack;if(!i||(null==r?void 0:r.length)!==(null==i?void 0:i.length)||null!=i&&i.some(e=>(null==r?void 0:r.indexOf(e))===-1)){this.groupIds=i,this.trackId=-1,this.currentTrack=null;let e=this.tracks.filter(e=>rV(e.groupId,i));if(e.length)this.selectDefaultTrack&&!e.some(e=>e.default)&&(this.selectDefaultTrack=!1),e.forEach((e,t)=>{e.id=t});else if(!n&&!this.tracksInGroup.length)return;this.tracksInGroup=e;let t=this.hls.config.audioPreference;if(!n&&t){let i=rB(t,e,rH);if(i>-1)n=e[i];else{let e=rB(t,this.tracks);n=this.tracks[e]}}let r=this.findTrackId(n);-1===r&&n&&(r=this.findTrackId(null)),this.log("Updating audio tracks, ".concat(e.length," track(s) found in group(s): ").concat(null==i?void 0:i.join(","))),this.hls.trigger(tz.AUDIO_TRACKS_UPDATED,{audioTracks:e});let s=this.trackId;if(-1!==r&&-1===s)this.setAudioTrack(r);else if(e.length&&-1===s){var a;let t=Error("No audio track selected for current audio group-ID(s): ".concat(null==(a=this.groupIds)?void 0:a.join(",")," track count: ").concat(e.length));this.warn(t.message),this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:t})}}}onError(e,t){!t.fatal&&t.context&&t.context.type===tJ.AUDIO_TRACK&&t.context.id===this.trackId&&rV(t.context.groupId,this.groupIds)&&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)}get nextAudioTrack(){return this.trackId}set nextAudioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e,!1)}setAudioOption(e){let t=this.hls;if(t.config.audioPreference=e,e){let i=this.allAudioTracks;
3if(this.selectDefaultTrack=!1,i.length){let r=this.currentTrack;if(r&&rG(e,r,rH))return r;let n=rB(e,this.tracksInGroup,rH);if(n>-1){let t=this.tracksInGroup[n];return this.setAudioTrack(n,"flushImmediate"in e&&e.flushImmediate),t}if(r){let r=t.loadLevel;-1===r&&(r=t.firstAutoLevel);let n=function(e,t,i,r,n){let a=t[r],s=t.reduce((e,t,i)=>{let r=t.uri;return(e[r]||(e[r]=[])).push(i),e},{})[a.uri];s.length>1&&(r=Math.max.apply(Math,s));let o=a.videoRange,l=a.frameRate,d=a.codecSet.substring(0,4),u=rK(t,r,t=>{if(t.videoRange!==o||t.frameRate!==l||t.codecSet.substring(0,4)!==d)return!1;let r=t.audioGroups;return rB(e,i.filter(e=>rV(e.groupId,r)),n)>-1});return u>-1?u:rK(t,r,t=>{let r=t.audioGroups;return rB(e,i.filter(e=>rV(e.groupId,r)),n)>-1})}(e,t.levels,i,r,rH);if(-1===n)return null;t.nextLoadLevel=n}if(e.channels||e.audioCodec){let t=rB(e,i);if(t>-1)return i[t]}}}return null}setAudioTrack(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=this.tracksInGroup;if(e<0||e>=i.length)return void this.warn("Invalid audio track id: ".concat(e));this.selectDefaultTrack=!1;let r=this.currentTrack,n=i[e],a=n.details&&!n.details.live;if(e===this.trackId&&n===r&&a||(this.log("Switching to audio-track ".concat(e,' "').concat(n.name,'" lang:').concat(n.lang," group:").concat(n.groupId," channels:").concat(n.channels)),this.trackId=e,this.currentTrack=n,this.hls.trigger(tz.AUDIO_TRACK_SWITCHING,t7(t7({},n),{},{flushImmediate:t})),a))return;let s=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(s)}findTrackId(e){let t=this.tracksInGroup;for(let i=0;i<t.length;i++){let r=t[i];if((!this.selectDefaultTrack||r.default)&&(!e||rG(e,r,rH)))return i}if(e){let{name:i,lang:r,assocLang:n,characteristics:a,audioCodec:s,channels:o}=e;for(let e=0;e<t.length;e++)if(rG({name:i,lang:r,assocLang:n,characteristics:a,audioCodec:s,channels:o},t[e],rH))return e;for(let i=0;i<t.length;i++){let r=t[i];if(sy(e.attrs,r.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return i}for(let i=0;i<t.length;i++){let r=t[i];if(sy(e.attrs,r.attrs,["LANGUAGE"]))return i}}return -1}loadPlaylist(e){super.loadPlaylist();let t=this.currentTrack;this.shouldLoadPlaylist(t)&&rW(t.url,this.hls)&&this.scheduleLoading(t,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=e.id,r=e.groupId,n=this.getUrlWithDirectives(e.url,t),a=e.details,s=null==a?void 0:a.age;this.log("Loading audio-track ".concat(i,' "').concat(e.name,'" lang:').concat(e.lang," group:").concat(r).concat((null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"").concat(s&&a.live?" age "+s.toFixed(1)+(a.type?" "+a.type:""):""," ").concat(n)),this.hls.trigger(tz.AUDIO_TRACK_LOADING,{url:n,id:i,groupId:r,deliveryDirectives:t||null,track:e})}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()}},emeController:oN,cmcdController:class{createReporter(){var e,t;let{cmcd:i}=this.config;if(null==i)return;let r=i.version||1;if(this.reporter=new oI({sid:i.sessionId||this.hls.sessionId,cid:i.contentId,version:r,transmissionMode:!0===i.useHeaders?ob:oy,enabledKeys:null!=(e=i.includeKeys)?e:[...r>=2?og:oi],eventTargets:(null!=(t=i.eventTargets)?t:[]).map(e=>{let{includeKeys:t}=e;return t7(t7({},ie(e,ow)),{},{enabledKeys:null!=t?t:og})})},i.loader),this.reporter.update({sf:oL.HLS,sta:this.playerState}),i.reporterCallback){let e=this.reporter;i.reporterCallback({updateCustomData:t=>{oC(t)&&e.update(t)},recordCustomEvent:function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};oC(i)&&e.recordEvent(sJ.CUSTOM_EVENT,t7({cen:t},i))}})}this.reporter.start()}registerListeners(){let e=this.hls;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MEDIA_ATTA
3CHING,this.onMediaAttaching,this),e.on(tz.MEDIA_DETACHED,this.onMediaDetached,this),e.on(tz.MEDIA_ENDED,this.onMediaEnded,this),e.on(tz.ERROR,this.onError,this),e.on(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(tz.LEVEL_SWITCHED,this.onLevelSwitched,this),e.on(tz.BUFFER_APPENDED,this.onBufferInfoChange,this),e.on(tz.BUFFER_FLUSHED,this.onBufferInfoChange,this)}unregisterListeners(){let e=this.hls;e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tz.MEDIA_DETACHED,this.onMediaDetached,this),e.off(tz.MEDIA_ENDED,this.onMediaEnded,this),e.off(tz.ERROR,this.onError,this),e.off(tz.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(tz.LEVEL_SWITCHED,this.onLevelSwitched,this),e.off(tz.BUFFER_APPENDED,this.onBufferInfoChange,this),e.off(tz.BUFFER_FLUSHED,this.onBufferInfoChange,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.hls=this.config=null,this.onWaiting=this.onPlay=this.onPlaying=this.onPause=null,this.onSeeking=this.onSeeked=this.onRateChange=this.media=null}onMediaAttaching(e,t){let i=this.media=t.media;this.setPlayerState(this.media.autoplay?oE.STARTING:oE.PRELOADING),as(i,"waiting",this.onWaiting),as(i,"play",this.onPlay),as(i,"playing",this.onPlaying),as(i,"pause",this.onPause),as(i,"seeking",this.onSeeking),as(i,"seeked",this.onSeeked),as(i,"ratechange",this.onRateChange)}onMediaDetached(){let e=this.media;e&&(ao(e,"waiting",this.onWaiting),ao(e,"play",this.onPlay),ao(e,"playing",this.onPlaying),ao(e,"pause",this.onPause),ao(e,"seeking",this.onSeeking),ao(e,"seeked",this.onSeeked),ao(e,"ratechange",this.onRateChange),this.media=null)}onMediaEnded(e,t){this.setPlayerState(oE.ENDED)}onManifestLoading(e,t){this.initialized=!1,this.starved=!1,this.buffering=!0,this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.createReporter(),this.media||this.setPlayerState(oE.PRELOADING)}onError(e,t){t.fatal&&(this.setPlayerState(oE.FATAL_ERROR),this.reporter&&this.reporter.recordEvent(sJ.ERROR,{ec:[t.details]}))}onLevelSwitching(e,t){var i;if(!this.reporter)return;let r={br:[t.bitrate/1e3]},n=null==(i=t.details)?void 0:i.fragments[0];n&&(r.ot=this.getObjectType(n,t)),this.reporter.recordEvent(sJ.BITRATE_CHANGE,r)}onLevelSwitched(e,t){let i=this.hls.levels[t.level];i&&(this.playheadLevel=i)}setPlayerState(e){this.playerState=e,this.reporter&&this.reporter.update({sta:e})}getStreamType(){let e=this.hls.latestLevelDetails;if(e)return e.live?e.partList&&e.canBlockReload?oD.LOW_LATENCY:oD.LIVE:oD.VOD}apply(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.reporter)return;this.reporter.update({mtp:[this.hls.bandwidthEstimate/1e3],pr:null==(t=this.media)?void 0:t.playbackRate,st:this.getStreamType()});let r=i.ot===ov.INIT||i.ot===ov.VIDEO||i.ot===ov.MUXED;this.starved&&r&&(i.bs=!0,i.su=!0,this.starved=!1),null==i.su&&(i.su=this.buffering);let n=this.reporter.createRequestReport({url:e.url,headers:e.headers},i);e.url=n.url,e.headers=n.headers}getNextFrag(e){var t;let i=null==(t=this.hls.levels[e.level])?void 0:t.details;if(i){let t=e.sn-i.startSN;return i.fragments[t+1]}}getNextPart(e){var t;let{index:i,fragment:r}=e,n=null==(t=this.hls.levels[r.level])||null==(t=t.details)?void 0:t.partList;if(n){let{sn:e}=r;for(let t=n.length-1;t>=0;t--){let r=n[t];if(r.index===i&&r.fragment.sn===e)return n[t+1]}}}getObjectType(e,t){let{type:i}=e;if("subtitle"===i)return ov.TIMED_TEXT;if("initSegment"===e.sn)return ov.INIT;if("audio"===i)return ov.AUDIO;if("main"===i){if(e.hasStreams){let t=e.elementaryStreams;if(t.audiovideo)return ov.MUXED;if(t.video)return ov.VIDEO;if(t.audio)return ov.AUDIO}if(t){let{audioCodec:e,videoCodec:i}=t;if(!this.hls.audioTracks.length){if(e&&i)return ov.MUXED;if(e)return ov.AUDIO}if(i)return ov.VIDEO}}}getTopBandwidth(){let e=0,t=this.hls,i=t.maxAutoLevel,r=i>-1?i+1:t.levels.length;return t.levels.slice(0,r).forEach(t=>{t.bitrate>e&&(e=t.bitrate)}),e>0?e:NaN}getLowestBandwidth(){let e=1/0,t=this.hls,i=t.maxAutoLevel,r=i>-1?i+1:t.levels.length;return t.levels.slice(0,r).forEach(t=>{t.bitrate<e&&(e=t.bitrate)}),tW(e)?e:NaN}getBufferLength(e){if(!this.media)return NaN;let t="audio"===e.type?this.hls.audioForwardBufferInfo:this.hls.mainForwardBufferInfo;return t?1e3*t.len:NaN}getEventBufferLength(){if(!this.media)return NaN;let e=this.hls.mainForwardBufferInfo,t=this.hls.audioForwardBufferInfo;if(e&&t)return 1e3*Math.min(e.len,t.len);let i=e||t;return i?1e3*i.len:NaN}onBufferInfoChange(e,t){if(!this.reporter)return;let i=this.getEventBufferLength();tW(i)&&this.reporter.update({bl:[i]})}createPlaylistLoader(){let{pLoader:e}=this.config,t=this.applyPlaylistData,i=e||this.config.loader;return class{get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,i,r){t(e),this.loader.load(e,i,r)}constructor(e){this.loader=void 0,this.loader=new i(e)}}}createFragmentLoader(){let{fLoader:e}=this.config,t=this.applyFragmentData,i=this.recordFragmentResponse,r=e||this.config.loader;return class{get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(e,r,n){t(e);let{onSuccess:a}=n;this.loader.load(e,r,t7(t7({},n),{},{onSuccess:(t,r,n,s)=>{a(t,r,n,s),i(e.url,t,r)}}))}constructor(e){this.loader=void 0,this.loader=new r(e)}}}constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.playerState=void 0,this.reporter=void 0,this.playheadLevel=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0,this.setPlayerState(oE.REBUFFERING)),this.buffering=!0},this.onPlay=()=>{this.initialized||this.setPlayerState(oE.STARTING)},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1,this.setPlayerState(oE.PLAYING)},this.onPause=()=>{this.media&&!this.media.ended&&this.setPlayerState(oE.PAUSED)},this.onSeeking=()=>{this.initialized&&this.setPlayerState(oE.SEEKING)},this.onSeeked=()=>{var e;this.initialized&&null!=(e=this.media)&&e.paused&&this.setPlayerState(oE.PAUSED)},this.onRateChange=()=>{this.reporter&&this.media&&this.reporter.update({pr:this.media.playbackRate})},this.applyPlaylistData=e=>{try{this.apply(e,{ot:ov.MANIFEST,su:!this.initialized})}catch(e){this.hls.logger.warn("Could not generate manifest CMCD data.",e)}},this.applyFragmentData=e=>{try{var t,i,r,n;let{frag:a,part:s}=e,o=this.hls.levels[a.level],l=this.getObjectType(a,o),d={d:1e3*(s||a).duration,ot:l};if(l===ov.VIDEO||l===ov.AUDIO||l===ov.MUXED||null==l&&("main"===a.type||"audio"===a.type)){let e=o.bitrate/1e3;d.br=[e];let{cmcd:r}=this.config,n=null!=(t=null==r?void 0:r.rtpSafetyFactor)?t:5;if(d.rtp=100*Math.round(e*n/100),l===ov.MUXED||null==l&&"main"===a.type){let e=this.getTopBandwidth()/1e3;tW(e)&&(d.tb=[e]);let t=this.getLowestBandwidth()/1e3;tW(t)&&(d.lb=[t])}let s=this.getBufferLength(a);if(tW(s)){d.bl=[s];let e=(null==(i=this.media)?void 0:i.playbackRate)||1;d.dl=100*Math.round(s/e/100)}this.playheadLevel&&(d.pb=[this.playheadLevel.bitrate/1e3]);let u=this.hls.maxAutoLevel;if(u>=0){let e=this.hls.levels[u];e&&(d.tpb=[e.bitrate/1e3])}}let u=s?this.getNextPart(s):this.getNextFrag(a);null!=u&&u.url&&u.url!==a.url&&(u.byteRange.length>0?d.nor=[(r=u.url,n={r:"".concat(u.byteRange[0],"-").concat(u.byteRange[1])},new sC(r,n))]:d.nor=[u.url]),this.apply(e,d)}catch(e){this.hls.logger.warn("Could not generate segment CMCD data.",e)}},this.recordFragmentResponse=(e,t,i)=>{var r;let{cmcd:n}=this.config,a=null==n||null==(r=n.eventTargets)?void 0:r.some(e=>{var t;return null==(t=e.events)?void 0:t.includes(sJ.RESPONSE_RECEIVED)});if(this.reporter&&i.loading.first>0&&a)try{this.reporter.recordResponseReceived({request:{url:e},status:t.code,resourceTiming:{startTime:i.loading.start,responseStart:i.loading.first,duration:i.loading.end-i.loading.start,encodedBodySize:i.total}})}catch(e){this.hls.logger.warn("Could not record fragment response CMCD data.",e)}},this.hls=e;let t=this.config=e.config,{cmcd:i}=t;null!=i&&(t.pLoader=this.createPlaylistLoader(),t.fLoader=this.createFragmentLoader(),this.registerListeners())}},contentSteeringController:class extends im{registerListeners(){let e=this.hls;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.on(tz.ER
3ROR,this.onError,this)}unregisterListeners(){let e=this.hls;e&&(e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.MANIFEST_PARSED,this.onManifestParsed,this),e.off(tz.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,t)=>(-1===e.indexOf(t.pathwayId)&&e.push(t.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){let e=1e3*this.timeToLoad-(performance.now()-this.updated);if(e>0)return void this.scheduleRefresh(this.uri,e)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){let t=this.levels;t&&(this.levels=t.filter(t=>t!==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){let{contentSteering:i}=t;null!==i&&(this.pathwayId=i.pathwayId,this.uri=i.uri,this.started&&this.startLoad())}onManifestParsed(e,t){this.audioTracks=t.audioTracks,this.subtitleTracks=t.subtitleTracks}onError(e,t){let{errorAction:i}=t;if((null==i?void 0:i.action)===rZ.SendAlternateToPenaltyBox&&i.flags&rJ.MoveAllAlternatesMatchingHost){let e=this.levels,r=this._pathwayPriority,n=this.pathwayId;if(t.context){let{groupId:i,pathwayId:r,type:a}=t.context;i&&e?n=this.getPathwayForGroupId(i,a,n):r&&(n=r)}n in this.penalizedPathways||(this.penalizedPathways[n]=performance.now()),!r&&e&&(r=this.pathways()),r&&r.length>1&&(this.updatePathwayPriority(r),i.resolved=this.pathwayId!==n,!i.resolved&&(t.details!==tj.BUFFER_APPEND_ERROR||t.fatal)&&this.warn("Could not resolve ".concat(t.details,' ("').concat(t.error.message,'") with content-steering for Pathway: ').concat(n," levels: ").concat(e?e.length:e," priorities: ").concat(rx(r)," penalized: ").concat(rx(this.penalizedPathways))))}}filterParsedLevels(e){this.levels=e;let t=this.getLevelsForPathway(this.pathwayId);if(0===t.length){let i=e[0].pathwayId;this.log("No levels found in Pathway ".concat(this.pathwayId,'. Setting initial Pathway to "').concat(i,'"')),t=this.getLevelsForPathway(i),this.pathwayId=i}return t.length!==e.length&&this.log("Found ".concat(t.length,"/").concat(e.length,' levels in Pathway "').concat(this.pathwayId,'"')),t}getLevelsForPathway(e){return null===this.levels?[]:this.levels.filter(t=>e===t.pathwayId)}updatePathwayPriority(e){let t;this._pathwayPriority=e;let i=this.penalizedPathways,r=performance.now();
3Object.keys(i).forEach(e=>{r-i[e]>3e5&&delete i[e]});for(let r=0;r<e.length;r++){let n=e[r];if(n in i)continue;if(n===this.pathwayId)return;let a=this.hls.nextLoadLevel,s=this.hls.levels[a];if((t=this.getLevelsForPathway(n)).length>0){this.log('Setting Pathway to "'.concat(n,'"')),this.pathwayId=n,ae(t),this.hls.trigger(tz.LEVELS_UPDATED,{levels:t});let e=this.hls.levels[a];s&&e&&this.levels&&(e.attrs["STABLE-VARIANT-ID"]!==s.attrs["STABLE-VARIANT-ID"]&&e.bitrate!==s.bitrate&&this.log("Unstable Pathways change from bitrate ".concat(s.bitrate," to ").concat(e.bitrate)),this.hls.nextLoadLevel=a);break}}}getPathwayForGroupId(e,t,i){let r=this.getLevelsForPathway(i).concat(this.levels||[]);for(let i=0;i<r.length;i++)if(t===tJ.AUDIO_TRACK&&r[i].hasAudioGroup(e)||t===tJ.SUBTITLE_TRACK&&r[i].hasSubtitleGroup(e))return r[i].pathwayId;return i}clonePathways(e){let t=this.levels;if(!t)return;let i={},r={};e.forEach(e=>{let{ID:n,"BASE-ID":a,"URI-REPLACEMENT":s}=e;if(t.some(e=>e.pathwayId===n))return;let o=this.getLevelsForPathway(a).map(e=>{let t=new nE(e.attrs);t["PATHWAY-ID"]=n;let a=t.AUDIO&&"".concat(t.AUDIO,"_clone_").concat(n),o=t.SUBTITLES&&"".concat(t.SUBTITLES,"_clone_").concat(n);a&&(i[t.AUDIO]=a,t.AUDIO=a),o&&(r[t.SUBTITLES]=o,t.SUBTITLES=o);let l=oP(e.uri,t["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",s),d=new rP({attrs:t,audioCodec:e.audioCodec,bitrate:e.bitrate,height:e.height,name:e.name,url:l,videoCodec:e.videoCodec,width:e.width});if(e.audioGroups)for(let t=1;t<e.audioGroups.length;t++)d.addGroupId("audio","".concat(e.audioGroups[t],"_clone_").concat(n));if(e.subtitleGroups)for(let t=1;t<e.subtitleGroups.length;t++)d.addGroupId("text","".concat(e.subtitleGroups[t],"_clone_").concat(n));return d});t.push(...o),oM(this.audioTracks,i,s,n),oM(this.subtitleTracks,r,s,n)})}loadSteeringManifest(e){let t,i=this.hls.config,r=i.loader;this.loader&&this.loader.destroy(),this.loader=new r(i);try{t=new self.URL(e)}catch(t){this.enabled=!1,this.log("Failed to parse Steering Manifest URI: ".concat(e));return}if("data:"!==t.protocol){let e=0|(this.hls.bandwidthEstimate||i.abrEwmaDefaultEstimate);rI(t,"_HLS_pathway",this.pathwayId),rI(t,"_HLS_throughput",""+e)}let n={type:tJ.STEERING_MANIFEST,responseType:"json",url:t.href},a=i.steeringManifestLoadPolicy.default,s=a.errorRetry||a.timeoutRetry||{},o={loadPolicy:a,timeout:a.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0};this.log("Requesting steering manifest: ".concat(t)),this.loader.load(n,o,{onSuccess:(e,i,r,n)=>{this.log('Loaded steering manifest: "'.concat(t,'"'));let a=e.data;if((null==a?void 0:a.VERSION)!==1)return void this.log("Steering VERSION ".concat(a.VERSION," not supported!"));this.updated=performance.now(),this.timeToLoad=a.TTL;let{"RELOAD-URI":s,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=a;if(s)try{this.uri=new self.URL(s,t).href}catch(e){this.enabled=!1,this.log("Failed to parse Steering Manifest RELOAD-URI: ".concat(s));return}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);let d={steeringManifest:a,url:t.toString()};this.hls.trigger(tz.STEERING_MANIFEST_LOADED,d),l&&this.updatePathwayPriority(l)},onError:(e,t,i,r)=>{if(this.log("Error loading steering manifest: ".concat(e.code," ").concat(e.text," (").concat(t.url,")")),this.stopLoad(),410===e.code){this.enabled=!1,this.log("Steering manifest ".concat(t.url," no longer available"));return}let n=1e3*this.timeToLoad;if(429===e.code){let e=this.loader;if("function"==typeof(null==e?void 0:e.getResponseHeader)){let t=e.getResponseHeader("Retry-After");t&&(n=1e3*parseFloat(t))}this.log("Steering manifest ".concat(t.url," rate limited"));return}this.scheduleRefresh(this.uri||t.url,n)},onTimeout:(e,t,i)=>{this.log("Timeout loading steering manifest (".concat(t.url,")")),this.scheduleRefresh(this.uri||t.url)}})}scheduleRefresh(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3*this.timeToLoad;this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var t;let i=null==(t=this.hls)?void 0:t.media;if(i&&!i.ended)return void this.loadSteeringManifest(e);this.scheduleRefresh(e,1e3*this.timeToLoad)},t)}constructor(e){super("content-steering",e.logger),this.hls=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.registerListeners()}}
3,iframeController:class extends im{registerListeners(){let e=this.hls;e&&(e.on(tz.MANIFEST_LOADING,this.clearAsset,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tz.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;e&&(e.off(tz.MANIFEST_LOADING,this.clearAsset,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tz.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tz.DESTROYING,this.onDestroying,this))}clearAsset(){this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances.forEach(e=>e.destroy()),this.iframeInstances.length=0}onDestroying(){this.unregisterListeners(),this.clearAsset(),this.hls=void 0}onManifestLoaded(e,t){this.stats=t.stats,this.variableList=t.variableList}onLevelsUpdated(e,t){var i;let{levels:r}=t,n=null==(i=this.hls)?void 0:i.pathwayPriority;r.length&&n&&this.iframeInstances.forEach(e=>{e.pathwayPriority=n})}onInitPtsFound(e,t){let{id:i,timestampOffsets:r}=t;i===t$.MAIN&&(this.initPTS=r)}onFragBuffered(e,t){var i;let r=this.hls;r&&r.hasEnoughToStart&&((null==(i=r.mainForwardBufferInfo)?void 0:i.len)||0)>10&&this.iframeInstances.forEach(e=>{if(!e.loadingEnabled){var t;e.startLoad((null==(t=this.hls)||null==(t=t.media)?void 0:t.currentTime)||0)}})}createIFramePlayer(e){var t;return this.createInstance(s,null==(t=this.hls)?void 0:t.iframeVariants,e)}createImageIFramePlayer(e){var t;let i=null==(t=this.hls)?void 0:t.iframeVariants.filter(e=>e.imageCodec);return this.createInstance(o,i,e,"image-")}createInstance(e,t,i,r){let{hls:n}=this;if(!n)return null;let{url:a,userConfig:s,latestLevelDetails:o,loadLevelObj:l,loadLevel:d,bandwidthEstimate:u,sessionId:h}=n,{stats:c,variableList:m}=this;if(!(null!=t&&t.length)||!c||!a)return null;let f="".concat(r||"","iframe-player-").concat(this.instanceCounter++),p=n.levels,g=l||p[d],v=rq(g,s.videoPreference),E=(null==g?void 0:g.pathwayId)||".",y=new e(t7(t7({},s),{},{loggerId:f,primarySessionId:h,videoPreference:v,abrEwmaDefaultEstimate:u,streamController:void 0,audioStreamController:void 0,audioTrackController:void 0,subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,id3TrackController:void 0,fpsController:void 0,gapController:void 0,iframeController:void 0,cmcd:void 0,interstitialsController:void 0,backBufferLength:1/0,maxMaxBufferLength:1,capLevelToPlayerSize:!0,enableWorker:!1,autoStartLoad:!1,startFragPrefetch:!1,testBandwidth:!1,progressive:!1},i),a,this.initPTS,o);return this.iframeInstances=this.iframeInstances.filter(e=>!e.url),this.iframeInstances.push(y),y.trigger(tz.MANIFEST_LOADED,{levels:t,contentSteering:{uri:"",pathwayId:E},sessionKeys:null,audioTracks:[],iframeVariants:[],sessionData:null,startTimeOffset:null,stats:c,networkDetails:null,url:a,variableList:m}),y}constructor(e,t){super("iframes",e.logger),this.hls=void 0,this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances=void 0,this.instanceCounter=0,s||(s=function(e){return class extends e{loadSource(){}loadMediaAt(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:lp;if(e<0)return;let i=t7(t7({},lp),t);this.loadingEnabled||this.startLoad(e),this.streamController.loadMediaAt(e,i)}constructor(e,t,i,r){e.streamController||(e.streamController=lm),super(e),this._url=t,this.streamController.setInitPts(i),this.streamController.initDetails=r}}}(t)),o||(o=function(e){return class extends e{attachImage(e){this.streamController.image=e}detachImage(){this.streamController.image=void 0}loadSource(){}attachMedia(){throw Error("Image I-Frame player does not accept HTMLMediaElements")}detachMedia(){}recoverMediaError(){}transferMedia(){return null}loadMediaAt(e){if(e<0)return null;this.loadingEnabled||this.startLoad(e),this.streamController.loadMediaAt(e)}constructor(e,t,i,r){e.cmcdController=void 0,e.emeController=void 0,e.streamController||(e.streamController=lf),e.capLevelController=void 0,e.bufferController=void 0,super(e,t,i,r)}}}(s)),this.hls=e,this.iframeInstances=[],this.registerListeners()}},interstitialsController:class extends im{registerListeners(){let e=this.hls;
3e&&(e.on(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(tz.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(tz.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(tz.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(tz.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(tz.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.on(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(tz.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(tz.MEDIA_ENDED,this.onMediaEnded,this),e.on(tz.ERROR,this.onError,this),e.on(tz.DESTROYING,this.onDestroying,this))}unregisterListeners(){let e=this.hls;e&&(e.off(tz.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(tz.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(tz.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(tz.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(tz.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(tz.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(tz.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(tz.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(tz.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(tz.BUFFER_CODECS,this.onBufferCodecs,this),e.off(tz.BUFFER_APPENDED,this.onBufferAppended,this),e.off(tz.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(tz.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(tz.MEDIA_ENDED,this.onMediaEnded,this),e.off(tz.ERROR,this.onError,this),e.off(tz.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;null==(e=this.getBufferingPlayer())||e.resumeBuffering()}pauseBuffering(){var e;null==(e=this.getBufferingPlayer())||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){let e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){ao(e,"play",this.onPlay),ao(e,"pause",this.onPause),ao(e,"seeking",this.onSeeking),ao(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,t){let i=this.media=t.media;as(i,"seeking",this.onSeeking),as(i,"timeupdate",this.onTimeupdate),as(i,"play",this.onPlay),as(i,"pause",this.onPause)}onMediaAttached(e,t){let i=this.effectivePlayingItem,r=this.detachedData;if(this.detachedData=null,null===i)this.checkStart();else if(!r){this.clearScheduleState();let e=this.findItemIndex(i);this.setSchedulePosition(e)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,t){let i=!!t.transferMedia,r=this.media;if(this.media=null,!i&&(r&&this.removeMediaListeners(r),this.detachedData)){let e=this.getBufferingPlayer();e&&(this.log("Removing schedule state for detachedData and ".concat(e)),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,e.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;let e=this,t=t=>t?e.getAssetPlayer(t.identifier):t,i=(i,n,a,s,o)=>{if(i){let l=i[n].start,d=i.event;if(d){if("playout"===n||d.timelineOccupancy!==lg.Point){let e=t(a);(null==e?void 0:e.interstitial)===d&&(l+=e.assetItem.startOffset+e[o])}}else l+=("bufferedPos"===s?r():e[s])-i.start;return l}return 0},r=()=>{let t=e.bufferedPos;return t===Number.MAX_VALUE?n("primary"):Math.max(t,0)},n=t=>{var i,r;return null!=(i=e.primaryDetails)&&i.live?e.primaryDetails.edge:(null==(r=e.schedule)?void 0:r.durations[t])||0},a=(r,n)=>{var a,s;let o=e.effectivePlayingItem;if(null!=o&&null!=(a=o.event)&&a.restrictions.skip||!e.schedule)return;e.log("seek to ".concat(r,' "').concat(n,'"'));let l=e.effectivePlayingItem,d=e.schedule.findItemIndexAtTime(r,n),u=null==(s=e.schedule.items)?void 0:s[d],h=e.getBuffer
3ingPlayer(),c=null==h?void 0:h.interstitial,m=null==c?void 0:c.appendInPlace,f=l&&e.itemsMatch(l,u);if(l&&(m||f)){let a=t(e.playingAsset),s=(null==a?void 0:a.media)||e.primaryMedia;if(s){let t="primary"===n?s.currentTime:i(l,n,e.playingAsset,"timelinePos","currentTime"),o=r-t,d=(m?t:s.currentTime)+o;if(d>=0&&(!a||m||d<=a.duration)){s.currentTime=d;return}}}if(u){let t=r;if("primary"!==n){let e=r-u[n].start;t=u.start+e}let i=!e.isInterstitial(u);if((!e.isInterstitial(l)||l.event.appendInPlace)&&(i||u.event.appendInPlace)){let i=e.media||(m?null==h?void 0:h.media:null);i&&(i.currentTime=t)}else if(l){let a=e.findItemIndex(l);if(d>a){let t=e.schedule.findJumpRestrictedIndex(a+1,d);if(t>a)return void e.setSchedulePosition(t)}let s=0;if(i)e.timelinePos=t,e.checkBuffer();else{let e=u.event.assetList,t=r-(u[n]||u).start;for(let i=e.length;i--;){let r=e[i];if(r.duration&&t>=r.startOffset&&t<r.startOffset+r.duration){s=i;break}}}e.setSchedulePosition(d,s)}}},s=()=>{let t=e.effectivePlayingItem;if(e.isInterstitial(t))return t;let i=e.bufferingItem||e.waitingItem;return e.isInterstitial(i)?i:null},o={get bufferedEnd(){let t=e.bufferingItem||e.waitingItem,r=e.bufferingItem;if(r&&r===t){var l;return i(r,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-r.playout.start||(null==(l=e.bufferingAsset)?void 0:l.startOffset)||0}return 0},get currentTime(){let t=s(),r=e.effectivePlayingItem;if(r&&r===t)return i(r,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-r.playout.start;return 0},set currentTime(time){let t=s(),i=e.effectivePlayingItem;i&&i===t&&a(time+i.playout.start,"playout")},get duration(){let e=s();if(e)return e.playout.end-e.playout.start;return 0},get assetPlayers(){var d;let t=null==(d=s())?void 0:d.event.assetList;if(t)return t.map(t=>e.getAssetPlayer(t.identifier));return[]},get playingIndex(){var u;let t=null==(u=s())?void 0:u.event;if(t&&e.effectivePlayingAsset)return t.findAssetIndex(e.effectivePlayingAsset);return -1},get scheduleItem(){return s()}};return this.manager={get events(){var h;return(null==(h=e.schedule)||null==(h=h.events)?void 0:h.slice(0))||[]},get schedule(){var c;return(null==(c=e.schedule)||null==(c=c.items)?void 0:c.slice(0))||[]},get interstitialPlayer(){if(s())return o;return null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return e.bufferingItem||e.waitingItem},get bufferingIndex(){let t=e.bufferingItem||e.waitingItem;return e.findItemIndex(t)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){let t=e.effectivePlayingItem;return e.findItemIndex(t)},primary:{get bufferedEnd(){return r()},get currentTime(){let t=e.timelinePos;return t>0?t:0},set currentTime(time){a(time,"primary")},get duration(){return n("primary")},get seekableStart(){return e.seekableStart}},integrated:{get bufferedEnd(){return i(e.bufferingItem||e.waitingItem,"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return i(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(time){a(time,"integrated")},get duration(){return n("integrated")},get seekableStart(){return((t,i)=>{var r,n;if(0!==t&&"primary"!==i&&null!=(r=e.schedule)&&r.length){let r=e.schedule.findItemIndexAtTime(t),a=null==(n=e.schedule.items)?void 0:n[r];if(a)return t+(a[i].start-a.start)}return t})(e.seekableStart,"integrated")}},skip:()=>{let t=e.effectivePlayingItem,i=null==t?void 0:t.event;if(i&&!i.restrictions.skip){let r=e.findItemIndex(t);i.appendInPlace?a(t.playout.start+t.event.duration+.001,"playout"):e.advanceAfterAssetEnded(i,r,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;let t=this.playingItem,i=null==(e=this.schedule)?void 0:e.items;return!!this.playbackStarted&&!!t&&!!i&&this.findItemIndex(t)===i.length-1}get playbackStarted(){return null!==this.effectivePlayingItem}get currentTime(){var e,t;if(null===this.mediaSelection)return;let i=this.waitingItem||this.playingItem;if(this.isInterstitial(i)&&!i.event.appendInPlace)return;let r=this.media;!r&&null!=(e=this.bufferingItem)&&null!=(e=e.event)&&e.appendInPlace&&(r=this.primaryMedia);let n=null==(t=r)?void 0:t.currentTime;if(void 0!==n&&tW(n))return n}get primaryMedia(){var e;return this.media||(null==(e=this.detachedData)?void 0:e.media)||null}isInterstitial(e){return!!(null!=e&&e.event)}retreiveMediaSource(e,t){let i=this.getAssetPlayer(e);i&&this.transferMediaFromPlayer(i,t)}transferMediaFromPlayer(e,t){let i=e.interstitial.appendInPlace,r=e.media;if(i&&r===this.primaryMedia){if(this.bufferingAsset=null,(!t||this.isInterstitial(t)&&!t.event.appendInPlace)&&t&&r){this.detachedData={media:r};return}let i=e.transferMedia();this.log("transfer MediaSource from ".concat(e," ").concat(rx(i))
3),this.detachedData=i}else t&&r&&(this.shouldPlay||(this.shouldPlay=!r.paused))}transferMediaTo(e,t){var i,r;let n;if(e.media===t)return;let a=null,s=this.hls,o=e!==s,l=o&&e.interstitial.appendInPlace,d=null==(i=this.detachedData)?void 0:i.mediaSource;if(s.media)l&&(a=s.transferMedia(),this.detachedData=a),n="Primary";else{let e=this.getBufferingPlayer();e?(a=e.transferMedia(),this.detachedData=a,n="".concat(e)):n=d?"detached MediaSource":"detached media"}if(!a){if(d)a=this.detachedData,this.log("using detachedData: MediaSource ".concat(rx(a)));else if(!this.detachedData||s.media===t){let e=this.playerQueue;e.length>1&&e.forEach(e=>{if(o&&e.interstitial.appendInPlace!==l){let t=e.interstitial;this.clearInterstitial(e.interstitial,null),t.appendInPlace=!1,t.appendInPlace&&this.warn("Could not change append strategy for queued assets ".concat(t))}}),this.hls.detachMedia(),this.detachedData={media:t}}}let u=a&&"mediaSource"in a&&(null==(r=a.mediaSource)?void 0:r.readyState)!=="closed";if(this.log("".concat(u?"transfering MediaSource":"attaching media"," to ").concat(o?e:"Primary"," from ").concat(n," (media.currentTime: ").concat(t.currentTime,")")),!u&&!o)return void e.attachMedia(t);let h=u&&a?t7({},a):{media:t},c=this.schedule;if(c&&o){let t=e.assetId===c.assetIdAtEnd;h.overrides={duration:c.duration,endOfStream:t||!1===e.appendInPlace}}if(!u&&l){let t=e.assetItem.timelineStart;if(t){let i=e.hls,r=Math.max(this.timelinePos-t,Number.EPSILON);i.startPosition!==r&&(this.log("Set ".concat(e," startPosition: ").concat(r)),i.config.startPosition=r,i.loadingEnabled&&i.startLoad(r))}}e.attachMedia(h)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){let e=this.schedule,t=null==e?void 0:e.events,i=this.hls;if(!t||this.playbackDisabled||!this.media||!i)return;-1===this.bufferedPos&&(this.bufferedPos=0);let r=this.timelinePos,n=this.effectivePlayingItem;if(-1===r){if(!i.loadingEnabled)return void this.log("waiting for startLoad( <startPosition> )");let r=i.startPosition;if(this.timelinePos=r,0===t.length)this.setSchedulePosition(0);else if(t[0].cue.pre){this.log(lL("checkStart (preroll)",r));let i=e.findEventIndex(t[0].identifier);this.setSchedulePosition(i)}else if(r>=0||!this.primaryLive){this.log(lL("checkStart",r));let t=this.timelinePos=r>0?r:0,i=e.findItemIndexAtTime(t);this.setSchedulePosition(i)}else 0===i.liveSyncPosition?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(n&&!this.playingItem){this.log(lL("checkStart (playing item)",n.start));let t=e.findItemIndex(n);this.setSchedulePosition(t)}}advanceAssetBuffering(e,t){let i=e.event,r=i.findAssetIndex(t),n=lT(i,r);if(i.isAssetPastPlayoutLimit(n)){if(this.schedule){var a;let t=this.getNextItemIndex(e,!0),i=null==(a=this.schedule.items)?void 0:a[t];i&&this.bufferedToItem(i)}}else this.bufferedToEvent(e,n)}livePrerollResumption(e,t){if(e.cue.pre&&this.primaryLive&&!tW(e.resumeOffset)&&this.hls){let e=this.getLiveStartPos();if(t){let t=this.getBufferingPlayer();return e+(null!=t&&t.interstitial.cue.pre?t.remaining:0)}return e}}getNextItemIndex(e,t){if(this.schedule){let i=this.livePrerollResumption(e.event,t);if(void 0!==i)return this.log("find next item index @".concat(i)),this.schedule.findItemIndexAtTime(i)}return this.findItemIndex(e)+1}advanceAfterAssetEnded(e,t,i){let r=lT(e,i);if(e.isAssetPastPlayoutLimit(r)){if(this.schedule){let i=this.schedule.items;if(i){let r=i[t],n=r.event?this.getNextItemIndex(r):t+1;if(n>=i.length)return void this.setSchedulePosition(-1);let a=e.resumeTime;this.timelinePos<a&&(this.log(lL("advanceAfterAssetEnded",a)),this.timelinePos=a,e.appendInPlace&&!i[n].event&&this.hls.startLoad(a+.01),this.checkBuffer(this.bufferedPos<a)),this.setSchedulePosition(n)}}}else{if(e.appendInPlace){let t=e.assetList[r];t&&this.advanceInPlace(t.timelineStart)}this.setSchedulePosition(t,r)}}setScheduleToAssetAtTime(e,t){let i=this.schedule;if(!i)return;let r=t.parentIdentifier,n=i.getEvent(r);if(n){let t=i.findEventIndex(r),a=i.findAssetIndex(n,e);this.advanceAfterAssetEnded(n,t,a-1)}}setSchedulePosition(e,t){var i,r,n,a;let s=null==(i=this.schedule)?void 0:i.items;if(!s||this.playbackDisabled)return;let o=e>=0?s[e]:null;this.log("setSchedulePosition ".concat(e,", ").concat(t," (").concat(o?lR(o):o,") pos: ").concat(this.timelinePos));let l=this.waitingItem||this.playingItem,d=this.playingLastItem;if(this.isInterstitial(l)){let i=l.event,u=this.playingAsset,h=null==u?void 0:u.identifier,c=h?this.getAssetPlayer(h):null;if(c&&h&&(!this.eventItemsMatch(l,o)||void 0!==t&&h!==i.assetList[t].identifier)){let t=i.findAssetIndex(u);if(this.log("INTERSTITIAL_ASSET_ENDED ".concat(t+1,"/").concat(i.assetList.length," ").concat(l_(u))),this.endedAsset=u,this.playingAsset=null,this.hls.trigger(tz.INTERSTITIAL_ASSET_ENDED,{asset:u,assetListIndex:t,event:i,schedule:s.slice(0),scheduleIndex:e,player:c}),l!==this.playingItem){this.itemsMatch(l,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(i,this.findItemIndex(this.playingItem),t);return}this.retreiveMediaSource(h,o),c.media&&!(null!=(r=this.detachedData)&&r.mediaSource)&&c.detachMedia()}if(!this.eventItemsMatch(l,o)&&(this.endedItem=l,this.playingItem=this.waitingItem=null,this.log("INTERSTITIAL_ENDED ".concat(i," ").concat(lR(l))),i.hasPlayed=!0,this.hls.trigger(tz.INTERSTITIAL_ENDED,{event:i,schedule:s.slice(0),scheduleIndex:e}),i.cue.once&&this.hls)){this.updateSchedule();let e=null==(n=this.schedule)?void 0:n.items;if(o&&e){let r=this.findItemIndex(o),n=this.livePrerollResumption(i);if(void 0!==n){let t=n,o=this.getNextItemIndex(l);if(!this.isInterstitial(s[o])){let e=null==(a=this.primaryDetails)?void 0:a.fragments;if(i.snapOptions.in&&e){let i=rj(null,e,n);i&&(t=Math.min(Math.max(s[o].start,lE(t,i)),s[o].end))}}if(this.log(lL("live join (preroll)",t)),this.timelinePos=t,o!==r&&(o||0===o))return void this.advanceSchedule(o,e,void 0,l,d)}this.advanceSchedule(r,e,t,l,d)}return}}this.advanceSchedule(e,s,t,l,d)}advanceSchedule(e,t,i,r,n){let a=this.schedule;if(!a)return;let s=t[e]||null,o=this.primaryMedia,l=this.playerQueue;if(l.length&&l.forEach(t=>{let i=t.interstitial,r=a.findEventIndex(i.identifier);(r<e||r>e+1)&&this.clearInterstitial(i,s)}),this.isInterstitial(s)){this.timelinePos=Math.min(Math.max(this.timelinePos,s.start),s.end);let n=s.event;if(void 0===i){i=n.cue.pre?0:a.findAssetIndex(n,this.timelinePos);let t=lT(n,i-1);
3if(n.isAssetPastPlayoutLimit(t)||n.appendInPlace&&this.timelinePos===s.end)return void this.advanceAfterAssetEnded(n,e,i);i=t}let l=this.waitingItem;this.assetsBuffered(s,o)||this.setBufferingItem(s);let d=this.preloadAssets(n,i);if(this.eventItemsMatch(s,l||r)||(this.waitingItem=s,this.log("INTERSTITIAL_STARTED ".concat(lR(s)," ").concat(n.appendInPlace?"append in place":"")),n.hasPlayed=!1,this.hls.trigger(tz.INTERSTITIAL_STARTED,{event:n,schedule:t.slice(0),scheduleIndex:e})),!n.assetListLoaded)return void this.log("Waiting for ASSET-LIST to complete loading ".concat(n));if(n.assetListLoader&&(n.assetListLoader.destroy(),n.assetListLoader=void 0),!o)return void this.log("Waiting for attachMedia to start Interstitial ".concat(n));this.waitingItem=this.endedItem=null,this.playingItem=s;let u=n.assetList[i];if(!u)return void this.advanceAfterAssetEnded(n,e,i||0);if(d||(d=this.getAssetPlayer(u.identifier)),null===d||d.destroyed){let e=n.assetList.length;this.warn("asset ".concat(i+1,"/").concat(e," player destroyed ").concat(n)),(d=this.createAssetPlayer(n,u,i)).loadSource()}if(!this.eventItemsMatch(s,this.bufferingItem)&&n.appendInPlace&&this.isAssetBuffered(u))return;this.startAssetPlayer(d,i,t,e,o),this.shouldPlay&&lI(d.media)}else s?(this.resumePrimary(s,e,r),this.shouldPlay&&lI(this.hls.media)):n&&this.isInterstitial(r)&&(this.endedItem=null,this.playingItem=r,r.event.appendInPlace||this.attachPrimary(a.durations.primary,null))}get playbackDisabled(){return!1===this.hls.config.enableInterstitialPlayback}get primaryDetails(){var e;return null==(e=this.mediaSelection)?void 0:e.main.details}get primaryLive(){var e;return!!(null!=(e=this.primaryDetails)&&e.live)}resumePrimary(e,t,i){var r,n;this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.endedItem=null,this.log("resuming ".concat(lR(e)));let a=this.timelinePos;if(null!=(r=this.detachedData)&&r.mediaSource?this.primaryLive&&this.startLoadingPrimaryAt(a):((a<e.start||a>=e.end||a<this.seekableStart)&&(a=this.getPrimaryResumption(e,t),this.log(lL("resumePrimary",a)),this.timelinePos=a),this.attachPrimary(a,e)),!i)return;let s=null==(n=this.schedule)?void 0:n.items;s&&(this.log("INTERSTITIALS_PRIMARY_RESUMED ".concat(lR(e))),this.hls.trigger(tz.INTERSTITIALS_PRIMARY_RESUMED,{schedule:s.slice(0),scheduleIndex:t}),this.checkBuffer())}get seekableStart(){var e;return this.primaryLive&&(null==(e=this.primaryDetails)?void 0:e.fragmentStart)||0}getPrimaryResumption(e,t,i){let r=e.start;if(this.primaryLive){if(0===t)return this.hls.startPosition;let e=this.endedItem||this.playingItem,n=null!=e&&e.event?this.livePrerollResumption(e.event,i):void 0;if(void 0!==n)return n;let a=this.primaryDetails;if(a){let{fragmentStart:e,edge:t}=a;if(r<e||r>t&&!i){let i=this.hls.liveSyncPosition;return this.log("primary resumption out of bounds (".concat(r," [").concat(e,"-").concat(t,"]) snapping to liveSync ").concat(i)),i||e}}}return this.log("primary resumption itemStart: ".concat(r)),r}getLiveStartPos(){var e;let t=this.hls.startPosition,i=this.hls.liveSyncPosition||0,r=3*((null==(e=this.primaryDetails)?void 0:e.targetduration)||10);return -1===t||i&&i-t<r?i||0:t}isAssetBuffered(e){let t=this.getAssetPlayer(e.identifier);return null!=t&&t.hls?t.hls.bufferedToEnd:nh.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,t,i){t?this.setBufferingItem(t):this.bufferingItem=this.playingItem,this.bufferingAsset=null;let r=this.primaryMedia;if(!r)return;let n=this.hls;n.media?this.checkBuffer():(this.transferMediaTo(n,r),i&&this.startLoadingPrimaryAt(e,i)),i||(this.log(lL("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,i))}startLoadingPrimaryAt(e,t){let i=this.hls,{loadingEnabled:r,bufferingEnabled:n,startPosition:a}=i,s=i.hasEnoughToStart;if(this.log("Start loading primary @".concat(e," bufferedPos: ").concat(this.bufferedPos," startPosition: ").concat(a," skip seek: ").concat(t," has enough ").concat(s," loadingEnabled: ").concat(r," bufferingEnabled: ").concat(n)),!t&&s||!r||Math.abs(a-e)>.1){let r=this.primaryDetails;if(null!=r&&r.live&&e+.5>=r.edge){let t=this.bufferingItem;this.log("Resume primary loading when live passes ".concat(e," buffering item: ").concat(t?lR(t):null)),i.pauseBuffer
3ing(),this.bufferPastEdge=!0;return}i.startLoad(e,t)}else n||i.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),null==(e=this.schedule)||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(tz.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(tz.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,t){if(-1===t.level||!this.schedule)return;let i=this.hls.levels[t.level];if(!i.details)return;let r=t7(t7({},this.mediaSelection||this.altSelection),{},{main:i});this.mediaSelection=r;let n=this.hls.startPosition;if(this.schedule.parseInterstitialDateRanges(r,this.hls.config.interstitialAppendInPlace,-1===n?0:n),this.schedule.items)if(this.effectivePlayingItem){if(this.bufferPastEdge){let e=this.primaryDetails,t=this.bufferedPos;if(null!=e&&e.live&&t+.5<e.edge){this.bufferPastEdge=!1;let i=this.bufferingItem;if(this.log("Live edge ".concat(e.edge," passed buffer: ").concat(t," buffering item: ").concat(i?lR(i):null)),(null==i?void 0:i.end)===1/0){let e=this.playingItem,r=this.isInterstitial(e)&&e.event.appendInPlace;this.hls.startLoad(Math.max(t,i.start),r)}else{let e=this.getBufferingPlayer();e&&e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime)&&e.hls&&e.hls.trigger(tz.BUFFERED_TO_END,void 0)}}}}else this.checkStart()}onAudioTrackUpdated(e,t){let i=this.hls.audioTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=t7(t7({},this.altSelection),{},{audio:i});return}let n=t7(t7({},r),{},{audio:i});this.mediaSelection=n}onSubtitleTrackUpdated(e,t){let i=this.hls.subtitleTracks[t.id],r=this.mediaSelection;if(!r){this.altSelection=t7(t7({},this.altSelection),{},{subtitles:i});return}let n=t7(t7({},r),{},{subtitles:i});this.mediaSelection=n}onAudioTrackSwitching(e,t){let i=rF(t);this.playerQueue.forEach(e=>{let{hls:r}=e;return r&&(r.setAudioOption(t)||r.setAudioOption(i))})}onSubtitleTrackSwitch(e,t){let i=rF(t);this.playerQueue.forEach(e=>{let{hls:r}=e;return r&&(r.setSubtitleOption(t)||-1!==t.id&&r.setSubtitleOption(i))})}onBufferCodecs(e,t){let i=t.tracks;i&&(this.requiredTracks=i)}onBufferAppended(e,t){this.checkBuffer()}onBufferFlushed(e,t){let i=this.playingItem;if(i&&!this.itemsMatch(i,this.bufferingItem)&&!this.isInterstitial(i)){let e=this.timelinePos;this.bufferedPos=e,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;let t=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&t){for(let e=0;e<t.length;e++){let i=t[e];if(i.cue.post){let e=this.getEventItem(i.identifier);e&&this.eventItemsMatch(e,this.bufferingItem)&&this.bufferedToItem(e,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){let t=this.playingItem;if(!this.playingLastItem&&t){let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}else this.shouldPlay=!1}updateItem(e,t){var i;let r=null==(i=this.schedule)?void 0:i.items;return e&&r&&r[this.findItemIndex(e,t)]||null}trimInPlace(e,t){if(this.isInterstitial(e)&&e.event.appendInPlace&&t.end-e.end>.25){e.event.assetList.forEach((t,i)=>{e.event.isAssetPastPlayoutLimit(i)&&this.clearAssetPlayer(t.identifier,null)});let i=e.end+.25,r=nh.bufferInfo(this.primaryMedia,i,0);(r.end>i||(r.nextStart||0)>i)&&(this.log("trim buffered interstitial ".concat(lR(e)," (was ").concat(lR(t),")")),this.attachPrimary(i,null,!0),this.flushFrontBuffer(i))}}itemsMatch(e,t){return!!t&&(e===t||e.event&&t.event&&this.eventItemsMatch(e,t)||!e.event&&!t.event&&this.findItemIndex(e)===this.findItemIndex(t))}eventItemsMatch(e,t){var i;return!!t&&(e===t||e.event.identifier===(null==(i=t.event)?void 0:i.identifier))}findEventIndex(e){return this.schedule?this.schedule.findEventIndex(e):-1}getEventItem(e){if(this.schedule){var t;let i=null==(t=this.schedule.items)?void 0:t[this.findEventIndex(e)];if(this.isInterstitial(i)&&i.event.identifier===e)return i}}findItemIndex(e,t){return e&&this.schedule?this.schedule.findItemIndex(e,t):-1}updateSchedule(){var e,t;let i=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this.mediaSelection;if(!r)return;let n=(null==(e=this.hls)?void 0:e.liveSyncPosition)||0;null==(t=this.schedule)||t.updateSchedule(r,[],n,i)}checkBuffer(e){var t;let i=null==(t=this.schedule)?void 0:t.items;if(!i)return;let r=nh.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=r.len<1),this.updateBufferedPos(r.end,i,e)}updateBufferedPos(e,t,i){let r=this.schedule,n=this.bufferingItem;if(this.bufferedPos>e||!r)return;if(1===t.length&&this.itemsMatch(t[0],n)){this.bufferedPos=e;return}let a=this.playingItem,s=this.findItemIndex(a),o=r.findItemIndexAtTime(e);
3if(this.bufferedPos<e){var l;let i=this.findItemIndex(n),r=Math.min(i+1,t.length-1),a=t[r];if((-1===o&&n&&e>=n.end||null!=(l=a.event)&&l.appendInPlace&&e+.01>=a.start)&&(o=r),this.isInterstitial(n)){let e=n.event;if(r-s>1&&!1===e.appendInPlace||0===e.assetList.length&&e.assetListLoader)return}if(this.bufferedPos=e,o>i&&o>s)this.bufferedToItem(a);else{let t=this.primaryDetails;this.primaryLive&&t&&e>t.edge-t.targetduration&&a.start<t.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(a)&&this.preloadAssets(a.event,0)}}else i&&a&&!this.itemsMatch(a,n)&&(o===s?this.bufferedToItem(a):o===s+1&&this.bufferedToItem(t[o]))}assetsBuffered(e,t){return 0!==e.event.assetList.length&&!e.event.assetList.some(e=>{let i=this.getAssetPlayer(e.identifier);return!(null!=i&&i.bufferedInPlaceToEnd(t))})}setBufferingItem(e){let t=this.bufferingItem,i=this.schedule;if(!this.itemsMatch(e,t)&&i){let{items:r,events:n}=i;if(!r||!n)return t;let a=this.isInterstitial(e),s=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));let o=s?s.remaining:t?t.end-this.timelinePos:0;if(this.log("INTERSTITIALS_BUFFERED_TO_BOUNDARY ".concat(lR(e))+(t?" (".concat(o.toFixed(2)," remaining)"):"")),!this.playbackDisabled)if(a){let t=i.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((e,i)=>{let r=this.getAssetPlayer(e.identifier);r&&(i===t&&r.loadSource(),r.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(e=>e.pauseBuffering());this.hls.trigger(tz.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:n.slice(0),schedule:r.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return t}bufferedToItem(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,t);else if(null!==i){this.bufferingAsset=null;let t=this.getPrimaryResumption(e,this.findItemIndex(e),!0),i=this.bufferedPos=Math.max(t,Math.min(this.bufferedPos,e.end),this.timelinePos,e.start),r=this.detachedData;if(r)r.mediaSource?this.attachPrimary(i,e,!0):this.startLoadingPrimaryAt(i);else{let e=this.playingItem,t=this.isInterstitial(e)&&e.event.appendInPlace;this.startLoadingPrimaryAt(i,t)}}}}bufferedToEvent(e,t){let i=e.event,r=0===i.assetList.length&&!i.assetListLoader,n=i.cue.once;if(r||!n){let e=this.preloadAssets(i,t);if(null!=e&&e.interstitial.appendInPlace){let t=this.primaryMedia;t&&this.bufferAssetPlayer(e,t)}}}preloadAssets(e,t){let i=e.assetUrl,r=e.assetList.length,n=0===r&&!e.assetListLoader,a=e.cue.once;if(n){let n,a=e.timelineStart,o=this.playingItem,l=this.getBufferingPlayer();if(e.appendInPlace){var s;this.isInterstitial(o)||(null==o||null==(s=o.nextEvent)?void 0:s.identifier)!==e.identifier||this.flushFrontBuffer(a+.25)}let d=0;if((!l||l.interstitial.cue.pre)&&this.primaryLive&&(d=this.getLiveStartPos(),l&&(d+=l.remaining)),d&&!(e.cue.pre||e.cue.post)){let e=d-a;e>0&&(n=Math.round(1e3*e)/1e3)}if(this.log("Load interstitial asset ".concat(t+1,"/").concat(i?1:r," ").concat(e).concat(d?" live-start: ".concat(d," start-offset: ").concat(n," (timeline-start: ").concat(a,")"):"")),i)return this.createAsset(e,0,0,a,e.duration,i);let u=this.assetListLoader.loadAssetList(e,n);u&&(e.assetListLoader=u)}else if(!a&&r){for(let i=t;i<r;i++){let t=e.assetList[i],r=this.getAssetPlayerQueueIndex(t.identifier);(-1===r||this.playerQueue[r].destroyed)&&!t.error&&this.createAssetPlayer(e,t,i)}let i=e.assetList[t];if(i){let e=this.getAssetPlayer(i.identifier);return e&&e.loadSource(),e}}return null}flushFrontBuffer(e){let t=this.requiredTracks;if(!t)return;let i=this.primaryDetails;i&&e>=i.edge||(this.log("Removing front buffer starting at ".concat(e)),Object.keys(t).forEach(t=>{this.hls.trigger(tz.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:t})}))}getAssetPlayerQueueIndex(e){let t=this.playerQueue;for(let i=0;i<t.length;i++)if(e===t[i].assetId)return i;return -1}getAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);return this.playerQueue[t]||null}
3getBufferingPlayer(){let{playerQueue:e,primaryMedia:t}=this;if(t){for(let i=0;i<e.length;i++)if(e[i].media===t)return e[i]}return null}createAsset(e,t,i,r,n,a){let s={parentIdentifier:e.identifier,identifier:"".concat(e.identifier,"-").concat(t+1,"-").concat(oz(a)),duration:n,startOffset:i,timelineStart:r,uri:a};return this.createAssetPlayer(e,s,t)}createAssetPlayer(e,t,i){let r=this.hls,n=r.userConfig,a=rq(r.loadLevelObj||r.levels[r.currentLevel],n.videoPreference),s=r.audioTracks[r.audioTrack],o=r.subtitleTracks[r.subtitleTrack],l=0;if(this.primaryLive||e.appendInPlace){let e=this.timelinePos-t.timelineStart;if(e>=0){let i=t.duration;i&&e<i&&(l=e)}}let d=t.identifier,u=t7(t7({},n),{},{maxMaxBufferLength:Math.min(15,r.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:r.sessionId,assetPlayerId:d,abrEwmaDefaultEstimate:r.bandwidthEstimate,interstitialsController:void 0,startPosition:l,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:a,audioPreference:s||n.audioPreference,subtitlePreference:o||n.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,t.timelineStart&&(u.timelineOffset=t.timelineStart));let h=u.cmcd;null!=h&&h.sessionId&&h.contentId&&(u.cmcd=t6({},h,{contentId:oz(t.uri)})),this.getAssetPlayer(d)&&this.warn("Duplicate date range identifier ".concat(e," and asset ").concat(d));let c=new lA(this.HlsPlayerClass,u,e,t);this.playerQueue.push(c),e.assetList[i]=t;let m=!0,f=r=>{if(r.live){let t=Error("Interstitials MUST be VOD assets ".concat(e)),r={fatal:!0,type:tY.OTHER_ERROR,details:tj.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},n=this.findEventIndex(e.identifier);this.handleAssetItemError(r,e,n,i,t.message);return}let n=r.edge-r.fragmentStart,a=t.duration;(m||null===a||n>a)&&(m=!1,this.log('Interstitial asset "'.concat(d,'" duration change ').concat(a," > ").concat(n)),t.duration=n,this.updateSchedule())};c.on(tz.LEVEL_UPDATED,(e,t)=>{let{details:i}=t;return f(i)}),c.on(tz.LEVEL_PTS_UPDATED,(e,t)=>{let{details:i}=t;return f(i)}),c.on(tz.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());let p=(e,t)=>{let i=this.getAssetPlayer(d);if(i&&t.tracks){i.off(tz.BUFFER_CODECS,p),i.tracks=t.tracks;let e=this.primaryMedia;this.bufferingAsset===i.assetItem&&e&&!i.media&&this.bufferAssetPlayer(i,e)}};c.on(tz.BUFFER_CODECS,p);let g=()=>{let t=this.getAssetPlayer(d);if(this.log("buffered to end of asset ".concat(t)),!t||!this.schedule)return;let i=this.getEventItem(e.identifier);i&&this.advanceAssetBuffering(i,t.assetItem)};c.on(tz.BUFFERED_TO_END,g);let v=t=>()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;this.shouldPlay=!0;let i=this.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,t)};return c.once(tz.MEDIA_ENDED,v(i)),c.once(tz.PLAYOUT_LIMIT_REACHED,v(1/0)),c.on(tz.ERROR,(t,r)=>{if(!this.schedule)return;let n=this.getAssetPlayer(d);if(r.details===tj.BUFFER_STALLED_ERROR)return null!=n&&n.appendInPlace?void this.handleInPlaceStall(e):(this.onTimeupdate(),void this.checkBuffer(!0));r.details!==tj.BUFFER_SEEK_OVER_HOLE&&this.handleAssetItemError(r,e,this.findEventIndex(e.identifier),i,"Asset player error ".concat(r.error," ").concat(e))}),c.on(tz.DESTROYING,()=>{if(!this.getAssetPlayer(d)||!this.schedule)return;let t=Error("Asset player destroyed unexpectedly ".concat(d)),r={fatal:!0,type:tY.OTHER_ERROR,details:tj.INTERSTITIAL_ASSET_ITEM_ERROR,error:t};this.handleAssetItemError(r,e,this.findEventIndex(e.identifier),i,t.message)}),this.log("INTERSTITIAL_ASSET_PLAYER_CREATED ".concat(l_(t))),this.hls.trigger(tz.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:t,assetListIndex:i,event:e,player:c}),c}clearInterstitial(e,t){this.clearAssetPlayers(e,t),e.reset()}clearAssetPlayers(e,t){e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,t)})}resetAssetPlayer(e){let t=this.getAssetPlayerQueueIndex(e);if(-1!==t){this.log('reset asset player "'.concat(e,'" after error'));let i=this.playerQueue[t];this.transferMediaFromPlayer(i,null),i.resetDetails()}}clearAssetPlayer(e,t){let i=this.getAssetPlayerQueueIndex(e);if(-1!==i){let e=this.playerQueue[i];this.log("clear ".concat(e," toSegment: ").concat(t?lR(t):t)),this.transferMediaFromPlayer(e,t),this.playerQueue.splice(i,1),e.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}
3startAssetPlayer(e,t,i,r,n){let{interstitial:a,assetItem:s,assetId:o}=e,l=a.assetList.length,d=this.playingAsset;this.endedAsset=null,this.playingAsset=s,(null==d?void 0:d.identifier)!==o&&(d&&(this.clearAssetPlayer(d.identifier,i[r]),delete d.error),this.log("INTERSTITIAL_ASSET_STARTED ".concat(t+1,"/").concat(l," ").concat(l_(s))),this.hls.trigger(tz.INTERSTITIAL_ASSET_STARTED,{asset:s,assetListIndex:t,event:a,schedule:i.slice(0),scheduleIndex:r,player:e})),this.bufferAssetPlayer(e,n)}bufferAssetPlayer(e,t){var i;if(!this.schedule)return;let{interstitial:r,assetItem:n}=e,a=this.getEventItem(r.identifier);if(!a)return;if(e.loadSource(),this.setBufferingItem(a),this.bufferingAsset=n,e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime))return void this.advanceAssetBuffering(a,n);let s=this.getBufferingPlayer();if(s===e)return;let o=r.appendInPlace;if(o&&(null==s?void 0:s.interstitial.appendInPlace)===!1)return;let l=(null==s?void 0:s.tracks)||(null==(i=this.detachedData)?void 0:i.tracks)||this.requiredTracks;if(o&&n!==this.playingAsset){if(!e.tracks)return void this.log("Waiting for track info before buffering ".concat(e));if(l&&!iT(l,e.tracks)){let t=Error("Asset ".concat(l_(n)," SourceBuffer tracks ('").concat(Object.keys(e.tracks),"') are not compatible with primary content tracks ('").concat(Object.keys(l),"')")),i={fatal:!0,type:tY.OTHER_ERROR,details:tj.INTERSTITIAL_ASSET_ITEM_ERROR,error:t},a=r.findAssetIndex(n);this.handleAssetItemError(i,r,this.findEventIndex(r.identifier),a,t.message);return}}this.transferMediaTo(e,t)}handleInPlaceStall(e){let t=this.schedule,i=this.primaryMedia;if(!t||!i)return;let r=i.currentTime,n=t.findAssetIndex(e,r),a=e.assetList[n];if(a){let s=this.getAssetPlayer(a.identifier);if(s){let o=s.currentTime||r-a.timelineStart,l=s.duration-o;if(this.warn("Stalled at ".concat(o," of ").concat(o+l," in ").concat(s," ").concat(e," (media.currentTime: ").concat(r,")")),o&&(l/i.playbackRate<.5||s.bufferedInPlaceToEnd(i,s.currentTime))&&s.hls){let i=t.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,i,n)}}}}advanceInPlace(e){let t=this.primaryMedia;if(t&&t.currentTime<e){let i="advance currentTime to ".concat(e,", duration: ").concat(t.duration);t.duration>e?(this.log(i),t.currentTime=e):this.log("Cannot ".concat(i))}}handleAssetItemError(e,t,i,r,n){if(e.details===tj.BUFFER_STALLED_ERROR)return;let a=t.assetList[r]||null;if(this.warn("INTERSTITIAL_ASSET_ERROR ".concat(a?l_(a):a," ").concat(e.error)),!this.schedule)return;let s=(null==a?void 0:a.identifier)||"",o=this.getAssetPlayerQueueIndex(s),l=this.playerQueue[o]||null,d=this.schedule.items,u=t6({},e,{fatal:!1,errorAction:r1(!0),asset:a,assetListIndex:r,event:t,schedule:d,scheduleIndex:i,player:l});if(this.hls.trigger(tz.INTERSTITIAL_ASSET_ERROR,u),!e.fatal)return;let h=this.playingAsset,c=this.bufferingAsset,m=Error(n);if(a&&(this.clearAssetPlayer(s,null),a.error=m),t.assetList.some(e=>!e.error))for(let e=r;e<t.assetList.length;e++)this.resetAssetPlayer(t.assetList[e].identifier);else t.error=m;this.updateSchedule(!0),t.error?this.primaryFallback(t):(null==h?void 0:h.identifier)===s?this.advanceAfterAssetEnded(t,i,r):(null==c?void 0:c.identifier)===s&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,c)}primaryFallback(e){let t=e.timelineStart,i=this.effectivePlayingItem,r=this.playingItem,n=this.seekableStart,a=this.hls.startPosition,s=this.timelinePos;if(this.isInterstitial(i)){this.log('Fallback to primary from event "'.concat(e.identifier,'" start: ').concat(t," pos: ").concat(s," playing: ").concat(lR(i)," startPosition: ").concat(a," seekableStart: ").concat(n," error: ").concat(e.error)),-1===s&&(s=a),s=Math.max(s,n);let r=this.updateItem(i,s);this.itemsMatch(i,r)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(t,null),this.flushFrontBuffer(t))}else if(-1===s)return void this.checkStart();if(!this.schedule||!this.isInterstitial(r))return;let o=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(o)}onAssetListLoaded(e,t){var i,r;let n=t.event,a=n.identifier,s=t.assetListResponse.ASSETS;if(!(null!=(i=this.schedule)&&i.hasEvent(a)))return;let o=n.timelineStart,l=n.duration,d=0;
3s.forEach((e,t)=>{let i=parseFloat(e.DURATION);this.createAsset(n,t,d,o+d,i,e.URI),d+=i}),n.duration=d,this.log("Loaded asset-list with duration: ".concat(d," (was: ").concat(l,") ").concat(n));let u=this.waitingItem,h=(null==u?void 0:u.event.identifier)===a;this.updateSchedule();let c=null==(r=this.bufferingItem)?void 0:r.event;if(h){let e=this.findEventIndex(a),t=this.getEventItem(a);if(t){if(!this.playingItem&&this.timelinePos>t.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==e){n.error=Error("Interstitial ".concat(s.length?"no longer within playback range":"asset-list is empty"," ").concat(this.timelinePos," ").concat(n)),this.log(n.error.message),this.updateSchedule(!0),this.primaryFallback(n);return}this.setBufferingItem(t)}this.setSchedulePosition(e)}else if((null==c?void 0:c.identifier)===a){let e=n.assetList[0];if(e){let t=this.getAssetPlayer(e.identifier);if(c.appendInPlace){let e=this.primaryMedia;t&&e&&this.bufferAssetPlayer(t,e)}else t&&t.loadSource()}}}onError(e,t){if(this.schedule)switch(t.details){case tj.ASSET_LIST_PARSING_ERROR:case tj.ASSET_LIST_LOAD_ERROR:case tj.ASSET_LIST_LOAD_TIMEOUT:{let e=t.interstitial;e&&(this.updateSchedule(!0),this.primaryFallback(e));break}case tj.BUFFER_STALLED_ERROR:{let e=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(e)&&e.event.appendInPlace)return void this.handleInPlaceStall(e.event);let t=this.primaryMedia;this.log("Primary player stall @".concat(this.timelinePos," currentTime: ").concat(null==t?void 0:t.currentTime," bufferedPos: ").concat(this.bufferedPos)),this.onTimeupdate(),this.checkBuffer(!0)}}}constructor(e,t){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.bufferPastEdge=!1,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{var e,t;let i=this.currentTime;if(void 0===i||this.playbackDisabled||!this.schedule)return;let r=i-this.timelinePos;if(Math.abs(r)<1/7056e5)return;let n=r<=-.01;-1!==this.timelinePos||this.effectivePlayingItem||this.checkStart(),this.timelinePos=i,this.bufferedPos=i;let a=this.playingItem;if(!a)return void this.checkBuffer();if(n&&this.schedule.resetErrorsInRange(i,i-r)&&this.updateSchedule(!0),this.checkBuffer(),n&&i<a.start||i>=a.end){let t=this.findItemIndex(a),r=this.schedule.findItemIndexAtTime(i);if(-1===r&&(r=t+(n?-1:1),this.log("seeked ".concat(n?"back ":"","to position not covered by schedule ").concat(i," (resolving from ").concat(t," to ").concat(r,")"))),!this.isInterstitial(a)&&null!=(e=this.media)&&e.paused&&(this.shouldPlay=!1),!n&&r>t){let e=this.schedule.findJumpRestrictedIndex(t+1,r);if(e>t)return void this.setSchedulePosition(e)}this.setSchedulePosition(r);return}let s=this.playingAsset;if(!s){if(this.playingLastItem&&this.isInterstitial(a)){let e=a.event.assetList[0];e&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(i,e))}return}let o=s.timelineStart,l=s.duration||0;(n&&i<o||i>=o+l)&&(null!=(t=a.event)&&t.appendInPlace&&(this.clearAssetPlayers(a.event,a),this.flushFrontBuffer(i)),this.setScheduleToAssetAtTime(i,s))},this.onTimeupdate=()=>{let e=this.currentTime;if(void 0===e||this.playbackDisabled||(-1!==this.timelinePos||this.effectivePlayingItem||this.checkStart(),!(e>this.timelinePos)))return;this.timelinePos=e,e>this.bufferedPos&&this.checkBuffer();let t=this.playingItem;if(!t||this.playingLastItem)return;if(e>=t.end){this.timelinePos=t.end;let e=this.findItemIndex(t);this.setSchedulePosition(e+1)}let i=this.playingAsset;i&&e>=i.timelineStart+(i.duration||0)&&this.setScheduleToAssetAtTime(e,i)},this.onScheduleUpdate=(e,t)=>{let i=this.schedule;if(!i)return;let r=this.playingItem,n=i.events||[],a=i.items||[],s=i.durations,o=e.map(e=>e.identifier),l=!!(n.length||o.length);(l||t)&&this.log("INTERSTITIALS_UPDATED (".concat(n.length,"): ").concat(n,"\nSchedule: ").concat(a.map(e=>lR(e))," pos: ").concat(this.timelinePos)),o.length&&this.log("Removed events ".concat(o));let d=null,u=null;r&&(d=this.updateItem(r,this.timelinePos),this.itemsMatch(r,d)?this.playingItem=d:this.waitingItem=null),this.waitingItem=this.updateItem(this.waitingItem);let h=this.bufferingItem;if(h&&(u=this.updateItem(h,this.bufferedPos),this.itemsMatch(h,u)?this.bufferingItem=u:h.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(h.event,null))),e.forEach(e
3=>{e.assetList.forEach(e=>{this.clearAssetPlayer(e.identifier,null)})}),this.playerQueue.forEach(e=>{if(e.interstitial.appendInPlace){let t=e.assetItem.timelineStart,i=e.timelineOffset-t;if(i)try{e.timelineOffset=t}catch(r){Math.abs(i)>.025&&this.warn("".concat(r,' ("').concat(e.assetId,'" ').concat(e.timelineOffset,"->").concat(t,")"))}}}),l||t){if(this.hls.trigger(tz.INTERSTITIALS_UPDATED,{events:n.slice(0),schedule:a.slice(0),durations:s,removedIds:o}),this.isInterstitial(r)&&o.indexOf(r.event.identifier)>-1){this.warn('Interstitial "'.concat(r.event.identifier,'" removed while playing')),this.primaryFallback(r.event);return}r&&this.trimInPlace(d,r),h&&u!==d&&this.trimInPlace(u,h),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=t,this.assetListLoader=new lk(e),this.schedule=new lS(this.onScheduleUpdate,e.logger),this.registerListeners()}}});class l4 extends sv{_registerListeners(){let{hls:e}=this;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.on(tz.ERROR,this.onError,this)}_unregisterListeners(){let{hls:e}=this;e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(tz.LEVEL_LOADED,this.onLevelLoaded,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(tz.FRAG_BUFFERED,this.onFragBuffered,this),e.off(tz.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(e=>{e.loadError=0,e.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1,this._iframeVariants=[]}onManifestLoading(e,t){this.resetLevels()}onManifestLoaded(e,t){let i=this.hls.config.preferManagedMediaSource,r=[],n={},a={},s=!1,o=!1,l=!1,d=!1;t.levels.forEach(e=>{let t=e.attrs,u=l6(e,i),{audioCodec:h,videoCodec:c,imageCodec:m,width:f,height:p}=e;if(!u)return void this.log('Some or all CODECS not supported "'.concat(t.CODECS,'"'));s||(s=!!(f&&p)),o||(o=!!c),l||(l=!!h),d||(d=!!m);let{CODECS:g,"FRAME-RATE":v,"HDCP-LEVEL":E,"PATHWAY-ID":y,RESOLUTION:b,"VIDEO-RANGE":T}=t,A="".concat("".concat(y||".","-")).concat(e.bitrate,"-").concat(b,"-").concat(v,"-").concat(g,"-").concat(T,"-").concat(E);if(n[A])if(n[A].uri===e.url||e.attrs["PATHWAY-ID"])e.iframes||(n[A].addGroupId("audio",t.AUDIO),n[A].addGroupId("text",t.SUBTITLES));else{let t=a[A]+=1;e.attrs["PATHWAY-ID"]=Array(t+1).join(".");let i=this.createLevel(e);n[A]=i,r.push(i)}else{let t=this.createLevel(e);n[A]=t,a[A]=1,r.push(t)}}),this.filterAndSortMediaOptions(r,t,s,o,l,d)}createLevel(e){let t=new rP(e),i=e.supplemental;if(null!=i&&i.videoCodec&&!l8(i.videoCodec,this.hls.config.preferManagedMediaSource)){let e=Error('SUPPLEMENTAL-CODECS not supported "'.concat(i.videoCodec,'"'));this.log(e.message),t.supportedResult=rA(e,[])}return t}filterAndSortMediaOptions(e,t,i,r,n,a){var s,o;let l=[],d=[],u=e,h=(null==(s=t.stats)?void 0:s.parsing)||{},c=this.hls.config.preferManagedMediaSource;if((i||r)&&n&&(u=u.filter(e=>{var t;let{videoCodec:i,videoRange:r,width:n,height:a}=e;return(!!i||!!(n&&a))&&!!(t=r)&&rD.indexOf(t)>-1})),r&&a&&(u=u.filter(e=>!e.imageCodec)),0===u.length){Promise.resolve().then(()=>{if(this.hls){let e="no level with compatible codecs found in manifest",i=e;t.levels.length&&(i="one or more CODECS in variant not supported: ".concat(rx(t.levels.map(e=>e.attrs.CODECS).filter((e,t,i)=>i.indexOf(e)===t))),this.warn(i),e+=" (".concat(i,")"));let r=Error(e);this.hls.trigger(tz.ERROR,{type:tY.MEDIA_ERROR,details:tj.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:t.url,error:r,reason:i})}}),h.end=performance.now();return}t.audioTracks&&l9(l=t.audioTracks.filter(e=>!e.audioCodec||l5(e.audioCodec,c))),t.subtitles&&l9(d=t.subtitles);let m=u.slice(0);u.sort((e,t)=>{if(e.attrs["HDCP-LEVEL"]!==t.attrs["HDCP-LEVEL"])return(e.attrs["HDCP-LEVEL"]||"")>(t.attrs["HDCP-LEVEL"]||"")?1:-1;if(i&&e.height!==t.height)return e.height-t.height;if(e.frameRate!==t.frameRate)return e.frameRate-t.frameRate;if(e.videoRange!==t.videoRange)return rD.indexOf(e.videoRange)-rD.indexOf(t.videoRange);
3if(e.videoCodec!==t.videoCodec){let i=rc(e.videoCodec),r=rc(t.videoCodec);if(i!==r)return r-i}if(e.uri===t.uri&&e.codecSet!==t.codecSet){let i=rm(e.codecSet),r=rm(t.codecSet);if(i!==r)return r-i}return e.averageBitrate!==t.averageBitrate?e.averageBitrate-t.averageBitrate:0});let f=m[0];if(this.steering&&(u=this.steering.filterParsedLevels(u)).length!==m.length){for(let e=0;e<m.length;e++)if(m[e].pathwayId===u[0].pathwayId){f=m[e];break}}this._levels=u;for(let e=0;e<u.length;e++)if(u[e]===f){this._firstLevel=e;let t=f.bitrate,i=this.hls.bandwidthEstimate;if(this.log("manifest loaded, ".concat(u.length," level(s) found, first bitrate: ").concat(t)),(null==(o=this.hls.userConfig)?void 0:o.abrEwmaDefaultEstimate)===void 0){let e=Math.min(t,this.hls.config.abrEwmaDefaultEstimateMax);e>i&&i===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=e)}break}let p=t.iframeVariants.filter(e=>l6(e,c));this._iframeVariants=p;let g=n&&!r,v=this.hls.config,E=!!(v.audioStreamController&&v.audioTrackController),y={levels:u,audioTracks:l,subtitleTracks:d,iframeVariants:p,sessionData:t.sessionData,sessionKeys:t.sessionKeys,firstLevel:this._firstLevel,stats:t.stats,audio:n,video:r,altAudio:E&&!g&&l.some(e=>!!e.url)};h.end=performance.now(),this.hls.trigger(tz.MANIFEST_PARSED,y)}get iframeVariants(){return 0===this._iframeVariants.length?null:this._iframeVariants}get levels(){return 0===this._levels.length?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){let t=this._levels;if(0===t.length)return;if(e<0||e>=t.length){let i=Error("invalid level idx"),r=e<0;if(this.hls.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.LEVEL_SWITCH_ERROR,level:e,fatal:r,error:i,reason:i.message}),r)return;e=Math.min(e,t.length-1)}let i=this.currentLevelIndex,r=this.currentLevel,n=r?r.attrs["PATHWAY-ID"]:void 0,a=t[e],s=a.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=a,i===e&&r&&n===s)return;this.log("Switching to level ".concat(e," (").concat(a.height?a.height+"p ":"").concat(a.videoRange?a.videoRange+" ":"").concat(a.codecSet?a.codecSet+" ":"","@").concat(a.bitrate,")").concat(s?" with Pathway "+s:""," from level ").concat(i).concat(n?" with Pathway "+n:""));let o={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(tz.LEVEL_SWITCHING,o);let l=a.details;if(!l||l.live){let e=this.switchParams(a.uri,null==r?void 0:r.details,l);this.loadPlaylist(e)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(void 0===this._startLevel){let e=this.hls.config.startLevel;return void 0!==e?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){let t=this.steering.pathways(),i=e.filter(e=>-1!==t.indexOf(e));if(e.length<1)return void this.warn("pathwayPriority ".concat(e," should contain at least one pathway from list: ").concat(t));this.steering.pathwayPriority=i}}onError(e,t){!t.fatal&&t.context&&t.context.type===tJ.LEVEL&&t.context.level===this.level&&this.checkRetry(t)}onFragBuffered(e,t){let{frag:i}=t;if(i.type===t$.MAIN){let e=i.elementaryStreams;if(!Object.keys(e).some(t=>!!e[t]))return;let t=this._levels[i.level];null!=t&&t.loadError&&(this.log("Resetting level error count of ".concat(t.loadError," on frag buffered")),t.loadError=0)}}onLevelLoaded(e,t){var i,r;let{level:n,details:a}=t,s=t.levelInfo;if(!s){this.warn("Invalid level index ".concat(n)),null!=(r=t.deliveryDirectives)&&r.skip&&(a.deltaUpdateFailed=!0);return}if(s===this.currentLevel||t.withoutMultiVariant){0===s.fragmentError&&(s.loadError=0);let e=s.details;e===t.details&&e.advanced&&(e=void 0),this.playlistLoaded(n,t,e)}else null!=(i=t.deliveryDirectives)&&i.skip&&(a.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLo
3ading(this.currentLevel,e)}loadingPlaylist(e,t){super.loadingPlaylist(e,t);let i=this.getUrlWithDirectives(e.uri,t),r=this.currentLevelIndex,n=e.attrs["PATHWAY-ID"],a=e.details,s=null==a?void 0:a.age;this.log("Loading level index ".concat(r).concat((null==t?void 0:t.msn)!==void 0?" at sn "+t.msn+" part "+t.part:"").concat(n?" Pathway "+n:"").concat(s&&a.live?" age "+s.toFixed(1)+(a.type?" "+a.type:""):""," ").concat(i)),this.hls.trigger(tz.LEVEL_LOADING,{url:i,level:r,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}get nextLoadLevel(){return -1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){let t=this.currentLevelIndex;if(-1===this.manualLevelIndex&&e!==t&&-1!==e){let i=this.hls.config.abrSwitchInterval;if(i>0){let r=performance.now(),n=r-this.lastABRSwitchTime,a=1e3*i;if(this.lastABRSwitchTime>-1&&n<a)return void this.warn("Preventing ABR level switch: ".concat(t," -> ").concat(e," (").concat(Math.round(n),"ms < ").concat(a,"ms / ").concat(i,"s)"));this.lastABRSwitchTime=r,this.log("Allowing ABR level switch: ".concat(t," -> ").concat(e," (").concat(Math.round(n),"ms >= ").concat(a,"ms / ").concat(i,"s)"))}}this.level=e,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=e)}removeLevel(e){var t;if(1===this._levels.length)return;let i=this._levels.filter((t,i)=>i!==e||(this.steering&&this.steering.removeLevel(t),t===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,t.details&&t.details.fragments.forEach(e=>e.level=-1)),!1));ae(i),this._levels=i,this.currentLevelIndex>-1&&null!=(t=this.currentLevel)&&t.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);let r=i.length-1;this._firstLevel=Math.min(this._firstLevel,r),this._startLevel&&(this._startLevel=Math.min(this._startLevel,r)),this.hls.trigger(tz.LEVELS_UPDATED,{levels:i})}onLevelsUpdated(e,t){let{levels:i}=t;this._levels=i}checkMaxAutoUpdated(){let{autoLevelCapping:e,maxAutoLevel:t,maxHdcpLevel:i}=this.hls;this._maxAutoLevel!==t&&(this._maxAutoLevel=t,this.hls.trigger(tz.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:t,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:i}))}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.lastABRSwitchTime=-1,this._iframeVariants=[],this.onParsedComplete=void 0,this.steering=t,this._registerListeners()}}function l5(e,t){return rd(e,"audio",t)}function l8(e,t){return rd(e,"video",t)}function l6(e,t){let{audioCodec:i,videoCodec:r}=e;i&&(e.audioCodec=i=rg(i,t)||void 0),r&&(r=e.videoCodec=function(e){let t=e.split(",");for(let e=0;e<t.length;e++){let i=t[e].split(".");i.length>2&&"avc1"===i[0]&&(t[e]="avc1.".concat(parseInt(i[1]).toString(16)).concat(("000"+parseInt(i[2]).toString(16)).slice(-4)))}return t.join(",")}(r));let{unknownCodecs:n}=e;return(null==n||!n.length)&&(!i||!!l5(i,t))&&(!r||!!l8(r,t))}function l9(e){let t={};e.forEach(e=>{let i=e.groupId||"";e.id=t[i]=t[i]||0,t[i]++})}class l7 extends im{abort(e){for(let i in this.keyLoaderInfo){let r=this.keyLoaderInfo[i].loader;if(r){var t;if(e&&e!==(null==(t=r.context)?void 0:t.frag.type))return;r.abort()}}}destroy(){for(let e in this.keyLoaderInfo){let t=this.keyLoaderInfo[e].loader;t&&t.destroy()}this.emeController=null,this.keyLoaderInfo={}}loadClear(e,t,i){return this.emeController?this.emeController.loadClear(e,t,i):null}load(e,t){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(i=>this.loadInternal(e,t,i)):this.loadInternal(e,t)}loadInternal(e,t,i){i&&e.setKeyFormat(i);let r=e.decryptdata;if(!r){let t=Error(i?"Expected frag.decryptdata to be defined after setting format ".concat(i):"Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ".concat(this.emeController&&this.config.emeEnabled,")"));return Promise.reject(de(e,tj.KEY_LOAD_ERROR,t))}switch(r.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":if("identity"===r.keyFormat)return this.loadKeyHTTP(e);return t?t.then(()=>this.loadKeyEME(e)):this.loadKeyEME(e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(e);default:return Promise.reject(de(e,tj.KEY_LOAD_ERROR,Error('Key supplied with unsupported METHOD: "'.concat(r.method,'"'))))}}loadKeyEME(e){if(this.emeController&&this.config.emeEnabled){var t;if(!e.decryptdata.keyId&&null!=(t=e.initSegment)&&t.data){let t=function(e){let t=[];return i3(e,e=>t.push(e.subarray(8,24))),t}(e.initSegment.data);if(t.length){let i=t[0],r=e.decryptdata.uri;if(i.some(e=>0!==e))this.log("Using keyId found in init segment ".concat(iN(i)," keyUri: ").concat(r)),nF.setKeyIdForUri(r,i);else{let e=nF.addKeyIdForUri(r);this.log("Patching empty keyId with ".concat(iN(e)," keyUri: ").concat(r)),i=e}e.decryptdata.keyId=i}}return this.emeController.loadKey(e).then(()=>({frag:e,keyInfo:{decryptdata:e.decryptdata}}))}return Promise.reject(de(e,tj.KEY_LOAD_ERROR,Error("emeEnabled with controller: ".concat(this.emeController&&this.config.emeEnabled,")"))))}loadKeyHTTP(e){let t=e.decryptdata,i=t.uri;if(!i)return Promise.reject(de(e,tj.KEY_LOAD_ERROR,Error('Invalid key URI: "'.concat(i,'"'))));let r=this.keyLoaderInfo[i];if(r){if(r.decryptdata.key)return t.key=r.decryptdata.key,r.keyLoadPromise=null,Promise.resolve({frag:e,keyInfo:r});if(r.keyLoadPromise)return r.keyLoadPromise.then(i=>(t.key=r.decryptdata.key,t7(t7({},i),{},{frag:e})))}this.log("Loading".concat(t.keyId?" keyId: "+iN(t.keyId):""," URI: ").concat(t.uri," from ").concat(e.type," ").concat(e.level));let n=this.config,a=new n.loader(n);e.keyLoader=a;let s=this.keyLoaderInfo[i]={decryptdata:t,keyLoadPromise:null,loader:a};return s.keyLoadPromise=new Promise((t,r)=>{let o={type:tJ.KEY,keyInfo:s,frag:e,responseType:"arraybuffer",url:i},l=n.keyLoadPolicy.default,d={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0};a.load(o,d,{onSuccess:(e,i,n,a)=>{let{frag:s,keyInfo:o,url:l}=n;if(!s.decryptdata||o!==this.keyLoaderInfo[l])return r(de(s,tj.KEY_LOAD_ERROR,Error("after key load, decryptdata unset or changed"),a));o.decryptdata.key=s.decryptdata.key=new Uint8Array(e.data),s.keyLoader=o.loader=o.keyLoadPromise=null,t({frag:s,keyInfo:o})},onError:(t,n,a,s)=>{this.resetLoader(n),r(de(e,tj.KEY_LOAD_ERROR,Error("HTTP Error ".concat(t.code," loading key ").concat(t.text)),a,t7({url:i,data:void 0},t)))},onTimeout:(t,i,n)=>{this.resetLoader(i),r(de(e,tj.KEY_LOAD_TIMEOUT,Error("key loading timed out"),n))},onAbort:(t,i,n)=>{this.resetLoader(i),r(de(e,tj.INTERNAL_ABORTED,Error("key loading aborted"),n))}})})}
3resetLoader(e){let{frag:t,keyInfo:i,url:r}=e,n=i.loader;t.keyLoader===n&&(t.keyLoader=i.loader=i.keyLoadPromise=null),delete this.keyLoaderInfo[r],n&&n.destroy()}constructor(e,t){super("key-loader",t),this.config=void 0,this.keyLoaderInfo={},this.emeController=null,this.config=e}}function de(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tj.KEY_LOAD_ERROR,i=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;return new ns({type:tY.NETWORK_ERROR,details:t,fatal:!1,frag:e,response:n,error:i,networkDetails:r||null})}function dt(e){let{type:t}=e;switch(t){case tJ.AUDIO_TRACK:return t$.AUDIO;case tJ.SUBTITLE_TRACK:return t$.SUBTITLE;default:return t$.MAIN}}function di(e,t){let i=e.url;return(void 0===i||0===i.indexOf("data:"))&&(i=t.url),i}class dr{startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){let{hls:e}=this;e.on(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.on(tz.LEVEL_LOADING,this.onLevelLoading,this),e.on(tz.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(tz.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(tz.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){let{hls:e}=this;e.off(tz.MANIFEST_LOADING,this.onManifestLoading,this),e.off(tz.LEVEL_LOADING,this.onLevelLoading,this),e.off(tz.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(tz.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(tz.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){let t=this.hls.config,i=t.pLoader,r=t.loader,n=new(i||r)(t);return this.loaders[e.type]=n,n}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(let e in this.loaders){let t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,t){let{url:i}=t;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:tJ.MANIFEST,url:i,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,t){let{id:i,level:r,pathwayId:n,url:a,deliveryDirectives:s,levelInfo:o}=t;this.load({id:i,level:r,pathwayId:n,responseType:"text",type:tJ.LEVEL,url:a,deliveryDirectives:s,levelOrTrack:o})}onAudioTrackLoading(e,t){let{id:i,groupId:r,url:n,deliveryDirectives:a,track:s}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:tJ.AUDIO_TRACK,url:n,deliveryDirectives:a,levelOrTrack:s})}onSubtitleTrackLoading(e,t){let{id:i,groupId:r,url:n,deliveryDirectives:a,track:s}=t;this.load({id:i,groupId:r,level:null,responseType:"text",type:tJ.SUBTITLE_TRACK,url:n,deliveryDirectives:a,levelOrTrack:s})}onLevelsUpdated(e,t){let i=this.loaders[tJ.LEVEL];if(i){let e=i.context;e&&!t.levels.some(t=>t===e.levelOrTrack)&&(i.abort(),delete this.loaders[tJ.LEVEL])}}load(e){var t;let i,r=this.hls.config,n=this.getInternalLoader(e);if(n){let t=this.hls.logger,i=n.context;if((null==i?void 0:i.levelOrTrack)===e.levelOrTrack&&(i.url===e.url||i.deliveryDirectives&&!e.deliveryDirectives))return void(i.url===e.url?t.log("[playlist-loader]: ignore ".concat(e.url," ongoing request")):t.log("[playlist-loader]: ignore ".concat(e.url," in favor of ").concat(i.url)));t.log("[playlist-loader]: aborting previous loader for type: ".concat(e.type)),n.abort()}if(i=e.type===tJ.MANIFEST?r.manifestLoadPolicy.default:t6({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),n=this.createInternalLoader(e),tW(null==(t=e.deliveryDirectives)?void 0:t.part)){let t;if(e.type===tJ.LEVEL&&null!==e.level?t=this.hls.levels[e.level].details:e.type===tJ.AUDIO_TRACK&&null!==e.id?t=this.hls.audioTracks[e.id].details:e.type===tJ.SUBTITLE_TRACK&&null!==e.id&&(t=this.hls.subtitleTracks[e.id].details),t){let e=t.partTarget,r=t.targetduration;if(e&&r){let t=1e3*Math.max(3*e,.8*r);i=t6({},i,{maxTimeToFirstByteMs:Math.min(t,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(t,i.maxTimeToFirstByteMs)})}}}let a=i.errorRetry||i.timeoutRetry||{},s={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0};n.load(e,s,{onSuccess:(e,t,i,r)=>{let n=this.getInternalLoader(i);this.resetInternalLoader(i.type);let a=e.data;t.parsing.start=performance.now(),nq.isMediaPlaylist(a)||i.type!==tJ.MANIFEST?this.handleTrackOrLevelPlaylist(e,t,i,r||null,n):this.handleMasterPlaylist(e,t,i,r)},onError:(e,t,i,r)=>{this.handleNetworkError(t,i,!1,e,r)},onTimeout:(e,t,i)=>{this.handleNetworkError(t,i,!0,void 0,e)}})}
3checkAutostartLoad(){if(!this.hls)return;let{config:{autoStartLoad:e,startPosition:t},forceStartLoad:i}=this.hls;(e||i)&&(this.hls.logger.log("".concat(e?"auto":"force"," startLoad with configured startPosition ").concat(t)),this.hls.startLoad(t))}handleMasterPlaylist(e,t,i,r){let n=this.hls,a=e.data,s=di(e,i),o=nq.parseMasterPlaylist(a,s);if(o.playlistParsingError){t.parsing.end=performance.now(),this.handleManifestParsingError(e,i,o.playlistParsingError,r,t);return}let{contentSteering:l,levels:d,iframeVariants:u,sessionData:h,sessionKeys:c,startTimeOffset:m,variableList:f}=o;this.variableList=f,d.forEach(e=>{let{unknownCodecs:t}=e;if(t){let{preferManagedMediaSource:i}=this.hls.config,{audioCodec:r,videoCodec:n}=e;for(let a=t.length;a--;){let s=t[a];rd(s,"audio",i)?(e.audioCodec=r=r?"".concat(r,",").concat(s):s,ro.audio[r.substring(0,4)]=2,t.splice(a,1)):rd(s,"video",i)&&(e.videoCodec=n=n?"".concat(n,",").concat(s):s,ro.video[n.substring(0,4)]=2,t.splice(a,1))}}});let{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=nq.parseMasterPlaylistMedia(a,s,o);p.length&&(p.some(e=>!e.url)||!d[0].audioCodec||d[0].attrs.AUDIO||(this.hls.logger.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 nE({}),bitrate:0,url:""}))),n.trigger(tz.MANIFEST_LOADED,{levels:d,audioTracks:p,subtitles:g,iframeVariants:u,captions:v,contentSteering:l,url:s,stats:t,networkDetails:r,sessionData:h,sessionKeys:c,startTimeOffset:m,variableList:f})}handleTrackOrLevelPlaylist(e,t,i,r,n){let a=this.hls,{id:s,level:o,type:l}=i,d=di(e,i),u=tW(o)?o:tW(s)?s:0,h=dt(i),c=nq.parseLevelPlaylist(e.data,d,u,h,0,this.variableList);if(l===tJ.MANIFEST){let e={attrs:new nE({}),bitrate:0,details:c,name:"",url:d};c.requestScheduled=t.loading.start+n8(c,0),a.trigger(tz.MANIFEST_LOADED,{levels:[e],audioTracks:[],iframeVariants:[],url:d,stats:t,networkDetails:r,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}t.parsing.end=performance.now(),i.levelDetails=c,this.handlePlaylistLoaded(c,e,t,i,r,n)}handleManifestParsingError(e,t,i,r,n){this.hls.trigger(tz.ERROR,{type:tY.NETWORK_ERROR,details:tj.MANIFEST_PARSING_ERROR,fatal:t.type===tJ.MANIFEST,url:e.url,err:i,error:i,reason:i.message,response:e,context:t,networkDetails:r,stats:n})}handleNetworkError(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0,a="A network ".concat(i?"timeout":"error"+(r?" (status "+r.code+")":"")," occurred while loading ").concat(e.type);e.type===tJ.LEVEL?a+=": ".concat(e.level," id: ").concat(e.id):(e.type===tJ.AUDIO_TRACK||e.type===tJ.SUBTITLE_TRACK)&&(a+=" id: ".concat(e.id,' group-id: "').concat(e.groupId,'"'));let s=Error(a);this.hls.logger.warn("[playlist-loader]: ".concat(a));let o=tj.UNKNOWN,l=!1,d=this.getInternalLoader(e);switch(e.type){case tJ.MANIFEST:o=i?tj.MANIFEST_LOAD_TIMEOUT:tj.MANIFEST_LOAD_ERROR,l=!0;break;case tJ.LEVEL:o=i?tj.LEVEL_LOAD_TIMEOUT:tj.LEVEL_LOAD_ERROR,l=!1;break;case tJ.AUDIO_TRACK:o=i?tj.AUDIO_TRACK_LOAD_TIMEOUT:tj.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case tJ.SUBTITLE_TRACK:o=i?tj.SUBTITLE_TRACK_LOAD_TIMEOUT:tj.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(e.type);let u={type:tY.NETWORK_ERROR,details:o,fatal:l,url:e.url,loader:d,context:e,error:s,networkDetails:t,stats:n};if(r){let i=e.url;t&&"url"in t&&(i=t.url),u.response=t7({url:i,data:void 0},r)}this.hls.trigger(tz.ERROR,u)}handlePlaylistLoaded(e,t,i,r,n,a){let s=this.hls,{type:o,level:l,levelOrTrack:d,id:u,groupId:h,deliveryDirectives:c}=r,m=di(t,r),f=dt(r),p="number"==typeof r.level&&f===t$.MAIN?l:void 0;d&&"iframes"in d&&d.iframes&&!e.iframesOnly&&(e.playlistParsingError=Error("EXT-X-I-FRAME-STREAM-INF media playlist MUST contain an EXT-X-I-FRAMES-ONLY tag"),e.iframesOnly=!0);let g=e.playlistParsingError;if(g){if(this.hls.logger.warn("".concat(g," ").concat(e.url)),!s.config.ignorePlaylistParsingErrors)return void s.trigger(tz.ERROR,{type:tY.NETWORK_E
3RROR,details:tj.LEVEL_PARSING_ERROR,fatal:!1,url:m,error:g,reason:g.message,response:t,context:r,level:p,parent:f,networkDetails:n,stats:i});e.playlistParsingError=null}if(!e.fragments.length){let a=e.playlistParsingError=Error("No Segments found in Playlist");s.trigger(tz.ERROR,{type:tY.NETWORK_ERROR,details:tj.LEVEL_EMPTY_ERROR,fatal:!1,url:m,error:a,reason:a.message,response:t,context:r,level:p,parent:f,networkDetails:n,stats:i});return}switch(e.live&&a&&(a.getCacheAge&&(e.ageHeader=a.getCacheAge()||0),(!a.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),o){case tJ.MANIFEST:case tJ.LEVEL:if(p)if(d){if(d!==s.levels[p]){let e=s.levels.indexOf(d);e>-1&&(p=e)}}else p=0;s.trigger(tz.LEVEL_LOADED,{details:e,levelInfo:d||s.levels[0],level:p||0,id:u||0,stats:i,networkDetails:n,deliveryDirectives:c,withoutMultiVariant:o===tJ.MANIFEST,context:r});break;case tJ.AUDIO_TRACK:s.trigger(tz.AUDIO_TRACK_LOADED,{details:e,track:d,id:u||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:c,context:r});break;case tJ.SUBTITLE_TRACK:s.trigger(tz.SUBTITLE_TRACK_LOADED,{details:e,track:d,id:u||0,groupId:h||"",stats:i,networkDetails:n,deliveryDirectives:c,context:r})}}constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}}class dn{static get version(){return ag}static isMSESupported(){return lu()}static isSupported(){if(!lu())return!1;let e=ib();return"function"==typeof(null==e?void 0:e.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(t=>e.isTypeSupported(rh(t,"video")))||["mp4a.40.2","fLaC"].some(t=>e.isTypeSupported(rh(t,"audio"))))}static getMediaSource(){return ib()}static get Events(){return tz}static get MetadataSchema(){return aS}static get ErrorTypes(){return tY}static get ErrorDetails(){return tj}static get DefaultConfig(){return dn.defaultConfig?dn.defaultConfig:l3}static set DefaultConfig(e){dn.defaultConfig=e}createController(e,t){if(e){let i=new e(this);return t&&t.push(i),i}return null}on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.on(e,t,i)}once(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this;this._emitter.once(e,t,i)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this,r=arguments.length>3?arguments[3]:void 0;this._emitter.off(e,t,i,r)}listeners(e){return this._emitter.listeners(e)}emit(e,t,i){return this._emitter.emit(e,t,i)}trigger(e,t){if(this.config.debug)return this.emit(e,e,t);try{return this.emit(e,e,t)}catch(t){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+t.message+'". Here is a stacktrace:',t),!this.triggeringException){this.triggeringException=!0;let i=e===tz.ERROR;this.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.INTERNAL_EXCEPTION,fatal:i,event:e,error:t}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(tz.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(e=>e.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(e=>
3e.destroy()),this.coreComponents.length=0,this.iframeController=void 0;let e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){let t=Error("attachMedia failed: invalid argument (".concat(e,")"));this.trigger(tz.ERROR,{type:tY.OTHER_ERROR,details:tj.ATTACH_MEDIA_ERROR,fatal:!0,error:t});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());let t="media"in e,i=t?e.media:e,r=t?e:{media:i};this._media=i,this.trigger(tz.MEDIA_ATTACHING,r)}detachMedia(){this.logger.log("detachMedia");let e={};this.trigger(tz.MEDIA_DETACHING,e),this._media=null,this.trigger(tz.MEDIA_DETACHED,e)}transferMedia(){var e;this._media=null;let t=(null==(e=this.bufferController)?void 0:e.transferMedia())||null,i={transferMedia:t};return this.trigger(tz.MEDIA_DETACHING,i),this.trigger(tz.MEDIA_DETACHED,i),t}loadSource(e){var t;this.stopLoad();let i=this.media,r=this._url,n=this._url=tX.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log("loadSource:".concat(n)),i&&r&&(r!==n||null!=(t=this.bufferController)&&t.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(i)),this.trigger(tz.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,t=arguments.length>1?arguments[1]:void 0;this.logger.log("startLoad(".concat(e+(t?", <skip seek to start>":""),")")),this.started=!0,this.resumeBuffering();for(let i=0;i<this.networkControllers.length&&(this.networkControllers[i].startLoad(e,t),this.started&&this.networkControllers);i++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!this.started&&this.networkControllers);e++);}get loadingEnabled(){return this.started&&this.streamController.state!==ad.STOPPED}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){let e={[t$.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[t$.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[t$.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");let e=this._media,t=this.started,i=null==e?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),t&&(i?this.startLoad(i):this.config.autoStartLoad||this.startLoad()))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=ik()),e}get levels(){return this.levelController.levels||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log("set currentLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log("set nextLevel:".concat(e)),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log("set loadLevel:".concat(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){this.logger.log("set firstLevel:".concat(e)),this.levelController.firstLevel=e}get startLevel(){let e=this.levelController.startLevel;return -1===e&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log("set startLevel:".concat(e)),-1!==e&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){let t=this.capLevelController,i=!!e;t&&i!==this.config.capLevelToPlayerSize&&(i?t.startCapping():(t.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=i)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){let{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){let{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log("set autoLevelCapping:".concat(e)),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){rL.indexOf(e)>-1&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return -1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){let{levels:e,config:{minAutoBitrate:t}}=this;if(!e)return 0;let i=e.length;for(let r=0;r<i;r++)if(e[r].maxBitrate>=t)return r;return 0}get maxAutoLevel(){let e,{levels:t,autoLevelCapping:i,maxHdcpLevel:r}=this;if(e=-1===i&&null!=t&&t.length?t.length-1:i,r)for(let i=e;i--;){let e=t[i].attrs["HDCP-LEVEL"];if(e&&e<=r)return i}return e}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()}get audioForwardBufferInfo(){var e;return(null==(e=this.audioStreamController)?void 0:e.getFwdBufferInfo())||null}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var t;return(null==(t=this.audioTrackController)?void 0:t.setAudioOption(e))||null}
3setSubtitleOption(e){var t;return(null==(t=this.subtitleTrackController)?void 0:t.setSubtitleOption(e))||null}get allAudioTracks(){let e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){let e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){let e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){let t=this.audioTrackController;t&&(t.audioTrack=e)}get nextAudioTrack(){var e,t;return null!=(e=null==(t=this.audioStreamController)?void 0:t.nextAudioTrack)?e:-1}set nextAudioTrack(e){let{audioTrackController:t}=this;t&&(t.nextAudioTrack=e)}get allSubtitleTracks(){let e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){let e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){let e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){let t=this.subtitleTrackController;t&&(t.subtitleTrack=e)}get subtitleDisplay(){let e=this.subtitleTrackController;return!!e&&e.subtitleDisplay}set subtitleDisplay(e){let t=this.subtitleTrackController;t&&(t.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){var e,t;return null!=(e=null==(t=this.latencyController)?void 0:t.liveSyncPosition)?e:null}get latency(){var e;return(null==(e=this.latencyController)?void 0:e.latency)||0}get maxLatency(){var e;return(null==(e=this.latencyController)?void 0:e.maxLatency)||0}get targetLatency(){var e;return(null==(e=this.latencyController)?void 0:e.targetLatency)||null}set targetLatency(e){this.latencyController&&(this.latencyController.targetLatency=e)}get drift(){var e;return(null==(e=this.latencyController)?void 0:e.drift)||null}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!(null!=(e=this.bufferController)&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?this.interstitialsController.interstitialsManager:null}get iframeVariants(){return this.levelController.iframeVariants||[]}
3createIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createIFramePlayer(e):null}createImageIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createImageIFramePlayer(e):null}getMediaDecodingInfo(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.allAudioTracks;return rS(e,rU(t),navigator.mediaCapabilities)}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this._url=null,this.streamController=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new ap,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.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.iframeController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;let t=this.logger=function(e,t,i){let r=iv();if("object"==typeof console&&!0===e||"object"==typeof e){let n=["debug","log","info","warn","error"];n.forEach(t=>{r[t]=iE(t,e,i)});try{r.log('Debug logs enabled for "'.concat(t,'" in hls.js version ',"1.7.3"))}catch(e){return iv()}n.forEach(t=>{iy[t]=iE(t,e)})}else t6(iy,r);return r}(e.debug||!1,"Hls instance",e.loggerId||e.assetPlayerId),i=this.config=function(e,t,i){if((t.liveSyncDurationCount||t.liveMaxLatencyDurationCount)&&(t.liveSyncDuration||t.liveMaxLatencyDuration))throw Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(void 0!==t.liveMaxLatencyDurationCount&&(void 0===t.liveSyncDurationCount||t.liveMaxLatencyDurationCount<=t.liveSyncDurationCount))throw Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(void 0!==t.liveMaxLatencyDuration&&(void 0===t.liveSyncDuration||t.liveMaxLatencyDuration<=t.liveSyncDuration))throw Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');if(void 0!==t.liveMaxUnchangedPlaylistRefresh){let e=t.liveMaxUnchangedPlaylistRefresh,r=Math.max(2,Math.min(e,1/0));r!==e&&i.warn('hls.js config: "liveMaxUnchangedPlaylistRefresh" clamped from '.concat(e," to ").concat(r,".")),t.liveMaxUnchangedPlaylistRefresh=r}let r=function e(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(e):Object.keys(t).reduce((i,r)=>(i[r]=e(t[r]),i),{}):t}(e),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach(e=>{let a="".concat("level"===e?"playlist":e,"LoadPolicy"),s=void 0===t[a],o=[];n.forEach(i=>{let n="".concat(e,"Loading").concat(i),l=t[n];if(void 0!==l&&s){o.push(n);let e=r[a].default;switch(t[a]={default:e},i){case"TimeOut":e.maxLoadTimeMs=l,e.maxTimeToFirstByteMs=l;break;case"MaxRetry":e.errorRetry.maxNumRetry=l,e.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":e.errorRetry.retryDelayMs=l,e.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":e.errorRetry.maxRetryDelayMs=l,e.timeoutRetry.maxRetryDelayMs=l}}}),o.length&&i.warn('hls.js config: "'.concat(o.join('", "'),'" setting(s) are deprecated, use "').concat(a,'": ').concat(rx(t[a])))}),t7(t7({},r),t)}(dn.DefaultConfig,e,t);this.userConfig=e,i.progressive&&function(e,t){let i=e.loader;i!==lJ&&i!==l2?(t.log("[config]: Custom loader detected, cannot enable progressive streaming"),e.progressive=!1):function(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch(e){}return!1}()&&(e.loader=lJ,e.progressive=!0,e.enableSoftwareAES=!0,t.log("[config]: Progressive streaming enabled, using FetchLoader"))}(i,t);let{streamController:r,abrController:n,bufferController:a,capLevelController:s,errorController:o,fpsController:l,id3TrackController:d,iframeController:u,gapController:h}=i,c=new o(this),m=this.abrController=new n(this),f=new r3(this),p=i.interstitialsController,g=p?this.interstitialsController=new p(this,dn):null,v=a?this.bufferController=new a(this,f):null,E=s?this.capLevelController=new s(this):null,y=l?new l(this):null,b=i.cmcdController,T=b?this.cmcdController=new b(this):null,A=new dr(this),S=i.contentSteeringController,R=S?new S(this):null,k=this.levelController=new l4(this,R),I=d?new d(this):void 0,L=new l7(this.config,this.logger),D=this.streamController=new r(this,f,L),w=this.gapController=h?new h(this,f):void 0;E&&E.setStreamController(D);let C=[A,k,D];g&&C.splice(1,0,g),R&&C.splice(1,0,R),this.networkControllers=C;let M=[m];v&&M.push(v),w&&M.push(w),E&&M.push(E),y&&(y.setStreamController(D),M.push(y)),I&&M.push(I),M.push(f),this.audioTrackController=this.createController(i.audioTrackController,C);let P=i.audioStreamController;P&&C.push(this.audioStreamController=new P(this,f,L)),this.subtitleTrackController=this.createController(i.subtitleTrackController,C);let O=i.subtitleStreamController;O&&C.push(this.subtititleStreamController=new O(this,f,L)),this.createController(i.timelineController,M),L.emeController=this.emeController=this.createController(i.emeController,M),T&&M.push(T),this.latencyController=this.createController(i.latencyController,M),this.coreComponents=M,this.iframeC
3ontroller=u?new u(this,dn):void 0,C.push(c);let x=c.onErrorOut;"function"==typeof x&&this.on(tz.ERROR,x,c),this.on(tz.MANIFEST_LOADED,A.onManifestLoaded,A)}}dn.defaultConfig=void 0;var da={VIDEO:"video",DRM:"drm"},ds={NETWORK_OFFLINE:2000002,NETWORK_RECONNECTING:2000003,NETWORK_UNKNOWN_ERROR:2e6,NETWORK_INVALID_URL:24e5,NETWORK_NOT_FOUND:2404e3,NETWORK_NOT_READY:2412e3,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_KEY_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},dl=e=>e===da.VIDEO?"playback":e,dd=class e extends Error{constructor(t,i=e.MEDIA_ERR_CUSTOM,r,n){var a;super(t),this.name="MediaError",this.code=i,this.context=n,this.fatal=null!=r?r:i>=e.MEDIA_ERR_NETWORK&&i<=e.MEDIA_ERR_ENCRYPTED,this.message||(this.message=null!=(a=e.defaultMessages[this.code])?a:"")}};dd.MEDIA_ERR_ABORTED=1,dd.MEDIA_ERR_NETWORK=2,dd.MEDIA_ERR_DECODE=3,dd.MEDIA_ERR_SRC_NOT_SUPPORTED=4,dd.MEDIA_ERR_ENCRYPTED=5,dd.MEDIA_ERR_CUSTOM=100,dd.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 du=(e,t)=>null!=t&&e in t,dh={ANY:"any",MUTED:"muted"},dc={ON_DEMAND:"on-demand",LIVE:"live",UNKNOWN:"unknown"},dm={MSE:"mse",NATIVE:"native"},df={HEADER:"header",QUERY:"query",NONE:"none"},dp=Object.values(df),dg={M3U8:"application/vnd.apple.mpegurl",MP4:"video/mp4"},dv={HLS:dg.M3U8};Object.keys(dv),[...Object.values(dg)];var dE={code:"en"},dy=function(e,t,i,r){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:e;n.addEventListener(t,i,r),e.addEventListener("teardown",()=>{n.removeEventListener(t,i)},{once:!0})},db=e=>{let t=e.indexOf("?");return t<0?[e]:[e.slice(0,t),e.slice(t)]},dT=e=>{let{type:t}=e;if(t){let e=t.toUpperCase();return du(e,dv)?dv[e]:t}return dS(e)},d_=e=>"VOD"===e?dc.ON_DEMAND:dc.LIVE,dA=e=>"EVENT"===e?1/0:"VOD"===e?NaN:0,dS=e=>{let{src:t}=e;if(!t)return"";let i="";try{i=dk(t).pathname}catch(e){console.error("Invalid url when trying to infer mime type",t)}let r=i.lastIndexOf(".");if(r<0)return dI(e)?dg.M3U8:"";let n=i.slice(r+1).toUpperCase();return du(n,dg)?dg[n]:""},dR=e=>{try{return new URL(e),!1}catch(e){return!0}},dk=(e,t)=>{var i;if(!dR(e))return new URL(e);let r=null==(i=null==window?void 0:window.location)?void 0:i.href,n=null!=t?t:r;return t&&dR(t.toString())&&(n=new URL(t,r)),new URL(e,n)},dI=e=>{let t,{src:i,customDomain:r="mux.com"}=e;try{t=new URL("".concat(i))}catch(e){return!1}let n="https:"===t.protocol,a=t.hostname==="stream.".concat(r).toLowerCase(),s=t.pathname.split("/"),o=2===s.length,l=!(null!=s&&s[1].includes("."));return n&&a&&o&&l},dL=e=>{let t=(null!=e?e:"").split(".")[1];if(t)try{let e=t.replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(atob(e).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(i)}catch(e){return}},dD=function(e){let{exp:t}=e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Date.now();return!t||1e3*t<i};function dw(e){var t;let i=!(arguments.length>1)||void 0===arguments[1]||arguments[1];return new dC(i&&null!=(t=null==dE?void 0:dE[e])?t:e,i?dE.code:"en")}var dC=class{format(e){return this.message.replace(/\{(\w+)\}/g,(t,i)=>{var r;return null!=(r=e[i])?r:""})}toString(){return this.message}constructor(e,t=(e=>null!=(e=dE)?e:"en")()){this.message=e,this.locale=t}},dM=Object.values(dh),dP=e=>"boolean"==typeof e||"string"==typeof e&&dM.includes(e),dO=(e,t)=>{if(!t)return;let i=e.muted,r=()=>e.muted=i;switch(t){case dh.ANY:e.play().catch(()=>{e.muted=!0,e.play().catch(r)});break;case dh.MUTED:e.muted=!0,e.play().catch(r);break;default:e.play().catch(()=>{})}},dx=e=>"time"in e?e.time:e.startTime;function dN(e,t,i,r,n,a){let s=document.createElement("track");return s.kind=t,s.label=i,r&&(s.srclang=r),n&&(s.id=n),a&&(s.default=!0),s.track.mode=["subtitles","captions"].includes(t)?"disabled":"hidden",s.setAttribute("data-removeondestroy",""),e.append(s),s.track}function dU(e,t,i){var r;return null==(r=Array.from(e.querySelectorAll("track")).find(e=>e.track.label===t&&e.track.kind===i))?void 0:r.track}async function dF(e,t,i,r){let n=dU(e,i,r);return n||((n=dN(e,r,i)).mode="hidden",await new Promise(e=>setTimeout(()=>
3e(void 0),0))),"hidden"!==n.mode&&(n.mode="hidden"),[...t].sort((e,t)=>dx(t)-dx(e)).forEach(t=>{var i,a;let s=t.value,o=dx(t);if("endTime"in t&&null!=t.endTime)null==n||n.addCue(new VTTCue(o,t.endTime,"chapters"===r?s:JSON.stringify(null!=s?s:null)));else{let t=Array.prototype.findIndex.call(null==n?void 0:n.cues,e=>e.startTime>=o),l=null==(i=null==n?void 0:n.cues)?void 0:i[t],d=l?l.startTime:Number.isFinite(e.duration)?e.duration:Number.MAX_SAFE_INTEGER,u=null==(a=null==n?void 0:n.cues)?void 0:a[t-1];u&&(u.endTime=o),null==n||n.addCue(new VTTCue(o,d,"chapters"===r?s:JSON.stringify(null!=s?s:null)))}}),e.textTracks.dispatchEvent(new Event("change",{bubbles:!0,composed:!0})),n}var dB="cuepoints",dG=Object.freeze({label:dB});async function dH(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dG;return dF(e,t,i.label,"metadata")}var dK=e=>({time:e.startTime,value:JSON.parse(e.text)});function dW(e){var t,i;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{label:dB},n=dU(e,r.label,"metadata");if(!(null!=(t=null==n?void 0:n.activeCues)&&t.length))return;if(1===n.activeCues.length)return dK(n.activeCues[0]);let{currentTime:a}=e;return dK(Array.prototype.find.call(null!=(i=n.activeCues)?i:[],e=>{let{startTime:t,endTime:i}=e;return t<=a&&i>a})||n.activeCues[0])}async function dV(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dG;return new Promise(i=>{dy(e,"loadstart",async()=>{let r=await dH(e,[],t);dy(e,"cuechange",()=>{let t=dW(e);if(t){let i=new CustomEvent("cuepointchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var dq="chapters",dY=Object.freeze({label:dq}),dj=e=>({startTime:e.startTime,endTime:e.endTime,value:e.text});async function dz(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dY;return dF(e,t,i.label,"chapters")}function dQ(e){var t,i;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{label:dq},n=dU(e,r.label,"chapters");if(!(null!=(t=null==n?void 0:n.activeCues)&&t.length))return;if(1===n.activeCues.length)return dj(n.activeCues[0]);let{currentTime:a}=e;return dj(Array.prototype.find.call(null!=(i=n.activeCues)?i:[],e=>{let{startTime:t,endTime:i}=e;return t<=a&&i>a})||n.activeCues[0])}async function dX(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:dY;return new Promise(i=>{dy(e,"loadstart",async()=>{let r=await dz(e,[],t);dy(e,"cuechange",()=>{let t=dQ(e);if(t){let i=new CustomEvent("chapterchange",{composed:!0,bubbles:!0,detail:t});e.dispatchEvent(i)}},{},r),i(r)})})}var dZ={VIDEO:"v",THUMBNAIL:"t",STORYBOARD:"s",DRM:"d"},dJ=function(e,t,i,r){var n,a,s,o;let l,d,u,h=arguments.length>4&&void 0!==arguments[4]&&arguments[4],c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:!(null==(l=globalThis.navigator)?void 0:l.onLine);if(c){let i=dw("Your device appears to be offline",h),r=dd.MEDIA_ERR_NETWORK,n=new dd(i,r,!1,void 0);return n.errorCategory=t,n.muxCode=ds.NETWORK_OFFLINE,n.data=e,n}let m="status"in e?e.status:e.code,f=Date.now(),p=dd.MEDIA_ERR_NETWORK;if(200===m)return;let g=dl(t),v=(d=dl(t),u="".concat(d,"Token"),null!=(s=i.tokens)&&s[d]?null==(o=i.tokens)?void 0:o[d]:du(u,i)?i[u]:void 0),E=t===da.VIDEO?dZ.VIDEO:t===da.DRM?dZ.DRM:void 0,[y]=db(null!=(n=i.playbackId)?n:"");if(!m||!y)return;let b=dL(v);if(v&&!b){let i=new dd(dw("The {tokenNamePrefix}-token provided is invalid or malformed.",h).format({tokenNamePrefix:g}),p,!0,dw("Compact JWT string: {token}",h).format({token:v}));return i.errorCategory=t,i.muxCode=ds.NETWORK_TOKEN_MALFORMED,i.data=e,i}if(m>=500){let e=new dd("",p,null==r||r);return e.errorCategory=t,e.muxCode=ds.NETWORK_UNKNOWN_ERROR,e}if(403===m)if(b){if(dD(b,f)){let i={timeStyle:"medium",dateStyle:"medium"},r=new dd(dw("The video’s secured {tokenNamePrefix}-token has expired.",h).format({tokenNamePrefix:g}),p,!0,dw("Expired at: {expiredDate}. Current time: {currentDate}.",h).format({expiredDate:new Intl.DateTimeFormat("en",i).format(null!=(a=b.exp)?a:0),currentDate:new Intl.DateTimeFormat("en",i).format(f)}));return r.errorCategory=t,r.muxCode=ds.NETWORK_TOKEN_EXPIRED,r.data=e,r}if(((e,t)=>{let{sub:i}=e;return i!==t})(b,y)){let i=new dd(dw("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",h).format({tokenNamePrefix:g}),p,!0,dw("Specified playback ID: {playbackId} and the playback ID encoded in the {tokenNamePrefix}-token: {tokenPlaybackId}",h).format({tokenNamePrefix:g,playbackId:y,tokenPlaybackId:b.sub}));return i.errorCategory=t,i.muxCode=ds.NETWORK_TOKEN_SUB_MISMATCH,i.data=e,i}if(((e,t)=>{let{aud:i}=e;return!i})(b,0)){let i=new dd(dw("The {tokenNamePrefix}-token is formatted with incorrect information.",h).format({tokenNamePrefix:g}),p,!0,dw("The {tokenNamePrefix}-token has no aud value. aud value should be {expectedAud}.",h).format({tokenNamePrefix:g,expectedAud:E}));return i.errorCategory=t,i.muxCode=ds.NETWORK_TOKEN_AUD_MISSING,i.data=e,i}if(((e,t)=>{let{aud:i}=e;return i!==t})(b,E)){let i=new dd(dw("The {tokenNamePrefix}-token is formatted with incorrect information.",h).format({tokenNamePrefix:g}),p,!0,dw("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.",h).format({tokenNamePrefix:g,expectedAud:E,aud:b.aud}));return i.errorCategory=t,i.muxCode=ds.NETWORK_TOKEN_AUD_MISMATCH,i.data=e,i}}else{let i=new dd(dw("Authorization error trying to access this {category} URL. If this is a signed URL, you might need to provide a {tokenNamePrefix}-token.",h).format({tokenNamePrefix:g,category:t}),p,null==r||r,dw("Specified playback ID: {playbackId}",h).format({playbackId:y}));return i.errorCategory=t,i.muxCode=ds.NETWORK_TOKEN_MISSING,i.data=e,i}if(412===m){let n=new dd(dw("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",h),p,null==r||r,dw("Specified playback ID: {playbackId}",h).format({playbackId:y}));return n.errorCategory=t,n.muxCode=ds.NETWORK_NOT_READY,n.streamType=i.streamType===dc.LIVE?"live":i.streamType===dc.ON_DEMAND?"on-demand":"unknown",n.data=e,n}if(404===m){let i=new dd(dw("This URL or playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",h),p,null==r||r,dw("Specified playback ID: {playbackId}",h).format({playbackId:y}));return i.errorCategory=t,i.muxCode=ds.NETWORK_NOT_FOUND,i.data=e,i}
3if(400===m){let i=new dd(dw("The URL or playback-id was invalid. You may have used an invalid value as a playback-id."),p,null==r||r,dw("Specified playback ID: {playbackId}",h).format({playbackId:y}));return i.errorCategory=t,i.muxCode=ds.NETWORK_INVALID_URL,i.data=e,i}let T=new dd("",p,null==r||r);return T.errorCategory=t,T.muxCode=ds.NETWORK_UNKNOWN_ERROR,T.data=e,T},d$=dn.DefaultConfig.capLevelController;d$||console.error("MinCapLevelController - hls.js DefaultConfig.capLevelController is unavailable");var d0={"720p":921600,"1080p":2073600,"1440p":4194304,"2160p":8294400},d1=class e extends d${static setMaxAutoResolution(t,i){i?e.maxAutoResolution.set(t,i):e.maxAutoResolution.delete(t)}getMaxAutoResolution(){var t;let i=this.hls;return null!=(t=e.maxAutoResolution.get(i))?t:void 0}get levels(){var e;return null!=(e=this.hls.levels)?e:[]}getValidLevels(e){return this.levels.filter((t,i)=>this.isLevelAllowed(t)&&i<=e)}getMaxLevelCapped(e){let t=this.getValidLevels(e),i=this.getMaxAutoResolution();if(!i)return super.getMaxLevel(e);let r=d0[i.toLowerCase().trim()];if(!r)return super.getMaxLevel(e);let n=t.filter(e=>e.width*e.height<=r),a=n.findIndex(e=>e.width*e.height===r);if(-1!==a){let e=n[a];return t.findIndex(t=>t===e)}if(0===n.length)return 0;let s=n[n.length-1];return t.findIndex(e=>e===s)}getMaxLevel(t){if(void 0!==this.getMaxAutoResolution())return this.getMaxLevelCapped(t);let i=super.getMaxLevel(t),r=this.getValidLevels(t);if(!r[i])return i;let n=Math.min(r[i].width,r[i].height),a=e.minMaxResolution;return n>=a?i:d$.getMaxLevelByMediaSize(r,16/9*a,a)}constructor(e){super(e)}};d1.minMaxResolution=720,d1.maxAutoResolution=new WeakMap;var d2,d3,d4,d5,d8,d6,d9,d7,ue=e=>new TextDecoder("utf-16le").decode(e).replace("skd://","").slice(1),ut={FAIRPLAY:"fairplay",PLAYREADY:"playready",WIDEVINE:"widevine"},ui=/([A-Z0-9-]+)="?(.*?)"?(?:,|$)/g,ur=async(e,t)=>{if(t===dg.MP4)return{streamType:dc.ON_DEMAND,targetLiveWindow:NaN,liveEdgeStartOffset:void 0,sessionData:void 0};if(t===dg.M3U8){let t=await fetch(e);if(!t.ok)return Promise.reject(t);let i=await t.text(),r=await ((e,t)=>{let i,r=e.split("\n").find((e,t,i)=>t>0&&i[t-1].startsWith("#EXT-X-STREAM-INF"));if(!r)return Promise.reject(Error("No media playlist URL found in multivariant playlist"));if(dR(r)&&!t)return Promise.reject(Error("masterPlaylistUrl is required to resolve relative media playlist URL"));try{i=dk(r,t)}catch(e){return Promise.reject(e)}return fetch(i).then(e=>200!==e.status?Promise.reject(e):e.text())})(i,t.url);return{...(e=>{let t=e.split("\n").filter(e=>e.startsWith("#EXT-X-SESSION-DATA"));if(!t.length)return{};let i={};for(let e of t){let t=Object.fromEntries([...e.matchAll(ui)].map(e=>{let[,t,i]=e;return[t,i]})),r=t["DATA-ID"];r&&(i[r]={...t})}return{sessionData:i}})(i),...(e=>{var t,i,r;let n=e.split("\n"),a=null==(i=(null!=(t=n.find(e=>e.startsWith("#EXT-X-PLAYLIST-TYPE")))?t:"").split(":")[1])?void 0:i.trim(),s=d_(a),o=dA(a),l;if(s===dc.LIVE){let e=n.find(e=>e.startsWith("#EXT-X-PART-INF"));if(e)l=2*e.split(":")[1].split("=")[1];else{let e=n.find(e=>e.startsWith("#EXT-X-TARGETDURATION")),t=null==(r=null==e?void 0:e.split(":"))?void 0:r[1];l=(null!=t?t:6)*3}}return{streamType:s,targetLiveWindow:o,liveEdgeStartOffset:l}})(r)}}return console.error("Media type ".concat(t," is an unrecognized or unsupported type for src ").concat(e,".")),{streamType:void 0,targetLiveWindow:void 0,liveEdgeStartOffset:void 0,sessionData:void 0}},un=async function(e,t){var i,r,n,a;let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:dT({src:e}),{streamType:o,targetLiveWindow:l,liveEdgeStartOffset:d,sessionData:u}=await ur(e,s),h=null==u?void 0:u["com.apple.hls.chapters"];(null!=h&&h.URI||null!=h&&h.VALUE.toLocaleLowerCase().startsWith("http"))&&ua(null!=(i=h.URI)?i:h.VALUE,t),(null!=(r=ud.get(t))?r:{}).liveEdgeStartOffset=d,(null!=(n=ud.get(t))?n:{}).targetLiveWindow=l,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),(null!=(a=ud.get(t))?a:{}).streamType=o,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))},ua=async(e,t)=>{var i,r;try{let n=await fetch(e);if(!n.ok)throw Error("Failed to fetch Mux metadata: ".concat(n.status," ").concat(n.statusText));let a=await n.json(),s={};if(!(null!=(i=null==a?void 0:a[0])&&i.metadata))return;for(let e of a[0].metadata)e.key&&e.value&&(s[e.key]=e.value);(null!=(r=ud.get(t))?r:{}).metadata=s;let o=new CustomEvent("muxmetadata");t.dispatchEvent(o)}catch(e){console.error(e)}},us=null!=(d5=null==(d4=null==globalThis?void 0:globalThis.navigator)?void 0:d4.userAgent)?d5:"",uo=null!=(d9=null==(d6=null==(d8=null==globalThis?void 0:globalThis.navigator)?void 0:d8.userAgentData)?void 0:d6.platform)?d9:"",ul=us.toLowerCase().includes("android")||["x11","android"].some(e=>uo.toLowerCase().includes(e)),ud=new WeakMap,uu="mux.com",uh=null==(d7=dn.isSupported)?void 0:d7.call(dn),uc=()=>
3{if("undefined"!=typeof window)return tH.utils.now()},um=tH.utils.generateUUID,uf=function(){let{playbackId:e,customDomain:t=uu,maxResolution:i,minResolution:r,renditionOrder:n,programStartTime:a,programEndTime:s,assetStartTime:o,assetEndTime:l,playbackToken:d,tokens:{playback:u=d}={},extraSourceParams:h={}}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e)return;let[c,m=""]=db(e),f=new URL("https://stream.".concat(t,"/").concat(c,".m3u8").concat(m));return u||f.searchParams.has("token")?(f.searchParams.forEach((e,t)=>{"token"!=t&&f.searchParams.delete(t)}),u&&f.searchParams.set("token",u)):(i&&f.searchParams.set("max_resolution",i),r&&(f.searchParams.set("min_resolution",r),i&&+i.slice(0,-1)<+r.slice(0,-1)&&console.error("minResolution must be <= maxResolution","minResolution",r,"maxResolution",i)),n&&f.searchParams.set("rendition_order",n),a&&f.searchParams.set("program_start_time","".concat(a)),s&&f.searchParams.set("program_end_time","".concat(s)),o&&f.searchParams.set("asset_start_time","".concat(o)),l&&f.searchParams.set("asset_end_time","".concat(l)),Object.entries(h).forEach(e=>{let[t,i]=e;null!=i&&f.searchParams.set(t,i)})),f.toString()},up=e=>{if(!e)return;let[t]=e.split("?");return t||void 0},ug=e=>{if(!e||!e.startsWith("https://stream."))return;let[t]=new URL(e).pathname.slice(1).split(/\.m3u8|\//);return t||void 0},uv=e=>{var t;return null==(t=ud.get(e))?void 0:t.error},uE=e=>{var t,i;return null!=(i=null==(t=ud.get(e))?void 0:t.streamType)?i:dc.UNKNOWN},uy=e=>{var t,i;return null!=(i=null==(t=ud.get(e))?void 0:t.seekable)?i:e.seekable},ub=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.034;return Math.abs(e-t)<=i},uT=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:.034;return e>t||ub(e,t,i)},u_=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.034;return e.paused&&uT(e.currentTime,e.duration,t)},uA=(e,t)=>{var i,r,n;if(!t||!e.buffered.length)return;if(e.readyState>2)return!1;let a=t.currentLevel>=0?null==(r=null==(i=t.levels)?void 0:i[t.currentLevel])?void 0:r.details:null==(n=t.levels.find(e=>!!e.details))?void 0:n.details;if(!a||a.live)return;let{fragments:s}=a;if(!(null!=s&&s.length))return;if(e.currentTime<e.duration-(a.targetduration+.5))return!1;let o=s[s.length-1];if(e.currentTime<=o.start)return!1;let l=o.start+o.duration/2,d=e.buffered.start(e.buffered.length-1),u=e.buffered.end(e.buffered.length-1);return l>d&&l<u},uS=(e,t)=>e.ended||e.loop?e.ended:!!(t&&uA(e,t))||u_(e),uR=(e,t,i)=>{uI(t,i,e);let{metadata:r={}}=e,{view_session_id:n=um()}=r,a=(e=>{var t,i,r;return null!=(t=null==e?void 0:e.metadata)&&t.video_id?e.metadata.video_id:uN(e)&&null!=(r=null!=(i=up(e.playbackId))?i:ug(e.src))?r:e.src})(e);r.view_session_id=n,r.video_id=a,e.metadata=r,e.drmTypeCb=e=>{var i;null==(i=t.mux)||i.emit("hb",{view_drm_type:e})},e.fallbackToWebkitFairplay=async()=>{var i;let r=!t.paused,n=t.currentTime;e.useWebkitFairplay=!0;let a=e.muxDataKeepSession;e.muxDataKeepSession=!0;let s=null==(i=ud.get(t))?void 0:i.coreReference;uR(e,t,s),e.muxDataKeepSession=a,e.useWebkitFairplay=!1,r&&await t.play().then(()=>{t.currentTime=n}).catch(()=>{}),t.currentTime=n},ud.set(t,{retryCount:0});let s=uD(e,t),o=((e,t,i)=>{let{preload:r,src:n}=e,a=e=>{null!=e&&["","none","metadata","auto"].includes(e)?t.setAttribute("preload",e):t.removeAttribute("preload")};if(!i)return a(r),a;let s=!1,o=!1,l=i.config.maxBufferLength,d=i.config.maxBufferSize,u=e=>{a(e);let r=null!=e?e:t.preload;o||"none"===r||("metadata"===r?(i.config.maxBufferLength=1,i.config.maxBufferSize=1):(i.config.maxBufferLength=l,i.config.maxBufferSize=d),h())},h=()=>{!s&&n&&(s=!0,i.loadSource(n))};return dy(t,"play",()=>{o=!0,i.config.maxBufferLength=l,i.config.maxBufferSize=d,h()},{once:!0}),u(r),u})(e,t,s);null!=e&&e.muxDataKeepSession&&null!=t&&t.mux&&!t.mux.deleted?s&&t.mux.addHLSJS({hlsjs:s,Hls:s?dn:void 0}):uF(e,t,s),uB(e,t,s),dV(t),dX(t);let l=((e,t,i)=>{let{autoplay:r}=e,n=!1,a=!1,s=dP(r)?r:!!r,o=()=>{n||dy(t,"playing",()=>{n=!0},{once:!0})};if(o(),dy(t,"loadstart",()=>{n=!1,o(),dO(t,s)},{once:!0}),dy(t,"loadstart",()=>{i||(a=e.streamType&&e.streamType!==dc.UNKNOWN?e.streamType===dc.LIVE:!Number.isFinite(t.duration)),dO(t,s)},{once:!0}),i&&i.once(dn.Events.LEVEL_LOADED,(t,i)=>{var r;a=e.streamType&&e.streamType!==dc.UNKNOWN?e.streamType===dc.LIVE:null!=(r=i.details.live)&&r}),!s){let r=()=>{!a||Number.isFinite(e.startTime)||(null!=i&&i.liveSyncPosition?t.currentTime=i.liveSyncPosition:Number.isFinite(t.seekable.end(0))&&(t.currentTime=t.
3seekable.end(0)))};i&&dy(t,"play",()=>{"metadata"===t.preload?i.once(dn.Events.LEVEL_UPDATED,r):r()},{once:!0})}return e=>{n||dO(t,s=dP(e)?e:!!e)}})(e,t,s);((e,t,i)=>{let{minPreloadSegments:r}=e;if(null==r||r<=0||!i)return;let n=0,a=!1,s=t.playbackRate||1,o=()=>{0!==t.playbackRate&&(s=t.playbackRate,t.playbackRate=0)};t.playbackRate=0,dy(t,"ratechange",o);let l=(e,i)=>{let{frag:l}=i;a||"main"!==l.type||++n>=r&&(a=!0,t.removeEventListener("ratechange",o),t.playbackRate=s)};i.on(dn.Events.FRAG_BUFFERED,l),t.addEventListener("teardown",()=>{a||(a=!0,i.off(dn.Events.FRAG_BUFFERED,l),t.playbackRate=s)},{once:!0})})(e,t,s),((e,t,i)=>{let{initialEstimateSegments:r}=e;if(null==r||r<=0||!i)return;let n=0;i.on(dn.Events.FRAG_BUFFERED,(e,t)=>{let{frag:a}=t;"main"===a.type&&++n<r&&i.abrController.resetEstimator(i.config.abrEwmaDefaultEstimate)})})(e,0,s);let d={engine:s,setAutoplay:l,setPreload:o},u=ud.get(t);return u&&(u.coreReference=d),d},uk=new WeakMap,uI=(e,t,i)=>{let r=null==t?void 0:t.engine;null!=e&&e.mux&&!e.mux.deleted&&(null!=i&&i.muxDataKeepSession?r&&e.mux.removeHLSJS():(e.mux.destroy(),delete e.mux)),r&&(r.detachMedia(),r.destroy()),e&&(e.hasAttribute("src")&&(e.removeAttribute("src"),e.load()),e.removeEventListener("error",uH),e.removeEventListener("error",uW),e.removeEventListener("durationchange",uG),ud.delete(e),e.dispatchEvent(new Event("teardown")))};function uL(e,t){var i;let r=dT(e);if(r!==dg.M3U8)return!0;let n=!r||null==(i=t.canPlayType(r))||i,{preferPlayback:a}=e,s=a===dm.MSE,o=a===dm.NATIVE,l=uh&&(s||ul||!(/^((?!chrome|android).)*safari/i.test(us)&&t.canPlayType("application/vnd.apple.mpegurl")));return n&&(o||!l)}var uD=(e,t)=>{let{debug:i,streamType:r,startTime:n=-1,metadata:a,preferCmcd:s,_hlsConfig:o={},maxAutoResolution:l,initialBandwidthEstimateKbps:d}=e,u=dT(e)===dg.M3U8,h=uL(e,t);if(u&&!h&&uh){let u={backBufferLength:30,renderTextTracksNatively:!1,liveDurationInfinity:!0,capLevelOnFPSDrop:!0,...null!=d?{abrEwmaDefaultEstimate:1e3*d}:{}},h=uw(r),c=uC(e),m=[df.QUERY,df.HEADER].includes(s)?{useHeaders:s===df.HEADER,sessionId:null==a?void 0:a.view_session_id,contentId:null==a?void 0:a.video_id}:void 0,f=uU(e,o),p=new dn({debug:i,startPosition:n,cmcd:m,xhrSetup:(e,t)=>{var i,r;if(s&&s!==df.QUERY)return;let n=dk(t);if(!n.searchParams.has("CMCD"))return;let a=(null!=(r=null==(i=n.searchParams.get("CMCD"))?void 0:i.split(","))?r:[]).filter(e=>e.startsWith("sid")||e.startsWith("cid")).join(",");n.searchParams.set("CMCD",a),e.open("GET",n)},...u,...f,...h,...c,...o});return f.capLevelController===d1&&void 0!==l&&d1.setMaxAutoResolution(p,l),p.on(dn.Events.MANIFEST_PARSED,async function(e,i){var r,n;let a=null==(r=i.sessionData)?void 0:r["com.apple.hls.chapters"];(null!=a&&a.URI||null!=a&&a.VALUE.toLocaleLowerCase().startsWith("http"))&&ua(null!=(n=null==a?void 0:a.URI)?n:null==a?void 0:a.VALUE,t)}),p}},uw=e=>e===dc.LIVE?{backBufferLength:8}:{},uC=e=>{let{tokens:{drm:t}={},playbackId:i,drmTypeCb:r}=e,n=up(i);return t&&n?{emeEnabled:!0,drmSystems:{"com.apple.fps":{licenseUrl:uO(e,"fairplay"),serverCertificateUrl:ux(e,"fairplay")},"com.widevine.alpha":{licenseUrl:uO(e,"widevine")},"com.microsoft.playready":{licenseUrl:uO(e,"playready")}},requestMediaKeySystemAccessFunc:(e,t)=>("com.widevine.alpha"===e&&(t=[...t.map(e=>{var t;let i=null==(t=e.videoCapabilities)?void 0:t.map(e=>({...e,robustness:"HW_SECURE_ALL"}));return{...e,videoCapabilities:i}}),...t]),navigator.requestMediaKeySystemAccess(e,t).then(t=>{let i=(e=>e.includes("fps")?ut.FAIRPLAY:e.includes("playready")?ut.PLAYREADY:e.includes("widevine")?ut.WIDEVINE:void 0)(e);return null==r||r(i),t}))}:{}},uM=async e=>{let t=await fetch(e);return 200!==t.status?Promise.reject(t):await t.arrayBuffer()},uP=async(e,t)=>{let i=await fetch(t,{method:"POST",headers:{"Content-type":"application/octet-stream"},body:e});return 200!==i.status?Promise.reject(i):new Uint8Array(await i.arrayBuffer())},uO=(e,t)=>{let{playbackId:i,tokens:{drm:r}={},customDomain:n=uu}=e,a=up(i);return"https://license.".concat(n.toLocaleLowerCase().endsWith(uu)?n:uu,"/license/").concat(t,"/").concat(a,"?token=").concat(r)},ux=(e,t)=>{let{playbackId:i,tokens:{drm:r}={},customDomain:n=uu}=e,a=up(i);return"https://license.".concat(n.toLocaleLowerCase().endsWith(uu)?n:uu,"/appcert/").concat(t,"/").concat(a,"?token=").concat(r)},uN=e=>{let{playbackId:t,src:i,customDomain:r}=e;if(t)return!0;
3if("string"!=typeof i)return!1;let n=new URL(i,null==window?void 0:window.location.href).hostname.toLocaleLowerCase();return n.includes(uu)||!!r&&n.includes(r.toLocaleLowerCase())},uU=(e,t)=>{let i={};return i.capLevelToPlayerSize=e.capRenditionToPlayerSize,null==i.capLevelToPlayerSize?(i.capLevelController=d1,i.capLevelToPlayerSize=!0):i.capLevelController=sw,i},uF=(e,t,i)=>{var r;let{envKey:n,disableTracking:a,muxDataSDK:s=tH,muxDataSDKOptions:o={}}=e,l=uN(e),d=ud.get(t);if(d&&(d.muxDataDisableCookies=!!e.disableCookies),!a&&(n||l)){let{playerInitTime:a,playerSoftwareName:l,playerSoftwareVersion:d,beaconCollectionDomain:u,debug:h,disableCookies:c}=e,m={...e.metadata,video_title:(null==(r=null==e?void 0:e.metadata)?void 0:r.video_title)||void 0};s.monitor(t,{debug:h,beaconCollectionDomain:u,hlsjs:i,Hls:i?dn:void 0,automaticErrorTracking:!1,errorTranslator:t=>"string"!=typeof t.player_error_code&&("function"==typeof e.errorTranslator?e.errorTranslator(t):t),disableCookies:c,...o,data:{...n?{env_key:n}:{},player_software_name:l,player_software:l,player_software_version:d,player_init_time:a,...m}})}},uB=(e,t,i)=>{var r,n,a;let s=uL(e,t),{src:o,customDomain:l=uu}=e,d=()=>{t.ended||e.disablePseudoEnded||!uS(t,i)||(uA(t,i)?t.currentTime=t.buffered.end(t.buffered.length-1):t.dispatchEvent(new Event("ended")))},u,h,c=()=>{let e=uy(t),i,r;e.length>0&&(i=e.start(0),r=e.end(0)),(h!==r||u!==i)&&t.dispatchEvent(new CustomEvent("seekablechange",{composed:!0})),u=i,h=r};if(dy(t,"durationchange",c),t&&s){let i=dT(e);if("string"==typeof o){if(o.endsWith(".mp4")&&o.includes(l)){let e=ug(o);ua(new URL("https://stream.".concat(l,"/").concat(e,"/metadata.json")).toString(),t)}let a=()=>{if(uE(t)!==dc.LIVE||Number.isFinite(t.duration))return;let e=setInterval(c,1e3);t.addEventListener("teardown",()=>{clearInterval(e)},{once:!0}),dy(t,"durationchange",()=>{Number.isFinite(t.duration)&&clearInterval(e)})},s=async()=>un(o,t,i).then(a).catch(i=>{if(i instanceof Response){let r=dJ(i,da.VIDEO,e);if(r)return void uK(t,r)}});if("none"===t.preload){let e=()=>{s(),t.removeEventListener("loadedmetadata",i)},i=()=>{s(),t.removeEventListener("play",e)};dy(t,"play",e,{once:!0}),dy(t,"loadedmetadata",i,{once:!0})}else s();null!=(r=e.tokens)&&r.drm?((e,t)=>{let i={mediaEl:t,getAppCertificate:()=>uM(ux(e,"fairplay")).catch(t=>{if(t instanceof Response){let i=dJ(t,da.DRM,e);return console.error("mediaError",null==i?void 0:i.message,null==i?void 0:i.context),i?Promise.reject(i):Promise.reject(Error("Unexpected error in app cert request"))}return Promise.reject(t)}),getLicenseKey:t=>uP(t,uO(e,"fairplay")).catch(t=>{if(t instanceof Response){let i=dJ(t,da.DRM,e);return console.error("mediaError",null==i?void 0:i.message,null==i?void 0:i.context),i?Promise.reject(i):Promise.reject(Error("Unexpected error in license key request"))}return Promise.reject(t)}),saveAndDispatchError:uK,drmTypeCb:()=>{var t;null==(t=e.drmTypeCb)||t.call(e,ut.FAIRPLAY)}};if(e.useWebkitFairplay)(e=>{let{mediaEl:t,getAppCertificate:i,getLicenseKey:r,saveAndDispatchError:n,drmTypeCb:a}=e;if(!window.WebKitMediaKeys||!("onwebkitneedkey"in t)){console.error("No WebKitMediaKeys. FairPlay may not be supported");let e=new dd(dw("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,!0);return e.errorCategory=da.DRM,e.muxCode=ds.ENCRYPTED_CDM_ERROR,n(t,e),()=>{}}let s=i(),o=null,l=e=>{(async()=>{try{t.webkitKeys||d();let i=await s;if(null===e.initData||null==i)return;let r=((e,t)=>{let i=function(e){let t=new ArrayBuffer(2*e.length),i=new DataView(t);for(let t=0;t<e.length;t++)i.setUint16(2*t,e.charCodeAt(t),!0);return t}(ue(e)),r=new Uint8Array(e),n=new Uint8Array(i),a=new Uint8Array(t),s=new Uint8Array(r.byteLength+4+a.byteLength+4+n.byteLength),o=0,l=e=>{s.set(e,o),o+=e.byteLength},d=e=>{let t=new DataView(s.buffer),i=e.byteLength;t.setUint32(o,i,!0),o+=4,l(e)};return l(r),d(n),d(a),s})(e.initData,i);u(r)}catch(e){console.error("Could not start encrypted playback due to exception",e),n(t,e)}})()},d=()=>{try{let e=new WebKitMediaKeys("com.apple.fps.1_0");t.webkitSetMediaKeys(e),a()}catch(t){let e=new dd("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser.",dd.MEDIA_ERR_ENCRYPTED,!0);throw e.errorCategory=da.DRM,e.muxCode=ds.ENCRYPTED_UNSUPPORTED_
3KEY_SYSTEM,e}},u=e=>{let i=t.webkitKeys.createSession("application/vnd.apple.mpegurl",e),a=async e=>{try{let t=e.message,n=await r(t);i.update(n)}catch(e){console.error("Error on FairPlay session message",e),n(t,e)}},s=e=>{let i=e.target.error;if(!i)return;console.error("Internal Webkit Key Session Error - sysCode: ".concat(i.systemCode," code: ").concat(i.code));let r=new dd(dw("The DRM Content Decryption Module system had an internal failure. Try reloading the page, updating your browser, or playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,!0);r.errorCategory=da.DRM,r.muxCode=ds.ENCRYPTED_CDM_ERROR,n(t,r)},l=()=>{i.removeEventListener("webkitkeymessage",a),i.removeEventListener("webkitkeyerror",s),t.removeEventListener("teardown",l),"webkitCurrentPlaybackTargetIsWireless"in t&&t.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",l),o=null;try{i.close()}catch(e){}};"webkitCurrentPlaybackTargetIsWireless"in t&&t.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",l,{once:!0}),i.addEventListener("webkitkeymessage",a),i.addEventListener("webkitkeyerror",s),t.addEventListener("teardown",l),o=l},h=()=>{t.removeEventListener("webkitneedkey",l),t.removeEventListener("teardown",h),null==o||o();try{t.webkitSetMediaKeys(null)}catch(e){}};return t.addEventListener("webkitneedkey",l),t.addEventListener("teardown",h,{once:!0})})(i);else{let t=(e=>{let{mediaEl:t,getAppCertificate:i,getLicenseKey:r,saveAndDispatchError:n,drmTypeCb:a,fallbackToWebkitFairplay:s}=e,o=null,l=async e=>{try{let i=e.initDataType;if("skd"!==i)return void console.error('Received unexpected initialization data type "'.concat(i,'"'));t.mediaKeys||await d(i);let r=e.initData;if(null==r)return void console.error("Could not start encrypted playback due to missing initData in ".concat(e.type," event"));await u(i,r)}catch(e){n(t,e);return}},d=async e=>{let r=await navigator.requestMediaKeySystemAccess("com.apple.fps",[{initDataTypes:[e],videoCapabilities:[{contentType:"application/vnd.apple.mpegurl",robustness:""}],distinctiveIdentifier:"not-allowed",persistentState:"not-allowed",sessionTypes:["temporary"]}]).then(e=>(a(),e)).catch(()=>{let e=new dd(dw("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,!0);e.errorCategory=da.DRM,e.muxCode=ds.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM,n(t,e)});if(!r)return;let s=await r.createMediaKeys();try{let e=await i();await s.setServerCertificate(e).catch(()=>{let e=dw("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),t=new dd(e,dd.MEDIA_ERR_ENCRYPTED,!0);return t.errorCategory=da.DRM,t.muxCode=ds.ENCRYPTED_UPDATE_SERVER_CERT_FAILED,Promise.reject(t)})}catch(e){n(t,e);return}await t.setMediaKeys(s)},u=async(e,i)=>{let a=t.mediaKeys.createSession(),l=async e=>{let i=e.message,s=await r(i);try{await a.update(s)}catch(i){let e=new dd(dw("Failed to update DRM license. This may be an issue with the player or your protected content."),dd.MEDIA_ERR_ENCRYPTED,!0);e.errorCategory=da.DRM,e.muxCode=ds.ENCRYPTED_UPDATE_LICENSE_FAILED,n(t,e)}},d=()=>{a.keyStatuses.forEach(e=>(e=>{let i;"internal-error"===e?((i=new dd(dw("The DRM Content Decryption Module system had an internal failure. Try reloading the page, updating your browser, or playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,!0)).errorCategory=da.DRM,i.muxCode=ds.ENCRYPTED_CDM_ERROR):("output-restricted"===e||"output-downscaled"===e)&&((i=new dd(dw("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen."),dd.MEDIA_ERR_ENCRYPTED,!1)).errorCategory=da.DRM,i.muxCode=ds.ENCRYPTED_OUTPUT_RESTRICTED),i&&n(t,i)})(e))};a.addEventListener("keystatuseschange",d),a.addEventListener("message",l);let u=async()=>{a.removeEventListener("keystatuseschange",d),a.removeEventListener("message",l),"webkitCurrentPlaybackTargetIsWireless"in t&&t.removeEventListener("webkitcurrentplaybacktargetiswirelesschanged",u),t.removeEventListener("teardown",u),await a.close().catch(e=>{console.warn("There was an error when closing EME session",e)}),o=null};"webkitCurrentPlaybackTargetIsWireless"in t&&t.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",u,{once:!0}),t.addEventListener("teardown",u,{once:!0}),o=u,await a.generateRequest(e,i).catch(async e=>{if("NotSupportedError"===e.name&&"webkitCurrentPlaybackTargetIsWireless"in t&&t.webkitCurrentPlaybackTargetIsWireless)console.warn("Failed to generate a DRM license request. Attempting to fallback to Webkit DRM"),null==s||s();else{let t=new dd(dw("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),dd.MEDIA_ERR_ENCRYPTED,!0);return t.errorCategory=da.DRM,t.muxCode=ds.ENCRYPTED_GENERATE_REQUEST_FAILED,console.error("Failed to generate license request",e),Promise.reject(t)}})},h=async()=>{t.removeEventListener("encrypted",l),t.removeEventListener("teardown",h),o&&await o(),await t.setMediaKeys(null).cat
3ch(()=>{})};return t.addEventListener("encrypted",l),t.addEventListener("teardown",h,{once:!0}),h})({fallbackToWebkitFairplay:async()=>{var i;await t(),null==(i=e.fallbackToWebkitFairplay)||i.call(e)},...i})}})(e,t):dy(t,"encrypted",()=>{let e=new dd(dw("Attempting to play DRM-protected content without providing a DRM token."),dd.MEDIA_ERR_ENCRYPTED,!0);e.errorCategory=da.DRM,e.muxCode=ds.ENCRYPTED_MISSING_TOKEN,uK(t,e)},{once:!0}),t.setAttribute("src",o),e.startTime&&((null!=(n=ud.get(t))?n:{}).startTime=e.startTime,t.addEventListener("durationchange",uG,{once:!0}))}else t.removeAttribute("src");t.addEventListener("error",uH),t.addEventListener("error",uW),t.addEventListener("emptied",()=>{t.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})},{once:!0}),dy(t,"pause",d),dy(t,"seeked",d),dy(t,"play",()=>{t.ended||uT(t.currentTime,t.duration)&&(t.currentTime=t.seekable.length?t.seekable.start(0):0)})}else if(i&&o){i.once(dn.Events.LEVEL_LOADED,(e,r)=>{((e,t,i)=>{var r,n,a,s,o,l,d,u;let{streamType:h,targetLiveWindow:c,liveEdgeStartOffset:m,lowLatency:f}=(e=>{var t;let i=e.type,r=d_(i),n=dA(i),a,s=!!(null!=(t=e.partList)&&t.length);return r===dc.LIVE&&(a=s?2*e.partTarget:3*e.targetduration),{streamType:r,targetLiveWindow:n,liveEdgeStartOffset:a,lowLatency:s}})(e);if(h===dc.LIVE){f?(i.config.backBufferLength=null!=(r=i.userConfig.backBufferLength)?r:4,i.config.maxFragLookUpTolerance=null!=(n=i.userConfig.maxFragLookUpTolerance)?n:.001,i.config.abrBandWidthUpFactor=null!=(a=i.userConfig.abrBandWidthUpFactor)?a:i.config.abrBandWidthFactor):i.config.backBufferLength=null!=(s=i.userConfig.backBufferLength)?s:8;let e=Object.freeze({get length(){return t.seekable.length},start:e=>t.seekable.start(e),end(e){var r;return e>this.length||e<0||Number.isFinite(t.duration)?t.seekable.end(e):null!=(r=i.liveSyncPosition)?r:t.seekable.end(e)}});(null!=(o=ud.get(t))?o:{}).seekable=e}(null!=(l=ud.get(t))?l:{}).liveEdgeStartOffset=m,(null!=(d=ud.get(t))?d:{}).targetLiveWindow=c,t.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0})),(null!=(u=ud.get(t))?u:{}).streamType=h,t.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}))})(r.details,t,i),c(),uE(t)!==dc.LIVE||Number.isFinite(t.duration)||(i.on(dn.Events.LEVEL_UPDATED,c),dy(t,"durationchange",()=>{Number.isFinite(t.duration)&&i.off(dn.Events.LEVELS_UPDATED,c)}))});let r=null!=(a=e.maxReconnectRetries)?a:0,n=r>0?(e=>{var t;let{hls:i,mediaEl:r,src:n,muxMediaState:a,saveAndDispatchError:s,maxRetries:o}=e,l,d=0,u=!1,h=!1,c=!1,m=()=>{null!=l&&(clearTimeout(l),l=void 0)},f=e=>(null==e?void 0:e.muxCode)===ds.NETWORK_RECONNECTING,p=()=>{if(!c&&n)return void i.loadSource(n);i.startLoad(r.currentTime)},g=()=>{let e=a.get(r);!(null!=e&&e.networkError)||h||!r.paused&&r.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&((()=>{let e=a.get(r);if(f(null==e?void 0:e.error))return;let t=new dd(dw("Attempting to reconnect..."),dd.MEDIA_ERR_NETWORK,!1);t.errorCategory=da.VIDEO,t.muxCode=ds.NETWORK_RECONNECTING,e&&(e.error=t),r.dispatchEvent(new CustomEvent("error",{detail:t}))})(),(()=>{if(null==l&&!u){if(d>=o)return(()=>{u=!1,h=!0,m();let e=new dd(dw("Network error, try reloading."),dd.MEDIA_ERR_NETWORK,!0);e.errorCategory=da.VIDEO,e.reload=!0,s(r,e)})();u=!0,l=setTimeout(()=>{l=void 0,d+=1,p()},Math.min(1e3*2**d,3e4))}})())},v=()=>{let e=a.get(r);null!=e&&e.networkError&&(d=0,h=!1,m(),u=!0,p())};return null==(t=globalThis.addEventListener)||t.call(globalThis,"online",v),i.on(dn.Events.FRAG_BUFFERED,()=>{let e=a.get(r);e&&(e.networkError||f(e.error))&&(e.networkError=!1,u=!1,d=0,h=!1,m(),e.error&&(e.error=null,r.dispatchEvent(new Event("emptied"))))}),dy(r,"playing",()=>{let e=a.get(r);null!=e&&e.networkError&&(u=!1,d=0,h=!1,m(),e.error&&(e.error=null))}),dy(r,"waiting",g),r.addEventListener("teardown",()=>{var e;null==(e=globalThis.removeEventListener)||e.call(globalThis,"online",v),m()},{once:!0}),{handleHlsError:(e,t)=>{var i,n;if(e.type!==dn.ErrorTypes.NETWORK_ERROR)return!1;let s=null!=(n=null==(i=e.response)?void 0:i.code)?n:0;return(t.muxCode===ds.NETWORK_OFFLINE||0===s||s>=500)&&!!e.fatal&&((()=>{let e=a.get(r);e&&(e.networkError=!0),u=!1,g()})(),!0)},onManifestLoaded:()=>{c=!0,u=!1,m()}}})({hls:i,mediaEl:t,src:o,muxMediaState:ud,saveAndDispatchError:uK,maxRetries:r}):void 0;i.on(dn.Events.ERROR,(r,a)=>{var s,o;let l=uV(a,e);if(l.muxCode===ds.NETWORK_NOT_READY){let e=null!=(s=ud.get(t))?s:{},r=null!=(o=e.retryCount)?o:0;
3if(r<6){let n=0===r?5e3:6e4,s=new dd("Retrying in ".concat(n/1e3," seconds..."),l.code,l.fatal);Object.assign(s,l),uK(t,s);let o=setTimeout(()=>{e.retryCount=r+1,"manifestLoadError"===a.details&&a.url&&i.loadSource(a.url)},n);t.addEventListener("teardown",()=>clearTimeout(o),{once:!0});return}{e.retryCount=0;let i=new dd("Network error, try reloading.",l.code,l.fatal);Object.assign(i,l),i.reload=!0,uK(t,i);return}}null!=n&&n.handleHlsError(a,l)||uK(t,l)}),i.on(dn.Events.MANIFEST_LOADED,()=>{null==n||n.onManifestLoaded();let e=ud.get(t);null!=e&&e.networkError||e&&e.error&&(e.error=null,e.retryCount=0,t.dispatchEvent(new Event("emptied")),t.dispatchEvent(new Event("loadstart")))}),t.addEventListener("error",uW),dy(t,"waiting",d),function(e,t){var i;if(!("videoTracks"in e))return;let r=new WeakMap;t.on(dn.Events.MANIFEST_PARSED,function(t,i){o();let n=e.addVideoTrack("main");for(let[e,t]of(n.selected=!0,i.levels.entries())){let i=n.addRendition(t.url[0],t.width,t.height,t.videoCodec,t.bitrate);r.set(t,"".concat(e)),i.id="".concat(e)}}),t.on(dn.Events.AUDIO_TRACKS_UPDATED,function(t,i){for(let t of(s(),i.audioTracks)){let i=t.default?"main":"alternative",r=e.addAudioTrack(i,t.name,t.lang);r.id="".concat(t.id),t.default&&(r.enabled=!0)}});let n=()=>{var i;let r=+(null==(i=[...e.audioTracks].find(e=>e.enabled))?void 0:i.id),n=t.audioTracks.map(e=>e.id);r!=t.audioTrack&&n.includes(r)&&(t.audioTrack=r)};e.audioTracks.addEventListener("change",n),t.on(dn.Events.LEVELS_UPDATED,function(t,i){var n;let a=e.videoTracks[null!=(n=e.videoTracks.selectedIndex)?n:0];if(!a)return;let s=i.levels.map(e=>r.get(e));for(let t of e.videoRenditions)t.id&&!s.includes(t.id)&&a.removeRendition(t)});let a=e=>{let i=e.target.selectedIndex;i!=t.nextLevel&&(t.nextLevel=i)};null==(i=e.videoRenditions)||i.addEventListener("change",a);let s=()=>{for(let t of e.audioTracks)e.removeAudioTrack(t)},o=()=>{(()=>{for(let t of e.videoTracks)e.removeVideoTrack(t)})(),s()};t.once(dn.Events.DESTROYING,()=>{var t,i;o(),null==(t=e.audioTracks)||t.removeEventListener("change",n),null==(i=e.videoRenditions)||i.removeEventListener("change",a)})}(e,i),function(e,t){t.on(dn.Events.NON_NATIVE_TEXT_TRACKS_FOUND,(i,r)=>{let{tracks:n}=r;n.forEach(i=>{var r,n;let a=null!=(r=i.subtitleTrack)?r:i.closedCaptions,s=t.subtitleTracks.findIndex(e=>{let{lang:t,name:r,type:n}=e;return t==(null==a?void 0:a.lang)&&r===i.label&&n.toLowerCase()===i.kind}),o=(null!=(n=i._id)?n:i.default)?"default":"".concat(i.kind).concat(s);dN(e,i.kind,i.label,null==a?void 0:a.lang,o,i.default)})});let i=()=>{if(!t.subtitleTracks.length)return;let i=Array.from(e.textTracks).find(e=>e.id&&"showing"===e.mode&&["subtitles","captions"].includes(e.kind));if(!i)return;let r=t.subtitleTracks[t.subtitleTrack],n=r?r.default?"default":"".concat(t.subtitleTracks[t.subtitleTrack].type.toLowerCase()).concat(t.subtitleTrack):void 0;if(t.subtitleTrack<0||(null==i?void 0:i.id)!==n){let e=t.subtitleTracks.findIndex(e=>{let{lang:t,name:r,type:n,default:a}=e;return"default"===i.id&&a||t==i.language&&r===i.label&&n.toLowerCase()===i.kind});t.subtitleTrack=e}(null==i?void 0:i.id)===n&&i.cues&&Array.from(i.cues).forEach(e=>{i.addCue(e)})};e.textTracks.addEventListener("change",i),t.on(dn.Events.CUES_PARSED,(t,i)=>{let{track:r,cues:n}=i,a=e.textTracks.getTrackById(r);if(!a)return;let s="disabled"===a.mode;s&&(a.mode="hidden"),n.forEach(e=>{var t;null!=(t=a.cues)&&t.getCueById(e.id)||a.addCue(e)}),s&&(a.mode="disabled")}),t.once(dn.Events.DESTROYING,()=>{e.textTracks.removeEventListener("change",i),e.querySelectorAll("track[data-removeondestroy]").forEach(e=>{e.remove()})});let r=()=>
3{Array.from(e.textTracks).forEach(t=>{var i,r;if(!["subtitles","caption"].includes(t.kind)&&("thumbnails"===t.label||"chapters"===t.kind)){if(!(null!=(i=t.cues)&&i.length)){let i="track";t.kind&&(i+='[kind="'.concat(t.kind,'"]')),t.label&&(i+='[label="'.concat(t.label,'"]'));let n=e.querySelector(i),a=null!=(r=null==n?void 0:n.getAttribute("src"))?r:"";null==n||n.removeAttribute("src"),setTimeout(()=>{null==n||n.setAttribute("src",a)},0)}"hidden"!==t.mode&&(t.mode="hidden")}})};t.once(dn.Events.MANIFEST_LOADED,r),t.once(dn.Events.MEDIA_ATTACHED,r)}(t,i),i.attachMedia(t)}else 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 uG(e){var t;let i=e.target,r=null==(t=ud.get(i))?void 0:t.startTime;if(r&&function(e,t,i){t&&i>t&&(i=t);for(let t=0;t<e.length;t++)if(e.start(t)<=i&&e.end(t)>=i)return!0;return!1}(i.seekable,i.duration,r)){let e="auto"===i.preload;e&&(i.preload="none"),i.currentTime=r,e&&(i.preload="auto")}}async function uH(e){if(!e.isTrusted)return;e.stopImmediatePropagation();let t=e.target;if(!(null!=t&&t.error))return;let{message:i,code:r}=t.error,n=new dd(i,r);if(t.src&&r===dd.MEDIA_ERR_SRC_NOT_SUPPORTED&&t.readyState===HTMLMediaElement.HAVE_NOTHING)return void setTimeout(()=>{var e;let i=null!=(e=uv(t))?e:t.error;(null==i?void 0:i.code)===dd.MEDIA_ERR_SRC_NOT_SUPPORTED&&uK(t,n)},500);if(t.src&&(r!==dd.MEDIA_ERR_DECODE||void 0!==r))try{let{status:e}=await fetch(t.src);n.data={response:{code:e}}}catch(e){}uK(t,n)}function uK(e,t){var i;t.fatal&&((null!=(i=ud.get(e))?i:{}).error=t,e.dispatchEvent(new CustomEvent("error",{detail:t})))}function uW(e){var t,i;if(!(e instanceof CustomEvent)||!(e.detail instanceof dd))return;let r=e.target,n=e.detail;n&&n.fatal&&((null!=(t=ud.get(r))?t:{}).error=n,null==(i=r.mux)||i.emit("error",{player_error_code:n.code,player_error_message:n.message,player_error_context:n.context}))}var uV=(e,t)=>{var i,r,n;e.fatal?console.error("getErrorFromHlsErrorData()",e):t.debug&&console.warn("getErrorFromHlsErrorData() (non-fatal)",e);let a={[dn.ErrorTypes.NETWORK_ERROR]:dd.MEDIA_ERR_NETWORK,[dn.ErrorTypes.MEDIA_ERROR]:dd.MEDIA_ERR_DECODE,[dn.ErrorTypes.KEY_SYSTEM_ERROR]:dd.MEDIA_ERR_ENCRYPTED},s,o=(e=>[dn.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,dn.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED].includes(e.details)?dd.MEDIA_ERR_NETWORK:a[e.type])(e);if(o===dd.MEDIA_ERR_NETWORK&&e.response){let n=null!=(i=(e=>e.type===dn.ErrorTypes.KEY_SYSTEM_ERROR?da.DRM:e.type===dn.ErrorTypes.NETWORK_ERROR?da.VIDEO:void 0)(e))?i:da.VIDEO;s=null!=(r=dJ(e.response,n,t,e.fatal))?r:new dd("",o,e.fatal)}else o===dd.MEDIA_ERR_ENCRYPTED?e.details===dn.ErrorDetails.KEY_SYSTEM_NO_CONFIGURED_LICENSE?((s=new dd(dw("Attempting to play DRM-protected content without providing a DRM token."),dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_MISSING_TOKEN):e.details===dn.ErrorDetails.KEY_SYSTEM_NO_ACCESS?((s=new dd(dw("Cannot play DRM-protected content with current security configuration on this browser. Try playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_UNSUPPORTED_KEY_SYSTEM):e.details===dn.ErrorDetails.KEY_SYSTEM_NO_SESSION?((s=new dd(dw("Failed to generate a DRM license request. This may be an issue with the player or your protected content."),dd.MEDIA_ERR_ENCRYPTED,!0)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_GENERATE_REQUEST_FAILED):e.details===dn.ErrorDetails.KEY_SYSTEM_SESSION_UPDATE_FAILED?((s=new dd(dw("Failed to update DRM license. This may be an issue with the player or your protected content."),dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_UPDATE_LICENSE_FAILED):e.details===dn.ErrorDetails.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED?((s=new dd(dw("Your server certificate failed when attempting to set it. This may be an issue with a no longer valid certificate."),dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_UPDATE_SERVER_CERT_FAILED):e.details===dn.ErrorDetails.KEY_SYSTEM_STATUS_INTERNAL_ERROR?((s=new dd(dw("The DRM Content Decryption Module system had an internal failure. Try reloading the page, updating your browser, or playing in another browser."),dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_CDM_ER
3ROR):e.details===dn.ErrorDetails.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED?((s=new dd(dw("DRM playback is being attempted in an environment that is not sufficiently secure. User may see black screen."),dd.MEDIA_ERR_ENCRYPTED,!1)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_OUTPUT_RESTRICTED):((s=new dd(e.error.message,dd.MEDIA_ERR_ENCRYPTED,e.fatal)).errorCategory=da.DRM,s.muxCode=ds.ENCRYPTED_ERROR):s=new dd("",o,e.fatal);return s.context||(s.context="".concat(e.url?"url: ".concat(e.url,"\n"):"").concat(e.response&&(e.response.code||e.response.text)?"response: ".concat(e.response.code,", ").concat(e.response.text,"\n"):"").concat(e.reason?"failure reason: ".concat(e.reason,"\n"):"").concat(e.level?"level: ".concat(e.level,"\n"):"").concat(e.parent?"parent stream controller: ".concat(e.parent,"\n"):"").concat(e.buffer?"buffer length: ".concat(e.buffer,"\n"):"").concat(e.error?"error: ".concat(e.error,"\n"):"").concat(e.event?"event: ".concat(e.event,"\n"):"").concat(e.err?"error message: ".concat(null==(n=e.err)?void 0:n.message,"\n"):"")),s.data=e,s},uq=e.i(376054),uY=e.i(136927),uj=e.i(550475),uz=e.i(42297),uQ=e.i(474754),uX=e.i(473471);function uZ(e,t){if(e!==t)throw TypeError("Private static access of wrong provenance")}function uJ(e,t){if(void 0===e)throw TypeError("attempted to "+t+" private static field before its declaration")}var u$=e.i(54763),u0=e.i(868275);let u1=["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"],u2=["autopictureinpicture","disablepictureinpicture","disableremoteplayback","autoplay","controls","controlslist","crossorigin","loop","muted","playsinline","poster","preload","src"];function u3(e){return'\n    <style>\n      :host {\n        display: inline-flex;\n        line-height: 0;\n        flex-direction: column;\n        justify-content: end;\n      }\n\n      audio {\n        width: 100%;\n      }\n    </style>\n    <slot name="media">\n      <audio'.concat(u8(e),"></audio>\n    </slot>\n    <slot></slot>\n  ")}function u4(e){return'\n    <style>\n      :host {\n        display: inline-block;\n        line-height: 0;\n      }\n\n      video {\n        max-width: 100%;\n        max-height: 100%;\n        min-width: 100%;\n        min-height: 100%;\n        object-fit: var(--media-object-fit, contain);\n        object-position: var(--media-object-position, 50% 50%);\n      }\n\n      video::-webkit-media-text-track-container {\n        transform: var(--media-webkit-text-track-transform);\n        transition: var(--media-webkit-text-track-transition);\n      }\n    </style>\n    <slot name="media">\n      <video'.concat(u8(e),"></video>\n    </slot>\n    <slot></slot>\n  ")}function u5(e,t){var i,r,n,a,s,o,l,d,u,h,c,m,f,p,g,v;let{tag:E,is:y}=t,b=null==(r=globalThis.document)||null==(i=r.createElement)?void 0:i.call(r,E,{is:y}),T=b?function(e){let t=[];for(let i=Object.getPrototypeOf(e);i&&i!==HTMLElement.prototype;i=Object.getPrototypeOf(i)){let e=Object.getOwnPropertyNames(i);t.push(...e)}return t}(b):[];return n=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakMap,l=new WeakMap,d=new WeakSet,u=new WeakSet,h=new WeakSet,c=new WeakSet,m=new WeakSet,f=new WeakSet,p=new WeakSet,g=class t extends e{static get observedAttributes(){var e,i;return(uZ(t,g),A).call(g),[...null!=(i=null==b||null==(e=b.constructor)?void 0:e.observedAttributes)?i:[],...u2]}get nativeEl(){var e,t,i,r,n;return(0,uz._)(this,d,S).call(this),null!=(n=null!=(r=null!=(i=null!=(t=(0,uq._)(this,a))?t:this.querySelector(":scope > [slot=media]"))?i:this.querySelector(E))?r:null==(e=this.shadowRoot)?void 0:e.querySelector(E))?n:null}set nativeEl(e){(0,uj._)(this,a,e)}get defaultMuted(){return this.hasAttribute("muted")}set defaultMuted(e){this.toggleAttribute("muted",e)}get src(){return this.getAttribute("src")}set src(e){this.setAttribute("src","".concat(e))}get preload(){var e,t;return null!=(t=this.getAttribute("preload"))?t:null==(e=this.nativeEl)?void 0:e.preload}set preload(e){this.setAttribute("preload","".concat(e))}init(){if(!this.shadowRoot){this.attachShadow({mode:"open"});let e=function(e){let t={};for(let i of e)t[i.name]=i.value;return t}(this.attributes);
3y&&(e.is=y),E&&(e.part=E),this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}for(let e of(this.nativeEl.muted=this.hasAttribute("muted"),T))(0,uz._)(this,f,D).call(this,e);(0,uz._)(this,u,R).call(this)}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{detail:e.detail}))}attributeChangedCallback(e,t,i){(0,uz._)(this,d,S).call(this),(0,uz._)(this,p,w).call(this,e,t,i)}connectedCallback(){(0,uz._)(this,d,S).call(this),(0,uq._)(this,l)||(0,uz._)(this,u,R).call(this)}disconnectedCallback(){var e,t,i;for(let r of(null==(e=(0,uq._)(this,o))||e.disconnect(),(0,uj._)(this,o,void 0),(0,uq._)(this,l)&&(null==(t=this.shadowRoot)||t.removeEventListener("slotchange",(0,uq._)(this,l)),(0,uj._)(this,l,void 0)),this.constructor.Events))null==(i=this.shadowRoot)||i.removeEventListener(r,this,!0);(0,uq._)(this,s).forEach(e=>e.remove()),(0,uq._)(this,s).clear(),(0,uj._)(this,a,null)}constructor(...e){super(...e),(0,uQ._)(this,d),(0,uQ._)(this,u),(0,uQ._)(this,h),(0,uQ._)(this,c),(0,uQ._)(this,m),(0,uQ._)(this,f),(0,uQ._)(this,p),(0,uY._)(this,n,{writable:!0,value:!1}),(0,uY._)(this,a,{writable:!0,value:null}),(0,uY._)(this,s,{writable:!0,value:new Map}),(0,uY._)(this,o,{writable:!0,value:void 0}),(0,uY._)(this,l,{writable:!0,value:void 0}),(0,u0._)(this,"get",void 0),(0,u0._)(this,"set",void 0),(0,u0._)(this,"call",void 0)}},(0,u0._)(g,"getTemplateHTML",E.endsWith("audio")?u3:u4),(0,u0._)(g,"shadowRootOptions",{mode:"open"}),(0,u0._)(g,"Events",u1),v={writable:!0,value:!1},g;function A(){if(uZ(this,g),uJ(v,"get"),(0,uX._)(this,v))return;uZ(this,g),uJ(v,"set"),(0,u$._)(this,v,!0);let e=new Set(this.observedAttributes);for(let t of(e.delete("muted"),T))if(!(t in this.prototype))if("function"==typeof b[t])this.prototype[t]=function(){for(var e=arguments.length,i=Array(e),r=0;r<e;r++)i[r]=arguments[r];return(0,uz._)(this,d,S).call(this),(()=>{var e;if(this.call)return this.call(t,...i);let r=null==(e=this.nativeEl)?void 0:e[t];return null==r?void 0:r.apply(this.nativeEl,i)})()};else{let i={get(){var i,r,n;(0,uz._)(this,d,S).call(this);let a=t.toLowerCase();if(e.has(a)){let e=this.getAttribute(a);return null!==e&&(""===e||e)}return null!=(n=null==(i=this.get)?void 0:i.call(this,t))?n:null==(r=this.nativeEl)?void 0:r[t]}};t!==t.toUpperCase()&&(i.set=function(i){(0,uz._)(this,d,S).call(this);let r=t.toLowerCase();return e.has(r)?void(!0===i||!1===i||null==i?this.toggleAttribute(r,!!i):this.setAttribute(r,i)):this.set?void this.set(t,i):void(this.nativeEl&&(this.nativeEl[t]=i))}),Object.defineProperty(this.prototype,t,i)}}function S(){(0,uq._)(this,n)||((0,uj._)(this,n,!0),this.init())}function R(){var e,t;for(let i of((0,uj._)(this,o,new MutationObserver((0,uz._)(this,c,I).bind(this))),(0,uj._)(this,l,()=>(0,uz._)(this,h,k).call(this)),null==(e=this.shadowRoot)||e.addEventListener("slotchange",(0,uq._)(this,l)),(0,uz._)(this,h,k).call(this),this.constructor.Events))null==(t=this.shadowRoot)||t.addEventListener(i,this,!0)}function k(){var e;let t=new Map((0,uq._)(this,s)),i=null==(e=this.shadowRoot)?void 0:e.querySelector("slot:not([name])");(null==i?void 0:i.assignedElements({flatten:!0}).filter(e=>["track","source"].includes(e.localName))).forEach(e=>{var i,r;t.delete(e);let n=(0,uq._)(this,s).get(e);n||(n=e.cloneNode(),(0,uq._)(this,s).set(e,n),null==(r=(0,uq._)(this,o))||r.observe(e,{attributes:!0})),null==(i=this.nativeEl)||i.append(n),(0,uz._)(this,m,L).call(this,n)}),t.forEach((e,t)=>{e.remove(),(0,uq._)(this,s).delete(t)})}function I(e){for(let i of e)if("attributes"===i.type){let{target:e,attributeName:r}=i,n=(0,uq._)(this,s).get(e);if(n&&r){var t;n.setAttribute(r,null!=(t=e.getAttribute(r))?t:""),(0,uz._)(this,m,L).call(this,n)}}}function L(e){e&&"track"===e.localName&&e.default&&("chapters"===e.kind||"metadata"===e.kind)&&"disabled"===e.track.mode&&(e.track.mode="hidden")}function D(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}}function w(e,t,i){var r,n,a;!["id","class"].includes(e)&&(!g.observedAttributes.includes(e)&&this.constructor.observedAttributes.includes(e)||(null===i?null==(n=this.nativeEl)||n.removeAttribute(e):(null==(r=this.nativeEl)?void 0:r.getAttribute(e))!==i&&(null==(a=this.nativeEl)||a.setAttribute(e,i))))}}function u8(e){let t="";for(let i in e){if(!u2.includes(i))continue;let r=e[i];""===r?t+=" ".concat(i):t+=" ".concat(i,'="').concat(r,'"')}return t}let u6=u5(null!=(u9=globalThis.HTMLElement)?u9:class{},{tag:"video"});u5(null!=(u7=globalThis.HTMLElement)?u7:class{},{tag:"audio"});var u9,u7,he,ht,hi,hr,hn,ha,hs,ho,hl,hd,hu,hh,hc,hm,hf=e=>{throw TypeError(e)},hp=(e,t,i)=>t.has(e)||hf("Cannot "+i),hg=(e,t,i)=>(hp(e,t,"read from private field"),i?i.call(e):t.get(e)),hv=(e,t,i)=>t.has(e)?hf("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),hE=(e,t,i,r)=>(hp(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),hy=(e,t,i)=>(hp(e,t,"access private method"),i),hb=(()=>{try{return"0.31.4"}catch(e){}return"UNKNOWN"})(),hT={BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",DEBUG:"debug",DISABLE_TRACKING:"disable-tracking",DISABLE_COOKIES:"disable-cookies",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended",MAX_RECONNECT_RETRIES:"max-reconnect-retries",DRM_TOKEN:"drm-token",PLAYBACK_TOKEN:"playback-token",ENV_KEY:"env-key",MAX_RESOLUTION:"max-resolution",MIN_RESOLUTION:"min-resolution",MAX_AUTO_RESOLUTION:"max-auto-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",CAP_RENDITION_TO_PLAYER_SIZE:"cap-rendition-to-player-size",INITIAL_BANDWIDTH_ESTIMATE_KBPS:"initial-bandwidth-estimate-kbps",INITIAL_ESTIMATE_SEGMENTS:"initial-estimate-segments",MIN_PRELOAD_SEGMENTS:"min-preload-segments"},h_=Object.values(hT),hA="mux-video",hS=class extends u6{static get NAME(){return hA}static get VERSION(){return hb}static get observedAttributes(){var e;return[...h_,...null!=(e=u6.observedAttributes)?e:[]]}static getLogoHTML(e){return e&&"false"!==e?"default"===e?'\n<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.12
31 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>':'<img part="logo" src="'.concat(e,'" />'):""}static getTemplateHTML(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return"\n      ".concat(u6.getTemplateHTML(t),'\n      <style>\n        :host {\n          position: relative;\n        }\n        slot[name="logo"] {\n          display: flex;\n          justify-content: end;\n          position: absolute;\n          top: 1rem;\n          right: 1rem;\n          opacity: 0;\n          transition: opacity 0.25s ease-in-out;\n          z-index: 1;\n        }\n        slot[name="logo"]:has([part="logo"]) {\n          opacity: 1;\n        }\n        slot[name="logo"] [part="logo"] {\n          width: 5rem;\n          pointer-events: none;\n          user-select: none;\n        }\n      </style>\n      <slot name="logo">\n        ').concat(this.getLogoHTML(null!=(e=t[hT.LOGO])?e:""),"\n      </slot>\n    ")}get preferCmcd(){var e;return null!=(e=this.getAttribute(hT.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?dp.includes(e)?this.setAttribute(hT.PREFER_CMCD,e):console.warn("Invalid value for preferCmcd. Must be one of ".concat(dp.join())):this.removeAttribute(hT.PREFER_CMCD))}get playerInitTime(){return this.hasAttribute(hT.PLAYER_INIT_TIME)?+this.getAttribute(hT.PLAYER_INIT_TIME):hg(this,ht)}set playerInitTime(e){e!=this.playerInitTime&&(null==e?this.removeAttribute(hT.PLAYER_INIT_TIME):this.setAttribute(hT.PLAYER_INIT_TIME,"".concat(+e)))}get playerSoftwareName(){var e;return null!=(e=hg(this,hs))?e:hA}set playerSoftwareName(e){hE(this,hs,e)}get playerSoftwareVersion(){var e;return null!=(e=hg(this,ha))?e:hb}set playerSoftwareVersion(e){hE(this,ha,e)}get _hls(){var e;return null==(e=hg(this,hu,hh))?void 0:e.engine}get mux(){var e;return null==(e=this.nativeEl)?void 0:e.mux}get error(){var e;return null!=(e=uv(this.nativeEl))?e:null}get errorTranslator(){return hg(this,ho)}set errorTranslator(e){hE(this,ho,e)}get src(){return this.getAttribute("src")}set src(e){e!==this.src&&(null==e?this.removeAttribute("src"):this.setAttribute("src",e))}get type(){var e;return null!=(e=this.getAttribute(hT.TYPE))?e:void 0}set type(e){e!==this.type&&(e?this.setAttribute(hT.TYPE,e):this.removeAttribute(hT.TYPE))}get preload(){let e=this.getAttribute("preload");return""===e?"auto":["none","metadata","auto"].includes(e)?e:super.preload}set preload(e){e!=this.getAttribute("preload")&&(["","none","metadata","auto"].includes(e)?this.setAttribute("preload",e):this.removeAttribute("preload"))}get debug(){return null!=this.getAttribute(hT.DEBUG)}set debug(e){e!==this.debug&&(e?this.setAttribute(hT.DEBUG,""):this.removeAttribute(hT.DEBUG))}get disableTracking(){return this.hasAttribute(hT.DISABLE_TRACKING)}set disableTracking(e){e!==this.disableTracking&&this.toggleAttribute(hT.DISABLE_TRACKING,!!e)}get disableCookies(){return this.hasAttribute(hT.DISABLE_COOKIES)}set disableCookies(e){e!==this.disableCookies&&(e?this.setAttribute(hT.DISABLE_COOKIES,""):this.removeAttribute(hT.DISABLE_COOKIES))}get disablePseudoEnded(){return this.hasAttribute(hT.DISABLE_PSEUDO_ENDED)}set disablePseudoEnded(e){e!==this.disablePseudoEnded&&(e?this.setAttribute(hT.DISABLE_PSEUDO_ENDED,""):this.removeAttribute(hT.DISABLE_PSEUDO_ENDED))}get maxReconnectRetries(){let e=this.getAttribute(hT.MAX_RECONNECT_RETRIES);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set maxReconnectRetries(e){e!==this.maxReconnectRetries&&(null==e?this.removeAttribute(hT.MAX_RECONNECT_RETRIES):this.setAttribute(hT.MAX_RECONNECT_RETRIES,"".concat(e)))}get startTime(){let e=this.getAttribute(hT.START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set startTime(e){e!==this.startTime&&(null==e?this.removeAttribute(hT.START_TIME):this.setAttribute(hT.START_TIME,"".concat(e)))}get initialBandwidthEstimateKbps(){let e=this.getAttribute(hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set initialBandwidthEstimateKbps(e){e!==this.initialBandwidthEstimateKbps&&(null==e?this.removeAttribute(hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS):this.setAttribute(hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS,"".concat(e)))}get initialEstimateSegments(){let e=this.getAttribute(hT.INITIAL_ESTIMATE_SEGMENTS);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set initialEstimateSegments(e){e!==this.initialEstimateSegments&&(null==e?this.removeAttribute(hT.INITIAL_ESTIMATE_SEGMENTS):this.setAttribute(hT.INITIAL_ESTIMATE_SEGMENTS,"".concat(e)))}get minPreloadSegments(){let e=this.getAttribute(hT.MIN_PRELOAD_SEGMENTS);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set minPreloadSegments(e){e!==this.minPreloadSegments&&(null==e?this.removeAttribute(hT.MIN_PRELOAD_SEGMENTS):this.setAttribute(hT.MIN_PRELOAD_SEGMENTS,"".concat(e)))}get playbackId(){var e;return this.hasAttribute(hT.PLAYBACK_ID)?this.getAttribute(hT.PLAYBACK_ID):null!=(e=ug(this.src))?e:void 0}set playbackId(e){e!==this.playbackId&&(e?this.setAttribute(hT.PLAYBACK_ID,e):this.removeAttribute(hT.PLAYBACK_ID))}get maxResolution(){var e;return null!=(e=this.getAttribute(hT.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(hT.MAX_RESOLUTION,e):this.removeAttribute(hT.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(hT.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(hT.MIN_RESOLUTION,e):this.removeAttribute(hT.MIN_RESOLUTION))}get maxAutoResolution(){var e;return null!=(e=this.getAttribute(hT.MAX_AUTO_RESOLUTION))?e:void 0}set maxAutoResolution(e){null==e?this.removeAttribute(hT.MAX_AUTO_RESOLUTION):this.setAttribute(hT.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return null!=(e=this.getAttribute(hT.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(hT.RENDITION_ORDER,e):this.removeAttribute(hT.RENDITION_ORDER))}get programStartTime(){let e=this.getAttribute(hT.PROGRAM_START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programStartTime(e){null==e?this.removeAttribute(hT.PROGRAM_START_TIME):this.setAttribute(hT.PROGRAM_START_TIME,"".concat(e))}get programEndTime(){let e=this.getAttribute(hT.PROGRAM_END_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set programEndTime(e){null==e?this.removeAttribute(hT.PROGRAM_END_TIME):this.setAttribute(hT.PROGRAM_END_TIME,"".concat(e))}get assetStartTime(){let e=this.getAttribute(hT.ASSET_START_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetStartTime(e){null==e?this.removeAttribute(hT.ASSET_START_TIME):this.setAttribute(hT.ASSET_START_TIME,"".concat(e))}get assetEndTime(){let e=this.getAttribute(hT.ASSET_END_TIME);if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}set assetEndTime(e){null==e?this.removeAttribute(hT.ASSET_END_TIME):this.setAttribute(hT.ASSET_END_TIME,"".concat(e))}get customDomain(){var e;return null!=(e=this.getAttribute(hT.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(hT.CUSTOM_DOMAIN,e):this.removeAttribute(hT.CUSTOM_DOMAIN))}get capRenditionToPlayerSize(){var e;return(null==(e=this._hlsConfig)?void 0:e.capLevelToPlayerSize)!=null?this._hlsConfig.capLevelToPlayerSize:hg(this,hc)}set capRenditionToPlayerSize(e){hE(this,hc,e)}get drmToken(){var e;return null!=(e=this.getAttribute(hT.DRM_TOKEN))?e:void 0}
3set drmToken(e){e!==this.drmToken&&(e?this.setAttribute(hT.DRM_TOKEN,e):this.removeAttribute(hT.DRM_TOKEN))}get playbackToken(){var e,t,i,r;if(this.hasAttribute(hT.PLAYBACK_TOKEN))return null!=(e=this.getAttribute(hT.PLAYBACK_TOKEN))?e:void 0;if(this.hasAttribute(hT.PLAYBACK_ID)){let[,e]=db(null!=(t=this.playbackId)?t:"");return null!=(i=new URLSearchParams(e).get("token"))?i:void 0}if(this.src)return null!=(r=new URLSearchParams(this.src).get("token"))?r:void 0}set playbackToken(e){e!==this.playbackToken&&(e?this.setAttribute(hT.PLAYBACK_TOKEN,e):this.removeAttribute(hT.PLAYBACK_TOKEN))}get tokens(){let e=this.getAttribute(hT.PLAYBACK_TOKEN),t=this.getAttribute(hT.DRM_TOKEN);return{...hg(this,hr),...null!=e?{playback:e}:{},...null!=t?{drm:t}:{}}}set tokens(e){hE(this,hr,null!=e?e:{})}get ended(){return uS(this.nativeEl,this._hls)}get envKey(){var e;return null!=(e=this.getAttribute(hT.ENV_KEY))?e:void 0}set envKey(e){e!==this.envKey&&(e?this.setAttribute(hT.ENV_KEY,e):this.removeAttribute(hT.ENV_KEY))}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(hT.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(hT.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(hT.BEACON_COLLECTION_DOMAIN))}get streamType(){var e;return null!=(e=this.getAttribute(hT.STREAM_TYPE))?e:uE(this.nativeEl)}set streamType(e){e!==this.streamType&&(e?this.setAttribute(hT.STREAM_TYPE,e):this.removeAttribute(hT.STREAM_TYPE))}get targetLiveWindow(){var e,t,i;return this.hasAttribute(hT.TARGET_LIVE_WINDOW)?+this.getAttribute(hT.TARGET_LIVE_WINDOW):(e=this.nativeEl,null!=(i=null==(t=ud.get(e))?void 0:t.targetLiveWindow)?i:NaN)}set targetLiveWindow(e){e!=this.targetLiveWindow&&(null==e?this.removeAttribute(hT.TARGET_LIVE_WINDOW):this.setAttribute(hT.TARGET_LIVE_WINDOW,"".concat(+e)))}get liveEdgeStart(){var e,t;if(this.hasAttribute(hT.LIVE_EDGE_OFFSET)){let{liveEdgeOffset:i}=this,r=null!=(e=this.nativeEl.seekable.end(0))?e:0;return Math.max(null!=(t=this.nativeEl.seekable.start(0))?t:0,r-i)}return(e=>{var t;let i=null==(t=ud.get(e))?void 0:t.liveEdgeStartOffset;if("number"!=typeof i)return NaN;let r=uy(e);return r.length?r.end(r.length-1)-i:NaN})(this.nativeEl)}get liveEdgeOffset(){if(this.hasAttribute(hT.LIVE_EDGE_OFFSET))return+this.getAttribute(hT.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){e!=this.liveEdgeOffset&&(null==e?this.removeAttribute(hT.LIVE_EDGE_OFFSET):this.setAttribute(hT.LIVE_EDGE_OFFSET,"".concat(+e)))}get seekable(){return uy(this.nativeEl)}async addCuePoints(e){return this.nativeEl.currentSrc||console.warn("addCuePoints() was called before the media element has loaded. Wait for the loadstart event before calling addCuePoints()."),dH(this.nativeEl,e)}get activeCuePoint(){return dW(this.nativeEl)}get cuePoints(){return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{label:dB},i=dU(e,t.label,"metadata");return null!=i&&i.cues?Array.from(i.cues,e=>dK(e)):[]}(this.nativeEl)}async addChapters(e){return this.nativeEl.currentSrc||console.warn("addChapters() was called before the media element has loaded. Wait for the loadstart event before calling addChapters()."),dz(this.nativeEl,e)}get activeChapter(){return dQ(this.nativeEl)}get chapters(){return function(e){var t;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{label:dq},r=dU(e,i.label,"chapters");return null!=(t=null==r?void 0:r.cues)&&t.length?Array.from(r.cues,e=>dj(e)):[]}(this.nativeEl)}getStartDate(){return function(e,t){if(t){let i=t.playingDate;if(null!=i)return new Date(i.getTime()-1e3*e.currentTime)}return"function"==typeof e.getStartDate?e.getStartDate():new Date(NaN)}(this.nativeEl,this._hls)}get currentPdt(){var e,t;return e=this.nativeEl,(t=this._hls)&&t.playingDate?t.playingDate:new Date("function"==typeof e.getStartDate?e.getStartDate().getTime()+1e3*e.currentTime:NaN)}get preferPlayback(){let e=this.getAttribute(hT.PREFER_PLAYBACK);if(e===dm.MSE||e===dm.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===dm.MSE||e===dm.NATIVE?this.setAttribute(hT.PREFER_PLAYBACK,e):this.removeAttribute(hT.PREFER_PLAYBACK))}get metadata(){return{...this.getAttributeNames().filter(e=>e.startsWith("metadata-")&&![hT.METADATA_URL].includes(e)).reduce((e,t)=>
3{let i=this.getAttribute(t);return null!=i&&(e[t.replace(/^metadata-/,"").replace(/-/g,"_")]=i),e},{}),...hg(this,hi)}}set metadata(e){hE(this,hi,null!=e?e:{}),this.mux&&this.mux.emit("hb",hg(this,hi))}get _hlsConfig(){return hg(this,hn)}set _hlsConfig(e){hE(this,hn,e)}get logo(){var e;return null!=(e=this.getAttribute(hT.LOGO))?e:hg(this,hl)}set logo(e){e?this.setAttribute(hT.LOGO,e):this.removeAttribute(hT.LOGO)}load(){uR(this,this.nativeEl,hg(this,hu,hh))}unload(){uI(this.nativeEl,hg(this,hu,hh),this)}attributeChangedCallback(e,t,i){var r,n;switch(u6.observedAttributes.includes(e)&&!["src","autoplay","preload"].includes(e)&&super.attributeChangedCallback(e,t,i),e){case hT.PLAYER_SOFTWARE_NAME:this.playerSoftwareName=null!=i?i:void 0;break;case hT.PLAYER_SOFTWARE_VERSION:this.playerSoftwareVersion=null!=i?i:void 0;break;case"src":{let e=!!t,r=!!i;!e&&r?hy(this,hu,hm).call(this):e&&!r?this.unload():e&&r&&(this.unload(),hy(this,hu,hm).call(this));break}case"autoplay":if(i===t)break;null==(r=hg(this,hu,hh))||r.setAutoplay(this.autoplay);break;case"preload":if(i===t)break;null==(n=hg(this,hu,hh))||n.setPreload(i);break;case hT.PLAYBACK_ID:case hT.CUSTOM_DOMAIN:case hT.MAX_RESOLUTION:case hT.MIN_RESOLUTION:case hT.RENDITION_ORDER:case hT.PROGRAM_START_TIME:case hT.PROGRAM_END_TIME:case hT.ASSET_START_TIME:case hT.ASSET_END_TIME:case hT.PLAYBACK_TOKEN:this.hasAttribute(hT.PLAYBACK_ID)&&(this.src=uf(this));break;case hT.DEBUG:{let e=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=e);break}case hT.METADATA_URL:i&&fetch(i).then(e=>e.json()).then(e=>this.metadata=e).catch(()=>console.error("Unable to load or parse metadata JSON from metadata-url ".concat(i,"!")));break;case hT.STREAM_TYPE:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("streamtypechange",{composed:!0,bubbles:!0}));break;case hT.TARGET_LIVE_WINDOW:(null==i||i!==t)&&this.dispatchEvent(new CustomEvent("targetlivewindowchange",{composed:!0,bubbles:!0,detail:this.targetLiveWindow}));break;case hT.LOGO:(null==i||i!==t)&&this.updateLogo();break;case hT.DISABLE_TRACKING:if(null==i||i!==t){let e=this.currentTime,t=this.paused;this.unload(),hy(this,hu,hm).call(this).then(()=>{this.currentTime=e,t||this.play()})}break;case hT.DISABLE_COOKIES:(null==i||i!==t)&&((e,t,i)=>{var r,n,a;if(!t)return;let s=!!e.disableCookies,o=ud.get(t);!o||o.muxDataDisableCookies===s||(r=e,n=t,a=i,n&&(n.mux&&(n.mux.deleted||n.mux.destroy(),delete n.mux),uk.has(n)||uk.set(n,Promise.resolve().then(()=>{var e,t;uk.delete(n);let i=ud.get(n);i&&(!n.mux||n.mux.deleted)&&uF(r,n,null==(t=null!=(e=i.coreReference)?e:a)?void 0:t.engine)}))),s&&Promise.resolve().then(()=>{let t,i;e.disableCookies&&(t=new Date(0).toUTCString(),i=new Set(["muxData"]),document.cookie.split(";").forEach(e=>{let t=e.split("=")[0].trim();t.startsWith("muxData")&&i.add(t)}),i.forEach(e=>{document.cookie="".concat(e,"=;expires=").concat(t,";path=/")}))}))})(this,this.nativeEl,hg(this,hu,hh));break;case hT.CAP_RENDITION_TO_PLAYER_SIZE:(null==i||i!==t)&&(this.capRenditionToPlayerSize=null!=i||void 0)}}updateLogo(){if(!this.shadowRoot)return;let e=this.shadowRoot.querySelector('slot[name="logo"]');e&&(e.innerHTML=this.constructor.getLogoHTML(hg(this,hl)||this.logo))}connectedCallback(){var e,t;null==(e=super.connectedCallback)||e.call(this),null==(t=this.nativeEl)||t.addEventListener("muxmetadata",hg(this,hd)),this.nativeEl&&this.src&&!hg(this,hu,hh)&&hy(this,hu,hm).call(this)}disconnectedCallback(){var e,t;null==(e=this.nativeEl)||e.removeEventListener("muxmetadata",hg(this,hd)),this.unload(),null==(t=super.disconnectedCallback)||t.call(this)}handleEvent(e){e.target===this.nativeEl&&this.dispatchEvent(new CustomEvent(e.type,{composed:!0,detail:e.detail}))}constructor(){super(),hv(this,hu),hv(this,he),hv(this,ht),hv(this,hi,{}),hv(this,hr,{}),hv(this,hn),hv(this,ha),hv(this,hs),hv(this,ho),hv(this,hl,""),hv(this,hd,e=>{var t;let i=(e=>{var t;return null==(t=ud.get(e))?void 0:t.metadata})(this.nativeEl),r=null!=(t=this.metadata)?t:{};this.metadata={...i,...r},(null==i?void 0:i["com.mux.video.branding"])==="mux-free-plan"&&(hE(this,hl,"default"),this.updateLogo())}),hv(this,hc),hE(this,ht,uc())}};
3function hR(e){return(hR=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function hk(e,t,i){return(hk="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=hR(e)););return e}(e,t);if(r){var n=Object.getOwnPropertyDescriptor(r,t);return n.get?n.get.call(i||e):n.value}})(e,t,i||e)}he=new WeakMap,ht=new WeakMap,hi=new WeakMap,hr=new WeakMap,hn=new WeakMap,ha=new WeakMap,hs=new WeakMap,ho=new WeakMap,hl=new WeakMap,hd=new WeakMap,hu=new WeakSet,hh=function(){var e,t;return e=this.nativeEl,null==(t=ud.get(e))?void 0:t.coreReference},hc=new WeakMap,hm=async function(){hg(this,he)||(await hE(this,he,Promise.resolve()),hE(this,he,null),this.load())};let hI=new WeakMap;class hL extends Error{}class hD extends Error{}let hw=["application/x-mpegURL","application/vnd.apple.mpegurl","audio/mpegurl"];function hC(){var e,t;return null==(t=globalThis.cast)||null==(e=t.framework)?void 0:e.CastContext.getInstance()}function hM(){var e;return null==(e=hC())?void 0:e.getCurrentSession()}function hP(){var e;return null==(e=hM())?void 0:e.getSessionObj().media[0]}function hO(e){return hC().setOptions({...hx(),...e})}function hx(){return{receiverApplicationId:"CC1AD845",autoJoinPolicy:"origin_scoped",androidReceiverCompatible:!1,language:"en-US",resumeSavedSession:!0}}function hN(e){if(!e)return;let t=e.match(/\.([a-zA-Z0-9]+)(?:\?.*)?$/);return t?t[1]:null}function hU(e){let t=e.split("\n").find(e=>!e.trim().startsWith("#")&&""!==e.trim());return null==t?void 0:t.trim()}async function hF(e){if(!e)return!1;if(/\.m3u8?(\?.*)?$/i.test(e))return!0;if(e.startsWith("blob:"))return!1;try{let t=(await fetch(e,{method:"HEAD"})).headers.get("Content-Type");return hw.some(e=>t===e)}catch(e){return console.error("Error while trying to get the Content-Type of the manifest",e),!1}}async function hB(e){if(!e||e.startsWith("blob:"))return{videoFormat:void 0,audioFormat:void 0};try{let i=await (await fetch(e)).text(),r=i,n=function(e){let t=e.split("\n"),i=[];for(let e=0;e<t.length;e++)if(t[e].trim().startsWith("#EXT-X-STREAM-INF")){let r=t[e+1]?t[e+1].trim():"";r&&!r.startsWith("#")&&i.push(r)}return i}(i);if(n.length>0){let t=new URL(n[0],e).toString();r=await (await fetch(t)).text()}let a=hU(r),s=hN(a),o=function(e){for(let t of e.split("\n")){let e=t.trim();if(e.startsWith("#EXT-X-MEDIA")&&/TYPE=AUDIO/i.test(e)){let t=e.match(/URI="([^"]+)"/i);if(t)return t[1]}}}(i),l=s;if(o)try{var t;let i=new URL(o,e).toString(),r=await (await fetch(i)).text(),n=hU(r);l=null!=(t=hN(n))?t:s}catch(e){console.error("Error while trying to parse the audio rendition playlist",e)}return{videoFormat:s,audioFormat:l}}catch(e){return console.error("Error while trying to parse the manifest playlist",e),{videoFormat:void 0,audioFormat:void 0}}}let hG=new(globalThis.WeakRef?class extends Set{add(e){super.add(new WeakRef(e))}forEach(e){super.forEach(t=>{let i=t.deref();i&&e(i)})}}:Set),hH=new WeakSet;!function(e){var t,i,r;(null==(i=globalThis.chrome)||null==(t=i.cast)?void 0:t.isAvailable)?(null==(r=globalThis.cast)?void 0:r.framework)?e():customElements.whenDefined("google-cast-button").then(e):globalThis.__onGCastApiAvailable=()=>{customElements.whenDefined("google-cast-button").then(e)}}(()=>{var e,t,i,r;if(!(null==(t=globalThis.chrome)||null==(e=t.cast)?void 0:e.isAvailable))return void console.debug("chrome.cast.isAvailable",null==(r=globalThis.chrome)||null==(i=r.cast)?void 0:i.isAvailable);l||(l=cast.framework,hC().addEventListener(l.CastContextEventType.CAST_STATE_CHANGED,e=>{hG.forEach(t=>{var i,r;return null==(i=(r=hI.get(t)).onCastStateChanged)?void 0:i.call(r,e)})}),hC().addEventListener(l.CastContextEventType.SESSION_STATE_CHANGED,e=>{hG.forEach(t=>{var i,r;return null==(i=(r=hI.get(t)).onSessionStateChanged)?void 0:i.call(r,e)})}),hG.forEach(e=>{var t,i;return null==(t=(i=hI.get(e)).init)?void 0:t.call(i)}))});let hK=0;var hW=new WeakMap,hV=new WeakMap,hq=new WeakMap,hY=new WeakMap,hj=new WeakMap,hz=new WeakMap,hQ=new WeakMap,hX=new WeakMap,hZ=new WeakMap,hJ=new WeakMap,h$=new WeakSet,h0=new WeakSet,h1=new WeakSet,h2=new WeakSet,h3=new WeakSet,h4=new WeakSet,h5=new WeakSet;
3class h8 extends EventTarget{destroy(){var e,t,i;null==(t=(0,uq._)(this,hW))||null==(e=t.textTracks)||e.removeEventListener("change",(0,uq._)(this,hZ)),(0,uq._)(this,hY)&&(null==(i=(0,uq._)(this,hq))?void 0:i.controller)&&Object.entries((0,uq._)(this,hY)).forEach(e=>{let[t,i]=e;(0,uq._)(this,hq).controller.removeEventListener(t,i)}),(0,uq._)(this,hW)&&hH.delete((0,uq._)(this,hW)),(0,uj._)(this,hV,!1)}get state(){return(0,uq._)(this,hj)}async watchAvailability(e){if((0,uq._)(this,hW).disableRemotePlayback)throw new hL("disableRemotePlayback attribute is present.");return(0,uq._)(this,hX).set(e,++hK),(0,uq._)(this,hQ).add(e),queueMicrotask(()=>e((0,uz._)(this,h0,h7).call(this))),hK}async cancelWatchAvailability(e){if((0,uq._)(this,hW).disableRemotePlayback)throw new hL("disableRemotePlayback attribute is present.");e?(0,uq._)(this,hQ).delete(e):(0,uq._)(this,hQ).clear()}async prompt(){var e,t,i,r;if((0,uq._)(this,hW).disableRemotePlayback)throw new hL("disableRemotePlayback attribute is present.");if(!(null==(t=globalThis.chrome)||null==(e=t.cast)?void 0:e.isAvailable))throw new hD("The RemotePlayback API is disabled on this platform.");let n=hH.has((0,uq._)(this,hW));hH.add((0,uq._)(this,hW)),hO((0,uq._)(this,hW).castOptions),Object.entries((0,uq._)(this,hY)).forEac
3h(e=>{let[t,i]=e;(0,uq._)(this,hq).controller.addEventListener(t,i)});try{await hC().requestSession()}catch(e){if(n||hH.delete((0,uq._)(this,hW)),"cancel"===e)return;throw Error(e)}null==(r=hI.get((0,uq._)(this,hW)))||null==(i=r.loadOnPrompt)||i.call(r)}constructor(e){super(),(0,uY._)(this,hJ,{get:h6,set:void 0}),(0,uQ._)(this,h$),(0,uQ._)(this,h0),(0,uQ._)(this,h1),(0,uQ._)(this,h2),(0,uQ._)(this,h3),(0,uQ._)(this,h4),(0,uQ._)(this,h5),(0,uY._)(this,hW,{writable:!0,value:void 0}),(0,uY._)(this,hV,{writable:!0,value:void 0}),(0,uY._)(this,hq,{writable:!0,value:void 0}),(0,uY._)(this,hY,{writable:!0,value:void 0}),(0,uY._)(this,hj,{writable:!0,value:"disconnected"}),(0,uY._)(this,hz,{writable:!0,value:!1}),(0,uY._)(this,hQ,{writable:!0,value:new Set}),(0,uY._)(this,hX,{writable:!0,value:new WeakMap}),(0,uY._)(this,hZ,{writable:!0,value:()=>(0,uz._)(this,h5,cn).call(this)}),(0,uj._)(this,hW,e),hG.add(this),hI.set(this,{init:()=>(0,uz._)(this,h3,ci).call(this),onCastStateChanged:()=>(0,uz._)(this,h1,ce).call(this),onSessionStateChanged:()=>(0,uz._)(this,h2,ct).call(this),getCastPlayer:()=>(0,uq._)(this,hJ)}),(0,uz._)(this,h3,ci).call(this)}}function h6(){if(hH.has((0,uq._)(this,hW)))return(0,uq._)(this,hq)}function h9(){hH.has((0,uq._)(this,hW))&&(Object.entries((0,uq._)(this,hY)).forEac
3h(e=>{let[t,i]=e;(0,uq._)(this,hq).controller.removeEventListener(t,i)}),hH.delete((0,uq._)(this,hW)),(0,uq._)(this,hW).muted=(0,uq._)(this,hq).isMuted,(0,uq._)(this,hW).currentTime=(0,uq._)(this,hq).savedPlayerState.currentTime,!1===(0,uq._)(this,hq).savedPlayerState.isPaused&&(0,uq._)(this,hW).play())}function h7(){var e;let t=null==(e=hC())?void 0:e.getCastState();return t&&"NO_DEVICES_AVAILABLE"!==t}function ce(){let e=hC().getCastState();if(hH.has((0,uq._)(this,hW))&&"CONNECTING"===e&&((0,uj._)(this,hj,"connecting"),this.dispatchEvent(new Event("connecting"))),!(0,uq._)(this,hz)&&(null==e?void 0:e.includes("CONNECT")))for(let e of((0,uj._)(this,hz,!0),(0,uq._)(this,hQ)))e(!0);else if((0,uq._)(this,hz)&&(!e||"NO_DEVICES_AVAILABLE"===e))for(let e of((0,uj._)(this,hz,!1),(0,uq._)(this,hQ)))e(!1)}async function ct(){let{SESSION_RESUMED:e}=l.SessionState;if(hC().getSessionState()===e){var t,i;if((0,uq._)(this,hW).castSrc===(null==(t=hP())?void 0:t.media.contentId)){hH.add((0,uq._)(this,hW)),Object.entries((0,uq._)(this,hY)).forEac
3h(e=>{let[t,i]=e;(0,uq._)(this,hq).controller.addEventListener(t,i)});try{await (i=new chrome.cast.media.GetStatusRequest,new Promise((e,t)=>{hP().getStatus(i,e,t)}))}catch(e){console.error(e)}(0,uq._)(this,hY)[l.RemotePlayerEventType.IS_PAUSED_CHANGED](),(0,uq._)(this,hY)[l.RemotePlayerEventType.PLAYER_STATE_CHANGED]()}}}function ci(){!l||(0,uq._)(this,hV)||((0,uj._)(this,hV,!0),hO((0,uq._)(this,hW).castOptions),(0,uq._)(this,hW).textTracks.addEventListener("change",(0,uq._)(this,hZ)),(0,uz._)(this,h1,ce).call(this),(0,uj._)(this,hq,new l.RemotePlayer),new l.RemotePlayerController((0,uq._)(this,hq)),(0,uj._)(this,hY,{[l.RemotePlayerEventType.IS_CONNECTED_CHANGED]:e=>{let{value:t}=e;!0===t?((0,uj._)(this,hj,"connected"),this.dispatchEvent(new Event("connect"))):((0,uz._)(this,h$,h9).call(this),(0,uj._)(this,hj,"disconnected"),this.dispatchEvent(new Event("disconnect")))},[l.RemotePlayerEventType.DURATION_CHANGED]:()=>{(0,uq._)(this,hW).dispatchEvent(new Event("durationchange"))},[l.RemotePlayerEventType.VOLUME_LEVEL_CHANGED]:()=>{(0,uq._)(this,hW).dispatchEvent(new Event("volumechange"))},[l.RemotePlayerEventType.IS_MUTED_CHANGED]:()=>{(0,uq._)(this,hW).dispatchEvent(new Event("volumechange"))},[l.RemotePlayerEventType.CURRENT_TIME_CHANGED]:()=>{var e;(null==(e=(0,uq._)(this,hJ))?void 0:e.isMediaLoaded)&&(0,uq._)(this,hW).dispatchEvent(new Event("timeupdate"))},[l.RemotePlayerEventType.VIDEO_INFO_CHANGED]:()=>{(0,uq._)(this,hW).dispatchEvent(new Event("resize"))},[l.RemotePlayerEventType.IS_PAUSED_CHANGED]:()=>{(0,uq._)(this,hW).dispatchEvent(new Event(this.paused?"pause":"play"))},[l.RemotePlayerEventType.PLAYER_STATE_CHANGED]:()=>{var e,t;(null==(e=(0,uq._)(this,hJ))?void 0:e.playerState)!==chrome.cast.media.PlayerState.PAUSED&&(0,uq._)(this,hW).dispatchEvent(new Event({[chrome.cast.media.PlayerState.PLAYING]:"playing",[chrome.cast.media.PlayerState.BUFFERING]:"waiting",[chrome.cast.media.PlayerState.IDLE]:"emptied"}[null==(t=(0,uq._)(this,hJ))?void 0:t.playerState]))},[l.RemotePlayerEventType.IS_MEDIA_LOADED_CHANGED]:async()=>{var e;(null==(e=(0,uq._)(this,hJ))?void 0:e.isMediaLoaded)&&(await Promise.resolve(),(0,uz._)(this,h4,cr).call(this))}}))}function cr(){(0,uz._)(this,h5,cn).call(this)}async function cn(){var e,t,i,r,n;let a;if(!(0,uq._)(this,hJ))return;let s=(null!=(r=null==(e=(0,uq._)(this,hq).mediaInfo)?void 0:e.tracks)?r:[]).filter(e=>{let{type:t}=e;return t===chrome.cast.media.TrackType.TEXT}),o=[...(0,uq._)(this,hW).textTracks].filter(e=>{let{kind:t}=e;return"subtitles"===t||"captions"===t}),l=s.map(e=>{var t;let{language:i,name:r,trackId:n}=e,{mode:a}=null!=(t=o.find(e=>e.language===i&&e.label===r))?t:{};return!!a&&{mode:a,trackId:n}}).filter(Boolean),d=l.filter(e=>{let{mode:t}=e;return"showing"!==t}).map(e=>{let{trackId:t}=e;return t}),u=l.find(e=>{let{mode:t}=e;return"showing"===t}),h=null!=(n=null==(i=hM())||null==(t=i.getSessionObj().media[0])?void 0:t.activeTrackIds)?n:[],c=h;if(h.length&&(c=c.filter(e=>!d.includes(e))),(null==u?void 0:u.trackId)&&(c=[...c,u.trackId]),a=c=[...new Set(c)],!(h.length===a.length&&h.every(e=>a.includes(e))))try{let e=new chrome.cast.media.EditTracksInfoRequest(c);await new Promise((t,i)=>{hP().editTracksInfo(e,t,i)})}catch(e){console.error(e)}}let ca=e=>{var t,i=new WeakMap,r=new WeakMap,n=new WeakMap,a=new WeakMap,s=new WeakMap,o=new WeakSet;class l extends e{get remote(){if((0,uq._)(this,a))return(0,uq._)(this,a);if(globalThis.chrome){if(!this.isConnected)return;return this.disableRemotePlayback||function(){var e;let t="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1";if((null==(e=globalThis.chrome)?void 0:e.cast)||document.querySelector('script[src="'.concat(t,'"]')))return;let i=document.createElement("script");i.src=t,document.head.append(i)}(),hI.set(this,{loadOnPrompt:()=>(0,uz._)(this,o,u).call(this)}),(0,uj._)(this,a,new h8(this))}return super.remote}disconnectedCallback(){var e,t;null==(e=(0,uq._)(this,a))||e.destroy(),(0,uj._)(this,a,null),hI.delete(this),null==(t=super.disconnectedCallback)||t.call(this)}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),"cast-receiver"===e&&i){(0,uq._)(this,r).receiverApplicationId=i;return}if((0,uq._)(this,s))switch(e){case"cast-stream-type":case"cast-src":this.load()}}async load(){var e,t;if(!(0,uq._)(this,s))return super.load();let r=new chrome.cast.media.MediaInfo(this.castSrc,this.castContentType);r.customData=this.castCustomData;let n=[...this.querySelectorAll("track")].filter(e=>{let{kind:t,src:i}=e;return i&&("subtitles"===t||"captions"===t)}),a=[],o=0;if(n.length&&(r.tracks=n.map(e=>{let t=++o;0===a.length&&"showing"===e.track.mode&&a.push(t);let i=new chrome.cast.media.Track(t,chrome.cast.media.TrackType.TEXT);return i.trackContentId=e.src,i.trackContentType="text/vtt",i.subtype="captions"===e.kind?chrome.cast.media.TextTrackType.CAPTIONS:chrome.cast.media.TextTrackType.SUBTITLES,i.name=e.label,i.language=e.srclang,i})),"live"===this.castStreamType?r.streamType=chrome.cast.media.StreamType.LIVE:r.streamType=chrome.cast.media.StreamType.BUFFERED,r.metadata=new chrome.cast.media.GenericMediaMetadata,r.metadata.title=this.title,r.metadata.images=[{url:this.poster}],await hF(this.castSrc)){r.contentType||(r.contentType="application/x-mpegURL");let{videoFormat:e,audioFormat:t}=await hB(this.castSrc);(null==e?void 0:e.includes("m4s"))||(null==e?void 0:e.includes("mp4"))||(null==e?void 0:e.includes("m4a"))?(r.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.FMP4,r.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.FMP4):(null==t?void 0:t.includes("aac"))?(r.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.AAC,r.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.MPEG2_TS):((null==e?void 0:e.includes("ts"))||(null==t?void 0:t.includes("ts")))&&(r.hlsSegmentFormat=chrome.cast.media.HlsSegmentFormat.TS,r.hlsVideoSegmentFormat=chrome.cast.media.HlsVideoSegmentFormat.MPEG2_TS)}let l=new chrome.cast.media.LoadRequest(r);l.currentTime=null!=(t=super.currentTime)?t:0,l.autoplay=!(0,uq._)(this,i).paused,l.activeTrackIds=a,await (null==(e=hM())?void 0:e.loadMedia(l)),this.dispatchEvent(new Event("volumechange"))}play(){if((0,uq._)(this,s)){if((0,uq._)(this,s).isPaused){var e;null==(e=(0,uq._)(this,s).controller)||e.playOrPause()}return}return super.play()}pause(){if((0,uq._)(this,s)){if(!(0,uq._)(this,s).isPaused){var e;null==(e=(0,uq._)(this,s).controller)||e.playOrPause()}return}super.pause()}get castOptions(){return(0,uq._)(this,r)}get castReceiver(){var e;return null!=(e=this.getAttribute("cast-receiver"))?e:void 0}set castReceiver(e){this.castReceiver!=e&&this.setAttribute("cast-receiver","".concat(e))}get castSrc(){var e,t,i,r,n;let a=this.currentSrc,s=(null==a?void 0:a.startsWith("blob:"))?void 0:a;return null!=(n=null!=(r=null!=(i=null!=(t=this.getAttribute("cast-src"))?t:null==(e=this.querySelector("source"))?void 0:e.src)?i:s)?r:this.getAttribute("src"))?n:void 0}set castSrc(e){this.castSrc!=e&&this.setAttribute("cast-src","".concat(e))}get castContentType(){var e;return null!=(e=this.getAttribute("cast-content-type"))?e:void 0}set castContentType(e){this.setAttribute("cast-content-type","".concat(e))}get castStreamType(){var e,t;return null!=(t=null!=(e=this.getAttribute("cast-stream-type"))?e:this.streamType)?t:void 0}set castStreamType(e){this.setAttribute("cast-stream-type","".concat(e))}get castCustomData(){return(0,uq._)(this,n)}set castCustomData(e){let t=typeof e;if(!["object","undefined"].includes(t))return void console.error("castCustomData must be nullish or an object but value was of type ".concat(t));(0,uj._)(this,n,e)}get readyState(){if((0,uq._)(this,s))switch((0,uq._)(this,s).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(0,uq._)(this,s)?(0,uq._)(this,s).isPaused:super.paused}get muted(){var e;return(0,uq._)(this,s)?null==(e=(0,uq._)(this,s))?void 0:e.isMuted:super.muted}set muted(e){if((0,uq._)(this,s)){if(e&&!(0,uq._)(this,s).isMuted||!e&&(0,uq._)(this,s).isMuted){var t;null==(t=(0,uq._)(this,s).controller)||t.muteOrUnmute()}return}super.muted=e}get volume(){var e,t;return(0,uq._)(this,s)?null!=(t=null==(e=(0,uq._)(this,s))?void 0:e.volumeLevel)?t:1:super.volume}set volume(e){if((0,uq._)(this,s)){var t;(0,uq._)(this,s).volumeLevel=+e,null==(t=(0,uq._)(this,s).controller)||t.setVolumeLevel();return}super.volume=e}get duration(){var e,t,i;return(0,uq._)(this,s)&&(null==(e=(0,uq._)(this,s))?void 0:e.isMediaLoaded)?null!=(i=null==(t=(0,uq._)(this,s))?void 0:t.duration)?i:NaN:super.duration}get currentTime(){var e,t,i;return(0,uq._)(this,s)&&(null==(e=(0,uq._)(this,s))?void 0:e.isMediaLoaded)?null!=(i=null==(t=(0,uq._)(this,s))?void 0:t.currentTime)?i:0:super.currentTime}set currentTime(e){if((0,uq._)(this,s)){var t;(0,uq._)(this,s).currentTime=e,null==(t=(0,uq._)(this,s).controller)||t.seek();return}super.currentTime=e}constructor(...e){super(...e),(0,uY._)(this,s,{get:d,set:void 0}),(0,uQ._)(this,o),(0,uY._)(this,i,{writable:!0,value:{paused:!1}}),(0,uY._)(this,r,{writable:!0,value:hx()}),(0,uY._)(this,n,{writable:!0,value:void 0}),(0,uY._)(this,a,{writable:!0,value:void 0})}}function d(){var e,t;return null==(t=hI.get((0,uq._)(this,a)))||null==(e=t.getCastPlayer)?void 0:e.call(t)}async function u(){(0,uq._)(this,i).paused=hk(hR(l.prototype),"paused",this),hk(hR(l.prototype),"pause",this).call(this),this.muted=hk(hR(l.prototype),"muted",this);try{await this.load()}catch(e){console.error(e)}}return(0,u0._)(l,"observedAttributes",[...null!=(t=e.observedAttributes)?t:[],"cast-src","cast-content-type","cast-stream-type","cast-receiver"]),l};
3class cs extends Event{constructor(e,t){super(e),(0,u0._)(this,"track",void 0),this.track=t.track}}let co=new WeakMap;function cl(e){var t,i,r;let n;return null!=(t=co.get(e))?t:(i=e,r={},(n=co.get(i))||co.set(i,n={}),Object.assign(n,r))}function cd(e,t){let i=e.videoTracks;cl(t).media=new WeakRef(e),cl(t).renditionSet||(cl(t).renditionSet=new Set);let r=cl(i).trackSet;r.add(t);let n=r.size-1;n in cp.prototype||Object.defineProperty(cp.prototype,n,{get(){return[...cl(this).trackSet][n]}}),queueMicrotask(()=>{i.dispatchEvent(new cs("addtrack",{track:t}))})}function cu(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.videoTracks;r&&(cl(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new cs("removetrack",{track:e}))}))}var ch=new WeakMap,cc=new WeakMap,cm=new WeakMap,cf=new WeakMap;class cp extends EventTarget{[Symbol.iterator](){return(0,uq._)(this,cf).values()}get length(){return(0,uq._)(this,cf).size}getTrackById(e){var t;return null!=(t=[...(0,uq._)(this,cf)].find(t=>t.id===e))?t:null}get selectedIndex(){return[...(0,uq._)(this,cf)].findIndex(e=>e.selected)}get onaddtrack(){return(0,uq._)(this,ch)}set onaddtrack(e){(0,uq._)(this,ch)&&(this.removeEventListener("addtrack",(0,uq._)(this,ch)),(0,uj._)(this,ch,void 0)),"function"==typeof e&&((0,uj._)(this,ch,e),this.addEventListener("addtrack",e))}get onremovetrack(){return(0,uq._)(this,cc)}set onremovetrack(e){(0,uq._)(this,cc)&&(this.removeEventListener("removetrack",(0,uq._)(this,cc)),(0,uj._)(this,cc,void 0)),"function"==typeof e&&((0,uj._)(this,cc,e),this.addEventListener("removetrack",e))}get onchange(){return(0,uq._)(this,cm)}set onchange(e){(0,uq._)(this,cm)&&(this.removeEventListener("change",(0,uq._)(this,cm)),(0,uj._)(this,cm,void 0)),"function"==typeof e&&((0,uj._)(this,cm,e),this.addEventListener("change",e))}constructor(){super(),(0,uY._)(this,cf,{get:cg,set:void 0}),(0,uY._)(this,ch,{writable:!0,value:void 0}),(0,uY._)(this,cc,{writable:!0,value:void 0}),(0,uY._)(this,cm,{writable:!0,value:void 0}),cl(this).trackSet=new Set}}function cg(){return cl(this).trackSet}class cv extends Event{constructor(e,t){super(e),(0,u0._)(this,"rendition",void 0),this.rendition=t.rendition}}function cE(e){var t;let i=null==(t=cl(e).media)?void 0:t.deref();return i?[...i.videoTracks].filter(e=>e.selected).flatMap(e=>[...cl(e).renditionSet]):[]}var cy=new WeakMap,cb=new WeakMap,cT=new WeakMap;class c_ extends EventTarget{[Symbol.iterator](){return cE(this).values()}get length(){return cE(this).length}getRenditionById(e){var t;return null!=(t=cE(this).find(t=>"".concat(t.id)==="".concat(e)))?t:null}get selectedIndex(){return cE(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of cE(this).entries())i.selected=t===e}get onaddrendition(){return(0,uq._)(this,cy)}set onaddrendition(e){(0,uq._)(this,cy)&&(this.removeEventListener("addrendition",(0,uq._)(this,cy)),(0,uj._)(this,cy,void 0)),"function"==typeof e&&((0,uj._)(this,cy,e),this.addEventListener("addrendition",e))}get onremoverendition(){return(0,uq._)(this,cb)}set onremoverendition(e){(0,uq._)(this,cb)&&(this.removeEventListener("removerendition",(0,uq._)(this,cb)),(0,uj._)(this,cb,void 0)),"function"==typeof e&&((0,uj._)(this,cb,e),this.addEventListener("removerendition",e))}get onchange(){return(0,uq._)(this,cT)}set onchange(e){(0,uq._)(this,cT)&&(this.removeEventListener("change",(0,uq._)(this,cT)),(0,uj._)(this,cT,void 0)),"function"==typeof e&&((0,uj._)(this,cT,e),this.addEventListener("change",e))}constructor(...e){super(...e),(0,uY._)(this,cy,{writable:!0,value:void 0}),(0,uY._)(this,cb,{writable:!0,value:void 0}),(0,uY._)(this,cT,{writable:!0,value:void 0})}}var cA=new WeakMap;class cS{get selected(){return(0,uq._)(this,cA)}set selected(e){(0,uq._)(this,cA)!==e&&((0,uj._)(this,cA,e),function(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.videoRenditions;r&&!cl(r).changeRequested&&(cl(r).changeRequested=!0,queueMicrotask(()=>{delete cl(r).changeRequested,cl(e).track.selected&&r.dispatchEvent(new Event("change"))}))}(this))}constructor(){(0,u0._)(this,"src",void 0),(0,u0._)(this,"id",void 0),(0,u0._)(this,"width",void 0),(0,u0._)(this,"height",void 0),(0,u0._)(this,"bitrate",void 0),(0,u0._)(this,"frameRate",void 0),(0,u0._)(this,"codec",void 0),(0,uY._)(this,cA,{writable:!0,value:!1})}}var cR=new WeakMap;class ck{addRendition(e,t,i,r,n,a){let s=new cS;return s.src=e,s.width=t,s.height=i,s.frameRate=a,s.bitrate=n,s.c
3odec=r,!function(e,t){var i,r;let n=null==(r=cl(e).media)||null==(i=r.deref())?void 0:i.videoRenditions;cl(t).media=cl(e).media,cl(t).track=e;let a=cl(e).renditionSet;a.add(t);let s=a.size-1;s in c_.prototype||Object.defineProperty(c_.prototype,s,{get(){return cE(this)[s]}}),queueMicrotask(()=>{n&&e.selected&&n.dispatchEvent(new cv("addrendition",{rendition:t}))})}(this,s),s}removeRendition(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.videoRenditions,n=cl(e).track;cl(n).renditionSet.delete(e),queueMicrotask(()=>{let t=cl(e).track;r&&t.selected&&r.dispatchEvent(new cv("removerendition",{rendition:e}))})}get selected(){return(0,uq._)(this,cR)}set selected(e){(0,uq._)(this,cR)!==e&&((0,uj._)(this,cR,e),!0===e&&function(e){var t,i,r;let n=null!=(r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.videoTracks)?r:[],a=!1;for(let t of n)t!==e&&(t.selected=!1,a=!0);if(a){if(cl(n).changeRequested)return;cl(n).changeRequested=!0,queueMicrotask(()=>{delete cl(n).changeRequested,n.dispatchEvent(new Event("change"))})}}(this))}constructor(){(0,u0._)(this,"id",void 0),(0,u0._)(this,"kind",void 0),(0,u0._)(this,"label",""),(0,u0._)(this,"language",""),(0,u0._)(this,"sourceBuffer",void 0),(0,uY._)(this,cR,{writable:!0,value:!1})}}function cI(e){var t;let i=null==(t=cl(e).media)?void 0:t.deref();return i?[...i.audioTracks].filter(e=>e.enabled).flatMap(e=>[...cl(e).renditionSet]):[]}var cL=new WeakMap,cD=new WeakMap,cw=new WeakMap;class cC extends EventTarget{[Symbol.iterator](){return cI(this).values()}get length(){return cI(this).length}getRenditionById(e){var t;return null!=(t=cI(this).find(t=>"".concat(t.id)==="".concat(e)))?t:null}get selectedIndex(){return cI(this).findIndex(e=>e.selected)}set selectedIndex(e){for(let[t,i]of cI(this).entries())i.selected=t===e}get onaddrendition(){return(0,uq._)(this,cL)}set onaddrendition(e){(0,uq._)(this,cL)&&(this.removeEventListener("addrendition",(0,uq._)(this,cL)),(0,uj._)(this,cL,void 0)),"function"==typeof e&&((0,uj._)(this,cL,e),this.addEventListener("addrendition",e))}get onremoverendition(){return(0,uq._)(this,cD)}set onremoverendition(e){(0,uq._)(this,cD)&&(this.removeEventListener("removerendition",(0,uq._)(this,cD)),(0,uj._)(this,cD,void 0)),"function"==typeof e&&((0,uj._)(this,cD,e),this.addEventListener("removerendition",e))}get onchange(){return(0,uq._)(this,cw)}set onchange(e){(0,uq._)(this,cw)&&(this.removeEventListener("change",(0,uq._)(this,cw)),(0,uj._)(this,cw,void 0)),"function"==typeof e&&((0,uj._)(this,cw,e),this.addEventListener("change",e))}constructor(...e){super(...e),(0,uY._)(this,cL,{writable:!0,value:void 0}),(0,uY._)(this,cD,{writable:!0,value:void 0}),(0,uY._)(this,cw,{writable:!0,value:void 0})}}var cM=new WeakMap;class cP{get selected(){return(0,uq._)(this,cM)}set selected(e){(0,uq._)(this,cM)!==e&&((0,uj._)(this,cM,e),function(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.audioRenditions;r&&!cl(r).changeRequested&&(cl(r).changeRequested=!0,queueMicrotask(()=>{delete cl(r).changeRequested,cl(e).track.enabled&&r.dispatchEvent(new Event("change"))}))}(this))}constructor(){(0,u0._)(this,"src",void 0),(0,u0._)(this,"id",void 0),(0,u0._)(this,"bitrate",void 0),(0,u0._)(this,"codec",void 0),(0,uY._)(this,cM,{writable:!0,value:!1})}}function cO(e,t){let i=e.audioTracks;cl(t).media=new WeakRef(e),cl(t).renditionSet||(cl(t).renditionSet=new Set);let r=cl(i).trackSet;r.add(t);let n=r.size-1;n in cG.prototype||Object.defineProperty(cG.prototype,n,{get(){return[...cl(this).trackSet][n]}}),queueMicrotask(()=>{i.dispatchEvent(new cs("addtrack",{track:t}))})}function cx(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.audioTracks;r&&(cl(r).trackSet.delete(e),queueMicrotask(()=>{r.dispatchEvent(new cs("removetrack",{track:e}))}))}var cN=new WeakMap,cU=new WeakMap,cF=new WeakMap,cB=new WeakMap;class cG extends EventTarget{[Symbol.iterator](){return(0,uq._)(this,cB).values()}get length(){return(0,uq._)(this,cB).size}getTrackById(e){var t;return null!=(t=[...(0,uq._)(this,cB)].find(t=>t.id===e))?t:null}get onaddtrack(){return(0,uq._)(this,cN)}set onaddtrack(e){(0,uq._)(this,cN)&&(this.removeEventListener("addtrack",(0,uq._)(this,cN)),(0,uj._)(this,cN,void 0)),"function"==typeof e&&((0,uj._)(this,cN,e),this.addEventListener("addtrack",e))}get onremovetrack(){return(0,uq._)(this,cU)}set onremovetrack(e){(0,uq._)(this,cU)&&(this.removeEventListener("removetrack",(0,uq._)(this,cU)),(0,uj._)(this,cU,void 0)),"function"==typeof e&&((0,uj._)(this,cU,e),this.addEventListener("removetrack",e))}get onchange(){return(0,uq._)(this,cF)}set onchange(e){(0,uq._)(this,cF)&&(this.removeEventListener("change",(0,uq._)(this,cF)
3),(0,uj._)(this,cF,void 0)),"function"==typeof e&&((0,uj._)(this,cF,e),this.addEventListener("change",e))}constructor(){super(),(0,uY._)(this,cB,{get:cH,set:void 0}),(0,uY._)(this,cN,{writable:!0,value:void 0}),(0,uY._)(this,cU,{writable:!0,value:void 0}),(0,uY._)(this,cF,{writable:!0,value:void 0}),cl(this).trackSet=new Set}}function cH(){return cl(this).trackSet}var cK=new WeakMap;class cW{addRendition(e,t,i){let r=new cP;return r.src=e,r.codec=t,r.bitrate=i,!function(e,t){var i,r;let n=null==(r=cl(e).media)||null==(i=r.deref())?void 0:i.audioRenditions;cl(t).media=cl(e).media,cl(t).track=e;let a=cl(e).renditionSet;a.add(t);let s=a.size-1;s in cC.prototype||Object.defineProperty(cC.prototype,s,{get(){return cI(this)[s]}}),queueMicrotask(()=>{n&&e.enabled&&n.dispatchEvent(new cv("addrendition",{rendition:t}))})}(this,r),r}removeRendition(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.audioRenditions,n=cl(e).track;cl(n).renditionSet.delete(e),queueMicrotask(()=>{let t=cl(e).track;r&&t.enabled&&r.dispatchEvent(new cv("removerendition",{rendition:e}))})}get enabled(){return(0,uq._)(this,cK)}set enabled(e){(0,uq._)(this,cK)!==e&&((0,uj._)(this,cK,e),function(e){var t,i;let r=null==(i=cl(e).media)||null==(t=i.deref())?void 0:t.audioTracks;r&&!cl(r).changeRequested&&(cl(r).changeRequested=!0,queueMicrotask(()=>{delete cl(r).changeRequested,r.dispatchEvent(new Event("change"))}))}(this))}constructor(){(0,u0._)(this,"id",void 0),(0,u0._)(this,"kind",void 0),(0,u0._)(this,"label",""),(0,u0._)(this,"language",""),(0,u0._)(this,"sourceBuffer",void 0),(0,uY._)(this,cK,{writable:!0,value:!1})}}let cV=cj(globalThis.HTMLMediaElement,"video"),cq=cj(globalThis.HTMLMediaElement,"audio");function cY(e){if(!(null==e?void 0:e.prototype))return e;let t=cj(e,"video");(!t||"".concat(t).includes("[native code]"))&&Object.defineProperty(e.prototype,"videoTracks",{get(){return function(e){let t=cl(e).videoTracks;if(!t&&(t=new cp,cl(e).videoTracks=t,cV)){var i;let r=cV.call(null!=(i=e.nativeEl)?i:e);for(let t of r)cd(e,t);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",i=>{if([...t].some(e=>e instanceof ck)){for(let e of r)cu(e);return}cd(e,i.track)}),r.addEventListener("removetrack",e=>{cu(e.track)})}return t}(this)}});let i=cj(e,"audio");(!i||"".concat(i).includes("[native code]"))&&Object.defineProperty(e.prototype,"audioTracks",{get(){return function(e){let t=cl(e).audioTracks;
3if(!t&&(t=new cG,cl(e).audioTracks=t,cq)){var i;let r=cq.call(null!=(i=e.nativeEl)?i:e);for(let t of r)cO(e,t);r.addEventListener("change",()=>{t.dispatchEvent(new Event("change"))}),r.addEventListener("addtrack",i=>{if([...t].some(e=>e instanceof cW)){for(let e of r)cx(e);return}cO(e,i.track)}),r.addEventListener("removetrack",e=>{cx(e.track)})}return t}(this)}}),"addVideoTrack"in e.prototype||(e.prototype.addVideoTrack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=new ck;return r.kind=e,r.label=t,r.language=i,cd(this,r),r}),"removeVideoTrack"in e.prototype||(e.prototype.removeVideoTrack=cu),"addAudioTrack"in e.prototype||(e.prototype.addAudioTrack=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=new cW;return r.kind=e,r.label=t,r.language=i,cO(this,r),r}),"removeAudioTrack"in e.prototype||(e.prototype.removeAudioTrack=cx),"videoRenditions"in e.prototype||Object.defineProperty(e.prototype,"videoRenditions",{get(){return r(this)}});let r=e=>{let t=cl(e).videoRenditions;return t||(cl(t=new c_).media=new WeakRef(e),cl(e).videoRenditions=t),t};"audioRenditions"in e.prototype||Object.defineProperty(e.prototype,"audioRenditions",{get(){return n(this)}});let n=e=>{let t=cl(e).audioRenditions;return t||(cl(t=new cC).media=new WeakRef(e),cl(e).audioRenditions=t),t};return e}function cj(e,t){if(null==e?void 0:e.prototype){var i;return null==(i=Object.getOwnPropertyDescriptor(e.prototype,"".concat(t,"Tracks")))?void 0:i.get}}var cz=e=>{throw TypeError(e)},cQ=(e,t,i)=>t.has(e)||cz("Cannot "+i),cX=(e,t,i)=>(cQ(e,t,"read from private field"),i?i.call(e):t.get(e)),cZ=(e,t,i)=>t.has(e)?cz("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),cJ=(e,t,i,r)=>(cQ(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),c$=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"undefined"==typeof DocumentFragment&&(globalThis.DocumentFragment=class extends c${});var c0,c1=class extends c${},c2=class{get detail(){return cX(this,c0)}initCustomEvent(){}constructor(e,t={}){cZ(this,c0),cJ(this,c0,null==t?void 0:t.detail)}};c0=new WeakMap;var c3={document:{createElement:function(e,t){return new c1}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(c1)},CustomEvent:c2,EventTarget:c$,HTMLElement:c1,HTMLVideoElement:class extends c${}},c4="undefined"==typeof window||void 0===globalThis.customElements,c5=c4?c3:globalThis;c4?c3.document:globalThis.document;var c8,c6=class extends ca(cY(hS)){get autoplay(){let e=this.getAttribute("autoplay");return null!==e&&(""===e||e)}set autoplay(e){e!==this.autoplay&&(e?this.setAttribute("autoplay","string"==typeof e?e:""):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 e;return null!=(e=cX(this,c8))?e:this.muxCastCustomData}set castCustomData(e){cJ(this,c8,e)}constructor(){super(...arguments),cZ(this,c8)}};function c9(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}c8=new WeakMap,c5.customElements.get("mux-video")||(c5.customElements.define("mux-video",c6),c5.MuxVideoElement=c6),e.s(["default",()=>Sh,"getVideoAttribute",()=>Su,"playerSoftwareName",()=>Ss,"playerSoftwareVersion",()=>Sa],645583),e.s(["AttributeToStateChangeEventMap",()=>ms,"AvailabilityStates",()=>mh,"MediaStateChangeEvents",()=>mn,"MediaStateReceiverAttributes",()=>me,"MediaUIAttributes",()=>mr,"MediaUIEvents",()=>c7,"MediaUIProps",()=>mt,"PointerTypes",()=>mu,"ReadyStates",()=>md,"StateChangeEventToAttributeMap",()=>ma,"StreamTypes",()=>mc,"TextTrackKinds",()=>mo,"TextTrackModes",()=>ml,"VolumeLevels",()=>mm,"WebkitPresentationModes",()=>mf],270573);let c7={MEDIA_PLAY_REQUEST:"mediaplayrequest",MEDIA_PAUSE_REQUEST:"mediapauserequest",MEDIA_MUTE_REQUEST:"mediamuterequest",MEDIA_UNMUTE_REQUEST:"mediaunmuterequest",MEDIA_LOOP_REQUEST:"medialooprequest",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:"mediash
3owtexttracksrequest",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"},me={MEDIA_CHROME_ATTRIBUTES:"mediachromeattributes",MEDIA_CONTROLLER:"mediacontroller"},mt={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
3LAYED:"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_LOOP:"mediaLoop",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_LANG:"mediaLang",MEDIA_WIDTH:"mediaWidth"},mi=Object.entries(mt),mr=mi.reduce((e,t)=>{let[i,r]=t;return e[i]=r.toLowerCase(),e},{}),mn=mi.reduce((e,t)=>{let[i,r]=t;return e[i]=r.toLowerCase(),e},{USER_INACTIVE_CHANGE:"userinactivechange",BREAKPOINTS_CHANGE:"breakpointchange",BREAKPOINTS_COMPUTED:"breakpointscomputed"}),ma=Object.entries(mn).reduce((e,t)=>{let[i,r]=t,n=mr[i];return n&&(e[r]=n),e},{userinactivechange:"userinactive"}),ms=Object.entries(mr).reduce((e,t)=>{let[i,r]=t,n=mn[i];return n&&(e[r]=n),e},{userinactive:"userinactivechange"}),mo={SUBTITLES:"subtitles",CAPTIONS:"captions",DESCRIPTIONS:"descriptions",CHAPTERS:"chapters",METADATA:"metadata"},ml={DISABLED:"disabled",HIDDEN:"hidden",SHOWING:"showing"},md={HAVE_NOTHING:0,HAVE_METADATA:1,HAVE_CURRENT_DATA:2,HAVE_FUTURE_DATA:3,HAVE_ENOUGH_DATA:4},mu={MOUSE:"mouse",PEN:"pen",TOUCH:"touch"},mh={UNAVAILABLE:"unavailable",UNSUPPORTED:"unsupported"},mc={LIVE:"live",ON_DEMAND:"on-demand",UNKNOWN:"unknown"},mm={HIGH:"high",MEDIUM:"medium",LOW:"low",OFF:"off"},mf={INLINE:"inline",FULLSCREEN:"fullscreen",PICTURE_IN_PICTURE:"picture-in-picture"};function mp(e){if(e){let{id:t,width:i,height:r}=e;return[t,i,r].filter(e=>null!=e).join(":")}}function mg(e){if(e){let[t,i,r]=e.split(":");return{id:t,width:+i,height:+r}}}function mv(e){if(e){let{id:t,kind:i,language:r,label:n}=e;return[t,i,r,n].filter(e=>null!=e).join(":")}}function mE(e){if(e){let[t,i,r,n]=e.split(":");return{id:t,kind:i,language:r,label:n}}}function my(e){return"number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)}function mb(e){return"string"==typeof e&&!isNaN(e)&&!isNaN(parseFloat(e))}e.i(270573),e.s(["emptyTimeRanges",()=>mL,"formatAsTimePhrase",()=>mk,"formatTime",()=>mI,"serializeTimeRanges",()=>mD],550760);let mT=e=>new Promise(t=>setTimeout(t,e)),m_={en:{"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",Loop:"Loop","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","chapter: {chapterName}":"chapter: {chapterName}",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
3ource 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.",hour:"hour",hours:"hours",minute:"minute",minutes:"minutes",second:"second",seconds:"seconds","{time} remaining":"{time} remaining","{currentTime} of {totalTime}":"{currentTime} of {totalTime}","video not loaded, unknown time.":"video not loaded, unknown time."}},mA=(null==(EG=globalThis.navigator)?void 0:EG.language)||"en",mS=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(e=>{var t,i,r;let[n]=mA.split("-");return(null==(t=m_[mA])?void 0:t[e])||(null==(i=m_[n])?void 0:i[e])||(null==(r=m_.en)?void 0:r[e])||e})(e).replace(/\{(\w+)\}/g,(e,i)=>i in t?String(t[i]):"{".concat(i,"}"))},mR=[{singular:"hour",plural:"hours"},{singular:"minute",plural:"minutes"},{singular:"second",plural:"seconds"}],mk=e=>{if(!my(e))return"";let t=Math.abs(e),i=t!==e,r=new Date(0,0,0,0,0,t,0),n=[r.getHours(),r.getMinutes(),r.getSeconds()].map((e,t)=>e&&((e,t)=>{let i=1===e?mS(mR[t].singular):mS(mR[t].plural);return"".concat(e," ").concat(i)})(e,t)).filter(e=>e).join(", ");return i?mS("{time} remaining",{time:n}):n};function mI(e,t){let i=!1;e<0&&(i=!0,e=0-e);let r=Math.floor((e=e<0?0:e)%60),n=Math.floor(e/60%60),a=Math.floor(e/3600),s=Math.floor(t/60%60),o=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(a=n=r="0"),n=(((a=a>0||o>0?a+":":"")||s>=10)&&n<10?"0"+n:n)+":",(i?"-":"")+a+n+(r=r<10?"0"+r:r)}let mL=Object.freeze({length:0,start(e){let t=e>>>0;if(t>=this.length)throw new DOMException("Failed to execute 'start' on 'TimeRanges': The index provided (".concat(t,") is greater than or equal to the maximum bound (").concat(this.length,")."));return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException("Failed to execute 'end' on 'TimeRanges': The index provided (".concat(t,") is greater than or equal to the maximum bound (").concat(this.length,")."));return 0}});function mD(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:mL;return Array.from(e).map((t,i)=>[Number(e.start(i).toFixed(3)),Number(e.end(i).toFixed(3))].join(":")).join(" ")}e.i(550760);class mw{addEventListener(){}removeEventListener(){}dispatchEvent(){return!0}}class mC extends mw{}class mM extends mC{constructor(){super(...arguments),this.role=null}}let mP={createElement:function(){return new mO.HTMLElement},createElementNS:function(){return new mO.HTMLElement},addEventListener(){},removeEventListener(){},dispatchEvent:e=>!1},mO={ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},document:mP,Node:mC,Element:mM,HTMLElement:class extends mM{get content(){return new mO.DocumentFragment}constructor(){super(...arguments),this.innerHTML=""}},DocumentFragment:class extends mw{},customElements:{get:function(){},define:function(){},whenDefined:function(){}},localStorage:{getItem:e=>null,setItem(e,t){},removeItem(e){}},CustomEvent:function(){},getComputedStyle:function(){},navigator:{languages:[],get userAgent(){return""}},matchMedia:e=>({matches:!1,media:e}),DOMParser:class{parseFromString(e,t){return{body:{textContent:e}}}}},mx="global"in globalThis&&(null==globalThis?void 0:globalThis.global)===globalThis||"undefined"==typeof window||void 0===window.customElements,mN=Object.keys(mO).every(e=>e in globalThis),mU=mx&&!mN?mO:globalThis,mF=mx&&!mN?mP:globalThis.document,mB=new WeakMap,mG=e=>{let t=mB.get(e);return t||mB.set(e,t=new Set),t},mH=new mU.ResizeObserver(e=>{for(let t of e)for(let e of mG(t.target))e(t)});function mK(e,t){mG(e).add(t),mH.observe(e)}function mW(e,t){let i=mG(e);i.delete(t),i.size||mH.unobserve(e)}function mV(e){let t={};for(let i of e)t[i.name]=i.value;return t}function mq(e){var t;return null!=(t=mY(e))?t:mX(e,"media-controller")}function mY(e){var t;let{MEDIA_CONTROLLER:i}=me,r=e.getAttribute(i);if(r)return null==(t=mJ(e))?void 0:t.getElementById(r)}let mj=function(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:".value",r=e.querySelector(i);r&&(r.textContent=t)},mz=(e,t)=>((e,t)=>{let i=e.shadowRoot.querySelector('slot[name="'.concat(t,'"]'));return i?i.children:[]})(e,t)[0],mQ=(e,t)=>!!e&&!!t&&(null!=e&&!!e.contains(t)||mQ(e,t.getRootNode().host)),mX=(e,t)=>{if(!e)return null;let i=e.closest(t);return i||mX(e.getRootNode().host,t)};function mZ(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,i=null==t?void 0:t.activeElement;return i?null!=(e=mZ(i.shadowRoot))?e:i:null}function mJ(e){var t;let i=null==(t=null==e?void 0:e.getRootNode)?void 0:t.call(e);return i instanceof ShadowRoot||i instanceof Document?i:null}function m$(e){let{depth:t=3,checkOpacity:i=!0,checkVisibilityCSS:r=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(e.checkVisibility)return e.checkVisibility({checkOpacity:i,checkVisibilityCSS:r});let n=e;for(;n&&t>0;){let e=getComputedStyle(n);if(i&&"0"===e.opacity||r&&"hidden"===e.visibility||"none"===e.display)return!1;n=n.parentElement,t--}return!0}function m0(e,t){let i=function(e,t){var i,r;let n;for(n of null!=(i=e.querySelectorAll("style:not([media])"))?i:[]){let e;try{e=null==(r=n.sheet)?void 0:r.cssRules}catch(e){continue}for(let i of null!=e?e:[])if(t(i.selectorText))return i}}(e,e=>e===t);return i||m1(e,t)}function m1(e,t){var i,r;let n=null!=(i=e.querySelectorAll("style:not([media])"))?i:[],a=null==n?void 0:n[n.length-1];if(!(null==a?void 0:a.sheet))return console.warn("Media Chrome: No style sheet found on style tag of",e),{style:{setProperty:()=>{},removeProperty:()=>"",getPropertyValue:()=>""}};let s=null==a?void 0:a.sheet.insertRule("".concat(t,"{}"),a.sheet.cssRules.length);return null==(r=a.sheet.cssRules)?void 0:r[s]}function m2(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:NaN,r=e.getAttribute(t);return null!=r?+r:i}function m3(e,t,i){let r=+i;if(null==i||Number.isNaN(r)){e.hasAttribute(t)&&e.removeAttribute(t);return}m2(e,t,void 0)!==r&&e.setAttribute(t,"".concat(r))}function m4(e,t){return e.hasAttribute(t)}function m5(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}m4(e,t)!=i&&e.toggleAttribute(t,i)}function m8(e,t){var i;let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return null!=(i=e.getAttribute(t))?i:r}function m6(e,t,i){if(null==i){e.hasAttribute(t)&&e.removeAttribute(t);return}let r="".concat(i);m8(e,t,void 0)!==r&&e.setAttribute(t,r)}var m9=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},m7=(e,t,i)=>(m9(e,t,"read from private field"),i?i.call(e):t.get(e)),fe=(e,t,i,r)=>(m9(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class ft extends mU.HTMLElement{static get observedAttributes(){return[me.MEDIA_CONTROLLER,mr.MEDIA_PAUSED]}attributeChangedCallback(e,t,i){var r,n,a,s,o;
3e===me.MEDIA_CONTROLLER&&(t&&(null==(n=null==(r=m7(this,EH))?void 0:r.unassociateElement)||n.call(r,this),fe(this,EH,null)),i&&this.isConnected&&(fe(this,EH,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=m7(this,EH))?void 0:s.associateElement)||o.call(s,this)))}connectedCallback(){var e,t;this.tabIndex=-1,this.setAttribute("aria-hidden","true"),fe(this,EH,function(e){var t;let i=e.getAttribute(me.MEDIA_CONTROLLER);return i?null==(t=e.getRootNode())?void 0:t.getElementById(i):mX(e,"media-controller")}(this)),this.getAttribute(me.MEDIA_CONTROLLER)&&(null==(t=null==(e=m7(this,EH))?void 0:e.associateElement)||t.call(e,this)),m7(this,EH)&&(m7(this,EH).addEventListener("pointerdown",this),m7(this,EH).addEventListener("click",this),m7(this,EH).hasAttribute("tabindex")||(m7(this,EH).tabIndex=0))}disconnectedCallback(){var e,t,i,r;this.getAttribute(me.MEDIA_CONTROLLER)&&(null==(t=null==(e=m7(this,EH))?void 0:e.unassociateElement)||t.call(e,this)),null==(i=m7(this,EH))||i.removeEventListener("pointerdown",this),null==(r=m7(this,EH))||r.removeEventListener("click",this),fe(this,EH,null)}handleEvent(e){var t;let i=null==(t=e.composedPath())?void 0:t[0];if(["video","media-controller"].includes(null==i?void 0:i.localName)){if("pointerdown"===e.type)this._pointerType=e.pointerType;else if("click"===e.type){let{clientX:t,clientY:i}=e,{left:r,top:n,width:a,height:s}=this.getBoundingClientRect(),o=t-r,l=i-n;if(o<0||l<0||o>a||l>s||0===a&&0===s)return;let d=this._pointerType||"mouse";if(this._pointerType=void 0,d===mu.TOUCH)return void this.handleTap(e);if(d===mu.MOUSE||d===mu.PEN)return void this.handleMouseClick(e)}}}get mediaPaused(){return m4(this,mr.MEDIA_PAUSED)}set mediaPaused(e){m5(this,mr.MEDIA_PAUSED,e)}handleTap(e){}handleMouseClick(e){let t=this.mediaPaused?c7.MEDIA_PLAY_REQUEST:c7.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new mU.CustomEvent(t,{composed:!0,bubbles:!0}))}constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,EH,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}EH=new WeakMap,ft.shadowRootOptions={mode:"open"},ft.getTemplateHTML=function(e){return"\n    <style>\n      :host {\n        display: var(--media-control-display, var(--media-gesture-receiver-display, inline-block));\n        box-sizing: border-box;\n      }\n    </style>\n  "},mU.customElements.get("media-gesture-receiver")||mU.customElements.define("media-gesture-receiver",ft);var fi=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fr=(e,t,i)=>(fi(e,t,"read from private field"),i?i.call(e):t.get(e)),fn=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},fa=(e,t,i,r)=>(fi(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),fs=(e,t,i)=>(fi(e,t,"access private method"),i);let fo={AUDIO:"audio",AUTOHIDE:"autohide",BREAKPOINTS:"breakpoints",GESTURES_DISABLED:"gesturesdisabled",KEYBOARD_CONTROL:"keyboardcontrol",NO_AUTOHIDE:"noautohide",USER_INACTIVE:"userinactive",AUTOHIDE_OVER_CONTROLS:"autohideovercontrols"},fl=Object.values(mr);function fd(e,t){var i,r,n;if(!e.isConnected)return;let a=Object.fromEntries((null!=(i=e.getAttribute(fo.BREAKPOINTS))?i:"sm:384 md:576 lg:768 xl:960").split(/\s+/).map(e=>e.split(":"))),s=(r=a,n=t,Object.keys(r).filter(e=>n>=parseInt(r[e]))),o=!1;if(Object.keys(a).forEach(t=>{if(s.includes(t)){e.hasAttribute("breakpoint".concat(t))||(e.setAttribute("breakpoint".concat(t),""),o=!0);return}e.hasAttribute("breakpoint".concat(t))&&(e.removeAttribute("breakpoint".concat(t)),o=!0)}),o){let t=new CustomEvent(mn.BREAKPOINTS_CHANGE,{detail:s});e.dispatchEvent(t)}e.breakpointsComputed||(e.breakpointsComputed=!0,e.dispatchEvent(new CustomEvent(mn.BREAKPOINTS_COMPUTED,{bubbles:!0,composed:!0})))}class fu extends mU.HTMLElement{static get observedAttributes(){return[fo.AUTOHIDE,fo.GESTURES_DISABLED].concat(fl).filter(e=>![mr.MEDIA_RENDITION_LIST,mr.MEDIA_AUDIO_TRACK_LIST,mr.MEDIA_CHAPTERS_CUES,mr.MEDIA_WIDTH,mr.MEDIA_HEIGHT,mr.MEDIA_ERROR,mr.MEDIA_ERROR_MESSAGE].includes(e))}attributeChangedCallback(e,t,i){e.toLowerCase()==fo.AUTOHIDE&&(this.autohide=i)}get media(){let e=this.querySelector(":scope > [slot=media]");return(null==e?void 0:e.nodeName)=="SLOT"&&(e=e.assignedElements({flatten:!0})[0]),e}async handleMediaUpdated(e){e&&(fa(this,EV,e),e.localName.includes("-")&&await mU.customElements.whenDefined(e.localName),this.mediaSetCallback(e))}connectedCallback(){var e;fr(this,EK).observe(this,{childList:!0,subtree:!0}),mK(this,fr(this,EQ));let t=null!=this.getAttribute(fo.AUDIO)?mS("audio player"):mS("video player");
3this.setAttribute("role","region"),this.setAttribute("aria-label",t),this.handleMediaUpdated(this.media),this.setAttribute(fo.USER_INACTIVE,""),fd(this,this.getBoundingClientRect().width);let i=this.querySelector(":scope > slot[slot=media]");i&&(fa(this,E8,i),fr(this,E8).addEventListener("slotchange",fr(this,E6))),this.addEventListener("pointerdown",this),this.addEventListener("pointermove",this),this.addEventListener("pointerup",this),this.addEventListener("mouseleave",this),this.addEventListener("keyup",this),null==(e=mU.window)||e.addEventListener("mouseup",this)}disconnectedCallback(){var e;mW(this,fr(this,EQ)),clearTimeout(fr(this,Eq)),fr(this,EK).disconnect(),this.media&&this.mediaUnsetCallback(this.media),null==(e=mU.window)||e.removeEventListener("mouseup",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointermove",this),this.removeEventListener("pointerup",this),this.removeEventListener("mouseleave",this),this.removeEventListener("keyup",this),fr(this,E8)&&(fr(this,E8).removeEventListener("slotchange",fr(this,E6)),fa(this,E8,null)),fa(this,Ez,!1)}mediaSetCallback(e){}mediaUnsetCallback(e){fa(this,EV,null)}handleEvent(e){switch(e.type){case"pointerdown":fa(this,EW,e.timeStamp);break;case"pointermove":fs(this,EX,EZ).call(this,e);break;case"pointerup":fs(this,EJ,E$).call(this,e);break;case"mouseleave":fs(this,E0,E1).call(this);break;case"mouseup":this.removeAttribute(fo.KEYBOARD_CONTROL);break;case"keyup":fs(this,E4,E5).call(this),this.setAttribute(fo.KEYBOARD_CONTROL,"")}}set autohide(e){let t=Number(e);fa(this,EY,isNaN(t)?0:t)}get autohide(){return(void 0===fr(this,EY)?2:fr(this,EY)).toString()}get breakpoints(){return m8(this,fo.BREAKPOINTS)}set breakpoints(e){m6(this,fo.BREAKPOINTS,e)}get audio(){return m4(this,fo.AUDIO)}set audio(e){m5(this,fo.AUDIO,e)}get gesturesDisabled(){return m4(this,fo.GESTURES_DISABLED)}set gesturesDisabled(e){m5(this,fo.GESTURES_DISABLED,e)}get keyboardControl(){return m4(this,fo.KEYBOARD_CONTROL)}set keyboardControl(e){m5(this,fo.KEYBOARD_CONTROL,e)}get noAutohide(){return m4(this,fo.NO_AUTOHIDE)}set noAutohide(e){m5(this,fo.NO_AUTOHIDE,e)}get autohideOverControls(){return m4(this,fo.AUTOHIDE_OVER_CONTROLS)}set autohideOverControls(e){m5(this,fo.AUTOHIDE_OVER_CONTROLS,e)}get userInteractive(){return m4(this,fo.USER_INACTIVE)}set userInteractive(e){m5(this,fo.USER_INACTIVE,e)}constructor(){if(super(),fn(this,EX),fn(this,EJ),fn(this,E0),fn(this,E2),fn(this,E4),fn(this,EK,void 0),fn(this,EW,0),fn(this,EV,null),fn(this,Eq,null),fn(this,EY,void 0),this.breakpointsComputed=!1,fn(this,Ej,e=>{let t=this.media;for(let i of e)if("childList"===i.type){for(let e of i.removedNodes){if("media"!=e.slot||i.target!=this)continue;let r=i.previousSibling&&i.previousSibling.previousElementSibling;if(r&&t){let t="media"!==r.slot;for(;null!==(r=r.previousSibling);)"media"==r.slot&&(t=!1);t&&this.mediaUnsetCallback(e)}else this.mediaUnsetCallback(e)}if(t)for(let e of i.addedNodes)e===t&&this.handleMediaUpdated(t)}}),fn(this,Ez,!1),fn(this,EQ,e=>{fr(this,Ez)||(setTimeout(()=>{!function(e){fd(e.target,e.contentRect.width)}(e),fa(this,Ez,!1)},0),fa(this,Ez,!0))}),fn(this,E8,void 0),fn(this,E6,()=>{if(!fr(this,E8).assignedElements({flatten:!0}).length){fr(this,EV)&&this.mediaUnsetCallback(fr(this,EV));return}this.handleMediaUpdated(this.media)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}fa(this,EK,new MutationObserver(fr(this,Ej)))}}EK=new WeakMap,EW=new WeakMap,EV=new WeakMap,Eq=new WeakMap,EY=new WeakMap,Ej=new WeakMap,Ez=new WeakMap,EQ=new WeakMap,EX=new WeakSet,EZ=function(e){if("mouse"!==e.pointerType&&e.timeStamp-fr(this,EW)<250)return;fs(this,E2,E3).call(this),clearTimeout(fr(this,Eq));let t=this.hasAttribute(fo.AUTOHIDE_OVER_CONTROLS);([this,this.media].includes(e.target)||t)&&fs(this,E4,E5).call(this)},EJ=new WeakSet,E$=function(e){if("touch"===e.pointerType){let t=!this.hasAttribute(fo.USER_INACTIVE);[this,this.media].includes(e.target)&&t?fs(this,E0,E1).call(this):fs(this,E4,E5).call(this)}else e.composedPath().some(e=>["media-play-button","media-fullscreen-button"].includes(null==e?void 0:e.localName))&&fs(this,E4,E5).call(this)},E0=new WeakSet,E1=function(){if(0>fr(this,EY)||this.hasAttribute(fo.USER_INACTIVE))return;this.setAttribute(fo.USER_INACTIVE,"");let e=new mU.CustomEvent(mn.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!0});this.dispatchEvent(e)},E2=new WeakSet,E3=function(){if(!this.hasAttribute(fo.USER_INACTIVE))return;this.removeAttribute(fo.USER_INACTIVE);let e=new mU.CustomEvent(mn.USER_INACTIVE_CHANGE,{composed:!0,bubbles:!0,detail:!1});this.dispatchEvent(e)},E4=new WeakSet,E5=function(){fs(this,E2,E3).call(this),clearTimeout(fr(this,Eq));let e=parseInt(this.autohide);e<0||fa(this,Eq,setTimeout(()=>{fs(this,E0,E1).call(this)},1e3*e))},E8=new WeakMap,E6=new WeakMap,fu.shadowRootOptions={mode:"open"},fu.getTemplateHTML=function(e){return"\n    <style>\n      \n      :host([".concat(mr.MEDIA_IS_FULLSCREEN,"]) ::slotted([slot=media]) {\n        outline: none;\n      }\n\n      :host {\n        box-sizing: border-box;\n        position: relative;\n        display: inline-block;\n        line-height: 0;\n        background-color: var(--media-background-color, #000);\n        overflow: hidden;\n      }\n\n      :host(:not([").concat(fo.AUDIO,"])) [part~=layer]:not([part~=media-layer]) {\n        position: absolute;\n        top: 0;\n        left: 0;\n        bottom: 0;\n        right: 0;\n        display: flex;\n        flex-flow: column nowrap;\n        align-items: start;\n        pointer-events: none;\n        background: none;\n      }\n\n      slot[name=media] {\n        display: var(--media-slot-display, contents);\n      }\n\n      ","\n      :host([").concat(fo.AUDIO,"]) slot[name=media] {\n        display: var(--media-slot-display, none);\n      }\n\n      ","\n      :host([").concat(fo.AUDIO,"]) [part~=layer][part~=gesture-layer] {\n        height: 0;\n        display: block;\n      }\n\n      ","\n      :host(:not([").concat(fo.AUDIO,"])[").concat(fo.GESTURES_DISABLED,"]) ::slotted([slot=gestures-chrome]),\n          :host(:not([").concat(fo.AUDIO,"])[").concat(fo.GESTURES_DISABLED,"]) media-gesture-receiver[slot=gestures-chrome] {\n        display: none;\n      }\n\n      ","\n      ::slotted(:not([slot=media]):not([slot=poster]):not(media-loading-indicator):not([role=dialog]):not([hidden])) {\n        pointer-events: auto;\n      }\n\n      :host(:not([").concat(fo.AUDIO,"])) *[part~=layer][part~=centered-layer] {\n        align-items: center;\n        justify-content: center;\n      }\n\n      :host(:not([").concat(fo.AUDIO,"])) ::slotted(media-gesture-receiver[slot=gestures-chrome]),\n      :host(:not([").concat(fo.AUDIO,"])) media-gesture-receiver[slot=gestures-chrome] {\n        align-self: stretch;\n        flex-grow: 1;\n      }\n\n      slot[name=middle-chrome] {\n        display: inline;\n        flex-grow: 1;\n        pointer-events: none;\n        background: none;\n      }\n\n      ","\n      ::slotted([slot=media]),\n      ::slotted([slot=poster]) {\n        width: 100%;\n        height: 100%;\n      }\n\n      ","\n      :host(:not([").concat(fo.AUDIO,"])) .spacer {\n        flex-grow: 1;\n      }\n\n      ","\n      :host(:-webkit-full-screen) {\n        ","\n        width: 100% !important;\n        height: 100% !important;\n      }\n\n      ","\n      ::slotted(:not([slot=media]):not([slot=poster]):not([").concat(fo.NO_AUTOHIDE,"]):not([hidden]):not([role=dialog])) {\n        opacity: 1;\n        transition: var(--media-control-transition-in, opacity 0.25s);\n      }\n\n      ","\n      :host([").concat(fo.USER_INACTIVE,"]:not([").concat(mr.MEDIA_PAUSED,"]):not([").concat(mr.MEDIA_IS_AIRPLAYING,"]):not([").concat(mr.MEDIA_IS_CASTING,"]):not([").concat(fo.AUDIO,"])) ::slotted(:not([slot=media]):not([slot=poster]):not([").concat(fo.NO_AUTOHIDE,"]):not([role=dialog])) {\n        opacity: 0;\n        transition: var(--media-control-transition-out, opacity 1s);\n      }\n\n      :host([").concat(fo.USER_INACTIVE,"]:not([").concat(fo.NO_AUTOHIDE,"]):not([").concat(mr.MEDIA_PAUSED,"]):not([").concat(mr.MEDIA_IS_CASTING,"]):not([").concat(fo.AUDIO,"])) ::slotted([slot=media]) {\n        cursor: n
3one;\n      }\n\n      :host([").concat(fo.USER_INACTIVE,"][").concat(fo.AUTOHIDE_OVER_CONTROLS,"]:not([").concat(fo.NO_AUTOHIDE,"]):not([").concat(mr.MEDIA_PAUSED,"]):not([").concat(mr.MEDIA_IS_CASTING,"]):not([").concat(fo.AUDIO,"])) * {\n        --media-cursor: none;\n        cursor: none;\n      }\n\n\n      ::slotted(media-control-bar)  {\n        align-self: stretch;\n      }\n\n      ","\n      :host(:not([").concat(fo.AUDIO,"])[").concat(mr.MEDIA_HAS_PLAYED,']) slot[name=poster] {\n        display: none;\n      }\n\n      ::slotted([role=dialog]) {\n        width: 100%;\n        height: 100%;\n        align-self: center;\n      }\n\n      ::slotted([role=menu]) {\n        align-self: end;\n      }\n    </style>\n\n    <slot name="media" part="layer media-layer"></slot>\n    <slot name="poster" part="layer poster-layer"></slot>\n    <slot name="gestures-chrome" part="layer gesture-layer">\n      <media-gesture-receiver slot="gestures-chrome">\n        <template shadowrootmode="').concat(ft.shadowRootOptions.mode,'">\n          ').concat(ft.getTemplateHTML({}),'\n        </template>\n      </media-gesture-receiver>\n    </slot>\n    <span part="layer vertical-layer">\n      <slot name="top-chrome" part="top chrome"></slot>\n      <slot name="middle-chrome" part="middle chrome"></slot>\n      <slot name="centered-chrome" part="layer centered-layer center centered chrome"></slot>\n      ','\n      <slot part="bottom chrome"></slot>\n    </span>\n    <slot name="dialog" part="layer dialog-layer"></slot>\n  ')},mU.customElements.get("media-container")||mU.customElements.define("media-container",fu);var fh=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fc=(e,t,i)=>(fh(e,t,"read from private field"),i?i.call(e):t.get(e)),fm=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},ff=(e,t,i,r)=>(fh(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class fp{[Symbol.iterator](){return fc(this,yi,yr).values()}get length(){return fc(this,yi,yr).size}get value(){var e;return null!=(e=[...fc(this,yi,yr)].join(" "))?e:""}set value(e){var t;e!==this.value&&(ff(this,yt,new Set),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return[...fc(this,yi,yr)][e]}values(){return fc(this,yi,yr).values()}forEach(e,t){fc(this,yi,yr).forEach(e,t)}add(){for(var e,t,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];r.forEach(e=>fc(this,yt).add(e)),(""!==this.value||(null==(e=fc(this,E9))?void 0:e.hasAttribute("".concat(fc(this,E7)))))&&(null==(t=fc(this,E9))||t.setAttribute("".concat(fc(this,E7)),"".concat(this.value)))}remove(){for(var e,t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(e=>fc(this,yt).delete(e)),null==(e=fc(this,E9))||e.setAttribute("".concat(fc(this,E7)),"".concat(this.value))}contains(e){return fc(this,yi,yr).has(e)}toggle(e,t){if(void 0!==t)if(t)return this.add(e),!0;else return this.remove(e),!1;return this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){return this.remove(e),this.add(t),e===t}constructor(e,t,{defaultValue:i}={defaultValue:void 0}){fm(this,yi),fm(this,E9,void 0),fm(this,E7,void 0),fm(this,ye,void 0),fm(this,yt,new Set),ff(this,E9,e),ff(this,E7,t),ff(this,ye,new Set(i))}}E9=new WeakMap,E7=new WeakMap,ye=new WeakMap,yt=new WeakMap,yi=new WeakSet,yr=function(){return fc(this,yt).size?fc(this,yt):fc(this,ye)};let fg=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.split(/\s+/)},fv=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",[t,i,r]=e.split(":"),n=r?decodeURIComponent(r):void 0;return{kind:"cc"===t?mo.CAPTIONS:mo.SUBTITLES,language:i,label:n}},fE=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return fg(e).map(e=>{let i=fv(e);return{...t,...i}})},fy=e=>e?Array.isArray(e)?e.map(e=>"string"==typeof e?fv(e):e):"string"==typeof e?fE(e):[e]:[],fb=function(){let{kind:e,label:t,language:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{kind:"subtitles"};return t?"".concat("captions"===e?"cc":"sb",":").concat(i,":").concat(encodeURIComponent(t)):i},fT=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Array.prototype.map.call(e,fb).join(" ")},f_=e=>{let t=Object.entries(e).map(e=>{let[t,i]=e;return e=>e[t]===i});return e=>t.every(t=>t(e))},fA=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=fy(i).map(f_);Array.from(t).filter(e=>r.some(t=>
3t(e))).forEach(t=>{t.mode=e})},fS=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>!0;if(!(null==e?void 0:e.textTracks))return[];let i="function"==typeof t?t:f_(t);return Array.from(e.textTracks).filter(i)},fR=e=>{var t;return!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)||e.hasAttribute(mr.MEDIA_SUBTITLES_SHOWING)},fk="exitFullscreen"in mF?"exitFullscreen":"webkitExitFullscreen"in mF?"webkitExitFullscreen":"webkitCancelFullScreen"in mF?"webkitCancelFullScreen":void 0,fI="fullscreenElement"in mF?"fullscreenElement":"webkitFullscreenElement"in mF?"webkitFullscreenElement":void 0,fL="fullscreenEnabled"in mF?"fullscreenEnabled":"webkitFullscreenEnabled"in mF?"webkitFullscreenEnabled":void 0,fD=()=>{var e;return d||(d=null==(e=null==mF?void 0:mF.createElement)?void 0:e.call(mF,"video"))},fw=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fD();if(!e)return!1;let t=e.volume;e.volume=t/2+.1;let i=new AbortController,r=await Promise.race([fC(e,i.signal),fM(e,t)]);return i.abort(),r},fC=(e,t)=>new Promise(i=>{e.addEventListener("volumechange",()=>i(!0),{signal:t})}),fM=async(e,t)=>{for(let i=0;i<10;i++){if(e.volume===t)return!1;await mT(10)}return e.volume!==t},fP=/.*Version\/.*Safari\/.*/.test(mU.navigator.userAgent),fO=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fD();return(!mU.matchMedia("(display-mode: standalone)").matches||!fP)&&"function"==typeof(null==e?void 0:e.requestPictureInPicture)},fx=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fD(),{documentElement:t,media:i}={documentElement:mF,media:e};return!!(null==t?void 0:t[fL])||i&&"webkitSupportsFullscreen"in i},fN=fx(),fU=fO(),fF=!!mU.WebKitPlaybackTargetAvailabilityEvent,fB=!!mU.chrome,fG=e=>fS(e.media,e=>[mo.SUBTITLES,mo.CAPTIONS].includes(e.kind)).sort((e,t)=>e.kind>=t.kind?1:-1),fH=e=>fS(e.media,e=>e.mode===ml.SHOWING&&[mo.SUBTITLES,mo.CAPTIONS].includes(e.kind)),fK=(e,t)=>{let i=fG(e),r=fH(e),n=!!r.length;if(i.length){if(!1===t||n&&!0!==t)fA(ml.DISABLED,i,r);else if(!0===t||!n&&!1!==t){let t=i[0],{options:n}=e;if(!(null==n?void 0:n.noSubtitlesLangPref)){let e=mU.localStorage.getItem("media-chrome-pref-subtitles-lang"),r=e?[e,...mU.navigator.languages]:mU.navigator.languages,n=i.filter(e=>r.some(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))).sort((e,t)=>r.findIndex(t=>e.language.toLowerCase().startsWith(t.split("-")[0]))-r.findIndex(e=>t.language.toLowerCase().startsWith(e.split("-")[0])));n[0]&&(t=n[0])}let{language:a,label:s,kind:o}=t;fA(ml.DISABLED,i,r),fA(ml.SHOWING,i,[{language:a,label:s,kind:o}])}}},fW=(e,t)=>e===t||null!=e&&null!=t&&typeof e==typeof t&&(!!("number"==typeof e&&Number.isNaN(e)&&Number.isNaN(t))||"object"==typeof e&&(Array.isArray(e)?fV(e,t):Object.entries(e).every(e=>{let[i,r]=e;return i in t&&fW(r,t[i])}))),fV=(e,t)=>{let i=Array.isArray(e),r=Array.isArray(t);return i===r&&(!i&&!r||e.length===t.length&&e.every((e,i)=>fW(e,t[i])))},fq=Object.values(mc),fY=fw().then(e=>u=e),fj=async function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];await Promise.all(t.filter(e=>e).map(async e=>{if(!("localName"in e&&e instanceof mU.HTMLElement))return;let t=e.localName;if(!t.includes("-"))return;let i=mU.customElements.get(t);i&&e instanceof i||(await mU.customElements.whenDefined(t),mU.customElements.upgrade(e))}))},fz=new mU.DOMParser,fQ={mediaError:{get(e,t){let{media:i}=e;if((null==t?void 0:t.type)!=="playing")return null==i?void 0:i.error},mediaEvents:["emptied","error","playing"]},mediaErrorCode:{get(e,t){var i;let{media:r}=e;if((null==t?void 0:t.type)!=="playing")return null==(i=null==r?void 0:r.error)?void 0:i.code},mediaEvents:["emptied","error","playing"]},mediaErrorMessage:{get(e,t){var i,r;let{media:n}=e;if((null==t?void 0:t.type)!=="playing")return null!=(r=null==(i=null==n?void 0:n.error)?void 0:i.message)?r:""},mediaEvents:["emptied","error","playing"]},mediaWidth:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.videoWidth)?t:0},mediaEvents:["resize"]},mediaHeight:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.videoHeight)?t:0},mediaEvents:["resize"]},mediaPaused:{get(e){var t;let{media:i}=e;return null==(t=null==i?void 0:i.paused)||t},set(e,t){var i;let{media:r}=t;r&&(e?r.pause():null==(i=r.play())||i.catch(()=>{}))},mediaEvents:["play","playing","pause","emptied"]},mediaHasPlayed:{get(e,t){let{media:i}=e;return!!i&&(t?"playing"===t.type:!i.paused)},mediaEvents:["playing","emptied"]},mediaEnded:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.ended)&&t},mediaEvents:["seeked","ended","emptied"]},mediaPlaybackRate:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.playbackRate)?t:1},set(e,t){let{media:i}=t;i&&Number.isFinite(+e)&&(i.playbackRate=+e)},mediaEvents:["ratechange","loadstart"]},mediaMuted:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.muted)&&t},set(e,t){let{media:i,options:{noMutedPref:r}={}}=t;if(i){i.muted=e;try{let t=null!==mU.localStorage.getItem("media-chrome-pref-muted"),n=i.hasAttribute("muted");if(r){t&&mU.localStorage.removeItem("media-chrome-pref-muted");return}if(n&&!t)return;mU.localStorage.setItem("media-chrome-pref-muted",e?"true":"false")}catch(e){console.debug("Error setting muted pref",e)}}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{let{options:{noMutedPref:i}}=t,{media:r}=t;if(r&&!r.muted&&!i)try{let i="true"===mU.localStorage.getItem("media-chrome-pref-muted");fQ.mediaMuted.set(i,t),e(i)}catch(e){console.debug("Error getting muted pref",e)}}]},mediaLoop:{get(e){let{media:t}=e;return null==t?void 0:t.loop},set(e,t){let{media:i}=t;i&&(i.loop=e)},mediaEvents:["medialooprequest"]},mediaVolume:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.volume)?t:1},set(e,t){let{media:i,options:{noVolumePref:r}={}}=t;if(i){try{null==e?mU.localStorage.removeItem("media-chrome-pref-volume"):i.hasAttribute("muted")||r||mU.localStorage.setItem("media-chrome-pref-volume",e.toString())}catch(e){console.debug("Error setting volume pref",e)}Number.isFinite(+e)&&(i.volume=+e)}},mediaEvents:["volumechange"],stateOwnersUpdateHandlers:[(e,t)=>{let{options:{noVolumePref:i}}=t;if(!i)try{let{media:i}=t;if(!i)return;let r=mU.localStorage.getItem("media-chrome-pref-volume");if(null==r)return;fQ.mediaVolume.set(+r,t),e(+r)}catch(e){console.debug("Error getting volume pref",e)}}]},mediaVolumeLevel:{get(e){let{media:t}=e;return void 0===(null==t?void 0:t.volume)?"high":t.muted||0===t.volume?"off":t.volume<.5?"low":t.volume<.75?"medium":"high"},mediaEvents:["volumechange"]},mediaCurrentTime:{get(e){var t;let{media:i}=e;return null!=(t=null==i?void 0:i.currentTime)?t:0},set(e,t){let{media:i}=t;i&&my(e)&&(i.currentTime=e)},mediaEvents:["timeupdate","loadedmetadata"]},mediaDuration:{get(e){let{media:t,options:{defaultDuration:i}={}}=e;return i&&(!t||!t.duration||Number.isNaN(t.duration)||!Number.isFinite(t.duration))?i:Number.isFinite(null==t?void 0:t.duration)?t.duration:NaN},mediaEvents:["durationchange","loadedmetadata","emptied"]},mediaLoading:{get(e){let{media:t}=e;return(null==t?void 0:t.readyState)<3},mediaEvents:["waiting","playing","emptied"]},mediaSeekable:{get(e){var t;let{media:i}=e;if(!(null==(t=null==i?void 0:i.seekable)?void 0:t.length))return;let r=i.seekable.start(0),n=i.seekable.end(i.seekable.length-1);if(r||n)return[Number(r.toFixed(3)),Number(n.toFixed(3))]},mediaEvents:["loadedmetadata","emptied","progress","seekablechange"]},mediaBuffered:{get(e){var t;let{media:i}=e,r=null!=(t=null==i?void 0:i.buffered)?t:[];return Array.from(r).map((e,t)=>[Number(r.start(t).toFixed(3)),Number(r.end(t).toFixed(3))])},mediaEvents:["progress","emptied"]},mediaStreamType:{get(e){let{media:t,options:{defaultStreamType:i}={}}=e,r=[mc.LIVE,mc.ON_DEMAND].includes(i)?i:void 0;if(!t)return r;let{streamType:n}=t;if(fq.includes(n))return n===mc.UNKNOWN?r:n;let a=t.duration;return a===1/0?mc.LIVE:Number.isFinite(a)?mc.ON_DEMAND:r}
3,mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange"]},mediaTargetLiveWindow:{get(e){let{media:t}=e;if(!t)return NaN;let{targetLiveWindow:i}=t,r=fQ.mediaStreamType.get(e);return(null==i||Number.isNaN(i))&&r===mc.LIVE?0:i},mediaEvents:["emptied","durationchange","loadedmetadata","streamtypechange","targetlivewindowchange"]},mediaTimeIsLive:{get(e){let{media:t,options:{liveEdgeOffset:i=10}={}}=e;if(!t)return!1;if("number"==typeof t.liveEdgeStart)return!Number.isNaN(t.liveEdgeStart)&&t.currentTime>=t.liveEdgeStart;if(fQ.mediaStreamType.get(e)!==mc.LIVE)return!1;let r=t.seekable;if(!r)return!0;if(!r.length)return!1;let n=r.end(r.length-1)-i;return t.currentTime>=n},mediaEvents:["playing","timeupdate","progress","waiting","emptied"]},mediaSubtitlesList:{get:e=>fG(e).map(e=>{let{kind:t,label:i,language:r}=e;return{kind:t,label:i,language:r}}),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack"]},mediaSubtitlesShowing:{get:e=>fH(e).map(e=>{let{kind:t,label:i,language:r}=e;return{kind:t,label:i,language:r}}),mediaEvents:["loadstart"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i,r;let{media:n,options:a}=t;if(!n)return;let s=e=>{var i;a.defaultSubtitles&&(e&&![mo.CAPTIONS,mo.SUBTITLES].includes(null==(i=null==e?void 0:e.track)?void 0:i.kind)||fK(t,!0))};return n.addEventListener("loadstart",s),null==(i=n.textTracks)||i.addEventListener("addtrack",s),null==(r=n.textTracks)||r.addEventListener("removetrack",s),()=>{var e,t;n.removeEventListener("loadstart",s),null==(e=n.textTracks)||e.removeEventListener("addtrack",s),null==(t=n.textTracks)||t.removeEventListener("removetrack",s)}}]},mediaChaptersCues:{get(e){var t;let{media:i}=e;if(!i)return[];let[r]=fS(i,{kind:mo.CHAPTERS});return Array.from(null!=(t=null==r?void 0:r.cues)?t:[]).map(e=>{let{text:t,startTime:i,endTime:r}=e;return{text:t&&fz.parseFromString(t,"text/html").body.textContent||t,startTime:i,endTime:r}})},mediaEvents:["loadstart","loadedmetadata"],textTracksEvents:["addtrack","removetrack","change"],stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(!r)return;let n=r.querySelector('track[kind="chapters"][default][src]'),a=null==(i=r.shadowRoot)?void 0:i.querySelector(':is(video,audio) > track[kind="chapters"][default][src]');return null==n||n.addEventListener("load",e),null==a||a.addEventListener("load",e),()=>{null==n||n.removeEventListener("load",e),null==a||a.removeEventListener("load",e)}}]},mediaIsPip:{get(e){var t,i;let{media:r,documentElement:n}=e;if(!r||!n||!n.pictureInPictureElement)return!1;if(n.pictureInPictureElement===r)return!0;if(n.pictureInPictureElement instanceof HTMLMediaElement)return!!(null==(t=r.localName)?void 0:t.includes("-"))&&mQ(r,n.pictureInPictureElement);if(n.pictureInPictureElement.localName.includes("-")){let e=n.pictureInPictureElement.shadowRoot;for(;null==e?void 0:e.pictureInPictureElement;){if(e.pictureInPictureElement===r)return!0;e=null==(i=e.pictureInPictureElement)?void 0:i.shadowRoot}}return!1},set(e,t){let{media:i}=t;if(i)if(e){if(!mF.pictureInPictureEnabled)return void console.warn("MediaChrome: Picture-in-picture is not enabled");if(!i.requestPictureInPicture)return void console.warn("MediaChrome: The current media does not support picture-in-picture");let e=()=>{console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a readyState > 0.")};i.requestPictureInPicture().catch(t=>{if(11===t.code){if(!i.src)return void console.warn("MediaChrome: The media is not ready for picture-in-picture. It must have a src set.");if(0===i.readyState&&"none"===i.preload){let t=()=>{i.removeEventListener("loadedmetadata",r),i.preload="none"},r=()=>{i.requestPictureInPicture().catch(e),t()};i.addEventListener("loadedmetadata",r),i.preload="metadata",setTimeout(()=>{0===i.readyState&&e(),t()},1e3)}else throw t}else throw t})}else mF.pictureInPictureElement&&mF.exitPictureInPicture()},mediaEvents:["enterpictureinpicture","leavepictureinpicture"]},mediaRenditionList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.videoRenditions)?t:[]].map(e=>({...e}))},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaRenditionSelected:{get(e){var t,i,r;let{media:n}=e;return null==(r=null==(i=null==n?void 0:n.videoRenditions)?void 0:i[null==(t=n.videoRenditions)?void 0:t.selectedIndex])?void 0:r.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.videoRenditions))return void console.warn("MediaController: Rendition selection not supported by this media.");let r=Array.prototype.findIndex.call(i.videoRenditions,t=>t.id==e);i.videoRenditions.selectedIndex!=r&&(i.videoRenditions.selectedIndex=r)},mediaEvents:["emptied"],videoRenditionsEvents:["addrendition","removerendition","change"]},mediaAudioTrackList:{get(e){var t;let{media:i}=e;return[...null!=(t=null==i?void 0:i.audioTracks)?t:[]]},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaAudioTrackEnabled:{get(e){var t,i;let{media:r}=e;return null==(i=[...null!=(t=null==r?void 0:r.audioTracks)?t:[]].find(e=>e.enabled))?void 0:i.id},set(e,t){let{media:i}=t;if(!(null==i?void 0:i.audioTracks))return void console.warn("MediaChrome: Audio track selection not supported by this media.");
3for(let t of i.audioTracks)t.enabled=e==t.id},mediaEvents:["emptied"],audioTracksEvents:["addtrack","removetrack","change"]},mediaIsFullscreen:{get:e=>(e=>{var t;let{media:i,documentElement:r,fullscreenElement:n=i}=e;if(!i||!r)return!1;let a=(e=>{let{documentElement:t,media:i}=e,r=null==t?void 0:t[fI];return!r&&"webkitDisplayingFullscreen"in i&&"webkitPresentationMode"in i&&i.webkitDisplayingFullscreen&&i.webkitPresentationMode===mf.FULLSCREEN?i:r})(e);if(!a)return!1;if(a===n||a===i)return!0;if(a.localName.includes("-")){let e=a.shadowRoot;if(!(fI in e))return mQ(a,n);for(;null==e?void 0:e[fI];){if(e[fI]===n)return!0;e=null==(t=e[fI])?void 0:t.shadowRoot}}return!1})(e),set(e,t,i){var r,n;e?((e=>{var t;let{media:i,fullscreenElement:r}=e;try{let e=r&&"requestFullscreen"in r?"requestFullscreen":r&&"webkitRequestFullScreen"in r?"webkitRequestFullScreen":void 0;if(e){let i=null==(t=r[e])?void 0:t.call(r);if(i instanceof Promise)return i.catch(()=>{})}else(null==i?void 0:i.webkitEnterFullscreen)?i.webkitEnterFullscreen():(null==i?void 0:i.requestFullscreen)&&i.requestFullscreen()}catch(e){console.error(e)}})(t),!i.detail||(null==(r=t.media)?void 0:r.inert)||null==(n=t.media)||n.focus()):(e=>{var t;let{documentElement:i}=e;if(fk){let e=null==(t=null==i?void 0:i[fk])?void 0:t.call(i);if(e instanceof Promise)return e.catch(()=>{})}})(t)},rootEvents:["fullscreenchange","webkitfullscreenchange"],mediaEvents:["webkitbeginfullscreen","webkitendfullscreen","webkitpresentationmodechanged"]},mediaIsCasting:{get(e){var t;let{media:i}=e;return!!(null==i?void 0:i.remote)&&(null==(t=i.remote)?void 0:t.state)!=="disconnected"&&"connected"===i.remote.state},set(e,t){var i,r;let{media:n}=t;if(n&&(!e||(null==(i=n.remote)?void 0:i.state)==="disconnected")&&(e||(null==(r=n.remote)?void 0:r.state)==="connected")){if("function"!=typeof n.remote.prompt)return void console.warn("MediaChrome: Casting is not supported in this environment");n.remote.prompt().catch(()=>{})}},remoteEvents:["connect","connecting","disconnect"]},mediaIsAirplaying:{get:()=>!1,set(e,t){let{media:i}=t;if(i){if(!(i.webkitShowPlaybackTargetPicker&&mU.WebKitPlaybackTargetAvailabilityEvent))return void console.error("MediaChrome: received a request to select AirPlay but AirPlay is not supported in this environment");i.webkitShowPlaybackTargetPicker()}},mediaEvents:["webkitcurrentplaybacktargetiswirelesschanged"]},mediaFullscreenUnavailable:{get(e){let{media:t}=e;if(!fN||!fx(t))return mh.UNSUPPORTED}},mediaPipUnavailable:{get(e){let{media:t}=e;return fU&&fO(t)?(null==t?void 0:t.disablePictureInPicture)?mh.UNAVAILABLE:void 0:mh.UNSUPPORTED}},mediaVolumeUnavailable:{get(e){let{media:t}=e;if(!1===u||(null==t?void 0:t.volume)==void 0)return mh.UNSUPPORTED},stateOwnersUpdateHandlers:[e=>{null==u&&fY.then(t=>e(t?void 0:mh.UNSUPPORTED))}]},mediaCastUnavailable:{get(e){var t;let{availability:i="not-available"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{media:r}=e;return fB&&(null==(t=null==r?void 0:r.remote)?void 0:t.state)?null!=i&&"available"!==i?mh.UNAVAILABLE:void 0:mh.UNSUPPORTED},stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaAirplayUnavailable:{get:(e,t)=>fF?(null==t?void 0:t.availability)==="not-available"?mh.UNAVAILABLE:void 0:mh.UNSUPPORTED,mediaEvents:["webkitplaybacktargetavailabilitychanged"],stateOwnersUpdateHandlers:[(e,t)=>{var i;let{media:r}=t;if(r)return r.disableRemotePlayback||r.hasAttribute("disableremoteplayback")||null==(i=null==r?void 0:r.remote)||i.watchAvailability(t=>{e({availability:t?"available":"not-available"})}).catch(t=>{"NotSupportedError"===t.name?e({availability:null}):e({availability:"not-available"})}),()=>{var e;null==(e=null==r?void 0:r.remote)||e.cancelWatchAvailability().catch(()=>{})}}]},mediaRenditionUnavailable:{get(e){var t;let{media:i}=e;return(null==i?void 0:i.videoRenditions)?(null==(t=i.videoRenditions)?void 0:t.length)?void 0:mh.UNAVAILABLE:mh.UNSUPPORTED},mediaEvents:["emptied","loadstart"],videoRenditionsEvents:["addrendition","removerendition"]},mediaAudioTrackUnavailable:{get(e){var t,i;let{media:r}=e;return(null==r?void 0:r.audioTracks)?(null!=(i=null==(t=r.audioTracks)?void 0:t.length)?i:0)<=1?mh.UNAVAILABLE:void 0:mh.UNSUPPORTED},mediaEvents:["emptied","loadstart"],audioTracksEvents:["addtrack","removetrack"]},mediaLang:{get(e){let{options:{mediaLang:t}={}}=e;return null!=t?t:"en"}}},fX={[c7.MEDIA_PREVIEW_REQUEST](e,t,i){var r,n,a;let s,o,{detail:l}=i,{media:d}=t,u=null!=l?l:void 0;if(d&&null!=u){let[e]=fS(d,{kind:mo.METADATA,label:"thumbnails"}),t=Array.prototype.find.call(null!=(r=null==e?void 0:e.cues)?r:[],
3(e,t,i)=>0===t?e.endTime>u:t===i.length-1?e.startTime<=u:e.startTime<=u&&e.endTime>u);if(t){let e=/'^(?:[a-z]+:)?\/\//i.test(t.text)||null==(n=null==d?void 0:d.querySelector('track[label="thumbnails"]'))?void 0:n.src,i=new URL(t.text,e);o=new URLSearchParams(i.hash).get("#xywh").split(",").map(e=>+e),s=i.href}}let h=e.mediaDuration.get(t),c=null==(a=e.mediaChaptersCues.get(t).find((e,t,i)=>t===i.length-1&&h===e.endTime?e.startTime<=u&&e.endTime>=u:e.startTime<=u&&e.endTime>u))?void 0:a.text;return null!=l&&null==c&&(c=""),{mediaPreviewTime:u,mediaPreviewImage:s,mediaPreviewCoords:o,mediaPreviewChapter:c}},[c7.MEDIA_PAUSE_REQUEST](e,t){e.mediaPaused.set(!0,t)},[c7.MEDIA_PLAY_REQUEST](e,t){var i,r,n,a;let s=e.mediaStreamType.get(t)===mc.LIVE,o=!(null==(i=t.options)?void 0:i.noAutoSeekToLive),l=e.mediaTargetLiveWindow.get(t)>0;if(s&&o&&!l){let i=null==(r=e.mediaSeekable.get(t))?void 0:r[1];if(i){let r=null!=(a=null==(n=t.options)?void 0:n.seekToLiveOffset)?a:0;e.mediaCurrentTime.set(i-r,t)}}e.mediaPaused.set(!1,t)},[c7.MEDIA_PLAYBACK_RATE_REQUEST](e,t,i){let{detail:r}=i;e.mediaPlaybackRate.set(r,t)},[c7.MEDIA_MUTE_REQUEST](e,t){e.mediaMuted.set(!0,t)},[c7.MEDIA_UNMUTE_REQUEST](e,t){e.mediaVolume.get(t)||e.mediaVolume.set(.25,t),e.mediaMuted.set(!1,t)},[c7.MEDIA_LOOP_REQUEST](e,t,i){let{detail:r}=i,n=!!r;return e.mediaLoop.set(n,t),{mediaLoop:n}},[c7.MEDIA_VOLUME_REQUEST](e,t,i){let{detail:r}=i;r&&e.mediaMuted.get(t)&&e.mediaMuted.set(!1,t),e.mediaVolume.set(r,t)},[c7.MEDIA_SEEK_REQUEST](e,t,i){let{detail:r}=i;e.mediaCurrentTime.set(r,t)},[c7.MEDIA_SEEK_TO_LIVE_REQUEST](e,t){var i,r,n;let a=null==(i=e.mediaSeekable.get(t))?void 0:i[1];if(Number.isNaN(Number(a)))return;let s=null!=(n=null==(r=t.options)?void 0:r.seekToLiveOffset)?n:0;e.mediaCurrentTime.set(a-s,t)},[c7.MEDIA_SHOW_SUBTITLES_REQUEST](e,t,i){var r;let{detail:n}=i,{options:a}=t,s=fG(t),o=fy(n),l=null==(r=o[0])?void 0:r.language;l&&!a.noSubtitlesLangPref&&mU.localStorage.setItem("media-chrome-pref-subtitles-lang",l),fA(ml.SHOWING,s,o)},[c7.MEDIA_DISABLE_SUBTITLES_REQUEST](e,t,i){let{detail:r}=i,n=fG(t);fA(ml.DISABLED,n,null!=r?r:[])},[c7.MEDIA_TOGGLE_SUBTITLES_REQUEST](e,t,i){let{detail:r}=i;fK(t,r)},[c7.MEDIA_RENDITION_REQUEST](e,t,i){let{detail:r}=i;e.mediaRenditionSelected.set(r,t)},[c7.MEDIA_AUDIO_TRACK_REQUEST](e,t,i){let{detail:r}=i;e.mediaAudioTrackEnabled.set(r,t)},[c7.MEDIA_ENTER_PIP_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsPip.set(!0,t)},[c7.MEDIA_EXIT_PIP_REQUEST](e,t){e.mediaIsPip.set(!1,t)},[c7.MEDIA_ENTER_FULLSCREEN_REQUEST](e,t,i){e.mediaIsPip.get(t)&&e.mediaIsPip.set(!1,t),e.mediaIsFullscreen.set(!0,t,i)},[c7.MEDIA_EXIT_FULLSCREEN_REQUEST](e,t){e.mediaIsFullscreen.set(!1,t)},[c7.MEDIA_ENTER_CAST_REQUEST](e,t){e.mediaIsFullscreen.get(t)&&e.mediaIsFullscreen.set(!1,t),e.mediaIsCasting.set(!0,t)},[c7.MEDIA_EXIT_CAST_REQUEST](e,t){e.mediaIsCasting.set(!1,t)},[c7.MEDIA_AIRPLAY_REQUEST](e,t){e.mediaIsAirplaying.set(!0,t)}};var fZ=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},fJ=(e,t,i)=>(fZ(e,t,"read from private field"),i?i.call(e):t.get(e)),f$=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},f0=(e,t,i,r)=>(fZ(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),f1=(e,t,i)=>(fZ(e,t,"access private method"),i);let f2=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"," ","f","m","k","c","l","j",">","<","p"],f3={DEFAULT_SUBTITLES:"defaultsubtitles",DEFAULT_STREAM_TYPE:"defaultstreamtype",DEFAULT_DURATION:"defaultduration",FULLSCREEN_ELEMENT:"fullscreenelement",HOTKEYS:"hotkeys",KEYBOARD_BACKWARD_SEEK_OFFSET:"keyboardbackwardseekoffset",KEYBOARD_FORWARD_SEEK_OFFSET:"keyboardforwardseekoffset",KEYBOARD_DOWN_VOLUME_STEP:"keyboarddownvolumestep",KEYBOARD_UP_VOLUME_STEP:"keyboardupvolumestep",KEYS_USED:"keysused",LANG:"lang",LOOP:"loop",LIVE_EDGE_OFFSET:"liveedgeoffset",NO_AUTO_SEEK_TO_LIVE:"noautoseektolive",NO_DEFAULT_STORE:"nodefaultstore",NO_HOTKEYS:"nohotkeys",NO_MUTED_PREF:"nomutedpref",NO_SUBTITLES_LANG_PREF:"nosubtitleslangpref",NO_VOLUME_PREF:"novolumepref",SEEK_TO_LIVE_OFFSET:"seektoliveoffset"};class f4 extends fu{static get observedAttributes(){return super.observedAttributes.concat(f3.NO_HOTKEYS,f3.HOTKEYS,f3.DEFAULT_STREAM_TYPE,f3.DEFAULT_SUBTITLES,f3.DEFAULT_DURATION,f3.NO_MUTED_PREF,f3.NO_VOLUME_PREF,f3.LANG,f3.LOOP,f3.LIVE_EDGE_OFFSET,f3.SEEK_TO_LIVE_OFFSET,f3.NO_AUTO_SEEK_TO_LIVE)}get mediaStore(){return fJ(this,ys)}set mediaStore(e){var t,i;if(fJ(this,ys)&&(null==(t=fJ(this,yd))||t.call(this),f0(this,yd,void 0)),f0(this,ys,e),!fJ(this,ys)&&!this.hasAttribute(f3.NO_DEFAULT_STORE))return void f1(this,yc,ym).call(this);f0(this,yd,null==(i=fJ(this,ys))?void 0:i.subscribe(fJ(this,yl)))}get fullscreenElement(){var e;return null!=(e=fJ(this,ya))?e:this}set fullscreenElement(e){var t;this.hasAttribute(f3.FULLSCREEN_ELEMENT)&&this.removeAttribute(f3.FULLSCREEN_ELEMENT),f0(this,ya,e),null==(t=fJ(this,ys))||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}get defaultSubtitles(){return m4(this,f3.DEFAULT_SUBTITLES)}set defaultSubtitles(e){m5(this,f3.DEFAULT_SUBTITLES,e)}get defaultStreamType(){return m8(this,f3.DEFAULT_STREAM_TYPE)}set defaultStreamType(e){m6(this,f3.DEFAULT_STREAM_TYPE,e)}get defaultDuration(){return m2(this,f3.DEFAULT_DURATION)}set defaultDuration(e){m3(this,f3.DEFAULT_DURATION,e)}get noHotkeys(){return m4(this,f3.NO_HOTKEYS)}set noHotkeys(e){m5(this,f3.NO_HOTKEYS,e)}get keysUsed(){return m8(this,f3.KEYS_USED)}set keysUsed(e){m6(this,f3.KEYS_USED,e)}get liveEdgeOffset(){return m2(this,f3.LIVE_EDGE_OFFSET)}set liveEdgeOffset(e){m3(this,f3.LIVE_EDGE_OFFSET,e)}get noAutoSeekToLive(){return m4(this,f3.NO_AUTO_SEEK_TO_LIVE)}set noAutoSeekToLive(e){m5(this,f3.NO_AUTO_SEEK_TO_LIVE,e)}get noVolumePref(){return m4(this,f3.NO_VOLUME_PREF)}set noVolumePref(e){m5(this,f3.NO_VOLUME_PREF,e)}get noMutedPref(){return m4(this,f3.NO_MUTED_PREF)}set noMutedPref(e){m5(this,f3.NO_MUTED_PREF,e)}get noSubtitlesLangPref(){return m4(this,f3.NO_SUBTITLES_LANG_PREF)}set noSubtitlesLangPref(e){m5(this,f3.NO_SUBTITLES_LANG_PREF,e)}get noDefaultStore(){return m4(this,f3.NO_DEFAULT_STORE)}set noDefaultStore(e){m5(this,f3.NO_DEFAULT_STORE,e)}get resolvedLang(){let[e]=mA.split("-");return m_[mA]?mA:m_[e]?e:"en"}attributeChangedCallback(e,t,i){var r,n,a,s,o,l,d,u,h,c,m,f;if(super.attributeChangedCallback(e,t,i),e===f3.NO_HOTKEYS)i!==t&&""===i?(this.hasAttribute(f3.HOTKEYS)&&console.warn("Media Chrome: Both `hotkeys` and `nohotkeys` have been set. All hotkeys will be disabled."),this.disableHotkeys()):i!==t&&null===i&&this.enableHotkeys();else if(e===f3.HOTKEYS)fJ(this,yn).value=i;else if(e===f3.DEFAULT_SUBTITLES&&i!==t)null==(r=fJ(this,ys))||r.dispatch({type:"optionschangerequest",detail:{defaultSubtitles:this.hasAttribute(f3.DEFAULT_SUBTITLES)}});else if(e===f3.DEFAULT_STREAM_TYPE)null==(a=fJ(this,ys))||a.dispatch({type:"optionschangerequest",detail:{defaultStreamType:null!=(n=this.getAttribute(f3.DEFAULT_STREAM_TYPE))?n:void 0}});else if(e===f3.LIVE_EDGE_OFFSET&&i!==t)null==(s=fJ(this,ys))||s.dispatch({type:"optionschangerequest",detail:{liveEdgeOffset:this.hasAttribute(f3.LIVE_EDGE_OFFSET)?+this.getAttribute(f3.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(f3.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(f3.SEEK_TO_LIVE_OFFSET):this.hasAttribute(f3.LIVE_EDGE_OFFSET)?+this.getAttribute(f3.LIVE_EDGE_OFFSET):void 0}});else if(e===f3.SEEK_TO_LIVE_OFFSET&&i!==t)null==(o=fJ(this,ys))||o.dispatch({type:"optionschangerequest",detail:{seekToLiveOffset:this.hasAttribute(f3.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(f3.SEEK_TO_LIVE_OFFSET):this.hasAttribute(f3.LIVE_EDGE_OFFSET)?+this.getAttribute(f3.LIVE_EDGE_OFFSET):void 0}});else if(e===f3.NO_AUTO_SEEK_TO_LIVE)null==(l=fJ(this,ys))||l.dispatch({type:"optionschangerequest",detail:{noAutoSeekToLive:this.hasAttribute(f3.NO_AUTO_SEEK_TO_LIVE)}});else if(e===f3.FULLSCREEN_ELEMENT){let e=i?null==(d=this.getRootNode())?void 0:d.getElementById(i):void 0;f0(this,ya,e),null==(u=fJ(this,ys))||u.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement})}else e===f3.LANG&&i!==t?(mA=i,null==(h=fJ(this,ys))||h.dispatch({type:"optionschangerequest",detail:{mediaLang:i}}
3)):e===f3.LOOP&&i!==t?null==(c=fJ(this,ys))||c.dispatch({type:c7.MEDIA_LOOP_REQUEST,detail:null!=i}):e===f3.NO_VOLUME_PREF&&i!==t?null==(m=fJ(this,ys))||m.dispatch({type:"optionschangerequest",detail:{noVolumePref:this.hasAttribute(f3.NO_VOLUME_PREF)}}):e===f3.NO_MUTED_PREF&&i!==t&&(null==(f=fJ(this,ys))||f.dispatch({type:"optionschangerequest",detail:{noMutedPref:this.hasAttribute(f3.NO_MUTED_PREF)}}))}connectedCallback(){var e,t,i;this.associateElement(this),fJ(this,ys)||this.hasAttribute(f3.NO_DEFAULT_STORE)||f1(this,yc,ym).call(this),null==(e=fJ(this,ys))||e.dispatch({type:"documentelementchangerequest",detail:mF}),null==(t=fJ(this,ys))||t.dispatch({type:"fullscreenelementchangerequest",detail:this.fullscreenElement}),super.connectedCallback(),fJ(this,ys)&&!fJ(this,yd)&&f0(this,yd,null==(i=fJ(this,ys))?void 0:i.subscribe(fJ(this,yl))),void 0!==fJ(this,yh)&&fJ(this,ys)&&this.media&&setTimeout(()=>{var e,t,i;(null==(t=null==(e=this.media)?void 0:e.textTracks)?void 0:t.length)&&(null==(i=fJ(this,ys))||i.dispatch({type:c7.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:fJ(this,yh)}))},0),this.hasAttribute(f3.NO_HOTKEYS)?this.disableHotkeys():this.enableHotkeys()}disconnectedCallback(){var e,t,i,r,n,a;if(null==(e=super.disconnectedCallback)||e.call(this),this.disableHotkeys(),fJ(this,ys)){let e=fJ(this,ys).getState();f0(this,yh,!!(null==(t=e.mediaSubtitlesShowing)?void 0:t.length)),null==(i=fJ(this,ys))||i.dispatch({type:"fullscreenelementchangerequest",detail:void 0}),null==(r=fJ(this,ys))||r.dispatch({type:"documentelementchangerequest",detail:void 0}),null==(n=fJ(this,ys))||n.dispatch({type:c7.MEDIA_TOGGLE_SUBTITLES_REQUEST,detail:!1})}fJ(this,yd)&&(null==(a=fJ(this,yd))||a.call(this),f0(this,yd,void 0)),this.unassociateElement(this),fJ(this,yo)&&(fJ(this,yo).remove(),f0(this,yo,null))}mediaSetCallback(e){var t;super.mediaSetCallback(e),null==(t=fJ(this,ys))||t.dispatch({type:"mediaelementchangerequest",detail:e}),e.hasAttribute("tabindex")||(e.tabIndex=-1)}mediaUnsetCallback(e){var t;super.mediaUnsetCallback(e),null==(t=fJ(this,ys))||t.dispatch({type:"mediaelementchangerequest",detail:void 0})}propagateMediaState(e,t){pr(this.mediaStateReceivers,e,t)}associateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;if(t.has(e))return;let i=pn(e,this.registerMediaStateReceiver.bind(this),this.unregisterMediaStateReceiver.bind(this));Object.values(c7).forEach(t=>{e.addEventListener(t,fJ(this,yu))}),t.set(e,i)}unassociateElement(e){if(!e)return;let{associatedElementSubscriptions:t}=this;t.has(e)&&(t.get(e)(),t.delete(e),Object.values(c7).forEach(t=>{e.removeEventListener(t,fJ(this,yu))}))}registerMediaStateReceiver(e){if(!e)return;let t=this.mediaStateReceivers;!(t.indexOf(e)>-1)&&(t.push(e),fJ(this,ys)&&Object.entries(fJ(this,ys).getState()).forEach(t=>{let[i,r]=t;pr([e],i,r)}))}unregisterMediaStateReceiver(e){let t=this.mediaStateReceivers,i=t.indexOf(e);i<0||t.splice(i,1)}enableHotkeys(){this.addEventListener("keydown",f1(this,yp,yg))}disableHotkeys(){this.removeEventListener("keydown",f1(this,yp,yg)),this.removeEventListener("keyup",fJ(this,yf))}get hotkeys(){return fJ(this,yn)}set hotkeys(e){m6(this,f3.HOTKEYS,e)}keyboardShortcutHandler(e){var t,i,r,n,a,s,o,l,d;let u,h,c,m=e.target;if(!((null!=(r=null!=(i=null==(t=m.getAttribute(f3.KEYS_USED))?void 0:t.split(" "))?i:null==m?void 0:m.keysUsed)?r:[]).map(e=>
3"Space"===e?" ":e).filter(Boolean).includes(e.key)||fJ(this,yn).contains("no".concat(e.key.toLowerCase()))||" "===e.key&&fJ(this,yn).contains("nospace"))&&!(e.shiftKey&&("/"===e.key||"?"===e.key)&&fJ(this,yn).contains("noshift+/")))switch(e.key){case" ":case"k":u=fJ(this,ys).getState().mediaPaused?c7.MEDIA_PLAY_REQUEST:c7.MEDIA_PAUSE_REQUEST,this.dispatchEvent(new mU.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"m":u="off"===this.mediaStore.getState().mediaVolumeLevel?c7.MEDIA_UNMUTE_REQUEST:c7.MEDIA_MUTE_REQUEST,this.dispatchEvent(new mU.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"f":u=this.mediaStore.getState().mediaIsFullscreen?c7.MEDIA_EXIT_FULLSCREEN_REQUEST:c7.MEDIA_ENTER_FULLSCREEN_REQUEST,this.dispatchEvent(new mU.CustomEvent(u,{composed:!0,bubbles:!0}));break;case"c":this.dispatchEvent(new mU.CustomEvent(c7.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}));break;case"ArrowLeft":case"j":{let e=this.hasAttribute(f3.KEYBOARD_BACKWARD_SEEK_OFFSET)?+this.getAttribute(f3.KEYBOARD_BACKWARD_SEEK_OFFSET):10;h=Math.max((null!=(n=this.mediaStore.getState().mediaCurrentTime)?n:0)-e,0),c=new mU.CustomEvent(c7.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowRight":case"l":{let e=this.hasAttribute(f3.KEYBOARD_FORWARD_SEEK_OFFSET)?+this.getAttribute(f3.KEYBOARD_FORWARD_SEEK_OFFSET):10;h=Math.max((null!=(a=this.mediaStore.getState().mediaCurrentTime)?a:0)+e,0),c=new mU.CustomEvent(c7.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowUp":{let e=this.hasAttribute(f3.KEYBOARD_UP_VOLUME_STEP)?+this.getAttribute(f3.KEYBOARD_UP_VOLUME_STEP):.025;h=Math.min((null!=(s=this.mediaStore.getState().mediaVolume)?s:1)+e,1),c=new mU.CustomEvent(c7.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"ArrowDown":{let e=this.hasAttribute(f3.KEYBOARD_DOWN_VOLUME_STEP)?+this.getAttribute(f3.KEYBOARD_DOWN_VOLUME_STEP):.025;h=Math.max((null!=(o=this.mediaStore.getState().mediaVolume)?o:1)-e,0),c=new mU.CustomEvent(c7.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break}case"<":h=Math.max((null!=(l=this.mediaStore.getState().mediaPlaybackRate)?l:1)-.25,.25).toFixed(2),c=new mU.
3CustomEvent(c7.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break;case">":h=Math.min((null!=(d=this.mediaStore.getState().mediaPlaybackRate)?d:1)+.25,2).toFixed(2),c=new mU.CustomEvent(c7.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:h}),this.dispatchEvent(c);break;case"/":case"?":e.shiftKey&&f1(this,yv,yE).call(this);break;case"p":u=this.mediaStore.getState().mediaIsPip?c7.MEDIA_EXIT_PIP_REQUEST:c7.MEDIA_ENTER_PIP_REQUEST,c=new mU.CustomEvent(u,{composed:!0,bubbles:!0}),this.dispatchEvent(c)}}constructor(){super(),f$(this,yc),f$(this,yp),f$(this,yv),this.mediaStateReceivers=[],this.associatedElementSubscriptions=new Map,f$(this,yn,new fp(this,f3.HOTKEYS)),f$(this,ya,void 0),f$(this,ys,void 0),f$(this,yo,null),f$(this,yl,void 0),f$(this,yd,void 0),f$(this,yu,e=>{var t;null==(t=fJ(this,ys))||t.dispatch(e)}),f$(this,yh,void 0),f$(this,yf,e=>{let{key:t,shiftKey:i}=e;if(!(i&&("/"===t||"?"===t)||f2.includes(t)))return void this.removeEventListener("keyup",fJ(this,yf));this.keyboardShortcutHandler(e)}),this.associateElement(this);let e={};f0(this,yl,t=>{Object.entries(t).forEach(t=>{let[i,r]=t;if(i in e&&e[i]===r)return;this.propagateMediaState(i,r);let n=i.toLowerCase(),a=new mU.CustomEvent(ms[n],{composed:!0,detail:r});this.dispatchEvent(a)}),e=t})}}yn=new WeakMap,ya=new WeakMap,ys=new WeakMap,yo=new WeakMap,yl=new WeakMap,yd=new WeakMap,yu=new WeakMap,yh=new WeakMap,yc=new WeakSet,ym=function(){var e;this.mediaStore=(e=>{let t,{media:i,fullscreenElement:r,documentElement:n,stateMediator:a=fQ,requestMap:s=fX,options:o={},monitorStateOwnersOnlyWithSubscriptions:l=!0}=e,d=[],u={options:{...o}},h=Object.freeze({mediaPreviewTime:void 0,mediaPreviewImage:void 0,mediaPreviewCoords:void 0,mediaPreviewChapter:void 0}),c=e=>{void 0!=e&&(fW(e,h)||(h=Object.freeze({...h,...e}),d.forEach(e=>e(h))))},m=()=>{c(Object.entries(a).reduce((e,t)=>{let[i,{get:r}]=t;return e[i]=r(u),e},{}))},f={},p=async(e,i)=>{var r,n,s,o,h,p,g,v,E,y,b,T,A,S,R,k;let I=!!t;if(t={...u,...null!=t?t:{},...e},I)return;await fj(...Object.values(e));let L=d.length>0&&0===i&&l,D=u.media!==t.media,w=(null==(r=u.media)?void 0:r.textTracks)!==(null==(n=t.media)?void 0:n.textTracks),C=(null==(s=u.media)?void 0:s.videoRenditions)!==(null==(o=t.media)?void 0:o.videoRenditions),M=(null==(h=u.media)?void 0:h.audioTracks)!==(null==(p=t.media)?void 0:p.audioTracks),P=(null==(g=u.media)?void 0:g.remote)!==(null==(v=t.media)?void 0:v.remote),O=u.documentElement!==t.documentElement,x=!!u.media&&(D||L),N=!!(null==(E=u.media)?void 0:E.textTracks)&&(w||L),U=!!(null==(y=u.media)?void 0:y.videoRenditions)&&(C||L),F=!!(null==(b=u.media)?void 0:b.audioTracks)&&(M||L),B=!!(null==(T=u.media)?void 0:T.remote)&&(P||L),G=!!u.documentElement&&(O||L),H=x||N||U||F||B||G,K=0===d.length&&1===i&&l,W=!!t.media&&(D||K),V=!!(null==(A=t.media)?void 0:A.textTracks)&&(w||K),q=!!(null==(S=t.media)?void 0:S.videoRenditions)&&(C||K),Y=!!(null==(R=t.media)?void 0:R.audioTracks)&&(M||K),j=!!(null==(k=t.media)?void 0:k.remote)&&(P||K),z=!!t.documentElement&&(O||K),Q=W||V||q||Y||j||z;if(!(H||Q)){Object.entries(t).forEach(e=>{let[t,i]=e;u[t]=i}),m(),t=void 0;return}Object.entries(a).forEach(e=>{let i,[r,{get:n,mediaEvents:a=[],textTracksEvents:s=[],videoRenditionsEvents:o=[],audioTracksEvents:l=[],remoteEvents:d=[],rootEvents:h=[],stateOwnersUpdateHandlers:m=[]}]=e;f[r]||(f[r]={});let p=e=>{c({[r]:n(u,e)})};i=f[r].mediaEvents,a.forEach(e=>{i&&x&&(u.media.removeEventListener(e,i),f[r].mediaEvents=void 0),W&&(t.media.addEventListener(e,p),f[r].mediaEvents=p)}),i=f[r].textTracksEvents,s.forEach(e=>{var n,a;i&&N&&(null==(n=u.media.textTracks)||n.removeEventListener(e,i),f[r].textTracksEvents=void 0),V&&(null==(a=t.media.textTracks)||a.addEventListener(e,p),f[r].textTracksEvents=p)}),i=f[r].videoRenditionsEvents,o.forEach(e=>{var n,a;i&&U&&(null==(n=u.media.videoRenditions)||n.removeEventListener(e,i),f[r].videoRenditionsEvents=void 0),q&&(null==(a=t.media.videoRenditions)||a.addEventListener(e,p),f[r].videoRenditionsEvents=p)}),i=f[r].audioTracksEvents,l.forEach(e=>{var n,a;i&&F&&(null==(n=u.media.audioTracks)||n.removeEventListener(e,i),f[r].audioTracksEvents=void 0),Y&&(null==(a=t.media.audioTracks)||a.addEventListener(e,p),f[r].audioTracksEvents=p)}
3),i=f[r].remoteEvents,d.forEach(e=>{var n,a;i&&B&&(null==(n=u.media.remote)||n.removeEventListener(e,i),f[r].remoteEvents=void 0),j&&(null==(a=t.media.remote)||a.addEventListener(e,p),f[r].remoteEvents=p)}),i=f[r].rootEvents,h.forEach(e=>{i&&G&&(u.documentElement.removeEventListener(e,i),f[r].rootEvents=void 0),z&&(t.documentElement.addEventListener(e,p),f[r].rootEvents=p)});let g=f[r].stateOwnersUpdateHandlers;if(g&&H&&(Array.isArray(g)?g:[g]).forEach(e=>{"function"==typeof e&&e()}),Q){let e=m.map(e=>e(p,t)).filter(e=>"function"==typeof e);f[r].stateOwnersUpdateHandlers=1===e.length?e[0]:e}else H&&(f[r].stateOwnersUpdateHandlers=void 0)}),Object.entries(t).forEach(e=>{let[t,i]=e;u[t]=i}),m(),t=void 0};return p({media:i,fullscreenElement:r,documentElement:n,options:o}),{dispatch(e){let{type:t,detail:i}=e;if(s[t]&&null==h.mediaErrorCode)return void c(s[t](a,u,e));"mediaelementchangerequest"===t?p({media:i}):"fullscreenelementchangerequest"===t?p({fullscreenElement:i}):"documentelementchangerequest"===t?p({documentElement:i}):"optionschangerequest"===t&&(Object.entries(null!=i?i:{}).forEach(e=>{let[t,i]=e;u.options[t]=i}),m())},getState:()=>h,subscribe:e=>(p({},d.length+1),d.push(e),e(h),()=>{let t=d.indexOf(e);t>=0&&(p({},d.length-1),d.splice(t,1))})}})({media:this.media,fullscreenElement:this.fullscreenElement,options:{defaultSubtitles:this.hasAttribute(f3.DEFAULT_SUBTITLES),defaultDuration:this.hasAttribute(f3.DEFAULT_DURATION)?+this.getAttribute(f3.DEFAULT_DURATION):void 0,defaultStreamType:null!=(e=this.getAttribute(f3.DEFAULT_STREAM_TYPE))?e:void 0,liveEdgeOffset:this.hasAttribute(f3.LIVE_EDGE_OFFSET)?+this.getAttribute(f3.LIVE_EDGE_OFFSET):void 0,seekToLiveOffset:this.hasAttribute(f3.SEEK_TO_LIVE_OFFSET)?+this.getAttribute(f3.SEEK_TO_LIVE_OFFSET):this.hasAttribute(f3.LIVE_EDGE_OFFSET)?+this.getAttribute(f3.LIVE_EDGE_OFFSET):void 0,noAutoSeekToLive:this.hasAttribute(f3.NO_AUTO_SEEK_TO_LIVE),noVolumePref:this.hasAttribute(f3.NO_VOLUME_PREF),noMutedPref:this.hasAttribute(f3.NO_MUTED_PREF),noSubtitlesLangPref:this.hasAttribute(f3.NO_SUBTITLES_LANG_PREF)}})},yf=new WeakMap,yp=new WeakSet,yg=function(e){var t;let{metaKey:i,altKey:r,key:n,shiftKey:a}=e,s=a&&("/"===n||"?"===n);if(s&&(null==(t=fJ(this,yo))?void 0:t.open)||i||r||!s&&!f2.includes(n))return void this.removeEventListener("keyup",fJ(this,yf));let o=e.target,l=o instanceof HTMLElement&&("media-volume-range"===o.tagName.toLowerCase()||"media-time-range"===o.tagName.toLowerCase());![" ","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(n)||fJ(this,yn).contains("no".concat(n.toLowerCase()))||" "===n&&fJ(this,yn).contains("nospace")||l||e.preventDefault(),this.addEventListener("keyup",fJ(this,yf),{once:!0})},yv=new WeakSet,yE=function(){fJ(this,yo)||(f0(this,yo,mF.createElement("media-keyboard-shortcuts-dialog")),this.appendChild(fJ(this,yo))),fJ(this,yo).open=!0};let f5=Object.values(mr),f8=Object.values(mt),f6=e=>{var t,i,r,n;let{observedAttributes:a}=e.constructor;!a&&(null==(t=e.nodeName)?void 0:t.includes("-"))&&(mU.customElements.upgrade(e),{observedAttributes:a}=e.constructor);let s=null==(n=null==(r=null==(i=null==e?void 0:e.getAttribute)?void 0:i.call(e,me.MEDIA_CHROME_ATTRIBUTES))?void 0:r.split)?void 0:n.call(r,/\s+/);return Array.isArray(a||s)?(a||s).filter(e=>f5.includes(e)):[]},f9=e=>(e=>{var t,i;return(null==(t=e.nodeName)?void 0:t.includes("-"))&&mU.customElements.get(null==(i=e.nodeName)?void 0:i.toLowerCase())&&!(e instanceof mU.customElements.get(e.nodeName.toLowerCase()))&&mU.customElements.upgrade(e),f8.some(t=>t in e)})(e)||!!f6(e).length,f7=e=>{var t;return null==(t=null==e?void 0:e.join)?void 0:t.call(e,":")},pe={[mr.MEDIA_SUBTITLES_LIST]:fT,[mr.MEDIA_SUBTITLES_SHOWING]:fT,[mr.MEDIA_SEEKABLE]:f7,[mr.MEDIA_BUFFERED]:e=>null==e?void 0:e.map(f7).join(" "),[mr.MEDIA_PREVIEW_COORDS]:e=>null==e?void 0:e.join(" "),[mr.MEDIA_RENDITION_LIST]:function(e){return null==e?void 0:e.map(mp).join(" ")},[mr.MEDIA_AUDIO_TRACK_LIST]:function(e){return null==e?void 0:e.map(mv).join(" ")}},pt=async(e,t,i)=>{var r,n;if(e.isConnected||await mT(0),"boolean"==typeof i||null==i)return m5(e,t,i);if("number"==typeof i)return m3(e,t,i);if("string"==typeof i)return m6(e,t,i);if(Array.isArray(i)&&!i.length)return e.removeAttribute(t);let a=null!=(n=null==(r=pe[t])?void 0:r.call(pe,i))?n:i;return e.setAttribute(t,a)},pi=(e,t)=>
3{if((e=>{var t;return!!(null==(t=e.closest)?void 0:t.call(e,'*[slot="media"]'))})(e))return;let i=(e,t)=>{var i,r;f9(e)&&t(e);let{children:n=[]}=null!=e?e:{};[...n,...null!=(r=null==(i=null==e?void 0:e.shadowRoot)?void 0:i.children)?r:[]].forEach(e=>pi(e,t))},r=null==e?void 0:e.nodeName.toLowerCase();if(r.includes("-")&&!f9(e))return void mU.customElements.whenDefined(r).then(()=>{i(e,t)});i(e,t)},pr=(e,t,i)=>{e.forEach(e=>{if(t in e){e[t]=i;return}let r=f6(e),n=t.toLowerCase();r.includes(n)&&pt(e,n,i)})},pn=(e,t,i)=>{pi(e,t);let r=e=>{var i;t(null!=(i=null==e?void 0:e.composedPath()[0])?i:e.target)},n=e=>{var t;i(null!=(t=null==e?void 0:e.composedPath()[0])?t:e.target)};e.addEventListener(c7.REGISTER_MEDIA_STATE_RECEIVER,r),e.addEventListener(c7.UNREGISTER_MEDIA_STATE_RECEIVER,n);let a=[],s=e=>{let r=e.target;"media"!==r.name&&(a.forEach(e=>pi(e,i)),(a=[...r.assignedElements({flatten:!0})]).forEach(e=>pi(e,t)))};e.addEventListener("slotchange",s);let o=new MutationObserver(e=>{e.forEach(e=>{let{addedNodes:r=[],removedNodes:n=[],type:a,target:s,attributeName:o}=e;"childList"===a?(Array.prototype.forEach.call(r,e=>pi(e,t)),Array.prototype.forEach.call(n,e=>pi(e,i))):"attributes"===a&&o===me.MEDIA_CHROME_ATTRIBUTES&&(f9(s)?t(s):i(s))})});return o.observe(e,{childList:!0,attributes:!0,subtree:!0}),()=>{pi(e,i),e.removeEventListener("slotchange",s),o.disconnect(),e.removeEventListener(c7.REGISTER_MEDIA_STATE_RECEIVER,r),e.removeEventListener(c7.UNREGISTER_MEDIA_STATE_RECEIVER,n)}};mU.customElements.get("media-controller")||mU.customElements.define("media-controller",f4);let pa={PLACEMENT:"placement",BOUNDS:"bounds"};class ps extends mU.HTMLElement{static get observedAttributes(){return[pa.PLACEMENT,pa.BOUNDS]}get placement(){return m8(this,pa.PLACEMENT)}set placement(e){m6(this,pa.PLACEMENT,e)}get bounds(){return m8(this,pa.BOUNDS)}set bounds(e){m6(this,pa.BOUNDS,e)}constructor(){if(super(),this.updateXOffset=()=>{var e;if(!m$(this,{checkOpacity:!1,checkVisibilityCSS:!1}))return;let t=this.placement;if("left"===t||"right"===t)return void this.style.removeProperty("--media-tooltip-offset-x");let i=getComputedStyle(this),r=null!=(e=mX(this,"#"+this.bounds))?e:mq(this);if(!r)return;let{x:n,width:a}=r.getBoundingClientRect(),{x:s,width:o}=this.getBoundingClientRect(),l=i.getPropertyValue("--media-tooltip-offset-x"),d=l?parseFloat(l.replace("px","")):0,u=i.getPropertyValue("--media-tooltip-container-margin"),h=u?parseFloat(u.replace("px","")):0,c=s-n+d-h,m=s+o-(n+a)+d+h;return c<0?void this.style.setProperty("--media-tooltip-offset-x","".concat(c,"px")):m>0?void this.style.setProperty("--media-tooltip-offset-x","".concat(m,"px")):void this.style.removeProperty("--media-tooltip-offset-x")},!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}if(this.arrowEl=this.shadowRoot.querySelector("#arrow"),Object.prototype.hasOwnProperty.call(this,"placement")){let e=this.placement;delete this.placement,this.placement=e}}}ps.shadowRootOptions={mode:"open"},ps.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        --_tooltip-background-color: var(--media-tooltip-background-color, var(--media-secondary-color, rgba(20, 20, 30, .7)));\n        --_tooltip-background: var(--media-tooltip-background, var(--_tooltip-background-color));\n        --_tooltip-arrow-half-width: calc(var(--media-tooltip-arrow-width, 12px) / 2);\n        --_tooltip-arrow-height: var(--media-tooltip-arrow-height, 5px);\n        --_tooltip-arrow-background: var(--media-tooltip-arrow-color, var(--_tooltip-background-color));\n        position: relative;\n        pointer-events: none;\n        display: var(--media-tooltip-display, inline-flex);\n        justify-content: center;\n        align-items: center;\n        box-sizing: border-box;\n        z-index: var(--media-tooltip-z-index, 1);\n        background: var(--_tooltip-background);\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        font: var(--media-font,\n          var(--media-font-weight, 400)\n          var(--media-font-size, 13px) /\n          var(--media-text-content-height, var(--media-control-height, 18px))\n          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));\n        padding: var(--media-tooltip-padding, .35em .7em);\n        border: var(--media-tooltip-border, none);\n        border-radius: var(--media-tooltip-border-radius, 5px);\n        filter: var(--media-tooltip-filter, drop-shadow(0 0 4px rgba(0, 0, 0, .2)));\n        white-space: var(--media-tooltip-white-space, nowrap);\n      }\n\n      :host([hidden]) {\n        display: none;\n      }\n\n      img, svg {\n        display: inline-block;\n      }\n\n      #arrow {\n        position: absolute;\n        width: 0px;\n        height: 0px;\n        border-style: solid;\n        display: var(--media-tooltip-arrow-display, block);\n      }\n\n      :host(:not([placement])),\n      :host([placement="top"]) {\n        position: absolute;\n        bottom: calc(100% + var(--media-tooltip-distance, 12px));\n        left: 50%;\n        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0
3);\n      }\n      :host(:not([placement])) #arrow,\n      :host([placement="top"]) #arrow {\n        top: 100%;\n        left: 50%;\n        border-width: var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width);\n        border-color: var(--_tooltip-arrow-background) transparent transparent transparent;\n        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);\n      }\n\n      :host([placement="right"]) {\n        position: absolute;\n        left: calc(100% + var(--media-tooltip-distance, 12px));\n        top: 50%;\n        transform: translate(0, -50%);\n      }\n      :host([placement="right"]) #arrow {\n        top: 50%;\n        right: 100%;\n        border-width: var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width) 0;\n        border-color: transparent var(--_tooltip-arrow-background) transparent transparent;\n        transform: translate(0, -50%);\n      }\n\n      :host([placement="bottom"]) {\n        position: absolute;\n        top: calc(100% + var(--media-tooltip-distance, 12px));\n        left: 50%;\n        transform: translate(calc(-50% - var(--media-tooltip-offset-x, 0px)), 0);\n      }\n      :host([placement="bottom"]) #arrow {\n        bottom: 100%;\n        left: 50%;\n        border-width: 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height) var(--_tooltip-arrow-half-width);\n        border-color: transparent transparent var(--_tooltip-arrow-background) transparent;\n        transform: translate(calc(-50% + var(--media-tooltip-offset-x, 0px)), 0);\n      }\n\n      :host([placement="left"]) {\n        position: absolute;\n        right: calc(100% + var(--media-tooltip-distance, 12px));\n        top: 50%;\n        transform: translate(0, -50%);\n      }\n      :host([placement="left"]) #arrow {\n        top: 50%;\n        left: 100%;\n        border-width: var(--_tooltip-arrow-half-width) 0 var(--_tooltip-arrow-half-width) var(--_tooltip-arrow-height);\n        border-color: transparent transparent transparent var(--_tooltip-arrow-background);\n        transform: translate(0, -50%);\n      }\n      \n      :host([placement="none"]) #arrow {\n        display: none;\n      }\n    </style>\n    <slot></slot>\n    <div id="arrow"></div>\n  '},mU.customElements.get("media-tooltip")||mU.customElements.define("media-tooltip",ps);var po=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pl=(e,t,i)=>(po(e,t,"read from private field"),i?i.call(e):t.get(e)),pd=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pu=(e,t,i,r)=>(po(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let ph={TOOLTIP_PLACEMENT:"tooltipplacement",DISABLED:"disabled",NO_TOOLTIP:"notooltip"};class pc extends mU.HTMLElement{static get observedAttributes(){return["disabled",ph.TOOLTIP_PLACEMENT,me.MEDIA_CONTROLLER,mr.MEDIA_LANG]}enable(){this.addEventListener("click",pl(this,yb)),this.addEventListener("keydown",pl(this,yA)),this.tabIndex=0}disable(){this.removeEventListener("click",pl(this,yb)),this.removeEventListener("keydown",pl(this,yA)),this.removeEventListener("keyup",pl(this,y_)),this.tabIndex=-1}attributeChangedCallback(e,t,i){var r,n,a,s,o;e===me.MEDIA_CONTROLLER?(t&&(null==(n=null==(r=pl(this,yy))?void 0:r.unassociateElement)||n.call(r,this),pu(this,yy,null)),i&&this.isConnected&&(pu(this,yy,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=pl(this,yy))?void 0:s.associateElement)||o.call(s,this))):"disabled"===e&&i!==t?null==i?this.enable():this.disable():e===ph.TOOLTIP_PLACEMENT&&this.tooltipEl&&i!==t?this.tooltipEl.placement=i:e===mr.MEDIA_LANG&&(this.shadowRoot.querySelector('slot[name="tooltip-content"]').innerHTML=this.constructor.getTooltipContentHTML()),pl(this,yT).call(this)}connectedCallback(){var e,t,i;let{style:r}=m0(this.shadowRoot,":host");r.setProperty("display","var(--media-control-display, var(--".concat(this.localName,"-display, inline-flex))")),this.hasAttribute("disabled")?this.disable():this.enable(),this.setAttribute("role","button");let n=this.getAttribute(me.MEDIA_CONTROLLER);n&&(pu(this,yy,null==(e=this.getRootNode())?void 0:e.getElementById(n)),null==(i=null==(t=pl(this,yy))?void 0:t.associateElement)||i.call(t,this)),mU.customElements.whenDefined("media-tooltip").then(()=>{var e,t;return(e=yS,t=yR,po(this,e,"access private method"),t).call(this)})}disconnectedCallback(){var e,t;this.disable(),null==(t=null==(e=pl(this,yy))?void 0:e.unassociateElement)||t.call(e,this),pu(this,yy,null),this.removeEventListener("mouseenter",pl(this,yT)),this.removeEventListener("focus",pl(this,yT)),this.removeEventListener("click",pl(this,yb))}get keysUsed(){return["Enter"," "]}get tooltipPlacement(){return m8(this,ph.TOOLTIP_PLACEMENT)}set tooltipPlacement(e){m6(this,ph.TOOLTIP_PLACEMENT,e)}get mediaController(){return m8(this,me.MEDIA_CONTROLLER)}set mediaController(e){m6(this,me.MEDIA_CONTROLLER,e)}get disabled(){return m4(this,ph.DISABLED)}set disabled(e){m5(this,ph.DISABLED,e)}get noTooltip(){return m4(this,ph.NO_TOOLTIP)}set noTooltip(e){m5(this,ph.NO_TOOLTIP,e)}handleClick(e){}constructor(){if(super(),pd(this,yS),pd(this,yy,void 0),this.preventClick=!1,this.tooltipEl=null,pd(this,yb,e=>{this.preventClick||this.handleClick(e),setTimeout(pl(this,yT),0)}),pd(this,yT,()=>{var e,t;null==(t=null==(e=this.tooltipEl)?void 0:e.updateXOffset)||t.call(e)}),pd(this,y_,e=>{let{key:t}=e;if(!this.keysUsed.includes(t))return void this.removeEventListener("keyup",pl(this,y_));this.preventClick||this.handleClick(e)}),pd(this,yA,e=>{let{metaKey:t,altKey:i,key:r}=e;if(t||i||!this.keysUsed.includes(r))return void this.removeEventListener("keyup",pl(this,y_));this.addEventListener("keyup",pl(this,y_),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(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")}}yy=new WeakMap,yb=new WeakMap,yT=new WeakMap,y_=new WeakMap,yA=new WeakMap,yS=new WeakSet,yR=function(){this.addEventListener("mouseenter",pl(this,yT)),this.addEventListener("focus",pl(this,yT)),this.addEventListener("click",pl(this,yb));let e=this.tooltipPlacement;e&&this.tooltipEl&&(this.tooltipEl.placement=e)},pc.shadowRootOptions={mode:"open"},pc.getTemplateHTML=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return'\n    <style>\n      :host {\n        position: relative;\n        font: var(--media-font,\n          var(--media-font-weight, bold)\n          var(--media-font-size, 14px) /\n          var(--media-text-content-height, var(--media-control-height, 24px))\n          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));\n        padding: var(--media-button-padding, var(--media-control-padding, 10px));\n        justify-content: var(--media-button-justify-content, center);\n        display: inline-flex;\n        align-items: center;\n        vertical-align: middle;\n        box-sizing: border-box;\n        transition: background .15s linear;\n        pointer-events: auto;\n        cursor: var(--media-cursor, pointer);\n        -webkit-tap-highlight-color: transparent;\n      }\n\n      \n      :host(:focus-visible) {\n        box-shadow: var(--media-focus-box-sha
3dow, inset 0 0 0 2px rgb(27 127 204 / .9));\n        outline: 0;\n      }\n      \n      :host(:where(:focus)) {\n        box-shadow: none;\n        outline: 0;\n      }\n\n      :host(:hover) {\n        background: var(--media-control-hover-background, rgba(50 50 70 / .7));\n      }\n\n      slot[name="icon"] {\n        display: inline-flex;\n        align-items: center;\n      }\n\n      svg, img, ::slotted(svg), ::slotted(img) {\n        width: var(--media-button-icon-width);\n        height: var(--media-button-icon-height, var(--media-control-height, 24px));\n        transform: var(--media-button-icon-transform);\n        transition: var(--media-button-icon-transition);\n        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));\n        vertical-align: middle;\n        max-width: 100%;\n        max-height: 100%;\n        min-width: 100%;\n      }\n\n      media-tooltip {\n        \n        max-width: 0;\n        overflow-x: clip;\n        opacity: 0;\n        transition: opacity .3s, max-width 0s 9s;\n      }\n\n      :host(:hover) media-tooltip,\n      :host(:focus-visible) media-tooltip {\n        max-width: 100vw;\n        opacity: 1;\n        transition: opacity .3s;\n      }\n\n      :host([notooltip]) slot[name="tooltip"] {\n        display: none;\n      }\n    </style>\n\n    '.concat(this.getSlotTemplateHTML(e,t),'\n\n    <slot name="tooltip">\n      <media-tooltip part="tooltip" aria-hidden="true">\n        <template shadowrootmode="').concat(ps.shadowRootOptions.mode,'">\n          ').concat(ps.getTemplateHTML({}),'\n        </template>\n        <slot name="tooltip-content">\n          ').concat(this.getTooltipContentHTML(e),"\n        </slot>\n      </media-tooltip>\n    </slot>\n  ")},pc.getSlotTemplateHTML=function(e,t){return"\n    <slot></slot>\n  "},pc.getTooltipContentHTML=function(){return""},mU.customElements.get("media-chrome-button")||mU.customElements.define("media-chrome-button",pc);let pm='<svg aria-hidden="true" viewBox="0 0 26 24">\n  <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"/>\n</svg>\n',pf=e=>{let t=e.mediaIsAirplaying?mS("stop airplay"):mS("start airplay");e.setAttribute("aria-label",t)};class pp extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_IS_AIRPLAYING,mr.MEDIA_AIRPLAY_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),pf(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_IS_AIRPLAYING&&pf(this)}get mediaIsAirplaying(){return m4(this,mr.MEDIA_IS_AIRPLAYING)}set mediaIsAirplaying(e){m5(this,mr.MEDIA_IS_AIRPLAYING,e)}get mediaAirplayUnavailable(){return m8(this,mr.MEDIA_AIRPLAY_UNAVAILABLE)}set mediaAirplayUnavailable(e){m6(this,mr.MEDIA_AIRPLAY_UNAVAILABLE,e)}handleClick(){let e=new mU.CustomEvent(c7.MEDIA_AIRPLAY_REQUEST,{composed:!0,bubbles:!0});this.dispatchEvent(e)}}pp.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host([".concat(mr.MEDIA_IS_AIRPLAYING,"]) slot[name=icon] slot:not([name=exit]) {\n        display: none !important;\n      }\n\n      ","\n      :host(:not([").concat(mr.MEDIA_IS_AIRPLAYING,"])) slot[name=icon] slot:not([name=enter]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_IS_AIRPLAYING,"]) slot[name=tooltip-enter],\n      :host(:not([").concat(mr.MEDIA_IS_AIRPLAYING,'])) slot[name=tooltip-exit] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="enter">').concat(pm,'</slot>\n      <slot name="exit">').concat(pm,"</slot>\n    </slot>\n  ")},pp.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-enter">'.concat(mS("start airplay"),'</slot>\n    <slot name="tooltip-exit">').concat(mS("stop airplay"),"</slot>\n  ")},mU.customElements.get("media-airplay-button")||mU.customElements.define("media-airplay-button",pp);let pg=e=>{e.setAttribute("aria-checked",fR(e).toString())};class pv extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_SUBTITLES_LIST,mr.MEDIA_SUBTITLES_SHOWING]}connectedCallback(){super.connectedCallback(),this.setAttribute("role","button"),this.setAttribute("aria-label",mS("closed captions")),pg(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_SUBTITLES_SHOWING&&pg(this)}get mediaSubtitlesList(){return pE(this,mr.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){py(this,mr.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return pE(this,mr.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){py(this,mr.MEDIA_SUBTITLES_SHOWING,e)}handleClick(){this.dispatchEvent(new mU.CustomEvent(c7.MEDIA_TOGGLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0}))}}pv.getSlotTemplateHTML=function(e){return'\n    <style>\n      :host([aria-checked="true"]) slot[name=off] {\n        display: none !important;\n      }\n\n      \n      :host(:not([aria-checked="true"])) slot[name=on] {\n        display: none !important;\n      }\n\n      :host([aria-checked="true"]) slot[name=tooltip-enable],\n      :host(:not([aria-checked="true"])) slot[name=tooltip-disable] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="on">'.concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <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 
30 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"/>\n</svg>','</slot>\n      <slot name="off">').concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <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"/>\n</svg>',"</slot>\n    </slot>\n  ")},pv.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-enable">'.concat(mS("Enable captions"),'</slot>\n    <slot name="tooltip-disable">').concat(mS("Disable captions"),"</slot>\n  ")};let pE=(e,t)=>{let i=e.getAttribute(t);return i?fE(i):[]},py=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=fT(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};mU.customElements.get("media-captions-button")||mU.customElements.define("media-captions-button",pv);let pb=e=>{let t=e.mediaIsCasting?mS("stop casting"):mS("start casting");e.setAttribute("aria-label",t)};class pT extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_IS_CASTING,mr.MEDIA_CAST_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),pb(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_IS_CASTING&&pb(this)}get mediaIsCasting(){return m4(this,mr.MEDIA_IS_CASTING)}set mediaIsCasting(e){m5(this,mr.MEDIA_IS_CASTING,e)}get mediaCastUnavailable(){return m8(this,mr.MEDIA_CAST_UNAVAILABLE)}set mediaCastUnavailable(e){m6(this,mr.MEDIA_CAST_UNAVAILABLE,e)}handleClick(){let e=this.mediaIsCasting?c7.MEDIA_EXIT_CAST_REQUEST:c7.MEDIA_ENTER_CAST_REQUEST;this.dispatchEvent(new mU.CustomEvent(e,{composed:!0,bubbles:!0}))}}pT.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host([".concat(mr.MEDIA_IS_CASTING,"]) slot[name=icon] slot:not([name=exit]) {\n        display: none !important;\n      }\n\n      ","\n      :host(:not([").concat(mr.MEDIA_IS_CASTING,"])) slot[name=icon] slot:not([name=enter]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_IS_CASTING,"]) slot[name=tooltip-enter],\n      :host(:not([").concat(mr.MEDIA_IS_CASTING,'])) slot[name=tooltip-exit] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="enter">').concat('<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>','</slot>\n      <slot name="exit">').concat('<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>',"</slot>\n    </slot>\n  ")},pT.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-enter">'.concat(mS("Start casting"),'</slot>\n    <slot name="tooltip-exit">').concat(mS("Stop casting"),"</slot>\n  ")},mU.customElements.get("media-cast-button")||mU.customElements.define("media-cast-button",pT);var p_=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pA=(e,t,i)=>(p_(e,t,"read from private field"),i?i.call(e):t.get(e)),pS=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pR=(e,t,i,r)=>(p_(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),pk=(e,t,i)=>(p_(e,t,"access private method"),i);let pI={OPEN:"open",ANCHOR:"anchor"};class pL extends mU.HTMLElement{static get observedAttributes(){return[pI.OPEN,pI.ANCHOR]}get open(){return m4(this,pI.OPEN)}set open(e){m5(this,pI.OPEN,e)}handleEvent(e){switch(e.type){case"invoke":pk(this,yx,yN).call(this,e);break;case"focusout":pk(this,yU,yF).call(this,e);break;case"keydown":pk(this,yB,yG).call(this,e)}}connectedCallback(){pk(this,yD,yw).call(this),this.role||(this.role="dialog"),this.addEventListener("invoke",this),this.addEventListener("focusout",this),this.addEventListener("keydown",this)}disconnectedCallback(){this.removeEventListener("invoke",this),this.removeEventListener("focusout",this),this.removeEventListener("keydown",this)}attributeChangedCallback(e,t,i){pk(this,yD,yw).call(this),e===pI.OPEN&&i!==t&&(this.open?pk(this,yC,yM).call(this):pk(this,yP,yO).call(this))}focus(){pR(this,yI,mZ());let 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;
3let i=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==i||i.focus()}get keysUsed(){return["Escape","Tab"]}constructor(){super(),pS(this,yD),pS(this,yC),pS(this,yP),pS(this,yx),pS(this,yU),pS(this,yB),pS(this,yk,!1),pS(this,yI,null),pS(this,yL,null)}}yk=new WeakMap,yI=new WeakMap,yL=new WeakMap,yD=new WeakSet,yw=function(){if(!pA(this,yk)&&(pR(this,yk,!0),!this.shadowRoot)){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e),queueMicrotask(()=>{let{style:e}=m0(this.shadowRoot,":host");e.setProperty("transition","display .15s, visibility .15s, opacity .15s ease-in, transform .15s ease-in")})}},yC=new WeakSet,yM=function(){var e;null==(e=pA(this,yL))||e.setAttribute("aria-expanded","true"),this.dispatchEvent(new Event("open",{composed:!0,bubbles:!0})),this.addEventListener("transitionend",()=>this.focus(),{once:!0})},yP=new WeakSet,yO=function(){var e;null==(e=pA(this,yL))||e.setAttribute("aria-expanded","false"),this.dispatchEvent(new Event("close",{composed:!0,bubbles:!0}))},yx=new WeakSet,yN=function(e){pR(this,yL,e.relatedTarget),mQ(this,e.relatedTarget)||(this.open=!this.open)},yU=new WeakSet,yF=function(e){var t;!mQ(this,e.relatedTarget)&&(null==(t=pA(this,yI))||t.focus(),pA(this,yL)&&pA(this,yL)!==e.relatedTarget&&this.open&&(this.open=!1))},yB=new WeakSet,yG=function(e){var t,i,r,n,a;let{key:s,ctrlKey:o,altKey:l,metaKey:d}=e;o||l||d||this.keysUsed.includes(s)&&(e.preventDefault(),e.stopPropagation(),"Tab"===s?(e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(n=null==(r=this.nextElementSibling)?void 0:r.focus)||n.call(r),this.blur()):"Escape"===s&&(null==(a=pA(this,yI))||a.focus(),this.open=!1))},pL.shadowRootOptions={mode:"open"},pL.getTemplateHTML=function(e){return"\n    <style>\n      :host {\n        font: var(--media-font,\n          var(--media-font-weight, normal)\n          var(--media-font-size, 14px) /\n          var(--media-text-content-height, var(--media-control-height, 24px))\n          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        display: var(--media-dialog-display, inline-flex);\n        justify-content: center;\n        align-items: center;\n        \n        transition-behavior: allow-discrete;\n        visibility: hidden;\n        opacity: 0;\n        transform: translateY(2px) scale(.99);\n        pointer-events: none;\n      }\n\n      :host([open]) {\n        transition: display .2s, visibility 0s, opacity .2s ease-out, transform .15s ease-out;\n        visibility: visible;\n        opacity: 1;\n        transform: translateY(0) scale(1);\n        pointer-events: auto;\n      }\n\n      #content {\n        display: flex;\n        position: relative;\n        box-sizing: border-box;\n        width: min(320px, 100%);\n        word-wrap: break-word;\n        max-height: 100%;\n        overflow: auto;\n        text-align: center;\n        line-height: 1.4;\n      }\n    </style>\n    ".concat(this.getSlotTemplateHTML(e),"\n  ")},pL.getSlotTemplateHTML=function(e){return'\n    <slot id="content"></slot>\n  '},mU.customElements.get("media-chrome-dialog")||mU.customElements.define("media-chrome-dialog",pL);var pD=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pw=(e,t,i)=>(pD(e,t,"read from private field"),i?i.call(e):t.get(e)),pC=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},pM=(e,t,i,r)=>(pD(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),pP=(e,t,i)=>(pD(e,t,"access private method"),i);class pO extends mU.HTMLElement{static get observedAttributes(){return["disabled","aria-disabled",me.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,s,o;e===me.MEDIA_CONTROLLER?(t&&(null==(n=null==(r=pw(this,yH))?void 0:r.unassociateElement)||n.call(r,this),pM(this,yH,null)),i&&this.isConnected&&(pM(this,yH,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=pw(this,yH))?void 0:s.associateElement)||o.call(s,this))):("disabled"===e||"aria-disabled"===e&&t!==i)&&(null==i?(this.range.removeAttribute(e),pP(this,yJ,y$).call(this)):(this.range.setAttribute(e,i),pP(this,y0,y1).call(this)))}connectedCallback(){var e,t,i;let{style:r}=m0(this.shadowRoot,":host");r.setProperty("display","var(--media-control-display, var(--".concat(this.localName,"-display, inline-flex))")),pw(this,yq).pointer=m0(this.shadowRoot,"#pointer"),pw(this,yq).progress=m0(this.shadowRoot,"#progress"),pw(this,yq).thumb=m0(this.shadowRoot,'#thumb, ::slotted([slot="thumb"])'),pw(this,yq).activeSegment=m0(this.shadowRoot,"#segments-clipping rect:nth-child(0)");let n=this.getAttribute(me.MEDIA_CONTROLLER);n&&(pM(this,yH,null==(e=this.getRootNode())?void 0:e.getElementById(n)),null==(i=null==(t=pw(this,yH))?void 0:t.associateElement)||i.call(t,this)),this.updateBar(),this.shadowRoot.addEventListener("focusin",pw(this,yj)),this.shadowRoot.addEventListener("focusout",pw(this,yz)),pP(this,yJ,y$).call(this),mK(this.container,pw(this,yQ))}disconnectedCallback(){var e,t;pP(this,y0,y1).call(this),null==(t=null==(e=pw(this,yH))?void 0:e.unassociateElement)||t.call(e,this),pM(this,yH,null),this.shadowRoot.removeEventListener("focusin",pw(this,yj)),this.shadowRoot.removeEventListener("focusout",pw(this,yz)),mW(this.container,pw(this,yQ))}updatePointerBar(e){var t;null==(t=pw(this,yq).pointer)||t.style.setProperty("width","".concat(100*this.getPointerRatio(e),"%"))}updateBar(){var e,t;let i=100*this.range.valueAsNumber;null==(e=pw(this,yq).progress)||e.style.setProperty("width","".concat(i,"%")),null==(t=pw(this,yq).thumb)||t.style.setProperty("left","".concat(i,"%"))}updateSegments(e){let t=this.shadowRoot.querySelector("#segments-clipping");if(t.textContent="",this.container.classList.toggle("segments",!!(null==e?void 0:e.length)),!(null==e?void 0:e.length))return;let i=[...new Set([+this.range.min,...e.flatMap(e=>[e.start,e.end]),+this.range.max])];pM(this,yY,[...i]);let r=i.pop();for(let[e,n]of i.entries()){let[a,s]=[0===e,e===i.length-1],o=a?"calc(var(--segments-gap) / -1)":"".concat(100*n,"%"),l=s?r:i[e+1],d="calc(".concat((l-n)*100,"%").concat(a||s?"":" - var(--segments-gap)",")"),u=mF.createElementNS("http://www.w3.org/2000/svg","rect"),h=m1(this.shadowRoot,"#segments-clipping rect:nth-child(".concat(e+1,")"));h.style.setProperty("x",o),h.style.setProperty("width",d),t.append(u)}}getPointerRatio(e){return function(e,t,i,r){let n=r.x-i.x,a=r.y-i.y,s=n*n+a*a;return 0===s?0:Math.max(0,Math.min(1,((e-i.x)*n+(t-i.y)*a)/s))}(e.clientX,e.clientY,pw(this,yW).getBoundingClientRect(),pw(this,yV).getBoundingClientRect())}get dragging(){return this.hasAttribute("dragging")}handleEvent(e){switch(e.type){case"pointermove":pP(this,be,bt).call(this,e);break;case"input":this.updateBar();break;case"pointerenter":pP(this,y4,y5).call(this,e);break;case"pointerdown":pP(this,y2,y3).call(this,e);break;case"pointerup":pP(this,y8,y6).call(this);break;case"pointerleave":pP(this,y9,y7).call(this)}}get keysUsed(){return["ArrowUp","ArrowRight","ArrowDown","ArrowLeft"]}constructor(){if(super(),pC(this,yX),pC(this,yJ),pC(this,y0),pC(this,y2),pC(this,y4),pC(this,y8),pC(this,y9),pC(this,be),pC(this,yH,void 0),pC(this,yK,void 0),pC(this,yW,void 0),pC(this,yV,void 0),pC(this,yq,{}),pC(this,yY,[]),pC(this,yj,()=>{if(this.range.matches(":focus-visible")){let{style:e}=m0(this.shadowRoot,":host");e.setProperty("--_focus-visible-box-shadow","var(--_focus-box-sha
3dow)")}}),pC(this,yz,()=>{let{style:e}=m0(this.shadowRoot,":host");e.removeProperty("--_focus-visible-box-shadow")}),pC(this,yQ,()=>{let e=this.shadowRoot.querySelector("#segments-clipping");e&&e.parentNode.append(e)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes),t=this.constructor.getTemplateHTML(e);this.shadowRoot.setHTMLUnsafe?this.shadowRoot.setHTMLUnsafe(t):this.shadowRoot.innerHTML=t}this.container=this.shadowRoot.querySelector("#container"),pM(this,yW,this.shadowRoot.querySelector("#startpoint")),pM(this,yV,this.shadowRoot.querySelector("#endpoint")),this.range=this.shadowRoot.querySelector("#range"),this.appearance=this.shadowRoot.querySelector("#appearance")}}yH=new WeakMap,yK=new WeakMap,yW=new WeakMap,yV=new WeakMap,yq=new WeakMap,yY=new WeakMap,yj=new WeakMap,yz=new WeakMap,yQ=new WeakMap,yX=new WeakSet,yZ=function(e){let t=pw(this,yq).activeSegment;if(!t)return;let i=this.getPointerRatio(e),r=pw(this,yY).findIndex((e,t,r)=>{let n=r[t+1];return null!=n&&i>=e&&i<=n}),n="#segments-clipping rect:nth-child(".concat(r+1,")");t.selectorText==n&&t.style.transform||(t.selectorText=n,t.style.setProperty("transform","var(--media-range-segment-hover-transform, scaleY(2))"))},yJ=new WeakSet,y$=function(){!this.hasAttribute("disabled")&&this.isConnected&&(this.addEventListener("input",this),this.addEventListener("pointerdown",this),this.addEventListener("pointerenter",this))},y0=new WeakSet,y1=function(){var e,t;this.removeEventListener("input",this),this.removeEventListener("pointerdown",this),this.removeEventListener("pointerenter",this),this.removeEventListener("pointerleave",this),null==(e=mU.window)||e.removeEventListener("pointerup",this),null==(t=mU.window)||t.removeEventListener("pointermove",this)},y2=new WeakSet,y3=function(e){var t;pM(this,yK,e.composedPath().includes(this.range)),null==(t=mU.window)||t.addEventListener("pointerup",this,{once:!0})},y4=new WeakSet,y5=function(e){var t;"mouse"!==e.pointerType&&pP(this,y2,y3).call(this,e),this.addEventListener("pointerleave",this,{once:!0}),null==(t=mU.window)||t.addEventListener("pointermove",this)},y8=new WeakSet,y6=function(){var e;null==(e=mU.window)||e.removeEventListener("pointerup",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled")},y9=new WeakSet,y7=function(){var e,t;this.removeEventListener("pointerleave",this),null==(e=mU.window)||e.removeEventListener("pointermove",this),this.toggleAttribute("dragging",!1),this.range.disabled=this.hasAttribute("disabled"),null==(t=pw(this,yq).activeSegment)||t.style.removeProperty("transform")},be=new WeakSet,bt=function(e){("pen"!==e.pointerType||0!==e.buttons)&&(this.toggleAttribute("dragging",1===e.buttons||"mouse"!==e.pointerType),this.updatePointerBar(e),pP(this,yX,yZ).call(this,e),this.dragging&&("mouse"!==e.pointerType||!pw(this,yK))&&(this.range.disabled=!0,this.range.valueAsNumber=this.getPointerRatio(e),this.range.dispatchEvent(new Event("input",{bubbles:!0,composed:!0}))))},pO.shadowRootOptions={mode:"open"},pO.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        --_focus-box-shadow: var(--media-focus-box-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));\n        --_media-range-padding: var(--media-range-padding, var(--media-control-padding, 10px));\n\n        box-shadow: var(--_focus-visible-box-shadow, none);\n        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));\n        height: calc(var(--media-control-height, 24px) + 2 * var(--_media-range-padding));\n        display: inline-flex;\n        align-items: center;\n        \n        vertical-align: middle;\n        box-sizing: border-box;\n        position: relative;\n        width: 100px;\n        transition: background .15s linear;\n        cursor: var(--media-cursor, pointer);\n        pointer-events: auto;\n        touch-action: none; \n      }\n\n      \n      input[type=range]:focus {\n        outline: 0;\n      }\n      input[type=range]:focus::-webkit-slider-runnable-track {\n        outline: 0;\n      }\n\n      :host(:hover) {\n        background: var(--media-control-hover-background, rgb(50 50 70 / .7));\n      }\n\n      #leftgap {\n        padding-left: var(--media-range-padding-left, var(--_media-range-padding));\n      }\n\n      #rightgap {\n        padding-right: var(--media-range-padding-right, var(--_media-range-padding));\n      }\n\n      #startpoint,\n      #endpoint {\n        position: absolute;\n      }\n\n      #endpoint {\n        right: 0;\n      }\n\n      #container {\n        \n        width: var(--media-range-track-width, 100%);\n        transform: translate(var(--media-range-track-translate-x, 0px), var(--media-range-track-translate-y, 0px));\n        position: relative;\n        height: 100%;\n        display: flex;\n        align-items: center;\n        min-width: 40px;\n      }\n\n      #range {\n        \n        display: var(--media-time-range-hover-display, block);\n        bottom: var(--media-time-range-hover-bottom, 0);\n        height: var(--media-time-range-hover-height, max(100% , 25px));\n        width: 100%;\n        position: absolute;\n        cursor: var(--media-cursor, pointer);\n\n        -webkit-appearance: none; \n        -webkit-tap-highlight-color: transparent;\n        background: transparent; \n        margin: 0;\n        z-index: 1;\n      }\n\n      @media (hover: hover) {\n        #range {\n          bottom: var(--media-time-range-hover-bottom, 0);\n          height: var(--media-time-range-hover-height, max(100%, 20px));\n        }\n      }\n\n      \n      \n      #range::-webkit-slider-thumb {\n        -webkit-appearance: none;\n        background: transparent;\n        width: .1px;\n        height: .1px;\n      }\n\n      \n      #range::-moz-range-thumb {\n        background: transparent;\n        border: transparent;\n        width: .1px;\n        height: .1px;\n      }\n\n      #appearance {\n        height: var(--media-range-track-height, 4px);\n        display: flex;\n        flex-direction: column;\n        justify-content: center;\n        width: 100%;\n        position: absolute;\n        \n        will-change: transform;\n      }\n\n      #track {\n        background: var(--media-range-track-background, rgb(255 255 255 / .2));\n        border-radius: var(--media-range-track-border-radius, 1px);\n        border: var(--media-range-track-border, none);\n        outline: var(--media-range-track-outline);\n        outline-offset: var(--media-range-track-outline-offset);\n        backdrop-filter: var(--media-range-track-backdrop-filter);\n        -webkit-backdrop-filter: var(--media-range-track-backdrop-filter);
3\n        box-shadow: var(--media-range-track-box-shadow, none);\n        position: absolute;\n        width: 100%;\n        height: 100%;\n        overflow: hidden;\n      }\n\n      #progress,\n      #pointer {\n        position: absolute;\n        height: 100%;\n        will-change: width;\n      }\n\n      #progress {\n        background: var(--media-range-bar-color, var(--media-primary-color, rgb(238 238 238)));\n        transition: var(--media-range-track-transition);\n      }\n\n      #pointer {\n        background: var(--media-range-track-pointer-background);\n        border-right: var(--media-range-track-pointer-border-right);\n        transition: visibility .25s, opacity .25s;\n        visibility: hidden;\n        opacity: 0;\n      }\n\n      @media (hover: hover) {\n        :host(:hover) #pointer {\n          transition: visibility .5s, opacity .5s;\n          visibility: visible;\n          opacity: 1;\n        }\n      }\n\n      #thumb,\n      ::slotted([slot=thumb]) {\n        width: var(--media-range-thumb-width, 10
3px);\n        height: var(--media-range-thumb-height, 10px);\n        transition: var(--media-range-thumb-transition);\n        transform: var(--media-range-thumb-transform, none);\n        opacity: var(--media-range-thumb-opacity, 1);\n        translate: -50%;\n        position: absolute;\n        left: 0;\n        cursor: var(--media-cursor, pointer);\n      }\n\n      #thumb {\n        border-radius: var(--media-range-thumb-border-radius, 10px);\n        background: var(--media-range-thumb-background, var(--media-primary-color, rgb(238 238 238)));\n        box-shadow: var(--media-range-thumb-box-shadow, 1px 1px 1px transparent);\n        border: var(--media-range-thumb-border, none);\n      }\n\n      :host([disabled]) #thumb {\n        background-color: #777;\n      }\n\n      .segments #appearance {\n        height: var(--media-range-segment-hover-height, 7px);\n      }\n\n      #track {\n        clip-path: url(#segments-clipping);\n      }\n\n      #segments {\n        --segments-gap: var(--media-range-segments-gap, 2px);\n        position: absolute;\n        width: 100%;\n        height: 100%;\n      }\n\n      #segments-clipping {\n        transform: translateX(calc(var(--segments-gap) / 2));\n      }\n\n      #segments-clipping:empty {\n        display: none;\n      }\n\n      #segments-clipping rect {\n        height: var(--media-range-track-height, 4px);\n        y: calc((var(--media-range-segment-hover-height, 7px) - var(--media-range-track-height, 4px)) / 2);\n        transition: var(--media-range-segment-transition, transform .1s ease-in-out);\n        transform: var(--media-range-segment-transform, scaleY(1));\n        transform-origin: center;\n      }\n\n      /* Visible label for accessibility - positioned off-screen but technically visible (Firefox requires visible labels) */\n      #range-label {\n        position: absolute;\n        left: -10000px;\n        background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));\n        pointer-events: none;\n      }\n    </style>\n    <div id="leftgap"></div>\n    <div id="container">\n      <div id="startpoint"></div>\n      <div id="endpoint"></div>\n      <div id="appearance">\n        <div id="track" part="track">\n          <div id="pointer"></div>\n          <div id="progress" part="progress"></div>\n        </div>\n        <slot name="thumb">\n          <div id="thumb" part="thumb"></div>\n        </slot>\n        <svg id="segments" aria-hidden="true"><clipPath id="segments-clipping"></clipPath></svg>\n      </div>
3\n        <input id="range" type="range" min="0" max="1" step="any" value="0">\n        <label for="range" id="range-label"></label>\n\n      '.concat(this.getContainerTemplateHTML(e),'\n    </div>\n    <div id="rightgap"></div>\n  ')},pO.getContainerTemplateHTML=function(e){return""},mU.customElements.get("media-chrome-range")||mU.customElements.define("media-chrome-range",pO);var px=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pN=(e,t,i)=>(px(e,t,"read from private field"),i?i.call(e):t.get(e)),pU=(e,t,i,r)=>(px(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class pF extends mU.HTMLElement{static get observedAttributes(){return[me.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,s,o;e===me.MEDIA_CONTROLLER&&(t&&(null==(n=null==(r=pN(this,bi))?void 0:r.unassociateElement)||n.call(r,this),pU(this,bi,null)),i&&this.isConnected&&(pU(this,bi,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=pN(this,bi))?void 0:s.associateElement)||o.call(s,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(me.MEDIA_CONTROLLER);r&&(pU(this,bi,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=pN(this,bi))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=pN(this,bi))?void 0:e.unassociateElement)||t.call(e,this),pU(this,bi,null)}constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bi,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}bi=new WeakMap,pF.shadowRootOptions={mode:"open"},pF.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        \n        box-sizing: border-box;\n        display: var(--media-control-display, var(--media-control-bar-display, inline-flex));\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        --media-loading-indicator-icon-height: 44px;\n      }\n\n      ::slotted(media-time-range),\n      ::slotted(media-volume-range) {\n        min-height: 100%;\n      }\n\n      ::slotted(media-time-range),\n      ::slotted(media-clip-selector) {\n        flex-grow: 1;\n      }\n\n      ::slotted([role="menu"]) {\n        position: absolute;\n      }\n    </style>\n\n    <slot></slot>\n  '},mU.customElements.get("media-control-bar")||mU.customElements.define("media-control-bar",pF);var pB=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pG=(e,t,i)=>(pB(e,t,"read from private field"),i?i.call(e):t.get(e)),pH=(e,t,i,r)=>(pB(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class pK extends mU.HTMLElement{static get observedAttributes(){return[me.MEDIA_CONTROLLER]}attributeChangedCallback(e,t,i){var r,n,a,s,o;e===me.MEDIA_CONTROLLER&&(t&&(null==(n=null==(r=pG(this,br))?void 0:r.unassociateElement)||n.call(r,this),pH(this,br,null)),i&&this.isConnected&&(pH(this,br,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=pG(this,br))?void 0:s.associateElement)||o.call(s,this)))}connectedCallback(){var e,t,i;let{style:r}=m0(this.shadowRoot,":host");r.setProperty("display","var(--media-control-display, var(--".concat(this.localName,"-display, inline-flex))"));let n=this.getAttribute(me.MEDIA_CONTROLLER);n&&(pH(this,br,null==(e=this.getRootNode())?void 0:e.getElementById(n)),null==(i=null==(t=pG(this,br))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=pG(this,br))?void 0:e.unassociateElement)||t.call(e,this),pH(this,br,null)}constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,br,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}br=new WeakMap,pK.shadowRootOptions={mode:"open"},pK.getTemplateHTML=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return"\n    <style>\n      :host {\n        font: var(--media-font,\n          var(--media-font-weight, normal)\n          var(--media-font-size, 14px) /\n          var(--media-text-content-height, var(--media-control-height, 24px))\n          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        background: var(--media-text-background, var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7))));\n        padding: var(--media-control-padding, 10px);\n        display: inline-flex;\n        justify-content: center;\n        align-items: center;\n        vertical-align: middle;\n        box-sizing: border-box;\n        text-align: center;\n        pointer-events: auto;\n      }\n\n      \n      :host(:focus-visible) {\n        box-shadow: var(--media-focus-box-sha
3dow, inset 0 0 0 2px rgb(27 127 204 / .9));\n        outline: 0;\n      }\n\n      \n      :host(:where(:focus)) {\n        box-shadow: none;\n        outline: 0;\n      }\n    </style>\n\n    ".concat(this.getSlotTemplateHTML(e,t),"\n  ")},pK.getSlotTemplateHTML=function(e,t){return"\n    <slot></slot>\n  "},mU.customElements.get("media-text-display")||mU.customElements.define("media-text-display",pK);var pW=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},pV=(e,t,i)=>(pW(e,t,"read from private field"),i?i.call(e):t.get(e));class pq extends pK{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_DURATION]}attributeChangedCallback(e,t,i){e===mr.MEDIA_DURATION&&(pV(this,bn).textContent=mI(+i)),super.attributeChangedCallback(e,t,i)}get mediaDuration(){return m2(this,mr.MEDIA_DURATION)}set mediaDuration(e){m3(this,mr.MEDIA_DURATION,e)}constructor(){var e;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bn,void 0),((e,t,i,r)=>(pW(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,bn,this.shadowRoot.querySelector("slot")),pV(this,bn).textContent=mI(null!=(e=this.mediaDuration)?e:0)}}bn=new WeakMap,pq.getSlotTemplateHTML=function(e,t){return"\n    <slot>".concat(mI(t.mediaDuration),"</slot>\n  ")},mU.customElements.get("media-duration-display")||mU.customElements.define("media-duration-display",pq);let pY={2:mS("Network Error"),3:mS("Decode Error"),4:mS("Source Not Supported"),5:mS("Encryption 
3Error")},pj={2:mS("A network error caused the media download to fail."),3:mS("A media error caused playback to be aborted. The media could be corrupt or your browser does not support this format."),4:mS("An unsupported error occurred. The server or network failed, or your browser does not support this format."),5:mS("The media is encrypted and there are no keys to decrypt it.")},pz=e=>{var t,i;return 1===e.code?null:{title:null!=(t=pY[e.code])?t:"Error ".concat(e.code),message:null!=(i=pj[e.code])?i:e.message}};var pQ=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};function pX(e){var t;let{title:i,message:r}=null!=(t=pz(e))?t:{},n="";return i&&(n+='<slot name="error-'.concat(e.code,'-title"><h3>').concat(i,"</h3></slot>")),r&&(n+='<slot name="error-'.concat(e.code,'-message"><p>').concat(r,"</p></slot>")),n}let pZ=[mr.MEDIA_ERROR_CODE,mr.MEDIA_ERROR_MESSAGE];class pJ extends pL{static get observedAttributes(){return[...super.observedAttributes,...pZ]}formatErrorMessage(e){return this.constructor.formatErrorMessage(e)}attributeChangedCallback(e,t,i){var r;if(super.attributeChangedCallback(e,t,i),!pZ.includes(e))return;let n=null!=(r=this.mediaError)?r:{code:this.mediaErrorCode,message:this.mediaErrorMessage};if(this.open=n.code&&null!==pz(n),this.open&&(this.shadowRoot.querySelector("slot").name="error-".concat(this.mediaErrorCode),this.shadowRoot.querySelector("#content").innerHTML=this.formatErrorMessage(n),!this.hasAttribute("aria-label"))){let{title:e}=pz(n);e&&this.setAttribute("aria-label",e)}}get mediaError(){var e,t;return pQ(this,e=ba,"read from private field"),t?t.call(this):e.get(this)}set mediaError(e){var t,i;pQ(this,t=ba,"write to private field"),i?i.call(this,e):t.set(this,e)}get mediaErrorCode(){return m2(this,"mediaerrorcode")}set mediaErrorCode(e){m3(this,"mediaerrorcode",e)}get mediaErrorMessage(){return m8(this,"mediaerrormessage")}set mediaErrorMessage(e){m6(this,"mediaerrormessage",e)}constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,ba,null)}}ba=new WeakMap,pJ.getSlotTemplateHTML=function(e){return'\n    <style>\n      :host {\n        background: rgb(20 20 30 / .8);\n      }\n\n      #content {\n        display: block;\n        padding: 1.2em 1.5em;\n      }\n\n      h3,\n      p {\n        margin-block: 0 .3em;\n      }\n    </style>\n    <slot name="error-'.concat(e.mediaerrorcode,'" id="content">\n      ').concat(pX({code:+e.mediaerrorcode,message:e.mediaerrormessage}),"\n    </slot>\n  ")},pJ.formatErrorMessage=pX,mU.customElements.get("media-error-dialog")||mU.customElements.define("media-error-dialog",pJ);var p$=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)},p0=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)};class p1 extends pL{connectedCallback(){super.connectedCallback(),this.open&&(this.addEventListener("click",p$(this,bs)),document.addEventListener("keydown",p$(this,bo)))}disconnectedCallback(){this.removeEventListener("click",p$(this,bs)),document.removeEventListener("keydown",p$(this,bo))}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),"open"===e&&(this.open?(this.addEventListener("click",p$(this,bs)),document.addEventListener("keydown",p$(this,bo))):(this.removeEventListener("click",p$(this,bs)),document.removeEventListener("keydown",p$(this,bo))))}constructor(){super(...arguments),p0(this,bs,e=>{var t;if(!this.open)return;let i=null==(t=this.shadowRoot)?void 0:t.querySelector("#content");if(!i)return;let r=e.composedPath(),n=r[0]===this||r.includes(this),a=r.includes(i);n&&!a&&(this.open=!1)}),p0(this,bo,e=>{if(!this.open)return;let t=e.shiftKey&&("/"===e.key||"?"===e.key);"Escape"!==e.key&&!t||e.ctrlKey||e.altKey||e.metaKey||(this.open=!1,e.preventDefault(),e.stopPropagation())})}}bs=new WeakMap,bo=new WeakMap,p1.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host {\n        position: fixed;\n        top: 0;\n        left: 0;\n        z-index: 9999;\n        background: rgb(20 20 30 / .8);\n        backdrop-filter: blur(10px);\n      }\n\n      #content {\n        display: block;\n        width: clamp(400px, 40vw, 700px);\n        max-width: 90vw;\n        text-align: left;\n      }\n\n      h2 {\n        margin: 0 0 1.5rem 0;\n        font-size: 1.5rem;\n        font-weight: 500;\n        text-align: center;\n      }\n\n      .shortcuts-table {\n        width: 100%;\n        border-collapse: collapse;\n      }\n\n      .shortcuts-table tr {\n        border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n      }\n\n      .shortcuts-table tr:last-child {\n        border-bottom: none;\n      }\n\n      .shortcuts-table td {\n        padding: 0.75rem 0.5rem;\n      }\n\n      .shortcuts-table td:first-child {\n        text-align: right;\n        padding-right: 1rem;\n        width: 40%;\n        min-width: 120px;\n      }\n\n      .shortcuts-table td:last-child {\n        padding-left: 1rem;\n      }\n\n      .key {\n        display: inline-block;\n        background: rgba(255, 255, 255, 0.15);\n        border: 1px solid rgba(255, 255, 255, 0.2);\n        border-radius: 4px;\n        padding: 0.25rem 0.5rem;\n        font-family: 'Courier New', monospace;\n        font-size: 0.9rem;\n        font-weight: 500;\n        min-width: 1.5rem;\n        text-align: center;\n        margin: 0 0.2rem;\n      }\n\n      .description {\n        color: rgba(255, 255, 255, 0.9);\n        font-size: 0.95rem;\n      }\n\n      .key-combo {\n        display: flex;\n        align-items: center;\n        justify-content: flex-end;\n        gap: 0.3rem;\n      }\n\n      .key-separator {\n        color: rgba(255, 255, 255, 0.5);\n        font-size: 0.9rem;\n      }\n    </style>\n    <slot id=\"content\">\n      ".concat(function(){let e=[{keys:["Space","k"],description:"Toggle Playback"},{keys:["m"],description:"Toggle mute"},{keys:["f"],description:"Toggle fullscreen"},{keys:["c"],description:"Toggle captions or subtitles, if available"},{keys:["p"],description:"Toggle Picture in Picture"},{keys:["←","j"],description:"Seek back 10s"},{keys:["→","l"],description:"Seek forward 10s"},{keys:["↑"],description:"Turn volume up"},{keys:["↓"],description:"Turn volume down"},{keys:["< (SHIFT+,)"],description:"Decrease playback rate"},{keys:["> (SHIFT+.)"],description:"Increase playback rate"}].map(e=>{let{keys:t,description:i}=e,r=t.map((e,t)=>t>0?'<span class="key-separator">or</span><span class="key">'.concat(e,"</span>"):'<span class="key">'.concat(e,"</span>")).join("");return'\n      <tr>\n        <td>\n          <div class="key-combo">'.concat(r,'</div>\n        </td>\n        <td class="description">').concat(i,"</td>\n      </tr>\n    ")}).join("");return'\n    <h2>Keyboard Shortcuts</h2>\n    <table class="shortcuts-table">'.concat(e,"</table>\n  ")}(),"\n    </slot>\n  ")},mU.customElements.get("media-keyboard-shortcuts-dialog")||mU.customElements.define("media-keyboard-shortcuts-dialog",p1);var p2=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};let p3=e=>{let t=e.mediaIsFullscreen?mS("exit fullscreen mode"):mS("enter fullscreen mode");e.setAttribute("aria-label",t)};class p4 extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_IS_FULLSCREEN,mr.MEDIA_FULLSCREEN_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),p3(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_IS_FULLSCREEN&&p3(this)}get mediaFullscreenUnavailable(){return m8(this,mr.MEDIA_FULLSCREEN_UNAVAILABLE)}set mediaFullscreenUnavailable(e){m6(this,mr.MEDIA_FULLSCREEN_UNAVAILABLE,e)}get mediaIsFullscreen(){return m4(this,mr.MEDIA_IS_FULLSCREEN)}set mediaIsFullscreen(e){m5(this,mr.MEDIA_IS_FULLSCREEN,e)}handleClick(e){var t,i,r,n;p2(this,t=bl,"write to private field"),i?i.call(this,e):t.set(this,e);let a=(p2(this,r=bl,"read from private field"),(n?n.call(this):r.get(this))instanceof PointerEvent),s=this.mediaIsFullscreen?new mU.CustomEvent(c7.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0}
3):new mU.CustomEvent(c7.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0,detail:a});this.dispatchEvent(s)}constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bl,null)}}bl=new WeakMap,p4.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host([".concat(mr.MEDIA_IS_FULLSCREEN,"]) slot[name=icon] slot:not([name=exit]) {\n        display: none !important;\n      }\n\n      ","\n      :host(:not([").concat(mr.MEDIA_IS_FULLSCREEN,"])) slot[name=icon] slot:not([name=enter]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_IS_FULLSCREEN,"]) slot[name=tooltip-enter],\n      :host(:not([").concat(mr.MEDIA_IS_FULLSCREEN,'])) slot[name=tooltip-exit] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="enter">').concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <path d="M16 3v2.5h3.5V9H22V3h-6ZM4 9h2.5V5.5H10V3H4v6Zm15.5 9.5H16V21h6v-6h-2.5v3.5ZM6.5 15H4v6h6v-2.5H6.5V15Z"/>\n</svg>','</slot>\n      <slot name="exit">').concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <path d="M18.5 6.5V3H16v6h6V6.5h-3.5ZM16 21h2.5v-3.5H22V15h-6v6ZM4 17.5h3.5V21H10v-6H4v2.5Zm3.5-11H4V9h6V3H7.5v3.5Z"/>\n</svg>',"</slot>\n    </slot>\n  ")},p4.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-enter">'.concat(mS("Enter fullscreen mode"),'</slot>\n    <slot name="tooltip-exit">').concat(mS("Exit fullscreen mode"),"</slot>\n  ")},mU.customElements.get("media-fullscreen-button")||mU.customElements.define("media-fullscreen-button",p4);let{MEDIA_TIME_IS_LIVE:p5,MEDIA_PAUSED:p8}=mr,{MEDIA_SEEK_TO_LIVE_REQUEST:p6,MEDIA_PLAY_REQUEST:p9}=c7,p7=e=>{var t;let i=e.mediaPaused||!e.mediaTimeIsLive,r=i?mS("seek to live"):mS("playing live");e.setAttribute("aria-label",r);let n=null==(t=e.shadowRoot)?void 0:t.querySelector('slot[name="text"]');n&&(n.textContent=mS("live")),i?e.removeAttribute("aria-disabled"):e.setAttribute("aria-disabled","true")};class ge extends pc{static get observedAttributes(){return[...super.observedAttributes,p5,p8]}connectedCallback(){super.connectedCallback(),p7(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),p7(this)}get mediaPaused(){return m4(this,mr.MEDIA_PAUSED)}set mediaPaused(e){m5(this,mr.MEDIA_PAUSED,e)}get mediaTimeIsLive(){return m4(this,mr.MEDIA_TIME_IS_LIVE)}set mediaTimeIsLive(e){m5(this,mr.MEDIA_TIME_IS_LIVE,e)}handleClick(){(this.mediaPaused||!this.mediaTimeIsLive)&&(this.dispatchEvent(new mU.CustomEvent(p6,{composed:!0,bubbles:!0})),this.hasAttribute(p8)&&this.dispatchEvent(new mU.CustomEvent(p9,{composed:!0,bubbles:!0})))}}ge.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host { --media-tooltip-display: none; }\n      \n      slot[name=indicator] > *,\n      :host ::slotted([slot=indicator]) {\n        \n        min-width: auto;\n        fill: var(--media-live-button-icon-color, rgb(140, 140, 140));\n        color: var(--media-live-button-icon-color, rgb(140, 140, 140));\n      }\n\n      :host([".concat(p5,"]:not([").concat(p8,"])) slot[name=indicator] > *,\n      :host([").concat(p5,"]:not([").concat(p8,"])) ::slotted([slot=indicator]) {\n        fill: var(--media-live-button-indicator-color, rgb(255, 0, 0));\n        color: var(--media-live-button-indicator-color, rgb(255, 0, 0));\n      }\n\n      :host([").concat(p5,"]:not([").concat(p8,'])) {\n        cursor: var(--media-cursor, not-allowed);\n      }\n\n      slot[name=text]{\n        text-transform: uppercase;\n      }\n\n    </style>\n\n    <slot name="indicator">').concat('<svg viewBox="0 0 6 12" aria-hidden="true"><circle cx="3" cy="6" r="2"></circle></svg>',"</slot>\n    ",'\n    <slot name="spacer">&nbsp;</slot><slot name="text">').concat(mS("live"),"</slot>\n  ")},mU.customElements.get("media-live-button")||mU.customElements.define("media-live-button",ge);var gt=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gi=(e,t,i)=>(gt(e,t,"read from private field"),i?i.call(e):t.get(e)),gr=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gn=(e,t,i,r)=>(gt(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let ga={LOADING_DELAY:"loadingdelay",NO_AUTOHIDE:"noautohide"};class gs extends mU.HTMLElement{static get observedAttributes(){return[me.MEDIA_CONTROLLER,mr.MEDIA_PAUSED,mr.MEDIA_LOADING,ga.LOADING_DELAY]}attributeChangedCallback(e,t,i){var r,n,a,s,o;e===ga.LOADING_DELAY&&t!==i?this.loadingDelay=Number(i):e===me.MEDIA_CONTROLLER&&(t&&(null==(n=null==(r=gi(this,bd))?void 0:r.unassociateElement)||n.call(r,this),gn(this,bd,null)),i&&this.isConnected&&(gn(this,bd,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=gi(this,bd))?void 0:s.associateElement)||o.call(s,this)))}connectedCallback(){var e,t,i;let r=this.getAttribute(me.MEDIA_CONTROLLER);r&&(gn(this,bd,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=gi(this,bd))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=gi(this,bd))?void 0:e.unassociateElement)||t.call(e,this),gn(this,bd,null)}get loadingDelay(){return gi(this,bu)}set loadingDelay(e){gn(this,bu,e);let{style:t}=m0(this.shadowRoot,":host");t.setProperty("--_loading-indicator-delay","var(--media-loading-indicator-transition-delay, ".concat(e,"ms)"))}get mediaPaused(){return m4(this,mr.MEDIA_PAUSED)}set mediaPaused(e){m5(this,mr.MEDIA_PAUSED,e)}get mediaLoading(){return m4(this,mr.MEDIA_LOADING)}set mediaLoading(e){m5(this,mr.MEDIA_LOADING,e)}get mediaController(){return m8(this,me.MEDIA_CONTROLLER)}set mediaController(e){m6(this,me.MEDIA_CONTROLLER,e)}get noAutohide(){return m4(this,ga.NO_AUTOHIDE)}set noAutohide(e){m5(this,ga.NO_AUTOHIDE,e)}constructor(){if(super(),gr(this,bd,void 0),gr(this,bu,500),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}bd=new WeakMap,bu=new WeakMap,gs.shadowRootOptions={mode:"open"},gs.getTemplateHTML=function(e){return"\n    <style>\n      :host {\n        display: var(--media-control-display, var(--media-loading-indicator-display, inline-block));\n        vertical-align: middle;\n        box-sizing: border-box;\n        --_loading-indicator-delay: var(--media-loading-indicator-transition-delay, ".concat(500,"ms);\n      }\n\n      #status {\n        color: rgba(0,0,0,0);\n        width: 0px;\n        height: 0px;\n      }\n\n      :host slot[name=icon] > *,\n      :host ::slotted([slot=icon]) {\n        opacity: var(--media-loading-indicator-opacity, 0);\n        transition: opacity 0.15s;\n      }\n\n      :host([").concat(mr.MEDIA_LOADING,"]:not([").concat(mr.MEDIA_PAUSED,"])) slot[name=icon] > *,\n      :host([").concat(mr.MEDIA_LOADING,"]:not([").concat(mr.MEDIA_PAUSED,"])) ::slotted([slot=icon]) {\n        opacity: var(--media-loading-indicator-opacity, 1);\n        transition: opacity 0.15s var(--_loading-indicator-delay);\n      }\n\n      :host #status {\n        visibility: var(--media-loading-indicator-opacity, hidden);\n        transition: visibility 0.15s;\n      }\n\n      :host([").concat(mr.MEDIA_LOADING,"]:not([").concat(mr.MEDIA_PAUSED,'])) #status {\n        visibility: var(--media-loading-indicator-opacity, visible);\n        transition: visibility 0.15s var(--_loading-indicator-delay);\n      }\n\n      svg, img, ::slotted(svg), ::slotted(img) {\n        width: var(--media-loading-indicator-icon-width);\n        height: var(--media-loading-indicator-icon-height, 100px);\n        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));\n        vertical-align: middle;\n      }\n    </style>\n\n    <slot name="icon">').concat('\n<svg aria-hidden="true" viewBox="0 0 100 100">\n  <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">\n    <animateTransform\n       attributeName="transform"\n       attributeType="XML"\n       type="rotate"\n       dur="1s"\n       from="0 50 50"\n       to="360 50 50"\n       repeatCount="indef
3inite" />\n  </path>\n</svg>\n','</slot>\n    <div id="status" role="status" aria-live="polite">').concat(mS("media loading"),"</div>\n  ")},mU.customElements.get("media-loading-indicator")||mU.customElements.define("media-loading-indicator",gs);let go='<svg aria-hidden="true" viewBox="0 0 24 24">\n  <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"/>\n</svg>',gl=e=>{let t="off"===e.mediaVolumeLevel?mS("unmute"):mS("mute");e.setAttribute("aria-label",t)};class gd extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_VOLUME_LEVEL]}connectedCallback(){super.connectedCallback(),gl(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_VOLUME_LEVEL&&gl(this)}get mediaVolumeLevel(){return m8(this,mr.MEDIA_VOLUME_LEVEL)}set mediaVolumeLevel(e){m6(this,mr.MEDIA_VOLUME_LEVEL,e)}handleClick(){let e="off"===this.mediaVolumeLevel?c7.MEDIA_UNMUTE_REQUEST:c7.MEDIA_MUTE_REQUEST;this.dispatchEvent(new mU.CustomEvent(e,{composed:!0,bubbles:!0}))}}gd.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host(:not([".concat(mr.MEDIA_VOLUME_LEVEL,"])) slot[name=icon] slot:not([name=high]),\n      :host([").concat(mr.MEDIA_VOLUME_LEVEL,"=high]) slot[name=icon] slot:not([name=high]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_VOLUME_LEVEL,"=off]) slot[name=icon] slot:not([name=off]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_VOLUME_LEVEL,"=low]) slot[name=icon] slot:not([name=low]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_VOLUME_LEVEL,"=medium]) slot[name=icon] slot:not([name=medium]) {\n        display: none !important;\n      }\n\n      :host(:not([").concat(mr.MEDIA_VOLUME_LEVEL,"=off])) slot[name=tooltip-unmute],\n      :host([").concat(mr.MEDIA_VOLUME_LEVEL,'=off]) slot[name=tooltip-mute] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="off">').concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <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"/>\n</svg>','</slot>\n      <slot name="low">').concat(go,'</slot>\n      <slot name="medium">').concat(go,'</slot>\n      <slot name="high">').concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <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"/>\n</svg>',"</slot>\n    </slot>\n  ")},gd.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-mute">'.concat(mS("Mute"),'</slot>\n    <slot name="tooltip-unmute">').concat(mS("Unmute"),"</slot>\n  ")},mU.customElements.get("media-mute-button")||mU.customElements.define("media-mute-button",gd);let gu='<svg aria-hidden="true" viewBox="0 0 28 24">\n  <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"/>\n</svg>',gh=e=>{let t=e.mediaIsPip?mS("exit picture in picture mode"):mS("enter picture in picture mode");e.setAttribute("aria-label",t)};class gc extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_IS_PIP,mr.MEDIA_PIP_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),gh(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_IS_PIP&&gh(this)}get mediaPipUnavailable(){return m8(this,mr.MEDIA_PIP_UNAVAILABLE)}set mediaPipUnavailable(e){m6(this,mr.MEDIA_PIP_UNAVAILABLE,e)}get mediaIsPip(){return m4(this,mr.MEDIA_IS_PIP)}set mediaIsPip(e){m5(this,mr.MEDIA_IS_PIP,e)}handleClick(){let e=this.mediaIsPip?c7.MEDIA_EXIT_PIP_REQUEST:c7.MEDIA_ENTER_PIP_REQUEST;this.dispatchEvent(new mU.CustomEvent(e,{composed:!0,bubbles:!0}))}}gc.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host([".concat(mr.MEDIA_IS_PIP,"]) slot[name=icon] slot:not([name=exit]) {\n        display: none !important;\n      }\n\n      :host(:not([").concat(mr.MEDIA_IS_PIP,"])) slot[name=icon] slot:not([name=enter]) {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_IS_PIP,"]) slot[name=tooltip-enter],\n      :host(:not([").concat(mr.MEDIA_IS_PIP,'])) slot[name=tooltip-exit] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="enter">').concat(gu,'</slot>\n      <slot name="exit">').concat(gu,"</slot>\n    </slot>\n  ")},gc.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-enter">'.concat(mS("Enter picture in picture mode"),'</slot>\n    <slot name="tooltip-exit">').concat(mS("Exit picture in picture mode"),"</slot>\n  ")},mU.customElements.get("media-pip-button")||mU.customElements.define("media-pip-button",gc);var gm=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)};let gf={RATES:"rates"},gp=[1,1.2,1.5,1.7,2];function gg(e){return Math.round(100*e)/100}class gv extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PLAYBACK_RATE,gf.RATES]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===gf.RATES&&(gm(this,bh).value=i),e===mr.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=gg(Number.isNaN(e)?1:e);this.container.innerHTML="".concat(t,"x"),this.setAttribute("aria-label",mS("Playback rate {playbackRate}",{playbackRate:t}))}}get rates(){return gm(this,bh)}set rates(e){e?Array.isArray(e)?gm(this,bh).value=e.join(" "):"str
3ing"==typeof e&&(gm(this,bh).value=e):gm(this,bh).value=""}get mediaPlaybackRate(){return m2(this,mr.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){m3(this,mr.MEDIA_PLAYBACK_RATE,e)}handleClick(){var e,t;let i=Array.from(gm(this,bh).values(),e=>+e).sort((e,t)=>e-t),r=null!=(t=null!=(e=i.find(e=>e>this.mediaPlaybackRate))?e:i[0])?t:1,n=new mU.CustomEvent(c7.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:r});this.dispatchEvent(n)}constructor(){var e;super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bh,new fp(this,gf.RATES,{defaultValue:gp})),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML="".concat(gg(null!=(e=this.mediaPlaybackRate)?e:1),"x")}}bh=new WeakMap,gv.getSlotTemplateHTML=function(e){let t=e.mediaplaybackrate?gg(+e.mediaplaybackrate):1;return'\n    <style>\n      :host {\n        min-width: 5ch;\n        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));\n      }\n    </style>\n    <slot name="icon">'.concat(t,"x</slot>\n  ")},gv.getTooltipContentHTML=function(){return mS("Playback rate")},mU.customElements.get("media-playback-rate-button")||mU.customElements.define("media-playback-rate-button",gv);let gE=e=>{let t=e.mediaPaused?mS("play"):mS("pause");e.setAttribute("aria-label",t)};class gy extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PAUSED,mr.MEDIA_ENDED]}connectedCallback(){super.connectedCallback(),gE(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),(e===mr.MEDIA_PAUSED||e===mr.MEDIA_LANG)&&gE(this)}get mediaPaused(){return m4(this,mr.MEDIA_PAUSED)}set mediaPaused(e){m5(this,mr.MEDIA_PAUSED,e)}handleClick(){let e=this.mediaPaused?c7.MEDIA_PLAY_REQUEST:c7.MEDIA_PAUSE_REQUEST;this.dispatchEvent(new mU.CustomEvent(e,{composed:!0,bubbles:!0}))}}gy.getSlotTemplateHTML=function(e){return"\n    <style>\n      :host([".concat(mr.MEDIA_PAUSED,"]) slot[name=pause],\n      :host(:not([").concat(mr.MEDIA_PAUSED,"])) slot[name=play] {\n        display: none !important;\n      }\n\n      :host([").concat(mr.MEDIA_PAUSED,"]) slot[name=tooltip-pause],\n      :host(:not([").concat(mr.MEDIA_PAUSED,'])) slot[name=tooltip-play] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="play">').concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <path d="m6 21 15-9L6 3v18Z"/>\n</svg>','</slot>\n      <slot name="pause">').concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <path d="M6 20h4V4H6v16Zm8-16v16h4V4h-4Z"/>\n</svg>',"</slot>\n    </slot>\n  ")},gy.getTooltipContentHTML=function(){return'\n    <slot name="tooltip-play">'.concat(mS("Play"),'</slot>\n    <slot name="tooltip-pause">').concat(mS("Pause"),"</slot>\n  ")},mU.customElements.get("media-play-button")||mU.customElements.define("media-play-button",gy);let gb={PLACEHOLDER_SRC:"placeholdersrc",SRC:"src"};class gT extends mU.HTMLElement{static get observedAttributes(){return[gb.PLACEHOLDER_SRC,gb.SRC]}attributeChangedCallback(e,t,i){if(e===gb.SRC&&(null==i?this.image.removeAttribute(gb.SRC):this.image.setAttribute(gb.SRC,i)),e===gb.PLACEHOLDER_SRC)if(null==i)this.image.style.removeProperty("background-image");else{var r;r=this.image,r.style["background-image"]="url('".concat(i,"')")}}get placeholderSrc(){return m8(this,gb.PLACEHOLDER_SRC)}set placeholderSrc(e){m6(this,gb.SRC,e)}get src(){return m8(this,gb.SRC)}set src(e){m6(this,gb.SRC,e)}constructor(){if(super(),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.image=this.shadowRoot.querySelector("#image")}}gT.shadowRootOptions={mode:"open"},gT.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        pointer-events: none;\n        display: var(--media-poster-image-display, inline-block);\n        box-sizing: border-box;\n      }\n\n      img {\n        max-width: 100%;\n        max-height: 100%;\n        min-width: 100%;\n        min-height: 100%;\n        background-repeat: no-repeat;\n        background-position: var(--media-poster-image-background-position, var(--media-object-position, center));\n        background-size: var(--media-poster-image-background-size, var(--media-object-fit, contain));\n        object-fit: var(--media-object-fit, contain);\n        object-position: var(--media-object-position, center);\n      }\n    </style>\n\n    <img part="poster img" aria-hidden="true" id="image"/>\n  '},mU.customElements.get("media-poster-image")||mU.customElements.define("media-poster-image",gT);var g_=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)};bc=new WeakMap,mU.customElements.get("media-preview-chapter-display")||mU.customElements.define("media-preview-chapter-display",class extends pK{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PREVIEW_CHAPTER,mr.MEDIA_LA
3NG]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),(e===mr.MEDIA_PREVIEW_CHAPTER||e===mr.MEDIA_LANG)&&i!==t&&null!=i){var r;if((g_(this,bc,"read from private field"),r?r.call(this):bc.get(this)).textContent=i,""!==i){let e=mS("chapter: {chapterName}",{chapterName:i});this.setAttribute("aria-valuetext",e)}else this.removeAttribute("aria-valuetext")}}get mediaPreviewChapter(){return m8(this,mr.MEDIA_PREVIEW_CHAPTER)}set mediaPreviewChapter(e){m6(this,mr.MEDIA_PREVIEW_CHAPTER,e)}constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bc,void 0),((e,t,i,r)=>(g_(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,bc,this.shadowRoot.querySelector("slot"))}});var gA=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gS=(e,t,i)=>(gA(e,t,"read from private field"),i?i.call(e):t.get(e)),gR=(e,t,i,r)=>(gA(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class gk extends mU.HTMLElement{static get observedAttributes(){return[me.MEDIA_CONTROLLER,mr.MEDIA_PREVIEW_IMAGE,mr.MEDIA_PREVIEW_COORDS]}connectedCallback(){var e,t,i;let r=this.getAttribute(me.MEDIA_CONTROLLER);r&&(gR(this,bm,null==(e=this.getRootNode())?void 0:e.getElementById(r)),null==(i=null==(t=gS(this,bm))?void 0:t.associateElement)||i.call(t,this))}disconnectedCallback(){var e,t;null==(t=null==(e=gS(this,bm))?void 0:e.unassociateElement)||t.call(e,this),gR(this,bm,null)}attributeChangedCallback(e,t,i){var r,n,a,s,o;[mr.MEDIA_PREVIEW_IMAGE,mr.MEDIA_PREVIEW_COORDS].includes(e)&&this.update(),e===me.MEDIA_CONTROLLER&&(t&&(null==(n=null==(r=gS(this,bm))?void 0:r.unassociateElement)||n.call(r,this),gR(this,bm,null)),i&&this.isConnected&&(gR(this,bm,null==(a=this.getRootNode())?void 0:a.getElementById(i)),null==(o=null==(s=gS(this,bm))?void 0:s.associateElement)||o.call(s,this)))}get mediaPreviewImage(){return m8(this,mr.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){m6(this,mr.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewCoords(){let e=this.getAttribute(mr.MEDIA_PREVIEW_COORDS);if(e)return e.split(/\s+/).map(e=>+e)}set mediaPreviewCoords(e){if(!e)return void this.removeAttribute(mr.MEDIA_PREVIEW_COORDS);this.setAttribute(mr.MEDIA_PREVIEW_COORDS,e.join(" "))}update(){let e,t,i=this.mediaPreviewCoords,r=this.mediaPreviewImage;if(!(i&&r))return;let[n,a,s,o]=i,l=r.split("#")[0],d=getComputedStyle(this),{maxWidth:u,maxHeight:h,minWidth:c,minHeight:m}=d;if("fill"===(d.getPropertyValue("--media-preview-thumbnail-object-fit").trim()||"contain")){let i=parseInt(u)/s,r=parseInt(h)/o,n=parseInt(c)/s,a=parseInt(m)/o;e=i<1?i:Math.max(i,n),t=r<1?r:Math.max(r,a)}else{let i=Math.min(parseInt(u)/s,parseInt(h)/o),r=Math.max(parseInt(c)/s,parseInt(m)/o),n=i<1?i:r>1?r:1;e=n,t=n}let{style:f}=m0(this.shadowRoot,":host"),p=m0(this.shadowRoot,"img").style,g=this.shadowRoot.querySelector("img"),v=1>Math.min(e,t)?"min":"max";f.setProperty("".concat(v,"-width"),"initial","important"),f.setProperty("".concat(v,"-height"),"initial","important"),f.width="".concat(s*e,"px"),f.height="".concat(o*t,"px");let E=()=>{p.width="".concat(this.imgWidth*e,"px"),p.height="".concat(this.imgHeight*t,"px"),p.display="block"};g.src!==l&&(g.onload=()=>{this.imgWidth=g.naturalWidth,this.imgHeight=g.naturalHeight,E(),g.onload=null},g.src=l,E()),E(),p.transform="translate(-".concat(n*e,"px, -").concat(a*t,"px)")}constructor(){if(super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bm,void 0),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}bm=new WeakMap,gk.shadowRootOptions={mode:"open"},gk.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        box-sizing: border-box;\n        display: var(--media-control-display, var(--media-preview-thumbnail-display, inline-block));\n        overflow: hidden;\n      }\n\n      img {\n        display: none;\n        position: relative;\n      }\n    </style>\n    <img crossorigin loading="eager" decoding="async">\n  '}
3,mU.customElements.get("media-preview-thumbnail")||mU.customElements.define("media-preview-thumbnail",gk);var gI=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gL=(e,t,i)=>(gI(e,t,"read from private field"),i?i.call(e):t.get(e));bf=new WeakMap,mU.customElements.get("media-preview-time-display")||mU.customElements.define("media-preview-time-display",class extends pK{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PREVIEW_TIME]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_PREVIEW_TIME&&null!=i&&(gL(this,bf).textContent=mI(parseFloat(i)))}get mediaPreviewTime(){return m2(this,mr.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){m3(this,mr.MEDIA_PREVIEW_TIME,e)}constructor(){super(),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,bf,void 0),((e,t,i,r)=>(gI(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,bf,this.shadowRoot.querySelector("slot")),gL(this,bf).textContent=mI(0)}});let gD={SEEK_OFFSET:"seekoffset"};class gw extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_CURRENT_TIME,gD.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=m2(this,gD.SEEK_OFFSET,30)}attributeChangedCallback(e,t,i){var r;super.attributeChangedCallback(e,t,i),r=this.seekOffset,this.setAttribute("aria-label",mS("seek back {seekOffset} seconds",{seekOffset:r})),e===gD.SEEK_OFFSET&&(this.seekOffset=m2(this,gD.SEEK_OFFSET,30))}get seekOffset(){return m2(this,gD.SEEK_OFFSET,30)}set seekOffset(e){m3(this,gD.SEEK_OFFSET,e),this.setAttribute("aria-label",mS("seek back {seekOffset} seconds",{seekOffset:this.seekOffset})),mj(mz(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return m2(this,mr.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){m3(this,mr.MEDIA_CURRENT_TIME,e)}handleClick(){let e=Math.max(this.mediaCurrentTime-this.seekOffset,0),t=new mU.CustomEvent(c7.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}gw.getSlotTemplateHTML=function(e,t){let i;return'\n    <slot name="icon">'.concat((i=t.seekOffset,'\n  <svg aria-hidden="true" viewBox="0 0 20 24">\n    <defs>\n      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>\n    </defs>\n    <text class="text value" transform="translate(2.18 19.87)">'.concat(i,'</text>\n    <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"/>\n  </svg>')),"</slot>\n  ")},gw.getTooltipContentHTML=function(){return mS("Seek backward")},mU.customElements.get("media-seek-backward-button")||mU.customElements.define("media-seek-backward-button",gw);let gC={SEEK_OFFSET:"seekoffset"};class gM extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_CURRENT_TIME,gC.SEEK_OFFSET]}connectedCallback(){super.connectedCallback(),this.seekOffset=m2(this,gC.SEEK_OFFSET,30)}attributeChangedCallback(e,t,i){var r;super.attributeChangedCallback(e,t,i),r=this.seekOffset,this.setAttribute("aria-label",mS("seek forward {seekOffset} seconds",{seekOffset:r})),e===gC.SEEK_OFFSET&&(this.seekOffset=m2(this,gC.SEEK_OFFSET,30))}get seekOffset(){return m2(this,gC.SEEK_OFFSET,30)}set seekOffset(e){m3(this,gC.SEEK_OFFSET,e),this.setAttribute("aria-label",mS("seek forward {seekOffset} seconds",{seekOffset:this.seekOffset})),mj(mz(this,"icon"),this.seekOffset)}get mediaCurrentTime(){return m2(this,mr.MEDIA_CURRENT_TIME,0)}set mediaCurrentTime(e){m3(this,mr.MEDIA_CURRENT_TIME,e)}handleClick(){let e=this.mediaCurrentTime+this.seekOffset,t=new mU.CustomEvent(c7.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}}gM.getSlotTemplateHTML=function(e,t){let i;return'\n    <slot name="icon">'.concat((i=t.seekOffset,'\n  <svg aria-hidden="true" viewBox="0 0 20 24">\n    <defs>\n      <style>.text{font-size:8px;font-family:Arial-BoldMT, Arial;font-weight:700;}</style>\n    </defs>\n    <text class="text value" transform="translate(8.9 19.87)">'.concat(i,'</text>\n    <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"/>\n  </svg>')),"</slot>\n  ")},gM.getTooltipContentHTML=function(){return mS("Seek forward")},mU.customElements.get("media-seek-forward-button")||mU.customElements.define("media-seek-forward-button",gM);var gP=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gO=(e,t,i)=>(gP(e,t,"read from private field"),i?i.call(e):t.get(e)),gx=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gN=(e,t,i,r)=>(gP(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gU=(e,t,i)=>(gP(e,t,"access private method"),i);let gF={REMAINING:"remaining",SHOW_DURATION:"showduration",NO_TOGGLE:"notoggle"},gB=[...Object.values(gF),mr.MEDIA_CURRENT_TIME,mr.MEDIA_DURATION,mr.MEDIA_SEEKABLE],gG=["Enter"," "],gH=function(e){var t,i;let{timesSep:r="&nbsp;/&nbsp;"}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null!=(t=e.mediaCurrentTime)?t:0,[,a]=null!=(i=e.mediaSeekable)?i:[],s=0;Number.isFinite(e.mediaDuration)?s=e.mediaDuration:Number.isFinite(a)&&(s=a);let o=e.remaining?mI(0-(s-n)):mI(n);return e.showDuration?"".concat(o).concat(r).concat(mI(s)):o};class gK extends pK{static get observedAttributes(){return[...super.observedAttributes,...gB,"disabled"]}connectedCallback(){let{style:e}=m0(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.setAttribute("aria-label",mS("playback time")),gU(this,b_,bA).call(this),super.connectedCallback()}toggleTimeDisplay(){this.noToggle||(this.hasAttribute("remaining")?this.removeAttribute("remaining"):this.setAttribute("remaining",""))}disconnectedCallback(){this.disable(),gU(this,bb,bT).call(this),super.disconnectedCallback()}attributeChangedCallback(e,t,i){this.setAttribute("aria-label",mS("playback time")),gB.includes(e)?this.update():"disabled"===e&&i!==t?null==i?gU(this,b_,bA).call(this):gU(this,bS,bR).call(this):e===gF.NO_TOGGLE&&i!==t&&(this.noToggle?gU(this,bS,bR).call(this):gU(this,b_,bA).call(this)),super.attributeChangedCallback(e,t,i)}enable(){this.noToggle||(this.tabIndex=0)}disable(){this.tabIndex=-1}get remaining(){return m4(this,gF.REMAINING)}set remaining(e){m5(this,gF.REMAINING,e)}get showDuration(){return m4(this,gF.SHOW_DURATION)}set showDuration(e){m5(this,gF.SHOW_DURATION,e)}get noToggle(){return m4(this,gF.NO_TOGGLE)}set noToggle(e){m5(this,gF.NO_TOGGLE,e)}get mediaDuration(){return m2(this,mr.MEDIA_DURATION)}set mediaDuration(e){m3(this,mr.MEDIA_DURATION,e)}get mediaCurrentTime(){return m2(this,mr.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){m3(this,mr.MEDIA_CURRENT_TIME,e)}get mediaSeekable(){let e=this.getAttribute(mr.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){if(null==e)return void this.removeAttribute(mr.MEDIA_SEEKABLE);this.setAttribute(mr.MEDIA_SEEKABLE,e.join(":"))}update(){let e=gH(this);(e=>{var t;let i=e.mediaCurrentTime,[,r]=null!=(t=e.mediaSeekable)?t:[],n=null;if(Number.isFinite(e.mediaDuration)?n=e.mediaDuration:Number.isFinite(r)&&(n=r),null==i||null===n)return e.setAttribute("aria-description",mS("video not loaded, unknown time."));let a=e.remaining?mk(0-(n-i)):mk(i);if(!e.showDuration)return e.setAttribute("aria-description",a);let s=mS("{currentTime} of {totalTime}",{currentTime:a,totalTime:mk(n)});e.setAttribute("aria-description",s)})(this),e!==gO(this,bp).innerHTML&&(gO(this,bp).innerHTML=e)}constructor(){super(),gx(this,bE),gx(this,bb),gx(this,b_),gx(this,bS),gx(this,bp,void 0),gx(this,bg,null),gx(this,bv,e=>{let{metaKey:t,altKey:i,key:r}=e;if(t||i||!gG.includes(r))return void this.removeEventListener("keyup",gO(this,bg));this.addEventListener("keyup",gO(this,bg))}),gN(this,bp,this.shadowRoot.querySelector("slot")),gO(this,bp).innerHTML="".concat(gH(this))}}bp=new WeakMap,bg=new WeakMap,bv=new WeakMap,bE=new WeakSet,by=function(){gO(this,bg)||(gN(this,bg,e=>{let{key:t}=e;if(!gG.includes(t))return void this.removeEventListener("keyup",gO(this,bg));this.toggleTimeDisplay()}),this.addEventListener("keydown",gO(this,bv)),this.addEventListener("click",this.toggleTimeDisplay))},bb=new WeakSet,bT=function(){gO(this,bg)&&(this.removeEventListener("keyup",gO(this,bg)),this.removeEventListener("keydown",gO(this,bv)),this.removeEventListener("click",this.toggleTimeDisplay),gN(this,bg,null))},b_=new WeakSet,bA=function(){this.noToggle||this.hasAttribute("disabled")||(this.setAttribute("role","button"),this.enable(),gU(this,bE,by).call(this))},bS=new WeakSet,bR=function(){this.removeAttribute("role"),this.disable(),gU(this,bb,bT).call(this)},gK.getSlotTemplateHTML=function(e,t){return"\n    <slot>".concat(gH(t),"</slot>\n  ")},mU.customElements.get("media-time-display")||mU.customElements.define("media-time-display",gK);var gW=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gV=(e,t,i)=>(gW(e,t,"read from private field"),i?i.call(e):t.get(e)),gq=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gY=(e,t,i,r)=>(gW(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);class gj{start(){0===gV(this,bO)&&(gY(this,bL,performance.now()),gY(this,bI,gV(this,bL)),gY(this,bw,0),gV(this,bx).call(this))}stop(){0!==gV(this,bO)&&(cancelAnimationFrame(gV(this,bO)),gY(this,bO,0))}update(e){let{start:t,duration:i,playbackRate:r}=e,n=t-gV(this,bk).valueAsNumber,a=Math.abs(i-this.duration);(n>0||n<-.03||a>=.5)&&this.callback(t),gY(this,bM,t),gY(this,bC,performance.now()),this.duration=i,this.playbackRate=r}constructor(e,t,i){var r=this;gq(this,bk,void 0),gq(this,bI,void 0),gq(this,bL,void 0),gq(this,bD,void 0),gq(this,bw,void 0),gq(this,bC,void 0),gq(this,bM,void 0),gq(this,bP,void 0),gq(this,bO,0),gq(this,bx,function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:performance.now();gY(r,bO,requestAnimationFrame(gV(r,bx))),gY(r,bD,performance.now()-gV(r,bL));let t=1e3/r.fps;if(gV(r,bD)>t){let i,n,a;gY(r,bL,e-gV(r,bD)%t);let s=1e3/((e-gV(r,bI))/++(i=bw,{set _(value){gY(r,i,value,n)},get _(){return gV(r,i,a)}})._),o=(e-gV(r,bC))/1e3/r.duration,l=gV(r,bM)+o*r.playbackRate;l-gV(r,bk).valueAsNumber>0?gY(r,bP,r.playbackRate/r.duration/s):(gY(r,bP,.995*gV(r,bP)),l=gV(r,bk).valueAsNumber+gV(r,bP)),r.callback(l)}}),gY(this,bk,e),this.callback=t,this.fps=i}}bk=new WeakMap,bI=new WeakMap,bL=new WeakMap,bD=new WeakMap,bw=new WeakMap,bC=new WeakMap,bM=new WeakMap,bP=new WeakMap,bO=new WeakMap,bx=new WeakMap;var gz=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},gQ=(e,t,i)=>(gz(e,t,"read from private field"),i?i.call(e):t.get(e)),gX=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},gZ=(e,t,i,r)=>(gz(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),gJ=(e,t,i)=>(gz(e,t,"access private method"),i);let g$=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.mediaCurrentTime,i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:Math.max(0,Math.min((t-i)/(r-i),1))},g0=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.range.valueAsNumber,i=Number.isFinite(e.mediaSeekableStart)?e.mediaSeekableStart:0,r=Number.isFinite(e.mediaDuration)?e.mediaDuration:e.mediaSeekableEnd;return Number.isNaN(r)?0:t*(r-i)+i};class g1 extends pO{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PAUSED,mr.MEDIA_DURATION,mr.MEDIA_SEEKABLE,mr.MEDIA_CURRENT_TIME,mr.MEDIA_PREVIEW_IMAGE,mr.MEDIA_PREVIEW_TIME,mr.MEDIA_PREVIEW_CHAPTER,mr.MEDIA_BUFFERED,mr.MEDIA_PLAYBACK_RATE,mr.MEDIA_LOADING,mr.MEDIA_ENDED]}connectedCallback(){var e;super.connectedCallback(),this.range.setAttribute("aria-label",mS("seek")),gQ(this,bY).call(this),gZ(this,bN,this.getRootNode()),null==(e=gQ(this,bN))||e.addEventListener("transitionstart",this)}disconnectedCallback(){var e;super.disconnectedCallback(),gQ(this,bU).stop(),null==(e=gQ(this,bN))||e.removeEventListener("transitionstart",this),gZ(this,bN,null)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),t!=i&&(e===mr.MEDIA_CURRENT_TIME||e===mr.MEDIA_PAUSED||e===mr.MEDIA_ENDED||e===mr.MEDIA_LOADING||e===mr.MEDIA_DURATION||e===mr.MEDIA_SEEKABLE?(gQ(this,bU).update({start:g$(this),duration:this.mediaSeekableEnd-this.mediaSeekableStart,playbackRate:this.mediaPlaybackRate}),gQ(this,bY).call(this),(e=>{let t=e.range,i=mk(+g0(e)),r=mk(+e.mediaSeekableEnd),n=i&&r?mS("{currentTime} of {totalTime}",{currentTime:i,totalTime:r}):mS("video not loaded, unknown time.");t.setAttribute("aria-valuetext",n)})(this)):e===mr.MEDIA_BUFFERED&&this.updateBufferedBar(),(e===mr.MEDIA_DURATION||e===mr.MEDIA_SEEKABLE)&&(this.mediaChapter
3sCues=gQ(this,bV),this.updateBar()))}get mediaChaptersCues(){return gQ(this,bV)}set mediaChaptersCues(e){var t;gZ(this,bV,e),this.updateSegments(null==(t=gQ(this,bV))?void 0:t.map(e=>({start:g$(this,e.startTime),end:g$(this,e.endTime)})))}get mediaPaused(){return m4(this,mr.MEDIA_PAUSED)}set mediaPaused(e){m5(this,mr.MEDIA_PAUSED,e)}get mediaLoading(){return m4(this,mr.MEDIA_LOADING)}set mediaLoading(e){m5(this,mr.MEDIA_LOADING,e)}get mediaDuration(){return m2(this,mr.MEDIA_DURATION)}set mediaDuration(e){m3(this,mr.MEDIA_DURATION,e)}get mediaCurrentTime(){return m2(this,mr.MEDIA_CURRENT_TIME)}set mediaCurrentTime(e){m3(this,mr.MEDIA_CURRENT_TIME,e)}get mediaPlaybackRate(){return m2(this,mr.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){m3(this,mr.MEDIA_PLAYBACK_RATE,e)}get mediaBuffered(){let e=this.getAttribute(mr.MEDIA_BUFFERED);return e?e.split(" ").map(e=>e.split(":").map(e=>+e)):[]}set mediaBuffered(e){if(!e)return void this.removeAttribute(mr.MEDIA_BUFFERED);let t=e.map(e=>e.join(":")).join(" ");this.setAttribute(mr.MEDIA_BUFFERED,t)}get mediaSeekable(){let e=this.getAttribute(mr.MEDIA_SEEKABLE);if(e)return e.split(":").map(e=>+e)}set mediaSeekable(e){if(null==e)return void this.removeAttribute(mr.MEDIA_SEEKABLE);this.setAttribute(mr.MEDIA_SEEKABLE,e.join(":"))}get mediaSeekableEnd(){var e;let[,t=this.mediaDuration]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaSeekableStart(){var e;let[t=0]=null!=(e=this.mediaSeekable)?e:[];return t}get mediaPreviewImage(){return m8(this,mr.MEDIA_PREVIEW_IMAGE)}set mediaPreviewImage(e){m6(this,mr.MEDIA_PREVIEW_IMAGE,e)}get mediaPreviewTime(){return m2(this,mr.MEDIA_PREVIEW_TIME)}set mediaPreviewTime(e){m3(this,mr.MEDIA_PREVIEW_TIME,e)}get mediaEnded(){return m4(this,mr.MEDIA_ENDED)}set mediaEnded(e){m5(this,mr.MEDIA_ENDED,e)}updateBar(){super.updateBar(),this.updateBufferedBar(),this.updateCurrentBox()}updateBufferedBar(){var e;let t,i=this.mediaBuffered;if(!i.length)return;if(this.mediaEnded)t=1;else{let r=this.mediaCurrentTime,[,n=this.mediaSeekableStart]=null!=(e=i.find(e=>{let[t,i]=e;return t<=r&&r<=i}))?e:[];t=g$(this,n)}let{style:r}=m0(this.shadowRoot,"#buffered");r.setProperty("width","".concat(100*t,"%"))}updateCurrentBox(){if(!this.shadowRoot.querySelector('slot[name="current"]').assignedElements().length)return;let e=m0(this.shadowRoot,"#current-rail"),t=m0(this.shadowRoot,'[part~="current-box"]'),i=gJ(this,bX,bZ).call(this,gQ(this,bH)),r=gJ(this,bJ,b$).call(this,i,this.range.valueAsNumber),n=gJ(this,b0,b1).call(this,i,this.range.valueAsNumber);e.style.transform="translateX(".concat(r,")"),e.style.setProperty("--_range-width","".concat(i.range.width)),t.style.setProperty("--_box-shift","".concat(n)),t.style.setProperty("--_box-width","".concat(i.box.width,"px")),t.style.setProperty("visibility","initial")}handleEvent(e){switch(super.handleEvent(e),e.type){case"input":gJ(this,b8,b6).call(this);break;case"pointermove":gJ(this,b2,b3).call(this,e);break;case"pointerup":gQ(this,bq)&&gZ(this,bq,!1);break;case"pointerdown":gZ(this,bq,!0);break;case"pointerleave":gJ(this,b4,b5).call(this,null);break;case"transitionstart":mQ(e.target,this)&&setTimeout(()=>gQ(this,bY).call(this),0)}}constructor(){super(),gX(this,bj),gX(this,bX),gX(this,bJ),gX(this,b0),gX(this,b2),gX(this,b4),gX(this,b8),gX(this,bN,null),gX(this,bU,void 0),gX(this,bF,void 0),gX(this,bB,void 0),gX(this,bG,void 0),gX(this,bH,void 0),gX(this,bK,void 0),gX(this,bW,void 0),gX(this,bV,void 0),gX(this,bq,void 0),gX(this,bY,()=>{gJ(this,bj,bz).call(this)?gQ(this,bU).start():gQ(this,bU).stop()}),gX(this,bQ,e=>{!this.dragging&&(my(e)&&(this.range.valueAsNumber=e),gQ(this,bq)||this.updateBar())}),this.shadowRoot.querySelector("#track").insertAdjacentHTML("afterbegin",'<div id="buffered" part="buffered"></div>'),gZ(this,bF,this.shadowRoot.querySelectorAll('[part~="box"]')),gZ(this,bG,this.shadowRoot.querySelector('[part~="preview-box"]')),gZ(this,bH,this.shadowRoot.querySelector('[part~="current-box"]'));let e=getComputedStyle(this);gZ(this,bK,parseInt(e.getPropertyValue("--media-box-padding-left"))),gZ(this,bW,parseInt(e.getPropertyValue("--media-box-padding-right"))),gZ(this,bU,new gj(this.range,gQ(this,bQ),60))}}bN=new WeakMap,bU=new WeakMap,bF=new WeakMap,bB=new WeakMap,bG=new WeakMap,bH=new WeakMap,bK=new WeakMap,bW=new WeakMap,bV=new WeakMap,bq=new WeakMap,bY=new WeakMap,bj=new WeakSet,bz=function(){return this.isConnected&&!this.mediaPaused&&!this.mediaLoading&&!this.mediaEnded&&this.mediaSeekableEnd>0&&m$(this)},bQ=new WeakMap,bX=new WeakSet,bZ=function(e){var t;let i=(null!=(t=this.getAttribute("bounds")?mX(this,"#".concat(this.getAttribute("bounds"))):this.parentElement)?t:this).getBoundingClientRect(),r=this.range.getBoundingClientRect(),n=e.offsetWidth,a=-(r.left-i.left-n/2),s=i.right-r.left-n/2;return{box:{width:n,min:a,max:s},bounds:i,range:r}}
3,bJ=new WeakSet,b$=function(e,t){let i="".concat(100*t,"%"),{width:r,min:n,max:a}=e.box;if(!r)return i;if(!Number.isNaN(n)){let e="calc(1 / var(--_range-width) * 100 * ".concat(n,"% + ").concat("var(--media-box-padding-left)",")");i="max(".concat(e,", ").concat(i,")")}if(!Number.isNaN(a)){let e="calc(1 / var(--_range-width) * 100 * ".concat(a,"% - ").concat("var(--media-box-padding-right)",")");i="min(".concat(i,", ").concat(e,")")}return i},b0=new WeakSet,b1=function(e,t){let{width:i,min:r,max:n}=e.box,a=t*e.range.width;if(a<r+gQ(this,bK)){let t=e.range.left-e.bounds.left-gQ(this,bK);return"".concat(a-i/2+t,"px")}if(a>n-gQ(this,bW)){let t=e.bounds.right-e.range.right-gQ(this,bW);return"".concat(a+i/2-t-e.range.width,"px")}return 0},b2=new WeakSet,b3=function(e){let t=[...gQ(this,bF)].some(t=>e.composedPath().includes(t));if(!this.dragging&&(t||!e.composedPath().includes(this)))return void gJ(this,b4,b5).call(this,null);let i=this.mediaSeekableEnd;if(!i)return;let r=m0(this.shadowRoot,"#preview-rail"),n=m0(this.shadowRoot,'[part~="preview-box"]'),a=gJ(this,bX,bZ).call(this,gQ(this,bG)),s=(e.clientX-a.range.left)/a.range.width;s=Math.max(0,Math.min(1,s));let o=gJ(this,bJ,b$).call(this,a,s),l=gJ(this,b0,b1).call(this,a,s);r.style.transform="translateX(".concat(o,")"),r.style.setProperty("--_range-width","".concat(a.range.width)),n.style.setProperty("--_box-shift","".concat(l)),n.style.setProperty("--_box-width","".concat(a.box.width,"px")),1>Math.abs(Math.round(gQ(this,bB))-Math.round(s*i))&&s>.01&&s<.99||(gZ(this,bB,s*i),gJ(this,b4,b5).call(this,gQ(this,bB)))},b4=new WeakSet,b5=function(e){this.dispatchEvent(new mU.CustomEvent(c7.MEDIA_PREVIEW_REQUEST,{composed:!0,bubbles:!0,detail:e}))},b8=new WeakSet,b6=function(){gQ(this,bU).stop();let e=g0(this);this.dispatchEvent(new mU.CustomEvent(c7.MEDIA_SEEK_REQUEST,{composed:!0,bubbles:!0,detail:e}))},g1.shadowRootOptions={mode:"open"},g1.getContainerTemplateHTML=function(e){return'\n    <style>\n      :host {\n        --media-box-border-radius: 4px;\n        --media-box-padding-left: 10px;\n        --media-box-padding-right: 10px;\n        --media-preview-border-radius: var(--media-box-border-radius);\n        --media-box-arrow-offset: var(--media-box-border-radius);\n        --_control-background: var(--media-control-background, var(--media-secondary-color, rgb(20 20 30 / .7)));\n        --_preview-background: var(--media-preview-background, var(--_control-background));\n\n        \n        contain: layout;\n      }\n\n      #buffered {\n        background: var(--media-time-range-buffered-color, rgb(255 255 255 / .4));\n        position: absolute;\n        height: 100%;\n        will-change: width;\n      }\n\n      #preview-rail,\n      #current-rail {\n        width: 100%;\n        position: absolute;\n        left: 0;\n        bottom: 100%;\n        pointer-events: none;\n        will-change: transform;\n      }\n\n      [part~="box"] {\n        width: min-content;\n        \n        position: absolute;\n        bottom: 100%;\n        flex-direction: column;\n        align-items: center;\n        transform: translateX(-50%);\n      }\n\n      [part~="current-box"] {\n        display: var(--media-current-box-display, var(--media-box-display, flex));\n        margin: var(--media-current-box-margin, var(--media-box-margin, 0 0 5px));\n        visibility: hidden;\n      }\n\n      [part~="preview-box"] {\n        display: var(--media-preview-box-display, var(--media-box-display, flex));\n        margin: var(--media-preview-box-margin, var(--media-box-margin, 0 0 5px));\n        transition-property: var(--media-preview-transition-property, visibility, opacity);\n        transition-duration: var(--media-preview-transition-duration-out, .25s);\n        transition-delay: var(--media-preview-transition-delay-out, 0s);\n        visibility: hidden;\n        opacity: 0;\n      }\n\n      :host(:is(['.concat(mr.MEDIA_PREVIEW_IMAGE,"], [").concat(mr.MEDIA_PREVIEW_TIME,'])[dragging]) [part~="preview-box"] {\n        transition-duration: var(--media-preview-transition-duration-in, .5s);\n        transition-delay: var(--media-preview-transition-delay-in, .25s);\n        visibility: visible;\n        opacity: 1;\n      }\n\n      @media (hover: hover) {\n        :host(:is([').concat(mr.MEDIA_PREVIEW_IMAGE,"], [").concat(mr.MEDIA_PREVIEW_TIME,']):hover) [part~="preview-box"] {\n          transition-duration: var(--media-preview-transition-duration-in, .5s);\n          transition-delay: var(--media-preview-transition-delay-in, .25s);\n          visibility: visible;\n          opacity: 1;\n        }\n      }
3\n\n      media-preview-thumbnail,\n      ::slotted(media-preview-thumbnail) {\n        visibility: hidden;\n        ',"\n        transition: visibility 0s .25s;\n        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));\n        background: var(--media-preview-thumbnail-background, var(--_preview-background));\n        box-shadow: var(--media-preview-thumbnail-box-shadow, 0 0 4px rgb(0 0 0 / .2));\n        max-width: var(--media-preview-thumbnail-max-width, 180px);\n        max-height: var(--media-preview-thumbnail-max-height, 160px);\n        min-width: var(--media-preview-thumbnail-min-width, 120px);\n        min-height: var(--media-preview-thumbnail-min-height, 80px);\n        border: var(--media-preview-thumbnail-border);\n        border-radius: var(--media-preview-thumbnail-border-radius,\n          var(--media-preview-border-radius) var(--media-preview-border-radius) 0 0);\n      }\n\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"][dragging]) media-preview-thumbnail,\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"][dragging]) ::slotted(media-preview-thumbnail) {\n        transition-delay: var(--media-preview-transition-delay-in, .25s);\n        visibility: visible;\n      }\n\n      @media (hover: hover) {\n        :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]:hover) media-preview-thumbnail,\n        :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]:hover) ::slotted(media-preview-thumbnail) {\n          transition-delay: var(--media-preview-transition-delay-in, .25s);\n          visibility: visible;\n        }\n\n        :host([").concat(mr.MEDIA_PREVIEW_TIME,"]:hover) {\n          --media-time-range-hover-display: block;\n        }\n      }\n\n      media-preview-chapter-display,\n      ::slotted(media-preview-chapter-display) {\n        font-size: var(--media-font-size, 13px);\n        line-height: 17px;\n        min-width: 0;\n        visibility: hidden;\n        ","\n        transition: min-width 0s, border-radius 0s, margin 0s, padding 0s, visibility 0s;\n        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));\n        background: var(--media-preview-chapter-background, var(--_preview-background));\n        border-radius: var(--media-preview-chapter-border-radius,\n          var(--media-preview-border-radius) var(--media-preview-border-radius)\n          var(--media-preview-border-radius) var(--media-preview-border-radius));\n        padding: var(--media-preview-chapter-padding, 3.5px 9px);\n        margin: var(--media-preview-chapter-margin, 0 0 5px);\n        text-shadow: var(--media-preview-chapter-text-shadow, 0 0 4px rgb(0 0 0 / .75));\n      }\n\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]) media-preview-chapter-display,\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]) ::slotted(media-preview-chapter-display) {\n        transition-delay: var(--media-preview-transition-delay-in, .25s);\n        border-radius: var(--media-preview-chapter-border-radius, 0);\n        padding: var(--media-preview-chapter-padding, 3.5px 9px 0);\n        margin: var(--media-preview-chapter-margin, 0);\n        min-width: 100%;\n      }\n\n      media-preview-chapter-display[").concat(mr.MEDIA_PREVIEW_CHAPTER,"],\n      ::slotted(media-preview-chapter-display[").concat(mr.MEDIA_PREVIEW_CHAPTER,"]) {\n        visibility: visible;\n      }\n\n      media-preview-chapter-display:not([aria-valuetext]),\n      ::slotted(media-preview-chapter-display:not([aria-valuetext])) {\n        display: none;\n      }\n\n      media-preview-time-display,\n      ::slotted(media-preview-time-display),\n      media-time-display,\n      ::slotted(media-time-display) {\n        font-size: var(--media-font-size, 13px);\n        line-height: 17px;\n        min-width: 0;\n        ","\n        transition: min-width 0s, border-radius 0s;\n        transition-delay: calc(var(--media-preview-transition-delay-out, 0s) + var(--media-preview-transition-duration-out, .25s));\n        background: var(--media-preview-time-background, var(--_preview-background));\n        border-radius: var(--media-preview-time-border-radius,\n          var(--media-preview-border-radius) var(--media-preview-border-radius)\n          var(--media-preview-border-radius) var(--media-preview-border-radius));\n        padding: var(--media-preview-time-padding, 3.5px 9px);\n        margin: var(--media-preview-time-margin, 0);\n        text-shadow: var(--media-preview-time-text-shadow, 0 0 4px rgb(0 0 0 / .75));\n        transform: translateX(min(\n          max(calc(50% - var(--_box-width) / 2),\n          calc(var(--_box-shift, 0))),\n          calc(var(--_box-width) / 2 - 50%)\n        ));\n      }\n\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]) media-preview-time-display,\n      :host([").concat(mr.MEDIA_PREVIEW_IMAGE,"]) ::slotted(media-preview-time-display) {\n        transition-delay: var(--media-preview-transition-delay-in, .25s);\n        border-radius: var(--media-preview-time-border-radius,\n          0 0 var(--media-preview-border-radius) var(--media-preview-border-radius));\n        min-width: 100%;\n      }\n\n      :host([").concat(mr.MEDIA_PREVIEW_TIME,']:hover) {\n        --media-time-range-hover-display: block;\n      }\n\n      [part~="arrow"],\n      ::slotted([part~="arrow"]) {\n        display: var(--media-box-arrow-display, inline-block);\n        transform: translateX(min(\n          max(calc(50% - var(--_box-width) / 2 + var(--media-box-arrow-offset)),\n          calc(var(--_box-shift, 0))),\n          calc(var(--_box-width) / 2 - 50% - var(--media-box-arrow-offset))\n        ));\n        ','\n        border-color: transparent;\n        border-top-color: var(--media-box-arrow-background, var(--_control-background));\n        border-width: var(--media-box-arrow-border-width,\n          var(--media-box-arrow-height, 5px) var(--media-box-arrow-width, 6px) 0);\n        border-style: solid;\n        justify-content: center;\n        height: 0;\n      }\n    </style>\n    <div id="preview-rail">\n      <slot name="preview" part="box preview-box">
3\n        <media-preview-thumbnail>\n          <template shadowrootmode="').concat(gk.shadowRootOptions.mode,'">\n            ').concat(gk.getTemplateHTML({}),'\n          </template>\n        </media-preview-thumbnail>\n        <media-preview-chapter-display></media-preview-chapter-display>\n        <media-preview-time-display></media-preview-time-display>\n        <slot name="preview-arrow"><div part="arrow"></div></slot>\n      </slot>\n    </div>\n    <div id="current-rail">\n      <slot name="current" part="box current-box">\n        ',"\n      </slot>\n    </div>\n  ")},mU.customElements.get("media-time-range")||mU.customElements.define("media-time-range",g1);var g2=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot read from private field");return i?i.call(e):t.get(e)};b9=new WeakMap,mU.customElements.get("media-volume-range")||mU.customElements.define("media-volume-range",class extends pO{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_VOLUME,mr.MEDIA_MUTED,mr.MEDIA_VOLUME_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),this.range.setAttribute("aria-label",mS("volume")),this.range.addEventListener("input",g2(this,b9))}disconnectedCallback(){this.range.removeEventListener("input",g2(this,b9)),super.disconnectedCallback()}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===mr.MEDIA_VOLUME||e===mr.MEDIA_MUTED){let e;this.range.valueAsNumber=this.mediaMuted?0:this.mediaVolume,this.range.setAttribute("aria-valuetext",(e=this.range.valueAsNumber,"".concat(Math.round(100*e),"%"))),this.updateBar()}}
3get mediaVolume(){return m2(this,mr.MEDIA_VOLUME,1)}set mediaVolume(e){m3(this,mr.MEDIA_VOLUME,e)}get mediaMuted(){return m4(this,mr.MEDIA_MUTED)}set mediaMuted(e){m5(this,mr.MEDIA_MUTED,e)}get mediaVolumeUnavailable(){return m8(this,mr.MEDIA_VOLUME_UNAVAILABLE)}set mediaVolumeUnavailable(e){m6(this,mr.MEDIA_VOLUME_UNAVAILABLE,e)}constructor(){super(...arguments),((e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)})(this,b9,()=>{let e=this.range.value,t=new mU.CustomEvent(c7.MEDIA_VOLUME_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)})}});class g3 extends pc{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_LOOP]}connectedCallback(){var e;super.connectedCallback(),this.container=(null==(e=this.shadowRoot)?void 0:e.querySelector("#icon"))||null,this.container&&(this.container.textContent=mS("Loop"))}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_LOOP&&this.container&&this.setAttribute("aria-checked",this.mediaLoop?"true":"false")}get mediaLoop(){return m4(this,mr.MEDIA_LOOP)}set mediaLoop(e){m5(this,mr.MEDIA_LOOP,e)}handleClick(){let e=!this.mediaLoop,t=new mU.CustomEvent(c7.MEDIA_LOOP_REQUEST,{composed:!0,bubbles:!0,detail:e});this.dispatchEvent(t)}constructor(){super(...arguments),this.container=null}}g3.getSlotTemplateHTML=function(e){return"\n      <style>\n        :host {\n          min-width: 4ch;\n          padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));\n          width: 100%;\n          display: grid;\n          grid-template-columns: 1fr auto;\n          gap: 1rem;\n          font-weight: var(--media-button-font-weight, normal);\n        }\n\n        #checked-indicator {\n          display: none;\n        }\n\n        :host([".concat(mr.MEDIA_LOOP,']) #checked-indicator {\n          display: block;\n        }\n      </style>\n      \n      <span id="icon">\n     </span>\n\n      <div id="checked-indicator">\n        <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">\n          <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"/>\n        </svg>\n      </div>\n    ')},g3.getTooltipContentHTML=function(){return mS("Loop")},mU.customElements.get("media-loop-button")||mU.customElements.define("media-loop-button",g3);var g4=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},g5=(e,t,i)=>(g4(e,t,"read from private field"),i?i.call(e):t.get(e)),g8=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},g6=(e,t,i,r)=>(g4(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i);let g9={processCallback(e,t,i){if(i){for(let[e,r]of t)if(e in i){let t=i[e];"boolean"==typeof t&&r instanceof vs&&"boolean"==typeof r.element[r.attributeName]?r.booleanValue=t:"function"==typeof t&&r instanceof vs?r.element[r.attributeName]=t:r.value=t}}}};class g7 extends mU.DocumentFragment{update(e){g5(this,Te).processCallback(this,g5(this,b7),e)}constructor(e,t,i=g9){var r;super(),g8(this,b7,void 0),g8(this,Te,void 0),this.append(e.content.cloneNode(!0)),g6(this,b7,ve(this)),g6(this,Te,i),null==(r=i.createCallback)||r.call(i,this,g5(this,b7),t),i.processCallback(this,g5(this,b7),t)}}b7=new WeakMap,Te=new WeakMap;let ve=function(e){let t,i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(let n of e.attributes||[])if(n.value.includes("{{")){let a=new va;for([t,i]of vi(n.value))if(t){let t=new vs(e,n.name,n.namespaceURI);a.append(t),r.push([i,t])}else a.append(i);n.value=a.toString()}for(let n of e.childNodes)if(1!==n.nodeType||n instanceof HTMLTemplateElement){let a=n.data;if(1===n.nodeType||a.includes("{{")){let s=[];if(a)for([t,i]of vi(a))if(t){let t=new vo(e);s.push(t),r.push([i,t])}else s.push(new Text(i));else if(n instanceof HTMLTemplateElement){let t=new vl(e,n);s.push(t),r.push([t.expression,t])}n.replaceWith(...s.flatMap(e=>e.replacementNodes||[e]))}}else ve(n,r);return r},vt={},vi=e=>{let t="",i=0,r=vt[e],n=0,a;if(r)return r;for(r=[];a=e[n];n++)"{"===a&&"{"===e[n+1]&&"\\"!==e[n-1]&&e[n+2]&&1==++i?(t&&r.push([0,t]),t="",n++):"}"!==a||"}"!==e[n+1]||"\\"===e[n-1]||--i?t+=a||"":(r.push([1,t.trim()]),t="",n++);return t&&r.push([0,(i>0?"{{":"")+t]),vt[e]=r};class vr{get value(){return""}set value(e){}toString(){return this.value}}let vn=new WeakMap;class va{[Symbol.iterator](){return g5(this,Tt).values()}get length(){return g5(this,Tt).length}item(e){return g5(this,Tt)[e]}append(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];for(let e of t)e instanceof vs&&vn.set(e,this),g5(this,Tt).push(e)}toString(){return g5(this,Tt).join("")}constructor(){g8(this,Tt,[])}}Tt=new WeakMap;class vs extends vr{get attributeName(){return g5(this,Tn)}get attributeNamespace(){return g5(this,Ta)}
3get element(){return g5(this,Tr)}get value(){return g5(this,Ti)}set value(e){g5(this,Ti)!==e&&(g6(this,Ti,e),g5(this,Ts,To)&&1!==g5(this,Ts,To).length?g5(this,Tr).setAttributeNS(g5(this,Ta),g5(this,Tn),g5(this,Ts,To).toString()):null==e?g5(this,Tr).removeAttributeNS(g5(this,Ta),g5(this,Tn)):g5(this,Tr).setAttributeNS(g5(this,Ta),g5(this,Tn),e))}get booleanValue(){return g5(this,Tr).hasAttributeNS(g5(this,Ta),g5(this,Tn))}set booleanValue(e){if(g5(this,Ts,To)&&1!==g5(this,Ts,To).length)throw new DOMException("Value is not fully templatized");this.value=e?"":null}constructor(e,t,i){super(),g8(this,Ts),g8(this,Ti,""),g8(this,Tr,void 0),g8(this,Tn,void 0),g8(this,Ta,void 0),g6(this,Tr,e),g6(this,Tn,t),g6(this,Ta,i)}}Ti=new WeakMap,Tr=new WeakMap,Tn=new WeakMap,Ta=new WeakMap,Ts=new WeakSet,To=function(){return vn.get(this)};class vo extends vr{get replacementNodes(){return g5(this,Td)}get parentNode(){return g5(this,Tl)}get nextSibling(){return g5(this,Td)[g5(this,Td).length-1].nextSibling}get previousSibling(){return g5(this,Td)[0].previousSibling}get value(){return g5(this,Td).map(e=>e.textContent).join("")}set value(e){this.replace(e)}replace(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];let r=t.flat().flatMap(e=>null==e?[new Text]:e.forEach?[...e]:11===e.nodeType?[...e.childNodes]:e.nodeType?[e]:[new Text(e)]);r.length||r.push(new Text),g6(this,Td,function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,n=0,a,s,o,l=i.length,d=t.length;for(;n<l&&n<d&&t[n]==i[n];)n++;for(;n<l&&n<d&&i[l-1]==t[d-1];)r=i[--d,--l];if(n==d)for(;n<l;)e.insertBefore(i[n++],r);if(n==l)for(;n<d;)e.removeChild(t[n++]);else{for(a=t[n];n<l;)o=i[n++],s=a?a.nextSibling:r,a==o?a=s:n<l&&i[n]==s?(e.replaceChild(o,a),a=s):e.insertBefore(o,a);for(;a!=r;)s=a.nextSibling,e.removeChild(a),a=s}return i}(g5(this,Td)[0].parentNode,g5(this,Td),r,this.nextSibling))}constructor(e,t){super(),g8(this,Tl,void 0),g8(this,Td,void 0),g6(this,Tl,e),g6(this,Td,t?[...t]:[new Text])}}Tl=new WeakMap,Td=new WeakMap;class vl extends vo{constructor(e,t){let i=t.getAttribute("directive")||t.getAttribute("type"),r=t.getAttribute("expression")||t.getAttribute(i)||"";r.startsWith("{{")&&(r=r.trim().slice(2,-2).trim()),super(e),this.expression=r,this.template=t,this.directive=i}}let vd={string:e=>String(e)};class vu{constructor(e){this.template=e,this.state=void 0}}let vh=new WeakMap,vc=new WeakMap,vm={partial:(e,t)=>{t[e.expression]=new vu(e.template)},if:(e,t)=>{var i;if(vv(e.expression,t))if(vh.get(e)!==e.template){vh.set(e,e.template);let i=new g7(e.template,t,vp);e.replace(i),vc.set(e,i)}else null==(i=vc.get(e))||i.update(t);else e.replace(""),vh.delete(e),vc.delete(e)}},vf=Object.keys(vm),vp={processCallback(e,t,i){var r,n;if(i)for(let[e,a]of t){if(a instanceof vl){if(!a.directive){let e=vf.find(e=>a.template.hasAttribute(e));e&&(a.directive=e,a.expression=a.template.getAttribute(e))}null==(r=vm[a.directive])||r.call(vm,a,i);continue}let t=vv(e,i);if(t instanceof vu){vh.get(a)!==t.template?(vh.set(a,t.template),a.value=t=new g7(t.template,t.state,vp),vc.set(a,t)):null==(n=vc.get(a))||n.update(t.state);continue}t?(a instanceof vs&&a.attributeName.startsWith("aria-")&&(t=String(t)),a instanceof vs?"boolean"==typeof t?a.booleanValue=t:"function"==typeof t?a.element[a.attributeName]=t:a.value=t:(a.value=t,vh.delete(a),vc.delete(a))):a instanceof vs?a.value=void 0:(a.value=void 0,vh.delete(a),vc.delete(a))}}},vg={"!":e=>!e,"!!":e=>!!e,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>
3e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"??":(e,t)=>null!=e?e:t,"|":(e,t)=>{var i;return null==(i=vd[t])?void 0:i.call(vd,e)}};function vv(e){var t,i,r,n,a,s,o;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=(function(e,t){let i,r,n,a=[];for(;e;){for(let a in n=null,i=e.length,t)(r=t[a].exec(e))&&r.index<i&&(n={token:r[0],type:a,matches:r.slice(1)},i=r.index);i&&a.push({token:e.substr(0,i),type:void 0}),n&&a.push(n),e=e.substr(i+(n?n.token.length:0))}return a})(e,{boolean:/true|false/,number:/-?\d+\.?\d*/,string:/(["'])((?:\\.|[^\\])*?)\1/,operator:/[!=><][=!]?|\?\?|\|/,ws:/\s+/,param:/[$a-z_][$\w]*/i}).filter(e=>{let{type:t}=e;return"ws"!==t});if(0===d.length||d.some(e=>{let{type:t}=e;return!t}))return vE(e);if((null==(t=d[0])?void 0:t.token)===">"){let t=l[null==(i=d[1])?void 0:i.token];if(!t)return vE(e);let s={...l};t.state=s;let o=d.slice(2);for(let e=0;e<o.length;e+=3){let t=null==(r=o[e])?void 0:r.token,i=null==(n=o[e+1])?void 0:n.token,d=null==(a=o[e+2])?void 0:a.token;t&&"="===i&&(s[t]=vb(d,l))}return t}if(1===d.length)return vy(d[0])?vb(d[0].token,l):vE(e);if(2===d.length){let t=vg[null==(s=d[0])?void 0:s.token];return t&&vy(d[1])?t(vb(d[1].token,l)):vE(e)}if(3===d.length){let t=null==(o=d[1])?void 0:o.token,i=vg[t];if(!i||!vy(d[0])||!vy(d[2]))return vE(e);let r=vb(d[0].token,l);return i(r,"|"===t?d[2].token:vb(d[2].token,l))}}function vE(e){return console.warn("Warning: invalid expression `".concat(e,"`")),!1}function vy(e){let{type:t}=e;return["number","boolean","string","param"].includes(t)}function vb(e,t){let i=e[0],r=e.slice(-1);return"true"===e||"false"===e?"true"===e:i===r&&["'",'"'].includes(i)?e.slice(1,-1):mb(e)?parseFloat(e):t[e]}var vT=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},v_=(e,t,i)=>(vT(e,t,"read from private field"),i?i.call(e):t.get(e)),vA=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vS=(e,t,i,r)=>(vT(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vR=(e,t,i)=>(vT(e,t,"access private method"),i);let vk={mediatargetlivewindow:"targetlivewindow",mediastreamtype:"streamtype"},vI=mF.createElement("template");
3vI.innerHTML="\n  <style>\n    :host {\n      display: inline-block;\n      line-height: 0;\n    }\n\n    media-controller {\n      width: 100%;\n      height: 100%;\n    }\n\n    media-captions-button:not([mediasubtitleslist]),\n    media-captions-menu:not([mediasubtitleslist]),\n    media-captions-menu-button:not([mediasubtitleslist]),\n    media-audio-track-menu[mediaaudiotrackunavailable],\n    media-audio-track-menu-button[mediaaudiotrackunavailable],\n    media-rendition-menu[mediarenditionunavailable],\n    media-rendition-menu-button[mediarenditionunavailable],\n    media-volume-range[mediavolumeunavailable],\n    media-airplay-button[mediaairplayunavailable],\n    media-fullscreen-button[mediafullscreenunavailable],\n    media-cast-button[mediacastunavailable],\n    media-pip-button[mediapipunavailable] {\n      display: none;\n    }\n  </style>\n";class vL extends mU.HTMLElement{get mediaController(){return this.renderRoot.querySelector("media-controller")}get template(){var e;return null!=(e=v_(this,Tu))?e:this.constructor.template}set template(e){if(null===e)return void this.removeAttribute("template");"string"==typeof e?this.setAttribute("template",e):e instanceof HTMLTemplateElement&&(vS(this,Tu,e),vS(this,Tc,null),this.createRenderer())}get props(){var e,t,i;let r=[...Array.from(null!=(t=null==(e=this.mediaController)?void 0:e.attributes)?t:[]).filter(e=>{let{name:t}=e;return vk[t]||t.startsWith("breakpoint")}),...Array.from(this.attributes)],n={};for(let e of r){let t=null!=(i=vk[e.name])?i:e.name.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase()),{value:r}=e;null!=r?(mb(r)&&(r=parseFloat(r)),n[t]=""===r||r):n[t]=!1}return n}attributeChangedCallback(e,t,i){"template"===e&&t!=i&&vR(this,Tg,Tv).call(this)}connectedCallback(){this.addEventListener(mn.BREAKPOINTS_COMPUTED,v_(this,TE)),v_(this,Tm).observe(this,{attributes:!0}),v_(this,Tm).observe(this.renderRoot,{attributes:!0,subtree:!0}),vR(this,Tg,Tv).call(this)}disconnectedCallback(){this.removeEventListener(mn.BREAKPOINTS_COMPUTED,v_(this,TE)),v_(this,Tm).disconnect()}createRenderer(){this.template instanceof HTMLTemplateElement&&this.template!==v_(this,Th)&&(vS(this,Th,this.template),this.renderer=new g7(this.template,this.props,this.constructor.processor),this.renderRoot.textContent="",this.renderRoot.append(vI.content.cloneNode(!0),this.renderer))}render(){var e;null==(e=this.renderer)||e.update(this.props)}constructor(){super(),vA(this,Tf),vA(this,Tg),vA(this,Tu,void 0),vA(this,Th,void 0),vA(this,Tc,void 0),vA(this,Tm,void 0),vA(this,TE,void 0),this.shadowRoot?this.renderRoot=this.shadowRoot:(this.renderRoot=this.attachShadow({mode:"open"}),this.createRenderer()),vS(this,Tm,new MutationObserver(e=>{var t;(!this.mediaController||(null==(t=this.mediaController)?void 0:t.breakpointsComputed))&&e.some(e=>{let t=e.target;return t===this||"media-controller"===t.localName&&!!(vk[e.attributeName]||e.attributeName.startsWith("breakpoint"))})&&this.render()})),vS(this,TE,this.render.bind(this)),vR(this,Tf,Tp).call(this,"template")}}async function vD(e){let t=await fetch(e);if(200!==t.status)throw Error("Failed to load resource: the server responded with a status of ".concat(t.status));return t.text()}function vw(e){return e.split("-")[0]}Tu=new WeakMap,Th=new WeakMap,Tc=new WeakMap,Tm=new WeakMap,Tf=new WeakSet,Tp=function(e){if(Object.prototype.hasOwnProperty.call(this,e)){let t=this[e];delete this[e],this[e]=t}},Tg=new WeakSet,Tv=function(){var e;let t=this.getAttribute("template");if(!t||t===v_(this,Tc))return;let i=this.getRootNode(),r=null==(e=null==i?void 0:i.getElementById)?void 0:e.call(i,t);if(r){vS(this,Tc,t),vS(this,Tu,r),this.createRenderer();return}(function(e){if(!/^(\/|\.\/|https?:\/\/)/.test(e))return!1;let t=/^https?:\/\//.test(e)?void 0:location.origin;try{new URL(e,t)}catch(e){return!1}return!0})(t)&&(vS(this,Tc,t),vD(t).then(e=>{let t=mF.createElement("template");t.innerHTML=e,vS(this,Tu,t),this.createRenderer()}).catch(console.error))},TE=new WeakMap,vL.observedAttributes=["template"],vL.processor=vp,mU.customElements.get("media-theme")||mU.customElements.define("media-theme",vL);
3class vC extends Event{constructor({action:e="auto",relatedTarget:t,...i}){super("invoke",i),this.action=e,this.relatedTarget=t}}class vM extends Event{constructor({newState:e,oldState:t,...i}){super("toggle",i),this.newState=e,this.oldState=t}}var vP=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},vO=(e,t,i)=>(vP(e,t,"read from private field"),i?i.call(e):t.get(e)),vx=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vN=(e,t,i,r)=>(vP(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vU=(e,t,i)=>(vP(e,t,"access private method"),i);function vF(e){let{type:t,text:i,value:r,checked:n}=e,a=mF.createElement("media-chrome-menu-item");a.type=null!=t?t:"",a.part.add("menu-item"),t&&a.part.add(t),a.value=r,a.checked=n;let s=mF.createElement("span");return s.textContent=i,a.append(s),a}function vB(e,t){let i=e.querySelector(':scope > [slot="'.concat(t,'"]'));if((null==i?void 0:i.nodeName)=="SLOT"&&(i=i.assignedElements({flatten:!0})[0]),i)return i.cloneNode(!0);let r=e.shadowRoot.querySelector('[name="'.concat(t,'"] > svg'));return r?r.cloneNode(!0):""}let vG={STYLE:"style",HIDDEN:"hidden",DISABLED:"disabled",ANCHOR:"anchor"};class vH extends mU.HTMLElement{static get observedAttributes(){return[vG.DISABLED,vG.HIDDEN,vG.STYLE,vG.ANCHOR,me.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":vU(this,Tk,TI).call(this,e);break;case"invoke":vU(this,TP,TO).call(this,e);break;case"click":vU(this,Tq,TY).call(this,e);break;case"toggle":vU(this,TQ,TX).call(this,e);break;case"focusout":vU(this,T$,T0).call(this,e);break;case"keydown":vU(this,T1,T2).call(this,e)}}connectedCallback(){var e,t;vO(this,TA).observe(this.defaultSlot,{childList:!0}),vN(this,TR,m1(this.shadowRoot,":host")),vU(this,TC,TM).call(this),this.hasAttribute("disabled")||this.enable(),this.role||(this.role="menu"),vN(this,Ty,mY(this)),null==(t=null==(e=vO(this,Ty))?void 0:e.associateElement)||t.call(e,this),this.hidden||(mK(vW(this),vO(this,TB)),mK(this,vO(this,TG))),vU(this,TL,TD).call(this),this.shadowRoot.addEventListener("slotchange",this)}disconnectedCallback(){var e,t;vO(this,TA).disconnect(),mW(vW(this),vO(this,TB)),mW(this,vO(this,TG)),this.disable(),null==(t=null==(e=vO(this,Ty))?void 0:e.unassociateElement)||t.call(e,this),vN(this,Ty,null),vN(this,Tb,null),vN(this,TT,null),this.shadowRoot.removeEventListener("slotchange",this)}attributeChangedCallback(e,t,i){var r,n,a,s;e===vG.HIDDEN&&i!==t?(vO(this,TS)||vN(this,TS,!0),this.hidden?vU(this,TU,TF).call(this):vU(this,Tx,TN).call(this),this.dispatchEvent(new vM({oldState:this.hidden?"open":"closed",newState:this.hidden?"closed":"open",bubbles:!0}))):e===me.MEDIA_CONTROLLER?(t&&(null==(n=null==(r=vO(this,Ty))?void 0:r.unassociateElement)||n.call(r,this),vN(this,Ty,null)),i&&this.isConnected&&(vN(this,Ty,mY(this)),null==(s=null==(a=vO(this,Ty))?void 0:a.associateElement)||s.call(a,this))):e===vG.DISABLED&&i!==t?null==i?this.enable():this.disable():e===vG.STYLE&&i!==t&&vU(this,TC,TM).call(this)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}get anchor(){return this.getAttribute("anchor")}set anchor(e){this.setAttribute("anchor","".concat(e))}get anchorElement(){var e;return this.anchor?null==(e=mJ(this))?void 0:e.querySelector("#".concat(this.anchor)):null}get items(){return this.defaultSlot.assignedElements({flatten:!0}).filter(vK)}get radioGroupItems(){return this.items.filter(e=>"menuitemradio"===e.role)}get checkedItems(){return this.items.filter(e=>e.checked)}get value(){var e,t;return null!=(t=null==(e=this.checkedItems[0])?void 0:e.value)?t:""}set value(e){let t=this.items.find(t=>t.value===e);t&&vU(this,T7,_e).call(this,t)}focus(){if(vN(this,Tb,mZ()),this.items.length){vU(this,T6,T9).call(this,this.items[0]),this.items[0].focus();return}
3let e=this.querySelector('[autofocus], [tabindex]:not([tabindex="-1"]), [role="menu"]');null==e||e.focus()}handleSelect(e){var t;let i=vU(this,T3,T4).call(this,e);i&&(vU(this,T7,_e).call(this,i,"checkbox"===i.type),vO(this,TT)&&!this.hidden&&(null==(t=vO(this,Tb))||t.focus(),this.hidden=!0))}get keysUsed(){return["Enter","Escape","Tab"," ","ArrowDown","ArrowUp","Home","End"]}handleMove(e){var t,i;let{key:r}=e,n=this.items,a=null!=(i=null!=(t=vU(this,T3,T4).call(this,e))?t:vU(this,T5,T8).call(this))?i:n[0],s=Math.max(0,n.indexOf(a));"ArrowDown"===r?s++:"ArrowUp"===r?s--:"Home"===e.key?s=0:"End"===e.key&&(s=n.length-1),s<0&&(s=n.length-1),s>n.length-1&&(s=0),vU(this,T6,T9).call(this,n[s]),n[s].focus()}constructor(){if(super(),vx(this,Tk),vx(this,TL),vx(this,TC),vx(this,TP),vx(this,Tx),vx(this,TU),vx(this,TH),vx(this,TW),vx(this,Tq),vx(this,Tj),vx(this,TQ),vx(this,TZ),vx(this,T$),vx(this,T1),vx(this,T3),vx(this,T5),vx(this,T6),vx(this,T7),vx(this,Ty,null),vx(this,Tb,null),vx(this,TT,null),vx(this,T_,new Set),vx(this,TA,void 0),vx(this,TS,!1),vx(this,TR,null),vx(this,Tw,()=>{let e=vO(this,T_),t=new Set(this.items);for(let i of e)t.has(i)||this.dispatchEvent(new CustomEvent("removemenuitem",{detail:i}));for(let i of t)e.has(i)||this.dispatchEvent(new CustomEvent("addmenuitem",{detail:i}));vN(this,T_,t)}),vx(this,TB,()=>{vU(this,TH,TK).call(this),vU(this,TW,TV).call(this,!1)}),vx(this,TG,()=>{vU(this,TH,TK).call(this)}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}this.container=this.shadowRoot.querySelector("#container"),this.defaultSlot=this.shadowRoot.querySelector("slot:not([name])"),vN(this,TA,new MutationObserver(vO(this,Tw)))}}function vK(e){return["menuitem","menuitemradio","menuitemcheckbox"].includes(null==e?void 0:e.role)}function vW(e){var t;return null!=(t=e.getAttribute("bounds")?mX(e,"#".concat(e.getAttribute("bounds"))):mq(e)||e.parentElement)?t:e}Ty=new WeakMap,Tb=new WeakMap,TT=new WeakMap,T_=new WeakMap,TA=new WeakMap,TS=new WeakMap,TR=new WeakMap,Tk=new WeakSet,TI=function(e){let t=e.target;for(let e of t.assignedNodes({flatten:!0}))3===e.nodeType&&""===e.textContent.trim()&&e.remove();["header","title"].includes(t.name)&&vU(this,TL,TD).call(this),t.name||vO(this,Tw).call(this)},TL=new WeakSet,TD=function(){let e=this.shadowRoot.querySelector('slot[name="header"]');e.hidden=0===this.shadowRoot.querySelector('slot[name="title"]').assignedNodes().length&&0===e.assignedNodes().length},Tw=new WeakMap,TC=new WeakSet,TM=function(){var e;let t=this.shadowRoot.querySelector("#layout-row"),i=null==(e=getComputedStyle(this).getPropertyValue("--media-menu-layout"))?void 0:e.trim();t.setAttribute("media","row"===i?"":"width:0")},TP=new WeakSet,TO=function(e){vN(this,TT,e.relatedTarget),mQ(this,e.relatedTarget)||(this.hidden=!this.hidden)},Tx=new WeakSet,TN=function(){var e;null==(e=vO(this,TT))||e.setAttribute("aria-expanded","true"),this.addEventListener("transitionend",()=>this.focus(),{once:!0}),mK(vW(this),vO(this,TB)),mK(this,vO(this,TG))},TU=new WeakSet,TF=function(){var e;null==(e=vO(this,TT))||e.setAttribute("aria-expanded","false"),mW(vW(this),vO(this,TB)),mW(this,vO(this,TG))},TB=new WeakMap,TG=new WeakMap,TH=new WeakSet,TK=function(e){if(this.hasAttribute("mediacontroller")&&!this.anchor||this.hidden||!this.anchorElement)return;let{x:t,y:i}=function(e){let{anchor:t,floating:i,placement:r}=e,{x:n,y:a}=function(e,t){let i,{anchor:r,floating:n}=e,a="x"==(["top","bottom"].includes(vw(t))?"y":"x")?"y":"x",s="y"===a?"height":"width",o=vw(t),l=r.x+r.width/2-n.width/2,d=r.y+r.height/2-n.height/2,u=r[s]/2-n[s]/2;switch(o){case"top":i={x:l,y:r.y-n.height};break;case"bottom":i={x:l,y:r.y+r.height};break;case"right":i={x:r.x+r.width,y:d};break;case"left":i={x:r.x-n.width,y:d};break;default:i={x:r.x,y:r.y}}switch(t.split("-")[1]){case"start":i[a]-=u;break;case"end":i[a]+=u}return i}(function(e){let{anchor:t,floating:i}=e;return{anchor:function(e,t){var i;let r=e.getBoundingClientRect(),n=null!=(i=null==t?void 0:t.getBoundingClientRect())?i:{x:0,y:0};return{x:r.x-n.x,y:r.y-n.y,width:r.width,height:r.height}}(t,i.offsetParent),floating:{x:0,y:0,width:i.offsetWidth,height:i.offsetHeight}}}({anchor:t,floating:i}),r);return{x:n,y:a}}({anchor:this.anchorElement,floating:this,placement:"top-start"});null!=e||(e=this.offsetWidth);let r=vW(this).getBoundingClientRect(),n=r.width-t-e,a=r.height-i-this.offsetHeight,{style:s}=vO(this,TR);s.setProperty("position","absolute"),s.setProperty("right","".concat(Math.max(0,n),"px")),s.setProperty("--_menu-bottom","".concat(a,"px"));let o=getComputedStyle(this),l=s.getPropertyValue("--_menu-bottom")===o.bottom?a:parseFloat(o.bottom),d=r.height-l-parseFloat(o.marginBottom);this.style.setProperty("--_menu-max-height","".concat(d,"px"))},TW=new WeakSet,TV=function(e){let t=this.querySelector('[role="menuitem"][aria-haspopup][aria-expanded="true"]'),i=null==t?void 0:t.querySelector('[role="menu"]'),{style:r}=vO(this,TR);if(e||r.setProperty("--media-menu-transition-in","none"),i){let e=i.offsetHeight,r=Math.max(i.offsetWidth,t.offsetWidth);this.style.setProperty("min-width","".concat(r,"px")),this.style.setProperty("min-height","".concat(e,"px")),vU(this,TH,TK).call(this,r)}else this.style.removeProperty("min-width"),this.style.removeProperty("min-height"),vU(this,TH,TK).call(this);r.removeProperty("--media-menu-transition-in")},Tq=new WeakSet,TY=function(e){var t;if(e.stopPropagation(),e.composedPath().includes(vO(this,Tj,Tz))){null==(t=vO(this,Tb))||t.focu
3s(),this.hidden=!0;return}let i=vU(this,T3,T4).call(this,e);!i||i.hasAttribute("disabled")||(vU(this,T6,T9).call(this,i),this.handleSelect(e))},Tj=new WeakSet,Tz=function(){var e;return null==(e=this.shadowRoot.querySelector('slot[name="header"]').assignedElements({flatten:!0}))?void 0:e.find(e=>e.matches('button[part~="back"]'))},TQ=new WeakSet,TX=function(e){if(e.target===this)return;vU(this,TZ,TJ).call(this);let t=Array.from(this.querySelectorAll('[role="menuitem"][aria-haspopup]'));for(let i of t)i.invokeTargetElement!=e.target&&("open"!=e.newState||"true"!=i.getAttribute("aria-expanded")||i.invokeTargetElement.hidden||i.invokeTargetElement.dispatchEvent(new vC({relatedTarget:i})));for(let e of t)e.setAttribute("aria-expanded","".concat(!e.submenuElement.hidden));vU(this,TW,TV).call(this,!0)},TZ=new WeakSet,TJ=function(){let e=this.querySelector('[role="menuitem"] > [role="menu"]:not([hidden])');this.container.classList.toggle("has-expanded",!!e)},T$=new WeakSet,T0=function(e){var t;mQ(this,e.relatedTarget)||(vO(this,TS)&&(null==(t=vO(this,Tb))||t.focus()),vO(this,TT)&&vO(this,TT)!==e.relatedTarget&&!this.hidden&&(this.hidden=!0))},T1=new WeakSet,T2=function(e){var t,i,r,n,a;let{key:s,ctrlKey:o,altKey:l,metaKey:d}=e;if(!o&&!l&&!d&&this.keysUsed.includes(s))if(e.preventDefault(),e.stopPropagation(),"Tab"===s){if(vO(this,TS)){this.hidden=!0;return}e.shiftKey?null==(i=null==(t=this.previousElementSibling)?void 0:t.focus)||i.call(t):null==(n=null==(r=this.nextElementSibling)?void 0:r.focus)||n.call(r),this.blur()}else"Escape"===s?(null==(a=vO(this,Tb))||a.focus(),vO(this,TS)&&(this.hidden=!0)):"Enter"===s||" "===s?this.handleSelect(e):this.handleMove(e)},T3=new WeakSet,T4=function(e){return e.composedPath().find(e=>["menuitemradio","menuitemcheckbox"].includes(e.role))},T5=new WeakSet,T8=function(){return this.items.find(e=>0===e.tabIndex)},T6=new WeakSet,T9=function(e){for(let t of this.items)t.tabIndex=t===e?0:-1},T7=new WeakSet,_e=function(e,t){let i=[...this.checkedItems];"radio"===e.type&&this.radioGroupItems.forEach(e=>e.checked=!1),t?e.checked=!e.checked:e.checked=!0,this.checkedItems.some((e,t)=>e!=i[t])&&this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))},vH.shadowRootOptions={mode:"open"},vH.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        font: var(--media-font,\n          var(--media-font-weight, normal)\n          var(--media-font-size, 14px) /\n          var(--media-text-content-height, var(--media-control-height, 24px))\n          var(--media-font-family, helvetica neue, segoe ui, roboto, arial, sans-serif));\n        color: var(--media-text-color, var(--media-primary-color, rgb(238 238 238)));\n        --_menu-bg: rgb(20 20 30 / .8);\n        background: var(--media-menu-background, var(--media-control-background, var(--media-secondary-color, var(--_menu-bg))));\n        border-radius: var(--media-menu-border-radius);\n        border: var(--media-menu-border, none);\n        display: var(--media-menu-display, inline-flex) !important;\n        \n        transition: var(--media-menu-transition-in,\n          visibility 0s,\n          opacity .2s ease-out,\n          transform .15s ease-out,\n          left .2s ease-in-out,\n          min-width .2s ease-in-out,\n          min-height .2s ease-in-out\n        ) !important;\n        \n        visibility: var(--media-menu-visibility, visible);\n        opacity: var(--media-menu-opacity, 1);\n        max-height: var(--media-menu-max-height, var(--_menu-max-height, 300px));\n        transform: var(--media-menu-transform-in, translateY(0) scale(1));\n        flex-direction: column;\n        \n        min-height: 0;\n        position: relative;\n        bottom: var(--_menu-bottom);\n        box-sizing: border-box;\n      } \n\n      @-moz-document url-prefix() {\n        :host{\n          --_menu-bg: rgb(20 20 30);\n        }\n      }\n\n      :host([hidden]) {\n        transition: var(--media-menu-transition-out,\n          visibility .15s ease-in,\n          opacity .15s ease-in,\n          transform .15s ease-in\n        ) !important;\n        visibility: var(--media-menu-hidden-visibility, hidden);\n        opacity: var(--media-menu-hidden-opacity, 0);\n        max-height: var(--media-menu-hidden-max-height,\n          var(--media-menu-max-height, var(--_menu-max-height, 300px)));\n        transform: var(--media-menu-transform-out, translateY(2px) scale(.99));\n        pointer-events: none;\n      }
3\n\n      :host([slot="submenu"]) {\n        background: none;\n        width: 100%;\n        min-height: 100%;\n        position: absolute;\n        bottom: 0;\n        right: -100%;\n      }\n\n      #container {\n        display: flex;\n        flex-direction: column;\n        min-height: 0;\n        transition: transform .2s ease-out;\n        transform: translate(0, 0);\n      }\n\n      #container.has-expanded {\n        transition: transform .2s ease-in;\n        transform: translate(-100%, 0);\n      }\n\n      button {\n        background: none;\n        color: inherit;\n        border: none;\n        padding: 0;\n        font: inherit;\n        outline: inherit;\n        display: inline-flex;\n        align-items: center;\n      }\n\n      slot[name="header"][hidden] {\n        display: none;\n      }\n\n      slot[name="header"] > *,\n      slot[name="header"]::slotted(*) {\n        padding: .4em .7em;\n        border-bottom: 1px solid rgb(255 255 255 / .25);\n        cursor: var(--media-cursor, default);\n      }\n\n      slot[name="header"] > button[part~="back"],\n      slot[name="header"]::slotted(button[part~="back"]) {\n        cursor: var(--media-cursor, pointer);\n      }\n\n      svg[part~="back"] {\n        height: var(--media-menu-icon-height, var(--media-control-height, 24px));\n        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));\n        display: block;\n        margin-right: .5ch;\n      }\n\n      slot:not([name]) {\n        gap: var(--media-menu-gap);\n        flex-direction: var(--media-menu-flex-direction, column);\n        overflow: var(--media-menu-overflow, hidden auto);\n        display: flex;\n        min-height: 0;\n      }\n\n      :host([role="menu"]) slot:not([name]) {\n        padding-block: .4em;\n      }\n\n      slot:not([name])::slotted([role="menu"]) {\n        background: none;\n      }\n\n      media-chrome-menu-item > span {\n        margin-right: .5ch;\n        max-width: var(--media-menu-item-max-width);\n        text-overflow: ellipsis;\n        overflow: hidden;\n      }\n    </style>\n    <style id="layout-row" media="width:0">\n\n      slot[name="header"] > *,\n      slot[name="header"]::slotted(*) {\n        padding: .4em .5em;\n      }\n\n      slot:not([name]) {\n        gap: var(--media-menu-gap, .25em);\n        flex-direction: var(--media-menu-flex-direction, row);\n        padding-inline: .5em;\n      }\n\n      media-chrome-menu-item {\n        padding: .3em .5em;\n      }\n\n      media-chrome-menu-item[aria-checked="true"] {\n        background: var(--media-menu-item-checked-background, rgb(255 255 255 / .2));\n      }\n\n      \n      media-chrome-menu-item::part(checked-indicator) {\n        display: var(--media-menu-item-checked-indicator-display, none);\n      }\n    </style>\n    <div id="container" part="container">\n      <slot name="header" hidden>\n        <button part="back button" aria-label="Back to previous menu">\n          <slot name="back-icon">\n            <svg aria-hidden="true" viewBox="0 0 20 24" part="back indicator">\n              <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"/>\n            </svg>\n          </slot>\n          <slot name="title"></slot>\n        </button>\n      </slot>\n      <slot></slot>\n    </div>\n    <slot name="checked-indicator" hidden></slot>\n  '},mU.customElements.get("media-chrome-menu")||mU.customElements.define("media-chrome-menu",vH);var vV=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},vq=(e,t,i)=>(vV(e,t,"read from private field"),i?i.call(e):t.get(e)),vY=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},vj=(e,t,i,r)=>(vV(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),vz=(e,t,i)=>(vV(e,t,"access private method"),i);let vQ={TYPE:"type",VALUE:"value",CHECKED:"checked",DISABLED:"disabled"};class vX extends mU.HTMLElement{static get observedAttributes(){return[vQ.TYPE,vQ.DISABLED,vQ.CHECKED,vQ.VALUE]}enable(){this.hasAttribute("tabindex")||this.setAttribute("tabindex","-1"),vZ(this)&&!this.hasAttribute("aria-checked")&&this.setAttribute("aria-checked","fal
3se"),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":vz(this,_r,_n).call(this,e);break;case"click":this.handleClick(e);break;case"keydown":vq(this,_h).call(this,e);break;case"keyup":vq(this,_u).call(this,e)}}attributeChangedCallback(e,t,i){e===vQ.CHECKED&&vZ(this)&&!vq(this,_t)?this.setAttribute("aria-checked",null!=i?"true":"false"):e===vQ.TYPE&&i!==t?this.role="menuitem"+i:e===vQ.DISABLED&&i!==t&&(null==i?this.enable():this.disable())}connectedCallback(){this.hasAttribute(vQ.DISABLED)||this.enable(),this.role="menuitem"+this.type,vj(this,_i,function e(t,i){if(!t)return null;let{host:r}=t.getRootNode();return!i&&r?e(t,r):(null==i?void 0:i.items)?i:e(i,null==i?void 0:i.parentNode)}(this,this.parentNode)),vz(this,_c,_m).call(this),this.submenuElement&&vz(this,_a,_s).call(this),this.shadowRoot.addEventListener("slotchange",this)}disconnectedCallback(){this.disable(),vz(this,_c,_m).call(this),vj(this,_i,null),this.shadowRoot.removeEventListener("slotchange",this)}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget","".concat(e))}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=mJ(this))?void 0:e.querySelector("#".concat(this.invokeTarget)):this.submenuElement}get submenuElement(){return this.shadowRoot.querySelector('slot[name="submenu"]').assignedElements({flatten:!0})[0]}get type(){var e;return null!=(e=this.getAttribute(vQ.TYPE))?e:""}set type(e){this.setAttribute(vQ.TYPE,"".concat(e))}get value(){var e;return null!=(e=this.getAttribute(vQ.VALUE))?e:this.text}set value(e){this.setAttribute(vQ.VALUE,e)}get text(){var e;return(null!=(e=this.textContent)?e:"").trim()}get checked(){if(vZ(this))return"true"===this.getAttribute("aria-checked")}set checked(e){vZ(this)&&(vj(this,_t,!0),this.setAttribute("aria-checked",e?"true":"false"),e?this.part.add("checked"):this.part.remove("checked"))}handleClick(e){!vZ(this)&&this.invokeTargetElement&&mQ(this,e.target)&&this.invokeTargetElement.dispatchEvent(new vC({relatedTarget:this}))}get keysUsed(){return["Enter"," "]}constructor(){if(super(),vY(this,_r),vY(this,_a),vY(this,_o),vY(this,_c),vY(this,_t,!1),vY(this,_i,void 0),vY(this,_d,()=>{var e,t;this.submenuElement.items&&this.setAttribute("submenusize","".concat(this.submenuElement.items.length));let i=this.shadowRoot.querySelector('slot[name="description"]'),r=null==(e=this.submenuElement.checkedItems)?void 0:e[0],n=null!=(t=null==r?void 0:r.dataset.description)?t:null==r?void 0:r.text,a=mF.createElement("span");a.textContent=null!=n?n:"",i.replaceChildren(a)}),vY(this,_u,e=>{let{key:t}=e;if(!this.keysUsed.includes(t))return void this.removeEventListener("keyup",vq(this,_u));this.handleClick(e)}),vY(this,_h,e=>{let{metaKey:t,altKey:i,key:r}=e;if(t||i||!this.keysUsed.includes(r))return void this.removeEventListener("keyup",vq(this,_u));this.addEventListener("keyup",vq(this,_u),{once:!0})}),!this.shadowRoot){this.attachShadow(this.constructor.shadowRootOptions);let e=mV(this.attributes);this.shadowRoot.innerHTML=this.constructor.getTemplateHTML(e)}}}function vZ(e){return"radio"===e.type||"checkbox"===e.type}_t=new WeakMap,_i=new WeakMap,_r=new WeakSet,_n=function(e){let t=e.target;if(!(null==t?void 0:t.name))for(let e of t.assignedNodes({flatten:!0}))e instanceof Text&&""===e.textContent.trim()&&e.remove();"submenu"===t.name&&(this.submenuElement?vz(this,_a,_s).call(this):vz(this,_o,_l).call(this))},_a=new WeakSet,_s=async function(){this.setAttribute("aria-haspopup","menu"),this.setAttribute("aria-expanded","".concat(!this.submenuElement.hidden)),this.submenuElement.addEventListener("change",vq(this,_d)),this.submenuElement.addEventListener("addmenuitem",vq(this,_d)),this.submenuElement.addEventListener("removemenuitem",vq(this,_d)),vq(this,_d).call(this)},_o=new WeakSet,_l=function(){this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.submenuElement.removeEventListener("change",vq(this,_d)),this.submenuElement.removeEventListener("addmenuitem",vq(this,_d)),this.submenuElement.removeEventListener("removemenuitem",vq(this,_d)),vq(this,_d).call(this)},_d=new WeakMap,_u=new WeakMap,_h=new WeakMap,_c=new WeakSet,_m=function(){var e;
3let t=null==(e=vq(this,_i))?void 0:e.radioGroupItems;if(!t)return;let i=t.filter(e=>"true"===e.getAttribute("aria-checked")).pop();for(let e of(i||(i=t[0]),t))e.setAttribute("aria-checked","false");null==i||i.setAttribute("aria-checked","true")},vX.shadowRootOptions={mode:"open"},vX.getTemplateHTML=function(e){return'\n    <style>\n      :host {\n        transition: var(--media-menu-item-transition,\n          background .15s linear,\n          opacity .2s ease-in-out\n        );\n        outline: var(--media-menu-item-outline, 0);\n        outline-offset: var(--media-menu-item-outline-offset, -1px);\n        cursor: var(--media-cursor, pointer);\n        display: flex;\n        align-items: center;\n        align-self: stretch;\n        justify-self: stretch;\n        white-space: nowrap;\n        white-space-collapse: collapse;\n        text-wrap: nowrap;\n        padding: .4em .8em .4em 1em;\n      }\n\n      :host(:focus-visible) {\n        box-shadow: var(--media-menu-item-focus-shadow, inset 0 0 0 2px rgb(27 127 204 / .9));\n        outline: var(--media-menu-item-hover-outline, 0);\n        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));\n      }\n\n      :host(:hover) {\n        cursor: var(--media-cursor, pointer);\n        background: var(--media-menu-item-hover-background, rgb(92 92 102 / .5));\n        outline: var(--media-menu-item-hover-outline);\n        outline-offset: var(--media-menu-item-hover-outline-offset,  var(--media-menu-item-outline-offset, -1px));\n      }\n\n      :host([aria-checked="true"]) {\n        background: var(--media-menu-item-checked-background);\n      }\n\n      :host([hidden]) {\n        display: none;\n      }\n\n      :host([disabled]) {\n        pointer-events: none;\n        color: rgba(255, 255, 255, .3);\n      }\n\n      slot:not([name]) {\n        width: 100%;\n      }\n\n      slot:not([name="submenu"]) {\n        display: inline-flex;\n        align-items: center;\n        transition: inherit;\n        opacity: var(--media-menu-item-opacity, 1);\n      }\n\n      slot[name="description"] {\n        justify-content: end;\n      }\n\n      slot[name="description"] > span {\n        display: inline-block;\n        margin-inline: 1em .2em;\n        max-width: var(--media-menu-item-description-max-width, 100px);\n        text-overflow: ellipsis;\n        overflow: hidden;\n        font-size: .8em;\n        font-weight: 400;\n        text-align: right;\n        position: relative;\n        top: .04em;\n      }\n\n      slot[name="checked-indicator"] {\n        display: none;\n      }\n\n      :host(:is([role="menuitemradio"],[role="menuitemcheckbox"])) slot[name="checked-indicator"] {\n        display: var(--media-menu-item-checked-indicator-display, inline-block);\n      }\n\n      \n      svg, img, ::slotted(svg), ::slotted(img) {\n        height: var(--media-menu-item-icon-height, var(--media-control-height, 24px));\n        fill: var(--media-icon-color, var(--media-primary-color, rgb(238 238 238)));\n        display: block;\n      }\n\n      \n      [part~="indicator"],\n      ::slotted([part~="indicator"]) {\n        fill: var(--media-menu-item-indicator-fill,\n          var(--media-icon-color, var(--media-primary-color, rgb(238 238 238))));\n        height: var(--media-menu-item-indicator-height, 1.25em);\n        margin-right: .5ch;\n      }\n\n      [part~="checked-indicator"] {\n        visibility: hidden;\n      }\n\n      :host([aria-checked="true"]) [part~="checked-indicator"] {\n        visibility: visible;\n      }\n    </style>\n    <slot name="checked-indicator">\n      <svg aria-hidden="true" viewBox="0 1 24 24" part="checked-indicator indicator">\n        <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"/>\n      </svg>\n    </slot>\n    <slot name="prefix"></slot>\n    <slot></slot>\n    <slot name="description"></slot>\n    <slot name="suffix">\n      '.concat(this.getSuffixSlotInnerHTML(e),'\n    </slot>\n    <slot name="submenu"></slot>\n  ')},vX.getSuffixSlotInnerHTML=function(e){return""},mU.customElements.get("media-chrome-menu-item")||mU.customElements.define("media-chrome-menu-item",vX);class vJ extends vH{get anchorElement(){return"auto"!==this.anchor?super.anchorElement:mq(this).querySelector("media-settings-menu-button")}}vJ.getTemplateHTML=function(e){return"\n    ".concat(vH.getTemplateHTML(e),'\n    <style>\n      :host {\n        --_menu-bg: rgb(20 20 30 / .8);
3\n        background: var(--media-settings-menu-background,\n            var(--media-menu-background,\n              var(--media-control-background,\n                var(--media-secondary-color, var(--_menu-bg)))));\n        min-width: var(--media-settings-menu-min-width, 170px);\n        border-radius: 2px 2px 0 0;\n        overflow: hidden;\n      }\n\n      @-moz-document url-prefix() {\n        :host{\n          --_menu-bg: rgb(20 20 30);\n        }\n      }\n\n      :host([role="menu"]) {\n        ',"\n        justify-content: end;\n      }\n\n      slot:not([name]) {\n        justify-content: var(--media-settings-menu-justify-content);\n        flex-direction: var(--media-settings-menu-flex-direction, column);\n        overflow: visible;\n      }\n\n      #container.has-expanded {\n        --media-settings-menu-item-opacity: 0;\n      }\n    </style>\n  ")},mU.customElements.get("media-settings-menu")||mU.customElements.define("media-settings-menu",vJ);class v$ extends vX{}v$.shadowRootOptions={mode:"open"},v$.getTemplateHTML=function(e){return"\n    ".concat(vX.getTemplateHTML.call(this,e),'\n    <style>\n      slot:not([name="submenu"]) {\n        opacity: var(--media-settings-menu-item-opacity, var(--media-menu-item-opacity));\n      }\n\n      :host([aria-expanded="true"]:hover) {\n        background: transparent;\n      }\n    </style>\n  ')},v$.getSuffixSlotInnerHTML=function(e){return'\n    <svg aria-hidden="true" viewBox="0 0 20 24">\n      <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"/>\n    </svg>\n  '},mU.customElements.get("media-settings-menu-item")||mU.customElements.define("media-settings-menu-item",v$);class v0 extends pc{connectedCallback(){super.connectedCallback(),this.invokeTargetElement&&this.setAttribute("aria-haspopup","menu")}get invokeTarget(){return this.getAttribute("invoketarget")}set invokeTarget(e){this.setAttribute("invoketarget","".concat(e))}get invokeTargetElement(){var e;return this.invokeTarget?null==(e=mJ(this))?void 0:e.querySelector("#".concat(this.invokeTarget)):null}handleClick(){var e;null==(e=this.invokeTargetElement)||e.dispatchEvent(new vC({relatedTarget:this}))}}mU.customElements.get("media-chrome-menu-button")||mU.customElements.define("media-chrome-menu-button",v0);class v1 extends v0{static get observedAttributes(){return[...super.observedAttributes,"target"]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",mS("settings"))}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:mq(this).querySelector("media-settings-menu")}}v1.getSlotTemplateHTML=function(){return'\n    <style>\n      :host([aria-expanded="true"]) slot[name=tooltip] {\n        display: none;\n      }\n    </style>\n    <slot name="icon">\n      <svg aria-hidden="true" viewBox="0 0 24 24">\n        <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"/>\n      </svg>\n    </slot>\n  '},v1.getTooltipContentHTML=function(){return mS("Settings")},mU.customElements.get("media-settings-menu-button")||mU.customElements.define("media-settings-menu-button",v1);var v2=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},v3=(e,t,i)=>(v2(e,t,"read from private field"),i?i.call(e):t.get(e)),v4=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},v5=(e,t,i,r)=>(v2(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),v8=(e,t,i)=>(v2(e,t,"access private method"),i);_f=new WeakMap,_p=new WeakMap,_g=new WeakSet,_v=function(){if(v3(this,_p)===JSON.stringify(this.mediaAudioTrackList))return;v5(this,_p,JSON.stringify(this.mediaAudioTrackList));let e=this.mediaAudioTrackList;for(let t of(this.defaultSlot.textContent="",e.sort((e,t)=>e.id.localeCompare(t.id,void 0,{numeric:!0})),e)){let e=vF({type:"radio",text:this.formatMenuItemText(t.label,t),value:"".concat(t.id),checked:t.enabled});
3e.prepend(vB(this,"checked-indicator")),this.defaultSlot.append(e)}},_E=new WeakSet,_y=function(){if(null==this.value)return;let e=new mU.CustomEvent(c7.MEDIA_AUDIO_TRACK_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},mU.customElements.get("media-audio-track-menu")||mU.customElements.define("media-audio-track-menu",class extends vH{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_AUDIO_TRACK_LIST,mr.MEDIA_AUDIO_TRACK_ENABLED,mr.MEDIA_AUDIO_TRACK_UNAVAILABLE]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===mr.MEDIA_AUDIO_TRACK_ENABLED&&t!==i)this.value=i;else if(e===mr.MEDIA_AUDIO_TRACK_LIST&&t!==i){var r;v5(this,_f,null==(r=null!=i?i:"")?void 0:r.split(/\s+/).map(mE)),v8(this,_g,_v).call(this)}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",v8(this,_E,_y))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",v8(this,_E,_y))}get anchorElement(){var e;return"auto"!==this.anchor?super.anchorElement:null==(e=mq(this))?void 0:e.querySelector("media-audio-track-menu-button")}get mediaAudioTrackList(){return v3(this,_f)}set mediaAudioTrackList(e){v5(this,_f,e),v8(this,_g,_v).call(this)}get mediaAudioTrackEnabled(){var e;return null!=(e=m8(this,mr.MEDIA_AUDIO_TRACK_ENABLED))?e:""}set mediaAudioTrackEnabled(e){m6(this,mr.MEDIA_AUDIO_TRACK_ENABLED,e)}constructor(){super(...arguments),v4(this,_g),v4(this,_E),v4(this,_f,[]),v4(this,_p,void 0)}});let v6=e=>{let t=mS("Audio");e.setAttribute("aria-label",t)};class v9 extends v0{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_AUDIO_TRACK_ENABLED,mr.MEDIA_AUDIO_TRACK_UNAVAILABLE]}connectedCallback(){super.connectedCallback(),v6(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_LANG&&v6(this)}get invokeTargetElement(){var e;return void 0!=this.invokeTarget?super.invokeTargetElement:null==(e=mq(this))?void 0:e.querySelector("media-audio-track-menu")}get mediaAudioTrackEnabled(){var e;return null!=(e=m8(this,mr.MEDIA_AUDIO_TRACK_ENABLED))?e:""}set mediaAudioTrackEnabled(e){m6(this,mr.MEDIA_AUDIO_TRACK_ENABLED,e)}}v9.getSlotTemplateHTML=function(){return'\n    <style>\n      :host([aria-expanded="true"]) slot[name=tooltip] {\n        display: none;\n      }\n    </style>\n    <slot name="icon">'.concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <path d="M11 17H9.5V7H11v10Zm-3-3H6.5v-4H8v4Zm6-5h-1.5v6H14V9Zm3 7h-1.5V8H17v8Z"/>\n  <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"/>\n</svg>',"</slot>\n  ")},v9.getTooltipContentHTML=function(){return mS("Audio")},mU.customElements.get("media-audio-track-menu-button")||mU.customElements.define("media-audio-track-menu-button",v9);var v7=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ee=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Et=(e,t,i)=>(v7(e,t,"access private method"),i);class Ei extends vH{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_SUBTITLES_LIST,mr.MEDIA_SUBTITLES_SHOWING]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_SUBTITLES_LIST&&t!==i?Et(this,_T,__).call(this):e===mr.MEDIA_SUBTITLES_SHOWING&&t!==i&&(this.value=i||"",Et(this,_T,__).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Et(this,_A,_S))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Et(this,_A,_S))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:mq(this).querySelector("media-captions-menu-button")}get mediaSubtitlesList(){return Er(this,mr.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){En(this,mr.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return Er(this,mr.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){En(this,mr.MEDIA_SUBTITLES_SHOWING,e)}constructor(){super(...arguments),Ee(this,_T),Ee(this,_A),Ee(this,_b,void 0)}}_b=new WeakMap,_T=new WeakSet,__=function(){var e,t,i,r,n,a;let s=(v7(this,t=_b,"read from private field"),(i?i.call(this):t.get(this))!==JSON.stringify(this.mediaSubtitlesList)),o=this.value!==this.getAttribute(mr.MEDIA_SUBTITLES_SHOWING);if(!s&&!o)return;r=_b,n=JSON.stringify(this.mediaSubtitlesList),v7(this,r,"write to private field"),a?a.call(this,n):r.set(this,n),this.defaultSlot.textContent="";let l=!this.value,d=vF({type:"radio",text:this.formatMenuItemText(mS("Off")),value:"off",checked:l});for(let t of(d.prepend(vB(this,"checked-indicator")),this.defaultSlot.append(d),this.mediaSubtitlesList)){let i=vF({type:"radio",text:this.formatMenuItemText(t.label,t),value:fb(t),checked:this.value==fb(t)});i.prepend(vB(this,"checked-indicator")),"captions"===(null!=(e=t.kind)?e:"subs")&&i.append(vB(this,"captions-indicator")),this.defaultSlot.append(i)}},_A=new WeakSet,_S=function(){let e=this.mediaSubtitlesShowing,t=this.getAttribute(mr.MEDIA_SUBTITLES_SHOWING),i=this.value!==t;if((null==e?void 0:e.length)&&i&&this.dispatchEvent(new mU.CustomEvent(c7.MEDIA_DISABLE_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:e})),!this.value||!i)return;let r=new mU.CustomEvent(c7.MEDIA_SHOW_SUBTITLES_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(r)},Ei.getTemplateHTML=function(e){return"\n    ".concat(vH.getTemplateHTML(e),'\n    <slot name="captions-indicator" hidden>').concat('\n  <svg aria-hidden="true" viewBox="0 0 26 24" part="captions-indicator indicator">\n    <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 
30 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"/>\n  </svg>',"</slot>\n  ")};let Er=(e,t)=>{let i=e.getAttribute(t);return i?fE(i):[]},En=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=fT(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};mU.customElements.get("media-captions-menu")||mU.customElements.define("media-captions-menu",Ei);let Ea=e=>{e.setAttribute("data-captions-enabled",fR(e).toString())},Es=e=>{e.setAttribute("aria-label",mS("closed captions"))};class Eo extends v0{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_SUBTITLES_LIST,mr.MEDIA_SUBTITLES_SHOWING,mr.MEDIA_LANG]}connectedCallback(){super.connectedCallback(),Es(this),Ea(this)}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_SUBTITLES_SHOWING?Ea(this):e===mr.MEDIA_LANG&&Es(this)}get invokeTargetElement(){var e;return void 0!=this.invokeTarget?super.invokeTargetElement:null==(e=mq(this))?void 0:e.querySelector("media-captions-menu")}get mediaSubtitlesList(){return El(this,mr.MEDIA_SUBTITLES_LIST)}set mediaSubtitlesList(e){Ed(this,mr.MEDIA_SUBTITLES_LIST,e)}get mediaSubtitlesShowing(){return El(this,mr.MEDIA_SUBTITLES_SHOWING)}set mediaSubtitlesShowing(e){Ed(this,mr.MEDIA_SUBTITLES_SHOWING,e)}}Eo.getSlotTemplateHTML=function(){return'\n    <style>\n      :host([data-captions-enabled="true"]) slot[name=off] {\n        display: none !important;\n      }\n\n      \n      :host(:not([data-captions-enabled="true"])) slot[name=on] {\n        display: none !important;\n      }\n\n      :host([aria-expanded="true"]) slot[name=tooltip] {\n        display: none;\n      }\n    </style>\n\n    <slot name="icon">\n      <slot name="on">'.concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <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"/>\n</svg>','</slot>\n      <slot name="off">').concat('<svg aria-hidden="true" viewBox="0 0 26 24">\n  <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"/>\n</svg>',"</slot>\n    </slot>\n  ")},Eo.getTooltipContentHTML=function(){return mS("Captions")};let El=(e,t)=>{let i=e.getAttribute(t);return i?fE(i):[]},Ed=(e,t,i)=>{if(!(null==i?void 0:i.length))return void e.removeAttribute(t);let r=fT(i);e.getAttribute(t)!==r&&e.setAttribute(t,r)};mU.customElements.get("media-captions-menu-button")||mU.customElements.define("media-captions-menu-button",Eo);var Eu=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Eh=(e,t,i)=>(Eu(e,t,"read from private field"),i?i.call(e):t.get(e)),Ec=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Em=(e,t,i)=>(Eu(e,t,"access private method"),i);let Ef={RATES:"rates"};_R=new WeakMap,_k=new WeakSet,_I=function(){this.defaultSlot.textContent="";let e=gg(this.mediaPlaybackRate),t=new Set(Array.from(Eh(this,_R)).map(e=>gg(Number(e))));for(let i of(e>0&&!t.has(e)&&t.add(e),Array.from(t).sort((e,t)=>
3e-t))){let t=vF({type:"radio",text:this.formatMenuItemText("".concat(i,"x"),i),value:i.toString(),checked:e===i});t.prepend(vB(this,"checked-indicator")),this.defaultSlot.append(t)}},_L=new WeakSet,_D=function(){if(!this.value)return;let e=new mU.CustomEvent(c7.MEDIA_PLAYBACK_RATE_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},mU.customElements.get("media-playback-rate-menu")||mU.customElements.define("media-playback-rate-menu",class extends vH{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PLAYBACK_RATE,Ef.RATES]}attributeChangedCallback(e,t,i){super.attributeChangedCallback(e,t,i),e===mr.MEDIA_PLAYBACK_RATE&&t!=i?(this.value=i,Em(this,_k,_I).call(this)):e===Ef.RATES&&t!=i&&(Eh(this,_R).value=i,Em(this,_k,_I).call(this))}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Em(this,_L,_D))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Em(this,_L,_D))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:mq(this).querySelector("media-playback-rate-menu-button")}get rates(){return Eh(this,_R)}set rates(e){e?Array.isArray(e)?Eh(this,_R).value=e.join(" "):"string"==typeof e&&(Eh(this,_R).value=e):Eh(this,_R).value="",Em(this,_k,_I).call(this)}get mediaPlaybackRate(){return m2(this,mr.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){m3(this,mr.MEDIA_PLAYBACK_RATE,e)}constructor(){super(),Ec(this,_k),Ec(this,_L),Ec(this,_R,new fp(this,Ef.RATES,{defaultValue:gp})),Em(this,_k,_I).call(this)}});class Ep extends v0{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_PLAYBACK_RATE]}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),e===mr.MEDIA_PLAYBACK_RATE){let e=i?+i:NaN,t=gg(Number.isNaN(e)?1:e);this.container.innerHTML="".concat(t,"x"),this.setAttribute("aria-label",mS("Playback rate {playbackRate}",{playbackRate:t}))}}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:mq(this).querySelector("media-playback-rate-menu")}get mediaPlaybackRate(){return m2(this,mr.MEDIA_PLAYBACK_RATE,1)}set mediaPlaybackRate(e){m3(this,mr.MEDIA_PLAYBACK_RATE,e)}constructor(){var e;super(),this.container=this.shadowRoot.querySelector('slot[name="icon"]'),this.container.innerHTML="".concat(gg(null!=(e=this.mediaPlaybackRate)?e:1),"x")}}Ep.getSlotTemplateHTML=function(e){let t=e.mediaplaybackrate?gg(+e.mediaplaybackrate):1;return'\n    <style>\n      :host {\n        min-width: 5ch;\n        padding: var(--media-button-padding, var(--media-control-padding, 10px 5px));\n      }\n\n      :host([aria-expanded="true"]) slot {\n        display: block;\n      }\n\n      :host([aria-expanded="true"]) slot[name=tooltip] {\n        display: none;\n      }\n    </style>\n    <slot name="icon">'.concat(t,"x</slot>\n  ")},Ep.getTooltipContentHTML=function(){return mS("Playback rate")},mU.customElements.get("media-playback-rate-menu-button")||mU.customElements.define("media-playback-rate-menu-button",Ep);var Eg=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},Ev=(e,t,i)=>(Eg(e,t,"read from private field"),i?i.call(e):t.get(e)),EE=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},Ey=(e,t,i,r)=>(Eg(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),Eb=(e,t,i)=>(Eg(e,t,"access private method"),i);_w=new WeakMap,_C=new WeakMap,_M=new WeakSet,_P=function(){let e,t=!this.mediaRenditionSelected;if(Ev(this,_C).mediaRenditionList===JSON.stringify(this.mediaRenditionList)&&Ev(this,_C).mediaHeight===this.mediaHeight&&Ev(this,_C).mediaWidth===this.mediaWidth&&Ev(this,_C).isAuto===t)return;Ev(this,_C).mediaRenditionList=JSON.stringify(this.mediaRenditionList),Ev(this,_C).mediaHeight=this.mediaHeight,Ev(this,_C).mediaWidth=this.mediaWidth,Ev(this,_C).isAuto=t;let i=this.mediaRenditionList.sort(this.compareRendition.bind(this)),r=i.find(e=>e.id===this.mediaRenditionSelected);for(let e of i)e.selected=e===r;for(let e of(this.defaultSlot.textContent="",i)){let i=vF({type:"radio",text:this.formatRendition(e,{showBitrate:this.showRenditionBitrate(e)}
3),value:"".concat(e.id),checked:e.selected&&!t});i.prepend(vB(this,"checked-indicator")),this.defaultSlot.append(i)}let n=r&&this.showRenditionBitrate(r);t&&(r?e=this.formatMenuItemText("".concat(mS("Auto")," • ").concat(this.formatRendition(r,{showBitrate:n})),r):this.mediaHeight>0&&this.mediaWidth>0&&(e=this.formatMenuItemText("".concat(mS("Auto")," (").concat(Math.min(this.mediaWidth,this.mediaHeight),"p)")))),e||(e=this.formatMenuItemText(mS("Auto")));let a=vF({type:"radio",text:e,value:"auto",checked:t});a.dataset.description=e,a.prepend(vB(this,"checked-indicator")),this.defaultSlot.append(a)},_O=new WeakSet,_x=function(){if(null==this.value)return;let e=new mU.CustomEvent(c7.MEDIA_RENDITION_REQUEST,{composed:!0,bubbles:!0,detail:this.value});this.dispatchEvent(e)},mU.customElements.get("media-rendition-menu")||mU.customElements.define("media-rendition-menu",class extends vH{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_RENDITION_LIST,mr.MEDIA_RENDITION_SELECTED,mr.MEDIA_RENDITION_UNAVAILABLE,mr.MEDIA_HEIGHT,mr.MEDIA_WIDTH]}static formatMenuItemText(e,t){return super.formatMenuItemText(e,t)}static formatRendition(e){let{showBitrate:t=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i="".concat(Math.min(e.width,e.height),"p");if(t&&e.bitrate){let t=e.bitrate/1e6,r="".concat(t.toFixed(+(t<1))," Mbps");return"".concat(i," (").concat(r,")")}return this.formatMenuItemText(i,e)}static compareRendition(e,t){var i,r;return t.height===e.height?(null!=(i=t.bitrate)?i:0)-(null!=(r=e.bitrate)?r:0):t.height-e.height}attributeChangedCallback(e,t,i){if(super.attributeChangedCallback(e,t,i),t!==i)switch(e){case mr.MEDIA_RENDITION_SELECTED:this.value=null!=i?i:"auto",Eb(this,_M,_P).call(this);break;case mr.MEDIA_RENDITION_LIST:Ey(this,_w,null==i?void 0:i.split(/\s+/).map(mg)),Eb(this,_M,_P).call(this);break;case mr.MEDIA_HEIGHT:case mr.MEDIA_WIDTH:Eb(this,_M,_P).call(this)}}connectedCallback(){super.connectedCallback(),this.addEventListener("change",Eb(this,_O,_x))}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("change",Eb(this,_O,_x))}get anchorElement(){return"auto"!==this.anchor?super.anchorElement:mq(this).querySelector("media-rendition-menu-button")}get mediaRenditionList(){return Ev(this,_w)}set mediaRenditionList(e){Ey(this,_w,e),Eb(this,_M,_P).call(this)}get mediaRenditionSelected(){return m8(this,mr.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){m6(this,mr.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return m2(this,mr.MEDIA_HEIGHT)}set mediaHeight(e){m3(this,mr.MEDIA_HEIGHT,e)}get mediaWidth(){return m2(this,mr.MEDIA_WIDTH)}set mediaWidth(e){m3(this,mr.MEDIA_WIDTH,e)}compareRendition(e,t){return this.constructor.compareRendition(e,t)}formatMenuItemText(e,t){return this.constructor.formatMenuItemText(e,t)}formatRendition(e,t){return this.constructor.formatRendition(e,t)}showRenditionBitrate(e){return this.mediaRenditionList.some(t=>t!==e&&t.height===e.height&&t.bitrate!==e.bitrate)}constructor(){super(...arguments),EE(this,_M),EE(this,_O),EE(this,_w,[]),EE(this,_C,{})}});class ET extends v0{static get observedAttributes(){return[...super.observedAttributes,mr.MEDIA_RENDITION_SELECTED,mr.MEDIA_RENDITION_UNAVAILABLE,mr.MEDIA_HEIGHT]}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",mS("quality"))}get invokeTargetElement(){return void 0!=this.invokeTarget?super.invokeTargetElement:mq(this).querySelector("media-rendition-menu")}get mediaRenditionSelected(){return m8(this,mr.MEDIA_RENDITION_SELECTED)}set mediaRenditionSelected(e){m6(this,mr.MEDIA_RENDITION_SELECTED,e)}get mediaHeight(){return m2(this,mr.MEDIA_HEIGHT)}set mediaHeight(e){m3(this,mr.MEDIA_HEIGHT,e)}}ET.getSlotTemplateHTML=function(){return'\n    <style>\n      :host([aria-expanded="true"]) slot[name=tooltip] {\n        display: none;\n      }\n    </style>\n    <slot name="icon">'.concat('<svg aria-hidden="true" viewBox="0 0 24 24">\n  <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" />\n</svg>',"</slot>\n  ")},ET.getTooltipContentHTML=function(){return mS("Quality")},mU.customElements.get("media-rendition-menu-button")||mU.customElements.define("media-rendition-menu-button",ET);var E_=(e,t,i)=>{if(!t.has(e))throw TypeError("Cannot "+i)},EA=(e,t,i)=>(E_(e,t,"read from private field"),i?i.call(e):t.get(e)),ES=(e,t,i)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,i)},ER=(e,t,i,r)=>(E_(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),Ek=(e,t,i)=>(E_(e,t,"access private method"),i);class EI extends vH{connectedCallback(){super.connectedCallback(),mq(this).addEventListener("contextmenu",EA(this,_q)),this.addEventListener("click",EA(this,_X))}disconnectedCallback(){super.disconnectedCallback(),mq(this).removeEventListener("contextmenu",EA(this,_q)),this.removeEventListener("click",EA(this,_X)),document.removeEventListener("mousedown",EA(this,_z)),document.removeEventListener("keydown",EA(this,_Q))}constructor(){super(),ES(this,_U),ES(this,_B),ES(this,_H),ES(this,_W),ES(this,_Y),ES(this,_N,!1),ES(this,_q,e=>{let t=e.target,i=(null==t?void 0:t.nodeName)==="VIDEO",r=Ek(this,_W,_V).c
3all(this,t);(i||r)&&(EA(this,_N)?Ek(this,_B,_G).call(this):Ek(this,_Y,_j).call(this,e))}),ES(this,_z,e=>{let t=e.target,i=this.contains(t),r=2===e.button,n=(null==t?void 0:t.nodeName)==="VIDEO",a=Ek(this,_W,_V).call(this,t);!i&&(r&&(n||a)||Ek(this,_B,_G).call(this))}),ES(this,_Q,e=>{"Escape"===e.key&&Ek(this,_B,_G).call(this)}),ES(this,_X,e=>{var t,i;let r=e.target;if(null==(t=r.matches)?void 0:t.call(r,'button[invoke="copy"]')){let e=null==(i=r.closest("media-context-menu-item"))?void 0:i.querySelector('input[slot="copy"]');e&&navigator.clipboard.writeText(e.value)}Ek(this,_B,_G).call(this)}),this.setAttribute("noautohide",""),Ek(this,_U,_F).call(this)}}_N=new WeakMap,_U=new WeakSet,_F=function(){this.hidden=!EA(this,_N)},_B=new WeakSet,_G=function(){ER(this,_N,!1),Ek(this,_U,_F).call(this)},_H=new WeakSet,_K=function(){document.querySelectorAll("media-context-menu").forEach(e=>{e!==this&&Ek(e,_B,_G).call(e)})},_W=new WeakSet,_V=function(e){return!!e&&(!!e.hasAttribute("slot")&&"media"===e.getAttribute("slot")||!!(e.nodeName.includes("-")&&e.tagName.includes("-"))&&(e.hasAttribute("src")||e.hasAttribute("poster")||e.hasAttribute("preload")||e.hasAttribute("playsinline")))},_q=new WeakMap,_Y=new WeakSet,_j=function(e){e.preventDefault(),Ek(this,_H,_K).call(this),ER(this,_N,!0),this.style.position="fixed",this.style.left="".concat(e.clientX,"px"),this.style.top="".concat(e.clientY,"px"),Ek(this,_U,_F).call(this),document.addEventListener("mousedown",EA(this,_z),{once:!0}),document.addEventListener("keydown",EA(this,_Q),{once:!0})},_z=new WeakMap,_Q=new WeakMap,_X=new WeakMap,EI.getTemplateHTML=function(e){return"\n      ".concat(vH.getTemplateHTML(e),"\n      <style>\n        :host {\n          --_menu-bg: rgb(20 20 30 / .8);\n          background: var(--media-settings-menu-background,\n            var(--media-menu-background,\n              var(--media-control-background,\n                var(--media-secondary-color, var(--_menu-bg)))));\n          min-width: var(--media-settings-menu-min-width, 170px);\n          border-radius: 2px;\n          overflow: hidden;\n        }\n      </style>\n    ")},mU.customElements.get("media-context-menu")||mU.customElements.define("media-context-menu",EI);class EL extends vX{}function ED(){let e=c9(["\n  <style>\n    ","\n    ","\n  </style>\n  ","\n"]);return ED=function(){return e},e}function Ew(){let e=c9(['<track label="thumbnails" default kind="metadata" src="','" />']);return Ew=function(){return e},e}function EC(){let e=c9([""]);return EC=function(){return e},e}function EM(){let e=c9(['\n  <media-theme\n    template="','"\n    defaultstreamtype="','"\n    hotkeys="','"\n    nohotkeys="','"\n    noautoseektolive="','"\n    novolumepref="','"\n    nomutedpref="','"\n    disabled="','"\n    audio="','"\n    style="','"\n    defaultsubtitles="','"\n    forwardseekoffset="','"\n    backwardseekoffset="','"\n    playbackrates="','"\n    defaultshowremainingtime="','"\n    defaultduration="','"\n    hideduration="','"\n    title="','"\n    videotitle="','"\n    proudlydisplaymuxbadge="','"\n    exportparts="','"\n  >\n    <mux-video\n      slot="media"\n      inert="','"\n      target-live-window="','"\n      stream-type="','"\n      crossorigin="','"\n      playsinline\n      autoplay="','"\n      muted="','"\n      loop="','"\n      preload="','"\n      debug="','"\n      prefer-cmcd="','"\n      disable-tracking="','"\n      disable-cookies="','"\n      prefer-playback="','"\n      start-time="','"\n      initial-bandwidth-estimate-kbps="','"\n      initial-estimate-segments="','"\n      min-preload-segments="','"\n      beacon-collection-domain="','"\n      player-init-time="','"\n      player-software-name="','"\n      player-software-version="','"\n      env-key="','"\n      custom-domain="','"\n      src="','"\n      cast-src="','"\n      cast-receiver="','"\n      drm-token="','"\n      playback-token="','"\n      exportparts="video"\n      disable-pseudo-ended="','"\n      max-reconnect-retries="','"\n      max-auto-resolution="','"\n      cap-rendition-to-player-size="','"\n    >\n      ','\n      <slot></slot>\n    </mux-video>\n    <slot name="poster" slot="poster">\n      <media-poster-image\n        part="poster"\n        exportparts="poster, img"\n        src="','"\n        placeholdersrc="','"\n      ></media-poster-image>\n    </slot>\n  </media-theme>\n']);return EM=function(){return e},e}EL.shadowRootOptions={mode:"open"},EL.getTemplateHTML=function(e){return"\n    ".concat(vX.getTemplateHTML.call(this,e),"\n    <style>\n        ::slotted(*) {\n            color: var(--media-text-color, white);\n            text-decoration: none;\n            border: none;\n            background: none;\n            cursor: pointer;\n            padding: 0;\n            min-height: var(--media-control-height, 24px);\n        }\n    </style>\n  ")},mU.customElements.get("media-context-menu-item")||mU.customElements.define("media-context-menu-item",EL);var EP=e=>{throw TypeError(e)},EO=(e,t,i)=>t.has(e)||EP("Cannot "+i),Ex=(e,t,i)=>(EO(e,t,"read from private field"),i?i.call(e):t.get(e)),EN=(e,t,i)=>t.has(e)?EP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),EU=(e,t,i,r)=>(EO(e,t,"write to private field"),r?r.call(e,i):t.set(e,i),i),EF=(e,t,i)=>(EO(e,t,"access private method"),i),EB=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"undefined"==typeof DocumentFragment&&(globalThis.DocumentFragment=class extends 
3EB{});var EG,EH,EK,EW,EV,Eq,EY,Ej,Ez,EQ,EX,EZ,EJ,E$,E0,E1,E2,E3,E4,E5,E8,E6,E9,E7,ye,yt,yi,yr,yn,ya,ys,yo,yl,yd,yu,yh,yc,ym,yf,yp,yg,yv,yE,yy,yb,yT,y_,yA,yS,yR,yk,yI,yL,yD,yw,yC,yM,yP,yO,yx,yN,yU,yF,yB,yG,yH,yK,yW,yV,yq,yY,yj,yz,yQ,yX,yZ,yJ,y$,y0,y1,y2,y3,y4,y5,y8,y6,y9,y7,be,bt,bi,br,bn,ba,bs,bo,bl,bd,bu,bh,bc,bm,bf,bp,bg,bv,bE,by,bb,bT,b_,bA,bS,bR,bk,bI,bL,bD,bw,bC,bM,bP,bO,bx,bN,bU,bF,bB,bG,bH,bK,bW,bV,bq,bY,bj,bz,bQ,bX,bZ,bJ,b$,b0,b1,b2,b3,b4,b5,b8,b6,b9,b7,Te,Tt,Ti,Tr,Tn,Ta,Ts,To,Tl,Td,Tu,Th,Tc,Tm,Tf,Tp,Tg,Tv,TE,Ty,Tb,TT,T_,TA,TS,TR,Tk,TI,TL,TD,Tw,TC,TM,TP,TO,Tx,TN,TU,TF,TB,TG,TH,TK,TW,TV,Tq,TY,Tj,Tz,TQ,TX,TZ,TJ,T$,T0,T1,T2,T3,T4,T5,T8,T6,T9,T7,_e,_t,_i,_r,_n,_a,_s,_o,_l,_d,_u,_h,_c,_m,_f,_p,_g,_v,_E,_y,_b,_T,__,_A,_S,_R,_k,_I,_L,_D,_w,_C,_M,_P,_O,_x,_N,_U,_F,_B,_G,_H,_K,_W,_V,_q,_Y,_j,_z,_Q,_X,_Z,_J=class extends EB{},_$=class{get detail(){return Ex(this,_Z)}initCustomEvent(){}constructor(e,t={}){EN(this,_Z),EU(this,_Z,null==t?void 0:t.detail)}};_Z=new WeakMap;var _0={document:{createElement:function(e,t){return new _J}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(_J)},CustomEvent:_$,EventTarget:EB,HTMLElement:_J,HTMLVideoElement:class extends EB{}},_1="undefined"==typeof window||void 0===globalThis.customElements,_2=_1?_0:globalThis,_3=_1?_0.document:globalThis.document;function _4(e){return e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function _5(e){return e.replace(/[-_]([a-z])/g,(e,t)=>t.toUpperCase())}function _8(e){if(null==e)return;let t=+e;return Number.isNaN(t)?void 0:t}function _6(e){let t=(function(e){let t={};for(let i in e)null!=e[i]&&(t[i]=e[i]);return new URLSearchParams(t)})(e).toString();return t?"?"+t:""}var _9,_7,Ae,At=(e,t)=>!!e&&!!t&&(!!e.contains(t)||At(e,t.getRootNode().host)),Ai="mux.com",Ar=(()=>{try{return"3.13.4"}catch(e){}return"UNKNOWN"})(),An=function(e){var t;let{token:i,customDomain:r=Ai,thumbnailTime:n,programTime:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=null==i?n:void 0,{aud:o}=null!=(t=dL(i))?t:{};if(!(i&&"t"!==o))return"https://image.".concat(r,"/").concat(e,"/thumbnail.webp").concat(_6({token:i,time:s,program_time:a}))},Aa=function(e){var t;let{token:i,customDomain:r=Ai,programStartTime:n,programEndTime:a}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{aud:s}=null!=(t=dL(i))?t:{};if(!(i&&"s"!==s))return"https://image.".concat(r,"/").concat(e,"/storyboard.vtt").concat(_6({token:i,format:"webp",program_start_time:n,program_end_time:a}))},As=e=>{if(e){if([dc.LIVE,dc.ON_DEMAND].includes(e))return e;if(null!=e&&e.includes("live"))return dc.LIVE}},Ao={crossorigin:"crossOrigin",playsinline:"playsInline"},Al=class{[Symbol.iterator](){return Ex(this,Ae).values()}get length(){return Ex(this,Ae).length}get value(){var e;return null!=(e=Ex(this,Ae).join(" "))?e:""}set value(e){var t;e!==this.value&&(EU(this,Ae,[]),this.add(...null!=(t=null==e?void 0:e.split(" "))?t:[]))}toString(){return this.value}item(e){return Ex(this,Ae)[e]}values(){return Ex(this,Ae).values()}keys(){return Ex(this,Ae).keys()}forEach(e){Ex(this,Ae).forEach(e)}add(){for(var e,t,i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];r.forEach(e=>{this.contains(e)||Ex(this,Ae).push(e)}),(""!==this.value||null!=(e=Ex(this,_9))&&e.hasAttribute("".concat(Ex(this,_7))))&&null!=(t=Ex(this,_9))&&t.setAttribute("".concat(Ex(this,_7)),"".concat(this.value))}remove(){for(var e,t=arguments.length,i=Array(t),r=0;r<t;r++)i[r]=arguments[r];i.forEach(e=>{Ex(this,Ae).splice(Ex(this,Ae).indexOf(e),1)}),null==(e=Ex(this,_9))||e.setAttribute("".concat(Ex(this,_7)),"".concat(this.value))}contains(e){return Ex(this,Ae).includes(e)}toggle(e,t){return void 0!==t?t?(this.add(e),!0):(this.remove(e),!1):this.contains(e)?(this.remove(e),!1):(this.add(e),!0)}replace(e,t){this.remove(e),this.add(t)}constructor(e,t){EN(this,_9),EN(this,_7),EN(this,Ae,[]),EU(this,_9,e),EU(this,_7,t)}};_9=new WeakMap,_7=new WeakMap,Ae=new WeakMap;var Ad="[mux-player ".concat(Ar,"]");function Au(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];console.warn(Ad,...t)}function Ah(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];console.error(Ad,...t)}function Ac(e){var t;let i=null!=(t=e.message)?t:"";e.context&&(i+=" ".concat(e.context)),e.file&&(i+=" ".concat(dw("Read more: "),"\nhttps://github.com/muxinc/elements/blob/main/errors/").concat(e.file)),Au(i)}var Am={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",PRELOAD:"preload"},Af={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},Ap=Object.freeze({length:0,start(e){let t=e>>>0;
3if(t>=this.length)throw new DOMException("Failed to execute 'start' on 'TimeRanges': The index provided (".concat(t,") is greater than or equal to the maximum bound (").concat(this.length,")."));return 0},end(e){let t=e>>>0;if(t>=this.length)throw new DOMException("Failed to execute 'end' on 'TimeRanges': The index provided (".concat(t,") is greater than or equal to the maximum bound (").concat(this.length,")."));return 0}}),Ag=[...Object.values(Am).filter(e=>Am.PLAYSINLINE!==e),...Object.values(Af)];function Av(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}var AE=class extends _2.HTMLElement{static get observedAttributes(){return Ag}attributeChangedCallback(e,t,i){var r,n;switch(e){case Af.MUTED:this.media&&(this.media.muted=null!=i,this.media.defaultMuted=null!=i);return;case Af.VOLUME:{let e=null!=(r=_8(i))?r:1;this.media&&(this.media.volume=e);return}case Af.PLAYBACKRATE:{let e=null!=(n=_8(i))?n:1;this.media&&(this.media.playbackRate=e,this.media.defaultPlaybackRate=e);return}}}play(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.play())?t:Promise.reject()}pause(){var e;null==(e=this.media)||e.pause()}load(){var e;null==(e=this.media)||e.load()}get media(){var e;return null==(e=this.shadowRoot)?void 0:e.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 e,t;return null==(t=null==(e=this.media)?void 0:e.paused)||t}get duration(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.duration)?t:NaN}get ended(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.ended)&&t}get buffered(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.buffered)?t:Ap}get seekable(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.seekable)?t:Ap}get readyState(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.readyState)?t:0}get videoWidth(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoWidth)?t:0}get videoHeight(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.videoHeight)?t:0}get currentSrc(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentSrc)?t:""}get currentTime(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.currentTime)?t:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.volume)?t:1}set volume(e){this.media&&(this.media.volume=Number(e))}get playbackRate(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.playbackRate)?t:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get defaultPlaybackRate(){var e;return null!=(e=_8(this.getAttribute(Af.PLAYBACKRATE)))?e:1}set defaultPlaybackRate(e){null!=e?this.setAttribute(Af.PLAYBACKRATE,"".concat(e)):this.removeAttribute(Af.PLAYBACKRATE)}get crossOrigin(){return Av(this,Am.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(Am.CROSSORIGIN,"".concat(e))}get autoplay(){return null!=Av(this,Am.AUTOPLAY)}set autoplay(e){e?this.setAttribute(Am.AUTOPLAY,"string"==typeof e?e:""):this.removeAttribute(Am.AUTOPLAY)}get loop(){return null!=Av(this,Am.LOOP)}set loop(e){e?this.setAttribute(Am.LOOP,""):this.removeAttribute(Am.LOOP)}get muted(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.muted)&&t}set muted(e){this.media&&(this.media.muted=!!e)}get defaultMuted(){return null!=Av(this,Am.MUTED)}set defaultMuted(e){e?this.setAttribute(Am.MUTED,""):this.removeAttribute(Am.MUTED)}get playsInline(){return null!=Av(this,Am.PLAYSINLINE)}set playsInline(e){Ah("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(e){["","none","metadata","auto"].includes(e)?this.setAttribute(Am.PRELOAD,e):this.removeAttribute(Am.PRELOAD)}constructor(){super()}},Ay=new WeakMap,Ab=class e{set(e){if("function"==typeof e)this.handleEvent=e.bind(this.element);else if("object"==typeof e&&"function"==typeof e.handleEvent)this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let e=Ay.get(this.element);
3e&&e.delete(this.type)}}static for(t){Ay.has(t.element)||Ay.set(t.element,new Map);let i=t.attributeName.slice(2),r=Ay.get(t.element);return r&&r.has(i)?r.get(i):new e(t.element,i)}constructor(e,t){this.element=e,this.type=t,this.element.addEventListener(this.type,this);let i=Ay.get(this.element);i&&i.set(this.type,this)}},AT=new Map,A_=new WeakMap,AA=new WeakMap,AS=class{get template(){if(AT.has(this.stringsKey))return AT.get(this.stringsKey);{let e=_3.createElement("template"),t=this.strings.length-1;return e.innerHTML=this.strings.reduce((e,i,r)=>e+i+(r<t?"{{ ".concat(r," }}"):""),""),AT.set(this.stringsKey,e),e}}renderInto(e){var t;let i=this.template;if(A_.get(e)!==i){A_.set(e,i);let t=new g7(i,this.values,this.processor);AA.set(e,t),e instanceof vo?e.replace(...t.children):e.appendChild(t);return}let r=AA.get(e);null==(t=null==r?void 0:r.update)||t.call(r,this.values)}constructor(e,t,i){this.strings=e,this.values=t,this.processor=i,this.stringsKey=this.strings.join("\x01")}},AR={processCallback(e,t,i){var r;if(i)for(let[e,n]of t)e in i&&function(e,t){(function(e,t){if(e instanceof vs&&t instanceof Element){let i=e.element;return i[e.attributeName]!==t&&(e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),i[e.attributeName]=t),!0}return!1})(e,t)||function(e,t){if("boolean"==typeof t&&e instanceof vs){let i=e.attributeNamespace;return t!==e.element.hasAttributeNS(i,e.attributeName)&&(e.booleanValue=t),!0}return!1}(e,t)||e instanceof vs&&e.attributeName.startsWith("on")&&(Ab.for(e).set(t),e.element.removeAttributeNS(e.attributeNamespace,e.attributeName),1)||!1===t&&e instanceof vo&&(e.replace(""),1)||t instanceof AS&&e instanceof vo&&(t.renderInto(e),1)||t instanceof DocumentFragment&&e instanceof vo&&(t.childNodes.length&&e.replace(...t.childNodes),1)||function(e,t){if(e instanceof vs){let i=e.attributeNamespace,r=e.element.getAttributeNS(i,e.attributeName);return String(t)!==r&&(e.value=String(t))}e.value=String(t)}(e,t)}(n,null!=(r=i[e])?r:"")}};function Ak(e){for(var t=arguments.length,i=Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return new AS(e,i,AR)}var AI=Object.values({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",THUMB:"thumb",DISPLAY:"display",CONTROL_BAR:"control-bar",MENU_BUTTON:"menu-button",MENU:"menu",MENU_ITEM:"menu-item",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"}).join(", "),AL=e=>e.charAt(0).toUpperCase()+e.slice(1),AD=function(e){var t,i;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.muxCode){let n=AL(null!=(t=e.errorCategory)?t:"video"),a=dl(null!=(i=e.errorCategory)?i:da.VIDEO);if(e.muxCode===ds.NETWORK_OFFLINE)return dw("Your device appears to be offline",r);if(e.muxCode===ds.NETWORK_RECONNECTING)return dw("Reconnecting...",r);if(e.muxCode===ds.NETWORK_TOKEN_EXPIRED)return dw("{category} URL has expired",r).format({category:n});if([ds.NETWORK_TOKEN_SUB_MISMATCH,ds.NETWORK_TOKEN_AUD_MISMATCH,ds.NETWORK_TOKEN_AUD_MISSING,ds.NETWORK_TOKEN_MALFORMED].includes(e.muxCode))return dw("{category} URL is formatted incorrectly",r).format({category:n});if(e.muxCode===ds.NETWORK_TOKEN_MISSING)return dw("Invalid {categoryName} URL",r).format({categoryName:a});if(e.muxCode===ds.NETWORK_NOT_FOUND)return dw("{category} does not exist",r).format({category:n});if(e.muxCode===ds.NETWORK_NOT_READY){let t="live"===e.streamType?"Live stream":"Video";return dw("{mediaType} is not currently available",r).format({mediaType:t})}}if(e.code){if(e.code===dd.MEDIA_ERR_NETWORK)return dw("Network Error",r);if(e.code===dd.MEDIA_ERR_DECODE)return dw("Media Error",r);if(e.code===dd.MEDIA_ERR_SRC_NOT_SUPPORTED)return dw("Source Not Supported",r)}return dw("Error",r)},Aw=function(e){var t,i;let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.reload)return'Try again later or <a href="#" data-mux-reload style="color: #4a90e2;">click here to retry</a>';if(e.muxCode){let n=AL(null!=(t=e.errorCategory)?t:"video"),a=dl(null!=(i=e.errorCategory)?i:da.VIDEO);return e.muxCode===ds.NETWORK_OFFLINE?dw("Check your internet connection and try reloading this video.",r):e.muxCode===ds.NETWORK_RECONNECTING?dw("Your connection was interrupted. Attempting to resume playback...",r):e.muxCode===ds.NETWORK_TOKEN_EXPIRED?dw("The video’s secured {tokenNamePrefix}-token has expired.",r).format({tokenNamePrefix:a}):e.muxCode===ds.NETWORK_TOKEN_SUB_MISMATCH?dw("The video’s playback ID does not match the one encoded in the {tokenNamePrefix}-token.",r).format({tokenNamePrefix:a}):e.muxCode===ds.NETWORK_TOKEN_MALFORMED?dw("{category} URL is formatted incorrectly",r).format({category:n}):[ds.NETWORK_TOKEN_AUD_MISMATCH,ds.NETWORK_TOKEN_AUD_MISSING].includes(e.muxCode)?dw("The {tokenNamePrefix}-token is formatted with incorrect information.",r).format({tokenNamePrefix:a}):[ds.NETWORK_TOKEN_MISSING,ds.NETWORK_INVALID_URL].includes(e.muxCode)?dw("The video URL or {tokenNamePrefix}-token are formatted with incorrect or incomplete information.",r).format({tokenNamePrefix:a}):e.muxCode===ds.NETWORK_NOT_FOUND?"":e.message}return e.code&&(e.code===dd.MEDIA_ERR_NETWORK||e.code===dd.MEDIA_ERR_DECODE||e.code===dd.MEDIA_ERR_SRC_NOT_SUPPORTED),e.message},AC=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return{title:AD(e,t).toString(),message:Aw(e,t).toString()}},AM=(e,t)=>{let i=(e=>{if(e.muxCode){if(e.muxCode===ds.NETWORK_TOKEN_EXPIRED)return"403-expired-token.md";if(e.muxCode===ds.NETWORK_TOKEN_MALFORMED)return"403-malformatted-token.md";if([ds.NETWORK_TOKEN_AUD_MISMATCH,ds.NETWORK_TOKEN_AUD_MISSING].includes(e.muxCode))return"403-incorrect-aud-value.md";if(e.muxCode===ds.NETWORK_TOKEN_SUB_MISMATCH)return"403-playback-id-mismatch.md";if(e.muxCode===ds.NETWORK_TOKEN_MISSING)return"missing-signed-tokens.md";if(e.muxCode===ds.NETWORK_NOT_FOUND)return"404-not-found.md";if(e.muxCode===ds.NETWORK_NOT_READY)return"412-not-playable.md"}if(e.code){if(e.code===dd.MEDIA_ERR_NETWORK)return"";if(e.code===dd.MEDIA_ERR_DECODE)return"media-decode-error.md";if(e.code===dd.MEDIA_ERR_SRC_NOT_SUPPORTED)return"media-src-not-supported.md"}return""})(e);return{message:e.message,context:e.context,file:i}},AP=_3.createElement("template");"innerHTML"in AP&&(AP.innerHTML='<template id="media-theme-gerwig">\n  <style>\n    @keyframes pre-play-hide {\n      0% {\n        transform: scale(1);\n        opacity: 1;\n      }\n\n      30% {\n        transform: scale(0.7);\n      }\n\n      100% {\n        transform: scale(1.5);\n        opacity: 0;\n      }\n    }\n\n    :host {\n      --_primary-color: var(--media-primary-color, #fff);\n      --_secondary-color: var(--media-secondary-color, transparent);\n      --_accent-color: var(--media-accent-color, #fa50b5);\n      --_text-color: var(--media-text-color, #000);\n\n      --media-icon-color: var(--_primary-color);\n      --media-control-background: var(--_secondary-color);\n      --media-control-hover-background: var(--_accent-color);\n      --media-time-buffered-color: rgba(255, 255, 255, 0.4);\n      --media-preview-time-text-shadow: none;\n      --media-control-height: 14px;\n      --media-control-padding: 6px;\n      --media-tooltip-container-margin: 6px;\n      --media-tooltip-distance: 18px;\n\n      color: var(--_primary-color);\n      display: inline-block;\n      width: 100%;\n      height: 100%;\n    }\n\n    :host([audio]) {\n      --_secondary-color: var(--media-secondary-color, black);\n      --media-preview-time-text-shadow: none;\n    }\n\n    :host([audio]) ::slotted([slot=\'media\']) {\n      height: 0px;\n    }\n\n    :host([audio]) media-loading-indicator {\n      display: none;\n    }\n\n    :host([audio]) media-controller {\n      background: transparent;\n    }\n\n    :host([audio]) media-controller::part(vertical-layer) {\n      background: transparent;\n    }\n\n    :host([audio]) media-control-bar {\n      width: 100%;\n      background-color: var(--media-control-background);\n    }\n\n    /*\n     * 0.433s is the transition duration for VTT Regions.\n     * Borrowed here, so the captions don\'t move too fast.\n     */\n    media-controller {\n      --media-webkit-text-track-transform: translateY(0) scale(0.98);\n      --media-webkit-text-track-transition: transform 0.433s ease-out 0.3s;\n    }\n    media-controller:is([mediapaused], :not([userinactive])) {\n      --media-webkit-text-track-transform: translateY(-50px) scale(0.98);\n      --media-webkit-text-track-transition: transform 0.15s ease;\n    }\n\n    /*\n     * CSS specific to iOS devices.\n     * See: https://stackoverflow.com/questions/30102792/css-media-query-to-target-only-ios-devices/60220757#60220757\n     */\n    @supports (-webkit-touch-callout: none) {\n      /* Disable subtitle adjusting for iOS Safari */\n      media-controller[mediaisfullscreen] {\n        --media-webkit-text-track-transform: unset;\n        --media-webkit-text-track-transition: unset;\n      }\n    }\n\n    media-time-range {\n      --media-box-padding-left: 6px;\n      --media-box-padding-right: 6px;\n      --media-range-bar-color: var(--_accent-color);\n      --media-time-range-buffered-color: var(--_primary-color);\n      --media-range-track-color: transparent;\n      --media-range-track-background: rgba(255, 255, 255, 0.4);\n      --media-range-thumb-background: radial-gradient(\n        circle,\n        #000 0%,\n        #000 25%,\n        var(--_accent-color) 25%,\n        var(--_accent-color)\n      );\n      --media-range-thumb-width: 12px;\n      --media-range-thumb-height: 12px;\n      --media-range-thumb-transform: scale(0);\n      --media-range-thumb-transition: transform 0.3s;\n      --media-range-thumb-opacity: 1;\n      --media-preview-background: var(--_primary-color);\n      --media-box-arrow-background: var(--_primary-color);
3\n      --media-preview-thumbnail-border: 5px solid var(--_primary-color);\n      --media-preview-border-radius: 5px;\n      --media-text-color: var(--_text-color);\n      --media-control-hover-background: transparent;\n      --media-preview-chapter-text-shadow: none;\n      color: var(--_accent-color);\n      padding: 0 6px;\n    }\n\n    :host([audio]) media-time-range {\n      --media-preview-time-padding: 1.5px 6px;\n      --media-preview-box-margin: 0 0 -5px;\n    }\n\n    media-time-range:hover {\n      --media-range-thumb-transform: scale(1);\n    }\n\n    media-preview-thumbnail {\n      border-bottom-width: 0;\n    }\n\n    [part~=\'menu\'] {\n      border-radius: 2px;\n      border: 1px solid rgba(0, 0, 0, 0.1);\n      bottom: 50px;\n      padding: 2.5px 10px;\n    }\n\n    [part~=\'menu\']::part(indicator) {\n      fill: var(--_accent-color);\n    }\n\n    [part~=\'menu\']::part(menu-item) {\n      box-sizing: border-box;\n      display: flex;\n      align-items: center;\n      padding: 6px 10px;\n      min-height: 34px;\n    }\n\n    [part~=\'menu\']::part(checked) {\n      font-weight: 700;\n    }\n\n    media-captions-menu,\n    media-rendition-menu,\n    media-audio-track-menu,\n    media-playback-rate-menu {\n      position: absolute; /* ensure they don\'t take up space in DOM on load */\n      --media-menu-background: var(--_primary-color);\n      --media-menu-item-checked-background: transparent;\n      --media-text-color: var(--_text-color);\n      --media-menu-item-hover-background: transparent;\n      --media-menu-item-hover-outline: var(--_accent-color) solid 1px;\n    }\n\n    media-rendition-menu {\n      min-width: 140px;\n    }\n\n    /* The icon is a circle so make it 16px high instead of 14px for more balance. */\n    media-audio-track-menu-button {\n      --media-control-padding: 5px;\n      --media-control-height: 16px;\n    }\n\n    media-playback-rate-menu-button {\n      --media-control-padding: 6px 3px;\n      min-width: 4.4ch;\n    }\n\n    media-playback-rate-menu {\n      --media-menu-flex-direction: row;\n      --media-menu-item-checked-background: var(--_accent-color);\n      --media-menu-item-checked-indicator-display: none;\n      margin-right: 6px;\n      padding: 0;\n      --media-menu-gap: 0.25em;\n    }\n\n    media-playback-rate-menu[part~=\'menu\']::part(menu-item) {\n      padding: 6px 6px 6px 8px;\n    }\n\n    media-playback-rate-menu[part~=\'menu\']::part(checked) {\n      color: #fff;\n    }\n\n    :host(:not([audio])) media-time-range {\n      /* Adding px is required here for calc() */\n      --media-range-padding: 0px;\n      background: transparent;\n      z-index: 10;\n      height: 10px;\n      bottom: -3px;\n      width: 100%;\n    }\n\n    media-control-bar :is([role=\'button\'], [role=\'switch\'], button) {\n      line-height: 0;\n    }\n\n    media-control-bar :is([part*=\'button\'], [part*=\'range\'], [part*=\'display\']) {\n      border-radius: 3px;\n    }\n\n    .spacer {\n      flex-grow: 1;\n      background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));\n    }\n\n    media-control-bar[slot~=\'top-chrome\'] {\n      min-height: 42px;\n      pointer-events: none;\n    }\n\n    media-control-bar {\n      --gradient-steps:\n        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%,\n        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%,\n        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%,\n        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%;\n    }\n\n    :host([title]) media-control-bar[slot=\'top-chrome\']::before,\n    :host([videotitle]) media-control-bar[slot=\'top-chrome\']::before {\n      content: \'\';\n      position: absolute;\n      width: 100%;\n      padding-bottom: min(100px, 25%);\n      background: linear-gradient(to top, var(--gradient-steps));\n      opacity: 0.8;\n      pointer-events: none;\n    }\n\n    :host(:not([audio])) media-control-bar[part~=\'bottom\']::before {\n      content: \'\';\n      position: absolute;\n      width: 100%;\n      bottom: 0;\n      left: 0;\n      padding-bottom: min(100px, 25%);\n      background: linear-gradient(to bottom, var(--gradient-steps));\n      opacity: 0.8;\n      z-index: 1;\n      pointer-events: none;\n    }\n\n    media-control-bar[part~=\'bottom\'] > * {\n      z-index: 20;\n    }\n\n    media-control-bar[part~=\'bottom\'] {\n      padding: 6px 6px;\n    }\n\n    media-control-bar[slot~=\'top-chrome\'] > * {\n      --media-control-background: transparent;\n      --media-control-hover-background: transparent;\n      position: relative;\n    }\n\n    media-controller::part(vertical-layer) {\n      transition: background-color 1s;\n    }\n\n    media-controller:is([mediapaused], :not([userinactive]))::part(vertical-layer) {\n      background-color: var(--controls-backdrop-color, var(--controls, transparent));\n      transition: background-color 0.25s;\n    }
3\n\n    .center-controls {\n      --media-button-icon-width: 100%;\n      --media-button-icon-height: auto;\n      --media-tooltip-display: none;\n      pointer-events: none;\n      width: 100%;\n      display: flex;\n      flex-flow: row;\n      align-items: center;\n      justify-content: center;\n      paint-order: stroke;\n      stroke: rgba(102, 102, 102, 1);\n      stroke-width: 0.3px;\n      text-shadow:\n        0 0 2px rgb(0 0 0 / 0.25),\n        0 0 6px rgb(0 0 0 / 0.25);\n      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));\n    }\n\n    .center-controls media-play-button {\n      --media-control-background: transparent;\n      --media-control-hover-background: transparent;\n      --media-control-padding: 0;\n      width: 40px;\n    }\n\n    [breakpointsm] .center-controls media-play-button {\n      width: 90px;\n      height: 90px;\n      border-radius: 50%;\n      transition: background 0.4s;\n      padding: 24px;\n      --media-control-background: #000;\n      --media-control-hover-background: var(--_accent-color);\n    }\n\n    .center-controls media-seek-backward-button,\n    .center-controls media-seek-forward-button {\n      --media-control-background: transparent;\n      --media-control-hover-background: transparent;\n      padding: 0;\n      margin: 0 20px;\n      width: max(33px, min(8%, 40px));\n      text-shadow:\n        0 0 2px rgb(0 0 0 / 0.25),\n        0 0 6px rgb(0 0 0 / 0.25);\n    }\n\n    [breakpointsm]:not([audio]) .center-controls.pre-playback {\n      display: grid;\n      align-items: initial;\n      justify-content: initial;\n      height: 100%;\n      overflow: hidden;\n    }\n\n    [breakpointsm]:not([audio]) .center-controls.pre-playback media-play-button {\n      place-self: var(--_pre-playback-place, center);\n      grid-area: 1 / 1;\n      margin: 16px;\n    }\n\n    /* Show and hide controls or pre-playback state */\n\n    [breakpointsm]:is([mediahasplayed], :not([mediapaused])):not([audio])\n      .center-controls.pre-playback\n      media-play-button {\n      /* Using `forwards` would lead to a laggy UI after the animation got in the end state */\n      animation: 0.3s linear pre-play-hide;\n      opacity: 0;\n      pointer-events: none;\n    }\n\n    .autoplay-unmute {\n      --media-control-hover-background: transparent;\n      width: 100%;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      filter: drop-shadow(0 0 2px rgb(0 0 0 / 0.25)) drop-shadow(0 0 6px rgb(0 0 0 / 0.25));\n    }\n\n    .autoplay-unmute-btn {\n      --media-control-height: 16px;\n      border-radius: 8px;\n      background: #000;\n      color: var(--_primary-color);\n      display: flex;\n      align-items: center;\n      padding: 8px 16px;\n      font-size: 18px;\n      font-weight: 500;\n      cursor: pointer;\n    }\n\n    .autoplay-unmute-btn:hover {\n      background: var(--_accent-color);\n    }\n\n    [breakpointsm] .autoplay-unmute-btn {\n      --media-control-height: 30px;\n      padding: 14px 24px;\n      font-size: 26px;\n    }\n\n    .autoplay-unmute-btn svg {\n      margin: 0 6px 0 0;\n    }\n\n    [breakpointsm] .autoplay-unmute-btn svg {\n      margin: 0 10px 0 0;\n    }\n\n    media-controller:not([audio]):not([mediahasplayed]) *:is(media-control-bar, media-time-range) {\n      display: none;\n    }\n\n    media-error-dialog:not([mediaerrorcode]) {\n      opacity: 0;\n    }\n\n    media-loading-indicator {\n      --media-loading-icon-width: 100%;\n      --media-button-icon-height: auto;\n      display: var(--media-control-display, var(--media-loading-indicator-display, flex));\n      pointer-events: none;\n      position: absolute;\n      width: min(15%, 150px);\n      flex-flow: row;\n      align-items: center;\n      justify-content: center;\n    }\n\n    /* Intentionally don\'t target the div for transition but the children\n     of the div. Prevents messing with media-chrome\'s autohide feature. */\n    media-loading-indicator + div * {\n      transition: opacity 0.15s;\n      opacity: 1;\n    }\n\n    media-loading-indicator[medialoading]:not([mediapaused]) ~ div > * {\n      opacity: 0;\n      transition-delay: 400ms;\n    }\n\n    media-volume-range {\n      width: min(100%, 100px);\n      --media-range-padding-left: 10px;\n      --media-range-padding-right: 10px;\n      --media-range-thumb-width: 12px;\n      --media-range-thumb-height: 12px;\n      --media-range-thumb-background: radial-gradient(\n        circle,\n        #000 0%,\n        #000 25%,\n        var(--_primary-color) 25%,\n        var(--_primary-color)\n      );\n      --media-control-hover-background: none;\n    }\n\n    media-time-display {\n      white-space: nowrap;\n    }\n\n    /* Generic style for explicitly disabled controls */\n    media-control-bar[part~=\'bottom\'] [disabled],\n    media-control-bar[part~=\'bottom\'] [aria-disabled=\'true\'] {\n      opacity: 60%;
3\n      cursor: not-allowed;\n    }\n\n    media-text-display {\n      --media-font-size: 16px;\n      --media-control-padding: 14px;\n      font-weight: 500;\n    }\n\n    media-play-button.animated *:is(g, path) {\n      transition: all 0.3s;\n    }\n\n    media-play-button.animated[mediapaused] .pause-icon-pt1 {\n      opacity: 0;\n    }\n\n    media-play-button.animated[mediapaused] .pause-icon-pt2 {\n      transform-origin: center center;\n      transform: scaleY(0);\n    }\n\n    media-play-button.animated[mediapaused] .play-icon {\n      clip-path: inset(0 0 0 0);\n    }\n\n    media-play-button.animated:not([mediapaused]) .play-icon {\n      clip-path: inset(0 0 0 100%);\n    }\n\n    media-seek-forward-button,\n    media-seek-backward-button {\n      --media-font-weight: 400;\n    }\n\n    .mute-icon {\n      display: inline-block;\n    }\n\n    .mute-icon :is(path, g) {\n      transition: opacity 0.5s;\n    }\n\n    .muted {\n      opacity: 0;\n    }\n\n    media-mute-button[mediavolumelevel=\'low\'] :is(.volume-medium, .volume-high),\n    media-mute-button[mediavolumelevel=\'medium\'] :is(.volume-high) {\n      opacity: 0;\n    }\n\n    media-mute-button[mediavolumelevel=\'off\'] .unmuted {\n      opacity: 0;\n    }\n\n    media-mute-button[mediavolumelevel=\'off\'] .muted {\n      opacity: 1;\n    }\n\n    /**\n     * Our defaults for these buttons are to hide them at small sizes\n     * users can override this with CSS\n     */\n    media-controller:not([breakpointsm]):not([audio]) {\n      --bottom-play-button: none;\n      --bottom-seek-backward-button: none;\n      --bottom-seek-forward-button: none;\n      --bottom-time-display: none;\n      --bottom-playback-rate-menu-button: none;\n      --bottom-pip-button: none;\n    }\n\n    [part=\'mux-badge\'] {\n      position: absolute;\n      bottom: 10px;\n      right: 10px;\n      z-index: 2;\n      opacity: 0.6;\n      transition:\n        opacity 0.2s ease-in-out,\n        bottom 0.2s ease-in-out;\n    }\n\n    [part=\'mux-badge\']:hover {\n      opacity: 1;\n    }\n\n    [part=\'mux-badge\'] a {\n      font-size: 14px;\n      font-family: var(--_font-family);\n      color: var(--_primary-color);\n      text-decoration: none;\n      display: flex;\n      align-items: center;\n      gap: 5px;\n    }\n\n    [part=\'mux-badge\'] .mux-badge-text {\n      transition: opacity 0.5s ease-in-out;\n      opacity: 0;\n    }\n\n    [part=\'mux-badge\'] .mux-badge-logo {\n      width: 40px;\n      height: auto;\n      display: inline-block;\n    }\n\n    [part=\'mux-badge\'] .mux-badge-logo svg {\n      width: 100%;\n      height: 100%;\n      fill: white;\n    }\n\n    media-controller:not([userinactive]):not([mediahasplayed]) [part=\'mux-badge\'],\n    media-controller:not([userinactive]) [part=\'mux-badge\'],\n    media-controller[mediahasplayed][mediapaused] [part=\'mux-badge\'] {\n      transition: bottom 0.1s ease-in-out;\n    }\n\n    media-controller[userinactive]:not([mediapaused]) [part=\'mux-badge\'] {\n      transition: bottom 0.2s ease-in-out 0.62s;\n    }\n\n    media-controller:not([userinactive]) [part=\'mux-badge\'] .mux-badge-text,\n    media-controller[mediahasplayed][mediapaused] [part=\'mux-badge\'] .mux-badge-text {\n      opacity: 1;\n    }\n\n    media-controller[userinactive]:not([mediapaused]) [part=\'mux-badge\'] .mux-badge-text {\n      opacity: 0;\n    }\n\n    media-controller[userinactive]:not([mediapaused]) [part=\'mux-badge\'] {\n      bottom: 10px;\n    }\n\n    media-controller:not([userinactive]):not([mediahasplayed]) [part=\'mux-badge\'] {\n      bottom: 10px;\n    }\n\n    media-controller:not([userinactive])[mediahasplayed] [part=\'mux-badge\'],\n    media-controller[mediahasplayed][mediapaused] [part=\'mux-badge\'] {\n      bottom: calc(28px + var(--media-control-height, 0px) + var(--media-control-padding, 0px) * 2);\n    }\n  </style>\n\n  <template partial="TitleDisplay">\n    <template if="videotitle">\n      <template if="videotitle != true">\n        <media-text-display part="top title display" class="title-display">{{videotitle}}</media-text-display>\n      </template>\n    </template>\n    <template if="!videotitle">\n      <template if="title">\n        <media-text-display part="top title display" class="title-display">{{title}}</media-text-display>\n      </template>\n    </template>\n  </template>\n\n  <template partial="PlayButton">\n    <media-play-button\n      part="{{section ?? \'bottom\'}} play button"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n      class="animated"\n    >\n      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon">\n        <g class="play-icon">\n          <path\n            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"\n          />\n        </g>
3\n        <g class="pause-icon">\n          <path\n            class="pause-icon-pt1"\n            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"\n          />\n          <path\n            class="pause-icon-pt2"\n            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"\n          />\n        </g>\n      </svg>\n    </media-play-button>\n  </template>\n\n  <template partial="PrePlayButton">\n    <media-play-button\n      part="{{section ?? \'center\'}} play button pre-play"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    >\n      <svg aria-hidden="true" viewBox="0 0 18 14" slot="icon" style="transform: translate(3px, 0)">\n        <path\n          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"\n        />\n      </svg>\n    </media-play-button>\n  </template>\n\n  <template partial="SeekBackwardButton">\n    <media-seek-backward-button\n      seekoffset="{{backwardseekoffset}}"\n      part="{{section ?? \'bottom\'}} seek-backward button"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    >\n      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">\n        <path\n          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"\n        />\n        <text transform="translate(6 12)" style="font-size: 14px; font-family: \'ArialMT\', \'Arial\'">\n          {{backwardseekoffset}}\n        </text>\n      </svg>\n    </media-seek-backward-button>\n  </template>\n\n  <template partial="SeekForwardButton">\n    <media-seek-forward-button\n      seekoffset="{{forwardseekoffset}}"\n      part="{{section ?? \'bottom\'}} seek-forward button"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    >\n      <svg viewBox="0 0 22 14" aria-hidden="true" slot="icon">\n        <g>\n          <text transform="translate(-1 12)" style="font-size: 14px; font-family: \'ArialMT\', \'Arial\'">\n            {{forwardseekoffset}}\n          </text>\n          <path\n            d="M18.35 11.9211L21.9136 7.2721C22.0288 7.12188 22.0288 6.87812 21.9136 6.7279L18.35 2.07888C18.2208 
31.91041 18 2.02968 18 2.26787V11.7321C18 11.9703 18.2208 12.0896 18.35 11.9211Z"\n          />\n        </g>\n      </svg>\n    </media-seek-forward-button>\n  </template>\n\n  <template partial="MuteButton">\n    <media-mute-button part="bottom mute button" disabled="{{disabled}}" aria-disabled="{{disabled}}">\n      <svg viewBox="0 0 18 14" slot="icon" class="mute-icon" aria-hidden="true">\n        <g class="unmuted">\n          <path\n            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"\n          />\n          <path\n            class="volume-low"\n            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"\n          />\n          <path\n            class="volume-medium"\n            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"\n          />\n          <path\n            class="volume-high"\n            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"\n          />\n        </g>\n        <g class="muted">\n          <path\n            fill-rule="evenodd"\n            clip-rule="evenodd"\n            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"\n          />\n          <path\n            fill-rule="evenodd"\n            clip-rule="evenodd"\n            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"\n          />\n        </g>\n      </svg>\n    </media-mute-button>\n  </template>\n\n  <template partial="PipButton">\n    <media-pip-button part="bottom pip button" disabled="{{disabled}}" aria-disabled="{{disabled}}">\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n      </svg>\n    </media-pip-button>\n  </template>\n\n  <template partial="CaptionsMenu">\n    <media-captions-menu-button part="bottom captions button">\n      <svg aria-hidden="true" viewBox="0 0 18 14" slot="on">\n        <path\n          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.
3009C3.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"\n        />\n      </svg>\n      <svg aria-hidden="true" viewBox="0 0 18 14" slot="off">\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n      </svg>\n    </media-captions-menu-button>\n    <media-captions-menu\n      hidden\n      anchor="auto"\n      part="bottom captions menu"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n      exportparts="menu-item"\n    >\n      <div slot="checked-indicator">\n        <style>\n          .indicator {\n            position: relative;\n            top: 1px;\n            width: 0.9em;\n            height: auto;\n            fill: var(--_accent-color);\n            margin-right: 5px;\n          }\n\n          [aria-checked=\'false\'] .indicator {\n            display: none;\n          }\n        </style>\n        <svg viewBox="0 0 14 18" class="indicator">\n          <path\n            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"\n            fill-rule="evenodd"\n          />\n        </svg></div\n    ></media-captions-menu>\n  </template>\n\n  <template partial="AirplayButton">\n    <media-airplay-button part="bottom airplay button" disabled="{{disabled}}" aria-disabled="{{disabled}}">\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="icon">\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n      </svg>\n    </media-airplay-button>\n  </template>\n\n  <template partial="FullscreenButton">\n    <media-fullscreen-button part="bottom fullscreen button" disabled="{{disabled}}" aria-disabled="{{disabled}}">\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n        <path\n          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.0153L1
37.9925 9.60498H16.9925Z"\n        />\n        <path\n          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"\n        />\n      </svg>\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n        <path\n          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"\n        />\n      </svg>\n    </media-fullscreen-button>\n  </template>\n\n  <template partial="CastButton">\n    <media-cast-button part="bottom cast button" disabled="{{disabled}}" aria-disabled="{{disabled}}">\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="enter">\n        <path\n          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"\n        />\n      </svg>\n      <svg viewBox="0 0 18 14" aria-hidden="true" slot="exit">\n        <path\n          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"\n        />\n        <path d="M2.15002 5.634C5.18352 6.4207 7.57252 8.8151 8.35282 11.8499H15.8501V2.1499H2.15002V5.634Z" />\n      </svg>\n    </media-cast-button>\n  </template>\n\n  <template partial="LiveButton">\n    <media-live-button part="{{section ?? \'top\'}} live button" disabled="{{disabled}}" aria-disabled="{{disabled}}">
3\n      <span slot="text">Live</span>\n    </media-live-button>\n  </template>\n\n  <template partial="PlaybackRateMenu">\n    <media-playback-rate-menu-button part="bottom playback-rate button"></media-playback-rate-menu-button>\n    <media-playback-rate-menu\n      hidden\n      anchor="auto"\n      rates="{{playbackrates}}"\n      exportparts="menu-item"\n      part="bottom playback-rate menu"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    ></media-playback-rate-menu>\n  </template>\n\n  <template partial="VolumeRange">\n    <media-volume-range\n      part="bottom volume range"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    ></media-volume-range>\n  </template>\n\n  <template partial="TimeDisplay">\n    <media-time-display\n      remaining="{{defaultshowremainingtime}}"\n      showduration="{{!hideduration}}"\n      part="bottom time display"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    ></media-time-display>\n  </template>\n\n  <template partial="TimeRange">\n    <media-time-range part="bottom time range" disabled="{{disabled}}" aria-disabled="{{disabled}}" exportparts="thumb">\n      <media-preview-thumbnail slot="preview"></media-preview-thumbnail>\n      <media-preview-chapter-display slot="preview"></media-preview-chapter-display>\n      <media-preview-time-display slot="preview"></media-preview-time-display>\n      <div slot="preview" part="arrow"></div>\n    </media-time-range>\n  </template>\n\n  <template partial="AudioTrackMenu">\n    <media-audio-track-menu-button part="bottom audio-track button">\n      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 16">\n        <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" />\n        <path\n          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"\n        />\n      </svg>\n    </media-audio-track-menu-button>\n    <media-audio-track-menu\n      hidden\n      anchor="auto"\n      part="bottom audio-track menu"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n      exportparts="menu-item"\n    >\n      <div slot="checked-indicator">\n        <style>\n          .indicator {\n            position: relative;\n            top: 1px;\n            width: 0.9em;\n            height: auto;\n            fill: var(--_accent-color);\n            margin-right: 5px;\n          }\n\n          [aria-checked=\'false\'] .indicator {\n            display: none;\n          }\n        </style>\n        <svg viewBox="0 0 14 18" class="indicator">\n          <path\n            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"\n            fill-rule="evenodd"\n          />\n        </svg>\n      </div>\n    </media-audio-track-menu>\n  </template>\n\n  <template partial="RenditionMenu">\n    <media-rendition-menu-button part="bottom rendition button">\n      <svg aria-hidden="true" slot="icon" viewBox="0 0 18 14">\n        <path\n          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"\n        />\n      </svg>\n    </media-rendition-menu-button>\n    <media-rendition-menu\n      hidden\n      anchor="auto"\n      part="bottom rendition menu"\n      disabled="{{disabled}}"\n      aria-disabled="{{disabled}}"\n    >\n      <div slot="checked-indicator">\n        <style>\n          .indicator {\n            position: relative;\n            top: 1px;\n            width: 0.9em;\n            height: auto;\n            fill: var(--_accent-color);\n            margin-right: 5px;\n          }\n\n          [aria-checked=\'false\'] .indicator {\n            opacity: 0;\n          }\n        </style>\n        <svg viewBox="0 0 14 18" class="indicator">\n          <path\n            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"\n            fill-rule="evenodd"\n          />\n        </svg>\n      </div>\n    </media-rendition-menu>\n  </template>\n\n  <template partial="MuxBadge">\n    <div part="mux-badge">\n      <a href="https://www.mux.com/player" target="_blank">
3\n        <span class="mux-badge-text">Powered by</span>\n        <div class="mux-badge-logo">\n          <svg\n            viewBox="0 0 1600 500"\n            style="fill-rule: evenodd; clip-rule: evenodd; stroke-linejoin: round; stroke-miterlimit: 2"\n          >\n            <g>\n              <path\n                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"\n                style="fill-rule: nonzero"\n              ></path>\n              <path\n                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"\n                style="fill-rule: nonzero"\n              ></path>\n              <path\n                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"\n                style="fill-rule: nonzero"\n              ></path>\n            </g>\n          </svg>\n        </div>\n      </a>\n    </div>\n  </template>\n\n  <media-controller\n    part="controller"\n    defaultstreamtype="{{defaultstreamtype ?? \'on-demand\'}}"\n    breakpoints="sm:470"\n    gesturesdisabled="{{disabled}}"\n    hotkeys="{{hotkeys}}"\n    nohotkeys="{{nohotkeys}}"\n    novolumepref="{{novolumepref}}"\n    audio="{{audio}}"\n    noautoseektolive="{{noautoseektolive}}"\n    defaultsubtitles="{{defaultsubtitles}}"\n    defaultduration="{{defaultduration ?? false}}"\n    keyboardforwardseekoffset="{{forwardseekoffset}}"\n    keyboardbackwardseekoffset="{{backwardseekoffset}}"\n    exportparts="layer, media-layer, poster-layer, vertical-layer, centered-layer, gesture-layer"\n    style="--_pre-playback-place:{{preplaybackplace ?? \'center\'}}"\n  >\n    <slot name="media" slot="media"></slot>\n    <slot name="poster" slot="poster"></slot>\n\n    <media-loading-indicator slot="centered-chrome" noautohide></media-loading-indicator>\n\n    <template if="!audio">\n      <media-error-dialog slot="dialog" noautohide></media-error-dialog>\n      <!-- Pre-playback UI -->\n      <!-- same for both on-demand and live -->\n      <div slot="centered-chrome" class="center-controls pre-playback">\n        <template if="!breakpointsm">{{>PlayButton section="center"}}</template>\n        <template if="breakpointsm">{{>PrePlayButton section="center"}}</template>\n      </div>\n\n      <!-- Mux Badge -->\n      <template if="proudlydisplaymuxbadge"> {{>MuxBadge}} </template>\n\n      <!-- Autoplay centered unmute button -->\n      <!--\n        todo: figure out how show this with available state variables\n        needs to show when:\n        - autoplay is enabled\n        - playback has been successful\n        - audio is muted\n        - in place / instead of the pre-plaback play button\n        - not to show again after user has interacted with this button\n          - OR user has interacted with the mute button in the control bar\n      -->\n      <!--\n        There should be a >MuteButton to the left of the "Unmute" text, but a templating bug\n        makes it appear even if commented out in the markup, add it back when code is un-commented\n      -->\n      <!-- <div slot="centered-chrome" class="autoplay-unmute">\n        <div role="button" class="autoplay-unmute-btn">Unmute</div>\n      </div> -->\n\n      <template if="streamtype == \'on-demand\'">\n        <template if="breakpointsm">\n          <media-control-bar part="control-bar top" slot="top-chrome">{{>TitleDisplay}} </media-control-bar>\n        </template>\n        {{>TimeRange}}\n        <media-control-bar part="control-bar bottom">\n          {{>PlayButton}} {{>SeekBackwardButton}} {{>SeekForwardButton}} {{>TimeDisplay}} {{>MuteButton}}\n          {{>VolumeRange}}\n          <div class="spacer"></div>\n          {{>RenditionMenu}} {{>PlaybackRateMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}}\n          {{>CastButton}} {{>PipButton}} {{>FullscreenButton}}\n        </media-control-bar>\n      </template>\n\n      <template if="streamtype == \'live\'">\n        <media-control-bar part="control-bar top" slot="top-chrome">\n          {{>LiveButton}}\n          <template if="breakpointsm"> {{>TitleDisplay}} </template>\n        </media-control-bar>\n        <template if="targetlivewindow > 0">{{>TimeRange}}</template>\n        <media-control-bar part="control-bar bottom">\n          {{>PlayButton}}\n          <template if="targetlivewindow > 0">{{>SeekBackwardButton}} {{>SeekForwardButton}}</template>\n          {{>MuteButton}} {{>VolumeRange}}\n          <div class="spacer"></div>\n          {{>RenditionMenu}} {{>AudioTrackMenu}} {{>CaptionsMenu}} {{>AirplayButton}} {{>CastButton}} {{>PipButton}}\n          {{>FullscreenButton}}\n        </media-control-bar>\n      </template>\n    </template>\n\n    <template if="audio">\n      <template if="streamtype == \'on-demand\'">\n        <template if="title">\n          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>\n        </template>\n        <media-control-bar part="control-bar bottom">\n          {{>PlayButton}}\n          <template if="breakpointsm"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>\n          {{>MuteButton}}\n          <template if="breakpointsm">{{>VolumeRange}}</template>\n          {{>TimeDisplay}} {{>TimeRange}}\n          <template if="breakpointsm">{{>PlaybackRateMenu}}</template>\n          {{>AirplayButton}} {{>CastButton}}\n        </media-control-bar>\n      </template>\n\n      <template if="streamtype == \'live\'">\n        <template if="title">\n          <media-control-bar part="control-bar top">{{>TitleDisplay}}</media-control-bar>\n        </template>\n        <media-control-bar part="control-bar bottom">\n          {{>PlayButton}} {{>LiveButton section="bottom"}} {{>MuteButton}}\n          <template if="breakpointsm">\n            {{>VolumeRange}}\n            <template if="targetlivewindow > 0"> {{>SeekBackwardButton}} {{>SeekForwardButton}} </template>\n          </template>\n          <template if="targetlivewindow > 0"> {{>TimeDisplay}} {{>TimeRange}} </template>\n          <template if="!targetlivewindow"><div class="spacer"></div></template>\n          {{>AirplayButton}} {{>CastButton}}\n        </media-control-bar>\n      </template>\n    </template>\n\n    <slot></slot>\n  </media-controller>\n</template>\n');var AO,Ax,AN=class extends vL{};AN.template=null==(Ax=null==(AO=AP.content)?void 0:AO.children)?void 0:Ax[0],_2.customElements.get("media-theme-gerwig")||_2.customElements.define("media-theme-gerwig",AN);var AU={SRC:"src",POSTER:"poster"},AF={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
3LAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",FULLSCREEN_ELEMENT:"fullscreen-element",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",NO_MUTED_PREF:"no-muted-pref",CAST_RECEIVER:"cast-receiver",NO_TOOLTIPS:"no-tooltips",PROUDLY_DISPLAY_MUX_BADGE:"proudly-display-mux-badge",DISABLE_PSEUDO_ENDED:"disable-pseudo-ended"},AB=["audio","backwardseekoffset","defaultduration","defaultshowremainingtime","defaultsubtitles","noautoseektolive","disabled","exportparts","forwardseekoffset","hideduration","hotkeys","nohotkeys","playbackrates","defaultstreamtype","streamtype","style","targetlivewindow","template","title","videotitle","novolumepref","nomutedpref","proudlydisplaymuxbadge"],AG=pJ.formatErrorMessage;function AH(e){let t=e.videoTitle?{video_title:e.videoTitle}:{};return e.getAttributeNames().filter(e=>e.startsWith("metadata-")).reduce((t,i)=>{let r=e.getAttribute(i);return null!==r&&(t[i.replace(/^metadata-/,"").replace(/-/g,"_")]=r),t},t)}pJ.formatErrorMessage=e=>{var t,i;if(e instanceof dd){let r=AC(e,!1);return"\n      ".concat(null!=r&&r.title?"<h3>".concat(r.title,"</h3>"):"","\n      ").concat(null!=r&&r.message||null!=r&&r.linkUrl?"<p>\n        ".concat(null==r?void 0:r.message,"\n        ").concat(null!=r&&r.linkUrl?'<a\n              href="'.concat(r.linkUrl,'"\n              target="_blank"\n              rel="external noopener"\n              aria-label="').concat(null!=(t=r.linkText)?t:""," ").concat(dw("(opens in a new window)"),'"\n              >').concat(null!=(i=r.linkText)?i:r.linkUrl,"</a\n            >"):"","\n      </p>"):"","\n    ")}return AG(e)};var AK,AW,AV,Aq,AY,Aj,Az,AQ,AX,AZ,AJ,A$,A0,A1,A2,A3,A4,A5,A8,A6,A9,A7,Se,St,Si=Object.values(hT),Sr=Object.values(AU),Sn=Object.values(AF),Sa=Ar,Ss="mux-player",So={isDialogOpen:!1},Sl={redundant_streams:!0},Sd=class extends AE{static get NAME(){return Ss}static get VERSION(){return Sa}static get observedAttributes(){var e;return[...null!=(e=AE.observedAttributes)?e:[],...Sr,...Si,...Sn]}setAttribute(e,t){super.setAttribute(e,t),e.startsWith("metadata-")&&this.media&&(this.media.metadata=AH(this))}removeAttribute(e){super.removeAttribute(e),e.startsWith("metadata-")&&this.media&&(this.media.metadata=AH(this))}get mediaTheme(){var e;return null==(e=this.shadowRoot)?void 0:e.querySelector("media-theme")}get mediaController(){var e,t;return null==(t=null==(e=this.mediaTheme)?void 0:e.shadowRoot)?void 0:t.querySelector("media-controller")}connectedCallback(){EF(this,A3,A4).call(this);let e=this.media;e&&(e.metadata=AH(this))}disconnectedCallback(){var e,t,i,r,n,a,s,o,l,d;null==(e=Ex(this,Aj))||e.disconnect(),null==(t=this.media)||t.removeEventListener("streamtypechange",Ex(this,Az)),null==(i=this.media)||i.removeEventListener("loadstart",Ex(this,AQ)),this.removeEventListener("error",Ex(this,A2)),this.removeEventListener("click",Ex(this,AZ)),null==(r=this.mediaTheme)||r.removeEventListener("close",Ex(this,AJ)),null==(n=this.mediaTheme)||n.removeEventListener("focusin",Ex(this,A$)),this.media&&(this.media.errorTranslator=void 0),null==(s=null==(a=this.media)?void 0:a.textTracks)||s.removeEventListener("addtrack",Ex(this,AX)),null==(l=null==(o=this.media)?void 0:o.textTracks)||l.removeEventListener("removetrack",Ex(this,AX)),null==(d=Ex(this,A0))||d.call(this),EU(this,A0,void 0),EU(this,AW,!1)}attributeChangedCallback(e,t,i){var r;switch(EF(this,A3,A4).call(this),super.attributeChangedCallback(e,t,i),e){case AF.HOTKEYS:Ex(this,AY).value=i;break;case AF.THUMBNAIL_TIME:null!=i&&this.tokens.thumbnail&&Au(dw("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").toString());break;case AF.THUMBNAIL_TOKEN:if(i){let e=dL(i);if(e){let{aud:t}=e,i=dZ.THUMBNAIL;t!==i&&Au(dw("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:i,tokenNamePrefix:"thumbnail"}))}}break;case AF.STORYBOARD_TOKEN:if(i){let e=dL(i);if(e){let{aud:t}=e,i=dZ.STORYBOARD;t!==i&&Au(dw("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:i,tokenNamePrefix:"storyboard"}))}}break;case AF.DRM_TOKEN:if(i){let e=dL(i);if(e){let{aud:t}=e,i=dZ.DRM;t!==i&&Au(dw("The {tokenNamePrefix}-token has an incorrect aud value: {aud}. aud value should be {expectedAud}.").format({aud:t,expectedAud:i,tokenNamePrefix:"drm"}))}}break;case hT.PLAYBACK_ID:null!=i&&i.includes("?token")&&Ah(dw("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:i}));break;case hT.STREAM_TYPE:i&&![dc.LIVE,dc.ON_DEMAND,dc.UNKNOWN].includes(i)?["ll-live","live:dvr","ll-live:dvr"].includes(this.streamType)?this.targetLiveWindow=i.includes("dvr")?1/0:0:Ac({file:"invalid-stream-type.md",message:dw("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand` or `live`").format({streamType:this.streamType})}):i===dc.LIVE?null==this.getAttribute(AF.TARGET_LIVE_WINDOW)&&(this.targetLiveWindow=0):this.targetLiveWindow=NaN;break;case AF.FULLSCREEN_ELEMENT:if(null!=i||i!==t){let e=_3.getElementById(i),t=null==e?void 0:e.querySelector("mux-player");this.mediaController&&e&&t&&(this.mediaController.fullscreenElement=e)}break;case hT.CAP_RENDITION_TO_PLAYER_SIZE:(null==i||i!==t)&&(this.capRenditionToPlayerSize=null!=i||void 0);break;case hT.MAX_RECONNECT_RETRIES:(null==i||i!==t)&&(this.maxReconnectRetries=Number(i))}[hT.PLAYBACK_ID,AU.SRC,AF.PLAYBACK_TOKEN].includes(e)&&t!==i&&EU(this,A1,{...Ex(this,A1),...So}
3),EF(this,A3,A6).call(this,{[null!=(r=Ao[e])?r:_5(e)]:i})}async requestFullscreen(e){var t;if(!(!this.mediaController||this.mediaController.hasAttribute(mr.MEDIA_IS_FULLSCREEN)))return null==(t=this.mediaController)||t.dispatchEvent(new _2.CustomEvent(c7.MEDIA_ENTER_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var i;null==(i=this.mediaController)||i.addEventListener(mn.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}async exitFullscreen(){var e;if(!(!this.mediaController||!this.mediaController.hasAttribute(mr.MEDIA_IS_FULLSCREEN)))return null==(e=this.mediaController)||e.dispatchEvent(new _2.CustomEvent(c7.MEDIA_EXIT_FULLSCREEN_REQUEST,{composed:!0,bubbles:!0})),new Promise((e,t)=>{var i;null==(i=this.mediaController)||i.addEventListener(mn.MEDIA_IS_FULLSCREEN,()=>e(),{once:!0})})}get preferCmcd(){var e;return null!=(e=this.getAttribute(hT.PREFER_CMCD))?e:void 0}set preferCmcd(e){e!==this.preferCmcd&&(e?dp.includes(e)?this.setAttribute(hT.PREFER_CMCD,e):Au("Invalid value for preferCmcd. Must be one of ".concat(dp.join())):this.removeAttribute(hT.PREFER_CMCD))}get hasPlayed(){var e,t;return null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(mr.MEDIA_HAS_P
3LAYED))&&t}get inLiveWindow(){var e;return null==(e=this.mediaController)?void 0:e.hasAttribute(mr.MEDIA_TIME_IS_LIVE)}get _hls(){var e;return null==(e=this.media)?void 0:e._hls}get mux(){var e;return null==(e=this.media)?void 0:e.mux}get theme(){var e;return null!=(e=this.getAttribute(AF.THEME))?e:"gerwig"}set theme(e){this.setAttribute(AF.THEME,"".concat(e))}get themeProps(){let e=this.mediaTheme;if(!e)return;let t={};for(let i of e.getAttributeNames()){if(AB.includes(i))continue;let r=e.getAttribute(i);t[_5(i)]=""===r||r}return t}set themeProps(e){var t,i;EF(this,A3,A4).call(this);let r={...this.themeProps,...e};for(let n in r){if(AB.includes(n))continue;let r=null==e?void 0:e[n];"boolean"==typeof r||null==r?null==(t=this.mediaTheme)||t.toggleAttribute(_4(n),!!r):null==(i=this.mediaTheme)||i.setAttribute(_4(n),r)}}get playbackId(){var e;return null!=(e=this.getAttribute(hT.PLAYBACK_ID))?e:void 0}set playbackId(e){e?this.setAttribute(hT.PLAYBACK_ID,e):this.removeAttribute(hT.PLAYBACK_ID)}get src(){var e,t;return this.playbackId?null!=(e=Su(this,AU.SRC))?e:void 0:null!=(t=this.getAttribute(AU.SRC))?t:void 0}set src(e){e?this.setAttribute(AU.SRC,e):this.removeAttribute(AU.SRC)}get poster(){var e;let t=this.getAttribute(AU.POSTER);if(null!=t)return t;let{tokens:i}=this;return i.playback&&!i.thumbnail?void Au("Missing expected thumbnail token. No poster image will be shown"):this.playbackId&&!this.audio?An(this.playbackId,{customDomain:this.customDomain,thumbnailTime:null!=(e=this.thumbnailTime)?e:this.startTime,programTime:this.programStartTime,token:i.thumbnail}):void 0}set poster(e){e||""===e?this.setAttribute(AU.POSTER,e):this.removeAttribute(AU.POSTER)}get storyboardSrc(){var e;return null!=(e=this.getAttribute(AF.STORYBOARD_SRC))?e:void 0}set storyboardSrc(e){e?this.setAttribute(AF.STORYBOARD_SRC,e):this.removeAttribute(AF.STORYBOARD_SRC)}get storyboard(){let{tokens:e}=this;return this.storyboardSrc&&!e.storyboard?this.storyboardSrc:this.audio||!this.playbackId||!this.streamType||[dc.LIVE,dc.UNKNOWN].includes(this.streamType)||e.playback&&!e.storyboard?void 0:Aa(this.playbackId,{customDomain:this.customDomain,token:e.storyboard,programStartTime:this.programStartTime,programEndTime:this.programEndTime})}get audio(){return this.hasAttribute(AF.AUDIO)}set audio(e){if(!e)return void this.removeAttribute(AF.AUDIO);this.setAttribute(AF.AUDIO,"")}get hotkeys(){return Ex(this,AY)}get nohotkeys(){return this.hasAttribute(AF.NOHOTKEYS)}set nohotkeys(e){if(!e)return void this.removeAttribute(AF.NOHOTKEYS);this.setAttribute(AF.NOHOTKEYS,"")}get thumbnailTime(){return _8(this.getAttribute(AF.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(AF.THUMBNAIL_TIME,"".concat(e))}get videoTitle(){var e,t;return null!=(t=null!=(e=this.getAttribute(AF.VIDEO_TITLE))?e:this.getAttribute(AF.TITLE))?t:""}set videoTitle(e){e!==this.videoTitle&&(e?this.setAttribute(AF.VIDEO_TITLE,e):this.removeAttribute(AF.VIDEO_TITLE))}get placeholder(){var e;return null!=(e=Su(this,AF.PLACEHOLDER))?e:""}set placeholder(e){this.setAttribute(AF.PLACEHOLDER,"".concat(e))}get primaryColor(){var e,t;let i=this.getAttribute(AF.PRIMARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=_2.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_primary-color"))?void 0:t.trim()))return i}set primaryColor(e){this.setAttribute(AF.PRIMARY_COLOR,"".concat(e))}get secondaryColor(){var e,t;let i=this.getAttribute(AF.SECONDARY_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=_2.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_secondary-color"))?void 0:t.trim()))return i}set secondaryColor(e){this.setAttribute(AF.SECONDARY_COLOR,"".concat(e))}get accentColor(){var e,t;let i=this.getAttribute(AF.ACCENT_COLOR);if(null!=i||this.mediaTheme&&(i=null==(t=null==(e=_2.getComputedStyle(this.mediaTheme))?void 0:e.getPropertyValue("--_accent-color"))?void 0:t.trim()))return i}set accentColor(e){this.setAttribute(AF.ACCENT_COLOR,"".concat(e))}get defaultShowRemainingTime(){return this.hasAttribute(AF.DEFAULT_SHOW_REMAINING_TIME)}set defaultShowRemainingTime(e){e?this.setAttribute(AF.DEFAULT_SHOW_REMAINING_TIME,""):this.removeAttribute(AF.DEFAULT_SHOW_REMAINING_TIME)}get playbackRates(){if(this.hasAttribute(AF.PLAYBACK_RATES))return this.getAttribute(AF.PLAYBACK_RATES).trim().split(/\s*,?\s+/).map(e=>Number(e)).filter(e=>!Number.isNaN(e)).sort((e,t)=>
3e-t)}set playbackRates(e){if(!e)return void this.removeAttribute(AF.PLAYBACK_RATES);this.setAttribute(AF.PLAYBACK_RATES,e.join(" "))}get forwardSeekOffset(){var e;return null!=(e=_8(this.getAttribute(AF.FORWARD_SEEK_OFFSET)))?e:10}set forwardSeekOffset(e){this.setAttribute(AF.FORWARD_SEEK_OFFSET,"".concat(e))}get backwardSeekOffset(){var e;return null!=(e=_8(this.getAttribute(AF.BACKWARD_SEEK_OFFSET)))?e:10}set backwardSeekOffset(e){this.setAttribute(AF.BACKWARD_SEEK_OFFSET,"".concat(e))}get defaultHiddenCaptions(){return this.hasAttribute(AF.DEFAULT_HIDDEN_CAPTIONS)}set defaultHiddenCaptions(e){e?this.setAttribute(AF.DEFAULT_HIDDEN_CAPTIONS,""):this.removeAttribute(AF.DEFAULT_HIDDEN_CAPTIONS)}get defaultDuration(){return _8(this.getAttribute(AF.DEFAULT_DURATION))}set defaultDuration(e){null==e?this.removeAttribute(AF.DEFAULT_DURATION):this.setAttribute(AF.DEFAULT_DURATION,"".concat(e))}get playerInitTime(){return this.hasAttribute(hT.PLAYER_INIT_TIME)?_8(this.getAttribute(hT.PLAYER_INIT_TIME)):Ex(this,AK)}set playerInitTime(e){e!=this.playerInitTime&&(null==e?this.removeAttribute(hT.PLAYER_INIT_TIME):this.setAttribute(hT.PLAYER_INIT_TIME,"".concat(+e)))}get playerSoftwareName(){var e;return null!=(e=this.getAttribute(hT.PLAYER_SOFTWARE_NAME))?e:Ss}get playerSoftwareVersion(){var e;return null!=(e=this.getAttribute(hT.PLAYER_SOFTWARE_VERSION))?e:Sa}get beaconCollectionDomain(){var e;return null!=(e=this.getAttribute(hT.BEACON_COLLECTION_DOMAIN))?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(hT.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(hT.BEACON_COLLECTION_DOMAIN))}get maxResolution(){var e;return null!=(e=this.getAttribute(hT.MAX_RESOLUTION))?e:void 0}set maxResolution(e){e!==this.maxResolution&&(e?this.setAttribute(hT.MAX_RESOLUTION,e):this.removeAttribute(hT.MAX_RESOLUTION))}get minResolution(){var e;return null!=(e=this.getAttribute(hT.MIN_RESOLUTION))?e:void 0}set minResolution(e){e!==this.minResolution&&(e?this.setAttribute(hT.MIN_RESOLUTION,e):this.removeAttribute(hT.MIN_RESOLUTION))}get maxAutoResolution(){var e;return null!=(e=this.getAttribute(hT.MAX_AUTO_RESOLUTION))?e:void 0}set maxAutoResolution(e){null==e?this.removeAttribute(hT.MAX_AUTO_RESOLUTION):this.setAttribute(hT.MAX_AUTO_RESOLUTION,e)}get renditionOrder(){var e;return null!=(e=this.getAttribute(hT.RENDITION_ORDER))?e:void 0}set renditionOrder(e){e!==this.renditionOrder&&(e?this.setAttribute(hT.RENDITION_ORDER,e):this.removeAttribute(hT.RENDITION_ORDER))}get programStartTime(){return _8(this.getAttribute(hT.PROGRAM_START_TIME))}set programStartTime(e){null==e?this.removeAttribute(hT.PROGRAM_START_TIME):this.setAttribute(hT.PROGRAM_START_TIME,"".concat(e))}get programEndTime(){return _8(this.getAttribute(hT.PROGRAM_END_TIME))}set programEndTime(e){null==e?this.removeAttribute(hT.PROGRAM_END_TIME):this.setAttribute(hT.PROGRAM_END_TIME,"".concat(e))}get assetStartTime(){return _8(this.getAttribute(hT.ASSET_START_TIME))}set assetStartTime(e){null==e?this.removeAttribute(hT.ASSET_START_TIME):this.setAttribute(hT.ASSET_START_TIME,"".concat(e))}get assetEndTime(){return _8(this.getAttribute(hT.ASSET_END_TIME))}set assetEndTime(e){null==e?this.removeAttribute(hT.ASSET_END_TIME):this.setAttribute(hT.ASSET_END_TIME,"".concat(e))}get extraSourceParams(){return this.hasAttribute(AF.EXTRA_SOURCE_PARAMS)?[...new URLSearchParams(this.getAttribute(AF.EXTRA_SOURCE_PARAMS)).entries()].reduce((e,t)=>{let[i,r]=t;return e[i]=r,e},{}):Sl}set extraSourceParams(e){null==e?this.removeAttribute(AF.EXTRA_SOURCE_PARAMS):this.setAttribute(AF.EXTRA_SOURCE_PARAMS,new URLSearchParams(e).toString())}get customDomain(){var e;return null!=(e=this.getAttribute(hT.CUSTOM_DOMAIN))?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(hT.CUSTOM_DOMAIN,e):this.removeAttribute(hT.CUSTOM_DOMAIN))}get envKey(){var e;return null!=(e=Su(this,hT.ENV_KEY))?e:void 0}set envKey(e){this.setAttribute(hT.ENV_KEY,"".concat(e))}get noVolumePref(){return this.hasAttribute(AF.NO_VOLUME_PREF)}set noVolumePref(e){e?this.setAttribute(AF.NO_VOLUME_PREF,""):this.removeAttribute(AF.NO_VOLUME_PREF)}get noMutedPref(){return this.hasAttribute(AF.NO_MUTED_PREF)}set noMutedPref(e){e?this.setAttribute(AF.NO_MUTED_PREF,""):this.removeAttribute(AF.NO_MUTED_PREF)}get debug(){return null!=Su(this,hT.DEBUG)}set debug(e){e?this.setAttribute(hT.DEBUG,""):this.removeAttribute(hT.DEBUG)}get disableTracking(){return null!=Su(this,hT.DISABLE_TRACKING)}set disableTracking(e){this.toggleAttribute(hT.DISABLE_TRACKING,!!e)}get disableCookies(){return null!=Su(this,hT.DISABLE_COOKIES)}set disableCookies(e){e?this.setAttribute(hT.DISABLE_COOKIES,""):this.removeAttribute(hT.DISABLE_COOKIES)}get streamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(hT.STREAM_TYPE))?t:null==(e=this.media)?void 0:e.streamType)?i:dc.UNKNOWN}set streamType(e){this.setAttribute(hT.STREAM_TYPE,"".concat(e))}get defaultStreamType(){var e,t,i;return null!=(i=null!=(t=this.getAttribute(AF.DEFAULT_STREAM_TYPE))?t:null==(e=this.mediaController)?void 0:e.getAttribute(AF.DEFAULT_STREAM_TYPE))?i:dc.ON_DEMAND}set defaultStreamType(e){e?this.setAttribute(AF.DEFAULT_STREAM_TYPE,e):this.removeAttribute(AF.DEFAULT_STREAM_TYPE)}get targetLiveWindow(){var e,t;return this.hasAttribute(AF.TARGET_LIVE_WINDOW)?+this.getAttribute(AF.TARGET_LIVE_WINDOW):null!=(t=null==(e=this.media)?void 0:e.targetLiveWindow)?t:NaN}
3set targetLiveWindow(e){e==this.targetLiveWindow||Number.isNaN(e)&&Number.isNaN(this.targetLiveWindow)||(null==e?this.removeAttribute(AF.TARGET_LIVE_WINDOW):this.setAttribute(AF.TARGET_LIVE_WINDOW,"".concat(+e)))}get liveEdgeStart(){var e;return null==(e=this.media)?void 0:e.liveEdgeStart}get startTime(){return _8(Su(this,hT.START_TIME))}set startTime(e){this.setAttribute(hT.START_TIME,"".concat(e))}get initialBandwidthEstimateKbps(){return _8(Su(this,hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS))}set initialBandwidthEstimateKbps(e){null==e?this.removeAttribute(hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS):this.setAttribute(hT.INITIAL_BANDWIDTH_ESTIMATE_KBPS,"".concat(e))}get initialEstimateSegments(){return _8(Su(this,hT.INITIAL_ESTIMATE_SEGMENTS))}set initialEstimateSegments(e){null==e?this.removeAttribute(hT.INITIAL_ESTIMATE_SEGMENTS):this.setAttribute(hT.INITIAL_ESTIMATE_SEGMENTS,"".concat(e))}get minPreloadSegments(){return _8(Su(this,hT.MIN_PRELOAD_SEGMENTS))}set minPreloadSegments(e){null==e?this.removeAttribute(hT.MIN_PRELOAD_SEGMENTS):this.setAttribute(hT.MIN_PRELOAD_SEGMENTS,"".concat(e))}get preferPlayback(){let e=this.getAttribute(hT.PREFER_PLAYBACK);if(e===dm.MSE||e===dm.NATIVE)return e}set preferPlayback(e){e!==this.preferPlayback&&(e===dm.MSE||e===dm.NATIVE?this.setAttribute(hT.PREFER_PLAYBACK,e):this.removeAttribute(hT.PREFER_PLAYBACK))}get metadata(){var e;return null==(e=this.media)?void 0:e.metadata}set metadata(e){if(EF(this,A3,A4).call(this),!this.media)return void Ah("underlying media element missing when trying to set metadata. metadata will not be set.");this.media.metadata={...AH(this),...e}}get _hlsConfig(){var e;return null==(e=this.media)?void 0:e._hlsConfig}set _hlsConfig(e){if(EF(this,A3,A4).call(this),!this.media)return void Ah("underlying media element missing when trying to set _hlsConfig. _hlsConfig will not be set.");this.media._hlsConfig=e}async addCuePoints(e){var t;return(EF(this,A3,A4).call(this),this.media)?null==(t=this.media)?void 0:t.addCuePoints(e):void Ah("underlying media element missing when trying to addCuePoints. cuePoints will not be added.")}get activeCuePoint(){var e;return null==(e=this.media)?void 0:e.activeCuePoint}get cuePoints(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.cuePoints)?t:[]}addChapters(e){var t;return(EF(this,A3,A4).call(this),this.media)?null==(t=this.media)?void 0:t.addChapters(e):void Ah("underlying media element missing when trying to addChapters. chapters will not be added.")}get activeChapter(){var e;return null==(e=this.media)?void 0:e.activeChapter}get chapters(){var e,t;return null!=(t=null==(e=this.media)?void 0:e.chapters)?t:[]}getStartDate(){var e;return null==(e=this.media)?void 0:e.getStartDate()}get currentPdt(){var e;return null==(e=this.media)?void 0:e.currentPdt}get tokens(){let e=this.getAttribute(AF.PLAYBACK_TOKEN),t=this.getAttribute(AF.DRM_TOKEN),i=this.getAttribute(AF.THUMBNAIL_TOKEN),r=this.getAttribute(AF.STORYBOARD_TOKEN);return{...Ex(this,AV),...null!=e?{playback:e}:{},...null!=t?{drm:t}:{},...null!=i?{thumbnail:i}:{},...null!=r?{storyboard:r}:{}}}set tokens(e){EU(this,AV,null!=e?e:{})}get playbackToken(){var e;return null!=(e=this.getAttribute(AF.PLAYBACK_TOKEN))?e:void 0}set playbackToken(e){this.setAttribute(AF.PLAYBACK_TOKEN,"".concat(e))}get drmToken(){var e;return null!=(e=this.getAttribute(AF.DRM_TOKEN))?e:void 0}set drmToken(e){this.setAttribute(AF.DRM_TOKEN,"".concat(e))}get thumbnailToken(){var e;return null!=(e=this.getAttribute(AF.THUMBNAIL_TOKEN))?e:void 0}set thumbnailToken(e){this.setAttribute(AF.THUMBNAIL_TOKEN,"".concat(e))}get storyboardToken(){var e;return null!=(e=this.getAttribute(AF.STORYBOARD_TOKEN))?e:void 0}set storyboardToken(e){this.setAttribute(AF.STORYBOARD_TOKEN,"".concat(e))}addTextTrack(e,t,i,r){var n;let a=null==(n=this.media)?void 0:n.nativeEl;if(a)return dN(a,e,t,i,r)}removeTextTrack(e){var t;let i=null==(t=this.media)?void 0:t.nativeEl;if(i){let t;return void(null==(t=Array.prototype.find.call(i.querySelectorAll("track"),t=>t.track===e))||t.remove())}}get textTracks(){var e;return null==(e=this.media)?void 0:e.textTracks}get castReceiver(){var e;return null!=(e=this.getAttribute(AF.CAST_RECEIVER))?e:void 0}set castReceiver(e){e!==this.castReceiver&&(e?this.setAttribute(AF.CAST_RECEIVER,e):this.removeAttribute(AF.CAST_RECEIVER))}get castCustomData(){var e;return null==(e=this.media)?void 0:e.castCustomData}set castCustomData(e){if(!this.media)return void Ah("underlying media element missing when trying to set castCustomData. castCustomData will not be set.");this.media.castCustomData=e}get noTooltips(){return this.hasAttribute(AF.NO_TOOLTIPS)}set noTooltips(e){if(!e)return void this.removeAttribute(AF.NO_TOOLTIPS);this.setAttribute(AF.NO_TOOLTIPS,"")}get proudlyDisplayMuxBadge(){return this.hasAttribute(AF.PROUDLY_DISPLAY_MUX_BADGE)}set proudlyDisplayMuxBadge(e){e?this.setAttribute(AF.PROUDLY_DISPLAY_MUX_BADGE,""):this.removeAttribute(AF.PROUDLY_DISPLAY_MUX_BADGE)}get capRenditionToPlayerSize(){var e;return null==(e=this.media)?void 0:e.capRenditionToPlayerSize}set capRenditionToPlayerSize(e){if(!this.media)return void Ah("underlying media element missing when trying to set capRenditionToPlayerSize");this.media.capRenditionToPlayerSize=e}get maxReconnectRetries(){var e;return null==(e=this.media)?void 0:e.maxReconnectRetries}set maxReconnectRetries(e){if(!this.media)return void Ah("underlying media element missing when trying to set maxReconnectRetries");this.media.maxReconnectRetries=e}constructor(){super(),EN(this,A3),EN(this,AK),EN(this,AW,!1),EN(this,AV,{}),EN(this,Aq,!0),EN(this,AY,new Al(this,"hotkeys")),EN(this,Aj),EN(this,Az,()=>
3EF(this,A3,A6).call(this)),EN(this,AQ,()=>EF(this,A3,A6).call(this)),EN(this,AX,()=>EF(this,A3,A6).call(this)),EN(this,AZ,e=>{e.composedPath().find(e=>{var t;return null==(t=null==e?void 0:e.hasAttribute)?void 0:t.call(e,"data-mux-reload")})&&(e.preventDefault(),window.location.reload())}),EN(this,AJ,e=>{var t;(null==(t=e.composedPath()[0])?void 0:t.localName)==="media-error-dialog"&&EF(this,A3,A8).call(this,{isDialogOpen:!1})}),EN(this,A$,e=>{var t;(null==(t=e.composedPath()[0])?void 0:t.localName)==="media-error-dialog"&&(At(this,_3.activeElement)||e.preventDefault())}),EN(this,A0),EN(this,A1,{...So}),EN(this,A2,e=>{var t;let i=null==(t=this.media)?void 0:t.error;if(!(i instanceof dd)){let{message:e,code:t}=null!=i?i:{};i=new dd(e,t)}if(!(null!=i&&i.fatal)){Au(i),i.data&&Au("".concat(i.name," data:"),i.data);return}let r=AM(i,!1);r.message&&Ac(r),Ah(i),i.data&&Ah("".concat(i.name," data:"),i.data),EF(this,A3,A8).call(this,{isDialogOpen:!0})}),EU(this,AK,uc()),this.attachShadow({mode:"open"}),EF(this,A3,A5).call(this),this.isConnected&&EF(this,A3,A4).call(this)}};function Su(e,t){return e.media?e.media.getAttribute(t):e.getAttribute(t)}AK=new WeakMap,AW=new WeakMap,AV=new WeakMap,Aq=new WeakMap,AY=new WeakMap,Aj=new WeakMap,Az=new WeakMap,AQ=new WeakMap,AX=new WeakMap,AZ=new WeakMap,AJ=new WeakMap,A$=new WeakMap,A0=new WeakMap,A1=new WeakMap,A2=new WeakMap,A3=new WeakSet,A4=function(){var e,t,i,r;if(!Ex(this,AW)){EU(this,AW,!0),EF(this,A3,A6).call(this);try{if(customElements.upgrade(this.mediaTheme),!(this.mediaTheme instanceof _2.HTMLElement))throw""}catch(e){Ah("<media-theme> failed to upgrade!")}try{customElements.upgrade(this.media)}catch(e){Ah("underlying media element failed to upgrade!")}try{if(customElements.upgrade(this.mediaController),!(this.mediaController instanceof f4))throw""}catch(e){Ah("<media-controller> failed to upgrade!")}EF(this,A3,A9).call(this),EF(this,A3,A7).call(this),EF(this,A3,Se).call(this),EU(this,Aq,null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(fo.USER_INACTIVE))||t),EF(this,A3,St).call(this),null==(i=this.media)||i.addEventListener("streamtypechange",Ex(this,Az)),null==(r=this.media)||r.addEventListener("loadstart",Ex(this,AQ)),this.media&&(this.media.metadata=AH(this))}},A5=function(){var e,t;try{null==(e=null==window?void 0:window.CSS)||e.registerProperty({name:"--media-primary-color",syntax:"<color>",inherits:!0}),null==(t=null==window?void 0:window.CSS)||t.registerProperty({name:"--media-secondary-color",syntax:"<color>",inherits:!0})}catch(e){}},A8=function(e){Object.assign(Ex(this,A1),e),EF(this,A3,A6).call(this)},A6=function(){var e,t,i,r,n,a,s,o,l,d,u,h,c,m,f,p,g,v,E,y,b,T,A,S,R,k,I,L,D,w,C,M,P,O,x,N,U,F,B,G,H,K,W,V,q,Y,j,z,Q,X;let Z,J,$=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e={...Ex(this,A1),...$},Z={src:!this.playbackId&&this.src,playbackId:this.playbackId,hasSrc:!!this.playbackId||!!this.src||!!this.currentSrc,poster:this.poster,storyboard:(null==(t=this.media)?void 0:t.currentSrc)&&this.storyboard,storyboardSrc:this.getAttribute(AF.STORYBOARD_SRC),fullscreenElement:this.getAttribute(AF.FULLSCREEN_ELEMENT),placeholder:this.getAttribute("placeholder"),themeTemplate:function(e){var t,i;let r=e.theme;if(r){let n=null==(i=null==(t=e.getRootNode())?void 0:t.getElementById)?void 0:i.call(t,r);
3if(n&&n instanceof HTMLTemplateElement)return n;r.startsWith("media-theme-")||(r="media-theme-".concat(r));let a=_2.customElements.get(r);if(null!=a&&a.template)return a.template}}(this),thumbnailTime:!this.tokens.thumbnail&&this.thumbnailTime,autoplay:this.autoplay,crossOrigin:this.crossOrigin,loop:this.loop,noHotKeys:this.hasAttribute(AF.NOHOTKEYS),hotKeys:this.getAttribute(AF.HOTKEYS),muted:this.muted,paused:this.paused,preload:this.preload,envKey:this.envKey,preferCmcd:this.preferCmcd,debug:this.debug,disableTracking:this.disableTracking,disableCookies:this.disableCookies,tokens:this.tokens,beaconCollectionDomain:this.beaconCollectionDomain,maxResolution:this.maxResolution,minResolution:this.minResolution,maxAutoResolution:this.maxAutoResolution,programStartTime:this.programStartTime,programEndTime:this.programEndTime,assetStartTime:this.assetStartTime,assetEndTime:this.assetEndTime,renditionOrder:this.renditionOrder,metadata:this.metadata,playerInitTime:this.playerInitTime,playerSoftwareName:this.playerSoftwareName,playerSoftwareVersion:this.playerSoftwareVersion,startTime:this.startTime,initialBandwidthEstimateKbps:this.initialBandwidthEstimateKbps,initialEstimateSegments:this.initialEstimateSegments,minPreloadSegments:this.minPreloadSegments,preferPlayback:this.preferPlayback,audio:this.audio,defaultStreamType:this.defaultStreamType,targetLiveWindow:this.getAttribute(hT.TARGET_LIVE_WINDOW),streamType:As(this.getAttribute(hT.STREAM_TYPE)),primaryColor:this.getAttribute(AF.PRIMARY_COLOR),secondaryColor:this.getAttribute(AF.SECONDARY_COLOR),accentColor:this.getAttribute(AF.ACCENT_COLOR),forwardSeekOffset:this.forwardSeekOffset,backwardSeekOffset:this.backwardSeekOffset,defaultHiddenCaptions:this.defaultHiddenCaptions,defaultDuration:this.defaultDuration,defaultShowRemainingTime:this.defaultShowRemainingTime,hideDuration:(J=null==(n=this.mediaController)?void 0:n.querySelector("media-time-display"))&&"none"===getComputedStyle(J).getPropertyValue("--media-duration-display-display").trim(),playbackRates:this.getAttribute(AF.PLAYBACK_RATES),customDomain:null!=(i=this.getAttribute(hT.CUSTOM_DOMAIN))?i:void 0,title:this.getAttribute(AF.TITLE),videoTitle:null!=(r=this.getAttribute(AF.VIDEO_TITLE))?r:this.getAttribute(AF.TITLE),novolumepref:this.hasAttribute(AF.NO_VOLUME_PREF),nomutedpref:this.hasAttribute(AF.NO_MUTED_PREF),proudlyDisplayMuxBadge:this.hasAttribute(AF.PROUDLY_DISPLAY_MUX_BADGE),castReceiver:this.castReceiver,disablePseudoEnded:this.hasAttribute(AF.DISABLE_PSEUDO_ENDED),maxReconnectRetries:this.maxReconnectRetries,capRenditionToPlayerSize:this.capRenditionToPlayerSize,...e,extraSourceParams:this.extraSourceParams},a=Ak(ED(),(e=>{let{tokens:t}=e;return t.drm?":host(:not([cast-receiver])) { --_cast-button-drm-display: none; }":""})(Z),":host {\n  --media-control-display: var(--controls);\n  --media-loading-indicator-display: var(--loading-indicator);\n  --media-dialog-display: var(--dialog);\n  --media-play-button-display: var(--play-button);\n  --media-live-button-display: var(--live-button);\n  --media-seek-backward-button-display: var(--seek-backward-button);\n  --media-seek-forward-button-display: var(--seek-forward-button);\n  --media-mute-button-display: var(--mute-button);\n  --media-captions-button-display: var(--captions-button);\n  --media-captions-menu-button-display: var(--captions-menu-button, var(--media-captions-button-display));\n  --media-rendition-menu-button-display: var(--rendition-menu-button);\n  --media-audio-track-menu-button-display: var(--audio-track-menu-button);\n  --media-airplay-button-display: var(--airplay-button);\n  --media-pip-button-display: var(--pip-button);\n  --media-fullscreen-button-display: var(--fullscreen-button);\n  --media-cast-button-display: var(--cast-button, var(--_cast-button-drm-display));\n  --media-playback-rate-button-display: var(--playback-rate-button);\n  --media-playback-rate-menu-button-display: var(--playback-rate-menu-button);\n  --media-volume-range-display: var(--volume-range);\n  --media-time-range-display: var(--time-range);\n  --media-time-display-display: var(--time-display);\n  --media-duration-display-display: var(--duration-display);\n  --media-title-display-display: var(--title-display);\n\n  display: inline-block;\n  line-height: 0;\n  width: 100%;\n}\n\na {\n  color: #fff;\n  font-size: 0.9em;\n  text-decoration: underline;\n}\n\nmedia-theme {\n  display: inline-block;\n  line-height: 0;\n  width: 100%;\n  height: 100%;\n  direction: ltr;\n}\n\nmedia-poster-image {\n  display: inline-block;\n  line-height: 0;\n  width: 100%;\n  height: 100%;\n}\n\nmedia-poster-image:not([src]):not([placeholdersrc]) {\n  display: none;\n}
3\n\n::part(top),\n[part~='top'] {\n  --media-control-display: var(--controls, var(--top-controls));\n  --media-play-button-display: var(--play-button, var(--top-play-button));\n  --media-live-button-display: var(--live-button, var(--top-live-button));\n  --media-seek-backward-button-display: var(--seek-backward-button, var(--top-seek-backward-button));\n  --media-seek-forward-button-display: var(--seek-forward-button, var(--top-seek-forward-button));\n  --media-mute-button-display: var(--mute-button, var(--top-mute-button));\n  --media-captions-button-display: var(--captions-button, var(--top-captions-button));\n  --media-captions-menu-button-display: var(\n    --captions-menu-button,\n    var(--media-captions-button-display, var(--top-captions-menu-button))\n  );\n  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--top-rendition-menu-button));\n  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--top-audio-track-menu-button));\n  --media-airplay-button-display: var(--airplay-button, var(--top-airplay-button));\n  --media-pip-button-display: var(--pip-button, var(--top-pip-button));\n  --media-fullscreen-button-display: var(--fullscreen-button, var(--top-fullscreen-button));\n  --media-cast-button-display: var(--cast-button, var(--top-cast-button, var(--_cast-button-drm-display)));\n  --media-playback-rate-button-display: var(--playback-rate-button, var(--top-playback-rate-button));\n  --media-playback-rate-menu-button-display: var(\n    --captions-menu-button,\n    var(--media-playback-rate-button-display, var(--top-playback-rate-menu-button))\n  );\n  --media-volume-range-display: var(--volume-range, var(--top-volume-range));\n  --media-time-range-display: var(--time-range, var(--top-time-range));\n  --media-time-display-display: var(--time-display, var(--top-time-display));\n  --media-duration-display-display: var(--duration-display, var(--top-duration-display));\n  --media-title-display-display: var(--title-display, var(--top-title-display));\n}\n\n::part(center),\n[part~='center'] {\n  --media-control-display: var(--controls, var(--center-controls));\n  --media-play-button-display: var(--play-button, var(--center-play-button));\n  --media-live-button-display: var(--live-button, var(--center-live-button));\n  --media-seek-backward-button-display: var(--seek-backward-button, var(--center-seek-backward-button));\n  --media-seek-forward-button-display: var(--seek-forward-button, var(--center-seek-forward-button));\n  --media-mute-button-display: var(--mute-button, var(--center-mute-button));\n  --media-captions-button-display: var(--captions-button, var(--center-captions-button));\n  --media-captions-menu-button-display: var(\n    --captions-menu-button,\n    var(--media-captions-button-display, var(--center-captions-menu-button))\n  );\n  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--center-rendition-menu-button));\n  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--center-audio-track-menu-button));\n  --media-airplay-button-display: var(--airplay-button, var(--center-airplay-button));\n  --media-pip-button-display: var(--pip-button, var(--center-pip-button));\n  --media-fullscreen-button-display: var(--fullscreen-button, var(--center-fullscreen-button));\n  --media-cast-button-display: var(--cast-button, var(--center-cast-button, var(--_cast-button-drm-display)));\n  --media-playback-rate-button-display: var(--playback-rate-button, var(--center-playback-rate-button));\n  --media-playback-rate-menu-button-display: var(\n    --playback-rate-menu-button,\n    var(--media-playback-rate-button-display, var(--center-playback-rate-menu-button))\n  );\n  --media-volume-range-display: var(--volume-range, var(--center-volume-range));\n  --media-time-range-display: var(--time-range, var(--center-time-range));\n  --media-time-display-display: var(--time-display, var(--center-time-display));\n  --media-duration-display-display: var(--duration-display, var(--center-duration-display));\n}\n\n::part(bottom),\n[part~='bottom'] {\n  --media-control-display: var(--controls, var(--bottom-control
3s));\n  --media-play-button-display: var(--play-button, var(--bottom-play-button));\n  --media-live-button-display: var(--live-button, var(--bottom-live-button));\n  --media-seek-backward-button-display: var(--seek-backward-button, var(--bottom-seek-backward-button));\n  --media-seek-forward-button-display: var(--seek-forward-button, var(--bottom-seek-forward-button));\n  --media-mute-button-display: var(--mute-button, var(--bottom-mute-button));\n  --media-captions-button-display: var(--captions-button, var(--bottom-captions-button));\n  --media-captions-menu-button-display: var(\n    --captions-menu-button,\n    var(--media-captions-button-display, var(--bottom-captions-menu-button))\n  );\n  --media-rendition-menu-button-display: var(--rendition-menu-button, var(--bottom-rendition-menu-button));\n  --media-audio-track-menu-button-display: var(--audio-track-menu-button, var(--bottom-audio-track-menu-button));\n  --media-airplay-button-display: var(--airplay-button, var(--bottom-airplay-button));\n  --media-pip-button-display: var(--pip-button, var(--bottom-pip-button));\n  --media-fullscreen-button-display: var(--fullscreen-button, var(--bottom-fullscreen-button));\n  --media-cast-button-display: var(--cast-button, var(--bottom-cast-button, var(--_cast-button-drm-display)));\n  --media-playback-rate-button-display: var(--playback-rate-button, var(--bottom-playback-rate-button));\n  --media-playback-rate-menu-button-display: var(\n    --playback-rate-menu-button,\n    var(--media-playback-rate-button-display, var(--bottom-playback-rate-menu-button))\n  );\n  --media-volume-range-display: var(--volume-range, var(--bottom-volume-range));\n  --media-time-range-display: var(--time-range, var(--bottom-time-range));\n  --media-time-display-display: var(--time-display, var(--bottom-time-display));\n  --media-duration-display-display: var(--duration-display, var(--bottom-duration-display));\n  --media-title-display-display: var(--title-display, var(--bottom-title-display));\n}\n\n:host([no-tooltips]) {\n  --media-tooltip-display: none;\n}\n",(o=Z,Ak(EM(),o.themeTemplate||!1,null!=(l=o.defaultStreamType)&&l,(e=>{let t=e.hotKeys?"".concat(e.hotKeys):"";return"live"===As(e.streamType)&&(t+=" noarrowleft noarrowright"),t})(o)||!1,o.noHotKeys||!o.hasSrc||!1,!!(null!=(d=o.streamType)&&d.includes(dc.LIVE))&&0!==o.targetLiveWindow,o.novolumepref||!1,o.nomutedpref||!1,!o.hasSrc||o.isDialogOpen,null!=(u=o.audio)&&u,null!=(h=function(e){let t="";return Object.entries(e).forEach(e=>{let[i,r]=e;null!=r&&(t+="".concat(_4(i),": ").concat(r,"; "))}),t?t.trim():void 0}({"--media-primary-color":o.primaryColor,"--media-secondary-color":o.secondaryColor,"--media-accent-color":o.accentColor}))&&h,!o.defaultHiddenCaptions,null!=(c=o.forwardSeekOffset)&&c,null!=(m=o.backwardSeekOffset)&&m,null!=(f=o.playbackRates)&&f,null!=(p=o.defaultShowRemainingTime)&&p,null!=(g=o.defaultDuration)&&g,null!=(v=o.hideDuration)&&v,null!=(E=o.title)&&E,null!=(y=o.videoTitle)&&y,null!=(b=o.proudlyDisplayMuxBadge)&&b,AI,null!=(T=o.noHotKeys)&&T,null!=(A=o.targetLiveWindow)&&A,null!=(S=As(o.streamType))&&S,null!=(R=o.crossOrigin)?R:"",null!=(k=o.autoplay)&&k,null!=(I=o.muted)&&I,null!=(L=o.loop)&&L,null!=(D=o.preload)&&D,null!=(w=o.debug)&&w,null!=(C=o.preferCmcd)&&C,null!=(M=o.disableTracking)&&M,null!=(P=o.disableCookies)&&P,null!=(O=o.preferPlayback)&&O,null!=o.startTime&&o.startTime,null!=o.initialBandwidthEstimateKbps&&o.initialBandwidthEstimateKbps,null!=o.initialEstimateSegments&&o.initialEstimateSegments,null!=o.minPreloadSegments&&o.minPreloadSegments,null!=(x=o.beaconCollectionDomain)&&x,null!=(N=o.playerInitTime)&&N,null!=(U=o.playerSoftwareName)&&U,null!=(F=o.playerSoftwareVersion)&&F,null!=(B=o.envKey)&&B,null!=(G=o.customDomain)&&G,o.src?o.src:!!o.playbackId&&uf(o),o.src?o.src:!!o.playbackId&&uf(o),null!=(H=o.castReceiver)&&H,null!=(W=null==(K=o.tokens)?void 0:K.drm)&&W,null!=(q=null==(V=o.tokens)?void 0:V.playback)&&q,null!=(Y=o.disablePseudoEnded)&&Y,null!=(j=o.maxReconnectRetries)&&j,null!=(z=o.maxAutoResolution)&&z,null!=(Q=o.capRenditionToPlayerSize)&&Q,o.storyboard?Ak(Ew(),o.storyboard):Ak(EC()),!!o.poster&&o.poster,null!=(X=o.placeholder)&&X))),s=this.shadowRoot,a.renderInto(s)},A9=function(){let e=e=>{var t,i;if(!(null!=e&&e.startsWith("theme-")))return;let r=e.replace(/^theme-/,"");if(AB.includes(r))return;let n=this.getAttribute(e);null!=n?null==(t=this.mediaTheme)||t.setAttribute(r,n):null==(i=this.mediaTheme)||i.removeAttribute(r)};EU(this,Aj,new MutationObserver(t=>{for(let{attributeName:i}of t)e(i)})),Ex(this,Aj).observe(this,{attributes:!0}
3),this.getAttributeNames().forEach(e)},A7=function(){var e,t,i=this;this.addEventListener("error",Ex(this,A2)),this.addEventListener("click",Ex(this,AZ)),null==(e=this.mediaTheme)||e.addEventListener("close",Ex(this,AJ)),null==(t=this.mediaTheme)||t.addEventListener("focusin",Ex(this,A$)),this.media&&(this.media.errorTranslator=function(){var e,t,r;let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!((null==(e=i.media)?void 0:e.error)instanceof dd))return n;let a=AM(null==(t=i.media)?void 0:t.error,!1);return{player_error_code:null==(r=i.media)?void 0:r.error.code,player_error_message:a.message?String(a.message):n.player_error_message,player_error_context:a.context?String(a.context):n.player_error_context}})},Se=function(){var e,t,i,r;null==(t=null==(e=this.media)?void 0:e.textTracks)||t.addEventListener("addtrack",Ex(this,AX)),null==(r=null==(i=this.media)?void 0:i.textTracks)||r.addEventListener("removetrack",Ex(this,AX))},St=function(){var e,t,i=this;if(!/Firefox/i.test(navigator.userAgent))return;let r,n=new WeakMap,a=()=>this.streamType===dc.LIVE&&!this.secondaryColor&&this.offsetWidth>=800,s=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];a()||Array.from(e&&e.activeCues||[]).forEach(e=>{if(!(!e.snapToLines||e.line<-5||e.line>=0&&e.line<10))if(!t||i.paused){let t=e.text.split("\n").length,a=-3;i.streamType===dc.LIVE&&(a=-2);let s=a-t;if(e.line===s&&!r)return;n.has(e)||n.set(e,e.line),e.line=s}else setTimeout(()=>{e.line=n.get(e)||"auto"},500)})},o=()=>{var e,t;s(r,null!=(t=null==(e=this.mediaController)?void 0:e.hasAttribute(fo.USER_INACTIVE))&&t)},l=()=>{var e,t;let i=Array.from((null==(t=null==(e=this.mediaController)?void 0:e.media)?void 0:t.textTracks)||[]).filter(e=>["subtitles","captions"].includes(e.kind)&&"showing"===e.mode)[0];i!==r&&(null==r||r.removeEventListener("cuechange",o)),null==(r=i)||r.addEventListener("cuechange",o),s(r,Ex(this,Aq))};l(),null==(e=this.textTracks)||e.addEventListener("change",l),null==(t=this.textTracks)||t.addEventListener("addtrack",l);let d=()=>{var e,t;let i=null==(t=null==(e=this.mediaController)?void 0:e.hasAttribute(fo.USER_INACTIVE))||t;Ex(this,Aq)!==i&&(EU(this,Aq,i),s(r,Ex(this,Aq)))};this.addEventListener("userinactivechange",d),EU(this,A0,()=>{var e,t;null==r||r.removeEventListener("cuechange",o),null==(e=this.textTracks)||e.removeEventListener("change",l),null==(t=this.textTracks)||t.removeEventListener("addtrack",l),this.removeEventListener("userinactivechange",d)})};var Sh=Sd,Sc=e=>{throw TypeError(e)},Sm=(e,t,i)=>t.has(e)||Sc("Cannot "+i),Sf=class{addEventListener(){}removeEventListener(){}dispatchEvent(e){return!0}};"undefined"==typeof DocumentFragment&&(globalThis.DocumentFragment=class extends Sf{});var Sp,Sg=class extends Sf{},Sv=class{get detail(){let e,t;return Sm(this,e=Sp,"read from private field"),t?t.call(this):e.get(this)}initCustomEvent(){}constructor(e,t={}){((e,t,i)=>t.has(e)?Sc("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i))(this,Sp),((e,t,i,r)=>(Sm(e,t,"write to private field"),r?r.call(e,i):t.set(e,i)))(this,Sp,null==t?void 0:t.detail)}};Sp=new WeakMap;var SE={document:{createElement:function(e,t){return new Sg}},DocumentFragment,customElements:{get(e){},define(e,t,i){},getName:e=>null,upgrade(e){},whenDefined:e=>Promise.resolve(Sg)},CustomEvent:Sv,EventTarget:Sf,HTMLElement:Sg,HTMLVideoElement:class extends Sf{}},Sy="undefined"==typeof window||void 0===globalThis.customElements,Sb=Sy?SE:globalThis;Sy?SE.document:globalThis.document,Sb.customElements.get("mux-player")||(Sb.customElements.define("mux-player",Sh),Sb.MuxPlayerElement=Sh),e.i(645583);var ST=parseInt(h.default.version)>=19,S_={className:"class",classname:"class",htmlFor:"for",crossOrigin:"crossorigin",viewBox:"viewBox",playsInline:"playsinline",autoPlay:"autoplay",playbackRate:"playbackrate"},SA=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{ref:t,...i}=e;return Object.entries(i).reduce((e,t)=>{let[i,r]=t,n=((e,t)=>{if(!(!ST&&"boolean"==typeof t&&!t)){let i,r;if(i=e,null!=(r=S_)&&i in r)return S_[e];if(void 0!==t)return/[A-Z]/.test(e)?e.replace(/[A-Z]/g,e=>"-".concat(e.toLowerCase())):e}})(i,r);if(!n)return e;let a=ST||"boolean"!=typeof r?r:"";return e[n]=a,e},{})};function SS(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}var SR=Object.prototype.hasOwnProperty,Sk=(e,t,i)=>!((e,t)=>{if(Object.is(e,t))return!0;
3if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(Array.isArray(e))return!!Array.isArray(t)&&e.length===t.length&&e.some((e,i)=>t[i]===e);let i=Object.keys(e),r=Object.keys(t);if(i.length!==r.length)return!1;for(let r=0;r<i.length;r++)if(!SR.call(t,i[r])||!Object.is(e[i[r]],t[i[r]]))return!1;return!0})(t,e[i]),SI=(e,t,i)=>{e[i]=t},SL=function(e,t,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:SI,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:Sk;return(0,h.useEffect)(()=>{let a=null==i?void 0:i.current;a&&n(a,t,e)&&r(a,t,e)},[null==i?void 0:i.current,t])},SD=(()=>{try{return"3.13.4"}catch(e){}return"UNKNOWN"})(),Sw=(e,t,i)=>(0,h.useEffect)(()=>{let r=null==t?void 0:t.current;if(r&&i)return r.addEventListener(e,i),()=>{r.removeEventListener(e,i)}},[null==t?void 0:t.current,i,e]),SC=h.default.forwardRef((e,t)=>{let{children:i,...r}=e;return h.default.createElement("mux-player",{suppressHydrationWarning:!0,...SA(r),ref:t},i)}),SM=h.default.forwardRef((e,t)=>{var i;let r=(0,h.useRef)(null),n=function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return h.useCallback(function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return e=>{let i=!1,r=t.map(t=>{let r=SS(t,e);return i||"function"!=typeof r||(i=!0),r});if(i)return()=>{for(let e=0;e<r.length;e++){let i=r[e];"function"==typeof i?i():SS(t[e],null)}}}}(...t),t)}(r,t),[a]=((e,t)=>{var i;let{onAbort:r,onCanPlay:n,onCanPlayThrough:a,onEmptied:s,onLoadStart:o,onLoadedData:l,onLoadedMetadata:d,onProgress:u,onDurationChange:h,onVolumeChange:c,onRateChange:m,onResize:f,onWaiting:p,onPlay:g,onPlaying:v,onTimeUpdate:E,onPause:y,onSeeking:b,onSeeked:T,onStalled:A,onSuspend:S,onEnded:R,onError:k,onCuePointChange:I,onChapterChange:L,metadata:D,tokens:w,paused:C,playbackId:M,playbackRates:P,currentTime:O,themeProps:x,extraSourceParams:N,castCustomData:U,_hlsConfig:F,...B}=t;return SL("tokens",w,e),SL("playbackId",M,e),SL("playbackRates",P,e),SL("metadata",D,e),SL("disableCookies",null!=(i=t.disableCookies)&&i,e),SL("extraSourceParams",N,e),SL("_hlsConfig",F,e),SL("themeProps",x,e),SL("castCustomData",U,e),SL("paused",C,e,(e,t)=>{null!=t&&(t?e.pause():e.play())},(e,t,i)=>(!e.hasAttribute("autoplay")||!!e.hasPlayed)&&Sk(e,t,i)),SL("currentTime",O,e,(e,t)=>{null!=t&&(e.currentTime=t)}),Sw("abort",e,r),Sw("canplay",e,n),Sw("canplaythrough",e,a),Sw("emptied",e,s),Sw("loadstart",e,o),Sw("loadeddata",e,l),Sw("loadedmetadata",e,d),Sw("progress",e,u),Sw("durationchange",e,h),Sw("volumechange",e,c),Sw("ratechange",e,m),Sw("resize",e,f),Sw("waiting",e,p),Sw("play",e,g),Sw("playing",e,v),Sw("timeupdate",e,E),Sw("pause",e,y),Sw("seeking",e,b),Sw("seeked",e,T),Sw("stalled",e,A),Sw("suspend",e,S),Sw("ended",e,R),Sw("error",e,k),Sw("cuepointchange",e,I),Sw("chapterchange",e,L),[B]})(r,e),[s]=(0,h.useState)(null!=(i=e.playerInitTime)?i:uc());return h.default.createElement(SC,{ref:n,defaultHiddenCaptions:e.defaultHiddenCaptions,playerSoftwareName:"mux-player-react",playerSoftwareVersion:SD,playerInitTime:s,...a})})}]);
4
5//# sourceMappingURL=d0673596dc836d18.js.map
6//# debugId=47db62e5-2bc5-5508-8db2-f7922bb83859

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.