jellyfin-web/dashboard-ui/bower_components/hlsjs/dist/hls.min.js

6 lines
131 KiB
JavaScript
Raw Normal View History

2016-10-10 23:46:59 -07:00
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){return function e(t,r,a){function i(s,o){if(!r[s]){if(!t[s]){var l="function"==typeof require&&require;if(!o&&l)return l(s,!0);if(n)return n(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[s]={exports:{}};t[s][0].call(d.exports,function(e){var r=t[s][1][e];return i(r?r:e)},d,d.exports,e,t,r,a)}return r[s].exports}for(var n="function"==typeof require&&require,s=0;s<a.length;s++)i(a[s]);return i}({1:[function(e,t,r){function a(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._maxListeners=void 0,a.defaultMaxListeners=10,a.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},a.prototype.emit=function(e){var t,r,a,n,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=Array.prototype.slice.call(arguments,1),r.apply(this,n)}else if(s(r))for(n=Array.prototype.slice.call(arguments,1),u=r.slice(),a=u.length,l=0;l<a;l++)u[l].apply(this,n);return!0},a.prototype.addListener=function(e,t){var r;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?s(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,s(this._events[e])&&!this._events[e].warned&&(r=o(this._maxListeners)?a.defaultMaxListeners:this._maxListeners,r&&r>0&&this._events[e].length>r&&(this._events[e].warned=!0,"function"==typeof console.trace)),this},a.prototype.on=a.prototype.addListener,a.prototype.once=function(e,t){function r(){this.removeListener(e,r),a||(a=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var a=!1;return r.listener=t,this.on(e,r),this},a.prototype.removeListener=function(e,t){var r,a,n,o;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],n=r.length,a=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(r)){for(o=n;o-- >0;)if(r[o]===t||r[o].listener&&r[o].listener===t){a=o;break}if(a<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(a,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},a.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},a.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},a.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},a.listenerCount=function(e,t){return e.listenerCount(t)}},{}]
this.state=R.WAITING_LEVEL;break}if(!r.live&&c&&c.sn===r.endSN&&(!s||n.duration-h<=c.duration/2)){this.hls.trigger(f.default.BUFFER_EOS),this.state=R.ENDED;break}var g=r.fragments,y=g.length;if(0===y)break;var E=g[0].start,b=g[y-1].start+g[y-1].duration,L=void 0;if(r.live){var A=void 0!==i.liveMaxLatencyDuration?i.liveMaxLatencyDuration:i.liveMaxLatencyDurationCount*r.targetduration;if(h<Math.max(E,b-A)){var T=void 0!==i.liveSyncDuration?i.liveSyncDuration:i.liveSyncDurationCount*r.targetduration,k=E+Math.max(0,r.totalduration-T);v.logger.log("buffer end: "+h+" is located too far from the end of live sliding playlist, reset currentTime to : "+k.toFixed(3)),h=k,n&&n.readyState&&n.duration>k&&(n.currentTime=k)}if(r.PTSKnown&&h>b)break;if(this.startFragRequested&&!r.PTSKnown){if(c){var S=c.sn+1;S>=r.startSN&&S<=r.endSN&&(L=g[S-r.startSN],v.logger.log("live playlist, switching playlist, load frag with next SN: "+L.sn))}L||(L=g[Math.min(y-1,Math.round(y/2))],v.logger.log("live playlist, switching playlist, unknown, load middle frag : "+L.sn))}}else h<E&&(L=g[0]);if(L||!function(){var e=i.maxFragLookUpTolerance;h<b?((h>b-e||s)&&(e=0),L=p.default.search(g,function(t){return t.start+t.duration-e<=h?1:t.start-e>h?-1:0})):L=g[y-1]}(),L){if(E=L.start,c&&L.level===c.level&&L.sn===c.sn){if(!(L.sn<r.endSN))break;var w=c.deltaPTS,D=L.sn-r.startSN;if(w&&w>i.maxBufferHole&&c.dropped?(L=g[D-1],v.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),c.loadCounter--):(L=g[D+1],v.logger.log("SN just loaded, load next one: "+L.sn)),!L)break}if(null!=L.decryptdata.uri&&null==L.decryptdata.key)v.logger.log("Loading key for "+L.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t),this.state=R.KEY_LOADING,a.trigger(f.default.KEY_LOADING,{frag:L});else{if(v.logger.log("Loading "+L.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+t+", currentTime:"+e+",bufferEnd:"+h.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,L.loadCounter){L.loadCounter++;var O=i.fragLoadingLoopThreshold;if(L.loadCounter>O&&Math.abs(this.fragLoadIdx-L.loadIdx)<O)return void a.trigger(f.default.ERROR,{type:_.ErrorTypes.MEDIA_ERROR,details:_.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:L})}else L.loadCounter=1;L.loadIdx=this.fragLoadIdx,this.fragCurrent=L,this.startFragRequested=!0,L.autoLevel=a.autoLevelEnabled,L.bitrateTest=this.fragBitrateTest,a.trigger(f.default.FRAG_LOADING,{frag:L}),this.state=R.FRAG_LOADING}}}break;case R.WAITING_LEVEL:t=this.levels[this.level],t&&t.details&&(this.state=R.IDLE);break;case R.FRAG_LOADING_WAITING_RETRY:var P=performance.now(),I=this.retryDate;(!I||P>=I||s)&&(v.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=R.IDLE);break;case R.STOPPED:case R.FRAG_LOADING:case R.PARSING:case R.PARSED:case R.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(e){var t,r,a=this.bufferRange;if(a)for(t=a.length-1;t>=0;t--)if(r=a[t],e>=r.start&&e<=r.end)return r;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(e){var t=this.media;if(t)for(var r=t.buffered,a=0;a<r.length;a++)if(e>=r.start(a)&&e<=r.end(a))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var e,t,r=this.media;if(r&&r.seeking===!1&&(t=r.currentTime,t>r.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=t),this.isBuffered(t)?e=this.getBufferRange(t):this.isBuffered(t+.1)&&(e=this.getBufferRange(t+.1)),e)){var a=e.frag;a!==this.fragPlaying&&(this.fragPlaying=a,this.hls.trigger(f.default.FRAG_CHANGED,{frag:a}))}}},{key:"immediateLevelSwitch",value:function(){if(v.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var e=this.media,t=void 0;e?(t=e.paused,e.pause()):t=!0,this.previouslyPaused=t}var r=this.fragCurrent;r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=R.PAUSED,this.hls.
s.onerror=function(e){r.trigger(o.default.ERROR,{type:g.ErrorTypes.OTHER_ERROR,details:g.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:e.message+" ("+e.filename+":"+e.lineno+")"}})},s.postMessage({cmd:"init",typeSupported:a})}catch(e){h.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),this.demuxer=new u.default(r,a)}}else this.demuxer=new u.default(r,a);this.demuxInitialized=!0}return n(t,[{key:"destroy",value:function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.decrypter;r&&(r.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(e,t,r,a,i,n,s,o){var l=this.w;if(l)l.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:r,timeOffset:a,cc:i,level:n,sn:s,duration:o},[e]);else{var u=this.demuxer;u&&u.push(new Uint8Array(e),t,r,a,i,n,s,o)}}},{key:"push",value:function(e,t,r,a,i,n,s,o,l){if(e.byteLength>0&&null!=l&&null!=l.key&&"AES-128"===l.method){null==this.decrypter&&(this.decrypter=new v.default(this.hls));var u=this;this.decrypter.decrypt(e,l.key,l.iv,function(e){u.pushDecrypted(e,t,r,a,i,n,s,o)})}else this.pushDecrypted(e,t,r,a,i,n,s,o)}},{key:"onWorkerMessage",value:function(e){var t=e.data;switch(t.event){case o.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(o.default.FRAG_PARSING_INIT_SEGMENT,r);break;case o.default.FRAG_PARSING_DATA:this.hls.trigger(o.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb,dropped:t.dropped});break;case o.default.FRAG_PARSING_METADATA:this.hls.trigger(o.default.FRAG_PARSING_METADATA,{samples:t.samples});break;case o.default.FRAG_PARSING_USERDATA:this.hls.trigger(o.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),t}();r.default=p},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../errors":21,"../events":23,"../utils/logger":38,webworkify:2}],18:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),n=e("../utils/logger"),s=function(){function e(t){a(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return i(e,[{key:"loadWord",value:function(){var e=this.data.byteLength-this.bytesAvailable,t=new Uint8Array(4),r=Math.min(4,this.bytesAvailable);if(0===r)throw new Error("no bytes available");t.set(this.data.subarray(e,e+r)),this.word=new DataView(t.buffer).getUint32(0),this.bitsAvailable=8*r,this.bytesAvailable-=r}},{key:"skipBits",value:function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(e){var t=Math.min(this.bitsAvailable,e),r=this.word>>>32-t;return e>32&&n.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=t,this.bitsAvailable>0?this.word<<=t:this.bytesAvailable>0&&this.loadWord(),t=e-t,t>0?r<<t|this.readBits(t):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return
return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),u=a(l),d=e("../event-handler"),f=a(d),h=e("../errors"),c=function(e){function t(e){return i(this,t),n(this,Object.getPrototypeOf(t).call(this,e,u.default.FRAG_LOADING))}return s(t,e),o(t,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),f.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(e){var t=e.frag;this.frag=t,this.frag.loaded=0;var r=this.hls.config;t.loader=this.loader="undefined"!=typeof r.fLoader?new r.fLoader(r):new r.loader(r),this.loader.load(t.url,"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),r.fragLoadingTimeOut,0,0,this.loadprogress.bind(this),t)}},{key:"loadsuccess",value:function(e,t){var r=e.currentTarget.response;t.length=r.byteLength,this.frag.loader=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:r,frag:this.frag,stats:t})}},{key:"loaderror",value:function(e){this.loader&&this.loader.abort(),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:this.frag,response:e})}},{key:"loadtimeout",value:function(){this.loader&&this.loader.abort(),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.NETWORK_ERROR,details:h.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:this.frag})}},{key:"loadprogress",value:function(e,t){this.frag.loaded=t.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:this.frag,stats:t})}}]),t}(f.default);r.default=c},{"../errors":21,"../event-handler":22,"../events":23}],29:[function(e,t,r){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(r,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),u=a(l),d=e("../event-handler"),f=a(d),h=e("../errors"),c=function(e){function t(e){i(this,t);var r=n(this,Object.getPrototypeOf(t).call(this,e,u.default.KEY_LOADING));return r.decryptkey=null,r.decrypturl=null,r}return s(t,e),o(t,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),f.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(e){var t=this.frag=e.frag,r=t.decryptdata,a=r.uri;if(a!==this.decrypturl||null===this.decryptkey){var i=this.hls.config;t.loader=this.loader=new i.loader(i),this.decrypturl=a,this.decryptkey=null,t.loader.load(a,"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),i.fragLoadingTimeOut,i.fragLoadingMaxRetry,i.fragLoadingRetryDelay,this.loadprogress.bind(this),t)}else this.decryptkey&&(r.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:fun
this.cue=null}},{key:"_clearActiveCues",value:function(e){var t=!0,r=!1,a=void 0;try{for(var i,n=this.display[Symbol.iterator]();!(t=(i=n.next()).done);t=!0){var s=i.value;s.endTime=e}}catch(e){r=!0,a=e}finally{try{!t&&n.return&&n.return()}finally{if(r)throw a}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();r.default=n},{}],37:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),n=function(){function e(t){a(this,e),this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=0,this.totalWeight_=0}return i(e,[{key:"sample",value:function(e,t){var r=Math.pow(this.alpha_,e);this.estimate_=t*(1-r)+r*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_}}]),e}();r.default=n},{}],38:[function(e,t,r){"use strict";function a(){}function i(e,t){return t="["+e+"] > "+t}function n(e){var t=window.console[e];return t?function(){for(var r=arguments.length,a=Array(r),n=0;n<r;n++)a[n]=arguments[n];a[0]&&(a[0]=i(e,a[0])),t.apply(window.console,a)}:a}function s(e){for(var t=arguments.length,r=Array(t>1?t-1:0),a=1;a<t;a++)r[a-1]=arguments[a];r.forEach(function(t){u[t]=e[t]?e[t].bind(e):n(t)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l={trace:a,debug:a,log:a,warn:a,info:a,error:a},u=l;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{u.log()}catch(e){u=l}}else u=l},r.logger=u},{}],39:[function(e,t,r){"use strict";var a={buildAbsoluteURL:function(e,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var r=null,i=null,n=/^([^#]*)(.*)$/.exec(t);n&&(i=n[2],t=n[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(r=s[2],t=s[1]);var o=/^([^#]*)(.*)$/.exec(e);o&&(e=o[1]);var l=/^([^\?]*)(.*)$/.exec(e);l&&(e=l[1]);var u=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(e);if(!u)throw new Error("Error trying to parse base URL.");var d=u[2]||"",f=u[1]||"",h=u[4],c=null;return c=/^\/\//.test(t)?d+"//"+a.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?f+"/"+a.buildAbsolutePath("",t.substring(1)):a.buildAbsolutePath(f+h,t),r&&(c+=r),i&&(c+=i),c},buildAbsolutePath:function(e,t){for(var r,a,i=t,n="",s=e.replace(/[^\/]*$/,i.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),o=0;a=s.indexOf("/../",o),a>-1;o=a+r)r=/^\/(?:\.\.\/)*/.exec(s.slice(a))[0].length,n=(n+s.substring(o,a)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(r-1)/3+"}$"),"/");return n+s.substr(o)}};t.exports=a},{}],40:[function(e,t,r){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),n=e("../utils/logger"),s=function(){function e(t){a(this,e),t&&t.xhrSetup&&(this.xhrSetup=t.xhrSetup)}return i(e,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var e=this.loader,t=this.timeoutHandle;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),t&&window.clearTimeout(t)}},{key:"load",value:function(e,t,r,a,i,n,s,o){var l=arguments.length<=8||void 0===arguments[8]?null:arguments[8],u=arguments.length<=9||void 0===arguments[9]?null:arguments[9];this.url=e,!u||isNaN(u.byteRangeStartOffset)||