UNPKG

swarmcloud-hls

Version:

Let your viewers become your unlimitedly scalable CDN.

1 lines 731 kB
!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,i="object"==typeof Reflect?Reflect:null,r=i&&"function"==typeof i.apply?i.apply:function(e,t,i){return Function.prototype.apply.call(e,t,i)};t=i&&"function"==typeof i.ownKeys?i.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(i,r){function s(i){e.removeListener(t,n),r(i)}function n(){"function"==typeof e.removeListener&&e.removeListener("error",s),i([].slice.call(arguments))}p(e,t,n,{once:!0}),"error"!==t&&function(e,t,i){"function"==typeof e.on&&p(e,"error",t,i)}(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,i,r){var s,n,a,h;if(o(i),void 0===(n=e._events)?(n=e._events=Object.create(null),e._eventsCount=0):(void 0!==n.newListener&&(e.emit("newListener",t,i.listener?i.listener:i),n=e._events),a=n[t]),void 0===a)a=n[t]=i,++e._eventsCount;else if("function"==typeof a?a=n[t]=r?[i,a]:[a,i]:r?a.unshift(i):a.push(i),(s=l(e))>0&&a.length>s&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,h=u,console&&console.warn&&console.warn(h)}return e}function u(){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 d(e,t,i){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:i},s=u.bind(r);return s.listener=i,r.wrapFn=s,s}function c(e,t,i){var r=e._events;if(void 0===r)return[];var s=r[t];return void 0===s?[]:"function"==typeof s?i?[s.listener||s]:[s]:i?function(e){for(var t=new Array(e.length),i=0;i<t.length;++i)t[i]=e[i].listener||e[i];return t}(s):g(s,s.length)}function f(e){var t=this._events;if(void 0!==t){var i=t[e];if("function"==typeof i)return 1;if(void 0!==i)return i.length}return 0}function g(e,t){for(var i=new Array(t),r=0;r<t;++r)i[r]=e[r];return i}function p(e,t,i,r){if("function"==typeof e.on)r.once?e.once(t,i):e.on(t,i);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){r.once&&e.removeEventListener(t,s),i(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=[],i=1;i<arguments.length;i++)t.push(arguments[i]);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)r(l,this,t);else{var h=l.length,u=g(l,h);for(i=0;i<h;++i)r(u[i],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,d(this,e,t)),this},n.prototype.prependOnceListener=function(e,t){return o(t),this.prependListener(e,d(this,e,t)),this},n.prototype.removeListener=function(e,t){var i,r,s,n,a;if(o(t),void 0===(r=this._events))return this;if(void 0===(i=r[e]))return this;if(i===t||i.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,i.listener||t));else if("function"!=typeof i){for(s=-1,n=i.length-1;n>=0;n--)if(i[n]===t||i[n].listener===t){a=i[n].listener,s=n;break}if(s<0)return this;0===s?i.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(i,s),1===i.length&&(r[e]=i[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(e){var t,i,r;if(void 0===(i=this._events))return this;if(void 0===i.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==i[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete i[e]),this;if(0===arguments.length){var s,n=Object.keys(i);for(r=0;r<n.length;++r)"removeListener"!==(s=n[r])&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=i[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);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 i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.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 i.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=r.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 u=o.path,d=u.substring(0,u.lastIndexOf("/")+1)+n.path;h.path=a.normalizePath(d)}else h.path=o.path,n.params||(h.params=o.params,n.query||(h.query=o.query));return null===h.path&&(h.path=i.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(h)},parseURL:function(e){var t=i.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}()},251:e=>{!function t(i){var r;r=function(){"use strict";function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function r(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(e,t,i){return(t=c(t))in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},n.apply(null,arguments)}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,d(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function h(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,r)}return i}function u(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?h(Object(i),!0).forEach((function(t){s(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,t);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function f(e){var t="function"==typeof Map?new Map:void 0;return f=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,i)}function i(){return function(e,t,i){if(l())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var s=new(e.bind.apply(e,r));return i&&d(s,i.prototype),s}(e,arguments,a(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),d(i,e)},f(e)}var g,p,m={exports:{}},v=(g||(g=1,function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function s(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function n(e,t,r,n,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var o=new s(r,n||e,a),l=i?i+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function o(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),o.prototype.eventNames=function(){var e,r,s=[];if(0===this._eventsCount)return s;for(r in e=this._events)t.call(e,r)&&s.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?s.concat(Object.getOwnPropertySymbols(e)):s},o.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,a=new Array(n);s<n;s++)a[s]=r[s].fn;return a},o.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},o.prototype.emit=function(e,t,r,s,n,a){var o=i?i+e:e;if(!this._events[o])return!1;var l,h,u=this._events[o],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,s),!0;case 5:return u.fn.call(u.context,t,r,s,n),!0;case 6:return u.fn.call(u.context,t,r,s,n,a),!0}for(h=1,l=new Array(d-1);h<d;h++)l[h-1]=arguments[h];u.fn.apply(u.context,l)}else{var c,f=u.length;for(h=0;h<f;h++)switch(u[h].once&&this.removeListener(e,u[h].fn,void 0,!0),d){case 1:u[h].fn.call(u[h].context);break;case 2:u[h].fn.call(u[h].context,t);break;case 3:u[h].fn.call(u[h].context,t,r);break;case 4:u[h].fn.call(u[h].context,t,r,s);break;default:if(!l)for(c=1,l=new Array(d-1);c<d;c++)l[c-1]=arguments[c];u[h].fn.apply(u[h].context,l)}}return!0},o.prototype.on=function(e,t,i){return n(this,e,t,i,!1)},o.prototype.once=function(e,t,i){return n(this,e,t,i,!0)},o.prototype.removeListener=function(e,t,r,s){var n=i?i+e:e;if(!this._events[n])return this;if(!t)return a(this,n),this;var o=this._events[n];if(o.fn)o.fn!==t||s&&!o.once||r&&o.context!==r||a(this,n);else{for(var l=0,h=[],u=o.length;l<u;l++)(o[l].fn!==t||s&&!o[l].once||r&&o[l].context!==r)&&h.push(o[l]);h.length?this._events[n]=1===h.length?h[0]:h:a(this,n)}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=i,o.EventEmitter=o,e.exports=o}(m)),m.exports),y=function(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}(v),E={exports:{}},S=(p||(p=1,function(e,t){var i,r,s,n,a;i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,r=/^(?=([^\/?#]*))\1([^]*)$/,s=/(?:\/|^)\.(?=\/)/g,n=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.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 i.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=r.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 u=o.path,d=u.substring(0,u.lastIndexOf("/")+1)+n.path;h.path=a.normalizePath(d)}else h.path=o.path,n.params||(h.params=o.params,n.query||(h.query=o.query));return null===h.path&&(h.path=i.alwaysNormalize?a.normalizePath(n.path):n.path),a.buildURLFromParts(h)},parseURL:function(e){var t=i.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}(E)),E.exports),T=Number.isFinite||function(e){return"number"==typeof e&&isFinite(e)},L=Number.isSafeInteger||function(e){return"number"==typeof e&&Math.abs(e)<=_},_=Number.MAX_SAFE_INTEGER||9007199254740991,b=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}({}),A=function(e){return e.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",e.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",e.KEY_SYSTEM_NO_SESSION="keySystemNoSession",e.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",e.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",e.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",e.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",e.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",e.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",e.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",e.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",e.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",e.MANIFEST_LOAD_ERROR="manifestLoadError",e.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",e.MANIFEST_PARSING_ERROR="manifestParsingError",e.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",e.LEVEL_EMPTY_ERROR="levelEmptyError",e.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.ASSET_LIST_LOAD_ERROR="assetListLoadError",e.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",e.ASSET_LIST_PARSING_ERROR="assetListParsingError",e.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",e.INTERNAL_EXCEPTION="internalException",e.INTERNAL_ABORTED="aborted",e.ATTACH_MEDIA_ERROR="attachMediaError",e.UNKNOWN="unknown",e}({}),I=function(e){return e.MEDIA_ATTACHING="hlsMediaAttaching",e.MEDIA_ATTACHED="hlsMediaAttached",e.MEDIA_DETACHING="hlsMediaDetaching",e.MEDIA_DETACHED="hlsMediaDetached",e.MEDIA_ENDED="hlsMediaEnded",e.STALL_RESOLVED="hlsStallResolved",e.BUFFER_RESET="hlsBufferReset",e.BUFFER_CODECS="hlsBufferCodecs",e.BUFFER_CREATED="hlsBufferCreated",e.BUFFER_APPENDING="hlsBufferAppending",e.BUFFER_APPENDED="hlsBufferAppended",e.BUFFER_EOS="hlsBufferEos",e.BUFFERED_TO_END="hlsBufferedToEnd",e.BUFFER_FLUSHING="hlsBufferFlushing",e.BUFFER_FLUSHED="hlsBufferFlushed",e.MANIFEST_LOADING="hlsManifestLoading",e.MANIFEST_LOADED="hlsManifestLoaded",e.MANIFEST_PARSED="hlsManifestParsed",e.LEVEL_SWITCHING="hlsLevelSwitching",e.LEVEL_SWITCHED="hlsLevelSwitched",e.LEVEL_LOADING="hlsLevelLoading",e.LEVEL_LOADED="hlsLevelLoaded",e.LEVEL_UPDATED="hlsLevelUpdated",e.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",e.LEVELS_UPDATED="hlsLevelsUpdated",e.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",e.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",e.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",e.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",e.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",e.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",e.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",e.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",e.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",e.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",e.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",e.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",e.SUBTITLE_FRAG_PROCESSED="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.ASSET_LIST_LOADING="hlsAssetListLoading",e.ASSET_LIST_LOADED="hlsAssetListLoaded",e.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",e.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",e.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",e.INTERSTITIAL_STARTED="hlsInterstitialStarted",e.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",e.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",e.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",e.INTERSTITIAL_ENDED="hlsInterstitialEnded",e.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",e.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",e.EVENT_CUE_ENTER="hlsEventCueEnter",e}({}),R="manifest",P="level",k="audioTrack",D="subtitleTrack",w="main",C="audio",M="subtitle",O=function(){function e(e,t,i){void 0===t&&(t=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=t,this.totalWeight_=i}var t=e.prototype;return t.sample=function(e,t){var i=Math.pow(this.alpha_,e);this.estimate_=t*(1-i)+i*this.estimate_,this.totalWeight_+=e},t.getTotalWeight=function(){return this.totalWeight_},t.getEstimate=function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_},e}(),x=function(){function e(e,t,i,r){void 0===r&&(r=100),this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=i,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new O(e),this.fast_=new O(t),this.defaultTTFB_=r,this.ttfb_=new O(e)}var t=e.prototype;return t.update=function(e,t){var i=this.slow_,r=this.fast_,s=this.ttfb_;i.halfLife!==e&&(this.slow_=new O(e,i.getEstimate(),i.getTotalWeight())),r.halfLife!==t&&(this.fast_=new O(t,r.getEstimate(),r.getTotalWeight())),s.halfLife!==e&&(this.ttfb_=new O(e,s.getEstimate(),s.getTotalWeight()))},t.sample=function(e,t){var i=(e=Math.max(e,this.minDelayMs_))/1e3,r=8*t/i;this.fast_.sample(i,r),this.slow_.sample(i,r)},t.sampleTTFB=function(e){var t=e/1e3,i=Math.sqrt(2)*Math.exp(-Math.pow(t,2)/2);this.ttfb_.sample(i,Math.max(e,5))},t.canEstimate=function(){return this.fast_.getTotalWeight()>=this.minWeight_},t.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},t.getEstimateTTFB=function(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_},t.destroy=function(){},r(e,[{key:"defaultEstimate",get:function(){return this.defaultEstimate_}}])}(),F=function(e,t){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;var i="["+e+"]:";this.trace=N,this.debug=t.debug.bind(null,i),this.log=t.log.bind(null,i),this.warn=t.warn.bind(null,i),this.info=t.info.bind(null,i),this.error=t.error.bind(null,i)},N=function(){},B={trace:N,debug:N,log:N,warn:N,info:N,error:N};function U(){return n({},B)}function G(e,t,i){return t[e]?t[e].bind(t):function(e,t){var i=self.console[e];return i?i.bind(self.console,(t?"["+t+"] ":"")+"["+e+"] >"):N}(e,i)}var H=U();function K(e,t,i){var r=U();if("object"==typeof console&&!0===e||"object"==typeof e){var s=["debug","log","info","warn","error"];s.forEach((function(t){r[t]=G(t,e,i)}));try{r.log('Debug logs enabled for "'+t+'" in hls.js version 1.6.5')}catch(e){return U()}s.forEach((function(t){H[t]=G(t,e)}))}else n(H,r);return r}var V=H;function W(e){if(void 0===e&&(e=!0),"undefined"!=typeof self)return(e||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function $(e,t){var i=Object.keys(e),r=Object.keys(t),s=i.length,n=r.length;return!s||!n||s===n&&!i.some((function(e){return-1===r.indexOf(e)}))}function q(e,t){if(void 0===t&&(t=!1),"undefined"!=typeof TextDecoder){var i=new TextDecoder("utf-8").decode(e);if(t){var r=i.indexOf("\0");return-1!==r?i.substring(0,r):i}return i.replace(/\0/g,"")}for(var s,n,a,o=e.length,l="",h=0;h<o;){if(0===(s=e[h++])&&t)return l;if(0!==s&&3!==s)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:l+=String.fromCharCode(s);break;case 12:case 13:n=e[h++],l+=String.fromCharCode((31&s)<<6|63&n);break;case 14:n=e[h++],a=e[h++],l+=String.fromCharCode((15&s)<<12|(63&n)<<6|63&a)}}return l}var j=function(e){for(var t="",i=0;i<e.length;i++){var r=e[i].toString(16);r.length<2&&(r="0"+r),t+=r}return t},Y=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}},z="audio",X="video",Q="audiovideo",J=function(){function e(e){var t;this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,"string"==typeof e&&(e={url:e}),this.base=e,(t=ie(this,"stats"))&&(t.enumerable=!0,Object.defineProperty(this,"stats",t))}var t=e.prototype;return t.setByteRange=function(e,t){var i,r=e.split("@",2);i=1===r.length?(null==t?void 0:t.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[i,parseInt(r[0])+i]},t.clearElementaryStreamInfo=function(){var e=this.elementaryStreams;e[z]=null,e[X]=null,e[Q]=null},r(e,[{key:"baseurl",get:function(){return this.base.url}},{key:"byteRange",get:function(){return null===this._byteRange?[]:this._byteRange}},{key:"byteRangeStartOffset",get:function(){return this.byteRange[0]}},{key:"byteRangeEndOffset",get:function(){return this.byteRange[1]}},{key:"elementaryStreams",get:function(){var e;return null===this._streams&&(this._streams=((e={})[z]=null,e[X]=null,e[Q]=null,e)),this._streams},set:function(e){this._streams=e}},{key:"hasStats",get:function(){return null!==this._stats}},{key:"hasStreams",get:function(){return null!==this._streams}},{key:"stats",get:function(){return null===this._stats&&(this._stats=new Y),this._stats},set:function(e){this._stats=e}},{key:"url",get:function(){return!this._url&&this.baseurl&&this.relurl&&(this._url=S.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(e){this._url=e}}])}();function Z(e){return"initSegment"!==e.sn}var ee=function(e){function t(t,i){var r;return(r=e.call(this,i)||this)._decryptdata=null,r._programDateTime=null,r._ref=null,r._bitrate=void 0,r.rawProgramDateTime=null,r.tagList=[],r.duration=0,r.sn=0,r.levelkeys=void 0,r.type=void 0,r.loader=null,r.keyLoader=null,r.level=-1,r.cc=0,r.startPTS=void 0,r.endPTS=void 0,r.startDTS=void 0,r.endDTS=void 0,r.start=0,r.playlistOffset=0,r.deltaPTS=void 0,r.maxStartPTS=void 0,r.minEndPTS=void 0,r.data=void 0,r.bitrateTest=!1,r.title=null,r.initSegment=null,r.endList=void 0,r.gap=void 0,r.urlId=0,r.type=t,r}o(t,e);var i=t.prototype;return i.addStart=function(e){this.setStart(this.start+e)},i.setStart=function(e){this.start=e,this._ref&&(this._ref.start=e)},i.setDuration=function(e){this.duration=e,this._ref&&(this._ref.duration=e)},i.setKeyFormat=function(e){if(this.levelkeys){var t=this.levelkeys[e];t&&!this._decryptdata&&(this._decryptdata=t.getDecryptData(this.sn))}},i.abortRequests=function(){var e,t;null==(e=this.loader)||e.abort(),null==(t=this.keyLoader)||t.abort()},i.setElementaryStreamInfo=function(e,t,i,r,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,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,s)):a[e]={startPTS:t,endPTS:i,startDTS:r,endDTS:s,partial:n}},r(t,[{key:"byteLength",get:function(){if(this.hasStats){var e=this.stats.total;if(e)return e}if(this.byteRange){var t=this.byteRange[0],i=this.byteRange[1];if(T(t)&&T(i))return i-t}return null}},{key:"bitrate",get:function(){return this.byteLength?8*this.byteLength/this.duration:this._bitrate?this._bitrate:null},set:function(e){this._bitrate=e}},{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;var e=T(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),i=t.length;if(i>1||1===i&&this.levelkeys[t[0]].encrypted)return!0}return!1}},{key:"programDateTime",get:function(){return null===this._programDateTime&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime},set:function(e){T(e)?this._programDateTime=e:this._programDateTime=this.rawProgramDateTime=null}},{key:"ref",get:function(){return Z(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}}])}(J),te=function(e){function t(t,i,r,s,n){var a;(a=e.call(this,r)||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.duration=t.decimalFloatingPoint("DURATION"),a.gap=t.bool("GAP"),a.independent=t.bool("INDEPENDENT"),a.relurl=t.enumeratedString("URI"),a.fragment=i,a.index=s;var o=t.enumeratedString("BYTERANGE");return o&&a.setByteRange(o,n),n&&(a.fragOffset=n.fragOffset+n.duration),a}return o(t,e),r(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)}}])}(J);function ie(e,t){var i=Object.getPrototypeOf(e);if(i)return Object.getOwnPropertyDescriptor(i,t)||ie(i,t)}var re=Math.pow(2,32)-1,se=[].push,ne={video:1,audio:2,id3:3,text:4};function ae(e){return String.fromCharCode.apply(null,e)}function oe(e,t){var i=e[t]<<8|e[t+1];return i<0?65536+i:i}function le(e,t){var i=ue(e,t);return i<0?4294967296+i:i}function he(e,t){var i=le(e,t);return(i*=Math.pow(2,32))+le(e,t+4)}function ue(e,t){return e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]}function de(e,t,i){e[t]=i>>24,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i}function ce(e,t){var i=[];if(!t.length)return i;for(var r=e.byteLength,s=0;s<r;){var n=le(e,s),a=n>1?s+n:r;if(ae(e.subarray(s+4,s+8))===t[0])if(1===t.length)i.push(e.subarray(s+8,a));else{var o=ce(e.subarray(s+8,a),t.slice(1));o.length&&se.apply(i,o)}s=a}return i}function fe(e){var t=[],i=e[0],r=8,s=le(e,r);r+=4;var n=0,a=0;0===i?(n=le(e,r),a=le(e,r+4),r+=8):(n=he(e,r),a=he(e,r+8),r+=16),r+=2;var o=e.length+a,l=oe(e,r);r+=2;for(var h=0;h<l;h++){var u=r,d=le(e,u);u+=4;var c=2147483647&d;if(1==(2147483648&d)>>>31)return V.warn("SIDX has hierarchical references (not supported)"),null;var f=le(e,u);u+=4,t.push({referenceSize:c,subsegmentDuration:f,info:{duration:f/s,start:o,end:o+c-1}}),o+=c,r=u+=4}return{earliestPresentationTime:n,timescale:s,version:i,referencesCount:l,references:t}}function ge(e){for(var t=[],i=ce(e,["moov","trak"]),r=0;r<i.length;r++){var s=i[r],n=ce(s,["tkhd"])[0];if(n){var a=n[0],o=le(n,0===a?12:20),l=ce(s,["mdia","mdhd"])[0];if(l){var h=le(l,0===(a=l[0])?12:20),d=ce(s,["mdia","hdlr"])[0];if(d){var c=ae(d.subarray(8,12)),f={soun:z,vide:X}[c],g=pe(ce(s,["mdia","minf","stbl","stsd"])[0]);f?(t[o]={timescale:h,type:f,stsd:g},t[f]=u({timescale:h,id:o},g)):t[o]={timescale:h,type:c,stsd:g}}}}}return ce(e,["moov","mvex","trex"]).forEach((function(e){var i=le(e,4),r=t[i];r&&(r.default={duration:le(e,12),flags:le(e,20)})})),t}function pe(e){var t,i=e.subarray(8),r=i.subarray(86),s=ae(i.subarray(4,8)),n=s,a="enca"===s||"encv"===s;if(a){var o=ce(i,[s])[0];ce(o.subarray("enca"===s?28:78),["sinf"]).forEach((function(e){var t=ce(e,["schm"])[0];if(t){var i=ae(t.subarray(4,8));if("cbcs"===i||"cenc"===i){var r=ce(e,["frma"])[0];r&&(n=ae(r))}}}))}var l=n;switch(n){case"avc1":case"avc2":case"avc3":case"avc4":var h=ce(r,["avcC"])[0];h&&h.length>3&&(n+="."+ye(h[1])+ye(h[2])+ye(h[3]),t=me("avc1"===l?"dva1":"dvav",r));break;case"mp4a":var u=ce(i,[s])[0],d=ce(u.subarray(28),["esds"])[0];if(d&&d.length>7){var c=4;if(3!==d[c++])break;c=ve(d,c),c+=2;var f=d[c++];if(128&f&&(c+=2),64&f&&(c+=d[c++]),4!==d[c++])break;c=ve(d,c);var g=d[c++];if(64!==g)break;if(n+="."+ye(g),c+=12,5!==d[c++])break;c=ve(d,c);var p=d[c++],m=(248&p)>>3;31===m&&(m+=1+((7&p)<<3)+((224&d[c])>>5)),n+="."+m}break;case"hvc1":case"hev1":var v=ce(r,["hvcC"])[0];if(v&&v.length>12){var y=v[1],E=["","A","B","C"][y>>6],S=31&y,T=le(v,2),L=(32&y)>>5?"H":"L",_=v[12],b=v.subarray(6,12);n+="."+E+S,n+="."+function(e){for(var t=0,i=0;i<32;i++)t|=(e>>i&1)<<31-i;return t>>>0}(T).toString(16).toUpperCase(),n+="."+L+_;for(var A="",I=b.length;I--;){var R=b[I];(R||A)&&(A="."+R.toString(16).toUpperCase()+A)}n+=A}t=me("hev1"==l?"dvhe":"dvh1",r);break;case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":n=me(n,r)||n;break;case"vp09":var P=ce(r,["vpcC"])[0];if(P&&P.length>6){var k=P[4],D=P[5],w=P[6]>>4&15;n+="."+Ee(k)+"."+Ee(D)+"."+Ee(w)}break;case"av01":var C=ce(r,["av1C"])[0];if(C&&C.length>2){var M=C[1]>>>5,O=31&C[1],x=C[2]>>>7?"H":"M",F=(64&C[2])>>6,N=(32&C[2])>>5,B=2===M&&F?N?12:10:F?10:8,U=(16&C[2])>>4,G=(8&C[2])>>3,H=(4&C[2])>>2,K=3&C[2];n+="."+M+"."+Ee(O)+x+"."+Ee(B)+"."+U+"."+G+H+K+"."+Ee(1)+"."+Ee(1)+"."+Ee(1)+".0",t=me("dav1",r)}}return{codec:n,encrypted:a,supplemental:t}}function me(e,t){var i=ce(t,["dvvC"]),r=i.length?i[0]:ce(t,["dvcC"])[0];if(r){var s=r[2]>>1&127,n=r[2]<<5&32|r[3]>>3&31;return e+"."+Ee(s)+"."+Ee(n)}}function ve(e,t){for(var i=t+5;128&e[t++]&&t<i;);return t}function ye(e){return("0"+e.toString(16).toUpperCase()).slice(-2)}function Ee(e){return(e<10?"0":"")+e}function Se(e){var t=ce(e,["schm"])[0];if(t){var i=ae(t.subarray(4,8));if("cbcs"===i||"cenc"===i)return ce(e,["schi","tenc"])[0]}return null}function Te(e,t){var i=new Uint8Array(e.length+t.length);return i.set(e),i.set(t,e.length),i}function Le(e,t){var i=[],r=t.samples,s=t.timescale,n=t.id,a=!1;return ce(r,["moof"]).map((function(o){var l=o.byteOffset-8;ce(o,["traf"]).map((function(o){var h=ce(o,["tfdt"]).map((function(e){var t=e[0],i=le(e,4);return 1===t&&(i*=Math.pow(2,32),i+=le(e,8)),i/s}))[0];return void 0!==h&&(e=h),ce(o,["tfhd"]).map((function(h){var u=le(h,4),d=16777215&le(h,0),c=0,f=!!(16&d),g=0,p=!!(32&d),m=8;u===n&&(!!(1&d)&&(m+=8),!!(2&d)&&(m+=4),!!(8&d)&&(c=le(h,m),m+=4),f&&(g=le(h,m),m+=4),p&&(m+=4),"video"===t.type&&(a=_e(t.codec)),ce(o,["trun"]).map((function(n){var o=n[0],h=16777215&le(n,0),u=!!(1&h),d=0,f=!!(4&h),p=!!(256&h),m=0,v=!!(512&h),y=0,E=!!(1024&h),S=!!(2048&h),T=0,L=le(n,4),_=8;u&&(d=le(n,_),_+=4),f&&(_+=4);for(var b=d+l,A=0;A<L;A++){if(p?(m=le(n,_),_+=4):m=c,v?(y=le(n,_),_+=4):y=g,E&&(_+=4),S&&(T=0===o?le(n,_):ue(n,_),_+=4),t.type===X)for(var I=0;I<y;){var R=le(r,b);be(a,r[b+=4])&&Ae(r.subarray(b,b+R),a?2:1,e+T/s,i),b+=R,I+=R+4}e+=m/s}})))}))}))})),i}function _e(e){if(!e)return!1;var t=e.substring(0,4);return"hvc1"===t||"hev1"===t||"dvh1"===t||"dvhe"===t}function be(e,t){if(e){var i=t>>1&63;return 39===i||40===i}return 6==(31&t)}function Ae(e,t,i,r){var s=Ie(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,u=n;if(o<h)n+=o;else if(o>h){V.error("Malformed SEI payload. "+o+" is too small, only "+h+" bytes left to parse.");break}if(4===a){if(181===s[u++]){var d=oe(s,u);if(u+=2,49===d){var c=le(s,u);if(u+=4,1195456820===c){var f=s[u++];if(3===f){var g=s[u++],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[u++]}r.push({type:f,payloadType:a,pts:i,bytes:v})}}}}}else if(5===a&&o>16){for(var E=[],S=0;S<16;S++){var T=s[u++].toString(16);E.push(1==T.length?"0"+T:T),3!==S&&5!==S&&7!==S&&9!==S||E.push("-")}for(var L=o-16,_=new Uint8Array(L),b=0;b<L;b++)_[b]=s[u++];r.push({payloadType:a,pts:i,uuid:E.join(""),userData:q(_),userDataBytes:_})}}}function Ie(e){for(var t=e.byteLength,i=[],r=1;r<t-2;)0===e[r]&&0===e[r+1]&&3===e[r+2]?(i.push(r+2),r+=2):r++;if(0===i.length)return e;var s=t-i.length,n=new Uint8Array(s),a=0;for(r=0;r<s;a++,r++)a===i[0]&&(a++,i.shift()),n[r]=e[a];return n}function Re(e){var t=e.getUint32(0),i=e.byteOffset,r=e.byteLength;if(r<t)return{offset:i,size:r};if(1886614376!==e.getUint32(4))return{offset:i,size:t};var s=e.getUint32(8)>>>24;if(0!==s&&1!==s)return{offset:i,size:t};var n=e.buffer,a=j(new Uint8Array(n,i+12,16)),o=e.getUint32(28),l=null,h=null;if(0===s){if(t-32<o||o<22)return{offset:i,size:t};h=new Uint8Array(n,i+32,o)}else if(1===s){if(!o||r<i+32+16*o+16)return{offset:i,size:t};l=[];for(var u=0;u<o;u++)l.push(new Uint8Array(n,i+32+16*u,16))}return{version:s,systemId:a,kids:l,data:h,offset:i,size:t}}var Pe=function(){return/\(Windows.+Firefox\//i.test(navigator.userAgent)},ke={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function De(e,t){var i=ke[t];return!!i&&!!i[e.slice(0,4)]}function we(e,t,i){return void 0===i&&(i=!0),!e.split(",").some((function(e){return!Ce(e,t,i)}))}function Ce(e,t,i){var r;void 0===i&&(i=!0);var s=W(i);return null!=(r=null==s?void 0:s.isTypeSupported(Me(e,t)))&&r}function Me(e,t){return t+"/mp4;codecs="+e}function Oe(e){if(e){var t=e.substring(0,4);return ke.video[t]}return 2}function xe(e){var t=Pe();return e.split(",").reduce((function(e,i){var r=t&&_e(i)?9:ke.video[i];return r?(2*r+e)/(e?3:2):(ke.audio[i]+e)/(e?2:1)}),0)}var Fe={},Ne=/flac|opus|mp4a\.40\.34/i;function Be(e,t){return void 0===t&&(t=!0),e.replace(Ne,(function(e){return function(e,t){if(void 0===t&&(t=!0),Fe[e])return Fe[e];for(var i={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[e],r=0;r<i.length;r++){var s;if(Ce(i[r],"audio",t))return Fe[e]=i[r],i[r];if("mp3"===i[r]&&null!=(s=W(t))&&s.isTypeSupported("audio/mpeg"))return""}return e}(e.toLowerCase(),t)}))}function Ue(e,t){if(e&&(e.length>4||-1!==["ac-3","ec-3","alac","fLaC","Opus"].indexOf(e)))return e;if(t){var i=t.split(",");if(i.length>1){if(e)for(var r=i.length;r--;)if(i[r].substring(0,4)===e.substring(0,4))return i[r];return i[0]}}return t||e}function Ge(e){if(e.startsWith("av01.")){for(var t=e.split("."),i=["0","111","01","01","01","0"],r=t.length;r>4&&r<10;r++)t[r]=i[r-4];return t.join(".")}return e}function He(e){var t=W(e)||{isTypeSupported:function(){return!1}};return{mpeg:t.isTypeSupported("audio/mpeg"),mp3:t.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:t.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Ke(e){return e.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}var Ve={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]};function We(e,t){return{supported:!1,configurations:t,decodingInfoResults:[{supported:!1,smooth:!1,powerEfficient:!1}],error:e}}var $e={};function qe(e,t,i){var r=e.videoCodec,s=e.audioCodec;if(!r&&!s||!i)return Promise.resolve(Ve);var n=[];if(r){var a={width:e.width,height:e.height,bitrate:Math.ceil(Math.max(.9*e.bitrate,e.averageBitrate)),framerate:e.frameRate||30},o=e.videoRange;"SDR"!==o&&(a.transferFunction=o.toLowerCase());var l=r.split(","),h=navigator.userAgent;if(l.some((function(e){return _e(e)}))&&Pe())return Promise.resolve(We(new Error("Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent sting: ("+h+")"),n));n.push.apply(n,l.map((function(e){return{type:"media-source",video:u(u({},a),{},{contentType:Me(Ge(e),"video")})}})))}return s&&e.audioGroups&&e.audioGroups.forEach((function(e){var i;e&&(null==(i=t.groups[e])||i.tracks.forEach((function(t){if(t.groupId===e){var i=t.channels||"",r=parseFloat(i);T(r)&&r>2&&n.push.apply(n,s.split(",").map((function(e){return{type:"media-source",audio:{contentType:Me(e,"audio"),channels:""+r}}})))}})))})),Promise.all(n.map((function(e){var t=function(e){var t=e.audio,i=e.video,r=i||t;if(r){var s=Ke(r.contentType);if(i)return"r"+i.height+"x"+i.width+"f"+Math.ceil(i.framerate)+(i.transferFunction||"sd")+"_"+s+"_"+Math.ceil(i.bitrate/1e5);if(t)return"c"+t.channels+(t.spatialRendering?"s":"n")+"_"+s}return""}(e);return $e[t]||($e[t]=i.decodingInfo(e))}))).then((function(e){return{supported:!e.some((function(e){return!e.supported})),configurations:n,decodingInfoResults:e}})).catch((function(e){return{supported:!1,configurations:n,decodingInfoResults:[],error:e}}))}var je=["NONE","TYPE-0","TYPE-1",null],Ye=["SDR","PQ","HLG"];function ze(e){var t=e.canSkipUntil,i=e.canSkipDateRanges,r=e.age;return t&&r<t/2?i?"v2":"YES":""}var Xe=function(){function e(e,t,i){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=t,this.skip=i}return e.prototype.addDirectives=function(e){var t=new self.URL(e);return void 0!==this.msn&&t.searchParams.set("_HLS_msn",this.msn.toString()),void 0!==this.part&&t.searchParams.set("_HLS_part",this.part.toString()),this.skip&&t.searchParams.set("_HLS_skip",this.skip),t.href},e}(),Qe=function(){function e(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter((function(e){return!!e})).map((function(e){return e.substring(0,4)})).join(","),"supplemental"in e){var t;this.supplemental=e.supplemental;var i=null==(t=e.supplemental)?void 0:t.videoCodec;i&&i!==e.videoCodec&&(this.codecSet+=","+i.substring(0,4))}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}var t=e.prototype;return t.hasAudioGroup=function(e){return Je(this._audioGroups,e)},t.hasSubtitleGroup=function(e){return Je(this._subtitleGroups,e)},t.addGroupId=function(e,t){if(t)if("audio"===e){var i=this._audioGroups;i||(i=this._audioGroups=[]),-1===i.indexOf(t)&&i.push(t)}else if("text"===e){var r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),-1===r.indexOf(t)&&r.push(t)}},t.addFallback=function(){},r(e,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(e){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var e;return null==(e=this.audioGroups)?void 0:e[0]}},{key:"textGroupId",get:function(){var e;return null==(e=this.subtitleGroups)?void 0:e[0]}}])}();function Je(e,t){return!(!t||!e)&&-1!==e.indexOf(t)}var Ze=function(e,t){return JSON.stringify(e,function(e){var t=new WeakSet;return function(i,r){if(e&&(r=e(i,r)),"object"==typeof r&&null!==r){if(t.has(r))return;t.add(r)}return r}}(t))};function et(e,t){V.log('[abr] start candidates with "'+e+'" ignored because '+t)}function tt(e){return e.reduce((function(e,t){var i=e.groups[t.groupId];i||(i=e.groups[t.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),i.tracks.push(t);var r=t.channels||"2";return i.channels[r]=(i.channels[r]||0)+1,i.hasDefault=i.hasDefault||t.default,i.hasAutoSelect=i.hasAutoSelect||t.autoselect,i.hasDefault&&(e.hasDefaultAudio=!0),i.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function it(e){if(!e)return e;var t=e;return{lang:t.lang,assocLang:t.assocLang,characteristics:t.characteristics,channels:t.channels,audioCodec:t.audioCodec}}function rt(e,t,i){if("attrs"in e){var r=t.indexOf(e);if(-1!==r)return r}for(var s=0;s<t.length;s++)if(st(e,t[s],i))return s;return-1}function st(e,t,i){var r,s,n=e.groupId,a=e.name,o=e.lang,l=e.assocLang,h=e.default,u=e.forced;return(void 0===n||t.groupId===n)&&(void 0===a||t.name===a)&&(void 0===o||(r=o,void 0===(s=t.lang)&&(s="--"),r.length===s.length?r===s:r.startsWith(s)||s.startsWith(r)))&&(void 0===o||t.assocLang===l)&&(void 0===h||t.default===h)&&(void 0===u||t.forced===u)&&(!("characteristics"in e)||function(e,t){void 0===t&&(t="");var i=e.split(","),r=t.split(",");return i.length===r.length&&!i.some((function(e){return-1===r.indexOf(e)}))}(e.characteristics||"",t.characteristics))&&(void 0===i||i(e,t))}function nt(e,t){var i=e.audioCodec,r=e.channels;return!(void 0!==i&&(t.audioCodec||"").substring(0,4)!==i.substring(0,4)||void 0!==r&&r!==(t.channels||"2"))}function at(e,t,i){for(var r=t;r>-1;r--)if(i(e[r]))return r;for(var s=t+1;s<e.length;s++)if(i(e[s]))return s;return-1}function ot(e,t){var i;return!!e&&e!==(null==(i=t.loadLevelObj)?void 0:i.uri)}var lt=function(e){function t(t){var i;return(i=e.call(this,"abr",t.logger)||this).hls=void 0,i.lastLevelLoadSec=0,i.lastLoadedFragLevel=-1,i.firstSelection=-1,i._nextAutoLevel=-1,i.nextAutoLevelKey="",i.audioTracksByGroup=null,i.codecTiers=null,i.timer=-1,i.fragCurrent=null,i.partCurrent=null,i.bitrateTestDelay=0,i.rebufferNotice=-1,i.bwEstimator=void 0,i._abandonRulesCheck=function(e){var t,r=i,s=r.fragCurrent,n=r.partCurrent,a=r.hls,o=a.autoLevelEnabled,l=a.media;if(s&&l){var h=performance.now(),u=n?n.stats:s.stats,d=n?n.duration:s.duration,c=h-u.loading.start,f=a.minAutoLevel,g=s.level,p=i._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||g<=f)return i.clearTimer(),void(i._nextAutoLevel=-1);if(o){var m=p>-1&&p!==g,v=!!e||m;if(v||!l.paused&&l.playbackRate&&l.readyState){var y=a.mainForwardBufferInfo;if(v||null!==y){var E=i.bwEstimator.getEstimateTTFB(),S=Math.abs(l.playbackRate);if(!(c<=Math.max(E,d/(2*S)*1e3))){var L=y?y.len/S:0,_=u.loading.first?u.loading.first-u.loading.start:-1,b=u.loaded&&_>-1,A=i.getBwEstimate(),R=a.levels,P=R[g],k=Math.max(u.loaded,Math.round(d*(s.bitrate||P.averageBitrate)/8)),D=b?c-_:c;D<1&&b&&(D=Math.min(c,8*u.loaded/A));var w=b?1e3*u.loaded/D:0,C=E/1e3,M=w?(k-u.loaded)/w:8*k/A+C;if(!(M<=L)){var O,x=w?8*w:A,F=!0===(null==(t=(null==e?void 0:e.details)||i.hls.latestLevelDetails)?void 0:t.live),N=i.hls.config.abrBandWidthUpFactor,B=Number.POSITIVE_INFINITY;for(O=g-1;O>f;O--){var U=R[O].maxBitrate,G=!R[O].details||F;if((B=i.getTimeToLoadFrag(C,x,d*U,G))<Math.min(L,d+C))break}if(!(B>=M||B>10*d)){b?i.bwEstimator.sample(c-Math.min(E,_),u.loaded):i.bwEstimator.sampleTTFB(c);var H=R[O].maxBitrate;i.getBwEstimate()*N>H&&i.resetEstimator(H);var K=i.findBestLevel(H,f,O,0,L,1,1);K>-1&&(O=K),i.warn("Fragment "+s.sn+(n?" part "+n.index:"")+" of level "+g+" is loading too slowly;\n Fragment duration: "+s.duration.toFixed(3)+"\n Time to underbuffer: "+L.toFixed(3)+" s\n Estimated load time for current fragment: "+M.toFixed(3)+" s\n Estimated load time for down switch fragment: "+B.toFixed(3)+" s\n TTFB estimate: "+(0|_)+" ms\n Current BW estimate: "+(T(A)?0|A:"Unknown")+" bps\n New BW estimate: "+(0|i.getBwEstimate())+" bps\n Switching to level "+O+" @ "+(0|H)+" bps"),a.nextLoadLevel=a.nextAutoLevel=O,i.clearTimer();var V=function(){if(i.clearTimer(),i.fragCurrent===s&&i.hls.loadLevel===O&&O>0){var e=i.getStarvationDelay();if(i.warn("Aborting inflight request "+(O>0?"and switching down":"")+"\n Fragment duration: "+s.duration.toFixed(3)+" s\n Time to underbuffer: "+e.toFixed(3)+" s"),s.abortRequests(),i.fragCurrent=i.partCurrent=null,O>f){var t=i.findBestLevel(i.hls.levels[f].bitrate,f,O,0,e,1,1);-1===t&&(t=f),i.hls.nextLoadLevel=i.hls.nextAutoLevel=t,i.resetEstimator(i.hls.levels[t].bitrate)}}};m||M>2*B?V():i.timer=self.setInterval(V,1e3*B),a.trigger(I.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:n,stats:u})}}}}}}}},i.hls=t,i.bwEstimator=i.initEs