@swarmcloud/hls
Version:
Let your viewers become your unlimitedly scalable CDN.
1 lines • 500 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Hls=t():e.Hls=t()}(this,(()=>(()=>{var e={415:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function n(){n.init.call(this)}e.exports=n,e.exports.once=function(e,t){return new Promise((function(r,i){function s(r){e.removeListener(t,n),i(r)}function n(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}p(e,t,n,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&p(e,"error",t,r)}(e,s,{once:!0})}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var a=10;function o(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?n.defaultMaxListeners:e._maxListeners}function h(e,t,r,i){var s,n,a,h;if(o(r),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),n=e._events),a=n[t]),void 0===a)a=n[t]=r,++e._eventsCount;else if("function"==typeof a?a=n[t]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(s=l(e))>0&&a.length>s&&!a.warned){a.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=a.length,h=d,console&&console.warn&&console.warn(h)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},s=d.bind(i);return s.listener=r,i.wrapFn=s,s}function c(e,t,r){var i=e._events;if(void 0===i)return[];var s=i[t];return void 0===s?[]:"function"==typeof s?r?[s.listener||s]:[s]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(s):g(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function g(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function p(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function s(n){i.once&&e.removeEventListener(t,s),r(n)}))}}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");a=e}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},n.prototype.getMaxListeners=function(){return l(this)},n.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var s="error"===e,n=this._events;if(void 0!==n)s=s&&void 0===n.error;else if(!s)return!1;if(s){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)i(l,this,t);else{var h=l.length,d=g(l,h);for(r=0;r<h;++r)i(d[r],this,t)}return!0},n.prototype.addListener=function(e,t){return h(this,e,t,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(e,t){return h(this,e,t,!0)},n.prototype.once=function(e,t){return o(t),this.on(e,u(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,u(this,e,t)),this},n.prototype.removeListener=function(e,t){var r,i,s,n,a;if(o(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(s=-1,n=r.length-1;n>=0;n--)if(r[n]===t||r[n].listener===t){a=r[n].listener,s=n;break}if(s<0)return this;0===s?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,s),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var s,n=Object.keys(r);for(i=0;i<n.length;++i)"removeListener"!==(s=n[i])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},n.prototype.listeners=function(e){return c(this,e,!0)},n.prototype.rawListeners=function(e){return c(this,e,!1)},n.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},n.prototype.listenerCount=f,n.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},558:function(e){!function(t){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var s=a.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");return s.path=a.normalizePath(s.path),a.buildURLFromParts(s)}var n=a.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=a.normalizePath(n.path),a.buildURLFromParts(n)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var h={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(h.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,u=d.substring(0,d.lastIndexOf("/")+1)+n.path;h.path=a.normalizePath(u)}else h.path=o.path,n.params||(h.params=o.params,n.query||(h.query=o.query));return null===h.path&&(h.path=r.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(h)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}};e.exports=a}()},917:e=>{!function t(r){var i;i=function(){"use strict";function e(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function i(t){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?e(Object(i),!0).forEach((function(e){var r,n,a;r=t,n=e,a=i[e],(n=s(n))in r?Object.defineProperty(r,n,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[n]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function s(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,s(i.key),i)}}function a(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},o.apply(this,arguments)}function l(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function u(e,t,r){return u=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(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}}()?Reflect.construct.bind():function(e,t,r){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return r&&d(s,r.prototype),s},u.apply(null,arguments)}function c(e){var t="function"==typeof Map?new Map:void 0;return c=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,h(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),d(r,e)},c(e)}function f(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};!function(e,t){var r,i,s,n,a;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,i=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,r){if(r=r||{},e=e.trim(),!(t=t.trim())){if(!r.alwaysNormalize)return e;var s=a.parseURL(e);if(!s)throw new Error("Error trying to parse base URL.");return s.path=a.normalizePath(s.path),a.buildURLFromParts(s)}var n=a.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return r.alwaysNormalize?(n.path=a.normalizePath(n.path),a.buildURLFromParts(n)):t;var o=a.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=i.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var h={scheme:o.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};if(!n.netLoc&&(h.netLoc=o.netLoc,"/"!==n.path[0]))if(n.path){var d=o.path,u=d.substring(0,d.lastIndexOf("/")+1)+n.path;h.path=a.normalizePath(u)}else h.path=o.path,n.params||(h.params=o.params,n.query||(h.query=o.query));return null===h.path&&(h.path=r.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(h)},parseURL:function(e){var t=r.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(s,"");e.length!==(e=e.replace(n,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=a}(g);var p=g.exports,m=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},v=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=y},y=Number.MAX_SAFE_INTEGER||9007199254740991,E=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",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.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.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_FRAG_PROCESSED="hlsSubtitleFragProcessed",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}({}),S=function(e){return e.NETWORK_ERROR="networkError",e.MEDIA_ERROR="mediaError",e.KEY_SYSTEM_ERROR="keySystemError",e.MUX_ERROR="muxError",e.OTHER_ERROR="otherError",e}({}),T=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.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.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_STALLED_ERROR="bufferStalledError",e.BUFFER_FULL_ERROR="bufferFullError",e.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",e.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.UNKNOWN="unknown",e}({}),_=function(){},b={trace:_,debug:_,log:_,warn:_,info:_,error:_},L=b;function R(e,t){if("object"==typeof console&&!0===e||"object"==typeof e){!function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];r.forEach((function(t){L[t]=e[t]?e[t].bind(e):function(e){var t=self.console[e];return t?t.bind(self.console,"["+e+"] >"):_}(t)}))}(e,"debug","log","info","warn","error");try{L.log('Debug logs enabled for "'+t+'" in hls.js version 1.5.20')}catch(e){L=b}}else L=b}var P=L,w=/^(\d+)x(\d+)$/,A=/(.+?)=(".*?"|.*?)(?:,|$)/g,C=function(){function e(t){"string"==typeof t&&(t=e.parseAttrList(t)),o(this,t)}var t=e.prototype;return t.decimalInteger=function(e){var t=parseInt(this[e],10);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.hexadecimalInteger=function(e){if(this[e]){var t=(this[e]||"0x").slice(2);t=(1&t.length?"0":"")+t;for(var r=new Uint8Array(t.length/2),i=0;i<t.length/2;i++)r[i]=parseInt(t.slice(2*i,2*i+2),16);return r}return null},t.hexadecimalIntegerAsNumber=function(e){var t=parseInt(this[e],16);return t>Number.MAX_SAFE_INTEGER?1/0:t},t.decimalFloatingPoint=function(e){return parseFloat(this[e])},t.optionalFloat=function(e,t){var r=this[e];return r?parseFloat(r):t},t.enumeratedString=function(e){return this[e]},t.bool=function(e){return"YES"===this[e]},t.decimalResolution=function(e){var t=w.exec(this[e]);if(null!==t)return{width:parseInt(t[1],10),height:parseInt(t[2],10)}},e.parseAttrList=function(e){var t,r={};for(A.lastIndex=0;null!==(t=A.exec(e));){var i=t[2];0===i.indexOf('"')&&i.lastIndexOf('"')===i.length-1&&(i=i.slice(1,-1)),r[t[1].trim()]=i}return r},a(e,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(e){return"X-"===e.substring(0,2)}))}}]),e}();function D(e){return"SCTE35-OUT"===e||"SCTE35-IN"===e}var I=function(){function e(e,t){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,t){var r=t.attr;for(var i in r)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]!==r[i]){P.warn('DATERANGE tag attribute: "'+i+'" does not match for tags with ID: "'+e.ID+'"'),this._badValueForSameId=i;break}e=o(new C({}),r,e)}if(this.attr=e,this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){var s=new Date(this.attr["END-DATE"]);m(s.getTime())&&(this._endDate=s)}}return a(e,[{key:"id",get:function(){return this.attr.ID}},{key:"class",get:function(){return this.attr.CLASS}},{key:"startDate",get:function(){return this._startDate}},{key:"endDate",get:function(){if(this._endDate)return this._endDate;var e=this.duration;return null!==e?new Date(this._startDate.getTime()+1e3*e):null}},{key:"duration",get:function(){if("DURATION"in this.attr){var e=this.attr.decimalFloatingPoint("DURATION");if(m(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}},{key:"plannedDuration",get:function(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}},{key:"endOnNext",get:function(){return this.attr.bool("END-ON-NEXT")}},{key:"isValid",get:function(){return!!this.id&&!this._badValueForSameId&&m(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),e}(),k=function(){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}},M="audio",x="video",O="audiovideo",F=function(){function e(e){var t;this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams=((t={})[M]=null,t[x]=null,t[O]=null,t),this.baseurl=e}return e.prototype.setByteRange=function(e,t){var r,i=e.split("@",2);r=1===i.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(i[1]),this._byteRange=[r,parseInt(i[0])+r]},a(e,[{key:"byteRange",get:function(){return this._byteRange?this._byteRange:[]}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=p.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}]),e}(),N=function(e){function t(t,r){var i;return(i=e.call(this,r)||this)._decryptdata=null,i.rawProgramDateTime=null,i.programDateTime=null,i.tagList=[],i.duration=0,i.sn=0,i.levelkeys=void 0,i.type=void 0,i.loader=null,i.keyLoader=null,i.level=-1,i.cc=0,i.startPTS=void 0,i.endPTS=void 0,i.startDTS=void 0,i.endDTS=void 0,i.start=0,i.deltaPTS=void 0,i.maxStartPTS=void 0,i.minEndPTS=void 0,i.stats=new k,i.data=void 0,i.bitrateTest=!1,i.title=null,i.initSegment=null,i.endList=void 0,i.gap=void 0,i.urlId=0,i.type=t,i}l(t,e);var r=t.prototype;return r.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},r.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},r.setElementaryStreamInfo=function(e,t,r,i,s,n){void 0===n&&(n=!1);var a=this.elementaryStreams,o=a[e];o?(o.startPTS=Math.min(o.startPTS,t),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,i),o.endDTS=Math.max(o.endDTS,s)):a[e]={startPTS:t,endPTS:r,startDTS:i,endDTS:s,partial:n}},r.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[M]=null,e[x]=null,e[O]=null},a(t,[{key:"decryptdata",get:function(){if(!this.levelkeys&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){var e=this.levelkeys.identity;if(e)this._decryptdata=e.getDecryptData(this.sn);else{var t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!m(this.programDateTime))return null;var e=m(this.duration)?this.duration:0;return this.programDateTime+1e3*e}},{key:"encrypted",get:function(){var e;if(null!=(e=this._decryptdata)&&e.encrypted)return!0;if(this.levelkeys){var t=Object.keys(this.levelkeys),r=t.length;if(r>1||1===r&&this.levelkeys[t[0]].encrypted)return!0}return!1}}]),t}(F),B=function(e){function t(t,r,i,s,n){var a;(a=e.call(this,i)||this).fragOffset=0,a.duration=0,a.gap=!1,a.independent=!1,a.relurl=void 0,a.fragment=void 0,a.index=void 0,a.stats=new k,a.duration=t.decimalFloatingPoint("DURATION"),a.gap=t.bool("GAP"),a.independent=t.bool("INDEPENDENT"),a.relurl=t.enumeratedString("URI"),a.fragment=r,a.index=s;var o=t.enumeratedString("BYTERANGE");return o&&a.setByteRange(o,n),n&&(a.fragOffset=n.fragOffset+n.duration),a}return l(t,e),a(t,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var e=this.elementaryStreams;return!!(e.audio||e.video||e.audiovideo)}}]),t}(F),U=function(){function e(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}return e.prototype.reloaded=function(e){if(!e)return this.advanced=!0,void(this.updated=!0);var t=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!t||!this.live,this.advanced=this.endSN>e.endSN||t>0||0===t&&r>0,this.updated||this.advanced?this.misses=Math.floor(.6*e.misses):this.misses=e.misses+1,this.availabilityDelay=e.availabilityDelay},a(e,[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&m(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var e=this.driftEndTime-this.driftStartTime;return e>0?1e3*(this.driftEnd-this.driftStart)/e:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var e;return null!=(e=this.fragments)&&e.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var e;return null!=(e=this.partList)&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}]),e}(),G=f(void 0);function $(e,t,r){return Uint8Array.prototype.slice?e.slice(t,r):new Uint8Array(Array.prototype.slice.call(e,t,r))}var H,W=function(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},q=function(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},V=function(e,t){for(var r=t,i=0;W(e,t);)i+=10,i+=j(e,t+6),q(e,t+10)&&(i+=10),t+=i;if(i>0)return e.subarray(r,r+i)},j=function(e,t){var r=0;return r=(127&e[t])<<21,r|=(127&e[t+1])<<14,(r|=(127&e[t+2])<<7)|127&e[t+3]},z=function(e,t){return W(e,t)&&j(e,t+6)+10<=e.length-t},K=function(e){for(var t=J(e),r=0;r<t.length;r++){var i=t[r];if(Y(i))return re(i)}},Y=function(e){return e&&"PRIV"===e.key&&"com.apple.streaming.transportStreamTimestamp"===e.info},X=function(e){var t=String.fromCharCode(e[0],e[1],e[2],e[3]),r=j(e,4);return{type:t,size:r,data:e.subarray(10,10+r)}},J=function(e){for(var t=0,r=[];W(e,t);){for(var i=j(e,t+6),s=(t+=10)+i;t+8<s;){var n=X(e.subarray(t)),a=Q(n);a&&r.push(a),t+=n.size+10}q(e,t)&&(t+=10)}return r},Q=function(e){return"PRIV"===e.type?Z(e):"W"===e.type[0]?te(e):ee(e)},Z=function(e){if(!(e.size<2)){var t=ie(e.data,!0),r=new Uint8Array(e.data.subarray(t.length+1));return{key:e.type,info:t,data:r.buffer}}},ee=function(e){if(!(e.size<2)){if("TXXX"===e.type){var t=1,r=ie(e.data.subarray(t),!0);t+=r.length+1;var i=ie(e.data.subarray(t));return{key:e.type,info:r,data:i}}var s=ie(e.data.subarray(1));return{key:e.type,data:s}}},te=function(e){if("WXXX"===e.type){if(e.size<2)return;var t=1,r=ie(e.data.subarray(t),!0);t+=r.length+1;var i=ie(e.data.subarray(t));return{key:e.type,info:r,data:i}}var s=ie(e.data);return{key:e.type,data:s}},re=function(e){if(8===e.data.byteLength){var t=new Uint8Array(e.data),r=1&t[3],i=(t[4]<<23)+(t[5]<<15)+(t[6]<<7)+t[7];return i/=45,r&&(i+=47721858.84),Math.round(i)}},ie=function(e,t){void 0===t&&(t=!1);var r=function(){if(!navigator.userAgent.includes("PlayStation 4"))return H||void 0===self.TextDecoder||(H=new self.TextDecoder("utf-8")),H}();if(r){var i=r.decode(e);if(t){var s=i.indexOf("\0");return-1!==s?i.substring(0,s):i}return i.replace(/\0/g,"")}for(var n,a,o,l=e.length,h="",d=0;d<l;){if(0===(n=e[d++])&&t)return h;if(0!==n&&3!==n)switch(n>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:h+=String.fromCharCode(n);break;case 12:case 13:a=e[d++],h+=String.fromCharCode((31&n)<<6|63&a);break;case 14:a=e[d++],o=e[d++],h+=String.fromCharCode((15&n)<<12|(63&a)<<6|63&o)}}return h};var se=function(e){for(var t="",r=0;r<e.length;r++){var i=e[r].toString(16);i.length<2&&(i="0"+i),t+=i}return t},ne=Math.pow(2,32)-1,ae=[].push,oe={video:1,audio:2,id3:3,text:4};function le(e){return String.fromCharCode.apply(null,e)}function he(e,t){var r=e[t]<<8|e[t+1];return r<0?65536+r:r}function de(e,t){var r=ce(e,t);return r<0?4294967296+r:r}function ue(e,t){var r=de(e,t);return(r*=Math.pow(2,32))+de(e,t+4)}function ce(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function fe(e,t,r){e[t]=r>>24,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function ge(e,t){var r=[];if(!t.length)return r;for(var i=e.byteLength,s=0;s<i;){var n=de(e,s),a=n>1?s+n:i;if(le(e.subarray(s+4,s+8))===t[0])if(1===t.length)r.push(e.subarray(s+8,a));else{var o=ge(e.subarray(s+8,a),t.slice(1));o.length&&ae.apply(r,o)}s=a}return r}function pe(e){var t=[],r=e[0],i=8,s=de(e,i);i+=4;var n=0,a=0;0===r?(n=de(e,i),a=de(e,i+4),i+=8):(n=ue(e,i),a=ue(e,i+8),i+=16),i+=2;var o=e.length+a,l=he(e,i);i+=2;for(var h=0;h<l;h++){var d=i,u=de(e,d);d+=4;var c=2147483647&u;if(1==(2147483648&u)>>>31)return P.warn("SIDX has hierarchical references (not supported)"),null;var f=de(e,d);d+=4,t.push({referenceSize:c,subsegmentDuration:f,info:{duration:f/s,start:o,end:o+c-1}}),o+=c,i=d+=4}return{earliestPresentationTime:n,timescale:s,version:r,referencesCount:l,references:t}}function me(e){for(var t=[],r=ge(e,["moov","trak"]),s=0;s<r.length;s++){var n=r[s],a=ge(n,["tkhd"])[0];if(a){var o=a[0],l=de(a,0===o?12:20),h=ge(n,["mdia","mdhd"])[0];if(h){var d=de(h,0===(o=h[0])?12:20),u=ge(n,["mdia","hdlr"])[0];if(u){var c=le(u.subarray(8,12)),f={soun:M,vide:x}[c];if(f){var g=ve(ge(n,["mdia","minf","stbl","stsd"])[0]);t[l]={timescale:d,type:f},t[f]=i({timescale:d,id:l},g)}}}}}return ge(e,["moov","mvex","trex"]).forEach((function(e){var r=de(e,4),i=t[r];i&&(i.default={duration:de(e,12),flags:de(e,20)})})),t}function ve(e){var t=e.subarray(8),r=t.subarray(86),i=le(t.subarray(4,8)),s=i,n="enca"===i||"encv"===i;if(n){var a=ge(t,[i])[0];ge(a.subarray("enca"===i?28:78),["sinf"]).forEach((function(e){var t=ge(e,["schm"])[0];if(t){var r=le(t.subarray(4,8));if("cbcs"===r||"cenc"===r){var i=ge(e,["frma"])[0];i&&(s=le(i))}}}))}switch(s){case"avc1":case"avc2":case"avc3":case"avc4":var o=ge(r,["avcC"])[0];s+="."+Ee(o[1])+Ee(o[2])+Ee(o[3]);break;case"mp4a":var l=ge(t,[i])[0],h=ge(l.subarray(28),["esds"])[0];if(h&&h.length>12){var d=4;if(3!==h[d++])break;d=ye(h,d),d+=2;var u=h[d++];if(128&u&&(d+=2),64&u&&(d+=h[d++]),4!==h[d++])break;d=ye(h,d);var c=h[d++];if(64!==c)break;if(s+="."+Ee(c),d+=12,5!==h[d++])break;d=ye(h,d);var f=h[d++],g=(248&f)>>3;31===g&&(g+=1+((7&f)<<3)+((224&h[d])>>5)),s+="."+g}break;case"hvc1":case"hev1":var p=ge(r,["hvcC"])[0],m=p[1],v=["","A","B","C"][m>>6],y=31&m,E=de(p,2),S=(32&m)>>5?"H":"L",T=p[12],_=p.subarray(6,12);s+="."+v+y,s+="."+E.toString(16).toUpperCase(),s+="."+S+T;for(var b="",L=_.length;L--;){var R=_[L];(R||b)&&(b="."+R.toString(16).toUpperCase()+b)}s+=b;break;case"dvh1":case"dvhe":var P=ge(r,["dvcC"])[0],w=P[2]>>1&127,A=P[2]<<5&32|P[3]>>3&31;s+="."+Se(w)+"."+Se(A);break;case"vp09":var C=ge(r,["vpcC"])[0],D=C[4],I=C[5],k=C[6]>>4&15;s+="."+Se(D)+"."+Se(I)+"."+Se(k);break;case"av01":var M=ge(r,["av1C"])[0],x=M[1]>>>5,O=31&M[1],F=M[2]>>>7?"H":"M",N=(64&M[2])>>6,B=(32&M[2])>>5,U=2===x&&N?B?12:10:N?10:8,G=(16&M[2])>>4,$=(8&M[2])>>3,H=(4&M[2])>>2,W=3&M[2];s+="."+x+"."+Se(O)+F+"."+Se(U)+"."+G+"."+$+H+W+"."+Se(1)+"."+Se(1)+"."+Se(1)+".0"}return{codec:s,encrypted:n}}function ye(e,t){for(var r=t+5;128&e[t++]&&t<r;);return t}function Ee(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Se(e){return(e<10?"0":"")+e}function Te(e){var t=de(e,0),r=8;1&t&&(r+=4),4&t&&(r+=4);for(var i=0,s=de(e,4),n=0;n<s;n++)256&t&&(i+=de(e,r),r+=4),512&t&&(r+=4),1024&t&&(r+=4),2048&t&&(r+=4);return i}function _e(e,t){var r=new Uint8Array(e.length+t.length);return r.set(e),r.set(t,e.length),r}function be(e,t){var r=[],i=t.samples,s=t.timescale,n=t.id,a=!1;return ge(i,["moof"]).map((function(o){var l=o.byteOffset-8;ge(o,["traf"]).map((function(o){var h=ge(o,["tfdt"]).map((function(e){var t=e[0],r=de(e,4);return 1===t&&(r*=Math.pow(2,32),r+=de(e,8)),r/s}))[0];return void 0!==h&&(e=h),ge(o,["tfhd"]).map((function(h){var d=de(h,4),u=16777215&de(h,0),c=0,f=!!(16&u),g=0,p=!!(32&u),m=8;d===n&&(!!(1&u)&&(m+=8),!!(2&u)&&(m+=4),!!(8&u)&&(c=de(h,m),m+=4),f&&(g=de(h,m),m+=4),p&&(m+=4),"video"===t.type&&(a=function(e){if(!e)return!1;var t=e.indexOf("."),r=t<0?e:e.substring(0,t);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(t.codec)),ge(o,["trun"]).map((function(n){var o=n[0],h=16777215&de(n,0),d=!!(1&h),u=0,f=!!(4&h),p=!!(256&h),m=0,v=!!(512&h),y=0,E=!!(1024&h),S=!!(2048&h),T=0,_=de(n,4),b=8;d&&(u=de(n,b),b+=4),f&&(b+=4);for(var L=u+l,R=0;R<_;R++){if(p?(m=de(n,b),b+=4):m=c,v?(y=de(n,b),b+=4):y=g,E&&(b+=4),S&&(T=0===o?de(n,b):ce(n,b),b+=4),t.type===x)for(var P=0;P<y;){var w=de(i,L);Le(a,i[L+=4])&&Re(i.subarray(L,L+w),a?2:1,e+T/s,r),L+=w,P+=w+4}e+=m/s}})))}))}))})),r}function Le(e,t){if(e){var r=t>>1&63;return 39===r||40===r}return 6==(31&t)}function Re(e,t,r,i){var s=Pe(e),n=0;n+=t;for(var a=0,o=0,l=0;n<s.length;){a=0;do{if(n>=s.length)break;a+=l=s[n++]}while(255===l);o=0;do{if(n>=s.length)break;o+=l=s[n++]}while(255===l);var h=s.length-n,d=n;if(o<h)n+=o;else if(o>h){P.error("Malformed SEI payload. "+o+" is too small, only "+h+" bytes left to parse.");break}if(4===a){if(181===s[d++]){var u=he(s,d);if(d+=2,49===u){var c=de(s,d);if(d+=4,1195456820===c){var f=s[d++];if(3===f){var g=s[d++],p=64&g,m=p?2+3*(31&g):0,v=new Uint8Array(m);if(p){v[0]=g;for(var y=1;y<m;y++)v[y]=s[d++]}i.push({type:f,payloadType:a,pts:r,bytes:v})}}}}}else if(5===a&&o>16){for(var E=[],S=0;S<16;S++){var T=s[d++].toString(16);E.push(1==T.length?"0"+T:T),3!==S&&5!==S&&7!==S&&9!==S||E.push("-")}for(var _=o-16,b=new Uint8Array(_),L=0;L<_;L++)b[L]=s[d++];i.push({payloadType:a,pts:r,uuid:E.join(""),userData:ie(b),userDataBytes:b})}}}function Pe(e){for(var t=e.byteLength,r=[],i=1;i<t-2;)0===e[i]&&0===e[i+1]&&3===e[i+2]?(r.push(i+2),i+=2):i++;if(0===r.length)return e;var s=t-r.length,n=new Uint8Array(s),a=0;for(i=0;i<s;a++,i++)a===r[0]&&(a++,r.shift()),n[i]=e[a];return n}var we=function(){function e(e,t,r,i,s){void 0===i&&(i=[1]),void 0===s&&(s=null),this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=t,this.keyFormat=r,this.keyFormatVersions=i,this.iv=s,this.encrypted=!!e&&"NONE"!==e,this.isCommonEncryption=this.encrypted&&"AES-128"!==e}e.clearKeyUriToKeyIdMap=function(){};var t=e.prototype;return t.isSupported=function(){if(this.method){if("AES-128"===this.method||"NONE"===this.method)return!0;if("identity"===this.keyFormat)return"SAMPLE-AES"===this.method}return!1},t.getDecryptData=function(t){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof t&&("AES-128"!==this.method||this.iv||P.warn('missing IV for initialization segment with method="'+this.method+'" - compliance issue'),t=0);var r=function(e){for(var t=new Uint8Array(16),r=12;r<16;r++)t[r]=e>>8*(15-r)&255;return t}(t);return new e(this.method,this.uri,"identity",this.keyFormatVersions,r)}return this},e}();function Ae(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var Ce={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 De(e,t,r){return void 0===r&&(r=!0),!e.split(",").some((function(e){return!Ie(e,t,r)}))}function Ie(e,t,r){var i;void 0===r&&(r=!0);var s=Ae(r);return null!=(i=null==s?void 0:s.isTypeSupported(ke(e,t)))&&i}function ke(e,t){return t+'/mp4;codecs="'+e+'"'}function Me(e){if(e){var t=e.substring(0,4);return Ce.video[t]}return 2}function xe(e){return e.split(",").reduce((function(e,t){var r=Ce.video[t];return r?(2*r+e)/(e?3:2):(Ce.audio[t]+e)/(e?2:1)}),0)}var Oe={},Fe=/flac|opus/i;function Ne(e,t){return void 0===t&&(t=!0),e.replace(Fe,(function(e){return function(e,t){if(void 0===t&&(t=!0),Oe[e])return Oe[e];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[e],i=0;i<r.length;i++)if(Ie(r[i],"audio",t))return Oe[e]=r[i],r[i];return e}(e.toLowerCase(),t)}))}function Be(e,t){return e&&"mp4a"!==e?e:t?t.split(",")[0]:t}var Ue=/#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,Ge=/#EXT-X-MEDIA:(.*)/g,$e=/^#EXT(?:INF|-X-TARGETDURATION):/m,He=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"),We=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("|")),qe=function(){function e(){}return e.findGroup=function(e,t){for(var r=0;r<e.length;r++){var i=e[r];if(i.id===t)return i}},e.resolve=function(e,t){return p.buildAbsoluteURL(t,e,{alwaysNormalize:!0})},e.isMediaPlaylist=function(e){return $e.test(e)},e.parseMasterPlaylist=function(t,r){var i,s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:!1},n=[];for(Ue.lastIndex=0;null!=(i=Ue.exec(t));)if(i[1]){var a,o=new C(i[1]),l=i[2],h={attrs:o,bitrate:o.decimalInteger("BANDWIDTH")||o.decimalInteger("AVERAGE-BANDWIDTH"),name:o.NAME,url:e.resolve(l,r)},d=o.decimalResolution("RESOLUTION");d&&(h.width=d.width,h.height=d.height),ze(o.CODECS,h),null!=(a=h.unknownCodecs)&&a.length||n.push(h),s.levels.push(h)}else if(i[3]){var u=i[3],c=i[4];switch(u){case"SESSION-DATA":var f=new C(c),g=f["DATA-ID"];g&&(null===s.sessionData&&(s.sessionData={}),s.sessionData[g]=f);break;case"SESSION-KEY":var p=Ve(c,r);p.encrypted&&p.isSupported()?(null===s.sessionKeys&&(s.sessionKeys=[]),s.sessionKeys.push(p)):P.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+c+'"');break;case"DEFINE":break;case"CONTENT-STEERING":var m=new C(c);s.contentSteering={uri:e.resolve(m["SERVER-URI"],r),pathwayId:m["PATHWAY-ID"]||"."};break;case"START":s.startTimeOffset=je(c)}}var v=n.length>0&&n.length<s.levels.length;return s.levels=v?n:s.levels,0===s.levels.length&&(s.playlistParsingError=new Error("no levels found in manifest")),s},e.parseMasterPlaylistMedia=function(t,r,i){var s,n={},a=i.levels,o={AUDIO:a.map((function(e){return{id:e.attrs.AUDIO,audioCodec:e.audioCodec}})),SUBTITLES:a.map((function(e){return{id:e.attrs.SUBTITLES,textCodec:e.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(Ge.lastIndex=0;null!==(s=Ge.exec(t));){var h=new C(s[1]),d=h.TYPE;if(d){var u=o[d],c=n[d]||[];n[d]=c;var f=h.LANGUAGE,g=h["ASSOC-LANGUAGE"],p=h.CHANNELS,m=h.CHARACTERISTICS,v=h["INSTREAM-ID"],y={attrs:h,bitrate:0,id:l++,groupId:h["GROUP-ID"]||"",name:h.NAME||f||"",type:d,default:h.bool("DEFAULT"),autoselect:h.bool("AUTOSELECT"),forced:h.bool("FORCED"),lang:f,url:h.URI?e.resolve(h.URI,r):""};if(g&&(y.assocLang=g),p&&(y.channels=p),m&&(y.characteristics=m),v&&(y.instreamId=v),null!=u&&u.length){var E=e.findGroup(u,y.groupId)||u[0];Ke(y,E,"audioCodec"),Ke(y,E,"textCodec")}c.push(y)}}return n},e.parseLevelPlaylist=function(e,t,r,i,s,n){var a,l,h,d=new U(t),u=d.fragments,c=null,f=0,g=0,p=0,v=0,y=null,E=new N(i,t),S=-1,T=!1,_=null;for(He.lastIndex=0,d.m3u8=e,d.hasVariableRefs=!1;null!==(a=He.exec(e));){T&&(T=!1,(E=new N(i,t)).start=p,E.sn=f,E.cc=v,E.level=r,c&&(E.initSegment=c,E.rawProgramDateTime=c.rawProgramDateTime,c.rawProgramDateTime=null,_&&(E.setByteRange(_),_=null)));var b=a[1];if(b){E.duration=parseFloat(b);var L=(" "+a[2]).slice(1);E.title=L||null,E.tagList.push(L?["INF",b,L]:["INF",b])}else if(a[3]){if(m(E.duration)){E.start=p,h&&Je(E,h,d),E.sn=f,E.level=r,E.cc=v,u.push(E);var R=(" "+a[3]).slice(1);E.relurl=R,Ye(E,y),y=E,p+=E.duration,f++,g=0,T=!0}}else if(a[4]){var w=(" "+a[4]).slice(1);y?E.setByteRange(w,y):E.setByteRange(w)}else if(a[5])E.rawProgramDateTime=(" "+a[5]).slice(1),E.tagList.push(["PROGRAM-DATE-TIME",E.rawProgramDateTime]),-1===S&&(S=u.length);else{if(!(a=a[0].match(We))){P.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<a.length&&void 0===a[l];l++);var A=(" "+a[l]).slice(1),D=(" "+a[l+1]).slice(1),k=a[l+2]?(" "+a[l+2]).slice(1):"";switch(A){case"PLAYLIST-TYPE":d.type=D.toUpperCase();break;case"MEDIA-SEQUENCE":f=d.startSN=parseInt(D);break;case"SKIP":var M=new C(D),x=M.decimalInteger("SKIPPED-SEGMENTS");if(m(x)){d.skippedSegments=x;for(var O=x;O--;)u.unshift(null);f+=x}var F=M.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(d.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":d.targetduration=Math.max(parseInt(D),1);break;case"VERSION":d.version=parseInt(D);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":case"DEFINE":break;case"ENDLIST":d.live=!1;break;case"#":(D||k)&&E.tagList.push(k?[D,k]:[D]);break;case"DISCONTINUITY":v++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([A]);break;case"BITRATE":E.tagList.push([A,D]);break;case"DATERANGE":var G=new C(D),$=new I(G,d.dateRanges[G.ID]);$.isValid||d.skippedSegments?d.dateRanges[$.id]=$:P.warn('Ignoring invalid DATERANGE tag: "'+D+'"'),E.tagList.push(["EXT-X-DATERANGE",D]);break;case"DISCONTINUITY-SEQUENCE":v=parseInt(D);break;case"KEY":var H=Ve(D,t);if(H.isSupported()){if("NONE"===H.method){h=void 0;break}h||(h={}),h[H.keyFormat]&&(h=o({},h)),h[H.keyFormat]=H}else P.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+D+'"');break;case"START":d.startTimeOffset=je(D);break;case"MAP":var W=new C(D);if(E.duration){var q=new N(i,t);Xe(q,W,r,h),c=q,E.initSegment=c,c.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=c.rawProgramDateTime)}else{var V=E.byteRangeEndOffset;if(V){var j=E.byteRangeStartOffset;_=V-j+"@"+j}else _=null;Xe(E,W,r,h),c=E,T=!0}break;case"SERVER-CONTROL":var z=new C(D);d.canBlockReload=z.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=z.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&z.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=z.optionalFloat("PART-HOLD-BACK",0),d.holdBack=z.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var K=new C(D);d.partTarget=K.decimalFloatingPoint("PART-TARGET");break;case"PART":var Y=d.partList;Y||(Y=d.partList=[]);var X=g>0?Y[Y.length-1]:void 0,J=g++,Q=new C(D),Z=new B(Q,E,t,J,X);Y.push(Z),E.duration+=Z.duration;break;case"PRELOAD-HINT":var ee=new C(D);d.preloadHint=ee;break;case"RENDITION-REPORT":var te=new C(D);d.renditionReports=d.renditionReports||[],d.renditionReports.push(te);break;default:P.warn("line parsed but not handled: "+a)}}}y&&!y.relurl?(u.pop(),p-=y.duration,d.partList&&(d.fragmentHint=y)):d.partList&&(Ye(E,y),E.cc=v,d.fragmentHint=E,h&&Je(E,h,d));var re=u.length,ie=u[0],se=u[re-1];if((p+=d.skippedSegments*d.targetduration)>0&&re&&se){d.averagetargetduration=p/re;var ne=se.sn;d.endSN="initSegment"!==ne?ne:0,d.live||(se.endList=!0),ie&&(d.startCC=ie.cc)}else d.endSN=0,d.startCC=0;return d.fragmentHint&&(p+=d.fragmentHint.duration),d.totalduration=p,d.endCC=v,S>0&&function(e,t){for(var r=e[t],i=t;i--;){var s=e[i];if(!s)return;s.programDateTime=r.programDateTime-1e3*s.duration,r=s}}(u,S),d},e}();function Ve(e,t,r){var i,s,n=new C(e),a=null!=(i=n.METHOD)?i:"",o=n.URI,l=n.hexadecimalInteger("IV"),h=n.KEYFORMATVERSIONS,d=null!=(s=n.KEYFORMAT)?s:"identity";o&&n.IV&&!l&&P.error("Invalid IV: "+n.IV);var u=o?qe.resolve(o,t):"",c=(h||"1").split("/").map(Number).filter(Number.isFinite);return new we(a,u,d,c,l)}function je(e){var t=new C(e).decimalFloatingPoint("TIME-OFFSET");return m(t)?t:null}function ze(e,t){var r=(e||"").split(/[ ,]+/).filter((function(e){return e}));["video","audio","text"].forEach((function(e){var i=r.filter((function(t){return function(e,t){var r=Ce[t];return!!r&&!!r[e.slice(0,4)]}(t,e)}));i.length&&(t[e+"Codec"]=i.join(","),r=r.filter((function(e){return-1===i.indexOf(e)})))})),t.unknownCodecs=r}function Ke(e,t,r){var i=t[r];i&&(e[r]=i)}function Ye(e,t){e.rawProgramDateTime?e.programDateTime=Date.parse(e.rawProgramDateTime):null!=t&&t.programDateTime&&(e.programDateTime=t.endProgramDateTime),m(e.programDateTime)||(e.programDateTime=null,e.rawProgramDateTime=null)}function Xe(e,t,r,i){e.relurl=t.URI,t.BYTERANGE&&e.setByteRange(t.BYTERANGE),e.level=r,e.sn="initSegment",i&&(e.levelkeys=i),e.initSegment=null}function Je(e,t,r){e.levelkeys=t;var i=r.encryptedFragments;i.length&&i[i.length-1].levelkeys===t||!Object.keys(t).some((function(e){return t[e].isCommonEncryption}))||i.push(e)}var Qe="manifest",Ze="level",et="audioTrack",tt="subtitleTrack",rt="main",it="audio",st="subtitle";function nt(e){switch(e.type){case et:return it;case tt:return st;default:return rt}}function at(e,t){var r=e.url;return void 0!==r&&0!==r.indexOf("data:")||(r=t.url),r}var ot=function(){function e(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=e,this.registerListeners()}var t=e.prototype;return t.startLoad=function(e){},t.stopLoad=function(){this.destroyInternalLoaders()},t.registerListeners=function(){var e=this.hls;e.on(E.MANIFEST_LOADING,this.onManifestLoading,this),e.on(E.LEVEL_LOADING,this.onLevelLoading,this),e.on(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.unregisterListeners=function(){var e=this.hls;e.off(E.MANIFEST_LOADING,this.onManifestLoading,this),e.off(E.LEVEL_LOADING,this.onLevelLoading,this),e.off(E.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(E.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},t.createInternalLoader=function(e){var t=this.hls.config,r=t.pLoader,i=t.loader,s=new(r||i)(t);return this.loaders[e.type]=s,s},t.getInternalLoader=function(e){return this.loaders[e.type]},t.resetInternalLoader=function(e){this.loaders[e]&&delete this.loaders[e]},t.destroyInternalLoaders=function(){for(var e in this.loaders){var t=this.loaders[e];t&&t.destroy(),this.resetInternalLoader(e)}},t.destroy=function(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()},t.onManifestLoading=function(e,t){var r=t.url;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Qe,url:r,deliveryDirectives:null})},t.onLevelLoading=function(e,t){var r=t.id,i=t.level,s=t.pathwayId,n=t.url,a=t.deliveryDirectives;this.load({id:r,level:i,pathwayId:s,responseType:"text",type:Ze,url:n,deliveryDirectives:a})},t.onAudioTrackLoading=function(e,t){var r=t.id,i=t.groupId,s=t.url,n=t.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:et,url:s,deliveryDirectives:n})},t.onSubtitleTrackLoading=function(e,t){var r=t.id,i=t.groupId,s=t.url,n=t.deliveryDirectives;this.load({id:r,groupId:i,level:null,responseType:"text",type:tt,url:s,deliveryDirectives:n})},t.load=function(e){var t,r,i,s=this,n=this.hls.config,a=this.getInternalLoader(e);if(a){var l=a.context;if(l&&l.url===e.url&&l.level===e.level)return void P.trace("[playlist-loader]: playlist request ongoing");P.log("[playlist-loader]: aborting previous loader for type: "+e.type),a.abort()}if(r=e.type===Qe?n.manifestLoadPolicy.default:o({},n.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),a=this.createInternalLoader(e),m(null==(t=e.deliveryDirectives)?void 0:t.part)&&(e.type===Ze&&null!==e.level?i=this.hls.levels[e.level].details:e.type===et&&null!==e.id?i=this.hls.audioTracks[e.id].details:e.type===tt&&null!==e.id&&(i=this.hls.subtitleTracks[e.id].details),i)){var h=i.partTarget,d=i.targetduration;if(h&&d){var u=1e3*Math.max(3*h,.8*d);r=o({},r,{maxTimeToFirstByteMs:Math.min(u,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(u,r.maxTimeToFirstByteMs)})}}var c=r.errorRe