UNPKG

mediaquad-video-component

Version:

1 lines 431 kB
(function(De,I){typeof exports=="object"&&typeof module<"u"?I(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],I):(De=typeof globalThis<"u"?globalThis:De||self,I(De.ViewerPlugin={},De.vue))})(this,function(De,I){"use strict";var Hi={mounted:function(n,e){var t=60,i=n.closest('div[data="root"]');i||(i=n);var s=i.getBoundingClientRect(),r=s.width+s.left,a=s.left,o=e.value;n.classList.add("tooltip"),n.setAttribute("tabindex","0");function l(){var u=document.createElement("span");u.textContent=o,u.setAttribute("id","tooltip"),n.appendChild(u);var d=u.getBoundingClientRect();if(d.right>r){var h=d.right-r+10;u.style.transform="translateX(-".concat(h,"px)")}else if(d.left<a){var g=Math.abs(d.left)+10;u.style.transform="translateX(".concat(g,"px)")}u.style.bottom="".concat(t,"px"),n.addEventListener("mouseleave",c),n.addEventListener("blur",c),n.removeEventListener("mouseenter",l),n.removeEventListener("focus",l)}function c(){var u=n.querySelector("#tooltip");u&&n.removeChild(u),n.removeEventListener("mouseleave",c),n.removeEventListener("blur",c),n.addEventListener("mouseenter",l),n.addEventListener("focus",l)}n.addEventListener("mouseenter",l),n.addEventListener("focus",l)}};function nr(n,e,t,i){function s(r){return r instanceof t?r:new t(function(a){a(r)})}return new(t||(t=Promise))(function(r,a){function o(u){try{c(i.next(u))}catch(d){a(d)}}function l(u){try{c(i.throw(u))}catch(d){a(d)}}function c(u){u.done?r(u.value):s(u.value).then(o,l)}c((i=i.apply(n,e||[])).next())})}function rr(n,e){var t={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,s,r,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=o(0),a.throw=o(1),a.return=o(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(t=0)),t;)try{if(i=1,s&&(r=c[0]&2?s.return:c[0]?s.throw||((r=s.return)&&r.call(s),0):s.next)&&!(r=r.call(s,c[1])).done)return r;switch(s=0,r&&(c=[c[0]&2,r.value]),c[0]){case 0:case 1:r=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,s=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(r=t.trys,!(r=r.length>0&&r[r.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!r||c[1]>r[0]&&c[1]<r[3])){t.label=c[1];break}if(c[0]===6&&t.label<r[1]){t.label=r[1],r=c;break}if(r&&t.label<r[2]){t.label=r[2],t.ops.push(c);break}r[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(n,t)}catch(u){c=[6,u],s=0}finally{i=r=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}typeof SuppressedError=="function"&&SuppressedError;function ar(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Wi={exports:{}};(function(n,e){(function(t){var i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,c,u){if(u=u||{},l=l.trim(),c=c.trim(),!c){if(!u.alwaysNormalize)return l;var d=o.parseURL(l);if(!d)throw new Error("Error trying to parse base URL.");return d.path=o.normalizePath(d.path),o.buildURLFromParts(d)}var h=o.parseURL(c);if(!h)throw new Error("Error trying to parse relative URL.");if(h.scheme)return u.alwaysNormalize?(h.path=o.normalizePath(h.path),o.buildURLFromParts(h)):c;var g=o.parseURL(l);if(!g)throw new Error("Error trying to parse base URL.");if(!g.netLoc&&g.path&&g.path[0]!=="/"){var f=s.exec(g.path);g.netLoc=f[1],g.path=f[2]}g.netLoc&&!g.path&&(g.path="/");var m={scheme:g.scheme,netLoc:h.netLoc,path:null,params:h.params,query:h.query,fragment:h.fragment};if(!h.netLoc&&(m.netLoc=g.netLoc,h.path[0]!=="/"))if(!h.path)m.path=g.path,h.params||(m.params=g.params,h.query||(m.query=g.query));else{var y=g.path,E=y.substring(0,y.lastIndexOf("/")+1)+h.path;m.path=o.normalizePath(E)}return m.path===null&&(m.path=u.alwaysNormalize?o.normalizePath(h.path):h.path),o.buildURLFromParts(m)},parseURL:function(l){var c=i.exec(l);return c?{scheme:c[1]||"",netLoc:c[2]||"",path:c[3]||"",params:c[4]||"",query:c[5]||"",fragment:c[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(r,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};n.exports=o})()})(Wi);var Gt=Wi.exports;function Yi(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(n,s).enumerable})),t.push.apply(t,i)}return t}function re(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Yi(Object(t),!0).forEach(function(i){cr(n,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):Yi(Object(t)).forEach(function(i){Object.defineProperty(n,i,Object.getOwnPropertyDescriptor(t,i))})}return n}function or(n,e){if(typeof n!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var i=t.call(n,e||"default");if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function lr(n){var e=or(n,"string");return typeof e=="symbol"?e:String(e)}function cr(n,e,t){return e=lr(e),e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ie(){return ie=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},ie.apply(this,arguments)}const M=Number.isFinite||function(n){return typeof n=="number"&&isFinite(n)},ur=Number.isSafeInteger||function(n){return typeof n=="number"&&Math.abs(n)<=dr},dr=Number.MAX_SAFE_INTEGER||9007199254740991;let p=function(n){return n.MEDIA_ATTACHING="hlsMediaAttaching",n.MEDIA_ATTACHED="hlsMediaAttached",n.MEDIA_DETACHING="hlsMediaDetaching",n.MEDIA_DETACHED="hlsMediaDetached",n.BUFFER_RESET="hlsBufferReset",n.BUFFER_CODECS="hlsBufferCodecs",n.BUFFER_CREATED="hlsBufferCreated",n.BUFFER_APPENDING="hlsBufferAppending",n.BUFFER_APPENDED="hlsBufferAppended",n.BUFFER_EOS="hlsBufferEos",n.BUFFER_FLUSHING="hlsBufferFlushing",n.BUFFER_FLUSHED="hlsBufferFlushed",n.MANIFEST_LOADING="hlsManifestLoading",n.MANIFEST_LOADED="hlsManifestLoaded",n.MANIFEST_PARSED="hlsManifestParsed",n.LEVEL_SWITCHING="hlsLevelSwitching",n.LEVEL_SWITCHED="hlsLevelSwitched",n.LEVEL_LOADING="hlsLevelLoading",n.LEVEL_LOADED="hlsLevelLoaded",n.LEVEL_UPDATED="hlsLevelUpdated",n.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",n.LEVELS_UPDATED="hlsLevelsUpdated",n.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",n.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",n.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",n.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",n.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",n.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",n.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",n.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",n.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",n.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",n.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",n.CUES_PARSED="hlsCuesParsed",n.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",n.INIT_PTS_FOUND="hlsInitPtsFound",n.FRAG_LOADING="hlsFragLoading",n.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",n.FRAG_LOADED="hlsFragLoaded",n.FRAG_DECRYPTED="hlsFragDecrypted",n.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",n.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",n.FRAG_PARSING_METADATA="hlsFragParsingMetadata",n.FRAG_PARSED="hlsFragParsed",n.FRAG_BUFFERED="hlsFragBuffered",n.FRAG_CHANGED="hlsFragChanged",n.FPS_DROP="hlsFpsDrop",n.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",n.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",n.ERROR="hlsError",n.DESTROYING="hlsDestroying",n.KEY_LOADING="hlsKeyLoading",n.KEY_LOADED="hlsKeyLoaded",n.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",n.BACK_BUFFER_REACHED="hlsBackBufferReached",n.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",n}({}),G=function(n){return n.NETWORK_ERROR="networkError",n.MEDIA_ERROR="mediaError",n.KEY_SYSTEM_ERROR="keySystemError",n.MUX_ERROR="muxError",n.OTHER_ERROR="otherError",n}({}),v=function(n){return n.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",n.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",n.KEY_SYSTEM_NO_SESSION="keySystemNoSession",n.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",n.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",n.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",n.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",n.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",n.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",n.MANIFEST_LOAD_ERROR="manifestLoadError",n.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",n.MANIFEST_PARSING_ERROR="manifestParsingError",n.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",n.LEVEL_EMPTY_ERROR="levelEmptyError",n.LEVEL_LOAD_ERROR="levelLoadError",n.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",n.LEVEL_PARSING_ERROR="levelParsingError",n.LEVEL_SWITCH_ERROR="levelSwitchError",n.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",n.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",n.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",n.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",n.FRAG_LOAD_ERROR="fragLoadError",n.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",n.FRAG_DECRYPT_ERROR="fragDecryptError",n.FRAG_PARSING_ERROR="fragParsingError",n.FRAG_GAP="fragGap",n.REMUX_ALLOC_ERROR="remuxAllocError",n.KEY_LOAD_ERROR="keyLoadError",n.KEY_LOAD_TIMEOUT="keyLoadTimeOut",n.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",n.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",n.BUFFER_APPEND_ERROR="bufferAppendError",n.BUFFER_APPENDING_ERROR="bufferAppendingError",n.BUFFER_STALLED_ERROR="bufferStalledError",n.BUFFER_FULL_ERROR="bufferFullError",n.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",n.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",n.INTERNAL_EXCEPTION="internalException",n.INTERNAL_ABORTED="aborted",n.UNKNOWN="unknown",n}({});const Me=function(){},Vt={trace:Me,debug:Me,log:Me,warn:Me,info:Me,error:Me};let Ze=Vt;function hr(n){const e=self.console[n];return e?e.bind(self.console,`[${n}] >`):Me}function fr(n,...e){e.forEach(function(t){Ze[t]=n[t]?n[t].bind(n):hr(t)})}function gr(n,e){if(typeof console=="object"&&n===!0||typeof n=="object"){fr(n,"debug","log","info","warn","error");try{Ze.log(`Debug logs enabled for "${e}" in hls.js version 1.5.19`)}catch{Ze=Vt}}else Ze=Vt}const L=Ze,mr=/^(\d+)x(\d+)$/,qi=/(.+?)=(".*?"|.*?)(?:,|$)/g;class te{constructor(e){typeof e=="string"&&(e=te.parseAttrList(e)),ie(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t}hexadecimalInteger(e){if(this[e]){let t=(this[e]||"0x").slice(2);t=(t.length&1?"0":"")+t;const i=new Uint8Array(t.length/2);for(let s=0;s<t.length/2;s++)i[s]=parseInt(t.slice(s*2,s*2+2),16);return i}else return null}hexadecimalIntegerAsNumber(e){const t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,t){const i=this[e];return i?parseFloat(i):t}enumeratedString(e){return this[e]}bool(e){return this[e]==="YES"}decimalResolution(e){const t=mr.exec(this[e]);if(t!==null)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}}static parseAttrList(e){let t;const i={},s='"';for(qi.lastIndex=0;(t=qi.exec(e))!==null;){let r=t[2];r.indexOf(s)===0&&r.lastIndexOf(s)===r.length-1&&(r=r.slice(1,-1));const a=t[1].trim();i[a]=r}return i}}function pr(n){return n!=="ID"&&n!=="CLASS"&&n!=="START-DATE"&&n!=="DURATION"&&n!=="END-DATE"&&n!=="END-ON-NEXT"}function yr(n){return n==="SCTE35-OUT"||n==="SCTE35-IN"}class zi{constructor(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){const i=t.attr;for(const s in i)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]!==i[s]){L.warn(`DATERANGE tag attribute: "${s}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=s;break}e=ie(new te({}),i,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=new Date(this.attr["END-DATE"]);M(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const e=this.duration;return e!==null?new Date(this._startDate.getTime()+e*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(M(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&M(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class rt{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}var Q={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class ji{constructor(e){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[Q.AUDIO]:null,[Q.VIDEO]:null,[Q.AUDIOVIDEO]:null},this.baseurl=e}setByteRange(e,t){const i=e.split("@",2);let s;i.length===1?s=(t==null?void 0:t.byteRangeEndOffset)||0:s=parseInt(i[1]),this._byteRange=[s,parseInt(i[0])+s]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=Gt.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}}class Kt extends ji{constructor(e,t){super(t),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new rt,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get decryptdata(){const{levelkeys:e}=this;if(!e&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const i=Object.keys(this.levelkeys);if(i.length===1)return this._decryptdata=this.levelkeys[i[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null||!M(this.programDateTime))return null;const e=M(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),i=t.length;if(i>1||i===1&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(e){if(this.levelkeys){const t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}}abortRequests(){var e,t;(e=this.loader)==null||e.abort(),(t=this.keyLoader)==null||t.abort()}setElementaryStreamInfo(e,t,i,s,r,a=!1){const{elementaryStreams:o}=this,l=o[e];if(!l){o[e]={startPTS:t,endPTS:i,startDTS:s,endDTS:r,partial:a};return}l.startPTS=Math.min(l.startPTS,t),l.endPTS=Math.max(l.endPTS,i),l.startDTS=Math.min(l.startDTS,s),l.endDTS=Math.max(l.endDTS,r)}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[Q.AUDIO]=null,e[Q.VIDEO]=null,e[Q.AUDIOVIDEO]=null}}class Er extends ji{constructor(e,t,i,s,r){super(i),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new rt,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=t,this.index=s;const a=e.enumeratedString("BYTERANGE");a&&this.setByteRange(a,r),r&&(this.fragOffset=r.fragOffset+r.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}}const Tr=10;class xr{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.live=!0,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.availabilityDelay=void 0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const t=this.lastPartSn-e.lastPartSn,i=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!i||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||t===0&&i>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay}get hasProgramDateTime(){return this.fragments.length?M(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Tr}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var e;return(e=this.fragments)!=null&&e.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function Ht(n){return Uint8Array.from(atob(n),e=>e.charCodeAt(0))}function Sr(n){const e=Wt(n).subarray(0,16),t=new Uint8Array(16);return t.set(e,16-e.length),t}function Lr(n){const e=function(i,s,r){const a=i[s];i[s]=i[r],i[r]=a};e(n,0,3),e(n,1,2),e(n,4,5),e(n,6,7)}function Ar(n){const e=n.split(":");let t=null;if(e[0]==="data"&&e.length===2){const i=e[1].split(";"),s=i[i.length-1].split(",");if(s.length===2){const r=s[0]==="base64",a=s[1];r?(i.splice(-1,1),t=Ht(a)):t=Sr(a)}}return t}function Wt(n){return Uint8Array.from(unescape(encodeURIComponent(n)),e=>e.charCodeAt(0))}const Ge=typeof self<"u"?self:void 0;var X={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},he={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function Yt(n){switch(n){case he.FAIRPLAY:return X.FAIRPLAY;case he.PLAYREADY:return X.PLAYREADY;case he.WIDEVINE:return X.WIDEVINE;case he.CLEARKEY:return X.CLEARKEY}}var at={CENC:"1077efecc0b24d02ace33c1e52e2fb4b",CLEARKEY:"e2719d58a985b3c9781ab030af78d30e",FAIRPLAY:"94ce86fb07ff4f43adb893d2fa968ca2",PLAYREADY:"9a04f07998404286ab92e65be0885f95",WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function qt(n){if(n===at.WIDEVINE)return X.WIDEVINE;if(n===at.PLAYREADY)return X.PLAYREADY;if(n===at.CENC||n===at.CLEARKEY)return X.CLEARKEY}function zt(n){switch(n){case X.FAIRPLAY:return he.FAIRPLAY;case X.PLAYREADY:return he.PLAYREADY;case X.WIDEVINE:return he.WIDEVINE;case X.CLEARKEY:return he.CLEARKEY}}function ot(n){const{drmSystems:e,widevineLicenseUrl:t}=n,i=e?[X.FAIRPLAY,X.WIDEVINE,X.PLAYREADY,X.CLEARKEY].filter(s=>!!e[s]):[];return!i[X.WIDEVINE]&&t&&i.push(X.WIDEVINE),i}const Xi=function(n){return Ge!=null&&(n=Ge.navigator)!=null&&n.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function vr(n,e,t,i){let s;switch(n){case X.FAIRPLAY:s=["cenc","sinf"];break;case X.WIDEVINE:case X.PLAYREADY:s=["cenc"];break;case X.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${n}`)}return Rr(s,e,t,i)}function Rr(n,e,t,i){return[{initDataTypes:n,persistentState:i.persistentState||"optional",distinctiveIdentifier:i.distinctiveIdentifier||"optional",sessionTypes:i.sessionTypes||[i.sessionType||"temporary"],audioCapabilities:e.map(r=>({contentType:`audio/mp4; codecs="${r}"`,robustness:i.audioRobustness||"",encryptionScheme:i.audioEncryptionScheme||null})),videoCapabilities:t.map(r=>({contentType:`video/mp4; codecs="${r}"`,robustness:i.videoRobustness||"",encryptionScheme:i.videoEncryptionScheme||null}))}]}function Qi(n){const e=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),t=String.fromCharCode.apply(null,Array.from(e)),i=t.substring(t.indexOf("<"),t.length),a=new DOMParser().parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(a){const o=a.childNodes[0]?a.childNodes[0].nodeValue:a.getAttribute("VALUE");if(o){const l=Ht(o).subarray(0,16);return Lr(l),l}}return null}function Ne(n,e,t){return Uint8Array.prototype.slice?n.slice(e,t):new Uint8Array(Array.prototype.slice.call(n,e,t))}const jt=(n,e)=>e+10<=n.length&&n[e]===73&&n[e+1]===68&&n[e+2]===51&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128,Ji=(n,e)=>e+10<=n.length&&n[e]===51&&n[e+1]===68&&n[e+2]===73&&n[e+3]<255&&n[e+4]<255&&n[e+6]<128&&n[e+7]<128&&n[e+8]<128&&n[e+9]<128,et=(n,e)=>{const t=e;let i=0;for(;jt(n,e);){i+=10;const s=lt(n,e+6);i+=s,Ji(n,e+10)&&(i+=10),e+=i}if(i>0)return n.subarray(t,t+i)},lt=(n,e)=>{let t=0;return t=(n[e]&127)<<21,t|=(n[e+1]&127)<<14,t|=(n[e+2]&127)<<7,t|=n[e+3]&127,t},br=(n,e)=>jt(n,e)&&lt(n,e+6)+10<=n.length-e,Xt=n=>{const e=es(n);for(let t=0;t<e.length;t++){const i=e[t];if(Zi(i))return _r(i)}},Zi=n=>n&&n.key==="PRIV"&&n.info==="com.apple.streaming.transportStreamTimestamp",Ir=n=>{const e=String.fromCharCode(n[0],n[1],n[2],n[3]),t=lt(n,4),i=10;return{type:e,size:t,data:n.subarray(i,i+t)}},es=n=>{let e=0;const t=[];for(;jt(n,e);){const i=lt(n,e+6);e+=10;const s=e+i;for(;e+8<s;){const r=Ir(n.subarray(e)),a=Dr(r);a&&t.push(a),e+=r.size+10}Ji(n,e)&&(e+=10)}return t},Dr=n=>n.type==="PRIV"?Cr(n):n.type[0]==="W"?kr(n):wr(n),Cr=n=>{if(n.size<2)return;const e=Se(n.data,!0),t=new Uint8Array(n.data.subarray(e.length+1));return{key:n.type,info:e,data:t.buffer}},wr=n=>{if(n.size<2)return;if(n.type==="TXXX"){let t=1;const i=Se(n.data.subarray(t),!0);t+=i.length+1;const s=Se(n.data.subarray(t));return{key:n.type,info:i,data:s}}const e=Se(n.data.subarray(1));return{key:n.type,data:e}},kr=n=>{if(n.type==="WXXX"){if(n.size<2)return;let t=1;const i=Se(n.data.subarray(t),!0);t+=i.length+1;const s=Se(n.data.subarray(t));return{key:n.type,info:i,data:s}}const e=Se(n.data);return{key:n.type,data:e}},_r=n=>{if(n.data.byteLength===8){const e=new Uint8Array(n.data),t=e[3]&1;let i=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return i/=45,t&&(i+=4772185884e-2),Math.round(i)}},Se=(n,e=!1)=>{const t=Pr();if(t){const c=t.decode(n);if(e){const u=c.indexOf("\0");return u!==-1?c.substring(0,u):c}return c.replace(/\0/g,"")}const i=n.length;let s,r,a,o="",l=0;for(;l<i;){if(s=n[l++],s===0&&e)return o;if(s===0||s===3)continue;switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(s);break;case 12:case 13:r=n[l++],o+=String.fromCharCode((s&31)<<6|r&63);break;case 14:r=n[l++],a=n[l++],o+=String.fromCharCode((s&15)<<12|(r&63)<<6|(a&63)<<0);break}}return o};let Qt;function Pr(){if(!navigator.userAgent.includes("PlayStation 4"))return!Qt&&typeof self.TextDecoder<"u"&&(Qt=new self.TextDecoder("utf-8")),Qt}const Le={hexDump:function(n){let e="";for(let t=0;t<n.length;t++){let i=n[t].toString(16);i.length<2&&(i="0"+i),e+=i}return e}},ct=Math.pow(2,32)-1,Fr=[].push,ts={video:1,audio:2,id3:3,text:4};function ne(n){return String.fromCharCode.apply(null,n)}function is(n,e){const t=n[e]<<8|n[e+1];return t<0?65536+t:t}function B(n,e){const t=ns(n,e);return t<0?4294967296+t:t}function ss(n,e){let t=B(n,e);return t*=Math.pow(2,32),t+=B(n,e+4),t}function ns(n,e){return n[e]<<24|n[e+1]<<16|n[e+2]<<8|n[e+3]}function Jt(n,e,t){n[e]=t>>24,n[e+1]=t>>16&255,n[e+2]=t>>8&255,n[e+3]=t&255}function Or(n){const e=n.byteLength;for(let t=0;t<e;){const i=B(n,t);if(i>8&&n[t+4]===109&&n[t+5]===111&&n[t+6]===111&&n[t+7]===102)return!0;t=i>1?t+i:e}return!1}function H(n,e){const t=[];if(!e.length)return t;const i=n.byteLength;for(let s=0;s<i;){const r=B(n,s),a=ne(n.subarray(s+4,s+8)),o=r>1?s+r:i;if(a===e[0])if(e.length===1)t.push(n.subarray(s+8,o));else{const l=H(n.subarray(s+8,o),e.slice(1));l.length&&Fr.apply(t,l)}s=o}return t}function Mr(n){const e=[],t=n[0];let i=8;const s=B(n,i);i+=4;let r=0,a=0;t===0?(r=B(n,i),a=B(n,i+4),i+=8):(r=ss(n,i),a=ss(n,i+8),i+=16),i+=2;let o=n.length+a;const l=is(n,i);i+=2;for(let c=0;c<l;c++){let u=i;const d=B(n,u);u+=4;const h=d&2147483647;if((d&2147483648)>>>31===1)return L.warn("SIDX has hierarchical references (not supported)"),null;const f=B(n,u);u+=4,e.push({referenceSize:h,subsegmentDuration:f,info:{duration:f/s,start:o,end:o+h-1}}),o+=h,u+=4,i=u}return{earliestPresentationTime:r,timescale:s,version:t,referencesCount:l,references:e}}function rs(n){const e=[],t=H(n,["moov","trak"]);for(let s=0;s<t.length;s++){const r=t[s],a=H(r,["tkhd"])[0];if(a){let o=a[0];const l=B(a,o===0?12:20),c=H(r,["mdia","mdhd"])[0];if(c){o=c[0];const u=B(c,o===0?12:20),d=H(r,["mdia","hdlr"])[0];if(d){const h=ne(d.subarray(8,12)),g={soun:Q.AUDIO,vide:Q.VIDEO}[h];if(g){const f=H(r,["mdia","minf","stbl","stsd"])[0],m=Nr(f);e[l]={timescale:u,type:g},e[g]=re({timescale:u,id:l},m)}}}}}return H(n,["moov","mvex","trex"]).forEach(s=>{const r=B(s,4),a=e[r];a&&(a.default={duration:B(s,12),flags:B(s,20)})}),e}function Nr(n){const e=n.subarray(8),t=e.subarray(86),i=ne(e.subarray(4,8));let s=i;const r=i==="enca"||i==="encv";if(r){const o=H(e,[i])[0].subarray(i==="enca"?28:78);H(o,["sinf"]).forEach(c=>{const u=H(c,["schm"])[0];if(u){const d=ne(u.subarray(4,8));if(d==="cbcs"||d==="cenc"){const h=H(c,["frma"])[0];h&&(s=ne(h))}}})}switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const a=H(t,["avcC"])[0];s+="."+ut(a[1])+ut(a[2])+ut(a[3]);break}case"mp4a":{const a=H(e,[i])[0],o=H(a.subarray(28),["esds"])[0];if(o&&o.length>12){let l=4;if(o[l++]!==3)break;l=Zt(o,l),l+=2;const c=o[l++];if(c&128&&(l+=2),c&64&&(l+=o[l++]),o[l++]!==4)break;l=Zt(o,l);const u=o[l++];if(u===64)s+="."+ut(u);else break;if(l+=12,o[l++]!==5)break;l=Zt(o,l);const d=o[l++];let h=(d&248)>>3;h===31&&(h+=1+((d&7)<<3)+((o[l]&224)>>5)),s+="."+h}break}case"hvc1":case"hev1":{const a=H(t,["hvcC"])[0],o=a[1],l=["","A","B","C"][o>>6],c=o&31,u=B(a,2),d=(o&32)>>5?"H":"L",h=a[12],g=a.subarray(6,12);s+="."+l+c,s+="."+u.toString(16).toUpperCase(),s+="."+d+h;let f="";for(let m=g.length;m--;){const y=g[m];(y||f)&&(f="."+y.toString(16).toUpperCase()+f)}s+=f;break}case"dvh1":case"dvhe":{const a=H(t,["dvcC"])[0],o=a[2]>>1&127,l=a[2]<<5&32|a[3]>>3&31;s+="."+Ae(o)+"."+Ae(l);break}case"vp09":{const a=H(t,["vpcC"])[0],o=a[4],l=a[5],c=a[6]>>4&15;s+="."+Ae(o)+"."+Ae(l)+"."+Ae(c);break}case"av01":{const a=H(t,["av1C"])[0],o=a[1]>>>5,l=a[1]&31,c=a[2]>>>7?"H":"M",u=(a[2]&64)>>6,d=(a[2]&32)>>5,h=o===2&&u?d?12:10:u?10:8,g=(a[2]&16)>>4,f=(a[2]&8)>>3,m=(a[2]&4)>>2,y=a[2]&3;s+="."+o+"."+Ae(l)+c+"."+Ae(h)+"."+g+"."+f+m+y+"."+Ae(1)+"."+Ae(1)+"."+Ae(1)+"."+0;break}}return{codec:s,encrypted:r}}function Zt(n,e){const t=e+5;for(;n[e++]&128&&e<t;);return e}function ut(n){return("0"+n.toString(16).toUpperCase()).slice(-2)}function Ae(n){return(n<10?"0":"")+n}function Br(n,e){if(!n||!e)return n;const t=e.keyId;return t&&e.isCommonEncryption&&H(n,["moov","trak"]).forEach(s=>{const a=H(s,["mdia","minf","stbl","stsd"])[0].subarray(8);let o=H(a,["enca"]);const l=o.length>0;l||(o=H(a,["encv"])),o.forEach(c=>{const u=l?c.subarray(28):c.subarray(78);H(u,["sinf"]).forEach(h=>{const g=as(h);if(g){const f=g.subarray(8,24);f.some(m=>m!==0)||(L.log(`[eme] Patching keyId in 'enc${l?"a":"v"}>sinf>>tenc' box: ${Le.hexDump(f)} -> ${Le.hexDump(t)}`),g.set(t,8))}})})}),n}function as(n){const e=H(n,["schm"])[0];if(e){const t=ne(e.subarray(4,8));if(t==="cbcs"||t==="cenc")return H(n,["schi","tenc"])[0]}return null}function Ur(n,e){return H(e,["moof","traf"]).reduce((t,i)=>{const s=H(i,["tfdt"])[0],r=s[0],a=H(i,["tfhd"]).reduce((o,l)=>{const c=B(l,4),u=n[c];if(u){let d=B(s,4);if(r===1){if(d===ct)return L.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),o;d*=ct+1,d+=B(s,8)}const h=u.timescale||9e4,g=d/h;if(M(g)&&(o===null||g<o))return g}return o},null);return a!==null&&M(a)&&(t===null||a<t)?a:t},null)}function $r(n,e){let t=0,i=0,s=0;const r=H(n,["moof","traf"]);for(let a=0;a<r.length;a++){const o=r[a],l=H(o,["tfhd"])[0],c=B(l,4),u=e[c];if(!u)continue;const d=u.default,h=B(l,0)|(d==null?void 0:d.flags);let g=d==null?void 0:d.duration;h&8&&(h&2?g=B(l,12):g=B(l,8));const f=u.timescale||9e4,m=H(o,["trun"]);for(let y=0;y<m.length;y++){if(t=Gr(m[y]),!t&&g){const E=B(m[y],4);t=g*E}u.type===Q.VIDEO?i+=t/f:u.type===Q.AUDIO&&(s+=t/f)}}if(i===0&&s===0){let a=1/0,o=0,l=0;const c=H(n,["sidx"]);for(let u=0;u<c.length;u++){const d=Mr(c[u]);if(d!=null&&d.references){a=Math.min(a,d.earliestPresentationTime/d.timescale);const h=d.references.reduce((g,f)=>g+f.info.duration||0,0);o=Math.max(o,h+d.earliestPresentationTime/d.timescale),l=o-a}}if(l&&M(l))return l}return i||s}function Gr(n){const e=B(n,0);let t=8;e&1&&(t+=4),e&4&&(t+=4);let i=0;const s=B(n,4);for(let r=0;r<s;r++){if(e&256){const a=B(n,t);i+=a,t+=4}e&512&&(t+=4),e&1024&&(t+=4),e&2048&&(t+=4)}return i}function Vr(n,e,t){H(e,["moof","traf"]).forEach(i=>{H(i,["tfhd"]).forEach(s=>{const r=B(s,4),a=n[r];if(!a)return;const o=a.timescale||9e4;H(i,["tfdt"]).forEach(l=>{const c=l[0],u=t*o;if(u){let d=B(l,4);if(c===0)d-=u,d=Math.max(d,0),Jt(l,4,d);else{d*=Math.pow(2,32),d+=B(l,8),d-=u,d=Math.max(d,0);const h=Math.floor(d/(ct+1)),g=Math.floor(d%(ct+1));Jt(l,4,h),Jt(l,8,g)}}})})})}function Kr(n){const e={valid:null,remainder:null},t=H(n,["moof"]);if(t.length<2)return e.remainder=n,e;const i=t[t.length-1];return e.valid=Ne(n,0,i.byteOffset-8),e.remainder=Ne(n,i.byteOffset-8),e}function ge(n,e){const t=new Uint8Array(n.length+e.length);return t.set(n),t.set(e,n.length),t}function os(n,e){const t=[],i=e.samples,s=e.timescale,r=e.id;let a=!1;return H(i,["moof"]).map(l=>{const c=l.byteOffset-8;H(l,["traf"]).map(d=>{const h=H(d,["tfdt"]).map(g=>{const f=g[0];let m=B(g,4);return f===1&&(m*=Math.pow(2,32),m+=B(g,8)),m/s})[0];return h!==void 0&&(n=h),H(d,["tfhd"]).map(g=>{const f=B(g,4),m=B(g,0)&16777215,y=(m&1)!==0,E=(m&2)!==0,T=(m&8)!==0;let x=0;const b=(m&16)!==0;let S=0;const w=(m&32)!==0;let R=8;f===r&&(y&&(R+=8),E&&(R+=4),T&&(x=B(g,R),R+=4),b&&(S=B(g,R),R+=4),w&&(R+=4),e.type==="video"&&(a=Hr(e.codec)),H(d,["trun"]).map(k=>{const P=k[0],D=B(k,0)&16777215,_=(D&1)!==0;let W=0;const F=(D&4)!==0,K=(D&256)!==0;let V=0;const $=(D&512)!==0;let z=0;const Z=(D&1024)!==0,N=(D&2048)!==0;let O=0;const j=B(k,4);let Y=8;_&&(W=B(k,Y),Y+=4),F&&(Y+=4);let J=W+c;for(let se=0;se<j;se++){if(K?(V=B(k,Y),Y+=4):V=x,$?(z=B(k,Y),Y+=4):z=S,Z&&(Y+=4),N&&(P===0?O=B(k,Y):O=ns(k,Y),Y+=4),e.type===Q.VIDEO){let le=0;for(;le<z;){const ue=B(i,J);if(J+=4,Wr(a,i[J])){const ye=i.subarray(J,J+ue);ls(ye,a?2:1,n+O/s,t)}J+=ue,le+=ue+4}}n+=V/s}}))})})}),t}function Hr(n){if(!n)return!1;const e=n.indexOf("."),t=e<0?n:n.substring(0,e);return t==="hvc1"||t==="hev1"||t==="dvh1"||t==="dvhe"}function Wr(n,e){if(n){const t=e>>1&63;return t===39||t===40}else return(e&31)===6}function ls(n,e,t,i){const s=cs(n);let r=0;r+=e;let a=0,o=0,l=0;for(;r<s.length;){a=0;do{if(r>=s.length)break;l=s[r++],a+=l}while(l===255);o=0;do{if(r>=s.length)break;l=s[r++],o+=l}while(l===255);const c=s.length-r;let u=r;if(o<c)r+=o;else if(o>c){L.error(`Malformed SEI payload. ${o} is too small, only ${c} bytes left to parse.`);break}if(a===4){if(s[u++]===181){const h=is(s,u);if(u+=2,h===49){const g=B(s,u);if(u+=4,g===1195456820){const f=s[u++];if(f===3){const m=s[u++],y=31&m,E=64&m,T=E?2+y*3:0,x=new Uint8Array(T);if(E){x[0]=m;for(let b=1;b<T;b++)x[b]=s[u++]}i.push({type:f,payloadType:a,pts:t,bytes:x})}}}}}else if(a===5&&o>16){const d=[];for(let f=0;f<16;f++){const m=s[u++].toString(16);d.push(m.length==1?"0"+m:m),(f===3||f===5||f===7||f===9)&&d.push("-")}const h=o-16,g=new Uint8Array(h);for(let f=0;f<h;f++)g[f]=s[u++];i.push({payloadType:a,pts:t,uuid:d.join(""),userData:Se(g),userDataBytes:g})}}}function cs(n){const e=n.byteLength,t=[];let i=1;for(;i<e-2;)n[i]===0&&n[i+1]===0&&n[i+2]===3?(t.push(i+2),i+=2):i++;if(t.length===0)return n;const s=e-t.length,r=new Uint8Array(s);let a=0;for(i=0;i<s;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=n[a];return r}function Yr(n){const e=n[0];let t="",i="",s=0,r=0,a=0,o=0,l=0,c=0;if(e===0){for(;ne(n.subarray(c,c+1))!=="\0";)t+=ne(n.subarray(c,c+1)),c+=1;for(t+=ne(n.subarray(c,c+1)),c+=1;ne(n.subarray(c,c+1))!=="\0";)i+=ne(n.subarray(c,c+1)),c+=1;i+=ne(n.subarray(c,c+1)),c+=1,s=B(n,12),r=B(n,16),o=B(n,20),l=B(n,24),c=28}else if(e===1){c+=4,s=B(n,c),c+=4;const d=B(n,c);c+=4;const h=B(n,c);for(c+=4,a=2**32*d+h,ur(a)||(a=Number.MAX_SAFE_INTEGER,L.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=B(n,c),c+=4,l=B(n,c),c+=4;ne(n.subarray(c,c+1))!=="\0";)t+=ne(n.subarray(c,c+1)),c+=1;for(t+=ne(n.subarray(c,c+1)),c+=1;ne(n.subarray(c,c+1))!=="\0";)i+=ne(n.subarray(c,c+1)),c+=1;i+=ne(n.subarray(c,c+1)),c+=1}const u=n.subarray(c,n.byteLength);return{schemeIdUri:t,value:i,timeScale:s,presentationTime:a,presentationTimeDelta:r,eventDuration:o,id:l,payload:u}}function qr(n,...e){const t=e.length;let i=8,s=t;for(;s--;)i+=e[s].byteLength;const r=new Uint8Array(i);for(r[0]=i>>24&255,r[1]=i>>16&255,r[2]=i>>8&255,r[3]=i&255,r.set(n,4),s=0,i=8;s<t;s++)r.set(e[s],i),i+=e[s].byteLength;return r}function zr(n,e,t){if(n.byteLength!==16)throw new RangeError("Invalid system id");let i,s;i=0,s=new Uint8Array;let r;i>0?(r=new Uint8Array(4),e.length>0&&new DataView(r.buffer).setUint32(0,e.length,!1)):r=new Uint8Array;const a=new Uint8Array(4);return t&&t.byteLength>0&&new DataView(a.buffer).setUint32(0,t.byteLength,!1),qr([112,115,115,104],new Uint8Array([i,0,0,0]),n,r,s,a,t||new Uint8Array)}function jr(n){const e=[];if(n instanceof ArrayBuffer){const t=n.byteLength;let i=0;for(;i+32<t;){const s=new DataView(n,i),r=Xr(s);e.push(r),i+=r.size}}return e}function Xr(n){const e=n.getUint32(0),t=n.byteOffset,i=n.byteLength;if(i<e)return{offset:t,size:i};if(n.getUint32(4)!==1886614376)return{offset:t,size:e};const r=n.getUint32(8)>>>24;if(r!==0&&r!==1)return{offset:t,size:e};const a=n.buffer,o=Le.hexDump(new Uint8Array(a,t+12,16)),l=n.getUint32(28);let c=null,u=null;if(r===0){if(e-32<l||l<22)return{offset:t,size:e};u=new Uint8Array(a,t+32,l)}else if(r===1){if(!l||i<t+32+l*16+16)return{offset:t,size:e};c=[];for(let d=0;d<l;d++)c.push(new Uint8Array(a,t+32+d*16,16))}return{version:r,systemId:o,kids:c,data:u,offset:t,size:e}}let dt={};class tt{static clearKeyUriToKeyIdMap(){dt={}}constructor(e,t,i,s=[1],r=null){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=i,this.keyFormatVersions=s,this.iv=r,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&e!=="AES-128"}isSupported(){if(this.method){if(this.method==="AES-128"||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case he.FAIRPLAY:case he.WIDEVINE:case he.PLAYREADY:case he.CLEARKEY:return["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e){if(!this.encrypted||!this.uri)return null;if(this.method==="AES-128"&&this.uri&&!this.iv){typeof e!="number"&&(this.method==="AES-128"&&!this.iv&&L.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0);const i=Qr(e);return new tt(this.method,this.uri,"identity",this.keyFormatVersions,i)}const t=Ar(this.uri);if(t)switch(this.keyFormat){case he.WIDEVINE:this.pssh=t,t.length>=22&&(this.keyId=t.subarray(t.length-22,t.length-6));break;case he.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=zr(i,null,t),this.keyId=Qi(t);break}default:{let i=t.subarray(0,16);if(i.length!==16){const s=new Uint8Array(16);s.set(i,16-i.length),i=s}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i=dt[this.uri];if(!i){const s=Object.keys(dt).length%Number.MAX_SAFE_INTEGER;i=new Uint8Array(16),new DataView(i.buffer,12,4).setUint32(0,s),dt[this.uri]=i}this.keyId=i}return this}}function Qr(n){const e=new Uint8Array(16);for(let t=12;t<16;t++)e[t]=n>>8*(15-t)&255;return e}const us=/\{\$([a-zA-Z0-9-_]+)\}/g;function ds(n){return us.test(n)}function fe(n,e,t){if(n.variableList!==null||n.hasVariableRefs)for(let i=t.length;i--;){const s=t[i],r=e[s];r&&(e[s]=ei(n,r))}}function ei(n,e){if(n.variableList!==null||n.hasVariableRefs){const t=n.variableList;return e.replace(us,i=>{const s=i.substring(2,i.length-1),r=t==null?void 0:t[s];return r===void 0?(n.playlistParsingError||(n.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),i):r})}return e}function hs(n,e,t){let i=n.variableList;i||(n.variableList=i={});let s,r;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const a=new self.URL(t).searchParams;if(a.has(s))r=a.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${t}"`)}catch(a){n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${a.message}`))}}else s=e.NAME,r=e.VALUE;s in i?n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):i[s]=r||""}function Jr(n,e,t){const i=e.IMPORT;if(t&&i in t){let s=n.variableList;s||(n.variableList=s={}),s[i]=t[i]}else n.playlistParsingError||(n.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${i}"`))}function Be(n=!0){return typeof self>"u"?void 0:(n||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function Zr(n){return typeof self<"u"&&n===self.ManagedMediaSource}const ht={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function ea(n,e){const t=ht[e];return!!t&&!!t[n.slice(0,4)]}function ti(n,e,t=!0){return!n.split(",").some(i=>!fs(i,e,t))}function fs(n,e,t=!0){var i;const s=Be(t);return(i=s==null?void 0:s.isTypeSupported(it(n,e)))!=null?i:!1}function it(n,e){return`${e}/mp4;codecs="${n}"`}function gs(n){if(n){const e=n.substring(0,4);return ht.video[e]}return 2}function ft(n){return n.split(",").reduce((e,t)=>{const i=ht.video[t];return i?(i*2+e)/(e?3:2):(ht.audio[t]+e)/(e?2:1)},0)}const ii={};function ta(n,e=!0){if(ii[n])return ii[n];const t={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[n];for(let i=0;i<t.length;i++)if(fs(t[i],"audio",e))return ii[n]=t[i],t[i];return n}const ia=/flac|opus/i;function gt(n,e=!0){return n.replace(ia,t=>ta(t.toLowerCase(),e))}function ms(n,e){return n&&n!=="mp4a"?n:e&&e.split(",")[0]}function sa(n){const e=n.split(",");for(let t=0;t<e.length;t++){const i=e[t].split(".");if(i.length>2){let s=i.shift()+".";s+=parseInt(i.shift()).toString(16),s+=("000"+parseInt(i.shift()).toString(16)).slice(-4),e[t]=s}}return e.join(",")}const ps=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,ys=/#EXT-X-MEDIA:(.*)/g,na=/^#EXT(?:INF|-X-TARGETDURATION):/m,Es=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),ra=new RegExp([/#(EXTM3U)/.source,/#EXT-X-(DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class ve{static findGroup(e,t){for(let i=0;i<e.length;i++){const s=e[i];if(s.id===t)return s}}static resolve(e,t){return Gt.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return na.test(e)}static parseMasterPlaylist(e,t){const i=ds(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:i},r=[];ps.lastIndex=0;let a;for(;(a=ps.exec(e))!=null;)if(a[1]){var o;const c=new te(a[1]);fe(s,c,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const u=ei(s,a[2]),d={attrs:c,bitrate:c.decimalInteger("BANDWIDTH")||c.decimalInteger("AVERAGE-BANDWIDTH"),name:c.NAME,url:ve.resolve(u,t)},h=c.decimalResolution("RESOLUTION");h&&(d.width=h.width,d.height=h.height),aa(c.CODECS,d),(o=d.unknownCodecs)!=null&&o.length||r.push(d),s.levels.push(d)}else if(a[3]){const c=a[3],u=a[4];switch(c){case"SESSION-DATA":{const d=new te(u);fe(s,d,["DATA-ID","LANGUAGE","VALUE","URI"]);const h=d["DATA-ID"];h&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[h]=d);break}case"SESSION-KEY":{const d=Ts(u,t,s);d.encrypted&&d.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(d)):L.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const d=new te(u);fe(s,d,["NAME","VALUE","QUERYPARAM"]),hs(s,d,t)}break}case"CONTENT-STEERING":{const d=new te(u);fe(s,d,["SERVER-URI","PATHWAY-ID"]),s.contentSteering={uri:ve.resolve(d["SERVER-URI"],t),pathwayId:d["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=xs(u);break}}}const l=r.length>0&&r.length<s.levels.length;return s.levels=l?r:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,t,i){let s;const r={},a=i.levels,o={AUDIO:a.map(c=>({id:c.attrs.AUDIO,audioCodec:c.audioCodec})),SUBTITLES:a.map(c=>({id:c.attrs.SUBTITLES,textCodec:c.textCodec})),"CLOSED-CAPTIONS":[]};let l=0;for(ys.lastIndex=0;(s=ys.exec(e))!==null;){const c=new te(s[1]),u=c.TYPE;if(u){const d=o[u],h=r[u]||[];r[u]=h,fe(i,c,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const g=c.LANGUAGE,f=c["ASSOC-LANGUAGE"],m=c.CHANNELS,y=c.CHARACTERISTICS,E=c["INSTREAM-ID"],T={attrs:c,bitrate:0,id:l++,groupId:c["GROUP-ID"]||"",name:c.NAME||g||"",type:u,default:c.bool("DEFAULT"),autoselect:c.bool("AUTOSELECT"),forced:c.bool("FORCED"),lang:g,url:c.URI?ve.resolve(c.URI,t):""};if(f&&(T.assocLang=f),m&&(T.channels=m),y&&(T.characteristics=y),E&&(T.instreamId=E),d!=null&&d.length){const x=ve.findGroup(d,T.groupId)||d[0];Ss(T,x,"audioCodec"),Ss(T,x,"textCodec")}h.push(T)}}return r}static parseLevelPlaylist(e,t,i,s,r,a){const o=new xr(t),l=o.fragments;let c=null,u=0,d=0,h=0,g=0,f=null,m=new Kt(s,t),y,E,T,x=-1,b=!1,S=null;for(Es.lastIndex=0,o.m3u8=e,o.hasVariableRefs=ds(e);(y=Es.exec(e))!==null;){b&&(b=!1,m=new Kt(s,t),m.start=h,m.sn=u,m.cc=g,m.level=i,c&&(m.initSegment=c,m.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,S&&(m.setByteRange(S),S=null)));const P=y[1];if(P){m.duration=parseFloat(P);const D=(" "+y[2]).slice(1);m.title=D||null,m.tagList.push(D?["INF",P,D]:["INF",P])}else if(y[3]){if(M(m.duration)){m.start=h,T&&vs(m,T,o),m.sn=u,m.level=i,m.cc=g,l.push(m);const D=(" "+y[3]).slice(1);m.relurl=ei(o,D),Ls(m,f),f=m,h+=m.duration,u++,d=0,b=!0}}else if(y[4]){const D=(" "+y[4]).slice(1);f?m.setByteRange(D,f):m.setByteRange(D)}else if(y[5])m.rawProgramDateTime=(" "+y[5]).slice(1),m.tagList.push(["PROGRAM-DATE-TIME",m.rawProgramDateTime]),x===-1&&(x=l.length);else{if(y=y[0].match(ra),!y){L.warn("No matches on slow regex match for level playlist!");continue}for(E=1;E<y.length&&!(typeof y[E]<"u");E++);const D=(" "+y[E]).slice(1),_=(" "+y[E+1]).slice(1),W=y[E+2]?(" "+y[E+2]).slice(1):"";switch(D){case"PLAYLIST-TYPE":o.type=_.toUpperCase();break;case"MEDIA-SEQUENCE":u=o.startSN=parseInt(_);break;case"SKIP":{const F=new te(_);fe(o,F,["RECENTLY-REMOVED-DATERANGES"]);const K=F.decimalInteger("SKIPPED-SEGMENTS");if(M(K)){o.skippedSegments=K;for(let $=K;$--;)l.unshift(null);u+=K}const V=F.enumeratedString("RECENTLY-REMOVED-DATERANGES");V&&(o.recentlyRemovedDateranges=V.split(" "));break}case"TARGETDURATION":o.targetduration=Math.max(parseInt(_),1);break;case"VERSION":o.version=parseInt(_);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":o.live=!1;break;case"#":(_||W)&&m.tagList.push(W?[_,W]:[_]);break;case"DISCONTINUITY":g++,m.tagList.push(["DIS"]);break;case"GAP":m.gap=!0,m.tagList.push([D]);break;case"BITRATE":m.tagList.push([D,_]);break;case"DATERANGE":{const F=new te(_);fe(o,F,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),fe(o,F,F.clientAttrs);const K=new zi(F,o.dateRanges[F.ID]);K.isValid||o.skippedSegments?o.dateRanges[K.id]=K:L.warn(`Ignoring invalid DATERANGE tag: "${_}"`),m.tagList.push(["EXT-X-DATERANGE",_]);break}case"DEFINE":{{const F=new te(_);fe(o,F,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in F?Jr(o,F,a):hs(o,F,t)}break}case"DISCONTINUITY-SEQUENCE":g=parseInt(_);break;case"KEY":{const F=Ts(_,t,o);if(F.isSupported()){if(F.method==="NONE"){T=void 0;break}T||(T={}),T[F.keyFormat]&&(T=ie({},T)),T[F.keyFormat]=F}else L.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${_}"`);break}case"START":o.startTimeOffset=xs(_);break;case"MAP":{const F=new te(_);if(fe(o,F,["BYTERANGE","URI"]),m.duration){const K=new Kt(s,t);As(K,F,i,T),c=K,m.initSegment=c,c.rawProgramDateTime&&!m.rawProgramDateTime&&(m.rawProgramDateTime=c.rawProgramDateTime)}else{const K=m.byteRangeEndOffset;if(K){const V=m.byteRangeStartOffset;S=`${K-V}@${V}`}else S=null;As(m,F,i,T),c=m,b=!0}break}case"SERVER-CONTROL":{const F=new te(_);o.canBlockReload=F.bool("CAN-BLOCK-RELOAD"),o.canSkipUntil=F.optionalFloat("CAN-SKIP-UNTIL",0),o.canSkipDateRanges=o.canSkipUntil>0&&F.bool("CAN-SKIP-DATERANGES"),o.partHoldBack=F.optionalFloat("PART-HOLD-BACK",0),o.holdBack=F.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const F=new te(_);o.partTarget=F.decimalFloatingPoint("PART-TARGET");break}case"PART":{let F=o.partList;F||(F=o.partList=[]);const K=d>0?F[F.length-1]:void 0,V=d++,$=new te(_);fe(o,$,["BYTERANGE","URI"]);const z=new Er($,m,t,V,K);F.push(z),m.duration+=z.duration;break}case"PRELOAD-HINT":{const F=new te(_);fe(o,F,["URI"]),o.preloadHint=F;break}case"RENDITION-REPORT":{const F=new te(_);fe(o,F,["URI"]),o.renditionReports=o.renditionReports||[],o.renditionReports.push(F);break}default:L.warn(`line parsed but not handled: ${y}`);break}}}f&&!f.relurl?(l.pop(),h-=f.duration,o.partList&&(o.fragmentHint=f)):o.partList&&(Ls(m,f),m.cc=g,o.fragmentHint=m,T&&vs(m,T,o));const w=l.length,R=l[0],k=l[w-1];if(h+=o.skippedSegments*o.targetduration,h>0&&w&&k){o.averagetargetduration=h/w;const P=k.sn;o.endSN=P!=="initSegment"?P:0,o.live||(k.endList=!0),R&&(o.startCC=R.cc)}else o.endSN=0,o.startCC=0;return o.fragmentHint&&(h+=o.fragmentHint.duration),o.totalduration=h,o.endCC=g,x>0&&oa(l,x),o}}function Ts(n,e,t){var i,s;const r=new te(n);fe(t,r,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=(i=r.METHOD)!=null?i:"",o=r.URI,l=r.hexadecimalInteger("IV"),c=r.KEYFORMATVERSIONS,u=(s=r.KEYFORMAT)!=null?s:"identity";o&&r.IV&&!l&&L.error(`Invalid IV: ${r.IV}`);const d=o?ve.resolve(o,e):"",h=(c||"1").split("/").map(Number).filter(Number.isFinite);return new tt(a,d,u,h,l)}function xs(n){const t=new te(n).decimalFloatingPoint("TIME-OFFSET");return M(t)?t:null}function aa(n,e){let t=(n||"").split(/[ ,]+/).filter(i=>i);["video","audio","text"].forEach(i=>{cons