require=function t(e,r,n){function i(a,o){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!o&&u)return u(a,!0);if(s)return s(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=r[a]={exports:{}};e[a][0].call(l.exports,(function(t){return i(e[a][1][t]||t)}),l,l.exports,t,e,r,n)}return r[a].exports}for(var s="function"==typeof require&&require,a=0;ai.Events[t])).forEach((t=>this.loader.on(t,((...e)=>this.emit(t,...e)))))}static isSupported(){return i.HybridLoader.isSupported()}createLoaderClass(){return o.createHlsJsLoaderClass(a.HlsJsLoader,this)}async destroy(){await this.segmentManager.destroy()}getSettings(){return{segments:this.segmentManager.getSettings(),loader:this.loader.getSettings()}}getDetails(){return{loader:this.loader.getDetails()}}setPlayingSegment(t,e,r,n){this.segmentManager.setPlayingSegment(t,e,r,n)}setPlayingSegmentByCurrentTime(t){this.segmentManager.setPlayingSegmentByCurrentTime(t)}}r.Engine=u},{"./hlsjs-loader":4,"./hlsjs-loader-class":3,"./segment-manager":5,events:"events","p2p-media-loader-core":"p2p-media-loader-core"}],3:[function(t,e,r){e.exports.createHlsJsLoaderClass=function(t,e){function r(){this.impl=new t(e.segmentManager),this.stats=this.impl.stats}return r.prototype.load=function(t,e,r){this.context=t,this.impl.load(t,e,r)},r.prototype.abort=function(){this.impl.abort(this.context)},r.prototype.destroy=function(){this.context&&this.impl.abort(this.context)},r.getEngine=function(){return e},r}},{}],4:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.HlsJsLoader=void 0;r.HlsJsLoader=class{constructor(t){this.stats={},this.segmentManager=t}async load(t,e,r){if(t.type)try{const e=await this.segmentManager.loadPlaylist(t.url);this.successPlaylist(e,t,r)}catch(e){this.error(e,t,r)}else if(t.frag)try{const e=await this.segmentManager.loadSegment(t.url,null==t.rangeStart||null==t.rangeEnd?void 0:{offset:t.rangeStart,length:t.rangeEnd-t.rangeStart});void 0!==e.content&&setTimeout((()=>this.successSegment(e.content,e.downloadBandwidth,t,r)),0)}catch(e){setTimeout((()=>this.error(e,t,r)),0)}else console.warn("Unknown load request",t)}abort(t){this.segmentManager.abortSegment(t.url,null==t.rangeStart||null==t.rangeEnd?void 0:{offset:t.rangeStart,length:t.rangeEnd-t.rangeStart})}successPlaylist(t,e,r){const n=performance.now();this.stats.trequest=n-300,this.stats.tfirst=n-200,this.stats.tload=n,this.stats.loaded=t.response.length,r.onSuccess({url:t.responseURL,data:t.response},this.stats,e)}successSegment(t,e,r,n){const i=performance.now(),s=t.byteLength/(void 0===e||e<=0?12500:e);this.stats.trequest=i-1-s,this.stats.tfirst=i-s,this.stats.tload=i,this.stats.loaded=t.byteLength,n.onSuccess({url:r.url,data:t},this.stats,r)}error(t,e,r){r.onError(t,e)}}},{}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.SegmentManager=void 0;const n=t("p2p-media-loader-core"),i=t("m3u8-parser"),s={forwardSegmentCount:20,swarmId:void 0,assetsStorage:void 0};r.SegmentManager=class{constructor(t,e={}){this.masterPlaylist=null,this.variantPlaylists=new Map,this.segmentRequest=null,this.playQueue=[],this.onSegmentLoaded=t=>{this.segmentRequest&&this.segmentRequest.segmentUrl===t.url&&f(this.segmentRequest.segmentByterange)===t.range&&(this.segmentRequest.onSuccess(t.data.slice(0),t.downloadBandwidth),this.segmentRequest=null)},this.onSegmentError=(t,e)=>{this.segmentRequest&&this.segmentRequest.segmentUrl===t.url&&f(this.segmentRequest.segmentByterange)===t.range&&(this.segmentRequest.onError(e),this.segmentRequest=null)},this.onSegmentAbort=t=>{this.segmentRequest&&this.segmentRequest.segmentUrl===t.url&&f(this.segmentRequest.segmentByterange)===t.range&&(this.segmentRequest.onError("Loading aborted: internal abort"),this.segmentRequest=null)},this.settings=Object.assign(Object.assign({},s),e),this.loader=t,this.loader.on(n.Events.SegmentLoaded,this.onSegmentLoaded),this.loader.on(n.Events.SegmentError,this.onSegmentError),this.loader.on(n.Events.SegmentAbort,this.onSegmentAbort)}getSettings(){return this.settings}processPlaylist(t,e,r){const n=new i.Parser;n.push(e),n.end();const s=new a(t,r,n.manifest);if(s.manifest.playlists){this.masterPlaylist=s;for(const[t,e]of this.variantPlaylists){const{streamSwarmId:r,found:n,index:i}=this.getStreamSwarmId(e.requestUrl);n?(e.streamSwarmId=r,e.streamId="V"+i.toString()):this.variantPlaylists.delete(t)}}else{const{streamSwarmId:e,found:r,index:n}=this.getStreamSwarmId(t);(r||null===this.masterPlaylist)&&(s.streamSwarmId=e,s.streamId=null===this.masterPlaylist?void 0:"V"+n.toString(),this.variantPlaylists.set(t,s),this.updateSegments())}}async loadPlaylist(t){const e=this.settings.assetsStorage;let r;if(void 0!==e){let n;n=this.getMasterSwarmId(),void 0===n&&(n=t.split("?")[0]);const i=await e.getAsset(t,void 0,n);void 0!==i?r={responseURL:i.responseUri,response:i.data}:(r=await this.loadContent(t,"text"),e.storeAsset({masterManifestUri:null!==this.masterPlaylist?this.masterPlaylist.requestUrl:t,masterSwarmId:n,requestUri:t,responseUri:r.responseURL,data:r.response}))}else r=await this.loadContent(t,"text");return this.processPlaylist(t,r.response,r.responseURL),r}async loadSegment(t,e){const r=this.getSegmentLocation(t,e),n=f(e);if(!r){let e;const r=this.settings.assetsStorage;if(void 0!==r){let i,s=null!==this.masterPlaylist?this.masterPlaylist.requestUrl:void 0;if(i=this.getMasterSwarmId(),void 0===i&&1===this.variantPlaylists.size&&(i=this.variantPlaylists.values().next().value.requestUrl.split("?")[0]),void 0===s&&1===this.variantPlaylists.size&&(s=this.variantPlaylists.values().next().value.requestUrl),void 0!==i&&void 0!==s){const a=await r.getAsset(t,n,i);if(void 0!==a)e=a.data;else{const a=await this.loadContent(t,"arraybuffer",n);e=a.response,r.storeAsset({masterManifestUri:s,masterSwarmId:i,requestUri:t,requestRange:n,responseUri:a.responseURL,data:e})}}}if(void 0===e){e=(await this.loadContent(t,"arraybuffer",n)).response}return{content:e,downloadBandwidth:0}}const i=(r.playlist.manifest.mediaSequence?r.playlist.manifest.mediaSequence:0)+r.segmentIndex;if(this.playQueue.length>0){this.playQueue[this.playQueue.length-1].segmentSequence!==i-1&&(this.playQueue=[])}this.segmentRequest&&this.segmentRequest.onError("Cancel segment request: simultaneous segment requests are not supported");const s=new Promise(((n,s)=>{this.segmentRequest=new o(t,e,i,r.playlist.requestUrl,((t,e)=>n({content:t,downloadBandwidth:e})),(t=>s(t)))}));return this.playQueue.push({segmentUrl:t,segmentByterange:e,segmentSequence:i}),this.loadSegments(r.playlist,r.segmentIndex,!0),s}setPlayingSegment(t,e,r,n){const i=this.playQueue.findIndex((r=>r.segmentUrl==t&&u(r.segmentByterange,e)));i>=0&&(this.playQueue=this.playQueue.slice(i),this.playQueue[0].playPosition={start:r,duration:n},this.updateSegments())}setPlayingSegmentByCurrentTime(t){if(0===this.playQueue.length||!this.playQueue[0].playPosition)return;const e=this.playQueue[0].playPosition;e.start+e.duration-t<.2&&(this.playQueue=this.playQueue.slice(1),this.updateSegments())}abortSegment(t,e){this.segmentRequest&&this.segmentRequest.segmentUrl===t&&u(this.segmentRequest.segmentByterange,e)&&(this.segmentRequest.onSuccess(void 0,0),this.segmentRequest=null)}async destroy(){this.segmentRequest&&(this.segmentRequest.onError("Loading aborted: object destroyed"),this.segmentRequest=null),this.masterPlaylist=null,this.variantPlaylists.clear(),this.playQueue=[],void 0!==this.settings.assetsStorage&&await this.settings.assetsStorage.destroy(),await this.loader.destroy()}updateSegments(){if(!this.segmentRequest)return;const t=this.getSegmentLocation(this.segmentRequest.segmentUrl,this.segmentRequest.segmentByterange);t&&this.loadSegments(t.playlist,t.segmentIndex,!1)}getSegmentLocation(t,e){for(const r of this.variantPlaylists.values()){const n=r.getSegmentIndex(t,e);if(n>=0)return{playlist:r,segmentIndex:n}}}async loadSegments(t,e,r){const n=[],i=t.manifest.segments,s=t.manifest.mediaSequence?t.manifest.mediaSequence:0;let a=null,o=Math.max(0,this.playQueue.length-1);const u=this.getMasterSwarmId();for(let l=e;l{const s=new XMLHttpRequest;s.open("GET",t,!0),s.responseType=e,r&&s.setRequestHeader("Range",r),s.addEventListener("readystatechange",(()=>{4===s.readyState&&(s.status>=200&&s.status<300?n(s):i(s.statusText))}));const a=this.loader.getSettings().xhrSetup;a&&a(s,t),s.send()}))}};class a{constructor(t,e,r){this.requestUrl=t,this.responseUrl=e,this.manifest=r,this.streamSwarmId=""}getSegmentIndex(t,e){for(let r=0;r-1},e.trigger=function(t){var e=this.listeners[t];if(e)if(2===arguments.length)for(var r=e.length,n=0;n0?a-4:a;for(r=0;r>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===o&&(e=i[t.charCodeAt(r)]<<2|i[t.charCodeAt(r+1)]>>4,u[l++]=255&e);1===o&&(e=i[t.charCodeAt(r)]<<10|i[t.charCodeAt(r+1)]<<4|i[t.charCodeAt(r+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},r.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],a=16383,o=0,u=r-i;ou?u:o+a));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function l(t,e,r){for(var i,s,a=[],o=e;o>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},{}],13:[function(t,e,r){(function(e){(function(){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ "use strict";var e=t("base64-js"),n=t("ieee754");r.Buffer=a,r.SlowBuffer=function(t){+t!=t&&(t=0);return a.alloc(+t)},r.INSPECT_MAX_BYTES=50;var i=2147483647;function s(t){if(t>i)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=a.prototype,e}function a(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return f(t)}return o(t,e,r)}function o(t,e,r){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!a.isEncoding(e))throw new TypeError("Unknown encoding: "+e);var r=0|g(t,e),n=s(r),i=n.write(t,e);i!==r&&(n=n.slice(0,i));return n}(t,e);if(ArrayBuffer.isView(t))return l(t);if(null==t)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(X(t,ArrayBuffer)||t&&X(t.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|t}function g(t,e){if(a.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||X(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return D(t).length;default:if(i)return n?-1:j(t).length;e=(""+e).toLowerCase(),i=!0}}function c(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return P(this,e,r);case"utf8":case"utf-8":return T(this,e,r);case"ascii":return R(this,e,r);case"latin1":case"binary":return U(this,e,r);case"base64":return I(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function d(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function p(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),k(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=a.from(e,n)),a.isBuffer(e))return 0===e.length?-1:y(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):y(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,r,n,i){var s,a=1,o=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,o/=2,u/=2,r/=2}function f(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var l=-1;for(s=r;so&&(r=o-u),s=r;s>=0;s--){for(var h=!0,g=0;gi&&(n=i):n=i;var s=e.length;n>s/2&&(n=s/2);for(var a=0;a>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function I(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function T(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:f>223?3:f>191?2:1;if(i+h<=r)switch(h){case 1:f<128&&(l=f);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&f)<<6|63&s)>127&&(l=u);break;case 3:s=t[i+1],a=t[i+2],128==(192&s)&&128==(192&a)&&(u=(15&f)<<12|(63&s)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:s=t[i+1],a=t[i+2],o=t[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(u=(15&f)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=h}return function(t){var e=t.length;if(e<=A)return String.fromCharCode.apply(String,t);var r="",n=0;for(;ne&&(t+=" ... "),""},a.prototype.compare=function(t,e,r,n,i){if(X(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(e>>>=0),u=Math.min(s,o),f=this.slice(n,i),l=t.slice(e,r),h=0;h>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return w(this,t,e,r);case"base64":return E(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function R(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",s=e;sr)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,i,s){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function x(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function B(t,e,r,i,s){return e=+e,r>>>=0,s||x(t,0,r,4),n.write(t,e,r,i,23,4),r+4}function L(t,e,r,i,s){return e=+e,r>>>=0,s||x(t,0,r,8),n.write(t,e,r,i,52,8),r+8}a.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,s=0;++s>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},a.prototype.readUInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return t>>>=0,e||O(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=this[t],i=1,s=0;++s=(i*=128)&&(n-=Math.pow(2,8*e)),n},a.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||O(t,e,this.length);for(var n=e,i=1,s=this[t+--n];n>0&&(i*=256);)s+=this[t+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},a.prototype.readInt8=function(t,e){return t>>>=0,e||O(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(t,e){t>>>=0,e||O(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return t>>>=0,e||O(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return t>>>=0,e||O(t,4,this.length),n.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return t>>>=0,e||O(t,8,this.length),n.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n)||M(this,t,e,r,Math.pow(2,8*r)-1,0);var i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},a.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,255,0),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},a.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var s=0,a=1,o=0;for(this[e]=255&t;++s>0)-o&255;return e+r},a.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+r},a.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},a.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},a.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},a.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||M(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},a.prototype.writeFloatLE=function(t,e,r){return B(this,t,e,!0,r)},a.prototype.writeFloatBE=function(t,e,r){return B(this,t,e,!1,r)},a.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},a.prototype.writeDoubleBE=function(t,e,r){return L(this,t,e,!1,r)},a.prototype.copy=function(t,e,r,n){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},a.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function D(t){return e.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(q,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function N(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function X(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function k(t){return t!=t}}).call(this)}).call(this,t("buffer").Buffer)},{"base64-js":12,buffer:13,ieee754:15}],14:[function(t,e,r){(function(t){(function(){var r;r="undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:{},e.exports=r}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],15:[function(t,e,r){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ r.read=function(t,e,r,n,i){var s,a,o=8*i-n-1,u=(1<>1,l=-7,h=r?i-1:0,g=r?-1:1,c=t[e+h];for(h+=g,s=c&(1<<-l)-1,c>>=-l,l+=o;l>0;s=256*s+t[e+h],h+=g,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=g,l-=8);if(0===s)s=1-f;else{if(s===u)return a?NaN:1/0*(c?-1:1);a+=Math.pow(2,n),s-=f}return(c?-1:1)*a*Math.pow(2,s-n)},r.write=function(t,e,r,n,i,s){var a,o,u,f=8*s-i-1,l=(1<>1,g=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,c=n?0:s-1,d=n?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?g/u:g*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(e*u-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+c]=255&o,c+=d,o/=256,i-=8);for(a=a<0;t[r+c]=255&a,c+=d,a/=256,f-=8);t[r+c-d]|=128*p}},{}],16:[function(t,e,r){ /*! @name m3u8-parser @version 4.5.2 @license Apache-2.0 */ "use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t("@babel/runtime/helpers/inheritsLoose"),i=t("@videojs/vhs-utils/cjs/stream.js"),s=t("@babel/runtime/helpers/extends"),a=t("@babel/runtime/helpers/assertThisInitialized"),o=t("@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js");function u(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var f=u(n),l=u(i),h=u(s),g=u(a),c=u(o),d=function(t){function e(){var e;return(e=t.call(this)||this).buffer="",e}return f.default(e,t),e.prototype.push=function(t){var e;for(this.buffer+=t,e=this.buffer.indexOf("\n");e>-1;e=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,e)),this.buffer=this.buffer.substring(e+1)},e}(l.default),p=function(t){for(var e,r=t.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},i=r.length;i--;)""!==r[i]&&((e=/([^=]*)=(.*)/.exec(r[i]).slice(1))[0]=e[0].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^\s+|\s+$/g,""),e[1]=e[1].replace(/^['"](.*)['"]$/g,"$1"),n[e[0]]=e[1]);return n},y=function(t){function e(){var e;return(e=t.call(this)||this).customParsers=[],e.tagMappers=[],e}f.default(e,t);var r=e.prototype;return r.push=function(t){var e,r,n=this;0!==(t=t.trim()).length&&("#"===t[0]?this.tagMappers.reduce((function(e,r){var n=r(t);return n===t?e:e.concat([n])}),[t]).forEach((function(t){for(var i=0;i0&&(a.duration=t.duration),0===t.duration&&(a.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=s},key:function(){if(t.attributes)if("NONE"!==t.attributes.METHOD)if(t.attributes.URI){if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===t.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(t.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===t.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==t.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):t.attributes.KEYID&&"0x"===t.attributes.KEYID.substring(0,2)?void(this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:t.attributes.KEYFORMAT,keyId:t.attributes.KEYID.substring(2)},pssh:c.default(t.attributes.URI.split(",")[1])}}):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}t.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:t.attributes.METHOD||"AES-128",uri:t.attributes.URI},void 0!==t.attributes.IV&&(n.iv=t.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(t.number)?this.manifest.mediaSequence=t.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+t.number})},"discontinuity-sequence":function(){isFinite(t.number)?(this.manifest.discontinuitySequence=t.number,f=t.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+t.number})},"playlist-type":function(){/VOD|EVENT/.test(t.playlistType)?this.manifest.playlistType=t.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+t.playlist})},map:function(){r={},t.uri&&(r.uri=t.uri),t.byterange&&(r.byterange=t.byterange)},"stream-inf":function(){this.manifest.playlists=s,this.manifest.mediaGroups=this.manifest.mediaGroups||u,t.attributes?(a.attributes||(a.attributes={}),h.default(a.attributes,t.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||u,t.attributes&&t.attributes.TYPE&&t.attributes["GROUP-ID"]&&t.attributes.NAME){var r=this.manifest.mediaGroups[t.attributes.TYPE];r[t.attributes["GROUP-ID"]]=r[t.attributes["GROUP-ID"]]||{},e=r[t.attributes["GROUP-ID"]],(g={default:/yes/i.test(t.attributes.DEFAULT)}).default?g.autoselect=!0:g.autoselect=/yes/i.test(t.attributes.AUTOSELECT),t.attributes.LANGUAGE&&(g.language=t.attributes.LANGUAGE),t.attributes.URI&&(g.uri=t.attributes.URI),t.attributes["INSTREAM-ID"]&&(g.instreamId=t.attributes["INSTREAM-ID"]),t.attributes.CHARACTERISTICS&&(g.characteristics=t.attributes.CHARACTERISTICS),t.attributes.FORCED&&(g.forced=/yes/i.test(t.attributes.FORCED)),e[t.attributes.NAME]=g}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){f+=1,a.discontinuity=!0,this.manifest.discontinuityStarts.push(s.length)},"program-date-time":function(){void 0===this.manifest.dateTimeString&&(this.manifest.dateTimeString=t.dateTimeString,this.manifest.dateTimeObject=t.dateTimeObject),a.dateTimeString=t.dateTimeString,a.dateTimeObject=t.dateTimeObject},targetduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+t.duration}):this.manifest.targetDuration=t.duration},totalduration:function(){!isFinite(t.duration)||t.duration<0?this.trigger("warn",{message:"ignoring invalid total duration: "+t.duration}):this.manifest.totalDuration=t.duration},start:function(){t.attributes&&!isNaN(t.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:t.attributes["TIME-OFFSET"],precise:t.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){a.cueOut=t.data},"cue-out-cont":function(){a.cueOutCont=t.data},"cue-in":function(){a.cueIn=t.data}}[t.tagType]||o).call(i)},uri:function(){a.uri=t.uri,s.push(a),this.manifest.targetDuration&&!("duration"in a)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),a.duration=this.manifest.targetDuration),n&&(a.key=n),a.timeline=f,r&&(a.map=r),a={}},comment:function(){},custom:function(){t.segment?(a.custom=a.custom||{},a.custom[t.customType]=t.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[t.customType]=t.data)}})[t.type].call(i)})),e}f.default(e,t);var r=e.prototype;return r.push=function(t){this.lineStream.push(t)},r.end=function(){this.lineStream.push("\n")},r.addParser=function(t){this.parseStream.addParser(t)},r.addTagMapper=function(t){this.parseStream.addTagMapper(t)},e}(l.default);r.LineStream=d,r.ParseStream=y,r.Parser=m},{"@babel/runtime/helpers/assertThisInitialized":6,"@babel/runtime/helpers/extends":7,"@babel/runtime/helpers/inheritsLoose":8,"@videojs/vhs-utils/cjs/decode-b64-to-uint8-array.js":10,"@videojs/vhs-utils/cjs/stream.js":11}],"p2p-media-loader-hlsjs":[function(t,e,r){"use strict"; /** * @license Apache-2.0 * Copyright 2018 Novage LLC. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */var n=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),i=this&&this.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||n(e,t,r)};function s(t){t&&t.config&&t.config.loader&&"function"==typeof t.config.loader.getEngine&&a(t,t.config.loader.getEngine())}function a(t,e){t.on("hlsFragChanged",((t,r)=>{const n=r.frag,i=2!==n.byteRange.length?void 0:{offset:n.byteRange[0],length:n.byteRange[1]-n.byteRange[0]};e.setPlayingSegment(n.url,i,n.start,n.duration)})),t.on("hlsDestroying",(async()=>{await e.destroy()})),t.on("hlsError",((r,n)=>{if("bufferStalledError"===n.details){const r=void 0===t.media?t.el_:t.media;if(void 0===r)return;e.setPlayingSegmentByCurrentTime(r.currentTime)}}))}Object.defineProperty(r,"__esModule",{value:!0}),r.initJwPlayer=r.initMediaElementJsPlayer=r.initVideoJsHlsJsPlugin=r.initVideoJsContribHlsJsPlayer=r.initFlowplayerHlsJsPlayer=r.initClapprPlayer=r.initHlsJsPlayer=r.version=void 0,r.version="0.6.2",i(t("./engine"),r),i(t("./segment-manager"),r),r.initHlsJsPlayer=s,r.initClapprPlayer=function(t){t.on("play",(()=>{const e=t.core.getCurrentPlayback();e._hls&&!e._hls._p2pm_linitialized&&(e._hls._p2pm_linitialized=!0,s(t.core.getCurrentPlayback()._hls))}))},r.initFlowplayerHlsJsPlayer=function(t){t.on("ready",(()=>s(t.engine.hlsjs?t.engine.hlsjs:t.engine.hls)))},r.initVideoJsContribHlsJsPlayer=function(t){t.ready((()=>{const e=t.tech_.options_;e&&e.hlsjsConfig&&e.hlsjsConfig.loader&&"function"==typeof e.hlsjsConfig.loader.getEngine&&a(t.tech_,e.hlsjsConfig.loader.getEngine())}))},r.initVideoJsHlsJsPlugin=function(){null!=videojs&&null!=videojs.Html5Hlsjs&&videojs.Html5Hlsjs.addHook("beforeinitialize",((t,e)=>{e.config&&e.config.loader&&"function"==typeof e.config.loader.getEngine&&a(e,e.config.loader.getEngine())}))},r.initMediaElementJsPlayer=function(t){t.addEventListener("hlsFragChanged",(e=>{const r=t.hlsPlayer;if(r&&r.config&&r.config.loader&&"function"==typeof r.config.loader.getEngine){const t=r.config.loader.getEngine();if(e.data&&e.data.length>1){const r=e.data[1].frag,n=2!==r.byteRange.length?void 0:{offset:r.byteRange[0],length:r.byteRange[1]-r.byteRange[0]};t.setPlayingSegment(r.url,n,r.start,r.duration)}}})),t.addEventListener("hlsDestroying",(async()=>{const e=t.hlsPlayer;if(e&&e.config&&e.config.loader&&"function"==typeof e.config.loader.getEngine){const t=e.config.loader.getEngine();await t.destroy()}})),t.addEventListener("hlsError",(e=>{const r=t.hlsPlayer;if(r&&r.config&&r.config.loader&&"function"==typeof r.config.loader.getEngine&&void 0!==e.data&&"bufferStalledError"===e.data.details){r.config.loader.getEngine().setPlayingSegmentByCurrentTime(r.media.currentTime)}}))},r.initJwPlayer=function(t,e){const r=setInterval((()=>{t.hls&&t.hls.config&&(clearInterval(r),Object.assign(t.hls.config,e),s(t.hls))}),200)}},{"./engine":2,"./segment-manager":5}]},{},[1]);