From ec04f61c5acd9e5ae28de01d498dd6278eb3fc32 Mon Sep 17 00:00:00 2001 From: Tom Jenkinson Date: Wed, 15 May 2019 16:04:20 +0200 Subject: [PATCH] update playback library --- vendor/playback/playback.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/vendor/playback/playback.js b/vendor/playback/playback.js index 8dd0f79..a09d5d5 100644 --- a/vendor/playback/playback.js +++ b/vendor/playback/playback.js @@ -1,19 +1,20 @@ -module.exports=function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){e.exports={SCAudio:r(1),SCAudioControllerHTML5Player:r(3),SCAudioControllerHLSMSEPlayer:r(5),SCAudioPublicApiStreamURLRetriever:r(12),MaestroCore:r(2),MaestroLoaders:r(11)}},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=99)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(5);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){"use strict";e.exports=r(55)()?Symbol:r(54)},function(e,t,r){"use strict";var n,o=r(11),i=r(18),a=r(59),s=r(17);n=e.exports=function(e,t){var r,n,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(r=a=!0,n=!1):(r=s.call(e,"c"),n=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:r,enumerable:n,writable:a},u?o(i(u),l):l},n.gs=function(e,t,r){var n,u,l,c;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(l=r,r=void 0):(l=t,t=r=void 0),null==e?(n=!0,u=!1):(n=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:r,configurable:n,enumerable:u},l?o(i(l),c):c}},function(e,t,r){"use strict";var n=r(22)();e.exports=function(e){return e!==n&&null!==e}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,t||"There was no format available that a player was able to play.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.NOT_SUPPORTED_ERROR"},t}(o.errors.PlayerFatalError);t.NotSupportedError=i},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===o)||!1}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===o}},function(e,t,r){"use strict";e.exports=r(20)()?Object.setPrototypeOf:r(19)},function(e,t,r){"use strict";var n,o=r(23),i=r(11),a=r(2),s=r(1),u=r(4),l=r(47),c=r(3),d=Object.defineProperty,p=Object.defineProperties;e.exports=n=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");p(this,{__list__:u("w",s(e)),__context__:u("w",t),__nextIndex__:u("w",0)}),t&&(a(t.on),t.on("_add",this._onAdd),t.on("_delete",this._onDelete),t.on("_clear",this._onClear))},delete n.prototype.constructor,p(n.prototype,i({_next:u(function(){var e;if(this.__list__)return this.__redo__&&(e=this.__redo__.shift(),void 0!==e)?e:this.__nextIndex__=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";e.exports=r(64)()?Object.assign:r(63)},function(e,t,r){"use strict";function n(){switch(window.document.hidden){case!0:return"background";case!1:return"foreground";default:return}}Object.defineProperty(t,"__esModule",{value:!0}),t.getAppState=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(97),o=r(96),i=r(95),a=r(94),s=r(93),u=r(92),l=r(91),c=r(90),d=r(89),p=r(88);t.renditions={httpMp3:n.httpMp3,httpAACHQ:p.httpAACHQ,hlsMp3:o.hlsMp3,encryptedHlsMp3:i.encryptedHlsMp3,hlsOpus:c.hlsOpus,encryptedHlsOpus:d.encryptedHlsOpus,hlsAACHQ:a.hlsAACHQ,encryptedHlsAACHQ:s.encryptedHlsAACHQ,apiMobile:u.apiMobile,maestroChromecast:l.maestroChromecast},t.allRenditions=Object.keys(t.renditions).map(function(e){return t.renditions[e]})},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=function(e){function t(){return e.call(this,"Failed to retrieve stream url.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.FAILED_RETRIEVING_URL"},t}(o.NotSupportedError);t.FailedRetrievingUrlError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=function(e){function t(){return e.call(this,"There were no stream URLs.")||this}return n(t,e),t.prototype.getCode=function(){return"SCAUDIO.NO_STREAMS"},t}(o.NotSupportedError);t.NoStreamsError=i},function(e,t,r){"use strict";var n=r(51);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not iterable");return e}},function(e,t,r){"use strict";e.exports=r(58)()?String.prototype.contains:r(57)},function(e,t,r){"use strict";var n=r(5),o=Array.prototype.forEach,i=Object.create,a=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return o.call(arguments,function(e){n(e)&&a(Object(e),t)}),t}},function(e,t,r){"use strict";var n,o=r(66),i=r(1),a=Object.prototype.isPrototypeOf,s=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(e,t){if(i(e),null===t||o(t))return e;throw new TypeError("Prototype must be null or an object")},e.exports=function(e){var t,r;return e?(2===e.level?e.set?(r=e.set,t=function(e,t){return r.call(n(e,t),t),e}):t=function(e,t){return n(e,t).__proto__=t,e}:t=function e(t,r){var o;return n(t,r),o=a.call(e.nullPolyfill,t),o&&delete e.nullPolyfill.__proto__,null===r&&(r=e.nullPolyfill),t.__proto__=r,o&&s(e.nullPolyfill,"__proto__",u),t},Object.defineProperty(t,"level",{configurable:!1,enumerable:!1,writable:!1,value:e.level})):null}(function(){var e,t=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{e=n.set,e.call(t,r)}catch(e){}if(Object.getPrototypeOf(t)===r)return{set:e,level:2}}return t.__proto__=r,Object.getPrototypeOf(t)===r?{level:2}:(t={},t.__proto__=r,Object.getPrototypeOf(t)===r&&{level:1})}()),r(65)},function(e,t,r){"use strict";var n=Object.create,o=Object.getPrototypeOf,i={};e.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;return"function"==typeof e&&o(e(t(null),i))===i}},function(e,t,r){"use strict";var n=r(70),o=Math.max;e.exports=function(e){return o(0,n(e))}},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";var n=r(1);e.exports=function(){return n(this).length=0,this}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.notSupportedError=new Error("Not supported.");var n=function(){function e(){this.supportsVolumeAutomation=!0,this.syncConfig={}}return e}();t.BaseController=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e}();t.BaseStreamUrlRetriever=n},function(e,t,r){"use strict";function n(e){return new i({startPos:0,endPos:e,startLevel:0,endLevel:1,fromEnd:!1})}function o(e){return new i({startPos:e,endPos:0,startLevel:1,endLevel:0,fromEnd:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.buildFadeIn=n,t.buildFadeOut=o;var i=function(){function e(e){var t=e.startPos,r=e.endPos,n=e.startLevel,o=e.endLevel,i=e.fromEnd,a=void 0!==i&&i;if(t<0)throw new Error("startPos invalid.");if(r<0||!a&&r1)throw new Error("startLevel invalid.");if(o<0||o>1)throw new Error("endLevel invalid.");this._startPos=t,this._endPos=r,this._startLevel=n,this._endLevel=o,this._fromEnd=a}return e.prototype.calculate=function(e,t){var r=this._fromEnd?t-500-this._startPos:this._startPos,n=this._fromEnd?t-500-this._endPos:this._endPos;if(ethis._maxCacheSize){this._logger.debug("All playing players are using more than the max cache size. Cleaning...",a,this._maxCacheSize);var u=this._maxCacheSize/r.length;r.forEach(function(e){return n(e,u)}),o.forEach(function(e){return n(e,0)})}else this._logger.debug("Recalculating cache sizes...",a+s,this._maxCacheSize),r.concat(o).reduce(function(t,r){return n(r,Math.max(0,e._maxCacheSize-t)),t+(r.getMemoryCacheUsage()||0)},0);this._updateTimer=window.setTimeout(function(){return e._update()},i)},e}();t.CacheManager=a},function(e,t,r){"use strict";e.exports=function(){return"undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)}()},function(e,t,r){"use strict";var n=Array.prototype.forEach,o=Object.create;e.exports=function(e){var t=o(null);return n.call(arguments,function(e){t[e]=!0}),t}},function(e,t,r){"use strict";e.exports=r(35)("key","value","key+value")},function(e,t,r){"use strict";var n,o=r(9),i=r(4),a=r(10),s=r(3).toStringTag,u=r(36),l=Object.defineProperties,c=a.prototype._unBind;n=e.exports=function(e,t){return this instanceof n?(a.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),void l(this,{__kind__:i("",t),__values__:i("w",e.__mapValuesData__)})):new n(e,t)},o&&o(n,a),n.prototype=Object.create(a.prototype,{constructor:i(n),_resolve:i(function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]}),_unBind:i(function(){this.__values__=null,c.call(this)}),toString:i(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,s,i("c","Map Iterator"))},function(e,t,r){"use strict";var n,o=r(9),i=r(4),a=r(3),s=r(10),u=Object.defineProperty;n=e.exports=function(e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");e=String(e),s.call(this,e),u(this,"__length__",i("",e.length))},o&&o(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i(function(){if(this.__list__)return this.__nextIndex__=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n=r(2),o=r(1),i=Function.prototype.bind,a=Function.prototype.call,s=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,l){var c,d=arguments[2],p=arguments[3];return r=Object(o(r)),n(l),c=s(r),p&&c.sort("function"==typeof p?i.call(p,r):void 0),"function"!=typeof e&&(e=c[e]),a.call(e,c,function(e,n){return u.call(r,e)?a.call(l,d,r[e],e,r,n):t})}}},function(e,t,r){"use strict";e.exports=r(39)("forEach")},function(e,t,r){"use strict";var n=r(2),o=r(40),i=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),o(e,function(e,n,o,s){r[n]=i.call(t,a,e,n,o,s)}),r}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(r(22));e.exports=function(e){return"function"==typeof e&&n.call(e)===o}},function(e,t,r){"use strict";var n=r(3).iterator,o=r(8),i=r(42),a=r(21),s=r(2),u=r(1),l=r(5),c=r(7),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,P=arguments[1],S=arguments[2];if(e=Object(u(e)),l(P)&&s(P),this&&this!==Array&&i(this))t=this;else{if(!P){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r=55296&&v<=56319&&(w+=e[++r])),w=P?p.call(P,S,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";var n=r(8),o=r(5),i=r(7),a=r(3).iterator,s=Array.isArray;e.exports=function(e){return!!o(e)&&(!!s(e)||(!!i(e)||(!!n(e)||"function"==typeof e[a])))}},function(e,t,r){"use strict";e.exports=function(e){return!!e&&("symbol"==typeof e||!!e.constructor&&("Symbol"===e.constructor.name&&"Symbol"===e[e.constructor.toStringTag]))}},function(e,t,r){"use strict";var n=r(52);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not a symbol");return e}},function(e,t,r){"use strict";var n,o,i,a,s=r(4),u=r(53),l=Object.create,c=Object.defineProperties,d=Object.defineProperty,p=Object.prototype,f=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),a=!0}catch(e){}}var h=function(){var e=l(null);return function(t){for(var r,n,o=0;e[t+(o||"")];)++o;return t+=o||"",e[t]=!0,r="@@"+t,d(p,r,s.gs(null,function(e){n||(n=!0,d(this,r,s(e)),n=!1)})),r}}();i=function(e){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return o(e)},e.exports=o=function e(t){var r;if(this instanceof e)throw new TypeError("Symbol is not a constructor");return a?n(t):(r=l(i.prototype),t=void 0===t?"":String(t),c(r,{__description__:s("",t),__name__:s("",h(t))}))},c(o,{for:s(function(e){return f[e]?f[e]:f[e]=o(String(e))}),keyFor:s(function(e){var t;u(e);for(t in f)if(f[t]===e)return t}),hasInstance:s("",n&&n.hasInstance||o("hasInstance")),isConcatSpreadable:s("",n&&n.isConcatSpreadable||o("isConcatSpreadable")),iterator:s("",n&&n.iterator||o("iterator")),match:s("",n&&n.match||o("match")),replace:s("",n&&n.replace||o("replace")),search:s("",n&&n.search||o("search")),species:s("",n&&n.species||o("species")),split:s("",n&&n.split||o("split")),toPrimitive:s("",n&&n.toPrimitive||o("toPrimitive")),toStringTag:s("",n&&n.toStringTag||o("toStringTag")),unscopables:s("",n&&n.unscopables||o("unscopables"))}),c(i.prototype,{constructor:s(o),toString:s("",function(){return this.__name__})}),c(o.prototype,{toString:s(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:s(function(){return u(this)})}),d(o.prototype,o.toPrimitive,s("",function(){var e=u(this);return"symbol"==typeof e?e:e.toString()})),d(o.prototype,o.toStringTag,s("c","Symbol")),d(i.prototype,o.toStringTag,s("c",o.prototype[o.toStringTag])),d(i.prototype,o.toPrimitive,s("c",o.prototype[o.toPrimitive]))},function(e,t,r){"use strict";var n={object:!0,symbol:!0};e.exports=function(){var e;if("function"!=typeof Symbol)return!1;e=Symbol("test symbol");try{String(e)}catch(e){return!1}return!!n[typeof Symbol.iterator]&&(!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag])}},function(e,t,r){"use strict";var n,o,i,a,s,u,l,c=r(4),d=r(2),p=Function.prototype.apply,f=Function.prototype.call,h=Object.create,_=Object.defineProperty,g=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var r;return d(t),y.call(this,"__ee__")?r=this.__ee__:(r=v.value=h(null),_(this,"__ee__",v),v.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},o=function(e,t){var r,o;return d(t),o=this,n.call(this,e,r=function(){i.call(o,e,r),p.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e,t){var r,n,o,i;if(d(t),!y.call(this,"__ee__"))return this;if(r=this.__ee__,!r[e])return this;if(n=r[e],"object"==typeof n)for(i=0;o=n[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===n.length?r[e]=n[i?0:1]:n.splice(i,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},a=function(e){var t,r,n,o,i;if(y.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(r=arguments.length,i=new Array(r-1),t=1;t-1}},function(e,t,r){"use strict";var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&(n.contains("dwa")===!0&&n.contains("foo")===!1)}},function(e,t,r){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";var n=r(5),o=Object.keys;e.exports=function(e){return o(n(e)?Object(e):e)}},function(e,t,r){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=r(61)()?Object.keys:r(60)},function(e,t,r){"use strict";var n=r(62),o=r(1),i=Math.max;e.exports=function(e,t){var r,a,s,u=i(arguments.length,2);for(e=Object(o(e)),s=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},a=1;a0?1:-1}},function(e,t,r){"use strict";e.exports=function(){var e=Math.sign;return"function"==typeof e&&(1===e(10)&&e(-20)===-1)}},function(e,t,r){"use strict";e.exports=r(68)()?Math.sign:r(67)},function(e,t,r){"use strict";var n=r(69),o=Math.abs,i=Math.floor;e.exports=function(e){return isNaN(e)?0:(e=Number(e),0!==e&&isFinite(e)?n(e)*i(o(e)):e)}},function(e,t,r){"use strict";e.exports=function(e){return e!==e}},function(e,t,r){"use strict";e.exports=function(){var e=Number.isNaN;return"function"==typeof e&&(!e({})&&e(NaN)&&!e(34))}},function(e,t,r){"use strict";e.exports=r(72)()?Number.isNaN:r(71)},function(e,t,r){"use strict";var n=r(73),o=r(21),i=r(1),a=Array.prototype.indexOf,s=Object.prototype.hasOwnProperty,u=Math.abs,l=Math.floor;e.exports=function(e){var t,r,c,d;if(!n(e))return a.apply(this,arguments);for(r=o(i(this).length),c=arguments[1],c=isNaN(c)?0:c>=0?l(c):o(this.length)-l(u(c)),t=c;t=this._controllers.length)this._logger.debug("No more controllers for this rendition."),t({excludeRendition:!0,immediateRetry:!0});else{var o=!1,i=function(i){if(o)throw new Error("performNextAction() already called");o=!0,"MOVE_ON"!==i&&"MOVE_ON_SAME_RENDITION"!==i||(r._logger.debug("Controller will not be used again."),r._controllerIndexByRendition.set(e.rendition,n+1)),"MOVE_ON_SAME_RENDITION"===i?r.buildNextController(e,t):t({excludeRendition:!1,immediateRetry:"MOVE_ON"===i})};this._manageController(e,this._controllers[n],i)}},e.prototype.releaseCurrentController=function(e){var t=e.retry;if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");this._controlledPlayerWithRendition.releaseControl({retry:t})},e.prototype.getQuality=function(){return this._quality},e.prototype.getPlayerDetails=function(){if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");var e=this._controlledPlayerWithRendition,t=e.initialUrlAndRendition,r=e.controller,n=e.controlledPlayer;return i(t,r,n.getUrl())},e.prototype._manageController=function(e,t,r){var n=this,o=function(){n._removePlayer(),n._controlledPlayerWithRendition=null,a&&a.kill()};if(this._logger.debug("Preparing controller.",t.name),!t.isRenditionSupported(e.rendition,{streamUrlExpires:this._streamUrlsExpire}))return this._logger.debug("Skipping controller because rendition not supported."),void r("MOVE_ON_SAME_RENDITION");var a,l=!1,c=function(e){var t=e.retry;l||(l=!0,n._logger.debug("Releasing control."),o(),r(t?"RETRY":"MOVE_ON"))};try{this._logger.debug("Building player.");var d=t.buildPlayer({logger:s.logger.prefixLogger(this._logger,t.name+"-Controller"),playerId:this._playerId,urlAndRendition:e,streamUrlExpires:this._streamUrlsExpire,fetchEnabled:this._fetchEnabled,releaseControl:c,fadeOnPauseAndPlay:this._fadeOnPauseAndPlay,fadeOnSeek:this._fadeOnSeek,getNewUrl:function(){return n._getNewUrlWithSameRendition(e.rendition)},reportError:function(r){n._errorEventGenerator&&n._errorEventGenerator.reportManualEvent(r,i(e,t,d?d.getUrl():e.url))},reportPerformance:function(e){!l&&n._audioPerformanceEventGenerator&&n._audioPerformanceEventGenerator.reportManualEvent(e)}});if(a=d.getPlayer(),l)this._logger.warn("Player released during constrution."),a.kill();else if(a.isDead()){var p=a.getFatalError();p instanceof s.errors.NotSupportedError?this._logger.debug("Player not supported (during construction)."):this._logger.error("Error during construction.",p),r("MOVE_ON_SAME_RENDITION")}else{this._logger.debug("Player built."),a.onChange.subscribe(function(e){var t=e.dead,r=e.fatalError;t&&(r&&n._logger.error("Fatal player error occurred.",r),c({retry:!1}))}),this._cacheManager.addPlayer(a),this._controlledPlayerWithRendition={controller:t,controlledPlayer:d,initialUrlAndRendition:e,releaseControl:c},this._providePlayer(d.getPlayer(),t.syncConfig,t.supportsVolumeAutomation),this._logger.debug("Player provided to proxy.");var f=e.quality||null;this._quality!==f&&(this._logger.debug("Quality changed.",f),this._quality=f,this._onQualityChanged.dispatch(f))}}catch(e){e===u.notSupportedError?this._logger.debug("Player not supported. Not constructed."):this._logger.error("Error during construction.",e),o(),r("MOVE_ON_SAME_RENDITION")}},e.prototype._getNewUrlWithSameRendition=function(e){var t=this,r=new s.helpers.abortableJob.AbortableJob(function(){var r=t._streamUrlRetriever.getUrl(t._getURLOpts),n=r.whenComplete().then(function(t){var r=null;return t&&t.success&&t.rendition===e&&(r=t.url),r});return{result:n,abort:function(){return r.abort()}}});return r.run()},e}();t.ControllerManager=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=1e3,a=function(){function e(e,t,r,o,a){this._checkpointTimer=null,this._logger=n.logger.prefixLogger(o,"AudioEventGenerator"),this._player=e,this._eventReporter=t,this._checkpointInterval=Math.max(i,r),this._getPlayerDetails=a,this._startReporting()}return e.prototype._startReporting=function(){var e=this,t=this._player;t.onChange.subscribe(function(r){var n=r.actuallyPlaying,o=r.ended;n===!0&&!t.isEnded()||o===!1&&t.isActuallyPlaying()?(e._checkpointTimer||(e._checkpointTimer=window.setInterval(function(){e._reportEvent("checkpoint")},e._checkpointInterval)),e._reportEvent("play")):(n===!1&&!t.isEnded()||o===!0&&t.isActuallyPlaying())&&(e._checkpointTimer&&(window.clearInterval(e._checkpointTimer),e._checkpointTimer=null),e._reportEvent("pause"))})},e.prototype._reportEvent=function(e){var t=this._getPlayerDetails();if(!t)return void this._logger.warn("Cannot report event because there is no player.",e);var r=this._player.getDuration();if(null===r)throw new Error("Duration should exist now.");var n={type:e,position:this._player.getPosition(),duration:r,preset:t.preset,quality:t.quality,playerType:t.name,appState:o.getAppState()};this._logger.debug("Generated audio event.",n),this._eventReporter(n)},e}();t.AudioEventGenerator=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){this._delayFactor=0,this._lastRequestTime=0}return e.prototype.getDelay=function(e){var t=void 0===e?{}:e,r=t.maxDelay,n=void 0===r?3e4:r,o=t.numInstantRuns,i=void 0===o?5:o,a=Date.now()-this._lastRequestTime;this._lastRequestTime=Date.now(),this._delayFactor=Math.max(0,this._delayFactor-a/n),this._delayFactor++;var s=this._delayFactor-i;return s>0?Math.pow(2,s):0},e}();t.DecayingExponentialDelayCalculator=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=function(){function e(e,t,r,o,i,a){this._logger=n.logger.prefixLogger(a,"ErrorGenerator"),this._player=e,this._logCollector=t,this._logId=r,this._trackId=o,this._eventReporter=i,this._listenForProxyFatalError()}return e.prototype.reportManualEvent=function(e,t){"NOT_SUPPORTED_ERROR"!==e&&"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"!==e&&(this._logger.debug("Reporting manual error event.",e),this._reportEvent(e,t))},e.prototype._listenForProxyFatalError=function(){var e=this;this._player.onError.subscribe(function(t){t instanceof n.errors.PlayerFatalError&&e._reportEvent(t.getCode())})},e.prototype._reportEvent=function(e,t){var r={errorCode:e,log:this._logCollector.getLog(),logId:this._logId,trackId:this._trackId,protocol:t&&t.protocol,playerType:t&&t.name?t.name:"MaestroUnknown",host:t&&t.host,bitrate:t&&t.bitrate,format:t&&t.format,preset:t&&t.preset,quality:t&&t.quality,url:t&&t.url,appState:o.getAppState()};this._logger.debug("Generated audio error event.",r),this._eventReporter(r)},e}();t.ErrorEventGenerator=i},function(e,t,r){"use strict";function n(e,t){var r=e.getBufferedTimeRanges();return r?a(r,function(e){return e.containsTime(t)})||new o.TimeRange(t,0):null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=2e3,a=o.helpers.find,s=function(){function e(e){var t=e.proxy,r=e.getPlayer;this._getPlayer=r;var o=this._position=t.getPosition(),i=this._initialActualPlayer=r();if(i){var a=n(i,o);a?this._initialBuffered=a.end-o:this._initialBuffered=null}else this._initialBuffered=null}return e.prototype.getPreloaded=function(){var e=this._initialBuffered;return null!==e&&this._initialActualPlayer&&this._getPlayer()===this._initialActualPlayer?0===e?"no":e>=i?"yes":"partial":null},e}();t.PreloadingCalculator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.helpers.time.now,i=function(){function e(){this._start=null,this._end=null}return e.prototype.start=function(){if(this.isComplete())throw new Error("Timer completed.");this._start=o()},e.prototype.isComplete=function(){return null!==this._end},e.prototype.stop=function(){if(null===this._start)throw new Error("Not started.");this._end=o()},e.prototype.getTime=function(){if(null===this._end)throw new Error("Not completed.");return this._end-this._start},e}();t.Timer=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(83),i=r(82),a=r(12),s=3e4,u=1e3,l=function(){function e(e,t,r,o,i){this._logger=n.logger.prefixLogger(o,"AudioPerformanceEventGenerator"),this._proxy=e,this._getPlayer=t,this._eventReporter=r,this._getPlayerDetails=i,this._measureGeneralEvents()}return e.prototype.reportManualEvent=function(e){this._logger.debug("Reporting manual audio performance event.",e),this._eventReporter(e)},e.prototype._measureGeneralEvents=function(){var e=this,t=this._proxy,r=null,n=null,a=null,l=null,c=null,d=null,p=null,f=!0;t.onChange.subscribe(function(h){var _=h.playing,g=h.actuallyPlaying,y=h.seek,v=h.seeking,m=h.stalled,E=h.ended,b=h.dead;if(b!==!0&&_!==!1||!l||(l.stop(),l.getTime()>=u&&e._reportEvent("rageSkip",l.getTime(),null),l=null),t.isDead())return void(p&&window.clearTimeout(p));var w=t.getSeekState();t.isActuallyPlaying()||l||!(_===!0||t.isPlaying()&&m===!0)||(l=new o.Timer,l.start()),_===!0&&(r||(r=new o.Timer,r.start(),n=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),p=window.setTimeout(function(){e._reportEvent("longInitialBuffering",0,null)},s),0===t.getPosition()&&(f=!1))),_===!1&&(p&&window.clearTimeout(p),r&&!r.isComplete()&&(r=null)),g===!0&&(l=null,r&&!r.isComplete()&&(r.stop(),p&&window.clearTimeout(p),e._reportEvent("play",r.getTime(),n.getPreloaded()))),y&&"IN_PROGRESS"===y.state&&t.isReady()&&(a=new o.Timer,a.start(),c=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),v===!0&&e._reportEvent("seekStart",0,null)),(y&&"COMPLETED"===y.state&&!t.isStalled()||m===!1&&w&&"COMPLETED"===w.state)&&a&&(a.stop(),e._reportEvent("seek",a.getTime(),c.getPreloaded()),a=null),m!==!0||!t.isPlaying()||w&&"IN_PROGRESS"===w.state||r&&r.isComplete()&&(d=new o.Timer,d.start(),e._reportEvent("rebufferingStart",t.getPosition(),null)),m===!1&&(r&&r.isComplete()&&(l=null),d&&(d.stop(),e._reportEvent("rebufferingEnd",d.getTime(),null),d=null)),E!==!0||f||(e._reportEvent("uninterruptedPlay",0,null),f=!0);var P=w&&"IN_PROGRESS"===w.state;!P&&m===!0&&t.isActuallyPlaying()&&(f=!0)})},e.prototype._reportEvent=function(e,t,r){var n=this._getPlayerDetails();if(!n)return void this._logger.warn("Cannot report event because there is no player.",e,t);var o={type:e,latency:t,protocol:n.protocol,playerType:n.name,host:n.host,bitrate:n.bitrate,format:n.format,preset:n.preset,quality:n.quality,preloaded:r||void 0,appState:a.getAppState()};this._logger.debug("Generated audio performance event.",o),this._eventReporter(o)},e}();t.AudioPerformanceEventGenerator=l},function(e,t,r){"use strict";function n(e){return e.map(function(e){try{return JSON.stringify(e)}catch(e){return""}})}var o=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;rthis._bufferSize&&this._log.shift()},e}();t.LogCollector=i},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}function o(e){if("number"!=typeof e)throw new Error("level must be a number.");if(e<0||e>1)throw new Error("Invalid volume level.");L=e,N.forEach(function(t){return t.setVolume(e)})}function i(){return L}function a(e){if("boolean"!=typeof e)throw new Error("muteEnabled must be a boolean.");F=e,N.forEach(function(t){return t.setMuted(e)})}function s(){return F}function u(e){if("number"!=typeof e||e<0)throw new Error("Invalid size.");D.setCacheSize(e)}var l=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var c=r(0),d=r(26),p=r(85),f=r(84),h=r(81),_=r(80),g=r(79),y=r(78),v=r(33),m=r(32),E=r(6),b=r(15),w=r(31),P=r(30),S=r(29),R=r(14),A=r(13),O=3e3,T=c.eventDispatcher.EventDispatcher,M=c.helpers.Promise,x=c.helpers.deferred.buildDeferred,D=new v.CacheManager(15e7,c.logger.noOpLogger),I=100,k=5e3,C=-1,N=[],L=1,F=!1;t.setGlobalVolume=o,t.getGlobalVolume=i,t.setGlobalMuted=a,t.getGlobalMuted=s,t.setCacheSize=u;var U=function(e){function t(t){var r=e.call(this,t)||this;r._onPreloadingEnabled=new T,r._onPreloadingDisabled=new T,r._retryDelayCalculator=new _.DecayingExponentialDelayCalculator,r._errorEventGenerator=null,r._fadeOutVolumeAutomator=null,r._volumeAutomators=[],r._volumeScale=1,r._userVolume=1,r._volumeAutomationSupported=!1,r._timer=null,r._pauseFadeTimer=null,r._pauseFadeDeferred=null,r._pauseFade=null,r._executionState={state:"IDLE"},r._preloadingListeners=[],r._retrieveAndBuildTimer=null,r._hadAStreamUrl=!1;var n=r._config=w.validatePlayerDependencies(t);r._preloadingEnabled=n.preloadingEnabled,r._getURLOpts=n.getURLOpts,r._controllers=n.controllers;var o=r._connectionRequiredHelper=new S.ConnectionRequiredHelper(r);r.onPreloadingEnabled=r._onPreloadingEnabled.getHandle(),r.onPreloadingDisabled=r._onPreloadingDisabled.getHandle(),r.onConnectionRequired=o.onConnectionRequired,r.onConnectionRecovered=o.onConnectionRecovered,r.onChange.subscribe(function(e){r.isDead()||((e.playing===!1||e.positionJumped||e.stalled||e.ended)&&r._completePauseFade(),r._pauseFade&&(e.actuallyPlaying===!1||e.ended||e.playing===!0)&&(r._removeVolumeAutomator(r._pauseFade),r._pauseFade=null),(e.positionJumped||void 0!==e.actuallyPlaying||void 0!==e.stalled)&&r._updateVolume(),void 0!==e.playing&&r._updateMaxBufferLength())});var i="SCAudio-"+ ++C,a=n.streamUrlRetriever.getTrackId();null!==a&&(i+="-"+a);var s=new p.LogCollector,u=c.logger.cloneLogger(s,r._logger);r._logger=c.logger.prefixLogger(u,i);var l=P.generateLogId();r._logger.info("Building player...",{ua:navigator.userAgent,getURLOpts:r._getURLOpts,logId:l}),N.push(r),r.setVolume(L,F),r._updateFadeOut();var d=null,v=null;n.audioPerformanceReporter&&(d=new f.AudioPerformanceEventGenerator(r,function(){return r._getPlayer()},n.audioPerformanceReporter,r._logger,function(){return r._getActivePlayerDetails()})),n.audioReporter&&new g.AudioEventGenerator(r,n.audioReporter,n.audioCheckpointInterval,r._logger,function(){return r._getActivePlayerDetails()}),n.errorReporter&&(v=r._errorEventGenerator=new h.ErrorEventGenerator(r,s,l,a,n.errorReporter,r._logger)),r._excludeUnsupportedRenditions();var m=r._controllerManager=new y.ControllerManager({logger:r._logger,controllers:n.controllers,playerId:i,streamUrlsExpire:n.streamUrlsExpire,fetchEnabled:n.fetchEnabled,fadeOnPauseAndPlay:n.fadeOnPauseAndPlay,fadeOnSeek:n.fadeOnSeek,cacheManager:D,providePlayer:function(e,t,n){r._volumeAutomationSupported=n,r._providePlayer(e,t),r._updateMaxBufferLength()},removePlayer:function(){r._getPlayer()&&r._removePlayer()},streamUrlRetriever:r._config.streamUrlRetriever,getURLOpts:r._getURLOpts,errorEventGenerator:v||void 0,audioPerformanceEventGenerator:d||void 0});if(r.onQualityChanged=m.onQualityChanged,void 0!==n.duration&&(r._logger.debug("Setting initial duration.",n.duration),r._setInitialDuration(n.duration)),r._preloadingEnabled)r._logger.debug("Preloading is enabled, so performing retrieve immediately."),r._retrieveAndBuild();else{r._logger.debug("Preloading is disabled, so deferring retrieve until either a play intent or preloading is enabled.");var E=function(){r._removePreloadingListeners(),r._logger.debug("Preloading now enabled or received a play request. Peforming retrieve."),r._retrieveAndBuild()};r._preloadingListeners.push(r.onPreloadingEnabled.subscribe(E),r.onPlayIntent.subscribe(E))}return r}return l(t,e),t.prototype.reload=function(e){void 0===e&&(e={}),this._ensureNotDead(),this._reloadStreamUrls(e)},t.prototype.enablePreloading=function(){this.isDead()||this._preloadingEnabled||(this._preloadingEnabled=!0,this._updateMaxBufferLength(),this._onPreloadingEnabled.dispatch(void 0))},t.prototype.disablePreloading=function(){this.isDead()||this._preloadingEnabled&&(this._preloadingEnabled=!1,this._updateMaxBufferLength(),this._onPreloadingDisabled.dispatch(void 0))},t.prototype.isPreloadingEnabled=function(){return this._preloadingEnabled},t.prototype.pauseAfterFade=function(e){var t=this;if(this._ensureNotDead(),this._pauseFadeDeferred)return this._pauseFadeDeferred.promise;if(!this.isPlaying()||!this.isActuallyPlaying())return M.resolve(this.pause());var r=x();this._pauseFadeDeferred=r;var n=this.getPosition();if(this._pauseFade)throw new Error("Fade should not already be assigned.");return this._pauseFade=new d.Fade({startPos:n,endPos:n+e,startLevel:1,endLevel:0}),this._addVolumeAutomator(this._pauseFade),this._pauseFadeTimer=window.setTimeout(function(){t._pauseFadeDeferred=null,r.resolve(t.pause({fadeDuration:0}))},e+50),r.promise},t.prototype.isConnectionRequired=function(){return this._connectionRequiredHelper.isConnectionRequired()},t.prototype.getQuality=function(){return this._controllerManager.getQuality()},t.prototype.getVolume=function(){return this._volumeAutomationSupported?this._userVolume:e.prototype.getVolume.call(this)},t.prototype._handleFatalError=function(e){this._logger.warn("Fatal error from current player.",e)},t.prototype._handleVolumeChange=function(t,r){this._userVolume=t,e.prototype._notifyVolumeChange.call(this,t,r),this._calculateAndSetVolume()},t.prototype._notifyVolumeChange=function(){},t.prototype._kill=function(){e.prototype._kill.call(this),this._timer&&window.clearTimeout(this._timer),this._abortPauseFade(),this._removePreloadingListeners(),N.splice(N.indexOf(this),1),"RETRIEVING_URL"===this._executionState.state?this._executionState.retrieveJob.abort():"CONTROLLING_PLAYER"===this._executionState.state&&this._controllerManager.releaseCurrentController({retry:!1}),this._executionState={state:"DEAD"},this._retrieveAndBuildTimer&&window.clearTimeout(this._retrieveAndBuildTimer)},t.prototype._excludeUnsupportedRenditions=function(){var e=this,t={streamUrlExpires:this._config.streamUrlsExpire},r=A.allRenditions.filter(function(r){return!e._controllers.some(function(e){return e.isRenditionSupported(r,t)})});r.forEach(function(t){e._config.streamUrlRetriever.excludeRendition(t)})},t.prototype._addVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t<0&&(this._volumeAutomators.push(e),this._updateVolume())},t.prototype._removeVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t>=0&&(this._volumeAutomators.splice(t,1),this._updateVolume())},t.prototype._removePreloadingListeners=function(){this._preloadingListeners.forEach(function(e){return e.remove()})},t.prototype._getActivePlayerDetails=function(){return"CONTROLLING_PLAYER"!==this._executionState.state?null:this._controllerManager.getPlayerDetails()},t.prototype._updateFadeOut=function(){this._fadeOutVolumeAutomator&&this._removeVolumeAutomator(this._fadeOutVolumeAutomator),this._getURLOpts.snippet&&(this._fadeOutVolumeAutomator=d.buildFadeOut(O),this._addVolumeAutomator(this._fadeOutVolumeAutomator))},t.prototype._handleUnexpectedError=function(e){try{e()}catch(e){this._logger.error("Unexpected error.",e),this._triggerError(new c.errors.PlayerFatalError("An unexpected error occurred.",e))}},t.prototype._retrieveAndBuild=function(){var e=this;this._handleUnexpectedError(function(){if(["IDLE","WAITING_TO_RETRIEVE"].indexOf(e._executionState.state)===-1)throw new Error("Invalid state for retrieveAndBuild().");e._logger.debug("Retrieving URL...");var t=m.retrieveUrl({streamUrlRetriever:e._config.streamUrlRetriever,urlProviderRetryDelayCalculator:e._config.urlProviderRetryDelayCalculator,getURLOpts:e._getURLOpts,logger:e._logger});e._executionState={state:"RETRIEVING_URL",retrieveJob:t},t.onCompletion(function(t){if(e._logger.debug("Retrieved URL.",!!t),t&&t.success){e._hadAStreamUrl=!0;var r=!1,n=function(n){var o=n.excludeRendition,i=n.immediateRetry;e._handleUnexpectedError(function(){if(r)throw new Error("startOver called multiple times.");if(r=!0,o&&e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e.isDead())return void e._logger.debug("Stopping execution because player is dead.");if(i)e._logger.debug("Moving on immediately."),e._retrieveAndBuild();else{var n=e._retryDelayCalculator.getDelay();e._logger.debug("Will move on in "+n+"ms."),n?e._retrieveAndBuildTimer=window.setTimeout(function(){return e._retrieveAndBuild()},n):e._retrieveAndBuild()}})};e._handleUnexpectedError(function(){e._executionState={state:"CONTROLLING_PLAYER"},e._logger.debug("Building controller..."),e._controllerManager.buildNextController(t,n),e._logger.debug("Built controller.")})}else if(t&&t.rendition){if(e._logger.warn("Error retrieving URL. Moving on.",t.error),e._errorEventGenerator){var o="SCAUDIO.URL_RETRIEVER_ERROR."+e._config.streamUrlRetriever.name+"."+t.error.getCode();e._errorEventGenerator.reportManualEvent(o,{preset:t.preset,quality:t.quality,bitrate:t.bitrate,format:t.rendition.scFormat,protocol:t.rendition.scProtocol})}e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e._retrieveAndBuild()}else t&&t.rendition&&e._logger.warn("Error retrieving URL for any rendition.",t.error),e._logger.info("Ran out of streams.",e._hadAStreamUrl),e._triggerError(e._hadAStreamUrl?new E.NotSupportedError:new b.NoStreamsError)}),t.onError(function(t){t!==c.helpers.abortableJob.abortedError&&(t===m.NoMoreAttemptsError?e._logger.error("Ran out of retries to retrieve URL."):e._logger.error("Unexpected error when retrieving a URL.",t),e._triggerError(new R.FailedRetrievingUrlError))})})},t.prototype._reloadStreamUrls=function(e){this._getURLOpts=e,this._updateFadeOut(),this._logger.info("Reloading stream URL's...",this._getURLOpts),"RETRIEVING_URL"===this._executionState.state?(this._logger.debug("Aborting current URL retrieve."),this._executionState.retrieveJob.abort(),this._executionState={state:"WAITING_TO_RETRIEVE"},this._retrieveAndBuild()):"CONTROLLING_PLAYER"===this._executionState.state?(this._logger.debug("Releasing controller."),this._controllerManager.releaseCurrentController({retry:!0})):this._logger.debug("Nothing to do."),this._logger.info("Reloaded stream URL's.")},t.prototype._completePauseFade=function(){if(this._pauseFadeDeferred){this._pauseFadeTimer&&window.clearTimeout(this._pauseFadeTimer);var e=this._pauseFadeDeferred;this._pauseFadeDeferred=null,e.resolve(this.pause())}},t.prototype._abortPauseFade=function(){this._pauseFadeTimer&&(window.clearTimeout(this._pauseFadeTimer),this._pauseFadeTimer=null),this._pauseFadeDeferred&&(this._pauseFadeDeferred.reject(new Error("Player was killed.")),this._pauseFadeDeferred=null)},t.prototype._updateVolume=function(){var e=this;if(this._volumeAutomationSupported){this._ensureNotDead(),this._timer&&(window.clearTimeout(this._timer),this._timer=null);var t=this.getDuration();if(null!==t){var r=this._volumeAutomators,o=this.getPosition(),i=1/0,a=1;r.forEach(function(e){var r=e.calculate(o,t),s=r.nextCalculatePosition,u=r.level;a*=n(0,1,u),s=0&&(t._listeners.splice(e,1),!0)},retrieve:function(){return t._dispatchListenerPayloads(r)}}},e.prototype.dispatch=function(e,t){var r=this,o="number"==typeof t?{time:t}:t||{},i=void 0!==o.time?o.time:n.now(),a=this._listeners;a.forEach(function(t){return t.payloads.push({time:i,payload:e})});var s=!1;do s=!a.some(function(e){var t=e.fn,n=e.payloads,o=n.shift();return!!o&&(r._callHandler(t,o),!0)});while(!s)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype._dispatchListenerPayloads=function(e){for(var t=e.fn,r=e.payloads;;){var n=r.shift();if(!n)break;this._callHandler(t,n)}},e.prototype._callHandler=function(e,t){try{e(t.payload,t.time)}catch(e){window.setTimeout(function(){throw e},0)}},e}();t.EventDispatcher=o},function(e,t,r){"use strict";var n,o=r(14),i=r(23),a=r(66),s=r(22);n=e.exports=function(e,t){var r,n,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(r=a=!0,n=!1):(r=s.call(e,"c"),n=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:r,enumerable:n,writable:a},u?o(i(u),l):l},n.gs=function(e,t,r){var n,u,l,c;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(l=r,r=void 0):(l=t,t=r=void 0),null==e?(n=!0,u=!1):(n=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:r,configurable:n,enumerable:u},l?o(i(l),c):c}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(95);t.Promise=n.Promise},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call("");e.exports=function(e){return"string"==typeof e||e&&"object"==typeof e&&(e instanceof String||n.call(e)===o)||!1}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(function(){return arguments}());e.exports=function(e){return n.call(e)===o}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._msg=e,this._cause=t}return e.prototype.getCode=function(){return"PLAYER_ERROR"},e.prototype.getMsg=function(){return this._msg},e.prototype.getCause=function(){return this._cause},e}();t.PlayerError=n},function(e,t,r){"use strict";function n(e,t){return{debug:function(r){for(var n=[],o=1;o=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";var n=r(10),o=r(9),i=r(63),a=r(43),s=r(42),u=r(2).iterator;e.exports=function(e){return"function"==typeof s(e)[u]?e[u]():n(e)?new i(e):o(e)?new a(e):new i(e)}},function(e,t,r){"use strict";e.exports=r(65)()?String.prototype.contains:r(64)},function(e,t,r){"use strict";var n=r(4),o=Array.prototype.forEach,i=Object.create,a=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return o.call(arguments,function(e){n(e)&&a(Object(e),t)}),t}},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";var n=r(4),o={function:!0,object:!0};e.exports=function(e){return n(e)&&o[typeof e]||!1}},function(e,t,r){"use strict";var n,o=r(25),i=r(0),a=Object.prototype.isPrototypeOf,s=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(e,t){if(i(e),null===t||o(t))return e;throw new TypeError("Prototype must be null or an object")},e.exports=function(e){var t,r;return e?(2===e.level?e.set?(r=e.set,t=function(e,t){return r.call(n(e,t),t),e}):t=function(e,t){return n(e,t).__proto__=t,e}:t=function e(t,r){var o;return n(t,r),o=a.call(e.nullPolyfill,t),o&&delete e.nullPolyfill.__proto__,null===r&&(r=e.nullPolyfill),t.__proto__=r,o&&s(e.nullPolyfill,"__proto__",u),t},Object.defineProperty(t,"level",{configurable:!1,enumerable:!1,writable:!1,value:e.level})):null}(function(){var e,t=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{e=n.set,e.call(t,r)}catch(e){}if(Object.getPrototypeOf(t)===r)return{set:e,level:2}}return t.__proto__=r,Object.getPrototypeOf(t)===r?{level:2}:(t={},t.__proto__=r,Object.getPrototypeOf(t)===r&&{level:1})}()),r(74)},function(e,t,r){"use strict";var n=Object.create,o=Object.getPrototypeOf,i={};e.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;return"function"==typeof e&&o(e(t(null),i))===i}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(11),i=function(e){function t(t,r,n){void 0===n&&(n="The player that the proxy was controlling had an error.");var o=e.call(this,n)||this;return o._providedPlayerError=t,o._providedPlayer=r,o}return n(t,e),t.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_ERROR"},t.prototype.getProvidedPlayerError=function(){return this._providedPlayerError},t.prototype.getProvidedPlayer=function(){return this._providedPlayer},t}(o.PlayerError);t.ProxyProvidedPlayerError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"IMPLEMENTATION_ERROR"},t}(o.PlayerFatalError);t.ImplementationError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=function(){function e(e,t){this._inCallback=!1,this._onExit=e,this._onEnter=t||null}return e.prototype.enter=function(e){var t=this;if(this._inCallback)return e?e(this._onEnterResultRetriever):void 0;this._inCallback=!0;var r=[],o=!1;this._onEnter&&(this._onEnterResultRetriever={getResult:function(e){o?n.deferException(function(){return e(t._onEnterError,t._onEnterResult)}):r.push(e)}});try{var i=e?e(this._onEnterResultRetriever):void 0;if(this._onEnter){this._onEnterError=void 0,this._onEnterResult=void 0;try{this._onEnterResult=this._onEnter()}catch(e){this._onEnterError=e}o=!0,r.forEach(function(e){return n.deferException(function(){return e(t._onEnterError,t._onEnterResult)})})}return i}finally{this._inCallback=!1,n.deferException(function(){return t._onExit(t._onEnterError,t._onEnterResult)})}},e}();t.OnExit=o},function(e,t,r){"use strict";function n(e){var t=Object.create(null);return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=r(30),i=r(3),a=function(){},s=function(){function e(e,t){void 0===t&&(t={});var r=this;this._subscribers=[],this._onExit=new o.OnExit(function(){return r._after()},function(){return r._onEnter()}),this._beforeUpdateError=void 0,this._inAfterUpdate=!1,this._dead=!1,this._officiallyDead=!1,this._errors=[],this._state=n(e),this._initialState=n(e),this._beforeUpdate=t.beforeUpdate||function(){},this._afterUpdate=t.afterUpdate||a,this._afterDispatches=t.afterDispatches||a}return e.prototype.subscribe=function(e,t){var r=this;if(void 0===t&&(t=!0),this._dead){var o=!1;return{retrieve:function(){},remove:function(){return!o&&(o=!0)}}}var i={callback:e,localState:t?n(this._state):this._initialState};return this._subscribers.push(i),t||this._updateSubscriber(i),{remove:function(){var t=r._subscribers.map(function(e){return e.callback}).indexOf(e);return t>=0&&(r._subscribers.splice(t,1),!0)},retrieve:function(){r._updateSubscriber(i)}}},e.prototype.subscribeIndividual=function(e,t,r){return this.subscribe(function(r){var n=r[e];void 0!==n&&t(n)},r)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype.getIndividualHandle=function(e){var t=this;return{subscribe:function(r){return t.subscribeIndividual(e,r)}}},e.prototype.update=function(e){var t=this;this._officiallyDead||(this._inAfterUpdate?e&&e(this._state,this._beforeUpdateError):this._onExit.enter(function(r){r.getResult(function(){try{e&&e(t._state,t._beforeUpdateError)}catch(e){t._errors.push(e)}})}))},e.prototype.getState=function(){return this._state},e.prototype.kill=function(){var e=this;this._dead||(this._dead=!0,window.setTimeout(function(){e._subscribers.splice(0),e._officiallyDead=!0},0))},e.prototype.isDead=function(){return this._dead},e.prototype._onEnter=function(){this._beforeUpdateError=void 0;try{this._beforeUpdate(this._state)}catch(e){this._beforeUpdateError=e}},e.prototype._after=function(){var e=this,t=this._errors;this._errors=[],i.deferException(function(){e._inAfterUpdate=!0;try{e._afterUpdate(e._state,{beforeUpdate:e._beforeUpdateError,update:t})}catch(t){throw e._inAfterUpdate=!1,t}e._inAfterUpdate=!1,e._subscribers.slice().forEach(function(t){return e._updateSubscriber(t)}),e._afterDispatches(e._state)})},e.prototype._updateSubscriber=function(e){var t=this._calculateDiff(e.localState);Object.keys(t).length&&(e.localState=n(this._state),i.deferException(function(){return e.callback(t,e.localState)}))},e.prototype._calculateDiff=function(e){var t=this,r=Object.create(null);return Object.keys(this._state).forEach(function(n){var o=t._state[n];o!==e[n]&&(r[n]=o)}),r},e}();t.StateManager=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.LOADING=0]="LOADING",e[e.PLAYING=1]="PLAYING",e[e.PAUSED=2]="PAUSED",e[e.DEAD=3]="DEAD"}(n=t.State||(t.State={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t){return e.call(this,t||"The player cannot play the provided descriptor.")||this}return n(t,e),t.prototype.getCode=function(){return"NOT_SUPPORTED_ERROR"},t}(o.PlayerFatalError);t.NotSupportedError=i},function(e,t,r){"use strict";function n(){return{ended:!1,loading:!1,playing:!1,actuallyPlaying:!1,volume:1,muted:!1,isFading:!1,fadeRate:null,isFadingForSeek:!1,playDeferred:null,pauseDeferred:null,ready:!1,seeking:!1,seek:null,positionJumped:null,stalled:!0,duration:null,dead:!1,state:d.State.PAUSED,fatalError:null,errorOccurred:null,position:0}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=r(33),a=r(6),s=r(13),u=r(17),l=r(19),c=r(8),d=r(32),p=r(12),f=r(31),h=r(29),_=r(3),g="undefined"!=typeof navigator&&"mediaSession"in navigator,y=5e3,v=150,m=25,E=35,b=1e3,w=g?navigator.mediaSession:null,P=function(){function e(e){var t=this;this._stateManager=new f.StateManager(n(),{afterUpdate:function(e,r){return t._afterUpdate(e,r)},afterDispatches:function(){return t._afterDispatches()},beforeUpdate:function(e){if(!e.dead&&(e.ready||!t._fatalErrorTriggered)){var r=t._getPosition(),n=e.duration;if(r<0)throw t._logger.error("Player provided invalid position.",r,n),t._triggerError(new h.ImplementationError("Player provided a position that was invalid.")),new Error("Player provided invalid position.");e.position=r,t._updateEndedInState(e)}}}),this._onError=new a.EventDispatcher,this._errors=[],this._fatalErrorTriggered=!1,this._loadingDelayTimer=null,this._stalled=!1,this._queuedDuration=null,this._readyDeferred=s.buildDeferred(),this._queuedSeekDeferreds=[],this._lastPlayError=null,this._lastPauseError=null,this._lastPlayedPosition=null,this._listenTimeBase=0,this._timePlaybackStarted=null,this._positionAfterLastUpdate=0,this._positionWhenStartedFadeOut=null,this._fadeStartAllowed=!1,this._seekFadeStartAllowed=!1,this._implementationIsFading=!1;var r=e.name;if(this._logger=p.prefixLogger(e.logger,"BasePlayer"+(r?"-"+r:"")),this._mediaSessionEnabled=!!e.mediaSessionEnabled,e.defaultFadeDuration&&e.defaultFadeDuration<0)throw new Error("defaultFadeDuration must be >= 0.");if(e.loadingDelay&&e.loadingDelay<0)throw new Error("loadingDelay must be >= 0.");this._defaultFadeDuration=void 0!==e.defaultFadeDuration?e.defaultFadeDuration:v,this._defaultSeekFadeOutDuration=void 0!==e.defaultSeekFadeOutDuration?e.defaultSeekFadeOutDuration:m,this._defaultSeekFadeInDuration=void 0!==e.defaultSeekFadeInDuration?e.defaultSeekFadeInDuration:E,this._loadingDelay=void 0!==e.loadingDelay?e.loadingDelay:b,this.onError=this._onError.getHandle(),this.whenReady=this._readyDeferred.promise,this._stateManager.subscribe(function(e,r){return t._onChange(e,r)}),this._stateManager.subscribe(function(e){var r=e.actuallyPlaying,n=e.seek;r===!0&&(t._fadeStartAllowed=!1),n&&"IN_PROGRESS"!==n.state&&(t._seekFadeStartAllowed=!1)}),this._stateManager.subscribe(function(e,r){var n=e.isFading,o=r.dead;!o&&n===!1&&t._implementationIsFading&&t._triggerError(new h.ImplementationError("Fade was still running when not allowed."))}),this._stateManager.subscribe(function(e,r){var n=e.playing,o=r.dead,i=r.fadeRate;if(!o&&void 0!==n)try{t._handlePlayPauseChange(n,{fadeRate:i||void 0}),n||(t._fadeStartAllowed=!1)}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling play/pause change.",e))}}),this._stateManager.subscribe(function(e,r){var n=e.seek,o=r.dead;if(!o&&n&&"IN_PROGRESS"===n.state)try{t._seekFadeStartAllowed=!0,t._handleSeekChange(n.position,{fadeRate:{beforeSeek:n.fadeRate.beforeSeek||void 0,afterSeek:n.fadeRate.afterSeek||void 0}}),t._seekFadeStartAllowed=!1}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling seek change.",e))}}),this.onChange=this._buildEventHandle(function(e,r){var n=r.ready;if(void 0!==n&&n!==!0)throw new Error("Ready state is invalid.");var o=r.duration;if(void 0!==o&&null===o)throw new Error("Duration state is invalid.");var i=r.dead;if(void 0!==i&&i!==!0)throw new Error("Dead state is invalid.");var a={ready:n,ended:r.ended,duration:o,volume:r.volume,muted:r.muted,playing:r.playing,actuallyPlaying:r.actuallyPlaying,stalled:r.stalled,loading:r.loading,fading:r.isFading,fadingForSeek:r.isFadingForSeek,playRejection:r.playing===!1?t._lastPlayError||void 0:void 0,pauseRejection:r.playing===!0?t._lastPauseError||void 0:void 0,seeking:r.seeking,seek:r.seek||void 0,positionJumped:void 0!==r.positionJumped||void 0,state:r.state,fatalError:r.fatalError||void 0,dead:i};Object.keys(a).some(function(e){return void 0!==a[e]})&&e(a)});var o=e.registerListeners;o&&_.deferException(function(){o({onChange:t.onChange,onError:t.onError})}),this._registerMediaSessionActionHandlers(),this._notifyMediaSessionPaused(),this.onDurationChange=this._buildEventHandle(function(e,t){var r=t.duration;void 0!==r&&null!==r&&e(r)}),this.onReady=this._buildEventHandle(function(e,t){var r=t.ready;r===!0&&e(void 0)}),this.onStateChange=this._buildEventHandle(function(e,t){var r=t.state;void 0!==r&&e(r)}),this.onVolumeChange=this._buildEventHandle(function(e,t,r){var n=t.volume,o=t.muted,i=r.volume,a=r.muted;void 0===n&&void 0===o||e({volume:i,muted:a})}),this.onPlay=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!0&&e(void 0)}),this.onPlayIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!0&&e(void 0)}),this.onPlayRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!1&&t._lastPlayError&&e(t._lastPlayError)}),this.onPause=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!1&&e(void 0)}),this.onPauseIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!1&&e(void 0)}),this.onPauseRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!0&&t._lastPauseError&&e(t._lastPauseError)}),this.onSeek=this._buildEventHandle(function(e,t){var r=t.seek;r&&"COMPLETED"===r.state&&e(void 0)}),this.onSeekIntent=this._buildEventHandle(function(e,t){var r=t.seeking;r===!0&&e(void 0)}),this.onSeekRejection=this._buildEventHandle(function(e,t){var r=t.seek;r&&"ERROR"===r.state&&e(r.error)}),this.onPositionJumped=this._buildEventHandle(function(e,t){var r=t.positionJumped;void 0!==r&&e(void 0)}),this.onEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!0&&e(void 0)}),this.onLeftEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!1&&e(void 0)}),this.onStallStart=this._buildEventHandle(function(e,t){var r=t.stalled;r===!0&&e(void 0)}),this.onStallEnd=this._buildEventHandle(function(e,t){var r=t.stalled;r===!1&&e(void 0)}),this.onLoadStart=this._buildEventHandle(function(e,t){var r=t.loading;r===!0&&e(void 0)}),this.onLoadEnd=this._buildEventHandle(function(e,t){var r=t.loading;r===!1&&e(void 0)}),this.onFadeStart=this._buildEventHandle(function(e,t){var r=t.isFading;r===!0&&e(void 0)}),this.onFadeEnd=this._buildEventHandle(function(e,t){var r=t.isFading;r===!1&&e(void 0)}),this.onFadeForSeekStart=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!0&&e(void 0)}),this.onFadeForSeekEnd=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!1&&e(void 0)})}return e.prototype.isReady=function(){return this._stateManager.getState().ready},e.prototype.getPosition=function(){return this._getPositionOrPositionSeekingTo()},e.prototype.getLastPlayedPosition=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.stalled;return t&&!r?this.getPosition():this._lastPlayedPosition},e.prototype.getListenTime=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.ended,n=this._listenTimeBase;return t&&!r&&(n+=l.now()-this._timePlaybackStarted),n},e.prototype.isStalled=function(){return this._stateManager.getState().stalled},e.prototype.isLoading=function(){return this._stateManager.getState().loading},e.prototype.isFading=function(){return this._stateManager.getState().isFading},e.prototype.isFadingForSeek=function(){return this._stateManager.getState().isFadingForSeek},e.prototype.isPlaying=function(){return this._stateManager.getState().playing},e.prototype.isActuallyPlaying=function(){return this._stateManager.getState().actuallyPlaying},e.prototype.isEnded=function(){return this._stateManager.getState().ended},e.prototype.getState=function(){return this._stateManager.getState().state},e.prototype.getBufferController=function(){return null},e.prototype.getMemoryCacheMaxSize=function(){return null},e.prototype.getMemoryCacheUsage=function(){return null},e.prototype.getMemoryCacheController=function(){return null},e.prototype.getFatalError=function(){return this._stateManager.getState().fatalError},e.prototype.isDead=function(){return this._stateManager.getState().dead},e.prototype.getVolume=function(){return this._stateManager.getState().volume},e.prototype.getMuted=function(){return this._stateManager.getState().muted},e.prototype.getDuration=function(){var e=this._stateManager.getState(),t=e.ready,r=e.duration;return t?r:null},e.prototype.setVolume=function(e,t){if(e<0||e>1)throw new Error("Volume must be >= 0 and <= 1.");if(!this._stateManager.getState().dead){var r=this._stateManager.getState().muted;void 0===t&&(t=r);try{this._handleVolumeChange(e,t)}catch(e){throw this._triggerError(new h.ImplementationError("Exception occurred updating volume.",e)),e}}},e.prototype.setMuted=function(e){this.setVolume(this._stateManager.getState().volume,e)},e.prototype.getCurrentBufferedTimeRange=function(){var e=this.getBufferedTimeRanges();if(!e)return null;var t=this.getPosition();return u.find(e,function(e){return e.containsTime(t)})||null},e.prototype.play=function(e){var t=this;this._ensureNotDead(),this._logger.debug("play() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing)t._logger.debug("Intent is already to be playing.");else{t._logger.debug("Requesting play."),n.playing=!0;var o=t._extractFadeDuration(e);o?n.fadeRate=1/o:n.fadeRate=null,t._lastPlayError=null}n.playDeferred&&!n.playDeferred.isSettled()||(n.playDeferred=s.buildDeferred()),r.resolve(n.playDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to play.",e)),c.Promise.reject(e)}},e.prototype.pause=function(e){var t=this;this._ensureNotDead(),this._logger.debug("pause() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing){t._logger.debug("Requesting pause."),t._positionWhenStartedFadeOut=t._getPositionOrPositionSeekingTo(),n.playing=!1;var o=t._extractFadeDuration(e);o?n.fadeRate=-1*(1/o):n.fadeRate=null,t._fadeStartAllowed=!0,t._lastPauseError=null}else t._logger.debug("Intent is already to be paused.");n.pauseDeferred&&!n.pauseDeferred.isSettled()||(n.pauseDeferred=s.buildDeferred()),r.resolve(n.pauseDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to pause.",e)),c.Promise.reject(e)}},e.prototype.seek=function(e,t){var r=this;this._ensureNotDead(),this._logger.debug("seek() called.",e);var n=s.buildDeferred();return this._stateManager.update(function(o){if(e<0)r._logger.warn("Rejecting seek immediately as the position was negative."),n.reject(new Error("You were attempting to seek to a negative time."));else if(null!==o.duration&&e>o.duration)r._logger.warn("Rejecting seek immediately as the duration is now known, and the requested positon was past it."),n.reject(new Error("You were attempting to seek past the end of the media."));else{o.stalled||!o.actuallyPlaying||o.seek&&"IN_PROGRESS"===o.seek.state||(r._lastPlayedPosition=r._getPositionOrPositionSeekingTo());var i=s.buildDeferred();if(o.seek&&"IN_PROGRESS"===o.seek.state&&o.seek.position===e)r._logger.debug("Seek already requested to the same position.",e);else{r._logger.debug("Requesting seek.",e),o.seeking=!0,r._positionWhenStartedFadeOut=null;var a=r._extractSeekFadeDurations(t,e),u=a.fadeOutDuration?-1*(1/a.fadeOutDuration):null,l=a.fadeInDuration?1/a.fadeInDuration:null;o.seek={state:"IN_PROGRESS",position:e,fadeRate:{beforeSeek:u,afterSeek:l}},o.positionJumped=Object.create(null)}r._queuedSeekDeferreds.push({position:e,deferred:i}),n.resolve(i.promise)}}),n.promise},e.prototype.getSeekState=function(){return this._stateManager.getState().seek},e.prototype.kill=function(){var e=this;this._stateManager.update(function(t){t.dead||(e._logger.debug("kill() called."),t.dead=!0)})},e.prototype._update=function(e){this._stateManager.update(function(){return e&&e()})},e.prototype._ensureNotDead=function(){if(this._stateManager.getState().dead)throw new Error("Player is dead.")},e.prototype._notifyStalled=function(e){this._ensureNotDead(),this._stalled!==e&&(this._logger.debug("notifyStalled() called.",e),this._stalled=e,this._stateManager.update())},e.prototype._getQueuedSeekPosition=function(){var e=this.getSeekState();return e&&"IN_PROGRESS"===e.state?e.position:null},e.prototype._provideDuration=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(r.duration!==e){var n=t._getPositionOrPositionSeekingTo();if(e<0||r.ready&&n>e)throw t._triggerError(new h.ImplementationError("Attempt to update duration to an invalid value.")),new Error("Duration cannot be less than the current position.");t._logger.debug("provideDuration() called.",e),r.ready?r.duration=e:t._queuedDuration=e}})},e.prototype._notifyVolumeChange=function(e,t){if(e<0||e>1)throw this._triggerError(new h.ImplementationError("Volume was out of range.",e)),new Error("Volume was out of range.");this._stateManager.update(function(r){r.volume=e,r.muted=t})},e.prototype._notifyPlaying=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to register playback as started before ready.")),new Error("Player must be ready first.");e!==r.actuallyPlaying&&(t._logger.debug("notifyPlaying() called.",e),e||r.seeking||r.stalled||(t._lastPlayedPosition=t._getPositionOrPositionSeekingTo()),r.actuallyPlaying=r.playing=e,e?(t._lastPlayError=null,t._fadeStartAllowed=!0):(r.isFading=!1,t._fadeStartAllowed=!1,t._lastPauseError=null))})},e.prototype._notifyPlayRejection=function(e){var t=this; -this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request before player ready.")),new Error("Player must be ready first.");if(r.actuallyPlaying||!r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPlayRejection() called.",e),r.playing=!1,t._lastPlayError=e})},e.prototype._notifyPauseRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request before player ready.")),new Error("Player must be ready first.");if(!r.actuallyPlaying||r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPauseRejection() called.",e),r.playing=!0,r.fadeRate&&(r.fadeRate*=-1),t._lastPauseError=e})},e.prototype._notifySeekRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request before player ready.")),new Error("Player must be ready first.");if(!r.seek||"IN_PROGRESS"!==r.seek.state)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request when none requested.")),new Error("A seek hasn't been requested.");if(null!==r.duration&&r.position>r.duration)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request after duration changed below current position.")),new Error("Attempt to reject seek request after duration changed below current position.");t._logger.debug("notifySeekRejection() called.",e),r.seeking=!1,r.seek={state:"ERROR",error:e},r.positionJumped=Object.create(null)})},e.prototype._notifyFading=function(e){var t=this;if(this._ensureNotDead(),e&&!this._fadeStartAllowed){var r="Attempt to register fade as starting when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._implementationIsFading=e,this._stateManager.update(function(r){r.isFading!==e&&(t._logger.debug("notifyFading() called",e),e||r.playing||null===t._positionWhenStartedFadeOut||t.seek(t._positionWhenStartedFadeOut,{fadeInDuration:0,fadeOutDuration:0}).catch(function(e){t._logger.warn("Seek back to position where fade out started failed.",e)}),r.isFading=e)})},e.prototype._notifyFadingForSeek=function(e){var t=this;if(this._ensureNotDead(),e&&!this._seekFadeStartAllowed){var r="Attempt to register fade as starting for seek when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._stateManager.update(function(r){r.isFadingForSeek!==e&&(t._logger.debug("notifyFadingForSeek() called",e),r.isFadingForSeek=e)})},e.prototype._signalReady=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal ready twice.")),new Error("Ready already signalled.");if(null===e._queuedDuration)throw e._triggerError(new h.ImplementationError("Attempt to signal ready when duration unknown.")),new Error("Duration is still unknown.");e._logger.debug("signalReady() called."),t.ready=!0,t.duration=e._queuedDuration,t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>t.duration&&(t.seeking=!1,t.seek={state:"ERROR",error:new Error("You were attempting to seek past the end of the media.")})})},e.prototype._signalSeekComplete=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(!t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete before player ready.")),new Error("Player must be ready first.");if(!t.seek||"IN_PROGRESS"!==t.seek.state)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete when none requested.")),new Error("There shouldn't be a seek in progress.");var r=t.duration;if(t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>r)throw new Error("Seek cannot have completed given it was to a time greater than the duration.");e._logger.debug("signalSeekComplete() called."),e._seekFadeStartAllowed=!0,t.seek={state:"COMPLETED",position:t.seek.position,fadeRate:t.seek.fadeRate},t.seeking=!1,t.position=t.seek.position})},e.prototype._triggerError=function(e){var t=this;e instanceof o.PlayerFatalError&&(this._fatalErrorTriggered=!0),this._stateManager.update(function(r){var n=!1;if(r.ready&&e instanceof i.NotSupportedError&&(e=new h.ImplementationError("Invalid NotSupportedError."),n=!0),e instanceof o.PlayerFatalError?(e instanceof i.NotSupportedError?t._logger.info("NotSupportedError occurred.",e):t._logger.error("Fatal error occurred.",e),r.fatalError?t._logger.warn("A fatal error already occurred.",r.fatalError):r.fatalError=e,t._errors.push(e),r.errorOccurred=Object.create(null),r.dead=!0):(t._logger.warn("Non-fatal error occurred.",e),t._errors.push(e),r.errorOccurred=Object.create(null)),n)throw new Error("Not supported errors are only valid before the player is ready.")})},e.prototype._buildEventHandle=function(e){var t=this;return{subscribe:function(r){var n=function(e){return r(e,l.now())};return t._stateManager.subscribe(function(t,r){e(n,t,r)})}}},e.prototype._finalizeState=function(e){this._updateEndedInState(e);var t=this._getPositionOrPositionSeekingTo();if(e.dead)this._lastPlayError=new Error("Player was killed."),e.loading=!1,this._clearLoadingDelay(),!e.playing&&e.isFading&&null!==this._positionWhenStartedFadeOut&&(this._logger.debug("Fade out was in progress. Pretending it completed."),e.isFading=!1,e.position=this._positionWhenStartedFadeOut),e.stalled=!0,e.actuallyPlaying=!1,e.isFadingForSeek=!1,e.playing=!1,e.state=d.State.DEAD;else{var r=!e.ended&&(!e.ready||this._stalled||!(!e.seek||"IN_PROGRESS"!==e.seek.state));r&&!e.stalled&&!e.seeking&&e.actuallyPlaying&&(this._lastPlayedPosition=t),e.stalled=r;var n=!e.ended&&!e.isFading&&!e.isFadingForSeek&&(e.playing||e.actuallyPlaying)&&(e.stalled||e.playing!==e.actuallyPlaying);n?this._loadingDelay?this._scheduleLoadingDelay():e.loading=!0:(e.loading=!1,this._clearLoadingDelay()),this._positionAfterLastUpdate!==t&&(this._positionAfterLastUpdate=t,e.playing||e.actuallyPlaying||(e.positionJumped=Object.create(null))),e.state=this._calculateState(e)}},e.prototype._updateEndedInState=function(e){e.ended=e.ready&&this._getPositionOrPositionSeekingTo()===e.duration},e.prototype._scheduleLoadingDelay=function(){var e=this;this._loadingDelayTimer||(this._loadingDelayTimer=window.setTimeout(function(){e._stateManager.update(function(e){return e.loading=!0})},this._loadingDelay))},e.prototype._clearLoadingDelay=function(){this._loadingDelayTimer&&(window.clearTimeout(this._loadingDelayTimer),this._loadingDelayTimer=null)},e.prototype._getPositionOrPositionSeekingTo=function(){this._stateManager.update();var e=this._stateManager.getState();return e.seek&&"IN_PROGRESS"===e.seek.state?e.seek.position:e.isFading&&!e.playing&&null!==this._positionWhenStartedFadeOut?this._positionWhenStartedFadeOut:e.ready&&null!==e.duration?e.position:0},e.prototype._calculateState=function(e){var t=e.dead,r=e.loading,n=e.playing,o=e.ended;return t?d.State.DEAD:r?d.State.LOADING:n&&!o?d.State.PLAYING:d.State.PAUSED},e.prototype._registerMediaSessionActionHandlers=function(){var e=this;this._mediaSessionEnabled&&w&&(w.setActionHandler("play",function(){e.isDead()||e.play()}),w.setActionHandler("pause",function(){e.isDead()||e.pause()}),w.setActionHandler("seekbackward",function(){e.isDead()||e.seek(Math.max(0,e.getPosition()-y))}),w.setActionHandler("seekforward",function(){e.isDead()||e.seek(Math.min(e.getDuration()||0,e.getPosition()+y))}))},e.prototype._notifyMediaSessionPlaying=function(){this._mediaSessionEnabled&&w&&(w.playbackState="playing")},e.prototype._notifyMediaSessionPaused=function(){this._mediaSessionEnabled&&w&&(w.playbackState="paused")},e.prototype._extractFadeDuration=function(e){return void 0===e&&(e={}),void 0===e.fadeDuration?!this._stateManager.getState().playing||this._getPositionOrPositionSeekingTo()>0?this._defaultFadeDuration:0:e.fadeDuration>0?e.fadeDuration:0},e.prototype._extractSeekFadeDurations=function(e,t){void 0===e&&(e={});var r;r=void 0!==e.fadeOutDuration?e.fadeOutDuration>0?e.fadeOutDuration:0:this._defaultSeekFadeOutDuration;var n;return n=void 0!==e.fadeInDuration?e.fadeInDuration>0?e.fadeInDuration:0:t>0?this._defaultSeekFadeInDuration:0,{fadeOutDuration:r,fadeInDuration:n}},e.prototype._afterUpdate=function(e,t){if(t.beforeUpdate||t.update.length>0)this._logger.error("Errors occurred during state update. Killing player.",t),this._triggerError(new o.PlayerFatalError("Errors occurred during state update.",t));else if(!e.dead&&e.ready){var r=e.duration;null!==r&&!e.seeking&&e.position>r&&(this._logger.error("Player provided invalid position.",e.position,r),this._triggerError(new h.ImplementationError("Player provided a position that was invalid.")))}this._finalizeState(e)},e.prototype._afterDispatches=function(){var e=this,t=this._errors;this._errors=[],t.forEach(function(t){return e._onError.dispatch(t)})},e.prototype._onChange=function(e,t){var r=this,n=e.ready,o=e.dead,i=e.fatalError,a=e.playing,s=e.actuallyPlaying,u=e.ended;if(n===!0&&(this._logger.debug("Resolving ready deferred."),this._readyDeferred.resolve(void 0)),s===!0&&this._registerMediaSessionActionHandlers(),a===!0?this._notifyMediaSessionPlaying():a===!1&&this._notifyMediaSessionPaused(),t.pauseDeferred&&!t.pauseDeferred.isSettled()&&t.playing){var c=this._lastPauseError||new Error("Pause request aborted.");this._logger.debug("Rejecting pause deferred.",c),t.pauseDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&!t.playing){var c=this._lastPlayError||new Error("Play request aborted.");this._logger.debug("Rejecting play deferred.",c),t.playDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&t.actuallyPlaying&&(this._logger.debug("Resolving play deferred."),t.playDeferred.resolve(void 0)),!t.pauseDeferred||t.pauseDeferred.isSettled()||t.actuallyPlaying||(this._logger.debug("Resolving pause deferred."),t.pauseDeferred.resolve(void 0)),s===!0&&!t.ended||u===!1&&t.actuallyPlaying?this._timePlaybackStarted=l.now():(s===!1&&!t.ended||u===!0&&t.actuallyPlaying)&&(this._listenTimeBase+=l.now()-this._timePlaybackStarted,this._timePlaybackStarted=null),this._queuedSeekDeferreds=this._queuedSeekDeferreds.filter(function(e){var n=e.position,o=e.deferred;if(t.seek)if("IN_PROGRESS"!==t.seek.state){if(!t.stalled||"ERROR"===t.seek.state)return"ERROR"!==t.seek.state?(r._logger.debug("Resolving seek()."),o.resolve(void 0)):(r._logger.debug("Rejecting seek().",t.seek.error),o.reject(t.seek.error)),!1}else if("IN_PROGRESS"!==t.seek.state||t.seek.position!==n)return r._logger.debug("Rejecting seek() because another seek was requested.",n),o.reject(new Error("Seek request aborted because another seek was requested to a different position.")),!1;return!0}),o===!0){this._logger.debug("Calling _kill() on player.");try{this._kill(),this._logger.info("Player killed.")}catch(e){this._triggerError(new h.ImplementationError("Exception occurred in _kill().",e)),this._logger.error("Exception when implementation was being killed.",e)}if(!t.ready){var c=i||new Error("Player was killed.");this._logger.debug("Rejecting whenReady."),this._readyDeferred.reject(c)}this._queuedSeekDeferreds.forEach(function(e){var t=e.position,n=e.deferred,o=i||new Error("Seek aborted as player killed.");r._logger.debug("Rejecting seek().",t),n.reject(o)}),this._stateManager.kill(),this._logger.debug("Player dead.")}},e}();t.BasePlayer=P},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),o=this&&this.__assign||Object.assign||function(e){for(var t,r=1,n=arguments.length;re&&(this._logger.debug("Capping position.",e),this.seek(e),this.isReady()&&(this._lastPlayerPosition=e,this._signalSeekComplete()))},t.prototype._sync=function(e){var t=this,r=this._player;if(!r)throw new Error("Player should have become available by now.");if(this._logger.debug("Syncing...",this.isPlaying(),this.isActuallyPlaying()),r.isDead()){this._logger.debug("Provided player is dead.");var n=r.getFatalError();return void(n&&this._handleFatalError(n,r))}this._errorHandler=r.onError.subscribe(function(e){e instanceof s.PlayerFatalError?t._onProvidedPlayerError.dispatch(new d.ProxyProvidedPlayerFatalError(e,r)):(t._triggerError(e),t._onProvidedPlayerError.dispatch(new c.ProxyProvidedPlayerError(e,r)))}),this._changeHandler=r.onChange.subscribe(function(e){t._update(function(){if(t._logger.debug("Handling changes.",e),e.dead)return t._logger.debug("Player has gone to DEAD state."),t._unsync(),void(t.isDead()||e.fatalError&&t._handleFatalError(e.fatalError,r));if(void 0===e.volume&&void 0===e.muted||t._notifyVolumeChange(r.getVolume(),r.getMuted()),void 0!==e.duration&&(t._ensureBelowPosition(e.duration),t._provideDuration(e.duration),t.isReady()||(t._signalReady(),t._handleSkippedSeek(),t._notifyStalled(r.isStalled()))),e.seek){var n=t.getSeekState();n&&"IN_PROGRESS"===n.state||"IN_PROGRESS"!==e.seek.state?n&&"IN_PROGRESS"===n.state&&("COMPLETED"===e.seek.state&&n.position===e.seek.position?(t._signalSeekComplete(),r.isFadingForSeek()&&t._notifyFadingForSeek(!0)):"COMPLETED"===e.seek.state&&n.position!==e.seek.position?t._notifySeekRejection(new Error("Another seek occurred to a different position.")):"IN_PROGRESS"===e.seek.state&&n.position!==e.seek.position?t.seek(e.seek.position):"ERROR"===e.seek.state&&t._notifySeekRejection(e.seek.error)):t.seek(e.seek.position)}void 0!==e.stalled&&t._notifyStalled(e.stalled),e.playing===!1&&e.playRejection?t.isActuallyPlaying()?(t._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),t._notifyPlaying(!1)):t._notifyPlayRejection(e.playRejection):e.playing===!1&&(r.isActuallyPlaying()?t.pause():void 0===e.actuallyPlaying&&t.isReady()&&t._notifyPlaying(!1)),e.playing===!0&&e.pauseRejection?t._notifyPauseRejection(e.pauseRejection):e.playing===!0&&t.play(),void 0!==e.actuallyPlaying&&e.actuallyPlaying!==t.isActuallyPlaying()&&(t._notifyPlaying(e.actuallyPlaying),e.actuallyPlaying&&r.isFading()&&t._notifyFading(!0)),e.fading===!1&&t._notifyFading(!1),e.fadingForSeek===!1&&t._notifyFadingForSeek(!1)})}),this._update(function(){var n=t._instanceLock;try{if(t._notifyStalled(r.isStalled()),r.isReady()){var o=r.getDuration();t._ensureBelowPosition(o),t._provideDuration(o),t.isReady()||(t._logger.debug("Provided player is already ready. Making proxy player ready."),t._signalReady())}if(e.syncVolume&&(r.setVolume(t.getVolume(),t.getMuted()),t._instanceLock!==n))return;var i=t.getSeekState();if(e.syncPosition){t._logger.debug("Seeking to match position.");var a=t.getPosition();r.getPosition()!==a?r.seek(a):(t._logger.debug("Skipping seek because already at same position."),t.isReady()&&i&&"IN_PROGRESS"===i.state&&t._signalSeekComplete())}else if(i&&"IN_PROGRESS"===i.state){t._logger.debug("Seeking to match position because a seek has been queued.");var u=t._seekConfig;t._seekConfig=void 0,r.seek(t.getPosition(),u)}else{var l=r.getSeekState();l&&"IN_PROGRESS"===l.state&&(t._logger.debug("Seeking on proxy to match seek that is in progress on provided player."),t.seek(l.position))}if(t._instanceLock!==n)return;if(r.isActuallyPlaying()?(t._logger.debug("Provided player is already playing."),t.isActuallyPlaying()||(t._notifyPlaying(!0),r.isFading()&&t._notifyFading(!0))):r.isPlaying()?(t._logger.debug("Provided player is preparing to play."),t.play()):t.isPlaying()?(t._logger.debug("Calling play() on provided player to match proxy."),t._playAndHandleAbort(r)):t.isReady()&&t.isActuallyPlaying()&&(t._logger.debug("Switching to paused state, as provided player and proxy intended state is paused."),t._notifyPlaying(!1)),t._instanceLock!==n)return;t._synced=!0,t._notifyVolumeChange(r.getVolume(),r.getMuted())}catch(e){t._triggerError(new s.PlayerFatalError("Unexpected error occurred whilst syncing.",e))}})},t.prototype._playAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling play() on provided player.");var r=this._playConfig;this._playConfig=this._pauseConfig=void 0,e.play(r),this._instanceLock===t&&!e.isPlaying()&&this.isPlaying()&&(this._logger.debug("Provided player was not playing after play() call completed."),this.isActuallyPlaying()?(this._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),this._notifyPlaying(!1)):this.pause())},t.prototype._pauseAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling pause() on provided player.");var r=this._pauseConfig;this._playConfig=this._pauseConfig=void 0,e.pause(r),this._instanceLock===t&&e.isPlaying()&&!this.isPlaying()&&(this._logger.debug("Provided player was not paused after pause() call completed."),this.play())},t.prototype._unsync=function(){if(this._logger.debug("Unsyncing..."),this._changeHandler&&(this._changeHandler.remove(),this._changeHandler=null),this._errorHandler&&(this._errorHandler.remove(),this._errorHandler=null),!this._synced)return void this._logger.debug("Unsynced. (Sync never completed)");this._synced=!1,this._unsyncInProgress=!0;var e=this._player;if(e)try{this._lastPlayerPosition=e.getPosition()}catch(e){this._logger.error("Error whilst unsyncing.",e)}this._unsyncInProgress=!1,this._logger.debug("Unsynced.",this.isPlaying(),this.isActuallyPlaying())},t}(i.BasePlayer);t.ProxyPlayerBase=p},function(e,t,r){"use strict";function n(){return f}function o(){return y}function i(){return g}function a(){return h}function s(){return _}function u(){return d(v)}function l(){return d(m)}function c(){return d(E)}function d(e){var t=navigator.userAgent.match(e);if(t&&t.length>=3){var r=parseInt(t[1],10),n=parseInt(t[2],10);if(!isNaN(r)&&!isNaN(n))return{major:r,minor:n}}return null}Object.defineProperty(t,"__esModule",{value:!0});var p="undefined"!=typeof navigator?navigator.userAgent:"",f=!/chrome|opera/i.test(p)&&/safari/i.test(p),h=p.indexOf("MSIE ")>=0||p.indexOf("Trident/")>=0,_=p.indexOf("Edge/")>=0,g=/Chrom(?:e|ium)/.test(p),y=p.toLowerCase().indexOf("firefox")>=0,v=/version\/(\d+)\.(\d+)/i,m=/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)/,E=/Firefox\/(\d+)\.(\d+)/;t.isSafari=n,t.isFirefox=o,t.isChrome=i,t.isIE=a,t.isEdge=s,t.getSafariVersion=u,t.getChromeVersion=l,t.getFirefoxVersion=c},function(e,t,r){"use strict";function n(e,t){var r=t.convertResult,n=t.convertProgressUpdate,o=t.abortableJobOpts,a=t.passThroughAbort,s=void 0===a||a;return new l(function(){var t=e(),o=new u.EventDispatcher,a=!0,l=i.buildDeferred();return n&&t.onProgressUpdate(function(e){o.dispatch(n(e,a)),a=!1},{skipPast:!0}),t.onCompletion(function(e){try{l.resolve(r(e))}catch(e){l.reject(e)}}),t.onError(l.reject),{result:l.promise,progressUpdates:n?{onProgressUpdate:o,getProgressSoFar:function(){var e=t.getProgressSoFar();if(e){var r=n(e,a);return a=!1,r}return null}}:void 0,abort:function(){return s&&t.abort()}}},o)}Object.defineProperty(t,"__esModule",{value:!0});var o=r(8),i=r(13),a=r(18),s=r(3),u=r(6);t.abortedError=new Error("Job aborted."),t.map=n;var l=function(){function e(e,t){void 0===t&&(t={}),this._job=e,this._opts=t,this._counter=0,this._jobControl=null,this._promise=null,this._jobCompleted=!1}return e.prototype.run=function(){var e,r=this;if(this._jobControl)e=this._jobControl;else{try{e=this._jobControl=this._job()}catch(t){e=this._jobControl={result:o.Promise.reject(t)}}this._promise=e.result,a.always(this._promise,function(){r._jobCompleted=!0,r._opts.storeResult||(r._jobCompleted=!1,r._promise=null,r._jobControl=null)})}var n=this._promise;this._counter++;var u=i.buildDeferred(),l=!1,c=!1,d=void 0,p=!1,f=[],h=[],_=[],g=function(){p||(l=!0,r._counter--),f.forEach(function(e){return e.remove()})};return a.always(n,g),n.then(function(e){p||(d=e,h.forEach(function(t){return s.deferException(function(){return t(e)})}),h.splice(0),u.resolve(e))},function(e){p||(c=!0,d=e,_.forEach(function(t){return t(e)}),_.splice(0),u.reject(e))}),{whenComplete:function(){return u.promise},onProgressUpdate:function(t,r){if(void 0===r&&(r={}),e.progressUpdates){if(!p&&!l){var n=e.progressUpdates.onProgressUpdate.subscribe(function(e){return t(e)});f.push(n)}if(!r.skipPast){var o=e.progressUpdates.getProgressSoFar();o&&t(o)}}},getProgressSoFar:function(){return e.progressUpdates?e.progressUpdates.getProgressSoFar():null},onCompletion:function(e){l?!c&&s.deferException(function(){return e(d)}):h.push(e)},onError:function(e){p?s.deferException(function(){return e(t.abortedError)}):l?c&&s.deferException(function(){return e(d)}):_.push(e)},hasCompleted:function(){return l},hasErrored:function(){return c},isAborted:function(){return p},abort:function(){p||l||(p=!0,f.forEach(function(e){return e.remove()}),0===--r._counter&&!r._jobCompleted&&r._jobControl&&r._jobControl.abort&&(r._jobControl.abort(),r._promise=null,r._jobControl=null),_.forEach(function(e){return s.deferException(function(){return e(t.abortedError)})}),u.reject(t.abortedError))}}},e}();t.AbortableJob=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){if(this.start=e,this.duration=t,t<0)throw new RangeError("Duration must be >= 0.");this.end=e+t}return e.normalizeRawTimeRanges=function(e){return e.slice(0).sort(function(e,t){return e.start-t.start}).reduce(function(e,t,r){var n=e.length-1;return r>0&&e[n].end>=t.start?e[n].end=t.end:e.push(t),e},[])},e.normalize=function(t){return e.normalizeRawTimeRanges(t.map(function(e){return{start:e.start,end:e.end}})).map(function(t){return new e(t.start,t.end-t.start)})},e.getCoverage=function(t){if(0===t.length)return new e(0,0);var r=1/0,n=0;return t.forEach(function(e){e.startn&&(n=e.end)}),new e(r,n-r)},e.rangesContainTime=function(e,t){return t.some(function(t){return t.containsTime(e)})},e.prototype.containsTime=function(e){return this.start<=e&&this.end>e},e}();t.TimeRange=n},function(e,t,r){"use strict";e.exports=function(){return"function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)}()},function(e,t,r){"use strict";var n=r(10),o=r(1),i=r(9),a=r(21),s=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;e.exports=function(e,t){var r,c,d,p,f,h,_,g,y=arguments[2];if(s(e)||n(e)?r="array":i(e)?r="string":e=a(e),o(t),d=function(){p=!0},"array"===r)return void l.call(e,function(e){return u.call(t,y,e,d),p});if("string"!==r)for(c=e.next();!c.done;){if(u.call(t,y,c.value,d),p)return;c=e.next()}else for(h=e.length,f=0;f=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";var n=r(10),o=r(4),i=r(9),a=r(2).iterator,s=Array.isArray;e.exports=function(e){return!!o(e)&&(!!s(e)||(!!i(e)||(!!n(e)||"function"==typeof e[a])))}},function(e,t,r){"use strict";var n=r(41);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not iterable");return e}},function(e,t,r){"use strict";var n,o=r(15),i=r(7),a=r(2),s=r(20),u=Object.defineProperty;n=e.exports=function(e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");e=String(e),s.call(this,e),u(this,"__length__",i("",e.length))},o&&o(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i(function(){if(this.__list__)return this.__nextIndex__=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n=r(1),o=r(0),i=Function.prototype.bind,a=Function.prototype.call,s=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,l){var c,d=arguments[2],p=arguments[3];return r=Object(o(r)),n(l),c=s(r),p&&c.sort("function"==typeof p?i.call(p,r):void 0),"function"!=typeof e&&(e=c[e]),a.call(e,c,function(e,n){return u.call(r,e)?a.call(l,d,r[e],e,r,n):t})}}},function(e,t,r){"use strict";e.exports=r(44)("forEach")},function(e,t,r){"use strict";var n=r(1),o=r(45),i=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),o(e,function(e,n,o,s){r[n]=i.call(t,a,e,n,o,s)}),r}},function(e,t,r){"use strict";e.exports=function(e){return e=Number(e),isNaN(e)||0===e?e:e>0?1:-1}},function(e,t,r){"use strict";e.exports=function(){var e=Math.sign;return"function"==typeof e&&(1===e(10)&&e(-20)===-1)}},function(e,t,r){"use strict";e.exports=r(48)()?Math.sign:r(47)},function(e,t,r){"use strict";var n=r(49),o=Math.abs,i=Math.floor;e.exports=function(e){return isNaN(e)?0:(e=Number(e),0!==e&&isFinite(e)?n(e)*i(o(e)):e)}},function(e,t,r){"use strict";var n=r(50),o=Math.max;e.exports=function(e){return o(0,n(e))}},function(e,t,r){"use strict";var n=Object.prototype.toString,o=n.call(r(24));e.exports=function(e){return"function"==typeof e&&n.call(e)===o}},function(e,t,r){"use strict";var n=r(2).iterator,o=r(10),i=r(52),a=r(51),s=r(1),u=r(0),l=r(4),c=r(9),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,P=arguments[1],S=arguments[2];if(e=Object(u(e)),l(P)&&s(P),this&&this!==Array&&i(this))t=this;else{if(!P){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r=55296&&v<=56319&&(w+=e[++r])),w=P?p.call(P,S,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r-1}},function(e,t,r){"use strict";var n="razdwatrzy";e.exports=function(){return"function"==typeof n.contains&&(n.contains("dwa")===!0&&n.contains("foo")===!1)}},function(e,t,r){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,r){"use strict";var n=r(4),o=Object.keys;e.exports=function(e){return o(n(e)?Object(e):e)}},function(e,t,r){"use strict";e.exports=function(){try{return Object.keys("primitive"),!0}catch(e){return!1}}},function(e,t,r){"use strict";e.exports=r(68)()?Object.keys:r(67)},function(e,t,r){"use strict";var n=r(69),o=r(0),i=Math.max;e.exports=function(e,t){var r,a,s,u=i(arguments.length,2);for(e=Object(o(e)),s=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},a=1;a>>=8;return n}function s(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: "+e);var t;for(t=1;t<=8&&!(e 0.");if(i<=0)throw new Error("Threshold must be > 0.");if(null!==s&&s<=0)throw new Error("Delay cap must be null or > 0.");if(null!==d&&d<1)throw new Error("Max attempts must be >= 1.");return function(e){if(null!==d&&e>=d)return null;var t=e>0?Math.pow(2,e/i-1):0;return Math.min(t*n,s||1/0)+Math.round(Math.random()*l)}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(3);t.retry=n,t.buildExponentialDelayCalculator=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(13),i=r(37),a=r(85),s=r(30),u=r(17),l=r(84),c=r(19),d=r(8),p=r(83),f=r(18),h=r(82),_=r(81),g=r(3),y=r(36),v=r(80),m=r(78);!function(e){e.OnExit=s.OnExit,e.find=u.find,e.Promise=d.Promise,e.promiseWithTimeout=p.promiseWithTimeout,e.always=f.always,e.compact=h.compact,e.deferException=g.deferException,e.SCWeakMap=m.SCWeakMap;var t;!function(e){e.buildCache=l.buildCache}(t=e.cache||(e.cache={}));var r;!function(e){e.buildDeferred=o.buildDeferred}(r=e.deferred||(e.deferred={}));var n;!function(e){e.getExtension=v.getExtension,e.buildAbsoluteUrl=v.buildAbsoluteUrl}(n=e.url||(e.url={}));var E;!function(e){e.AbortableJob=i.AbortableJob,e.map=i.map,e.abortedError=i.abortedError}(E=e.abortableJob||(e.abortableJob={}));var b;!function(e){e.retry=a.retry,e.buildExponentialDelayCalculator=a.buildExponentialDelayCalculator}(b=e.retry||(e.retry={}));var w;!function(e){e.isSafari=y.isSafari,e.getSafariVersion=y.getSafariVersion,e.isIE=y.isIE,e.isEdge=y.isEdge,e.isFirefox=y.isFirefox,e.isChrome=y.isChrome,e.getChromeVersion=y.getChromeVersion,e.getFirefoxVersion=y.getFirefoxVersion}(w=e.browser||(e.browser={}));var P;!function(e){e.combine=_.combine,e.fill=_.fill,e.forEach=_.forEach,e.numberToUint8Array=_.numberToUint8Array,e.createVintBuffer=_.createVintBuffer}(P=e.arrayBuffer||(e.arrayBuffer={}));var S;!function(e){e.now=c.now}(S=e.time||(e.time={}))}(n=t.helpers||(t.helpers={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._msg=e,this._cause=t}return e.prototype.getMsg=function(){return this._msg},e.prototype.getCause=function(){return this._cause},e}();t.LoaderError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(87);!function(e){e.LoaderError=o.LoaderError}(n=t.loaderErrors||(t.loaderErrors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t||"The URL update failed for some reason.",r)||this}return n(t,e),t.prototype.getCode=function(){return"URL_UPDATE_ERROR"},t}(o.PlayerFatalError);t.URLUpdateError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(33),i=r(89),a=r(29),s=r(16),u=r(11),l=r(5);!function(e){e.PlayerError=u.PlayerError,e.PlayerFatalError=l.PlayerFatalError,e.NotSupportedError=o.NotSupportedError,e.URLUpdateError=i.URLUpdateError,e.ImplementationError=a.ImplementationError,e.ProxyProvidedPlayerFatalError=s.ProxyProvidedPlayerFatalError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),i=r(12),a=r(35),s=r(16),u=function(e){function t(t){var r=e.call(this,t)||this;return r._onPlayerProvided=new o.EventDispatcher,r._onPlayerRemoved=new o.EventDispatcher,r._shouldPassThroughFatalErrors=!!t.shouldPassThroughFatalErrors,r.onPlayerProvided=r._onPlayerProvided.getHandle(),r.onPlayerRemoved=r._onPlayerRemoved.getHandle(),r._logger=i.prefixLogger(r._logger,"ProxyPlayer"),r}return n(t,e),t.prototype.providePlayer=function(e,t){void 0===t&&(t={}),this._providePlayer(e,t),this._onPlayerProvided.dispatch(e)},t.prototype.removePlayer=function(){var e=this._getPlayer();if(!e)throw new Error("There is no player to remove.");this._removePlayer(),this._onPlayerRemoved.dispatch(e)},t.prototype.setInitialDuration=function(e){this._setInitialDuration(e)},t.prototype.getPlayer=function(){return this._getPlayer()},t.prototype._handleFatalError=function(e,t){this._shouldPassThroughFatalErrors?this._triggerError(e):this._triggerError(new s.ProxyProvidedPlayerFatalError(e,t))},t}(a.ProxyPlayerBase);t.ProxyPlayer=u},function(e,t){},function(e,t){var r;r=function(){return this}();try{r=r||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(d===clearTimeout)return clearTimeout(e);if((d===n||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(e);try{return d(e)}catch(t){try{return d.call(null,e)}catch(t){return d.call(this,e)}}}function a(){_&&f&&(_=!1,f.length?h=f.concat(h):g=-1,h.length&&s())}function s(){if(!_){var e=o(a);_=!0;for(var t=h.length;t;){for(f=h,h=[];++g1)for(var r=1;r0?Math.pow(2,s):0},e.prototype.registerSuccess=function(){this._delayFactor=Math.max(0,this._delayFactor-2)},e}();t.DecayingExponentialDelayCalculator=n},function(e,t,r){"use strict";function n(){switch(window.document.hidden){case!0:return"background";case!1:return"foreground";default:return}}Object.defineProperty(t,"__esModule",{value:!0}),t.getAppState=n},function(e,t,r){"use strict";e.exports=r(63)()?Object.assign:r(64)},function(e,t,r){"use strict";var n,o=r(18),i=r(13),a=r(2),s=r(1),u=r(4),l=r(80),c=r(3),d=Object.defineProperty,p=Object.defineProperties;e.exports=n=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");p(this,{__list__:u("w",s(e)),__context__:u("w",t),__nextIndex__:u("w",0)}),t&&(a(t.on),t.on("_add",this._onAdd),t.on("_delete",this._onDelete),t.on("_clear",this._onClear))},delete n.prototype.constructor,p(n.prototype,i({_next:u(function(){var e;if(this.__list__)return this.__redo__&&(e=this.__redo__.shift(),void 0!==e)?e:this.__nextIndex__=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";function n(e){return new i({startPos:0,endPos:e,startLevel:0,endLevel:1,fromEnd:!1})}function o(e){return new i({startPos:e,endPos:0,startLevel:1,endLevel:0,fromEnd:!0})}Object.defineProperty(t,"__esModule",{value:!0}),t.buildFadeIn=n,t.buildFadeOut=o;var i=function(){function e(e){var t=e.startPos,r=e.endPos,n=e.startLevel,o=e.endLevel,i=e.fromEnd,a=void 0!==i&&i;if(t<0)throw new Error("startPos invalid.");if(r<0||!a&&r1)throw new Error("startLevel invalid.");if(o<0||o>1)throw new Error("endLevel invalid.");this._startPos=t,this._endPos=r,this._startLevel=n,this._endLevel=o,this._fromEnd=a}return e.prototype.calculate=function(e,t){var r=this._fromEnd?t-500-this._startPos:this._startPos,n=this._fromEnd?t-500-this._endPos:this._endPos;if(e=0&&t._jobs.splice(e,1)}}},e.prototype._executeNextJob=function(){var e=this;if(!this._jobWaiting){var t=this._jobs.shift();if(t){var r=function(){e._jobWaiting=!1,e._executeNextJob()},n=this._calculator.getDelay();this._jobWaiting=!0,o.helpers.deferException(function(){t.job().then(function(){e._calculator.registerSuccess()})}),0===n?r():window.setTimeout(r,n)}}},e}();t.Limiter=i},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}function o(e){if("number"!=typeof e)throw new Error("level must be a number.");if(e<0||e>1)throw new Error("Invalid volume level.");L=e,N.forEach(function(t){return t.setVolume(e)})}function i(){return L}function a(e){if("boolean"!=typeof e)throw new Error("muteEnabled must be a boolean.");j=e,N.forEach(function(t){return t.setMuted(e)})}function s(){return j}function u(e){if("number"!=typeof e||e<0)throw new Error("Invalid size.");D.setCacheSize(e)}var l=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var c=r(0),d=r(15),p=r(43),f=r(44),h=r(47),_=r(11),g=r(48),y=r(49),v=r(94),m=r(95),E=r(9),b=r(26),w=r(96),S=r(97),P=r(98),R=r(27),O=r(10),A=3e3,T=c.eventDispatcher.EventDispatcher,M=c.helpers.Promise,x=c.helpers.deferred.buildDeferred,D=new v.CacheManager(15e7,c.logger.noOpLogger),I=100,k=5e3,C=-1,N=[],L=1,j=!1;t.setGlobalVolume=o,t.getGlobalVolume=i,t.setGlobalMuted=a,t.getGlobalMuted=s,t.setCacheSize=u;var F=function(e){function t(t){var r=e.call(this,t)||this;r._onPreloadingEnabled=new T,r._onPreloadingDisabled=new T,r._retryDelayCalculator=new _.DecayingExponentialDelayCalculator,r._errorEventGenerator=null,r._fadeOutVolumeAutomator=null,r._volumeAutomators=[],r._volumeScale=1,r._userVolume=1,r._volumeAutomationSupported=!1,r._timer=null,r._pauseFadeTimer=null,r._pauseFadeDeferred=null,r._pauseFade=null,r._executionState={state:"IDLE"},r._preloadingListeners=[],r._retrieveAndBuildTimer=null,r._hadAStreamUrl=!1;var n=r._config=w.validatePlayerDependencies(t);r._preloadingEnabled=n.preloadingEnabled,r._getURLOpts=n.getURLOpts,r._controllers=n.controllers;var o=r._connectionRequiredHelper=new P.ConnectionRequiredHelper(r);r.onPreloadingEnabled=r._onPreloadingEnabled.getHandle(),r.onPreloadingDisabled=r._onPreloadingDisabled.getHandle(),r.onConnectionRequired=o.onConnectionRequired,r.onConnectionRecovered=o.onConnectionRecovered,r.onChange.subscribe(function(e){r.isDead()||((e.playing===!1||e.positionJumped||e.stalled||e.ended)&&r._completePauseFade(),r._pauseFade&&(e.actuallyPlaying===!1||e.ended||e.playing===!0)&&(r._removeVolumeAutomator(r._pauseFade),r._pauseFade=null),(e.positionJumped||void 0!==e.actuallyPlaying||void 0!==e.stalled)&&r._updateVolume(),void 0!==e.playing&&r._updateMaxBufferLength())});var i="SCAudio-"+ ++C,a=n.streamUrlRetriever.getTrackId();null!==a&&(i+="-"+a);var s=new p.LogCollector,u=c.logger.cloneLogger(s,r._logger);r._logger=c.logger.prefixLogger(u,i);var l=S.generateLogId();r._logger.info("Building player...",{ua:navigator.userAgent,getURLOpts:r._getURLOpts,logId:l}),N.push(r),r.setVolume(L,j),r._updateFadeOut();var d=null,v=null;n.audioPerformanceReporter&&(d=new f.AudioPerformanceEventGenerator(r,function(){return r._getPlayer()},n.audioPerformanceReporter,r._logger,function(){return r._getActivePlayerDetails()})),n.audioReporter&&new g.AudioEventGenerator(r,n.audioReporter,n.audioCheckpointInterval,r._logger,function(){return r._getActivePlayerDetails()}),n.errorReporter&&(v=r._errorEventGenerator=new h.ErrorEventGenerator(r,s,l,a,n.errorReporter,r._logger)),r._excludeUnsupportedRenditions();var m=r._controllerManager=new y.ControllerManager({logger:r._logger,controllers:n.controllers,playerId:i,streamUrlsExpire:n.streamUrlsExpire,fetchEnabled:n.fetchEnabled,fadeOnPauseAndPlay:n.fadeOnPauseAndPlay,fadeOnSeek:n.fadeOnSeek,cacheManager:D,providePlayer:function(e,t,n){r._volumeAutomationSupported=n,r._providePlayer(e,t),r._updateMaxBufferLength()},removePlayer:function(){r._getPlayer()&&r._removePlayer()},streamUrlRetriever:r._config.streamUrlRetriever,getURLOpts:r._getURLOpts,errorEventGenerator:v||void 0,audioPerformanceEventGenerator:d||void 0});if(r.onQualityChanged=m.onQualityChanged,void 0!==n.duration&&(r._logger.debug("Setting initial duration.",n.duration),r._setInitialDuration(n.duration)),r._preloadingEnabled)r._logger.debug("Preloading is enabled, so performing retrieve immediately."),r._retrieveAndBuild();else{r._logger.debug("Preloading is disabled, so deferring retrieve until either a play intent or preloading is enabled.");var E=function(){r._removePreloadingListeners(),r._logger.debug("Preloading now enabled or received a play request. Peforming retrieve."),r._retrieveAndBuild()};r._preloadingListeners.push(r.onPreloadingEnabled.subscribe(E),r.onPlayIntent.subscribe(E))}return r}return l(t,e),t.prototype.reload=function(e){void 0===e&&(e={}),this._ensureNotDead(),this._reloadStreamUrls(e)},t.prototype.enablePreloading=function(){this.isDead()||this._preloadingEnabled||(this._preloadingEnabled=!0,this._updateMaxBufferLength(),this._onPreloadingEnabled.dispatch(void 0))},t.prototype.disablePreloading=function(){this.isDead()||this._preloadingEnabled&&(this._preloadingEnabled=!1,this._updateMaxBufferLength(),this._onPreloadingDisabled.dispatch(void 0))},t.prototype.isPreloadingEnabled=function(){return this._preloadingEnabled},t.prototype.pauseAfterFade=function(e){var t=this;if(this._ensureNotDead(),this._pauseFadeDeferred)return this._pauseFadeDeferred.promise;if(!this.isPlaying()||!this.isActuallyPlaying())return M.resolve(this.pause());var r=x();this._pauseFadeDeferred=r;var n=this.getPosition();if(this._pauseFade)throw new Error("Fade should not already be assigned.");return this._pauseFade=new d.Fade({startPos:n,endPos:n+e,startLevel:1,endLevel:0}),this._addVolumeAutomator(this._pauseFade),this._pauseFadeTimer=window.setTimeout(function(){t._pauseFadeDeferred=null,r.resolve(t.pause({fadeDuration:0}))},e+50),r.promise},t.prototype.isConnectionRequired=function(){return this._connectionRequiredHelper.isConnectionRequired()},t.prototype.getQuality=function(){return this._controllerManager.getQuality()},t.prototype.getVolume=function(){return this._volumeAutomationSupported?this._userVolume:e.prototype.getVolume.call(this)},t.prototype._handleFatalError=function(e){this._logger.warn("Fatal error from current player.",e)},t.prototype._handleVolumeChange=function(t,r){this._userVolume=t,e.prototype._notifyVolumeChange.call(this,t,r),this._calculateAndSetVolume()},t.prototype._notifyVolumeChange=function(){},t.prototype._kill=function(){e.prototype._kill.call(this),this._timer&&window.clearTimeout(this._timer),this._abortPauseFade(),this._removePreloadingListeners(),N.splice(N.indexOf(this),1),"RETRIEVING_URL"===this._executionState.state?this._executionState.retrieveJob.abort():"CONTROLLING_PLAYER"===this._executionState.state&&this._controllerManager.releaseCurrentController({retry:!1}),this._executionState={state:"DEAD"},this._retrieveAndBuildTimer&&window.clearTimeout(this._retrieveAndBuildTimer)},t.prototype._excludeUnsupportedRenditions=function(){var e=this,t={streamUrlExpires:this._config.streamUrlsExpire},r=O.allRenditions.filter(function(r){return!e._controllers.some(function(e){return e.isRenditionSupported(r,t)})});r.forEach(function(t){e._config.streamUrlRetriever.excludeRendition(t)})},t.prototype._addVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t<0&&(this._volumeAutomators.push(e),this._updateVolume())},t.prototype._removeVolumeAutomator=function(e){var t=this._volumeAutomators.indexOf(e);t>=0&&(this._volumeAutomators.splice(t,1),this._updateVolume())},t.prototype._removePreloadingListeners=function(){this._preloadingListeners.forEach(function(e){return e.remove()})},t.prototype._getActivePlayerDetails=function(){return"CONTROLLING_PLAYER"!==this._executionState.state?null:this._controllerManager.getPlayerDetails()},t.prototype._updateFadeOut=function(){this._fadeOutVolumeAutomator&&this._removeVolumeAutomator(this._fadeOutVolumeAutomator),this._getURLOpts.snippet&&(this._fadeOutVolumeAutomator=d.buildFadeOut(A),this._addVolumeAutomator(this._fadeOutVolumeAutomator))},t.prototype._handleUnexpectedError=function(e){try{e()}catch(e){this._logger.error("Unexpected error.",e),this._triggerError(new c.errors.PlayerFatalError("An unexpected error occurred.",e))}},t.prototype._retrieveAndBuild=function(){var e=this;this._handleUnexpectedError(function(){if(["IDLE","WAITING_TO_RETRIEVE"].indexOf(e._executionState.state)===-1)throw new Error("Invalid state for retrieveAndBuild().");e._logger.debug("Retrieving URL...");var t=m.retrieveUrl({streamUrlRetriever:e._config.streamUrlRetriever,urlProviderRetryDelayCalculator:e._config.urlProviderRetryDelayCalculator,getURLOpts:e._getURLOpts,logger:e._logger});e._executionState={state:"RETRIEVING_URL",retrieveJob:t},t.onCompletion(function(t){if(e._logger.debug("Retrieved URL.",!!t),t&&t.success){e._hadAStreamUrl=!0;var r=!1,n=function(n){var o=n.excludeRendition,i=n.immediateRetry;e._handleUnexpectedError(function(){if(r)throw new Error("startOver called multiple times.");if(r=!0,o&&e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e.isDead())return void e._logger.debug("Stopping execution because player is dead.");if(i)e._logger.debug("Moving on immediately."),e._retrieveAndBuild();else{var n=e._retryDelayCalculator.getDelay();e._logger.debug("Will move on in "+n+"ms."),n?e._retrieveAndBuildTimer=window.setTimeout(function(){return e._retrieveAndBuild()},n):e._retrieveAndBuild()}})};e._handleUnexpectedError(function(){e._executionState={state:"CONTROLLING_PLAYER"},e._logger.debug("Building controller..."),e._controllerManager.buildNextController(t,n),e._logger.debug("Built controller.")})}else if(t&&t.rendition){if(e._logger.warn("Error retrieving URL. Moving on.",t.error),e._errorEventGenerator){var o="SCAUDIO.URL_RETRIEVER_ERROR."+e._config.streamUrlRetriever.name+"."+t.error.getCode();e._errorEventGenerator.reportManualEvent(o,{preset:t.preset,quality:t.quality,bitrate:t.bitrate,format:t.rendition.scFormat,protocol:t.rendition.scProtocol})}e._config.streamUrlRetriever.excludeRendition(t.rendition),e._executionState={state:"WAITING_TO_RETRIEVE"},e._retrieveAndBuild()}else t&&t.rendition&&e._logger.warn("Error retrieving URL for any rendition.",t.error),e._logger.info("Ran out of streams.",e._hadAStreamUrl),e._triggerError(e._hadAStreamUrl?new E.NotSupportedError:new b.NoStreamsError)}),t.onError(function(t){t!==c.helpers.abortableJob.abortedError&&(t===m.NoMoreAttemptsError?e._logger.error("Ran out of retries to retrieve URL."):e._logger.error("Unexpected error when retrieving a URL.",t),e._triggerError(new R.FailedRetrievingUrlError))})})},t.prototype._reloadStreamUrls=function(e){this._getURLOpts=e,this._updateFadeOut(),this._logger.info("Reloading stream URL's...",this._getURLOpts),"RETRIEVING_URL"===this._executionState.state?(this._logger.debug("Aborting current URL retrieve."),this._executionState.retrieveJob.abort(),this._executionState={state:"WAITING_TO_RETRIEVE"},this._retrieveAndBuild()):"CONTROLLING_PLAYER"===this._executionState.state?(this._logger.debug("Releasing controller."),this._controllerManager.releaseCurrentController({retry:!0})):this._logger.debug("Nothing to do."),this._logger.info("Reloaded stream URL's.")},t.prototype._completePauseFade=function(){if(this._pauseFadeDeferred){this._pauseFadeTimer&&window.clearTimeout(this._pauseFadeTimer);var e=this._pauseFadeDeferred;this._pauseFadeDeferred=null,e.resolve(this.pause())}},t.prototype._abortPauseFade=function(){this._pauseFadeTimer&&(window.clearTimeout(this._pauseFadeTimer),this._pauseFadeTimer=null),this._pauseFadeDeferred&&(this._pauseFadeDeferred.reject(new Error("Player was killed.")),this._pauseFadeDeferred=null)},t.prototype._updateVolume=function(){var e=this;if(this._volumeAutomationSupported){this._ensureNotDead(),this._timer&&(window.clearTimeout(this._timer),this._timer=null);var t=this.getDuration();if(null!==t){var r=this._volumeAutomators,o=this.getPosition(),i=1/0,a=1;r.forEach(function(e){var r=e.calculate(o,t),s=r.nextCalculatePosition,u=r.level;a*=n(0,1,u),s"}})}var o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;rthis._bufferSize&&this._log.shift()},e}();t.LogCollector=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(45),i=r(46),a=r(12),s=3e4,u=1e3,l=function(){function e(e,t,r,o,i){this._logger=n.logger.prefixLogger(o,"AudioPerformanceEventGenerator"),this._proxy=e,this._getPlayer=t,this._eventReporter=r,this._getPlayerDetails=i,this._measureGeneralEvents()}return e.prototype.reportManualEvent=function(e){this._logger.debug("Reporting manual audio performance event.",e),this._eventReporter(e)},e.prototype._measureGeneralEvents=function(){var e=this,t=this._proxy,r=null,n=null,a=null,l=null,c=null,d=null,p=null,f=!0;t.onChange.subscribe(function(h){var _=h.playing,g=h.actuallyPlaying,y=h.seek,v=h.seeking,m=h.stalled,E=h.ended,b=h.dead;if(b!==!0&&_!==!1||!l||(l.stop(),l.getTime()>=u&&e._reportEvent("rageSkip",l.getTime(),null),l=null),t.isDead())return void(p&&window.clearTimeout(p));var w=t.getSeekState();t.isActuallyPlaying()||l||!(_===!0||t.isPlaying()&&m===!0)||(l=new o.Timer,l.start()),_===!0&&(r||(r=new o.Timer,r.start(),n=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),p=window.setTimeout(function(){e._reportEvent("longInitialBuffering",0,null)},s),0===t.getPosition()&&(f=!1))),_===!1&&(p&&window.clearTimeout(p),r&&!r.isComplete()&&(r=null)),g===!0&&(l=null,r&&!r.isComplete()&&(r.stop(),p&&window.clearTimeout(p),e._reportEvent("play",r.getTime(),n.getPreloaded()))),y&&"IN_PROGRESS"===y.state&&t.isReady()&&(a=new o.Timer,a.start(),c=new i.PreloadingCalculator({proxy:t,getPlayer:e._getPlayer}),v===!0&&e._reportEvent("seekStart",0,null)),(y&&"COMPLETED"===y.state&&!t.isStalled()||m===!1&&w&&"COMPLETED"===w.state)&&a&&(a.stop(),e._reportEvent("seek",a.getTime(),c.getPreloaded()),a=null),m!==!0||!t.isPlaying()||w&&"IN_PROGRESS"===w.state||r&&r.isComplete()&&(d=new o.Timer,d.start(),e._reportEvent("rebufferingStart",t.getPosition(),null)),m===!1&&(r&&r.isComplete()&&(l=null),d&&(d.stop(),e._reportEvent("rebufferingEnd",d.getTime(),null), +d=null)),E!==!0||f||(e._reportEvent("uninterruptedPlay",0,null),f=!0);var S=w&&"IN_PROGRESS"===w.state;!S&&m===!0&&t.isActuallyPlaying()&&(f=!0)})},e.prototype._reportEvent=function(e,t,r){var n=this._getPlayerDetails();if(!n)return void this._logger.warn("Cannot report event because there is no player.",e,t);var o={type:e,latency:t,protocol:n.protocol,playerType:n.name,host:n.host,bitrate:n.bitrate,format:n.format,preset:n.preset,quality:n.quality,preloaded:r||void 0,appState:a.getAppState()};this._logger.debug("Generated audio performance event.",o),this._eventReporter(o)},e}();t.AudioPerformanceEventGenerator=l},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.helpers.time.now,i=function(){function e(){this._start=null,this._end=null}return e.prototype.start=function(){if(this.isComplete())throw new Error("Timer completed.");this._start=o()},e.prototype.isComplete=function(){return null!==this._end},e.prototype.stop=function(){if(null===this._start)throw new Error("Not started.");this._end=o()},e.prototype.getTime=function(){if(null===this._end)throw new Error("Not completed.");return this._end-this._start},e}();t.Timer=i},function(e,t,r){"use strict";function n(e,t){var r=e.getBufferedTimeRanges();return r?a(r,function(e){return e.containsTime(t)})||new o.TimeRange(t,0):null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=2e3,a=o.helpers.find,s=function(){function e(e){var t=e.proxy,r=e.getPlayer;this._getPlayer=r;var o=t.getPosition(),i=this._initialActualPlayer=r();if(i){var a=n(i,o);a?this._initialBuffered=a.end-o:this._initialBuffered=null}else this._initialBuffered=null}return e.prototype.getPreloaded=function(){var e=this._initialBuffered;return null!==e&&this._initialActualPlayer&&this._getPlayer()===this._initialActualPlayer?0===e?"no":e>=i?"yes":"partial":null},e}();t.PreloadingCalculator=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=function(){function e(e,t,r,o,i,a){this._logger=n.logger.prefixLogger(a,"ErrorGenerator"),this._player=e,this._logCollector=t,this._logId=r,this._trackId=o,this._eventReporter=i,this._listenForProxyFatalError()}return e.prototype.reportManualEvent=function(e,t){"NOT_SUPPORTED_ERROR"!==e&&"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"!==e&&(this._logger.debug("Reporting manual error event.",e),this._reportEvent(e,t))},e.prototype._listenForProxyFatalError=function(){var e=this;this._player.onError.subscribe(function(t){t instanceof n.errors.PlayerFatalError&&e._reportEvent(t.getCode())})},e.prototype._reportEvent=function(e,t){var r={errorCode:e,log:this._logCollector.getLog(),logId:this._logId,trackId:this._trackId,protocol:t&&t.protocol,playerType:t&&t.name?t.name:"MaestroUnknown",host:t&&t.host,bitrate:t&&t.bitrate,format:t&&t.format,preset:t&&t.preset,quality:t&&t.quality,url:t&&t.url,appState:o.getAppState()};this._logger.debug("Generated audio error event.",r),this._eventReporter(r)},e}();t.ErrorEventGenerator=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=1e3,a=function(){function e(e,t,r,o,a){this._checkpointTimer=null,this._logger=n.logger.prefixLogger(o,"AudioEventGenerator"),this._player=e,this._eventReporter=t,this._checkpointInterval=Math.max(i,r),this._getPlayerDetails=a,this._startReporting()}return e.prototype._startReporting=function(){var e=this,t=this._player;t.onChange.subscribe(function(r){var n=r.actuallyPlaying,o=r.ended;n===!0&&!t.isEnded()||o===!1&&t.isActuallyPlaying()?(e._checkpointTimer||(e._checkpointTimer=window.setInterval(function(){e._reportEvent("checkpoint")},e._checkpointInterval)),e._reportEvent("play")):(n===!1&&!t.isEnded()||o===!0&&t.isActuallyPlaying())&&(e._checkpointTimer&&(window.clearInterval(e._checkpointTimer),e._checkpointTimer=null),e._reportEvent("pause"))})},e.prototype._reportEvent=function(e){var t=this._getPlayerDetails();if(!t)return void this._logger.warn("Cannot report event because there is no player.",e);var r=this._player.getDuration();if(null===r)throw new Error("Duration should exist now.");var n={type:e,position:this._player.getPosition(),duration:r,preset:t.preset,quality:t.quality,playerType:t.name,appState:o.getAppState()};this._logger.debug("Generated audio event.",n),this._eventReporter(n)},e}();t.AudioEventGenerator=a},function(e,t,r){"use strict";function n(e){var t=e.split("//",2);return 1===t.length?t[0].split("/",1)[0]:t[1]?t[1].split("/",1)[0]:""}function o(e){var t=l.exec(e);return t&&t[0]||""}function i(e,t,r){return{name:t.name,preset:e.preset,bitrate:e.bitrate,protocol:e.rendition.scProtocol,host:n(r),url:o(r),format:e.rendition.scFormat,quality:e.quality}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(50),s=r(0),u=r(17),l=/^[^?#]*/,c=function(){function e(e){var t=e.logger,r=e.controllers,n=e.playerId,o=e.streamUrlsExpire,i=e.fetchEnabled,u=e.fadeOnPauseAndPlay,l=e.fadeOnSeek,c=e.cacheManager,d=e.providePlayer,p=e.removePlayer,f=e.streamUrlRetriever,h=e.getURLOpts,_=e.errorEventGenerator,g=e.audioPerformanceEventGenerator;this._quality=null,this._onQualityChanged=new s.eventDispatcher.EventDispatcher,this._controllerIndexByRendition=new a,this._controlledPlayerWithRendition=null,this.onQualityChanged=this._onQualityChanged.getHandle(),this._logger=s.logger.prefixLogger(t,"ControllerManager"),this._controllers=r,this._playerId=n,this._streamUrlsExpire=o,this._fetchEnabled=i,this._fadeOnPauseAndPlay=u,this._fadeOnSeek=l,this._cacheManager=c,this._providePlayer=d,this._removePlayer=p,this._streamUrlRetriever=f,this._getURLOpts=h,this._errorEventGenerator=_||null,this._audioPerformanceEventGenerator=g||null}return e.prototype.buildNextController=function(e,t){var r=this;if(this._controlledPlayerWithRendition)throw new Error("A player is already being controlled.");this._logger.debug("Building next controller.");var n=this._controllerIndexByRendition.get(e.rendition)||0;if(n>=this._controllers.length)this._logger.debug("No more controllers for this rendition."),t({excludeRendition:!0,immediateRetry:!0});else{var o=!1,i=function(i){if(o)throw new Error("performNextAction() already called");o=!0,"MOVE_ON"!==i&&"MOVE_ON_SAME_RENDITION"!==i||(r._logger.debug("Controller will not be used again."),r._controllerIndexByRendition.set(e.rendition,n+1)),"MOVE_ON_SAME_RENDITION"===i?r.buildNextController(e,t):t({excludeRendition:!1,immediateRetry:"MOVE_ON"===i})};this._manageController(e,this._controllers[n],i)}},e.prototype.releaseCurrentController=function(e){var t=e.retry;if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");this._controlledPlayerWithRendition.releaseControl({retry:t})},e.prototype.getQuality=function(){return this._quality},e.prototype.getPlayerDetails=function(){if(!this._controlledPlayerWithRendition)throw new Error("There is no player being controlled.");var e=this._controlledPlayerWithRendition,t=e.initialUrlAndRendition,r=e.controller,n=e.controlledPlayer;return i(t,r,n.getUrl())},e.prototype._manageController=function(e,t,r){var n=this,o=function(){n._removePlayer(),n._controlledPlayerWithRendition=null,a&&a.kill()};if(this._logger.debug("Preparing controller.",t.name),!t.isRenditionSupported(e.rendition,{streamUrlExpires:this._streamUrlsExpire}))return this._logger.debug("Skipping controller because rendition not supported."),void r("MOVE_ON_SAME_RENDITION");var a,l=!1,c=function(e){var t=e.retry;l||(l=!0,n._logger.debug("Releasing control."),o(),r(t?"RETRY":"MOVE_ON"))};try{this._logger.debug("Building player.");var d=t.buildPlayer({logger:s.logger.prefixLogger(this._logger,t.name+"-Controller"),playerId:this._playerId,urlAndRendition:e,streamUrlExpires:this._streamUrlsExpire,fetchEnabled:this._fetchEnabled,releaseControl:c,fadeOnPauseAndPlay:this._fadeOnPauseAndPlay,fadeOnSeek:this._fadeOnSeek,getNewUrl:function(){return n._getNewUrlWithSameRendition(e.rendition)},reportError:function(r){n._errorEventGenerator&&n._errorEventGenerator.reportManualEvent(r,i(e,t,d?d.getUrl():e.url))},reportPerformance:function(e){!l&&n._audioPerformanceEventGenerator&&n._audioPerformanceEventGenerator.reportManualEvent(e)}});if(a=d.getPlayer(),l)this._logger.warn("Player released during constrution."),a.kill();else if(a.isDead()){var p=a.getFatalError();p instanceof s.errors.NotSupportedError?this._logger.debug("Player not supported (during construction)."):this._logger.error("Error during construction.",p),r("MOVE_ON_SAME_RENDITION")}else{this._logger.debug("Player built."),a.onChange.subscribe(function(e){var t=e.dead,r=e.fatalError;t&&(r&&n._logger.error("Fatal player error occurred.",r),c({retry:!1}))}),this._cacheManager.addPlayer(a),this._controlledPlayerWithRendition={controller:t,controlledPlayer:d,initialUrlAndRendition:e,releaseControl:c},this._providePlayer(d.getPlayer(),t.syncConfig,t.supportsVolumeAutomation),this._logger.debug("Player provided to proxy.");var f=e.quality||null;this._quality!==f&&(this._logger.debug("Quality changed.",f),this._quality=f,this._onQualityChanged.dispatch(f))}}catch(e){e===u.notSupportedError?this._logger.debug("Player not supported. Not constructed."):this._logger.error("Error during construction.",e),o(),r("MOVE_ON_SAME_RENDITION")}},e.prototype._getNewUrlWithSameRendition=function(e){var t=this,r=new s.helpers.abortableJob.AbortableJob(function(){var r=t._streamUrlRetriever.getUrl(t._getURLOpts),n=r.whenComplete().then(function(t){var r=null;return t&&t.success&&t.rendition===e&&(r=t.url),r});return{result:n,abort:function(){return r.abort()}}});return r.run()},e}();t.ControllerManager=c},function(e,t,r){"use strict";e.exports=r(51)()?Map:r(52)},function(e,t,r){"use strict";e.exports=function(){var e,t,r;if("function"!=typeof Map)return!1;try{e=new Map([["raz","one"],["dwa","two"],["trzy","three"]])}catch(e){return!1}return"[object Map]"===String(e)&&(3===e.size&&("function"==typeof e.clear&&("function"==typeof e.delete&&("function"==typeof e.entries&&("function"==typeof e.forEach&&("function"==typeof e.get&&("function"==typeof e.has&&("function"==typeof e.keys&&("function"==typeof e.set&&("function"==typeof e.values&&(t=e.entries(),r=t.next(),r.done===!1&&(!!r.value&&("raz"===r.value[0]&&"one"===r.value[1])))))))))))))}},function(e,t,r){"use strict";var n,o=r(18),i=r(53),a=r(6),s=r(2),u=r(1),l=r(4),c=r(71),d=r(3),p=r(25),f=r(77),h=r(90),_=r(93),g=Function.prototype.call,y=Object.defineProperties,v=Object.getPrototypeOf;e.exports=n=function(){var e,t,r,o=arguments[0];if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");return r=_&&a&&Map!==n?a(new Map,v(this)):this,null!=o&&p(o),y(r,{__mapKeysData__:l("c",e=[]),__mapValuesData__:l("c",t=[])}),o?(f(o,function(r){var n=u(r)[0];r=r[1],i.call(e,n)===-1&&(e.push(n),t.push(r))},r),r):r},_&&(a&&a(n,Map),n.prototype=Object.create(Map.prototype,{constructor:l(n)})),c(y(n.prototype,{clear:l(function(){this.__mapKeysData__.length&&(o.call(this.__mapKeysData__),o.call(this.__mapValuesData__),this.emit("_clear"))}),delete:l(function(e){var t=i.call(this.__mapKeysData__,e);return t!==-1&&(this.__mapKeysData__.splice(t,1),this.__mapValuesData__.splice(t,1),this.emit("_delete",t,e),!0)}),entries:l(function(){return new h(this,"key+value")}),forEach:l(function(e){var t,r,n=arguments[1];for(s(e),t=this.entries(),r=t._next();void 0!==r;)g.call(e,n,this.__mapValuesData__[r],this.__mapKeysData__[r],this),r=t._next()}),get:l(function(e){var t=i.call(this.__mapKeysData__,e);if(t!==-1)return this.__mapValuesData__[t]}),has:l(function(e){return i.call(this.__mapKeysData__,e)!==-1}),keys:l(function(){return new h(this,"key")}),set:l(function(e,t){var r,n=i.call(this.__mapKeysData__,e);return n===-1&&(n=this.__mapKeysData__.push(e)-1,r=!0),this.__mapValuesData__[n]=t,r&&this.emit("_add",n,e),this}),size:l.gs(function(){return this.__mapKeysData__.length}),values:l(function(){return new h(this,"value")}),toString:l(function(){return"[object Map]"})})),Object.defineProperty(n.prototype,d.iterator,l(function(){return this.entries()})),Object.defineProperty(n.prototype,d.toStringTag,l("c","Map"))},function(e,t,r){"use strict";var n=r(54),o=r(20),i=r(1),a=Array.prototype.indexOf,s=Object.prototype.hasOwnProperty,u=Math.abs,l=Math.floor;e.exports=function(e){var t,r,c,d;if(!n(e))return a.apply(this,arguments);for(r=o(i(this).length),c=arguments[1],c=isNaN(c)?0:c>=0?l(c):o(this.length)-l(u(c)),t=c;t0?1:-1}},function(e,t,r){"use strict";var n=r(5),o={function:!0,object:!0};e.exports=function(e){return n(e)&&o[typeof e]||!1}},function(e,t,r){"use strict";var n,o=Object.create;r(21)()||(n=r(22)),e.exports=function(){var e,t,r;return n?1!==n.level?o:(e={},t={},r={configurable:!1,enumerable:!1,writable:!0,value:void 0},Object.getOwnPropertyNames(Object.prototype).forEach(function(e){return"__proto__"===e?void(t[e]={configurable:!0,enumerable:!1,writable:!0,value:void 0}):void(t[e]=r)}),Object.defineProperties(e,t),Object.defineProperty(n,"nullPolyfill",{configurable:!1,enumerable:!1,writable:!1,value:e}),function(t,r){return o(null===t?e:t,r)}):o}()},function(e,t,r){"use strict";e.exports=function(){var e,t=Object.assign;return"function"==typeof t&&(e={foo:"raz"},t(e,{bar:"dwa"},{trzy:"trzy"}),e.foo+e.bar+e.trzy==="razdwatrzy")}},function(e,t,r){"use strict";var n=r(65),o=r(1),i=Math.max;e.exports=function(e,t){var r,a,s,u=i(arguments.length,2);for(e=Object(o(e)),s=function(n){try{e[n]=t[n]}catch(e){r||(r=e)}},a=1;a-1}},function(e,t,r){"use strict";var n,o,i,a,s,u,l,c=r(4),d=r(2),p=Function.prototype.apply,f=Function.prototype.call,h=Object.create,_=Object.defineProperty,g=Object.defineProperties,y=Object.prototype.hasOwnProperty,v={configurable:!0,enumerable:!1,writable:!0};n=function(e,t){var r;return d(t),y.call(this,"__ee__")?r=this.__ee__:(r=v.value=h(null),_(this,"__ee__",v),v.value=null),r[e]?"object"==typeof r[e]?r[e].push(t):r[e]=[r[e],t]:r[e]=t,this},o=function(e,t){var r,o;return d(t),o=this,n.call(this,e,r=function(){i.call(o,e,r),p.call(t,this,arguments)}),r.__eeOnceListener__=t,this},i=function(e,t){var r,n,o,i;if(d(t),!y.call(this,"__ee__"))return this;if(r=this.__ee__,!r[e])return this;if(n=r[e],"object"==typeof n)for(i=0;o=n[i];++i)o!==t&&o.__eeOnceListener__!==t||(2===n.length?r[e]=n[i?0:1]:n.splice(i,1));else n!==t&&n.__eeOnceListener__!==t||delete r[e];return this},a=function(e){var t,r,n,o,i;if(y.call(this,"__ee__")&&(o=this.__ee__[e]))if("object"==typeof o){for(r=arguments.length,i=new Array(r-1),t=1;t=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";var n=r(7),o=r(8),i=r(79),a=r(89),s=r(25),u=r(3).iterator;e.exports=function(e){return"function"==typeof s(e)[u]?e[u]():n(e)?new i(e):o(e)?new a(e):new i(e)}},function(e,t,r){"use strict";var n,o=r(6),i=r(24),a=r(4),s=r(3),u=r(14),l=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?i.call(t,"key+value")?"key+value":i.call(t,"key")?"key":"value":"value",l(this,"__kind__",a("",t))},o&&o(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:a(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),l(n.prototype,s.toStringTag,a("c","Array Iterator"))},function(e,t,r){"use strict";var n,o=r(81),i=r(23),a=r(2),s=r(86),u=r(2),l=r(1),c=Function.prototype.bind,d=Object.defineProperty,p=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=l(t)&&u(t.value);return n=o(t),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&p.call(this,e)?i:(t.value=c.call(i,r.resolveContext?r.resolveContext(this):this),d(this,e,t),this[e])},n},e.exports=function(e){var t=i(arguments[1]);return null!=t.resolveContext&&a(t.resolveContext),s(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n=r(82),o=r(13),i=r(1);e.exports=function(e){var t=Object(i(e)),r=arguments[1],a=Object(arguments[2]);if(t!==e&&!r)return t;var s={};return r?n(r,function(t){(a.ensure||t in e)&&(s[t]=e[t])}):o(s,e),s}},function(e,t,r){"use strict";e.exports=r(83)()?Array.from:r(84)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(e=["raz","dwa"],t=r(e),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(3).iterator,o=r(7),i=r(85),a=r(20),s=r(2),u=r(1),l=r(5),c=r(8),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,S=arguments[1],P=arguments[2];if(e=Object(u(e)),l(S)&&s(S),this&&this!==Array&&i(this))t=this;else{if(!S){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r=55296&&v<=56319&&(w+=e[++r])),w=S?p.call(S,P,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n,o=r(6),i=r(4),a=r(14),s=r(3).toStringTag,u=r(91),l=Object.defineProperties,c=a.prototype._unBind;n=e.exports=function(e,t){return this instanceof n?(a.call(this,e.__mapKeysData__,e),t&&u[t]||(t="key+value"),void l(this,{__kind__:i("",t),__values__:i("w",e.__mapValuesData__)})):new n(e,t)},o&&o(n,a),n.prototype=Object.create(a.prototype,{constructor:i(n),_resolve:i(function(e){return"value"===this.__kind__?this.__values__[e]:"key"===this.__kind__?this.__list__[e]:[this.__list__[e],this.__values__[e]]}),_unBind:i(function(){this.__values__=null,c.call(this)}),toString:i(function(){return"[object Map Iterator]"})}),Object.defineProperty(n.prototype,s,i("c","Map Iterator"))},function(e,t,r){"use strict";e.exports=r(92)("key","value","key+value")},function(e,t,r){"use strict";var n=Array.prototype.forEach,o=Object.create;e.exports=function(e){var t=o(null);return n.call(arguments,function(e){t[e]=!0}),t}},function(e,t,r){"use strict";e.exports=function(){return"undefined"!=typeof Map&&"[object Map]"===Object.prototype.toString.call(new Map)}()},function(e,t,r){"use strict";function n(e,t){var r=e.getMemoryCacheController();r&&r.setMaxCacheSize(t)}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=2e4,a=function(){function e(e,t){this._maxCacheSize=e,this._players=[],this._updateTimer=null,this._logger=o.logger.prefixLogger(t,"CacheManager"),this._logger.debug("Initialized with cache size "+e+" bytes.")}return e.prototype.setCacheSize=function(e){this._maxCacheSize!==e&&(this._logger.debug("Updating cache size to "+e+" bytes."),this._maxCacheSize=e,this._update())},e.prototype.addPlayer=function(e){var t=this;if(this._logger.debug("Adding player to cache manager."),e.isDead())return void this._logger.debug("Player was dead.");var r=this._players;e.onChange.subscribe(function(n){var o=n.playing,i=n.dead;i===!0?(t._logger.debug("Removing player that became dead."),r.splice(r.indexOf(e),1),t._update()):o===!0?(t._logger.debug("Updating because player started playing."),r.splice(r.indexOf(e),1),r.unshift(e),t._update()):o===!1&&(t._logger.debug("Updating because player became paused."),t._update())}),e.isPlaying()?r.unshift(e):r.push(e),this._update()},e.prototype._update=function(){var e=this;if(this._updateTimer&&(window.clearTimeout(this._updateTimer),this._updateTimer=null),0===this._players.length)return void this._logger.debug("There are no longer any players to manage.");var t=this._players.reduce(function(e,t){return t.isPlaying()?e.playingPlayers.push(t):e.pausedPlayers.push(t),e},{playingPlayers:[],pausedPlayers:[]}),r=t.playingPlayers,o=t.pausedPlayers,a=r.reduce(function(e,t){return e+(t.getMemoryCacheUsage()||0)},0),s=o.reduce(function(e,t){return e+(t.getMemoryCacheUsage()||0)},0);if(a>this._maxCacheSize){this._logger.debug("All playing players are using more than the max cache size. Cleaning...",a,this._maxCacheSize);var u=this._maxCacheSize/r.length;r.forEach(function(e){return n(e,u)}),o.forEach(function(e){return n(e,0)})}else this._logger.debug("Recalculating cache sizes...",a+s,this._maxCacheSize),r.concat(o).reduce(function(t,r){return n(r,Math.max(0,e._maxCacheSize-t)),t+(r.getMemoryCacheUsage()||0)},0);this._updateTimer=window.setTimeout(function(){return e._update()},i)},e}();t.CacheManager=a},function(e,t,r){"use strict";function n(e){var r=e.streamUrlRetriever,n=e.getURLOpts,a=e.logger,s=e.urlProviderRetryDelayCalculator,u=new o.helpers.abortableJob.AbortableJob(function(){var e=o.helpers.deferred.buildDeferred(),u=o.helpers.retry.retry(s,function(t){var s=t.scheduleRetry,u=r.getUrl(n);return a.debug("Retrieving a URL..."),u.onCompletion(function(t){t?t.rendition&&i.allRenditions.indexOf(t.rendition)<0?(a.warn("Unknown rendition. Skipping...",t.rendition),r.excludeRendition(t.rendition),s()):!t.success&&t.error.isTransient()?(a.warn("Transient error retrieving url.",t.error),s()):e.resolve(t):(a.debug("No URL provided."),e.resolve(null))}),u.onError(function(t){t!==o.helpers.abortableJob.abortedError&&a.error("Error retrieving URL.",t),e.reject(t)}),{onCancel:function(){return u.abort()}}},{onNoMoreRetries:function(){return e.reject(t.NoMoreAttemptsError)}}).cancel;return{result:e.promise,abort:function(){return u()}}});return u.run()}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(10);t.NoMoreAttemptsError=new Error("No more attempts to retrieve URL."),t.retrieveUrl=n},function(e,t,r){"use strict";function n(e,t){return void 0!==e?e:t}function o(e){if(!(e.streamUrlRetriever instanceof i.BaseStreamUrlRetriever))throw new Error("StreamUrlRetriever invalid.");if(void 0!==e.duration&&("number"!=typeof e.duration||e.duration<0))throw new Error("duration invalid.");if(void 0!==e.getURLOpts&&"object"!=typeof e.getURLOpts)throw new Error("getURLOpts invalid.");if(void 0!==e.preloadingEnabled&&"boolean"!=typeof e.preloadingEnabled)throw new Error("preloadingEnabled invalid.");if(void 0!==e.fadeOnPauseAndPlay&&"boolean"!=typeof e.fadeOnPauseAndPlay)throw new Error("fadeOnPauseAndPlay invalid.");if(void 0!==e.fadeOnSeek&&"boolean"!=typeof e.fadeOnSeek)throw new Error("fadeOnSeek invalid.");if(void 0!==e.mediaSessionEnabled&&"boolean"!=typeof e.mediaSessionEnabled)throw new Error("mediaSessionEnabled invalid.");if(void 0!==e.pausedMaxBufferLength&&("number"!=typeof e.pausedMaxBufferLength||e.pausedMaxBufferLength<0))throw new Error("pausedMaxBufferLength invalid.");if(void 0!==e.playingMaxBufferLength&&("number"!=typeof e.playingMaxBufferLength||e.playingMaxBufferLength<0))throw new Error("playingMaxBufferLength invalid.");if(void 0!==e.logger&&"function"!=typeof e.logger&&"object"!=typeof e.logger)throw new Error("logger invalid.");if(void 0!==e.audioReporter&&"function"!=typeof e.audioReporter)throw new Error("audioReporter invalid.");if(void 0!==e.audioCheckpointInterval&&("number"!=typeof e.audioCheckpointInterval||e.audioCheckpointInterval<0))throw new Error("audioCheckpointInterval invalid.");if(void 0!==e.audioPerformanceReporter&&"function"!=typeof e.audioPerformanceReporter)throw new Error("audioPerformanceReporter invalid.");if(void 0!==e.errorReporter&&"function"!=typeof e.errorReporter)throw new Error("errorReporter invalid.");if(void 0!==e.urlProviderRetryDelayCalculator&&"function"!=typeof e.urlProviderRetryDelayCalculator)throw new Error("urlProviderRetryDelayCalculator invalid.");return{controllers:e.controllers,streamUrlRetriever:e.streamUrlRetriever,getURLOpts:n(e.getURLOpts,{}),preloadingEnabled:n(e.preloadingEnabled,!1),pausedMaxBufferLength:n(e.pausedMaxBufferLength,2e3),playingMaxBufferLength:n(e.playingMaxBufferLength,9e4),fadeOnPauseAndPlay:n(e.fadeOnPauseAndPlay,!1),fadeOnSeek:n(e.fadeOnSeek,!1),audioCheckpointInterval:n(e.audioCheckpointInterval,3e4),urlProviderRetryDelayCalculator:n(e.urlProviderRetryDelayCalculator,a.helpers.retry.buildExponentialDelayCalculator()),streamUrlsExpire:n(e.streamUrlsExpire,!0),fetchEnabled:n(e.fetchEnabled,!0),duration:e.duration,audioReporter:e.audioReporter,audioPerformanceReporter:e.audioPerformanceReporter,errorReporter:e.errorReporter}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(16),a=r(0);t.validatePlayerDependencies=o},function(e,t,r){"use strict";function n(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t="",r=0;r<20;r++)t+=e.charAt(Math.floor(Math.random()*e.length));return t}Object.defineProperty(t,"__esModule",{value:!0}),t.generateLogId=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=1500,i=function(){function e(e){var t=this;this._player=e,this._onConnectionRequired=new n.eventDispatcher.EventDispatcher,this._onConnectionRecovered=new n.eventDispatcher.EventDispatcher,this._connectionRequired=!1,this._connectionLossTimer=null,this.onConnectionRequired=this._onConnectionRequired.getHandle(),this.onConnectionRecovered=this._onConnectionRecovered.getHandle();var r=function(){return t._calculateIfConnectionRequired()};window.addEventListener("online",r),window.addEventListener("offline",r),this._calculateIfConnectionRequired(),e.onChange.subscribe(function(n){ +var o=n.loading,i=n.dead;i&&null!==t._connectionLossTimer&&(window.clearTimeout(t._connectionLossTimer),window.removeEventListener("online",r),window.removeEventListener("offline",r)),e.isDead()||void 0===o||t._calculateIfConnectionRequired()})}return e.prototype.isConnectionRequired=function(){return this._connectionRequired},e.prototype._calculateIfConnectionRequired=function(){var e=this,t=this._player.isLoading()&&"navigator"in window&&!window.navigator.onLine;t?null===this._connectionLossTimer&&(this._connectionLossTimer=window.setTimeout(function(){e._connectionLossTimer=null,e._connectionRequired=!0,e._onConnectionRequired.dispatch(void 0)},o)):this._connectionRequired?(this._connectionRequired=!1,this._onConnectionRecovered.dispatch(void 0)):null!==this._connectionLossTimer&&(window.clearTimeout(this._connectionLossTimer),this._connectionLossTimer=null)},e}();t.ConnectionRequiredHelper=i},function(e,t,r){"use strict";function n(e){switch(e){case o.SQ:return o.SQ;case o.HQ:return o.HQ}return null}Object.defineProperty(t,"__esModule",{value:!0});var o;!function(e){e.SQ="sq",e.HQ="hq"}(o=t.Quality||(t.Quality={})),t.resolveQuality=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(9),i=r(26),a=r(27);!function(e){e.NotSupportedError=o.NotSupportedError,e.NoStreamsError=i.NoStreamsError,e.FailedRetrievingUrlError=a.FailedRetrievingUrlError}(n=t.errors||(t.errors={}))}])})},function(e,t,r){!function(t,r){e.exports=r()}(window,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=38)}([function(e,t,r){"use strict";var n=r(6);e.exports=function(e){if(!n(e))throw new TypeError("Cannot use null or undefined");return e}},function(e,t,r){"use strict";function n(e){try{e()}catch(e){window.setTimeout(function(){throw e},0)}}Object.defineProperty(t,"__esModule",{value:!0}),t.deferException=n},function(e,t,r){"use strict";e.exports=r(74)()?Symbol:r(75)},function(e,t,r){"use strict";e.exports=function(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(14),o=function(){function e(){this._listeners=[],this.dispatch=this.dispatch.bind(this)}return e.prototype.subscribe=function(e){var t=this,r={fn:e,payloads:[]};return this._listeners.push(r),{remove:function(){var e=t._listeners.indexOf(r);return e>=0&&(t._listeners.splice(e,1),!0)},retrieve:function(){return t._dispatchListenerPayloads(r)}}},e.prototype.dispatch=function(e,t){var r=this,o="number"==typeof t?{time:t}:t||{},i=void 0!==o.time?o.time:n.now(),a=this._listeners;a.forEach(function(t){return t.payloads.push({time:i,payload:e})});var s=!1;do s=!a.some(function(e){var t=e.fn,n=e.payloads,o=n.shift();return!!o&&(r._callHandler(t,o),!0)});while(!s)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype._dispatchListenerPayloads=function(e){for(var t=e.fn,r=e.payloads;;){var n=r.shift();if(!n)break;this._callHandler(t,n)}},e.prototype._callHandler=function(e,t){try{e(t.payload,t.time)}catch(e){window.setTimeout(function(){throw e},0)}},e}();t.EventDispatcher=o},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(11),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"PLAYER_FATAL_ERROR"},t}(o.PlayerError);t.PlayerFatalError=i},function(e,t,r){"use strict";var n=r(33)();e.exports=function(e){return e!==n&&null!==e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(40);t.Promise=n.Promise},function(e,t,r){"use strict";var n,o=r(19),i=r(34),a=r(70),s=r(35);n=e.exports=function(e,t){var r,n,a,u,l;return arguments.length<2||"string"!=typeof e?(u=t,t=e,e=null):u=arguments[2],null==e?(r=a=!0,n=!1):(r=s.call(e,"c"),n=s.call(e,"e"),a=s.call(e,"w")),l={value:t,configurable:r,enumerable:n,writable:a},u?o(i(u),l):l},n.gs=function(e,t,r){var n,u,l,c;return"string"!=typeof e?(l=r,r=t,t=e,e=null):l=arguments[3],null==t?t=void 0:a(t)?null==r?r=void 0:a(r)||(l=r,r=void 0):(l=t,t=r=void 0),null==e?(n=!0,u=!1):(n=s.call(e,"c"),u=s.call(e,"e")),c={get:t,set:r,configurable:n,enumerable:u},l?o(i(l),c):c}},function(e,t,r){"use strict";function n(){var e,t,r=!1,n=new o.Promise(function(r,n){e=r,t=n});return{promise:n,resolve:function(t){r||(r=!0,e(t))},reject:function(e){r||(r=!0,t(e))},isSettled:function(){return r}}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(7);t.buildDeferred=n},function(e,t,r){"use strict";function n(e,t){return{debug:function(r){for(var n=[],o=1;o=3){var r=parseInt(t[1],10),n=parseInt(t[2],10);if(!isNaN(r)&&!isNaN(n))return{major:r,minor:n}}return null}Object.defineProperty(t,"__esModule",{value:!0});var p="undefined"!=typeof navigator?navigator.userAgent:"",f=!/chrome|opera/i.test(p)&&/safari/i.test(p),h=p.indexOf("MSIE ")>=0||p.indexOf("Trident/")>=0,_=p.indexOf("Edge/")>=0,g=/Chrom(?:e|ium)/.test(p),y=p.toLowerCase().indexOf("firefox")>=0,v=/version\/(\d+)\.(\d+)/i,m=/Chrom(?:e|ium)\/([0-9]+)\.([0-9]+)\.([0-9]+)/,E=/Firefox\/(\d+)\.(\d+)/;t.isSafari=n,t.isFirefox=o,t.isChrome=i,t.isIE=a,t.isEdge=s,t.getSafariVersion=u,t.getChromeVersion=l,t.getFirefoxVersion=c},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),o=this&&this.__assign||function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;re&&(this._logger.debug("Capping position.",e),this.seek(e),this.isReady()&&(this._lastPlayerPosition=e,this._signalSeekComplete()))},t.prototype._sync=function(e){var t=this,r=this._player;if(!r)throw new Error("Player should have become available by now.");if(this._logger.debug("Syncing...",this.isPlaying(),this.isActuallyPlaying()),r.isDead()){this._logger.debug("Provided player is dead.");var n=r.getFatalError();return void(n&&this._handleFatalError(n,r))}this._errorHandler=r.onError.subscribe(function(e){e instanceof s.PlayerFatalError?t._onProvidedPlayerError.dispatch(new d.ProxyProvidedPlayerFatalError(e,r)):(t._triggerError(e),t._onProvidedPlayerError.dispatch(new c.ProxyProvidedPlayerError(e,r)))}),this._changeHandler=r.onChange.subscribe(function(e){t._update(function(){if(t._logger.debug("Handling changes.",e),e.dead)return t._logger.debug("Player has gone to DEAD state."),t._unsync(),void(t.isDead()||e.fatalError&&t._handleFatalError(e.fatalError,r));if(void 0===e.volume&&void 0===e.muted||t._notifyVolumeChange(r.getVolume(),r.getMuted()),void 0!==e.duration&&(t._ensureBelowPosition(e.duration),t._provideDuration(e.duration),t.isReady()||(t._signalReady(),t._handleSkippedSeek(),t._notifyStalled(r.isStalled()))),e.seek){var n=t.getSeekState();n&&"IN_PROGRESS"===n.state||"IN_PROGRESS"!==e.seek.state?n&&"IN_PROGRESS"===n.state&&("COMPLETED"===e.seek.state&&n.position===e.seek.position?(t._signalSeekComplete(),r.isFadingForSeek()&&t._notifyFadingForSeek(!0)):"COMPLETED"===e.seek.state&&n.position!==e.seek.position?t._notifySeekRejection(new Error("Another seek occurred to a different position.")):"IN_PROGRESS"===e.seek.state&&n.position!==e.seek.position?t.seek(e.seek.position):"ERROR"===e.seek.state&&t._notifySeekRejection(e.seek.error)):t.seek(e.seek.position)}void 0!==e.stalled&&t._notifyStalled(e.stalled),e.playing===!1&&e.playRejection?t.isActuallyPlaying()?(t._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),t._notifyPlaying(!1)):t._notifyPlayRejection(e.playRejection):e.playing===!1&&(r.isActuallyPlaying()?t.pause():void 0===e.actuallyPlaying&&t.isReady()&&t._notifyPlaying(!1)),e.playing===!0&&e.pauseRejection?t._notifyPauseRejection(e.pauseRejection):e.playing===!0&&t.play(),void 0!==e.actuallyPlaying&&e.actuallyPlaying!==t.isActuallyPlaying()&&(t._notifyPlaying(e.actuallyPlaying),e.actuallyPlaying&&r.isFading()&&t._notifyFading(!0)),e.fading===!1&&t._notifyFading(!1),e.fadingForSeek===!1&&t._notifyFadingForSeek(!1)})}),this._update(function(){var n=t._instanceLock;try{if(t._notifyStalled(r.isStalled()),r.isReady()){var o=r.getDuration();t._ensureBelowPosition(o),t._provideDuration(o),t.isReady()||(t._logger.debug("Provided player is already ready. Making proxy player ready."),t._signalReady())}if(e.syncVolume&&(r.setVolume(t.getVolume(),t.getMuted()),t._instanceLock!==n))return;var i=t.getSeekState();if(e.syncPosition){t._logger.debug("Seeking to match position.");var a=t.getPosition();r.getPosition()!==a?r.seek(a):(t._logger.debug("Skipping seek because already at same position."),t.isReady()&&i&&"IN_PROGRESS"===i.state&&t._signalSeekComplete())}else if(i&&"IN_PROGRESS"===i.state){t._logger.debug("Seeking to match position because a seek has been queued.");var u=t._seekConfig;t._seekConfig=void 0,r.seek(t.getPosition(),u)}else{var l=r.getSeekState();l&&"IN_PROGRESS"===l.state&&(t._logger.debug("Seeking on proxy to match seek that is in progress on provided player."),t.seek(l.position))}if(t._instanceLock!==n)return;if(r.isActuallyPlaying()?(t._logger.debug("Provided player is already playing."),t.isActuallyPlaying()||(t._notifyPlaying(!0),r.isFading()&&t._notifyFading(!0))):r.isPlaying()?(t._logger.debug("Provided player is preparing to play."),t.play()):t.isPlaying()?(t._logger.debug("Calling play() on provided player to match proxy."),t._playAndHandleAbort(r)):t.isReady()&&t.isActuallyPlaying()&&(t._logger.debug("Switching to paused state, as provided player and proxy intended state is paused."),t._notifyPlaying(!1)),t._instanceLock!==n)return;t._synced=!0,t._notifyVolumeChange(r.getVolume(),r.getMuted())}catch(e){t._triggerError(new s.PlayerFatalError("Unexpected error occurred whilst syncing.",e))}})},t.prototype._playAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling play() on provided player.");var r=this._playConfig;this._playConfig=this._pauseConfig=void 0,e.play(r),this._instanceLock===t&&!e.isPlaying()&&this.isPlaying()&&(this._logger.debug("Provided player was not playing after play() call completed."),this.isActuallyPlaying()?(this._triggerError(new a.PlayerError("Paused because a player was provided that refused to play.")),this._notifyPlaying(!1)):this.pause())},t.prototype._pauseAndHandleAbort=function(e){var t=this._instanceLock;this._logger.debug("Calling pause() on provided player.");var r=this._pauseConfig;this._playConfig=this._pauseConfig=void 0,e.pause(r),this._instanceLock===t&&e.isPlaying()&&!this.isPlaying()&&(this._logger.debug("Provided player was not paused after pause() call completed."),this.play())},t.prototype._unsync=function(){if(this._logger.debug("Unsyncing..."),this._changeHandler&&(this._changeHandler.remove(),this._changeHandler=null),this._errorHandler&&(this._errorHandler.remove(),this._errorHandler=null),!this._synced)return void this._logger.debug("Unsynced. (Sync never completed)");this._synced=!1,this._unsyncInProgress=!0;var e=this._player;if(e)try{this._lastPlayerPosition=e.getPosition()}catch(e){this._logger.error("Error whilst unsyncing.",e)}this._unsyncInProgress=!1,this._logger.debug("Unsynced.",this.isPlaying(),this.isActuallyPlaying())},t}(i.BasePlayer);t.ProxyPlayerBase=p},function(e,t,r){"use strict";function n(){return{ended:!1,loading:!1,playing:!1,actuallyPlaying:!1,volume:1,muted:!1,isFading:!1,fadeRate:null,isFadingForSeek:!1,playDeferred:null,pauseDeferred:null,ready:!1,seeking:!1,seek:null,positionJumped:null,stalled:!0,duration:null,dead:!1,state:d.State.PAUSED,fatalError:null,errorOccurred:null,position:0}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=r(24),a=r(4),s=r(9),u=r(16),l=r(14),c=r(7),d=r(25),p=r(10),f=r(26),h=r(28),_=r(1),g=r(45),y=5e3,v=150,m=25,E=35,b=1e3,w=function(){function e(e){var t=this;this._stateManager=new f.StateManager(n(),{afterUpdate:function(e,r){return t._afterUpdate(e,r)},afterDispatches:function(){return t._afterDispatches()},beforeUpdate:function(e){if(!e.dead&&(e.ready||!t._fatalErrorTriggered)){var r=t._getPosition(),n=e.duration;if(r<0)throw t._logger.error("Player provided invalid position.",r,n),t._triggerError(new h.ImplementationError("Player provided a position that was invalid.")),new Error("Player provided invalid position.");e.position=r,t._updateEndedInState(e)}}}),this._onError=new a.EventDispatcher,this._errors=[],this._fatalErrorTriggered=!1,this._loadingDelayTimer=null,this._stalled=!1,this._queuedDuration=null,this._readyDeferred=s.buildDeferred(),this._queuedSeekDeferreds=[],this._lastPlayError=null,this._lastPauseError=null,this._lastPlayedPosition=null,this._listenTimeBase=0,this._timePlaybackStarted=null,this._positionAfterLastUpdate=0,this._positionWhenStartedFadeOut=null,this._fadeStartAllowed=!1,this._seekFadeStartAllowed=!1,this._implementationIsFading=!1,this._mediaSessionManagerHandle=null;var r=e.name;if(this._logger=p.prefixLogger(e.logger,"BasePlayer"+(r?"-"+r:"")),this._mediaSessionEnabled=!!e.mediaSessionEnabled,e.defaultFadeDuration&&e.defaultFadeDuration<0)throw new Error("defaultFadeDuration must be >= 0.");if(e.loadingDelay&&e.loadingDelay<0)throw new Error("loadingDelay must be >= 0.");this._defaultFadeDuration=void 0!==e.defaultFadeDuration?e.defaultFadeDuration:v,this._defaultSeekFadeOutDuration=void 0!==e.defaultSeekFadeOutDuration?e.defaultSeekFadeOutDuration:m,this._defaultSeekFadeInDuration=void 0!==e.defaultSeekFadeInDuration?e.defaultSeekFadeInDuration:E,this._loadingDelay=void 0!==e.loadingDelay?e.loadingDelay:b,this.onError=this._onError.getHandle(),this.whenReady=this._readyDeferred.promise,this._configureRewindAfterFadeOut(),this._stateManager.subscribe(function(e,r){return t._onChange(e,r)}),this._stateManager.subscribe(function(e){var r=e.actuallyPlaying,n=e.seek;r===!0&&(t._fadeStartAllowed=!1),n&&"IN_PROGRESS"!==n.state&&(t._seekFadeStartAllowed=!1)}),this._stateManager.subscribe(function(e,r){var n=e.isFading,o=r.dead;!o&&n===!1&&t._implementationIsFading&&t._triggerError(new h.ImplementationError("Fade was still running when not allowed."))}),this._stateManager.subscribe(function(e,r){var n=e.playing,o=r.dead,i=r.fadeRate;o||void 0===n||t._stateManager.update(function(){try{t._handlePlayPauseChange(n,{fadeRate:i||void 0}),n||(t._fadeStartAllowed=!1)}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling play/pause change.",e))}})}),this._stateManager.subscribe(function(e,r){var n=e.seek,o=r.dead;!o&&n&&"IN_PROGRESS"===n.state&&t._stateManager.update(function(){try{t._seekFadeStartAllowed=!0,t._handleSeekChange(n.position,{fadeRate:{beforeSeek:n.fadeRate.beforeSeek||void 0,afterSeek:n.fadeRate.afterSeek||void 0}}),t._seekFadeStartAllowed=!1}catch(e){t._triggerError(new h.ImplementationError("Exception occurred whilst handling seek change.",e))}})}),this.onChange=this._buildEventHandle(function(e,r){var n=r.ready;if(void 0!==n&&n!==!0)throw new Error("Ready state is invalid.");var o=r.duration;if(void 0!==o&&null===o)throw new Error("Duration state is invalid.");var i=r.dead;if(void 0!==i&&i!==!0)throw new Error("Dead state is invalid.");var a={ready:n,ended:r.ended,duration:o,volume:r.volume,muted:r.muted,playing:r.playing,actuallyPlaying:r.actuallyPlaying,stalled:r.stalled,loading:r.loading,fading:r.isFading,fadingForSeek:r.isFadingForSeek,playRejection:r.playing===!1?t._lastPlayError||void 0:void 0,pauseRejection:r.playing===!0?t._lastPauseError||void 0:void 0,seeking:r.seeking,seek:r.seek||void 0,positionJumped:void 0!==r.positionJumped||void 0,state:r.state,fatalError:r.fatalError||void 0,dead:i};Object.keys(a).some(function(e){return void 0!==a[e]})&&e(a)});var o=e.registerListeners;o&&_.deferException(function(){o({onChange:t.onChange,onError:t.onError})}),this.onDurationChange=this._buildEventHandle(function(e,t){var r=t.duration;void 0!==r&&null!==r&&e(r)}),this.onReady=this._buildEventHandle(function(e,t){var r=t.ready;r===!0&&e(void 0)}),this.onStateChange=this._buildEventHandle(function(e,t){var r=t.state;void 0!==r&&e(r)}),this.onVolumeChange=this._buildEventHandle(function(e,t,r){var n=t.volume,o=t.muted,i=r.volume,a=r.muted;void 0===n&&void 0===o||e({volume:i,muted:a})}),this.onPlay=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!0&&e(void 0)}),this.onPlayIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!0&&e(void 0)}),this.onPlayRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!1&&t._lastPlayError&&e(t._lastPlayError)}),this.onPause=this._buildEventHandle(function(e,t){var r=t.actuallyPlaying;r===!1&&e(void 0)}),this.onPauseIntent=this._buildEventHandle(function(e,t){var r=t.playing;r===!1&&e(void 0)}),this.onPauseRejection=this._buildEventHandle(function(e,r){var n=r.playing;n===!0&&t._lastPauseError&&e(t._lastPauseError)}),this.onSeek=this._buildEventHandle(function(e,t){var r=t.seek;r&&"COMPLETED"===r.state&&e(void 0)}),this.onSeekIntent=this._buildEventHandle(function(e,t){var r=t.seeking;r===!0&&e(void 0)}),this.onSeekRejection=this._buildEventHandle(function(e,t){var r=t.seek;r&&"ERROR"===r.state&&e(r.error)}),this.onPositionJumped=this._buildEventHandle(function(e,t){var r=t.positionJumped;void 0!==r&&e(void 0)}),this.onEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!0&&e(void 0)}),this.onLeftEnded=this._buildEventHandle(function(e,t){var r=t.ended;r===!1&&e(void 0)}),this.onStallStart=this._buildEventHandle(function(e,t){var r=t.stalled;r===!0&&e(void 0)}),this.onStallEnd=this._buildEventHandle(function(e,t){var r=t.stalled;r===!1&&e(void 0)}),this.onLoadStart=this._buildEventHandle(function(e,t){var r=t.loading;r===!0&&e(void 0)}),this.onLoadEnd=this._buildEventHandle(function(e,t){var r=t.loading;r===!1&&e(void 0)}),this.onFadeStart=this._buildEventHandle(function(e,t){var r=t.isFading;r===!0&&e(void 0)}),this.onFadeEnd=this._buildEventHandle(function(e,t){var r=t.isFading;r===!1&&e(void 0)}),this.onFadeForSeekStart=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!0&&e(void 0)}),this.onFadeForSeekEnd=this._buildEventHandle(function(e,t){var r=t.isFadingForSeek;r===!1&&e(void 0)})}return e.prototype.isReady=function(){return this._stateManager.getState().ready},e.prototype.getPosition=function(){return this._getPositionOrPositionSeekingTo()},e.prototype.getLastPlayedPosition=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.stalled;return t&&!r?this.getPosition():this._lastPlayedPosition},e.prototype.getListenTime=function(){var e=this._stateManager.getState(),t=e.actuallyPlaying,r=e.ended,n=this._listenTimeBase;return t&&!r&&(n+=l.now()-this._timePlaybackStarted),n},e.prototype.isStalled=function(){return this._stateManager.getState().stalled},e.prototype.isLoading=function(){return this._stateManager.getState().loading},e.prototype.isFading=function(){return this._stateManager.getState().isFading},e.prototype.isFadingForSeek=function(){return this._stateManager.getState().isFadingForSeek},e.prototype.isPlaying=function(){return this._stateManager.getState().playing},e.prototype.isActuallyPlaying=function(){return this._stateManager.getState().actuallyPlaying},e.prototype.isEnded=function(){return this._stateManager.getState().ended},e.prototype.getState=function(){return this._stateManager.getState().state},e.prototype.getBufferController=function(){return null},e.prototype.getMemoryCacheMaxSize=function(){ +return null},e.prototype.getMemoryCacheUsage=function(){return null},e.prototype.getMemoryCacheController=function(){return null},e.prototype.getFatalError=function(){return this._stateManager.getState().fatalError},e.prototype.isDead=function(){return this._stateManager.getState().dead},e.prototype.getVolume=function(){return this._stateManager.getState().volume},e.prototype.getMuted=function(){return this._stateManager.getState().muted},e.prototype.getDuration=function(){var e=this._stateManager.getState(),t=e.ready,r=e.duration;return t?r:null},e.prototype.setVolume=function(e,t){if(e<0||e>1)throw new Error("Volume must be >= 0 and <= 1.");if(!this._stateManager.getState().dead){var r=this._stateManager.getState().muted;void 0===t&&(t=r);try{this._handleVolumeChange(e,t)}catch(e){throw this._triggerError(new h.ImplementationError("Exception occurred updating volume.",e)),e}}},e.prototype.setMuted=function(e){this.setVolume(this._stateManager.getState().volume,e)},e.prototype.getCurrentBufferedTimeRange=function(){var e=this.getBufferedTimeRanges();if(!e)return null;var t=this.getPosition();return u.find(e,function(e){return e.containsTime(t)})||null},e.prototype.play=function(e){var t=this;this._ensureNotDead(),this._logger.debug("play() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing)t._logger.debug("Intent is already to be playing.");else{t._logger.debug("Requesting play."),n.playing=!0;var o=t._extractFadeDuration(e);o?n.fadeRate=1/o:n.fadeRate=null,t._lastPlayError=null}n.playDeferred&&!n.playDeferred.isSettled()||(n.playDeferred=s.buildDeferred()),r.resolve(n.playDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to play.",e)),c.Promise.reject(e)}},e.prototype.pause=function(e){var t=this;this._ensureNotDead(),this._logger.debug("pause() called.",e);var r=s.buildDeferred();try{return this._stateManager.update(function(n){if(n.playing){t._logger.debug("Requesting pause."),t._positionWhenStartedFadeOut=t._getPositionOrPositionSeekingTo(),n.playing=!1;var o=t._extractFadeDuration(e);o?n.fadeRate=-1*(1/o):n.fadeRate=null,t._fadeStartAllowed=!0,t._lastPauseError=null}else t._logger.debug("Intent is already to be paused.");n.pauseDeferred&&!n.pauseDeferred.isSettled()||(n.pauseDeferred=s.buildDeferred()),r.resolve(n.pauseDeferred.promise)}),r.promise}catch(e){return this._triggerError(new o.PlayerFatalError("Unexpected error when attempting to pause.",e)),c.Promise.reject(e)}},e.prototype.seek=function(e,t){var r=this;this._ensureNotDead(),this._logger.debug("seek() called.",e);var n=s.buildDeferred();return this._stateManager.update(function(o){if(e<0)r._logger.warn("Rejecting seek immediately as the position was negative."),n.reject(new Error("You were attempting to seek to a negative time."));else if(null!==o.duration&&e>o.duration)r._logger.warn("Rejecting seek immediately as the duration is now known, and the requested positon was past it."),n.reject(new Error("You were attempting to seek past the end of the media."));else{o.stalled||!o.actuallyPlaying||o.seek&&"IN_PROGRESS"===o.seek.state||(r._lastPlayedPosition=r._getPositionOrPositionSeekingTo());var i=s.buildDeferred();if(o.seek&&"IN_PROGRESS"===o.seek.state&&o.seek.position===e)r._logger.debug("Seek already requested to the same position.",e);else{r._logger.debug("Requesting seek.",e),o.seeking=!0,r._positionWhenStartedFadeOut=null;var a=r._extractSeekFadeDurations(t,e),u=a.fadeOutDuration?-1*(1/a.fadeOutDuration):null,l=a.fadeInDuration?1/a.fadeInDuration:null;o.seek={state:"IN_PROGRESS",position:e,fadeRate:{beforeSeek:u,afterSeek:l}},o.positionJumped=Object.create(null)}r._queuedSeekDeferreds.push({position:e,deferred:i}),n.resolve(i.promise)}}),n.promise},e.prototype.getSeekState=function(){return this._stateManager.getState().seek},e.prototype.registerMediaSessionActionHandlers=function(e){var t=this;void 0===e&&(e={play:!0,pause:!0,seekForward:!0,seekBackward:!0}),this.unregisterMediaSessionActionHandlers();var r={},n=function(e){t.isDead()||e()};e.play&&(r.play=function(){return n(function(){return t.play()})}),e.pause&&(r.pause=function(){return n(function(){return t.pause()})}),e.seekBackward&&(r.seekBackward=function(){return n(function(){t.seek(Math.max(0,t.getPosition()-y))})}),e.seekForward&&(r.seekForward=function(){return n(function(){t.seek(Math.min(t.getDuration()||0,t.getPosition()+y))})}),this._mediaSessionManagerHandle=g.mediaSessionManager.register(new g.MediaSessionItem(this,r))},e.prototype.unregisterMediaSessionActionHandlers=function(){this._mediaSessionManagerHandle&&(this._mediaSessionManagerHandle.remove(),this._mediaSessionManagerHandle=null)},e.prototype.kill=function(){var e=this;this._stateManager.update(function(t){t.dead||(e._logger.debug("kill() called."),t.dead=!0)})},e.prototype._update=function(e){this._stateManager.update(function(){return e&&e()})},e.prototype._ensureNotDead=function(){if(this._stateManager.getState().dead)throw new Error("Player is dead.")},e.prototype._notifyStalled=function(e){this._ensureNotDead(),this._stalled!==e&&(this._logger.debug("notifyStalled() called.",e),this._stalled=e,this._stateManager.update())},e.prototype._getQueuedSeekPosition=function(){var e=this.getSeekState();return e&&"IN_PROGRESS"===e.state?e.position:null},e.prototype._provideDuration=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(r.duration!==e){var n=t._getPositionOrPositionSeekingTo();if(e<0||r.ready&&n>e)throw t._triggerError(new h.ImplementationError("Attempt to update duration to an invalid value.")),new Error("Duration cannot be less than the current position.");t._logger.debug("provideDuration() called.",e),r.ready?r.duration=e:t._queuedDuration=e}})},e.prototype._notifyVolumeChange=function(e,t){if(e<0||e>1)throw this._triggerError(new h.ImplementationError("Volume was out of range.",e)),new Error("Volume was out of range.");this._stateManager.update(function(r){r.volume=e,r.muted=t})},e.prototype._notifyPlaying=function(e){var t=this;this._ensureNotDead(),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to register playback as started before ready.")),new Error("Player must be ready first.");e!==r.actuallyPlaying&&(t._logger.debug("notifyPlaying() called.",e),e||r.seeking||r.stalled||(t._lastPlayedPosition=t._getPositionOrPositionSeekingTo()),r.actuallyPlaying=r.playing=e,e?(t._lastPlayError=null,t._fadeStartAllowed=!0):(r.isFading=!1,t._fadeStartAllowed=!1,t._lastPauseError=null))})},e.prototype._notifyPlayRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request before player ready.")),new Error("Player must be ready first.");if(r.actuallyPlaying||!r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject a play request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPlayRejection() called.",e),r.playing=!1,t._lastPlayError=e})},e.prototype._notifyPauseRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request before player ready.")),new Error("Player must be ready first.");if(!r.actuallyPlaying||r.playing)throw t._triggerError(new h.ImplementationError("Attempt to reject pause request when not valid.")),new Error("Playing state is incorrect.");t._logger.debug("notifyPauseRejection() called.",e),r.playing=!0,r.fadeRate&&(r.fadeRate*=-1),t._lastPauseError=e})},e.prototype._notifySeekRejection=function(e){var t=this;this._ensureNotDead(),e=e||new Error("Unknown error."),this._stateManager.update(function(r){if(!r.ready)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request before player ready.")),new Error("Player must be ready first.");if(!r.seek||"IN_PROGRESS"!==r.seek.state)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request when none requested.")),new Error("A seek hasn't been requested.");if(null!==r.duration&&r.position>r.duration)throw t._triggerError(new h.ImplementationError("Attempt to reject seek request after duration changed below current position.")),new Error("Attempt to reject seek request after duration changed below current position.");t._logger.debug("notifySeekRejection() called.",e),r.seeking=!1,r.seek={state:"ERROR",error:e},r.positionJumped=Object.create(null)})},e.prototype._notifyFading=function(e){var t=this;if(this._ensureNotDead(),e&&!this._fadeStartAllowed){var r="Attempt to register fade as starting when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._implementationIsFading=e,this._stateManager.update(function(r){r.isFading!==e&&(t._logger.debug("notifyFading() called",e),r.isFading=e)})},e.prototype._notifyFadingForSeek=function(e){var t=this;if(this._ensureNotDead(),e&&!this._seekFadeStartAllowed){var r="Attempt to register fade as starting for seek when not allowed.";throw this._triggerError(new h.ImplementationError(r)),new Error(r)}this._stateManager.update(function(r){r.isFadingForSeek!==e&&(t._logger.debug("notifyFadingForSeek() called",e),r.isFadingForSeek=e)})},e.prototype._signalReady=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal ready twice.")),new Error("Ready already signalled.");if(null===e._queuedDuration)throw e._triggerError(new h.ImplementationError("Attempt to signal ready when duration unknown.")),new Error("Duration is still unknown.");e._logger.debug("signalReady() called."),t.ready=!0,t.duration=e._queuedDuration,t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>t.duration&&(t.seeking=!1,t.seek={state:"ERROR",error:new Error("You were attempting to seek past the end of the media.")})})},e.prototype._signalSeekComplete=function(){var e=this;this._ensureNotDead(),this._stateManager.update(function(t){if(!t.ready)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete before player ready.")),new Error("Player must be ready first.");if(!t.seek||"IN_PROGRESS"!==t.seek.state)throw e._triggerError(new h.ImplementationError("Attempt to signal seek as complete when none requested.")),new Error("There shouldn't be a seek in progress.");var r=t.duration;if(t.seek&&"IN_PROGRESS"===t.seek.state&&t.seek.position>r)throw new Error("Seek cannot have completed given it was to a time greater than the duration.");e._logger.debug("signalSeekComplete() called."),e._seekFadeStartAllowed=!0,t.seek={state:"COMPLETED",position:t.seek.position,fadeRate:t.seek.fadeRate},t.seeking=!1,t.position=t.seek.position})},e.prototype._triggerError=function(e){var t=this;e instanceof o.PlayerFatalError&&(this._fatalErrorTriggered=!0),this._stateManager.update(function(r){var n=!1;if(r.ready&&e instanceof i.NotSupportedError&&(e=new h.ImplementationError("Invalid NotSupportedError."),n=!0),e instanceof o.PlayerFatalError?(e instanceof i.NotSupportedError?t._logger.info("NotSupportedError occurred.",e):t._logger.error("Fatal error occurred.",e),r.fatalError?t._logger.warn("A fatal error already occurred.",r.fatalError):r.fatalError=e,t._errors.push(e),r.errorOccurred=Object.create(null),r.dead=!0):(t._logger.warn("Non-fatal error occurred.",e),t._errors.push(e),r.errorOccurred=Object.create(null)),n)throw new Error("Not supported errors are only valid before the player is ready.")})},e.prototype._buildEventHandle=function(e){var t=this;return{subscribe:function(r){var n=function(e){return r(e,l.now())};return t._stateManager.subscribe(function(t,r){e(n,t,r)})}}},e.prototype._finalizeState=function(e){this._updateEndedInState(e);var t=this._getPositionOrPositionSeekingTo();if(e.dead)this._lastPlayError=new Error("Player was killed."),e.loading=!1,this._clearLoadingDelay(),!e.playing&&e.isFading&&null!==this._positionWhenStartedFadeOut&&(this._logger.debug("Fade out was in progress. Pretending it completed."),e.isFading=!1,e.position=this._positionWhenStartedFadeOut),e.stalled=!0,e.actuallyPlaying=!1,e.isFadingForSeek=!1,e.playing=!1,e.state=d.State.DEAD;else{var r=!e.ended&&(!e.ready||this._stalled||!(!e.seek||"IN_PROGRESS"!==e.seek.state));r&&!e.stalled&&!e.seeking&&e.actuallyPlaying&&(this._lastPlayedPosition=t),e.stalled=r;var n=!e.ended&&!e.isFading&&!e.isFadingForSeek&&(e.playing||e.actuallyPlaying)&&(e.stalled||e.playing!==e.actuallyPlaying);n?this._loadingDelay?this._scheduleLoadingDelay():e.loading=!0:(e.loading=!1,this._clearLoadingDelay()),this._positionAfterLastUpdate!==t&&(this._positionAfterLastUpdate=t,e.playing||e.actuallyPlaying||(e.positionJumped=Object.create(null))),e.state=this._calculateState(e)}},e.prototype._updateEndedInState=function(e){e.ended=e.ready&&this._getPositionOrPositionSeekingTo()===e.duration},e.prototype._scheduleLoadingDelay=function(){var e=this;this._loadingDelayTimer||(this._loadingDelayTimer=window.setTimeout(function(){e._stateManager.update(function(e){return e.loading=!0})},this._loadingDelay))},e.prototype._clearLoadingDelay=function(){this._loadingDelayTimer&&(window.clearTimeout(this._loadingDelayTimer),this._loadingDelayTimer=null)},e.prototype._getPositionOrPositionSeekingTo=function(){this._stateManager.update();var e=this._stateManager.getState();return e.seek&&"IN_PROGRESS"===e.seek.state?e.seek.position:e.isFading&&!e.playing&&null!==this._positionWhenStartedFadeOut?this._positionWhenStartedFadeOut:e.ready&&null!==e.duration?e.position:0},e.prototype._calculateState=function(e){var t=e.dead,r=e.loading,n=e.playing,o=e.ended;return t?d.State.DEAD:r?d.State.LOADING:n&&!o?d.State.PLAYING:d.State.PAUSED},e.prototype._extractFadeDuration=function(e){return void 0===e&&(e={}),void 0===e.fadeDuration?!this._stateManager.getState().playing||this._getPositionOrPositionSeekingTo()>0?this._defaultFadeDuration:0:e.fadeDuration>0?e.fadeDuration:0},e.prototype._extractSeekFadeDurations=function(e,t){void 0===e&&(e={});var r;r=void 0!==e.fadeOutDuration?e.fadeOutDuration>0?e.fadeOutDuration:0:this._defaultSeekFadeOutDuration;var n;return n=void 0!==e.fadeInDuration?e.fadeInDuration>0?e.fadeInDuration:0:t>0?this._defaultSeekFadeInDuration:0,{fadeOutDuration:r,fadeInDuration:n}},e.prototype._configureRewindAfterFadeOut=function(){var e=this;this._stateManager.subscribe(function(t,r){var n=t.isFading,o=r.playing,i=r.dead;i||n!==!1||o||null===e._positionWhenStartedFadeOut||e.seek(e._positionWhenStartedFadeOut,{fadeInDuration:0,fadeOutDuration:0}).catch(function(t){e._logger.warn("Seek back to position where fade out started failed.",t)})})},e.prototype._afterUpdate=function(e,t){if(t.beforeUpdate||t.update.length>0)this._logger.error("Errors occurred during state update. Killing player.",t),this._triggerError(new o.PlayerFatalError("Errors occurred during state update.",t));else if(!e.dead&&e.ready){var r=e.duration;null!==r&&!e.seeking&&e.position>r&&(this._logger.error("Player provided invalid position.",e.position,r),this._triggerError(new h.ImplementationError("Player provided a position that was invalid.")))}this._finalizeState(e)},e.prototype._afterDispatches=function(){var e=this,t=this._errors;this._errors=[],t.forEach(function(t){return e._onError.dispatch(t)})},e.prototype._onChange=function(e,t){var r=this,n=e.ready,o=e.dead,i=e.fatalError,a=e.playing,s=e.actuallyPlaying,u=e.ended;if(n===!0&&(this._logger.debug("Resolving ready deferred."),this._readyDeferred.resolve(void 0)),a===!0&&this._mediaSessionEnabled&&!this._mediaSessionManagerHandle&&this.registerMediaSessionActionHandlers({play:!0,pause:!0,seekForward:!0,seekBackward:!0}),t.pauseDeferred&&!t.pauseDeferred.isSettled()&&t.playing){var c=this._lastPauseError||new Error("Pause request aborted.");this._logger.debug("Rejecting pause deferred.",c),t.pauseDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&!t.playing){var c=this._lastPlayError||new Error("Play request aborted.");this._logger.debug("Rejecting play deferred.",c),t.playDeferred.reject(c)}if(t.playDeferred&&!t.playDeferred.isSettled()&&t.actuallyPlaying&&(this._logger.debug("Resolving play deferred."),t.playDeferred.resolve(void 0)),!t.pauseDeferred||t.pauseDeferred.isSettled()||t.actuallyPlaying||(this._logger.debug("Resolving pause deferred."),t.pauseDeferred.resolve(void 0)),s===!0&&!t.ended||u===!1&&t.actuallyPlaying?this._timePlaybackStarted=l.now():(s===!1&&!t.ended||u===!0&&t.actuallyPlaying)&&(this._listenTimeBase+=l.now()-this._timePlaybackStarted,this._timePlaybackStarted=null),this._queuedSeekDeferreds=this._queuedSeekDeferreds.filter(function(e){var n=e.position,o=e.deferred;if(t.seek)if("IN_PROGRESS"!==t.seek.state){if(!t.stalled||"ERROR"===t.seek.state)return"ERROR"!==t.seek.state?(r._logger.debug("Resolving seek()."),o.resolve(void 0)):(r._logger.debug("Rejecting seek().",t.seek.error),o.reject(t.seek.error)),!1}else if("IN_PROGRESS"!==t.seek.state||t.seek.position!==n)return r._logger.debug("Rejecting seek() because another seek was requested.",n),o.reject(new Error("Seek request aborted because another seek was requested to a different position.")),!1;return!0}),o===!0){this._logger.debug("Calling _kill() on player.");try{this._kill(),this._logger.info("Player killed.")}catch(e){this._triggerError(new h.ImplementationError("Exception occurred in _kill().",e)),this._logger.error("Exception when implementation was being killed.",e)}if(this.unregisterMediaSessionActionHandlers(),!t.ready){var c=i||new Error("Player was killed.");this._logger.debug("Rejecting whenReady."),this._readyDeferred.reject(c)}this._queuedSeekDeferreds.forEach(function(e){var t=e.position,n=e.deferred,o=i||new Error("Seek aborted as player killed.");r._logger.debug("Rejecting seek().",t),n.reject(o)}),this._stateManager.kill(),this._logger.debug("Player dead.")}},e}();t.BasePlayer=w},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t){return e.call(this,t||"The player cannot play the provided descriptor.")||this}return n(t,e),t.prototype.getCode=function(){return"NOT_SUPPORTED_ERROR"},t}(o.PlayerFatalError);t.NotSupportedError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n;!function(e){e[e.LOADING=0]="LOADING",e[e.PLAYING=1]="PLAYING",e[e.PAUSED=2]="PAUSED",e[e.DEAD=3]="DEAD"}(n=t.State||(t.State={}))},function(e,t,r){"use strict";function n(e){var t=Object.create(null);return Object.keys(e).forEach(function(r){t[r]=e[r]}),t}Object.defineProperty(t,"__esModule",{value:!0});var o=r(27),i=r(1),a=function(){},s=function(){function e(e,t){void 0===t&&(t={});var r=this;this._subscribers=[],this._onExit=new o.OnExit(function(){return r._after()},function(){return r._onEnter()}),this._beforeUpdateError=void 0,this._inAfterUpdate=!1,this._dead=!1,this._officiallyDead=!1,this._errors=[],this._state=n(e),this._initialState=n(e),this._beforeUpdate=t.beforeUpdate||function(){},this._afterUpdate=t.afterUpdate||a,this._afterDispatches=t.afterDispatches||a}return e.prototype.subscribe=function(e,t){var r=this;if(void 0===t&&(t=!0),this._dead){var o=!1;return{retrieve:function(){},remove:function(){return!o&&(o=!0)}}}var i={callback:e,localState:t?n(this._state):this._initialState};return this._subscribers.push(i),t||this._updateSubscriber(i),{remove:function(){var t=r._subscribers.map(function(e){return e.callback}).indexOf(e);return t>=0&&(r._subscribers.splice(t,1),!0)},retrieve:function(){r._updateSubscriber(i)}}},e.prototype.subscribeIndividual=function(e,t,r){return this.subscribe(function(r){var n=r[e];void 0!==n&&t(n)},r)},e.prototype.getHandle=function(){return{subscribe:this.subscribe.bind(this)}},e.prototype.getIndividualHandle=function(e){var t=this;return{subscribe:function(r){return t.subscribeIndividual(e,r)}}},e.prototype.update=function(e){var t=this;this._officiallyDead||(this._inAfterUpdate?e&&e(this._state,this._beforeUpdateError):this._onExit.enter(function(r){r.getResult(function(){try{e&&e(t._state,t._beforeUpdateError)}catch(e){t._errors.push(e)}})}))},e.prototype.getState=function(){return this._state},e.prototype.kill=function(){var e=this;this._dead||(this._dead=!0,window.setTimeout(function(){e._subscribers.splice(0),e._officiallyDead=!0},0))},e.prototype.isDead=function(){return this._dead},e.prototype._onEnter=function(){this._beforeUpdateError=void 0;try{this._beforeUpdate(this._state)}catch(e){this._beforeUpdateError=e}},e.prototype._after=function(){var e=this,t=this._errors;this._errors=[],i.deferException(function(){e._inAfterUpdate=!0;try{e._afterUpdate(e._state,{beforeUpdate:e._beforeUpdateError,update:t})}catch(t){throw e._inAfterUpdate=!1,t}e._inAfterUpdate=!1,e._subscribers.slice().forEach(function(t){return e._updateSubscriber(t)}),e._afterDispatches(e._state)})},e.prototype._updateSubscriber=function(e){var t=this._calculateDiff(e.localState);Object.keys(t).length&&(e.localState=n(this._state),i.deferException(function(){return e.callback(t,e.localState)}))},e.prototype._calculateDiff=function(e){var t=this,r=Object.create(null);return Object.keys(this._state).forEach(function(n){var o=t._state[n];o!==e[n]&&(r[n]=o)}),r},e}();t.StateManager=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=function(){function e(e,t){this._inCallback=!1,this._onExit=e,this._onEnter=t||null}return e.prototype.enter=function(e){var t=this;if(this._inCallback)return e?e(this._onEnterResultRetriever):void 0;this._inCallback=!0;var r=[],o=!1;this._onEnter&&(this._onEnterResultRetriever={getResult:function(e){o?n.deferException(function(){return e(t._onEnterError,t._onEnterResult)}):r.push(e)}});try{var i=e?e(this._onEnterResultRetriever):void 0;if(this._onEnter){this._onEnterError=void 0,this._onEnterResult=void 0;try{this._onEnterResult=this._onEnter()}catch(e){this._onEnterError=e}o=!0,r.forEach(function(e){return n.deferException(function(){return e(t._onEnterError,t._onEnterResult)})})}return i}finally{this._inCallback=!1,n.deferException(function(){return t._onExit(t._onEnterError,t._onEnterResult)})}},e}();t.OnExit=o},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"IMPLEMENTATION_ERROR"},t}(o.PlayerFatalError);t.ImplementationError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(11),i=function(e){function t(t,r,n){void 0===n&&(n="The player that the proxy was controlling had an error.");var o=e.call(this,n)||this;return o._providedPlayerError=t,o._providedPlayer=r,o}return n(t,e),t.prototype.getCode=function(){return"PROXY_PLAYER_PROVIDED_PLAYER_ERROR"},t.prototype.getProvidedPlayerError=function(){return this._providedPlayerError},t.prototype.getProvidedPlayer=function(){return this._providedPlayer},t}(o.PlayerError);t.ProxyProvidedPlayerError=i},function(e,t,r){"use strict";var n=Object.create,o=Object.getPrototypeOf,i={};e.exports=function(){var e=Object.setPrototypeOf,t=arguments[0]||n;return"function"==typeof e&&o(e(t(null),i))===i}},function(e,t,r){"use strict";var n,o=r(32),i=r(0),a=Object.prototype.isPrototypeOf,s=Object.defineProperty,u={configurable:!0,enumerable:!1,writable:!0,value:void 0};n=function(e,t){if(i(e),null===t||o(t))return e;throw new TypeError("Prototype must be null or an object")},e.exports=function(e){var t,r;return e?(2===e.level?e.set?(r=e.set,t=function(e,t){return r.call(n(e,t),t),e}):t=function(e,t){return n(e,t).__proto__=t,e}:t=function e(t,r){var o;return n(t,r),o=a.call(e.nullPolyfill,t),o&&delete e.nullPolyfill.__proto__,null===r&&(r=e.nullPolyfill),t.__proto__=r,o&&s(e.nullPolyfill,"__proto__",u),t},Object.defineProperty(t,"level",{configurable:!1,enumerable:!1,writable:!1,value:e.level})):null}(function(){var e,t=Object.create(null),r={},n=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__");if(n){try{e=n.set,e.call(t,r)}catch(e){}if(Object.getPrototypeOf(t)===r)return{set:e,level:2}}return t.__proto__=r,Object.getPrototypeOf(t)===r?{level:2}:(t={},t.__proto__=r,Object.getPrototypeOf(t)===r&&{level:1})}()),r(62)},function(e,t,r){"use strict";var n=r(6),o={function:!0,object:!0};e.exports=function(e){return n(e)&&o[typeof e]||!1}},function(e,t,r){"use strict";e.exports=function(){}},function(e,t,r){"use strict";var n=r(6),o=Array.prototype.forEach,i=Object.create,a=function(e,t){var r;for(r in e)t[r]=e[r]};e.exports=function(e){var t=i(null);return o.call(arguments,function(e){n(e)&&a(Object(e),t)}),t}},function(e,t,r){"use strict";e.exports=r(71)()?String.prototype.contains:r(72)},function(e,t,r){"use strict";var n=r(12),o=r(13),i=r(73),a=r(93),s=r(94),u=r(2).iterator;e.exports=function(e){return"function"==typeof s(e)[u]?e[u]():n(e)?new i(e):o(e)?new a(e):new i(e)}},function(e,t,r){"use strict";var n,o=r(78),i=r(19),a=r(3),s=r(0),u=r(8),l=r(79),c=r(2),d=Object.defineProperty,p=Object.defineProperties;e.exports=n=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");p(this,{__list__:u("w",s(e)),__context__:u("w",t),__nextIndex__:u("w",0)}),t&&(a(t.on),t.on("_add",this._onAdd),t.on("_delete",this._onDelete),t.on("_clear",this._onClear))},delete n.prototype.constructor,p(n.prototype,i({_next:u(function(){var e;if(this.__list__)return this.__redo__&&(e=this.__redo__.shift(),void 0!==e)?e:this.__nextIndex__=this.__nextIndex__)){if(++this.__nextIndex__,!this.__redo__)return void d(this,"__redo__",u("c",[e]));this.__redo__.forEach(function(t,r){t>=e&&(this.__redo__[r]=++t)},this),this.__redo__.push(e)}}),_onDelete:u(function(e){var t;e>=this.__nextIndex__||(--this.__nextIndex__,this.__redo__&&(t=this.__redo__.indexOf(e),t!==-1&&this.__redo__.splice(t,1),this.__redo__.forEach(function(t,r){t>e&&(this.__redo__[r]=--t)},this)))}),_onClear:u(function(){this.__redo__&&o.call(this.__redo__),this.__nextIndex__=0})}))),d(n.prototype,c.iterator,u(function(){return this}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905;var n=r(4),o=r(39),i=r(10),a=r(44);t.ProxyPlayer=a.ProxyPlayer;var s=r(22);t.ProxyPlayerBase=s.ProxyPlayerBase;var u=r(46);t.errors=u.errors;var l=r(48);t.loaderErrors=l.loaderErrors;var c=r(50);t.helpers=c.helpers;var d=r(23);t.BasePlayer=d.BasePlayer;var p=r(25);t.State=p.State;var f=r(26);t.StateManager=f.StateManager;var h=r(98);t.TimeRange=h.TimeRange;var _;!function(e){e.EventDispatcher=n.EventDispatcher}(_=t.eventDispatcher||(t.eventDispatcher={}));var g;!function(e){e.LoaderRequest=o.LoaderRequest,e.ResponseState=o.ResponseState}(g=t.loader||(t.loader={}));var y;!function(e){e.noOpLogger=i.noOpLogger,e.consoleLogger=i.consoleLogger,e.prefixLogger=i.prefixLogger,e.cloneLogger=i.cloneLogger}(y=t.logger||(t.logger={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(9),i=r(4),a=r(20),s=r(1);!function(e){e[e.PENDING=0]="PENDING",e[e.WAITING=1]="WAITING",e[e.IN_PROGRESS=2]="IN_PROGRESS",e[e.COMPLETED=3]="COMPLETED",e[e.ERRORED=4]="ERRORED"}(n=t.ResponseState||(t.ResponseState={}));var u=function(){function e(){var e=this;this._responseDeferred=o.buildDeferred(),this._requestStartCallbacks=[],this._parts=[],this._progressEventDispatcher=new i.EventDispatcher,this._cachedCompleteParts=null,this._state=n.PENDING,this._statusAndHeaders=null,this._getProgressSoFar=function(){if(!e._parts.length)return null;if(!e._statusAndHeaders)throw new Error("Headers should be set.");return{initial:!0,statusCode:e._statusAndHeaders.statusCode,headers:e._statusAndHeaders.headers,part:e._getDataSoFar()}};var t=new a.AbortableJob(function(){return{result:e._responseDeferred.promise,progressUpdates:{getProgressSoFar:e._getProgressSoFar,onProgressUpdate:e._progressEventDispatcher}}},{storeResult:!0});this._jobHandle=t.run()}return e.prototype.onProgress=function(e){this._jobHandle.onProgressUpdate(e)},e.prototype.getResponse=function(){return this._jobHandle.whenComplete()},e.prototype.onRequestStart=function(e){this._state!==n.PENDING?s.deferException(e):this._requestStartCallbacks.push(e)},e.prototype.onResponseReceived=function(e){this._jobHandle.onCompletion(e)},e.prototype.onError=function(e){this._jobHandle.onError(e)},e.prototype.hasRequestStarted=function(){return this._state!==n.PENDING},e.prototype.hasCompleted=function(){return this._state===n.COMPLETED||this._state===n.ERRORED},e.prototype.getState=function(){return this._state},e.prototype.abort=function(){[n.ERRORED,n.COMPLETED].indexOf(this._state)===-1&&(this._jobHandle.abort(),this._state=n.ERRORED,this._abort())},e.prototype._signalRequestStart=function(){this._enforceState(n.PENDING),this._state=n.WAITING,this._requestStartCallbacks.splice(0).forEach(function(e){return s.deferException(e)})},e.prototype._signalTimeout=function(){this._enforceState(n.WAITING,n.IN_PROGRESS),this._state=n.COMPLETED,this._requestStartCallbacks.splice(0),this._responseDeferred.resolve(null)},e.prototype._provideStatusAndHeaders=function(e,t){this._enforceState(n.WAITING),this._statusAndHeaders=e,this._state=n.IN_PROGRESS,this._providePart(t)},e.prototype._providePart=function(e){this._enforceState(n.IN_PROGRESS);var t=!this._parts.length;if(this._parts.push(e),!this._statusAndHeaders)throw new Error("Headers should be set.");this._progressEventDispatcher.dispatch({initial:t,statusCode:this._statusAndHeaders.statusCode,headers:this._statusAndHeaders.headers,part:e})},e.prototype._finalize=function(e){var t=this;if(e)this._enforceState(n.PENDING,n.WAITING,n.IN_PROGRESS),this._state=n.ERRORED,this._requestStartCallbacks.splice(0),this._responseDeferred.reject(e);else{if(this._enforceState(n.IN_PROGRESS),this._state=n.COMPLETED,!this._statusAndHeaders)throw new Error("Headers should be set.");this._responseDeferred.resolve({statusCode:this._statusAndHeaders.statusCode,headers:this._statusAndHeaders.headers,getData:function(){if(!t._parts.length)throw new Error("Unexpected error. No parts."); +return t._cachedCompleteParts?t._cachedCompleteParts:t._cachedCompleteParts=t._getDataSoFar()}})}},e.prototype._getDataSoFar=function(){var e=this._parts.length;if(!e)throw new Error("No parts.");return 1===e?this._parts[0]:this._reduceParts(this._parts)},e.prototype._enforceState=function(){for(var e=[],t=0;t=0||void 0===n))throw o.notSupportedError;return new u(e,this._mediaElementManager)},t}(o.BaseController);t.HTML5PlayerController=s;var u=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t;var n=e.logger,o=e.playerId,i=e.urlAndRendition,u=e.streamUrlExpires,l=e.reportError,c=e.fadeOnPauseAndPlay,d=e.fadeOnSeek,p=e.releaseControl;this._logger=n;var f=i.rendition,h=i.timeRetrieved;if(u){if(void 0===h)throw new Error("Expecting timeUrlRetrieved to be set.");this._expirationConfig={urlExpires:!0,timeUrlRetrieved:h}}else this._expirationConfig={urlExpires:!1};var _=this._player=new a.HTML5Player({url:i.url,format:f.maestroFormat},{name:o,mediaElement:null,fadeSupportEnabled:c||d,defaultFadeDuration:c?void 0:0,defaultSeekFadeInDuration:d?void 0:0,defaultSeekFadeOutDuration:d?void 0:0,webAudioContext:this._mediaElementManager.getWebAudioContext(),logger:this._logger,registerListeners:function(e){var t=e.onError,n=e.onChange;t.subscribe(function(e){e instanceof a.errors.NetworkError&&r._hasExpired()?(r._logger.info("Releasing control as a network error occurred, and the URL has expired."),p({retry:!0})):(l(e.getCode()),s.errorQualifiesAbort(e)&&p({retry:!1}))}),n.subscribe(function(e){var t=e.dead,n=e.playing,o=e.actuallyPlaying,i=e.seeking,a=e.duration;return t?void p({retry:!1}):a===1/0?(r._logger.info("Releasing control because the duration was Infinity."),void p({retry:!1})):void(r._expirationConfig.urlExpires&&(n||o||i)&&r._checkIfUrlWillExpireBeforeEnd())})}});this._mediaElementManager.registerPlayer(_,function(){return p({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._config.urlAndRendition.url},e.prototype._checkIfUrlWillExpireBeforeEnd=function(){var e=this._player.getDuration(),t=this._getExpireTime();if(null!==e&&null!==t){var r=e-this._player.getPosition();i.helpers.time.now()+r>t&&(this._logger.info("Releasing control because stream URL would expire before reaching end."),this._config.releaseControl({retry:!0}))}},e.prototype._getExpireTime=function(){if(!this._expirationConfig.urlExpires)return null;var e=this._player.getDuration();return null===e?null:this._expirationConfig.timeUrlRetrieved+e+105e3},e.prototype._hasExpired=function(){var e=this._getExpireTime();return null!==e&&e<=i.helpers.time.now()},e}();t.ControlledPlayer=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(4);t.HTML5PlayerController=n.HTML5PlayerController;var o=r(2);t.MediaElementManager=o.MediaElementManager;var i=r(0);t.HTML5Player=i.HTML5Player}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=18)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t){void 0===t&&(t={});var r=e.mimeType||t.mimeType;if(!r)return null;var n=e.audioCodec||t.audioCodec,i=e.videoCodec||t.videoCodec,a=o.helpers.compact([n,i]),s=a.length>0?'; codecs="'+a.map(function(e){return e.id}).join(",")+'"':"";return r+s}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0);t.buildMimeTypeFromFormat=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when initializing web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_INITIALIZE_ERROR"},t}(o.errors.PlayerError);t.WebAudioInitializeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when activating web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_ACTIVATION_ERROR"},t}(o.errors.PlayerFatalError);t.WebAudioActivationError=i},function(e,t,r){"use strict";function n(){return"AudioContext"in window&&(a.helpers.browser.isChrome()||u&&u.major>=48||a.helpers.browser.isEdge())}function o(){if(l)return l;if(!n())throw new Error("Web audio is not enabled.");var e=new window.AudioContext;if(!e.destination.maxChannelCount)throw t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR;return l={context:e,suspender:new s.WebAudioContextSuspender(e)}}function i(e){return e.state&&e.resume&&"running"!==e.state?a.helpers.promiseWithTimeout(e.resume(),t.WEB_AUDIO_ACTIVATION_TIMEOUT,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR):a.helpers.Promise.resolve()}Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(15),u=a.helpers.browser.getFirefoxVersion();t.WEB_AUDIO_ACTIVATION_TIMEOUT=5e3,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR=new Error("Web audio activation timed out."),t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR=new Error("Web audio found no output channels.");var l=null,c=function(){function e(){}return e.prototype.getAudioContextWithSuspender=function(){return n()?o():null},e.prototype.activate=function(){if(!n())return a.helpers.Promise.resolve(void 0);try{var e=o().context;return i(e)}catch(e){return a.helpers.Promise.reject(e)}},e}();t.WebAudioContext=c},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),i=function(e){function t(t){return e.call(this,"Web audio found no channels.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_INITIALIZE_NO_CHANNELS_ERROR"},t}(o.WebAudioInitializeError);t.WebAudioInitializeNoChannelsError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(3),i=function(e){function t(t){return e.call(this,"We timed out when trying to activate web audio.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR"},t}(o.WebAudioActivationError);t.WebAudioActivationTimeoutError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){var r=e.call(this,"Unexpected error from media element.",t)||this;return r._error=t,r}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.UNEXPECTED_MEDIA_ELEMENT_ERROR_"+(this._error&&this._error.code||"UNKNWON")},t}(o.errors.PlayerFatalError);t.MediaElementError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"An unrecoverable error occurred whilst decoding.")||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.DECODE_ERROR"},t}(o.errors.PlayerFatalError);t.DecodeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"An unrecoverable network error occurred.")||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.NETWORK_ERROR"},t}(o.errors.PlayerFatalError);t.NetworkError=i},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.length,n=0;n=0)throw new Error("The same media element is currently being used in another player.");if(!this._webAudioOrchestration&&k.has(e))throw new Error("The same media element has been used in another player with fading enabled.");I.push(e);var r=this._provideMediaElementDeferred=E();return this._update(function(){t._logger.debug("provideMediaElement() called.",e),t._initMediaElementLocal(e,!1);var n=t._mediaElementAndState={element:e,state:"INITIALIZING"},o=function(){t._logger.debug("Initializing media element."),t._initMediaElement(e,!0),t._addPausedHandlers(e),t._attachListeners();var o=t._listenToOnce("error",function(){t._provideMediaElementDeferred=null;var n=e.error,o=n?n.code:"unknown";t._logger.error("Error whilst initializing media element.",o),t.revokeMediaElement(),r.reject(new Error("Error when initializing media element. Error: "+o))},{earlyAttach:!0}),i=function(){t._logger.debug("Putting media element in the state that is expected..."),a()},a=function(){null===t._getQueuedSeekPosition()&&t._positionWhenMediaElementRevoked>0?(t._logger.debug("Seeking to expected position..."),t._performSeek(t._positionWhenMediaElementRevoked,function(e){return void 0!==e?(t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to seek to the expected position."),t.revokeMediaElement(),void r.reject(new Error("An error occurred when trying to restore the position."))):(t._logger.debug("Seeked to expected position."),void s())})):s()},s=function(){t.isPlaying()===t.isActuallyPlaying()&&t._playingWhenMediaElementRevoked?(t._logger.debug("Calling play to match previous state..."),t._mediaElementPlay().catch(function(e){t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to play.",e),n===t._mediaElementAndState&&t.revokeMediaElement(),r.reject(new Error("Browser refused play() request on media element."))}),t._listenToOnce("play",function(){t._logger.debug("Play succeeded."),u()},{earlyAttach:!0})):u()},u=function(){return t._mediaElementAndState!==n?void t._triggerError(new A("Media element switched unexpectedly.")):(t._provideMediaElementDeferred=null,o.remove(),r.resolve(void 0),t._mediaElementAndState.state="STABLE",t._logger.debug("Finished putting element in expected state."),t._shouldCoverGlitch=!0,void(null!==t._duration&&t._update(function(){t.isReady()||t._signalReady(),t._handleDeferredPauseAndSeek()})))};t._listenToOnce("emptied",function(){t._logger.debug("Got emptied event from media element."),i()},{earlyAttach:!0})};t._initialized?o():t._deferredProvideMediaElementCallback=o}),r.promise},t.prototype.revokeMediaElement=function(){var e=this;if(!this._mediaElementAndState)throw new Error("There is no media element to revoke.");this._deferredProvideMediaElementCallback=null,this._provideMediaElementDeferred&&(this._provideMediaElementDeferred.reject(O),this._provideMediaElementDeferred=null),this._logger.debug("revokeMediaElement() called."),this._detachListeners();var t=this._mediaElementAndState.element,r=I.indexOf(t);r>=0&&I.splice(r,1),this._onSeekFadeOutCompleted=null,this.isDead()||(this._positionWhenMediaElementRevoked=this.getPosition(),this._playingWhenMediaElementRevoked=this.isPlaying()),this._mediaElementAndState=null,this._initMediaElement(t,!1),this._removePausedHandlers(t),this._completeCurrentFade(),this._completeSeekFadeOutAndIn(),this._update(function(){e.isDead()||(!e.isPlaying()&&e.isActuallyPlaying()&&e._notifyPlaying(!1),e._handleStalled())})},t.prototype.getBufferedTimeRanges=function(){return this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state?u.buildTimeRanges(this._mediaElementAndState.element.buffered):[]; -},t.prototype.getMaxBufferLength=function(){return null},t.prototype._hasInitialized=function(){return this._initialized},t.prototype._inferFormat=function(e){var t=b(e);switch(t){case"mp3":return{mimeType:"audio/mpeg"};case"opus":return{mimeType:"audio/ogg",audioCodec:{id:"opus"}};case"mp4":return{mimeType:"video/mp4"};case"m4a":return{mimeType:"audio/mp4"};case"m3u8":return{mimeType:"application/x-mpegURL"};default:return{}}},t.prototype._canPlayType=function(e){return i(e)},t.prototype._initialize=function(){var e=this;this._initialized=!0,this._listenTo("error",function(){if("INITIALIZING"===e._mediaElementAndState.state)return void e._logger.debug("An error occurred, but the media element is initializing, so ignoring...");var t=e._mediaElementAndState.element.error;switch(t&&t.code){case 2:e._triggerError(new c.NetworkError);break;case 3:e._triggerError(new d.DecodeError);break;default:e._logger.error("Unexpected error from media element.",t&&t.code,t&&t.message),e._triggerError(new p.MediaElementError(t))}},{earlyAttach:!0}),this._listenTo("play",function(){e._logger.debug("Media element play event."),e.isPlaying()||e.isActuallyPlaying()||!e._mediaElementAndState||e._isMediaElementPaused(e._mediaElementAndState.element)||(e._logger.debug("Calling play() because something external called play() on media element."),e.play())}),this._listenTo("playing",function(){e._logger.debug("Media element playing event."),e._mediaElementAndState&&!e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePlayingEvent():e._logger.debug("Ignoring playing event because media element is reporting it is paused.")}),this._listenTo("timeupdate",function(){return e._determineIfPlaying()}),this._listenTo("pause",function(){e._logger.debug("Media element pause event."),e._mediaElementAndState&&e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePauseEvent():e._logger.debug("Ignoring pause event because media element is reporting it is not paused.")}),this._listenTo("ended",function(){e._logger.debug("Media element ended event."),e._mediaElementAndState&&e._mediaElementAndState.element.ended?e._handleEndedEvent():e._logger.debug("Ignoring ended event because media element is reporting it is not ended.")}),this._listenTo("stalled",function(){e._logger.debug("Media element stalled event."),e._checkIfStalled()}),this._listenTo("volumechange",function(){e._mediaElementAndState&&e._notifyVolumeChangeFromMediaEl(e._mediaElementAndState.element)}),this._stallCheckTimerId=window.setInterval(function(){return e._checkIfStalled()},D),this._deferredProvideMediaElementCallback&&this._deferredProvideMediaElementCallback()},t.prototype._handleDurationChange=function(){var e=this,t=this._duration;null!==t&&this._update(function(){e._provideDuration(t),e._mediaElementAndState&&"STABLE"===e._mediaElementAndState.state&&(e._signalReady(),e._handleDeferredPauseAndSeek())})},t.prototype._createDefaultMediaElement=function(){return document.createElement(this._playerDependencies.mediaElementType||"audio")},t.prototype._handlePauseEvent=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element should exist.");var t=this._mediaElementAndState.element;this.isActuallyPlaying()&&this._update(function(){t.ended||(e._notifyNotStalled(),e._completeCurrentFade(),e._completeSeekFadeOutAndIn(),e._notifyPlaying(!1))})},t.prototype._handlePlayingEvent=function(){var e=this,t=this._duration;if(null===t)throw new Error("Expecting duration to exist.");var r=this._getTruePosition();return r>=t?void this._logger.warn("Got a media element playing event and the positon was >= the duration.",r,t):this.isEnded()||this._shouldBeEnded()?void this._logger.warn("Got a media element playing event when the player is/should be ended."):void this._update(function(){e._notifyNotStalled(),e._determineIfPlaying(),e.isActuallyPlaying()||(e._playDetectionTimerNumAttempts=0,e._playDetectionTimer||(e._playDetectionTimer=window.setInterval(function(){return e._determineIfPlaying()},T)))})},t.prototype._handleEndedEvent=function(){return null!==this._getQueuedSeekPosition()?void this._logger.warn("Got a media element ended event but ignoring because a seek is in progress."):void this._update()},t.prototype._shouldBeEnded=function(){return this._endedOverride||this._mediaElementReportingEnded()},t.prototype._mediaElementReportingEnded=function(){return!!(this._mediaElementAndState&&this._mediaElementAndState.element.ended&&this._mediaElementAndState.element.paused)},t.prototype._handleDurationUpdates=function(){var e=this;this._listenToOnce("loadedmetadata",function(){return e._updateDurationFromMediaElement()},{reattach:!0,earlyAttach:!0}),this._listenTo("durationchange",function(){return e._updateDurationFromMediaElement()})},t.prototype._updateDurationFromMediaElement=function(){var e=this._mediaElementAndState;e&&(this._duration=1e3*e.element.duration,this._handleDurationChange())},t.prototype._handlePlayPauseChange=function(e,t){var r=this,n=t.fadeRate;this._fadeRate=n||null;var o=function(){r._mediaElementAndState&&"USABLE"===r._mediaElementAndState.state&&r._callMediaElementPause(r._mediaElementAndState.element),r._notifyFading(!1),r._completeSeekFadeOutAndIn(),r._notifyPlaying(!1)};if(this.isEnded())e?this._notifyPlaying(!0):o();else if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state){var i=this._playInProgress.inProgress||!this._isMediaElementPaused(this._mediaElementAndState.element);e&&!i?(this._fadeManagers&&this._fadeManagers.pausePlay.performFade(-(1/0)),this._playDetectionPosition=this._getTruePosition(),this._play(function(e){return r._notifyPlayRejection(e)})):!e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.UP?(r._notifyFading(!0),r._fadeManagers.pausePlay.performFade(n||-(1/0),function(){return o()})):o()}):e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.DOWN&&r._fadeManagers.pausePlay.performFade(n||1/0,function(){return r._notifyFading(!1)}),r._notifyPlaying(!0)}):this._notifyPlaying(e)}},t.prototype._handleVolumeChange=function(e,t){if(this._mediaElementAndState){var r=this._mediaElementAndState.element;r.muted=t,r.volume=e,this._notifyVolumeChangeFromMediaEl(r)}else this._muted=t,this._volume=e,this._notifyVolumeChange(e,t)},t.prototype._handleSeekChange=function(e,t){var r=this,n=t.fadeRate;this._seekFadeRate=n,this._fadeRateAfterSeek=n.afterSeek||1/0;var o=this._mediaElementAndState;if(o&&"USABLE"===o.state){this._onSeekFadeOutCompleted=function(){r._onSeekFadeOutCompleted=null,a&&a.remove(),i&&i.seek.getDirection()===l.FadeDirection.DOWN&&(r._logger.debug("Fade out for seek completed.",e,n),i.seek.performFade(-(1/0)),r._notifyFadingForSeek(!1));var t=r._mediaElementReportingEnded();r._endedOverride=!1,r._performSeek(e,function(t){return void 0!==t?void r._triggerError(new s.errors.PlayerFatalError("An error occurred when trying to seek.",t)):(e===r._duration&&(r._endedOverride=!0),void r._update(function(){r.isActuallyPlaying()&&r._assumeStalled(),r._signalSeekComplete(),i&&(!r.isActuallyPlaying()||r._fadeRateAfterSeek===1/0||r.isEnded()?i.seek.performFade(1/0):r._notifyFadingForSeek(!0))}))}),t&&r.isPlaying()&&r._play(function(e){r._triggerError(new s.errors.PlayerFatalError("Error when trying to play after seek from end.",e))})},this._fadeEndedHandle&&(this._fadeEndedHandle.remove(),this._fadeEndedHandle=null);var i=this._fadeManagers,a=null,u=function(){r._onSeekFadeOutCompleted&&r._onSeekFadeOutCompleted()};this._update(function(){i&&(n.beforeSeek||n.afterSeek)?(r._logger.debug("Fading out ready for seek.",e,n),(i.seek.getDirection()===l.FadeDirection.UP||i.seek.isFading())&&r.isActuallyPlaying()&&n.beforeSeek&&!r._mediaElementReportingEnded()?(r._notifyFadingForSeek(!0),a=r._fadeEndedHandle=r._listenToOnce("ended",u),i.seek.performFade(n.beforeSeek||-(1/0),u)):(i.seek.performFade(-(1/0)),u())):u()})}},t.prototype._performSeek=function(e,t){var r=this,n=this._mediaElementAndState;if(!n)throw new Error("Media element does not exist.");var o=this._currentSeek;o&&(this._currentSeek=null,o.abort());var i=n.element;if(i.currentTime===e/1e3)return void t();var a=0,s=function(){var n=[],o=function(){r._currentSeek&&(r._currentSeek.abort(),r._currentSeek=null),t()};try{i.currentTime=e/1e3}catch(t){r._logger.warn("Error when trying to seek.",t,e)}r._playDetectionPosition=1e3*i.currentTime;var u=window.setTimeout(function(){r._logger.warn("Seek attempt failed. Retrying...",e,a),l(),s()},N(++a));n.push(r._listenToOnce("seeking",function(){window.clearTimeout(u)},{earlyAttach:!0})),n.push(r._listenToOnce("seeked",function(){var t=1e3*i.currentTime;Math.abs(t-e)<=100?o():(r._logger.warn("Seek attempt failed. Incorect position. Retrying...",t,e),l(),s())},{earlyAttach:!0}));var l=function(){n.forEach(function(e){return e.remove()}),window.clearTimeout(u)};r._currentSeek={abort:l}};s()},t.prototype._getPosition=function(){var e=null!==this._duration?this._duration:1/0;if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)return this._positionWhenMediaElementRevoked;this._determineIfPlaying();var t=Math.min(this._getTruePosition(),e);return this._shouldBeEnded()?e:t},t.prototype._getTruePosition=function(){if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)throw new Error("Media element does not exist or is in invalid state.");var e=this._mediaElementAndState.element;return 1e3*e.currentTime},t.prototype._kill=function(){window.clearTimeout(this._canPlayTimer),this._playDetectionTimer&&window.clearInterval(this._playDetectionTimer),this._mediaElementAndState&&this.revokeMediaElement(),this._stallCheckTimerId&&window.clearInterval(this._stallCheckTimerId),this._webAudioOrchestration&&this._webAudioOrchestration.gainNodes.glitchCoverup.disconnect(this._webAudioOrchestration.context.destination),this._listeners=[]},t.prototype._listenToOnce=function(e,t,r){void 0===r&&(r={});var n=r.reattach,o=r.earlyAttach;void 0===n&&(n=!1),void 0===o&&(o=!1);var i=function(e){a.remove(),t(e)},a=this._listenTo(e,i,{reattach:n,earlyAttach:o});return a},t.prototype._listenTo=function(e,t,r){var n=this;void 0===r&&(r={});var o=r.reattach,i=r.earlyAttach;void 0===o&&(o=!0),void 0===i&&(i=!1);var a=function(r){if(s.attachedToElement)switch(e){case"play":var o=n._mediaElPlayShouldBeAborted.get(s.attachedToElement);if(n._mediaElPlayShouldBeAborted.delete(s.attachedToElement),o){n._logger.warn("Calling pause() on media element because the play request should have been rejected."),s.attachedToElement.pause();break}default:t(r)}else n._logger.warn("Got media element event after handler was removed. Ignoring.",r)},s={attachedToElement:null,handler:a,eventType:e,once:!1,reattach:o,earlyAttach:i};if(this._listeners.push(s),!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state&&!i)return{remove:function(){var e=n._listeners.indexOf(s);e>=0&&n._listeners.splice(e,1)}};var u=this._mediaElementAndState.element;return u.addEventListener(e,a,!1),s.attachedToElement=u,{remove:function(){var t=n._listeners.indexOf(s);t>=0&&(n._listeners.splice(t,1),s.attachedToElement=null,u.removeEventListener(e,a,!1))}}},t.prototype._notifyNotStalled=function(){this._stallDetected=!1,this._lastStallCheckPos=null,this._handleStalled()},t.prototype._assumeStalled=function(){this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&(this._lastStallCheckPos=this._mediaElementAndState.element.currentTime,this._timeWhenPositionChanged=0,this._stallDetected=!0,this._handleStalled())},t.prototype._initMediaElement=function(e,t){this._initMediaElementLocal(e,t)},t.prototype._callMediaElementPlay=function(e){var t=this;P.isEdge()&&this._mediaElPlayShouldBeAborted.set(e,!1);var r=this._mediaElPaused.get(e);r&&(r.paused=!1);var n=this._mediaElPlayTracker={},o=e.play();return r&&o&&o.catch&&o.catch(function(){n===t._mediaElPlayTracker&&(r.paused=!0)}),o},t.prototype._callMediaElementPause=function(e){this._playInProgress.inProgress=!1,P.isEdge()&&this._mediaElPlayShouldBeAborted.has(e)&&this._mediaElPlayShouldBeAborted.set(e,!0);var t=this._mediaElPaused.get(e);t&&(t.paused=!0),e.pause()},t.prototype._isMediaElementPaused=function(e){var t=this._mediaElPaused.get(e);return!t||t.paused},t.prototype._completeCurrentFade=function(){var e=this._fadeManagers;e&&(e.pausePlay.performFade(this.isPlaying()?1/0:-(1/0)),this.isDead()||this._notifyFading(!1))},t.prototype._completeSeekFadeOutAndIn=function(){var e=this,t=this._fadeManagers;t&&this._update(function(){t.seek.performFade(1/0),e.isDead()||(e._notifyFadingForSeek(!1),e._onSeekFadeOutCompleted&&e._onSeekFadeOutCompleted())})},t.prototype._determineIfPlaying=function(){var e=this;this._playDetectionTimer&&(!this.isPlaying()||++this._playDetectionTimerNumAttempts>=M)&&(window.clearInterval(this._playDetectionTimer),this._playDetectionTimer=null),this._update(function(){e._mediaElementAndState&&"USABLE"===e._mediaElementAndState.state&&(e.isDead()||!e.isReady()||!e.isPlaying()||e.isActuallyPlaying()||e._isMediaElementPaused(e._mediaElementAndState.element)||e._getTruePosition()===e._playDetectionPosition||(e._logger.debug("Detected that playback has started."),e._playDetectionTimer&&(window.clearInterval(e._playDetectionTimer),e._playDetectionTimer=null),e._notifyPlaying(!0),e._fadeManagers&&(e._notifyFading(!0),e._fadeManagers.pausePlay.performFade(e._fadeRate||1/0,function(){return e._notifyFading(!1)}))))})},t.prototype._initMediaElementLocal=function(e,t){if(e.setAttribute("msAudioCategory","BackgroundCapableMedia"),e.mozAudioChannelType="content",e.removeAttribute("src"),o(e),this._activateWebAudio(),this._pauseEventTimer&&(this._logger.debug("Clearing pause event timer."),window.clearTimeout(this._pauseEventTimer),this._pauseEventTimer=null),this._webAudioOrchestration&&this._webAudioOrchestration.mediaElementSource&&(this._logger.debug("Disconnecting media element from gain node."),this._webAudioOrchestration.mediaElementSource.disconnect(this._webAudioOrchestration.gainNodes.pausePlay),this._webAudioOrchestration.mediaElementSource=void 0),this._currentSeek&&(this._logger.debug("Aborting seek attempt."),this._currentSeek.abort(),this._currentSeek=null),t){this._webAudioOrchestration&&(this._logger.debug("Adding crossorigin attribute to media element because fading enabled."),e.setAttribute("crossorigin","anonymous"));var r=this._getUrlForMediaElement();if(this._logger.debug("Setting media element src.",r),e.src=r,e.volume=this._volume,e.muted=this._muted,this._webAudioOrchestration&&this._fadeManagers){this._logger.debug("Creating media element source node...");var n=k.get(e);if(n?this._logger.debug("Reusing media element source node."):(n=this._webAudioOrchestration.context.createMediaElementSource(e),k.set(e,n)),this._webAudioOrchestration.mediaElementSource=n,n.connect(this._webAudioOrchestration.gainNodes.pausePlay),this._logger.debug("Created media element source node."),this._shouldCoverGlitch){var i=this._webAudioOrchestration.context.currentTime,a=this._webAudioOrchestration.gainNodes.glitchCoverup;a.gain.setValueAtTime(0,i),a.gain.setValueAtTime(1,i+.1),this._shouldCoverGlitch=!1}}}e.playbackRate=1,e.setAttribute("preload","metadata"),this._callMediaElementPause(e),e.load()},t.prototype._addPausedHandlers=function(e){var t={removeListeners:function(){e.removeEventListener("play",r),e.removeEventListener("playing",r),e.removeEventListener("pause",r),e.removeEventListener("ended",r)},paused:!1},r=function(){t.paused=e.paused};r(),e.addEventListener("play",r),e.addEventListener("playing",r),e.addEventListener("pause",r),e.addEventListener("ended",r),this._mediaElPaused.set(e,t)},t.prototype._removePausedHandlers=function(e){var t=this._mediaElPaused.get(e);t&&t.removeListeners(),this._mediaElPaused.delete(e)},t.prototype._checkIfStalled=function(){if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&this.isActuallyPlaying()){var e=this._mediaElementAndState.element,t=e.currentTime,r=s.helpers.time.now();t!==this._lastStallCheckPos&&(this._timeWhenPositionChanged=r),this._stallDetected=e.readyState<=2||this._timeWhenPositionChanged<=r-x,this._lastStallCheckPos=t,this._handleStalled()}},t.prototype._handleStalled=function(){this._shouldBeEnded()&&null===this._getQueuedSeekPosition()?this.isEnded()||(this._logger.debug("Updating because stalled near end."),this._update()):this._notifyStalled(this._stallDetected||!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)},t.prototype._play=function(e){var t=this,r=this._activateWebAudio(),n={inProgress:!0};this._playInProgress=n,this._mediaElementPlay().then(function(){n.inProgress=!1,r.catch(function(e){t._logger.error("Error activating web audio.",e),e===v.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR?t._triggerError(new h.WebAudioActivationTimeoutError):t._triggerError(new y.WebAudioActivationError)})}).catch(function(r){return t._playInProgress!==n?void t._logger.debug("Ignoring play error because paused since.",r):(n.inProgress=!1,void(e&&e(r)))})},t.prototype._mediaElementPlay=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");if(this._mediaElementReportingEnded())return this._logger.debug("Not calling play() because we are at the end. It will be called after a seek."),w.resolve();var t=this._mediaElementAndState.element,r=this._callMediaElementPlay(t);return new w(function(t,n){r?(r=r.then(function(){return t()}),r.catch&&(r=r.catch(function(r){"AbortError"===r.name?(e._logger.debug("Media element play() promise rejected with AbortError."),t()):n(r)}))):t()})},t.prototype._notifyVolumeChangeFromMediaEl=function(e){this._volume=e.volume,this._muted=e.muted,this._notifyVolumeChange(e.volume,e.muted)},t.prototype._initWebAudio=function(){try{var e=this._webAudioContext.getAudioContextWithSuspender();if(!e)return this._logger.debug("WebAudio not supported/enabled."),null;this._logger.debug("WebAudio supported.");var t=e.context,r=e.suspender;r.watchPlayer(this);var n=t.createGain(),o=t.createGain(),i=t.createGain();return n.connect(o),o.connect(i),i.connect(t.destination),{context:t,suspender:r,gainNodes:{glitchCoverup:i,pausePlay:n,seek:o}}}catch(e){return e===v.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR?this._triggerError(new g.WebAudioInitializeNoChannelsError(e)):this._triggerError(new _.WebAudioInitializeError(e)),this._logger.error("Failed initializing web audio.",e),null}},t.prototype._activateWebAudio=function(){return this._webAudioOrchestration?this._webAudioContext.activate():w.resolve(void 0)},t.prototype._handleDeferredPauseAndSeek=function(){var e=this;if(!this._mediaElementAndState||"STABLE"!==this._mediaElementAndState.state)throw new Error("Media element must be in the STABLE state.");this._logger.debug("Handling deferred pause and seek..."),this._mediaElementAndState.state="USABLE",this._attachListeners(),this._update(function(){e._handleStalled();var t=e._getQueuedSeekPosition();if(null!==t){var r=e._seekFadeRate?e._seekFadeRate.afterSeek:void 0;e._handleSeekChange(t,{fadeRate:{afterSeek:r}})}e.isPlaying()!==e.isActuallyPlaying()&&e._handlePlayPauseChange(e.isPlaying(),{fadeRate:e._fadeRate||void 0})})},t.prototype._detachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");var e=this._mediaElementAndState.element;this._listeners.forEach(function(t){t.attachedToElement&&(t.attachedToElement=null,e.removeEventListener(t.eventType,t.handler,!1))}),this._listeners=this._listeners.filter(function(e){return e.reattach})},t.prototype._attachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");this._logger.debug("Attaching listeners...");var e=this._mediaElementAndState,t=e.element,r=e.state;this._listeners.forEach(function(e){e.attachedToElement||!e.reattach||"USABLE"!==r&&!e.earlyAttach||(t.addEventListener(e.eventType,e.handler,!1),e.attachedToElement=t)}),this._logger.debug("Attached listeners.")},t}(s.BasePlayer);t.HTML5PlayerBase=L},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(10),i=r(1);!function(e){var t;!function(e){e.buildTimeRanges=o.buildTimeRanges}(t=e.timeRanges||(e.timeRanges={}));var r;!function(e){e.buildMimeTypeFromFormat=i.buildMimeTypeFromFormat}(r=e.mimeType||(e.mimeType={}))}(n=t.helpers||(t.helpers={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(8),i=r(9),a=r(7),s=r(2),u=r(5),l=r(3),c=r(6);!function(e){e.DecodeError=o.DecodeError,e.NetworkError=i.NetworkError,e.MediaElementError=a.MediaElementError,e.WebAudioInitializeError=s.WebAudioInitializeError,e.WebAudioInitializeNoChannelsError=u.WebAudioInitializeNoChannelsError,e.WebAudioActivationError=l.WebAudioActivationError,e.WebAudioActivationTimeoutError=c.WebAudioActivationTimeoutError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(11),a=r(1),s=o.helpers.Promise,u=function(e){function t(t,r){var n=e.call(this,r)||this;return n._descriptor=t,n._mimeType=t.format.mimeType||a.buildMimeTypeFromFormat(t.format,n._inferFormat(t.url)),n}return n(t,e),t.prototype._getUrlForMediaElement=function(){return this._descriptor.url},t.prototype._canPlay=function(){return this._mimeType&&this._canPlayType(this._mimeType)?s.resolve(!0):s.resolve(!1)},t}(i.HTML5PlayerBase);t.HTML5Player=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=2e4,o=function(){function e(e,t){void 0===t&&(t=n),this._audioContext=e,this._idleTime=t,this._players=[],this._prevPlayingCount=0,this._playingCount=0,this._timerId=null,this._suspendTimerId=null,this._suspendSupported="function"==typeof e.suspend}return e.prototype.watchPlayer=function(e){var t=this;!this._suspendSupported||e.isDead()||this._players.indexOf(e)>=0||(e.onChange.subscribe(function(r){var n=r.dead,o=r.playing;if(void 0!==o&&t._handleCountChange(o),n){var i=t._players.indexOf(e);i>=0&&(t._players.splice(i,1),!t._players.length&&t._suspendTimerId&&(window.clearInterval(t._suspendTimerId),t._suspendTimerId=null))}}),this._players.length||(this._suspendTimerId=window.setInterval(function(){0===t._playingCount&&null===t._timerId&&"suspended"!==t._audioContext.state&&t._scheduleSuspend(5e3)},5e3)),this._players.push(e),e.isPlaying()&&this._handleCountChange(!0))},e.prototype._handleCountChange=function(e){e?this._playingCount++:this._playingCount--,this._playingCount!==this._prevPlayingCount&&(this._prevPlayingCount=this._playingCount,0===this._playingCount?this._scheduleSuspend(this._idleTime):1===this._playingCount&&this._abortSuspend())},e.prototype._scheduleSuspend=function(e){var t=this;this._timerId=window.setTimeout(function(){t._timerId=null,t._audioContext.suspend()},e)},e.prototype._abortSuspend=function(){this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null)},e}();t.WebAudioContextSuspender=o},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred when initializing the media element.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}Object.defineProperty(t,"__esModule",{value:!0});var o;!function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(o=t.FadeDirection||(t.FadeDirection={}));var i=function(){function e(e,t){this._context=e,this._gain=t,this._currentFade={startTime:0,startValue:1,rate:0},this._fadeEndTimer=null}return e.prototype.isFading=function(){return!!this._fadeEndTimer},e.prototype.getDirection=function(){var e=this._currentFade,t=e.rate,r=e.startValue;return 0===t?0===r?o.DOWN:o.UP:t<0?o.DOWN:o.UP},e.prototype.performFade=function(e,t){var r=this;if(0===e)throw new Error("Rate cannot be 0.");this._fadeEndTimer&&window.clearTimeout(this._fadeEndTimer);var o=this._context.currentTime,i=this._gain;if(e===1/0||e===-(1/0)){i.gain.cancelScheduledValues(o);var a=e===1/0?1:0;i.gain.setValueAtTime(a,o),this._currentFade={startTime:o,startValue:a,rate:0},this._fadeEndTimer=null,t&&t()}else{var s=this._currentFade,u=n(0,1,s.startValue+1e3*s.rate*(o-s.startTime)),l=e>0?1-u:u,c=l*(1/Math.abs(1e3*e)),d=o+c;this._currentFade={startTime:o,rate:e,startValue:u},i.gain.cancelScheduledValues(o),i.gain.setValueAtTime(u,o),i.gain.linearRampToValueAtTime(e>0?1:0,d),this._fadeEndTimer=window.setTimeout(function(){r._fadeEndTimer=null,t&&t()},1e3*c)}},e}();t.FadeManager=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(11);t.HTML5PlayerBase=n.HTML5PlayerBase;var o=r(14);t.HTML5Player=o.HTML5Player;var i=r(13);t.errors=i.errors;var a=r(12);t.helpers=a.helpers;var s=r(4);t.WebAudioContext=s.WebAudioContext}])})},function(e,t,r){!function(t,n){e.exports=n(r(6),r(10),r(11),r(2),r(3),r(1))}(window,function(e,t,r,n,o,i){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i},function(e,t,r){"use strict";function n(e){return e.match(d)[0]}var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=r(5),a=r(4),s=r(3),u=r(2),l=r(1),c=r(0),d=/^[^\?#]*/,p=function(e){function t(t){var r=e.call(this)||this;return r._mediaElementManager=t,r.name="MaestroHLSMSE",r}return o(t,e),t.prototype.isRenditionSupported=function(e){return["hls","encrypted-hls"].indexOf(e.scProtocol)!==-1&&c.HLSMSEPlayer.isFormatSupported(e.maestroSegmentFormat||{})},t.prototype.buildPlayer=function(e){return new f(e,this._mediaElementManager)},t}(i.BaseController);t.HLSMSEPlayerController=p;var f=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t,this._urlRefreshRetrieveHandle=null;var o=e.logger,i=e.playerId,u=e.urlAndRendition,l=e.streamUrlExpires,d=e.reportError,p=e.fadeOnPauseAndPlay,f=e.fadeOnSeek,h=e.releaseControl,_=e.getNewUrl;this._currentUrl=u.url;var g=u.rendition.maestroSegmentFormat||{},y=this._buildPlaylist(u.url),v=this._player=new c.HLSMSEPlayer({playlist:y,segmentFormat:g},{name:i,mediaElement:null,fadeSupportEnabled:p||f,defaultFadeDuration:p?void 0:0,defaultSeekFadeInDuration:f?void 0:0,defaultSeekFadeOutDuration:f?void 0:0,logger:o,registerListeners:function(e){var t=e.onError,i=e.onChange;t.subscribe(function(e){if(l){if(e instanceof s.errors.URLUpdateError)return o.error("URL refresh failed for some reason.",e),void h({retry:!0});if(r._isErrorWhichShouldTriggerURLRefresh(e)){if(r._urlRefreshRetrieveHandle)return void o.debug("Got a 403 status code, but URL refresh already in progress.");o.info("Got a 403 status code. Peforming a URL refresh...");var t=r._urlRefreshRetrieveHandle=_();return void t.whenComplete().then(function(e){r._urlRefreshRetrieveHandle=null,e?n(e)!==n(r._currentUrl)?(o.warn("Got a new URL but the rendition did not match the original."),h({retry:!1})):(r._currentUrl=e,o.info("Got a new URL. Updating..."),v.switchPlaylist(r._buildPlaylist(e))):(o.warn("Could not get a new URL."),h({retry:!1}))}).catch(function(e){o.error("Unexpected error when trying to retrieve a new URL.",e),h({retry:!1})})}}d(e.getCode()),a.HTML5PlayerController.errorQualifiesAbort(e)&&h({retry:!1})}),i.subscribe(function(e){var t=e.dead;t&&(r._urlRefreshRetrieveHandle&&(r._urlRefreshRetrieveHandle.abort(),r._urlRefreshRetrieveHandle=null),h({retry:!1}))})}});this._mediaElementManager.registerPlayer(v,function(){return h({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._currentUrl},e.prototype._buildPlaylist=function(e){var t=new u.ArrayBufferLoader({fetchEnabled:this._config.fetchEnabled});return new l.PlaylistHLS({url:e,playlistLoader:u.stringLoader,segmentLoader:t,keyLoader:t,segmentFormat:this._config.urlAndRendition.rendition.maestroSegmentFormat||{},logger:this._config.logger})},e.prototype._isErrorWhichShouldTriggerURLRefresh=function(e){if(e instanceof c.errors.RetrievalError){var t=e.getCause();if(t instanceof c.retrievalErrors.UnacceptableResponseStatusCodeError)return 403===t.getStatusCode()}return!1},e}();t.ControlledPlayer=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(6);t.HLSMSEPlayerController=n.HLSMSEPlayerController;var o=r(0);t.HLSMSEPlayer=o.HLSMSEPlayer}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(4),r(7))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=15)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.PLAYLIST_UPDATE_ERROR"},t}(o.errors.PlayerFatalError);t.PlaylistUpdateError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"A transmuxer could not be found.")||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"; -},t}(o.errors.NotSupportedError);t.NoTransmuxerError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){var r=e.call(this,"An error occurred when trying to retrieve a playlist/segment/key.",t)||this;return r._internalRetrievalError=t,r}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.RETRIEVAL_ERROR."+this._internalRetrievalError.getCode()},t}(o.errors.PlayerError);t.RetrievalError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to initialize the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to append to the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.APPEND_ERROR"},t}(o.errors.PlayerError);t.AppendError=i},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(5),i=r(4),a=r(1),s=r(2),u=r(3);!function(e){e.AppendError=o.AppendError,e.InitializeError=i.InitializeError,e.PlaylistUpdateError=a.PlaylistUpdateError,e.NoTransmuxerError=s.NoTransmuxerError,e.RetrievalError=u.RetrievalError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.eventDispatcher.EventDispatcher,i=n.logger.prefixLogger,a=n.logger.noOpLogger,s=15e3,u=2e4,l=function(){function e(e,t,r,n,s){void 0===s&&(s=a);var u=this;this._onAppendQueued=new o,this._onAppendEnd=new o,this._needsInitData=!0,this._updateTimerId=null,this._gcTimerId=null,this._waitingForData=!1,this._started=!1,this._error=null,this._currentRetrieveHandle=null,this._logger=i(s,"SimpleMSE"),this.onAppendQueued=this._onAppendQueued.getHandle(),this.onAppendEnd=this._onAppendEnd.getHandle(),this._mse=e,this._getNextSegmentData=t,this._getPosition=r,this._onError=n,e.whenInitialized().then(function(){!u._error&&u._started&&(u._logger.debug("MSE initialized. Preparing to update."),u._prepareUpdate())}).catch(function(e){u._error||(u._logger.error("Error when waiting for MSE to initialize.",e),u._handleError(e||new Error("Error waiting for MSE to initialize.")))})}return e.prototype.start=function(){if(this._checkNotErrored(),this._started)throw new Error("Already started.");this._logger.debug("start() called."),this._scheduleGC(),this._started=!0,this._prepareUpdate()},e.prototype.kill=function(){this._error||(this._logger.debug("kill() called."),this._error=new Error("Killed."),this._clearTimers(),this._logger.debug("Killed."))},e.prototype.waitingForSegmentData=function(){return this._checkNotErrored(),this._waitingForData},e.prototype.provideNextSegmentData=function(e){if(this._checkNotErrored(),!this._waitingForData)throw new Error("Not waiting for data.");this._logger.debug("Segment data provided."),this._waitingForData=!1,this._update(e)},e.prototype._prepareUpdate=function(){if(!this._updateTimerId){var e=this._mse;if(e.hasInitialized()){var t=n.TimeRange.getCoverage(e.getBuffered());if(t.end<=this._getPosition()+s){this._logger.debug("Requesting next segment data.");var r=this._getNextSegmentData();r?(this._logger.debug("Got segment data."),this._update(r)):(this._logger.debug("Did not get any data."),this._waitingForData=!0)}else this._scheduleUpdate()}}},e.prototype._gc=function(){var e=this,t=this._mse;if(!t.hasInitialized())return void this._scheduleGC();var r=n.TimeRange.getCoverage(t.getBuffered()),o=this._getPosition()-5e3;if(r.start0?Math.floor(e):Math.ceil(e)}function d(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,u=W;for(n=0;n=u?1:0,a[n]=r-s*u;for(;n0&&a.push(s),a}function p(e,t){return e.length>=t.length?d(e,t):d(t,e)}function f(e,t){var r,n,o=e.length,i=new Array(o),a=W;for(n=0;n0;)i[n++]=t%a,t=Math.floor(t/a);return i}function h(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,l=W;for(r=0;r=0?i=h(e,t):(i=h(t,e),o=!o),i=s(i),"number"==typeof i?(o&&(i=-i),new n(i)):new r(i,o)}function g(e,t,o){var i,a,u=e.length,l=new Array(u),c=-t,d=W;for(i=0;i0;)i[n++]=s%a,s=Math.floor(s/a);return i}function m(e,t){for(var r=[];t-- >0;)r.push(0);return r.concat(e)}function E(e,t){var r=Math.max(e.length,t.length);if(r<=30)return y(e,t);r=Math.ceil(r/2);var n=e.slice(r),o=e.slice(0,r),i=t.slice(r),a=t.slice(0,r),s=E(o,a),l=E(n,i),c=E(p(o,n),p(a,i)),d=p(p(s,m(h(h(c,s),l),r)),m(l,2*r));return u(d),d}function b(e,t){return-.012*e-.012*t+15e-6*e*t>0}function w(e,t,n){return e=0;n--){for(r=f-1,y[n+p]!==_&&(r=Math.floor((y[n+p]*f+y[n+p-1])/_)),o=0,i=0,u=m.length,a=0;ac&&(o=(o+1)*f),r=Math.ceil(o/i);do{if(a=v(t,r),T(a,p)<=0)break;r--}while(r);d.push(r),p=h(p,a)}return d.reverse(),[s(d),s(p)]}function A(e,t){var r,n,o,i,a=e.length,s=l(a),u=W;for(o=0,r=a-1;r>=0;--r)i=o*u+e[r],n=c(i/t),o=i-n*t,s[r]=0|n;return[s,0|o]}function O(e,o){var i,u,l=V(o),d=e.value,p=l.value;if(0===p)throw new Error("Cannot divide by zero");if(e.isSmall)return l.isSmall?[new n(c(d/p)),new n(d%p)]:[t[0],e];if(l.isSmall){if(1===p)return[e,t[0]];if(p==-1)return[e.negate(),t[0]];var f=Math.abs(p);if(ft.length?1:-1;for(var r=e.length-1;r>=0;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function M(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(25)||void 0))}function x(e){return("number"==typeof e||"string"==typeof e)&&+Math.abs(e)<=W||e instanceof r&&e.value.length<=1}function D(e,t,r){t=V(t);for(var n=e.isNegative(),i=t.isNegative(),a=n?e.not():e,s=i?t.not():t,u=0,l=0,c=null,d=null,p=[];!a.isZero()||!s.isZero();)c=O(a,$),u=c[1].toJSNumber(),n&&(u=$-1-u),d=O(s,$),l=d[1].toJSNumber(),i&&(l=$-1-l),a=c[0],s=d[0],p.push(r(u,l));for(var f=o(0!==r(n?1:0,i?1:0)?-1:0),h=p.length-1;h>=0;h-=1)f=f.multiply($).add(o(p[h]));return f}function I(e){var t=e.value,r="number"==typeof t?t|ee:t[0]+t[1]*W|te;return r&-r}function k(e,t){if(t.compareTo(e)<=0){var r=k(e,t.square(t)),n=r.p,i=r.e,a=n.multiply(t);return a.compareTo(e)<=0?{p:a,e:2*i+1}:{p:n,e:2*i}}return{p:o(1),e:0}}function C(e,t){return e=V(e),t=V(t),e.greater(t)?e:t}function N(e,t){return e=V(e),t=V(t),e.lesser(t)?e:t}function L(e,r){if(e=V(e).abs(),r=V(r).abs(),e.equals(r))return e;if(e.isZero())return r;if(r.isZero())return e;for(var n,o,i=t[1];e.isEven()&&r.isEven();)n=Math.min(I(e),I(r)),e=e.divide(n),r=r.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(I(e));do{for(;r.isEven();)r=r.divide(I(r));e.greater(r)&&(o=r,r=e,e=o),r=r.subtract(e)}while(!r.isZero());return i.isUnit()?e:e.multiply(i)}function F(e,t){return e=V(e).abs(),t=V(t).abs(),e.divide(L(e,t)).multiply(t)}function U(e,t){e=V(e),t=V(t);var o=N(e,t),i=C(e,t),a=i.subtract(o).add(1);if(a.isSmall)return o.add(Math.floor(Math.random()*a));for(var u=a.value.length-1,l=[],d=!0,p=u;p>=0;p--){var f=d?a.value[p]:W,h=c(Math.random()*f);l.unshift(h),h=0;o--)i=i.add(e[o].times(a)),a=a.times(r);return n?i.negate():i}function B(e){return e<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e):"<"+e+">"}function q(e,t){if(t=o(t),t.isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+e-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var n=!1;if(e.isNegative()&&t.isPositive()&&(n=!0,e=e.abs()),t.equals(1))return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+e)).map(Number.prototype.valueOf,1),isNegative:n};for(var i,a=[],s=e;s.isNegative()||s.compareAbs(t)>=0;){i=s.divmod(t),s=i.quotient;var u=i.remainder;u.isNegative()&&(u=t.minus(u).abs(),s=s.next()),a.push(u.toJSNumber())}return a.push(s.toJSNumber()),{value:a.reverse(),isNegative:n}}function H(e,t){var r=q(e,t);return(r.isNegative?"-":"")+r.value.map(B).join("")}function z(e){if(i(+e)){var t=+e;if(t===c(t))return new n(t);throw new Error("Invalid integer: "+e)}var o="-"===e[0];o&&(e=e.slice(1));var a=e.split(/e/i);if(a.length>2)throw new Error("Invalid integer: "+a.join("e"));if(2===a.length){var s=a[1];if("+"===s[0]&&(s=s.slice(1)),s=+s,s!==c(s)||!i(s))throw new Error("Invalid integer: "+s+" is not a valid exponent.");var l=a[0],d=l.indexOf(".");if(d>=0&&(s-=l.length-d-1,l=l.slice(0,d)+l.slice(d+1)),s<0)throw new Error("Cannot include negative exponent part for integers");l+=new Array(s+1).join("0"),e=l}var p=/^([0-9][0-9]*)$/.test(e);if(!p)throw new Error("Invalid integer: "+e);for(var f=[],h=e.length,_=J,g=h-_;h>0;)f.push(+e.slice(g,h)),g-=_,g<0&&(g=0),h-=_;return u(f),new r(f,o)}function G(e){if(i(e)){if(e!==c(e))throw new Error(e+" is not an integer.");return new n(e)}return z(e.toString())}function V(e){return"number"==typeof e?G(e):"string"==typeof e?z(e):e}var W=1e7,J=7,K=9007199254740992,Q=a(K),Y=Math.log(K);r.prototype=Object.create(t.prototype),n.prototype=Object.create(t.prototype),r.prototype.add=function(e){var t=V(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,o=t.value;return t.isSmall?new r(f(n,Math.abs(o)),this.sign):new r(p(n,o),this.sign)},r.prototype.plus=r.prototype.add,n.prototype.add=function(e){var t=V(e),o=this.value;if(o<0!==t.sign)return this.subtract(t.negate());var s=t.value;if(t.isSmall){if(i(o+s))return new n(o+s);s=a(Math.abs(s))}return new r(f(s,Math.abs(o)),o<0)},n.prototype.plus=n.prototype.add,r.prototype.subtract=function(e){var t=V(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,n=t.value;return t.isSmall?g(r,Math.abs(n),this.sign):_(r,n,this.sign)},r.prototype.minus=r.prototype.subtract,n.prototype.subtract=function(e){var t=V(e),r=this.value;if(r<0!==t.sign)return this.add(t.negate());var o=t.value;return t.isSmall?new n(r-o):g(o,Math.abs(r),r>=0)},n.prototype.minus=n.prototype.subtract,r.prototype.negate=function(){return new r(this.value,!this.sign)},n.prototype.negate=function(){var e=this.sign,t=new n(-this.value);return t.sign=!e,t},r.prototype.abs=function(){return new r(this.value,!1)},n.prototype.abs=function(){return new n(Math.abs(this.value))},r.prototype.multiply=function(e){var n,o=V(e),i=this.value,s=o.value,u=this.sign!==o.sign;if(o.isSmall){if(0===s)return t[0];if(1===s)return this;if(s===-1)return this.negate();if(n=Math.abs(s),nn?1:-1):-1},r.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:T(r,n)*(this.sign?-1:1)},r.prototype.compareTo=r.prototype.compare,n.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return t.isSmall?r==n?0:r>n?1:-1:r<0!==t.sign?r<0?-1:1:r<0?1:-1},n.prototype.compareTo=n.prototype.compare,r.prototype.equals=function(e){return 0===this.compare(e)},n.prototype.eq=n.prototype.equals=r.prototype.eq=r.prototype.equals,r.prototype.notEquals=function(e){return 0!==this.compare(e)},n.prototype.neq=n.prototype.notEquals=r.prototype.neq=r.prototype.notEquals,r.prototype.greater=function(e){return this.compare(e)>0},n.prototype.gt=n.prototype.greater=r.prototype.gt=r.prototype.greater,r.prototype.lesser=function(e){return this.compare(e)<0},n.prototype.lt=n.prototype.lesser=r.prototype.lt=r.prototype.lesser,r.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},n.prototype.geq=n.prototype.greaterOrEquals=r.prototype.geq=r.prototype.greaterOrEquals,r.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},n.prototype.leq=n.prototype.lesserOrEquals=r.prototype.leq=r.prototype.lesserOrEquals,r.prototype.isEven=function(){return 0===(1&this.value[0])},n.prototype.isEven=function(){return 0===(1&this.value)},r.prototype.isOdd=function(){return 1===(1&this.value[0])},n.prototype.isOdd=function(){return 1===(1&this.value)},r.prototype.isPositive=function(){return!this.sign},n.prototype.isPositive=function(){return this.value>0},r.prototype.isNegative=function(){return this.sign},n.prototype.isNegative=function(){return this.value<0},r.prototype.isUnit=function(){return!1},n.prototype.isUnit=function(){return 1===Math.abs(this.value)},r.prototype.isZero=function(){return!1},n.prototype.isZero=function(){return 0===this.value},r.prototype.isDivisibleBy=function(e){var r=V(e),n=r.value;return 0!==n&&(1===n||(2===n?this.isEven():this.mod(r).equals(t[0])))},n.prototype.isDivisibleBy=r.prototype.isDivisibleBy,r.prototype.isPrime=function(){var r=M(this);if(r!==e)return r;for(var n,i,a,s,u=this.abs(),l=u.prev(),c=[2,3,5,7,11,13,17,19],d=l;d.isEven();)d=d.divide(2);for(a=0;a-K?new n(e-1):new r(Q,!0)};for(var X=[1];2*X[X.length-1]<=W;)X.push(2*X[X.length-1]);var Z=X.length,$=X[Z-1];r.prototype.shiftLeft=function(e){if(!x(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftRight(-e);var t=this;if(t.isZero())return t;for(;e>=Z;)t=t.multiply($),e-=Z-1;return t.multiply(X[e])},n.prototype.shiftLeft=r.prototype.shiftLeft,r.prototype.shiftRight=function(e){var t;if(!x(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftLeft(-e);for(var r=this;e>=Z;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;t=O(r,$),r=t[1].isNegative()?t[0].prev():t[0],e-=Z-1}return t=O(r,X[e]),t[1].isNegative()?t[0].prev():t[0]},n.prototype.shiftRight=r.prototype.shiftRight,r.prototype.not=function(){return this.negate().prev()},n.prototype.not=r.prototype.not,r.prototype.and=function(e){return D(this,e,function(e,t){return e&t})},n.prototype.and=r.prototype.and,r.prototype.or=function(e){return D(this,e,function(e,t){return e|t})},n.prototype.or=r.prototype.or,r.prototype.xor=function(e){return D(this,e,function(e,t){return e^t})},n.prototype.xor=r.prototype.xor;var ee=1<<30,te=(W&-W)*(W&-W)|ee;r.prototype.bitLength=function(){var e=this;return e.compareTo(o(0))<0&&(e=e.negate().subtract(o(1))),0===e.compareTo(o(0))?o(0):o(k(e,o(2)).e).add(o(1))},n.prototype.bitLength=r.prototype.bitLength;var re=function(e,t){for(var r,o=e.length,i=Math.abs(t),r=0;r=i){if("1"===a&&1===i)continue;throw new Error(a+" is not a valid digit in base "+t+".")}if(a.charCodeAt(0)-87>=i)throw new Error(a+" is not a valid digit in base "+t+".")}}if(2<=t&&t<=36&&o<=Y/Math.log(t)){var s=parseInt(e,t);if(isNaN(s))throw new Error(a+" is not a valid digit in base "+t+".");return new n(parseInt(e,t))}t=V(t);var u=[],l="-"===e[0];for(r=l?1:0;r"!==e[r]);u.push(V(e.slice(d+1,r)))}}return j(u,t,l)};r.prototype.toArray=function(e){return q(this,e)},n.prototype.toArray=function(e){return q(this,e)},r.prototype.toString=function(t){if(t===e&&(t=10),10!==t)return H(this,t);for(var r,n=this.value,o=n.length,i=String(n[--o]),a="0000000";--o>=0;)r=String(n[o]),i+=a.slice(r.length)+r;var s=this.sign?"-":"";return s+i},n.prototype.toString=function(t){return t===e&&(t=10),10!=t?H(this,t):String(this.value)},r.prototype.toJSON=n.prototype.toJSON=function(){return this.toString()},r.prototype.valueOf=function(){return parseInt(this.toString(),10)},r.prototype.toJSNumber=r.prototype.valueOf,n.prototype.valueOf=function(){return this.value},n.prototype.toJSNumber=n.prototype.valueOf;for(var ne=0;ne<1e3;ne++)t[ne]=new n(ne),ne>0&&(t[-ne]=new n(-ne));return t.one=t[1],t.zero=t[0],t.minusOne=t[-1],t.max=C,t.min=N,t.gcd=L,t.lcm=F,t.isInstance=function(e){return e instanceof r||e instanceof n},t.randBetween=U,t.fromArray=function(e,t,r){return j(e.map(V),V(t||10),r)},t}();"undefined"!=typeof e&&e.hasOwnProperty("exports")&&(e.exports=o),r=[],n=function(){return o}.apply(t,r),!(void 0!==n&&(e.exports=n))}).call(this,r(10)(e))},function(e,t,r){"use strict";function n(e,t){for(var r=e.byteLength,n=0;n0&&e.setUint32(16,0)},o=function(e){n(e,function(e,t){return e===c&&(s(t),!0)})},s=function(e){n(e,function(e,t){return e===d&&(p(t),!0)})},p=function(e){var r,n=e.getUint8(0);t?r=a(0):(r=a(e.getUint32(4)),n>0&&(r=r.shiftLeft(32),r=r.add(e.getUint32(8))),null===h&&(h=r),r=r.subtract(h)),n>0?(e.setUint32(4,r.shiftRight(32).toJSNumber()),e.setUint32(8,r.and(65535).toJSNumber())):e.setUint32(4,r.toJSNumber())},f=i.helpers.arrayBuffer.combine([e]),h=null;return n(new DataView(f.buffer,f.byteOffset,f.byteLength),function(e,t){switch(e){case u:r(t);break;case l:o(t)}return!1}),f}Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(11),s=8,u=1936286840,l=1836019558,c=1953653094,d=1952867444;t.clearMP4InternalTimestamp=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(6),i=r(12),a=n.helpers.deferred.buildDeferred,s=o.helpers.timeRanges.buildTimeRanges,u=n.helpers.Promise,l=n.logger.prefixLogger,c=n.logger.noOpLogger,d=n.helpers.browser.isIE(),p=n.helpers.browser.isSafari(),f='audio/mp4; codecs="mp3"',h="audio/mpeg",_='audio/webm; codecs="opus"',g=n.helpers.browser.getSafariVersion(),y=n.helpers.browser.getChromeVersion(),v=p||!!(y&&y.major<=49),m=!!g&&g.major<10||!!y&&y.major<=49;t.killedError=new Error("MSE killed.");var E=function(){function e(e,t){var r=this.constructor;if(void 0===t&&(t=c),this._sourceBuffer=null,this._initialized=!1,this._initializeDeferred=a(),this._whenIdleDeferred=a(),this._error=null,this._dead=!1,this._eosSignalled=!1,this._pendingActions=[],this._currentAction=null,this._logger=l(t,"MSE"),this._onMediaSourceInit=this._onMediaSourceInit.bind(this),this._onMediaSourceEnded=this._onMediaSourceEnded.bind(this),this._onMediaSourceError=this._onMediaSourceError.bind(this),this._onSourceBufferUpdateEnd=this._onSourceBufferUpdateEnd.bind(this),this._onSourceBufferError=this._onSourceBufferError.bind(this),!r.isSupported(e))throw this._logger.error("Not supported."),new Error("Not supported.");p&&e===f&&(e="audio/mp4"),this._type=e,this._useSegmentsMode=m&&0===e.indexOf("audio/mp4"),this._mediaSource=new MediaSource,this._mediaSource.addEventListener("sourceopen",this._onMediaSourceInit,!1),this._mediaSource.addEventListener("error",this._onMediaSourceError,!1),this._url=URL.createObjectURL(this._mediaSource),this._logger.debug("Created URL.",this._url)}return e.isSupported=function(e){return!d&&("MediaSource"in window&&(!e||(!(!p||e!==f)||!(g&&g.major<10&&e===h)&&(!(y&&y.major<50&&e===_)&&MediaSource.isTypeSupported(e)))))},e.prototype.whenInitialized=function(){return this._initializeDeferred.promise},e.prototype.whenIdle=function(){return this._whenIdleDeferred?this._whenIdleDeferred.promise:u.resolve(void 0)},e.prototype.isIdle=function(){return this._dead||!this._whenIdleDeferred},e.prototype.hasInitialized=function(){return this._initialized},e.prototype.getError=function(){return this._error},e.prototype.getUrl=function(){return this._ensureNotDead(),this._url},e.prototype.getBuffered=function(){if(this._ensureNotDead(),!this._sourceBuffer)return[];try{return s(this._sourceBuffer.buffered)}catch(t){var e="Failed to read the 'buffered' property from 'SourceBuffer': This SourceBuffer has been removed from the parent media source.";if("InvalidStateError"===t.name&&t.message===e)return[];throw t}},e.prototype.append=function(e){if(this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("append() called."),v&&0===this._type.indexOf("audio/mp4")){this._logger.debug("Rewriting internal timestamp to 0.");try{e=i.clearMP4InternalTimestamp(e,!this._useSegmentsMode)}catch(e){return this._logger.error("Error rewriting timestamps.",e),this._handleError(e),u.reject(e)}}var t=a();return this._pendingActions.push({type:"append",data:e,deferred:t}),this._performNextAction(),t.promise},e.prototype.remove=function(e){if(0===e.duration)throw new Error("Remove range must have a duration > 0.");this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("remove() called.",e);var t=a();return this._pendingActions.push({type:"remove",range:e,deferred:t}),this._performNextAction(),t.promise},e.prototype.signalEOS=function(){this._ensureNotDead(),this._ensureInitialized(),this._ensureNotEOS(),this._logger.debug("signalEOS() called."),this._eosSignalled=!0;var e=a();return this._pendingActions.push({type:"eos",deferred:e}),this._performNextAction(),e.promise},e.prototype.eosSignalled=function(){return this._eosSignalled},e.prototype.kill=function(){if(!this._dead){if(this._logger.debug("kill() called."),this._dead=!0,this._sourceBuffer){this._sourceBuffer.removeEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.removeEventListener("error",this._onSourceBufferError,!1);try{this._mediaSource.removeSourceBuffer(this._sourceBuffer)}catch(e){this._logger.error("Error from removeSourceBuffer()",e)}}this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1),this._mediaSource.removeEventListener("sourceended",this._onMediaSourceEnded,!1),this._mediaSource.removeEventListener("error",this._onMediaSourceError,!1),URL.revokeObjectURL(this._url);var e=this._error||t.killedError,r=this._currentAction?[this._currentAction]:[];r=r.concat(this._pendingActions),r.forEach(function(t){t.deferred.reject(e)}),this._whenIdleDeferred||(this._whenIdleDeferred=a()),this._whenIdleDeferred.reject(e),this._initialized||this._initializeDeferred.reject(e), -this._pendingActions.length=0,this._logger.debug("Killed.")}},e.prototype._ensureInitialized=function(){if(!this._initialized)throw new Error("Not initialized yet.")},e.prototype._ensureNotEOS=function(){if(this._eosSignalled)throw new Error("EOS signalled.")},e.prototype._ensureNotDead=function(){if(this._dead)throw new Error("MSE is dead.")},e.prototype._onMediaSourceInit=function(){this._logger.debug("MSE initialized."),this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1);try{this._logger.debug("Creating source buffer.",this._type),this._sourceBuffer=this._mediaSource.addSourceBuffer(this._type),this._sourceBuffer.mode=this._useSegmentsMode?"segments":"sequence",this._logger.debug("Using append mode: "+this._sourceBuffer.mode),this._sourceBuffer.addEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.addEventListener("error",this._onSourceBufferError,!1)}catch(e){this._handleError(e)}this._initializeDeferred.resolve(void 0),this._whenIdleDeferred.resolve(void 0),this._initialized=!0,this._performNextAction()},e.prototype._onMediaSourceEnded=function(){this._onSourceBufferUpdateEnd()},e.prototype._onMediaSourceError=function(e){this._handleError(e)},e.prototype._handleError=function(e){this._ensureNotDead(),this._logger.error("Error occurred.",e),this._error=e||new Error("Unknown error."),this.kill()},e.prototype._onSourceBufferUpdateEnd=function(){var e=this._currentAction;return this._logger.debug("Update ended.",this.getBuffered()),e?(this._currentAction=null,e.deferred.resolve(void 0),void this._performNextAction()):void this._handleError(new Error("No action in progress."))},e.prototype._onSourceBufferError=function(e){this._handleError(e)},e.prototype._performNextAction=function(){var e=this._whenIdleDeferred;if(!this._currentAction&&this._sourceBuffer){var t=this._pendingActions.shift();if(!t)return this._logger.debug("No more actions."),void(e&&(this._whenIdleDeferred=null,e.resolve(void 0)));switch(e||(this._whenIdleDeferred=a()),this._currentAction=t,this._logger.debug("Performing next action..."),t.type){case"append":var r=n.TimeRange.getCoverage(this.getBuffered());try{if("segments"===this._sourceBuffer.mode){var o=r.end/1e3;this._logger.debug("Setting timestampOffset because detected safari.",o);try{this._sourceBuffer.timestampOffset=o}catch(e){if(11!==e.code)throw e;this._logger.debug("Failed to set timestampOffset.",e)}}this._logger.debug("Calling appendBuffer()."),this._sourceBuffer.appendBuffer(t.data)}catch(e){this._handleError(e)}break;case"remove":try{var i=t.range;this._logger.debug("Calling remove().",i.start,i.end),this._sourceBuffer.remove(i.start/1e3,i.end/1e3)}catch(e){this._handleError(e)}break;case"eos":try{this._logger.debug("Calling endOfStream()."),this._sourceBuffer.removeEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._mediaSource.addEventListener("sourceended",this._onMediaSourceEnded,!1),this._mediaSource.endOfStream()}catch(e){this._handleError(e)}}}},e}();t.MSE=E},function(e,t,r){"use strict";function n(e){if(e.hasEnded()){var t=e.getCompleteDuration();if(null===t)throw new Error("Expected playlist duration to be available.");return t}return 1/0}function o(e){var t=s.TransmuxerFactory.retrieveTransmuxers(e),r=g(t,function(t){var r=u.helpers.mimeType.buildMimeTypeFromFormat(t.getOutputFormat(),e);return!!r&&l.MSE.isSupported(r)})||null;if(!r)return null;var n=r.getOutputFormat(),o=u.helpers.mimeType.buildMimeTypeFromFormat(n,e);return o?{transmuxer:r,mimeType:o}:null}var i=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(7),u=r(6),l=r(13),c=r(9),d=r(5),p=r(4),f=r(3),h=r(2),_=r(1),g=a.helpers.find,y=a.helpers.Promise,v=a.helpers.time.now,m=a.errors.PlayerFatalError,E=a.eventDispatcher.EventDispatcher,b=a.logger.prefixLogger,w=a.helpers.abortableJob.abortedError,P=a.helpers.browser.getSafariVersion(),S=a.helpers.browser.isSafari(),R=a.helpers.browser.isFirefox(),A=a.helpers.browser.isEdge(),O=3e4,T=1e8,M=2e3,x=1e4,D=1e3,I=600,k=50,C=function(e){function t(t,r){var n=e.call(this,r)||this;if(n._onSegmentRequestQueued=new E,n._onSegmentRequestStart=new E,n._onSegmentRetrieved=new E,n._onSegmentRequestFailed=new E,n._onSegmentReady=new E,n._onSegmentAppendQueued=new E,n._onSegmentAppendEnd=new E,n._playlist=null,n._playlistSegmentRetriever=null,n._playlistUpdateJob=null,n._initialPlaylistRetrieveCompleted=!1,n._playlistUpdateTimer=null,n._earliestAllowedNextUpdateTime=v(),n._mse=null,n._simpleMSE=null,n._html5PlayerReady=!1,n._startPositionOffset=0,n._transmuxerAndMimeType=null,n._lastSegmentAppended=null,n._maxBufferLength=null,n._cacheSize=null,n._onFirstSegmentRetrieved=null,n._firstSegmentOffset=0,n._seekAttemptTimer=null,n._seekMetadataEventHandle=null,n._playlistUpdateEventHandle=null,n._playlistDuration=null,n._logger=b(n._logger,"HLSMSEPlayer"),void 0!==r.maxBufferLength&&r.maxBufferLength<0)throw new Error("maxBufferLength cannot be < 0.");if(void 0!==r.memoryCacheSize&&r.memoryCacheSize<0)throw new Error("memoryCacheSize cannot be < 0.");return n.onSegmentRequestQueued=n._onSegmentRequestQueued.getHandle(),n.onSegmentRequestStart=n._onSegmentRequestStart.getHandle(),n.onSegmentRetrieved=n._onSegmentRetrieved.getHandle(),n.onSegmentRequestFailed=n._onSegmentRequestFailed.getHandle(),n.onSegmentReady=n._onSegmentReady.getHandle(),n.onSegmentAppendQueued=n._onSegmentAppendQueued.getHandle(),n.onSegmentAppendEnd=n._onSegmentAppendEnd.getHandle(),n.__descriptor=t,n.__playerDependencies=r,n._queuedPlaylist=t.playlist,n}return i(t,e),t.isFormatSupported=function(e){return!!l.MSE.isSupported()&&!!o(e)},t.prototype.getBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getCompleteBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().filter(function(e){return e.complete}).map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getMaxBufferLength=function(){return this._maxBufferLength},t.prototype.getBufferController=function(){var e=this;return{setMaxBufferLength:function(t){if(t<0)throw new Error("Max buffer length cannot be < 0.");e._logger.debug("Updating max buffer length.",t),e._maxBufferLength=t,e._playlistSegmentRetriever?e._playlistSegmentRetriever.updateMaxBufferLength(t):e._logger.debug("Cannot update right now. Playlist segment retriever doesn't exist.")}}},t.prototype.switchPlaylist=function(e){return this._logger.debug("Updating playlist."),this._hasInitialized()?(this._playlistSegmentRetriever&&(this._playlistSegmentRetriever.switchPlaylist(null),this._logger.debug("Removed current URL.")),this._disposePlaylist(),void this._setPlaylist(e)):(this._logger.debug("Cannot update right now. Still initializing."),void(this._queuedPlaylist=e))},t.prototype.getMemoryCacheMaxSize=function(){return null!==this._cacheSize?this._cacheSize:T},t.prototype.getMemoryCacheUsage=function(){return this._playlistSegmentRetriever?this._playlistSegmentRetriever.getCacheUsage():0},t.prototype.getMemoryCacheController=function(){var e=this;return{setMaxCacheSize:function(t){if(t<0)throw new Error("Max size cannot be < 0.");e._cacheSize=t,e._playlistSegmentRetriever&&e._playlistSegmentRetriever.updateCacheSize(t)}}},t.prototype._canPlay=function(){if(!l.MSE.isSupported())return this._logger.debug("MSE not supported."),y.resolve(!1);var e=this.__descriptor.segmentFormat,t=o(e);return t?(this._transmuxerAndMimeType=t,y.resolve(!0)):(this._logger.debug("No transmuxer found."),y.resolve(new h.NoTransmuxerError))},t.prototype._getUrlForMediaElement=function(){if(!this._mse)throw new Error("MSE does not exist.");return this._mse.getUrl()},t.prototype._handleDurationUpdates=function(){},t.prototype._signalReady=function(){this._html5PlayerReady=!0,this._initialPlaylistRetrieveCompleted&&e.prototype._signalReady.call(this)},t.prototype._initialize=function(){var t=this.__playerDependencies;if(null===this._maxBufferLength&&(void 0!==t.maxBufferLength?this._maxBufferLength=t.maxBufferLength:this._maxBufferLength=O),this._logger.debug("Initialized max buffer length.",this._maxBufferLength),null===this._cacheSize&&(void 0!==t.memoryCacheSize?this._cacheSize=t.memoryCacheSize:this._cacheSize=T),this._logger.debug("Initialized cache size.",this._cacheSize),e.prototype._initialize.call(this),!this._queuedPlaylist)throw new Error("Playlist should exist.");this._setPlaylist(this._queuedPlaylist),this._queuedPlaylist=null},t.prototype._initMediaElement=function(t,r){this._simpleMSE&&(this._simpleMSE.kill(),this._simpleMSE=null,this._logger.debug("Killed SimpleMSE.")),this._mse&&(this._mse.kill(),this._mse=null,this._logger.debug("Killed MSE.")),null!==this._seekAttemptTimer&&(window.clearTimeout(this._seekAttemptTimer),this._seekAttemptTimer=null,this._logger.debug("Cancelled seek attempt timer.")),this._onFirstSegmentRetrieved=null,this._seekMetadataEventHandle&&(this._seekMetadataEventHandle.remove(),this._seekMetadataEventHandle=null),r?(this._initMSE(),e.prototype._initMediaElement.call(this,t,!0)):e.prototype._initMediaElement.call(this,t,!1)},t.prototype._shouldBeEnded=function(){var t=this._lastSegmentAppended;if(!t||!t.isFinalSegment())return!1;if(!S)return e.prototype._shouldBeEnded.call(this);if(e.prototype._shouldBeEnded.call(this))return!0;if(!this.getMediaElement())return!1;var r=this._duration;return this._stallDetected&&null!==r&&this._getTruePosition()>=r-I},t.prototype._getTruePosition=function(){var e=this.getMediaElement();if(!e)throw new Error("Media element should exist.");return this._startPositionOffset+this._getMediaElementPosition()},t.prototype._handleSeekChange=function(t,r){e.prototype._handleSeekChange.call(this,t,r),this._playlistSegmentRetriever&&(this._logger.debug("Explicitly updating playlist segment retriever, as seek requested."),this._playlistSegmentRetriever.update(),this._findSegmentAndAppendToMSE())},t.prototype._performSeek=function(t,r){var n=this,o=this,i=o._simpleMSE,s=o._mse,u=this.getMediaElement();if(!s)throw new Error("MSE should exist.");if(!u)throw new Error("Media element should exist.");var l=!this._isMediaElementPaused(u);null!==this._seekAttemptTimer&&(window.clearTimeout(this._seekAttemptTimer),this._seekAttemptTimer=null,this._logger.debug("Cancelled previous seek attempt timer.")),this._seekMetadataEventHandle&&(this._seekMetadataEventHandle.remove(),this._seekMetadataEventHandle=null,this._logger.debug("Removed previous loaded metadata event handler.")),i&&i.kill(),s.kill(),this._logger.debug("SimpleMSE and MSE destroyed."),this._startPositionOffset=t;var c=!1;this._onFirstSegmentRetrieved=function(){return c=!0},this._logger.debug("Initializing MSE and SimpleMSE for new position."),this._initMSE();var d=this._mse.getUrl();if(this._logger.debug("Updated media element MSE src.",d),e.prototype._initMediaElement.call(this,u,!0),l){this._logger.debug("Calling play() on media element as it was playing previously.");var p=this._callMediaElementPlay(u);p&&p.catch&&p.catch(function(e){"AbortError"!==e.name&&(n._logger.error("Unexpected play() error.",e),n._triggerError(new m("Exception from calling play() after seek.",e)))})}var f=function(e){(P&&P.major<11||R)&&e0){var r=e.length+this.bufferSize;if(!this.buffer||this.buffer.length0&&n.set(this.buffer.subarray(0,this.bufferSize)),this.buffer=n}this.buffer.set(e,this.bufferSize),this.bufferSize=r,e=this.buffer,t=r}else t=e.length;for(var o,i=0;i0;)i+=o;var a=t-i;a>0&&(!this.buffer||this.buffer.lengthr)return-1;if(255===e[t]||224===(224&e[t+1])){if(t+24>r)return-1;var n=e[t+1]>>3&3,a=e[t+1]>>1&3,s=e[t+2]>>4&15,u=e[t+2]>>2&3,l=!!(2&e[t+2]);if(1!==n&&0!==s&&15!==s&&3!==u){var c=3===n?3-a:3===a?3:4,d=1e3*o[14*c+s-1],p=3===n?0:2===n?1:2,f=i[3*p+u],h=l?1:0,_=3===a?(3===n?12:6)*d/f+h<<2:(3===n?144:72)*d/f+h|0;return t+_>r?-1:(this.onFrame&&this.onFrame(new Uint8Array(e.subarray(t,t+_))),_)}}for(var g=t+2;g0&&this.onNoise&&this.onNoise(new Uint8Array(this.buffer.subarray(0,this.bufferSize))),this.buffer=null,this.bufferSize=0,this.onClose&&this.onClose()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PassThrough={getInputFormat:function(){return{}},getOutputFormat:function(){return{}},transmux:function(e){return e}}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"NO_DECRYPTOR"},t}(o.RetrievalError);t.NoDecryptorError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._statusCode=t,r}return n(t,e),t.prototype.getStatusCode=function(){return this._statusCode},t.prototype.getCode=function(){return"UNACCEPTABLE_RESPONSE_STATUS_CODE"},t}(o.RetrievalError);t.UnacceptableResponseStatusCodeError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t,r){this._playlist=e,this._url=t,this._sequenceNumber=r}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e.prototype.getSequenceNumber=function(){return this._sequenceNumber},e}();t.Segment=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._code=t,r}return n(t,e),t.prototype.getCode=function(){return"OGG_PARSER."+this._code},t}(o.RetrievalError);t.OggParserError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._url=e}return e.prototype.getUrl=function(){return this._url},e}();t.Playlist=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.Key=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.InitData=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(13),i=r(12),a=r(11),s=r(9);!function(e){e.InitData=o.InitData,e.Key=i.Key,e.Playlist=a.Playlist,e.Segment=s.Segment}(n=t.events||(t.events={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"UNSUPPORTED_ENCRYPTION_ERROR"},t}(o.RetrievalError);t.UnsupportedEncryptionError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._details=t,r}return n(t,e),t.prototype.getDetails=function(){return this._details},t.prototype.getCode=function(){return"PLAYLIST_PARSE"},t}(o.RetrievalError);t.PlaylistParseError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(7),i=r(16),a=r(10),s=r(1),u=r(8),l=r(15);!function(e){e.NoDecryptorError=o.NoDecryptorError,e.PlaylistParseError=i.PlaylistParseError,e.OggParserError=a.OggParserError,e.RetrievalError=s.RetrievalError,e.UnacceptableResponseStatusCodeError=u.UnacceptableResponseStatusCodeError,e.UnsupportedEncryptionError=l.UnsupportedEncryptionError}(n=t.retrievalErrors||(t.retrievalErrors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.MP4ToMP4={getInputFormat:function(){return{mimeType:"audio/mp4"}},getOutputFormat:function(){return{mimeType:"audio/mp4"}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(t){r.reject(t),e.abort()}var r=n.helpers.deferred.buildDeferred(),o=new n.eventDispatcher.EventDispatcher,i=[],a=[],s=new Uint8Array(0),u=null,l=!1,c=function(e){ -if(e.byteLength<4)return void(s=e);if(null===u){var t=new DataView(e.buffer).getUint32(0);if(1===t)throw new Error("Large atom size not supported.");u=t}if(0!==u&&e.byteLength>=u){var r=new Uint8Array(e.buffer.slice(0,u));a.push(r),s=new Uint8Array(e.buffer.slice(u)),u=null,c(s)}else s=e};return e.onProgressUpdate(function(e){var r=e.data;!l&&e.initData&&(r=n.helpers.arrayBuffer.combine([e.initData,e.data])),l=!0;try{var u=n.helpers.arrayBuffer.combine([s,r]);if(c(u),a.length){var d=n.helpers.arrayBuffer.combine(a);a.splice(0),i.push(d),o.dispatch({data:d})}}catch(e){t(e)}}),e.onCompletion(function(e){try{if(0===u)i.push(s),o.dispatch({data:s});else if(s.byteLength)throw new Error("Part way through an atom.");r.resolve(e)}catch(e){t(e)}}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:o,getProgressSoFar:function(){return i.length?{data:n.helpers.arrayBuffer.combine(i)}:null}},abort:function(){e.abort()}}});return t.run()}}},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(3),i=r(19);t.OggOpusToWebm={getInputFormat:function(){return{mimeType:"audio/ogg",audioCodec:{id:"opus"}}},getOutputFormat:function(){return{mimeType:"audio/webm",audioCodec:{id:"opus"}}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(t){p=!0,r.reject(t),e.abort()}var r=n.helpers.deferred.buildDeferred(),a=new n.eventDispatcher.EventDispatcher,s=[],u=null,l=new Uint8Array(0),c=!1,d=null,p=!1;return e.onProgressUpdate(function(e){if(!p){var r=[l,e.data];!c&&e.initData&&(r=[e.initData].concat(r)),c=!0;var f=n.helpers.arrayBuffer.combine(r);try{var h=o.retrievePages(f).pages,_=h.reduce(function(e,t){return e+t.entirePage.byteLength},0);l=new Uint8Array(f.buffer.slice(_));var g=o.retrievePackets(h);if(g.length&&!u){if(g.length<2)throw new Error("Expecting at least 2 opus packets.");var y=i.parseOpusHead(g[0]);y.outputGain>-2&&i.setOutputGain(g[0],-2),u=[g[0],g[1]],g=g.slice(2)}if(g.length&&u){s.push.apply(s,g);var v=i.buildWebm(u.concat(g));d||(d=v.initData),a.dispatch({initData:d,data:v.data})}}catch(e){t(e)}}}),e.onCompletion(function(e){l.byteLength?r.reject(new Error("Still data left in buffer.")):r.resolve(e)}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:a,getProgressSoFar:function(){if(s.length&&u){var e=i.buildWebm(u.concat(s)).data;return{initData:d,data:e}}return null}},abort:function(){p=!0,e.abort()}}});return t.run()}}},function(e,t,r){"use strict";t.__esModule=!0;var n,o,i=function(e,t){function r(){this.constructor=e}for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)};!function(e){var t;!function(e){function t(e){for(var t=new Uint8Array(4*e.length),r=0,n=0,o=e.length;n>>24&3,t[r++]=128|i>>>18&63,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294901760&i)?(t[r++]=240|i>>>18&7,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294965248&i)?(t[r++]=224|i>>>12&15,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=192|i>>>6&31,t[r++]=128|63&i)}}return t.subarray(0,r)}function r(e){for(var t=0,r="";t>1|128;if((n&a)===o)break;o=o>>1|128,--i}while(i>=0);if(i<=0)throw new Error("Invalid UTF8 character");for(var s=n&(1<=i;--u){var l=e[t++];if(128!==(192&l))throw new Error("Invalid UTF8 character sequence");s=s<<6|63&l}r+=s>=65536?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}}return r}e.utf8decode=t,e.utf8encode=r}(t=e.StringUtilities||(e.StringUtilities={}))}(o||(o={})),function(e){var t;!function(e){function t(e){for(var t=e.length>>1,r=new Uint8Array(t),n=0;n>4,d=o>>2&3,p=2&o?16:8,f=1&o?2:1;switch(r++,i){case c:var h=e[r++];n=h,t=1024;break;case l:var _=e[r+1]>>3&3,g=e[r+1]>>1&3;t=1===g?3===_?1152:576:3===g?384:1152}return{codecDescription:u[i],codecId:i,data:e.subarray(r),rate:s[d],size:p,channels:f,samples:t,packetType:n}}function n(e){var t=0,r=e[t]>>4,n=15&e[t];t++;var o={frameType:r,codecId:n,codecDescription:p[n]};switch(n){case h:var i=e[t++];o.packetType=i,o.compositionTime=(e[t]<<24|e[t+1]<<16|e[t+2]<<8)>>8,t+=3;break;case f:o.packetType=_.NALU,o.horizontalOffset=e[t]>>4&15,o.verticalOffset=15&e[t],o.compositionTime=0,t++}return o.data=e.subarray(t),o}function o(e){var t,r,n=[],o=-1,i=-1,a=+e.asGetPublicProperty("duration"),s=e.asGetPublicProperty("audiocodecid");switch(s){case l:case"mp3":t="mp3",r=l;break;case c:case"mp4a":t="mp4a",r=c;break;default:if(!isNaN(s))throw new Error("Unsupported audio codec: "+s);t=null,r=-1}var u,d,p=e.asGetPublicProperty("videocodecid");switch(p){case f:case"vp6f":u="vp6f",d=f;break;case h:case"avc1":u="avc1",d=h;break;default:if(!isNaN(p))throw new Error("Unsupported video codec: "+p);u=null,d=-1}var _=null===t?null:{codecDescription:t,codecId:r,language:"und",timescale:+e.asGetPublicProperty("audiosamplerate")||44100,samplerate:+e.asGetPublicProperty("audiosamplerate")||44100,channels:+e.asGetPublicProperty("audiochannels")||2,samplesize:16},g=null===u?null:{codecDescription:u,codecId:d,language:"und",timescale:6e4,framerate:+e.asGetPublicProperty("videoframerate")||+e.asGetPublicProperty("framerate"),width:+e.asGetPublicProperty("width"),height:+e.asGetPublicProperty("height")},y=e.asGetPublicProperty("trackinfo");if(y)for(var v=0;v=0&&t.push({tracks:[e.tracks[e.audioTrackId]],duration:e.duration,audioTrackId:0,videoTrackId:-1}),e.videoTrackId>=0&&t.push({tracks:[e.tracks[e.videoTrackId]],duration:e.duration,audioTrackId:-1,videoTrackId:0}),t}var a,s=[5500,11025,22050,44100],u=["PCM","ADPCM","MP3","PCM le","Nellymouser16","Nellymouser8","Nellymouser","G.711 A-law","G.711 mu-law",null,"AAC","Speex","MP3 8khz"],l=2,c=10;!function(e){e[e.HEADER=0]="HEADER",e[e.RAW=1]="RAW"}(a||(a={}));var d,p=[null,"JPEG","Sorenson","Screen","VP6","VP6 alpha","Screen2","AVC"],f=4,h=7;!function(e){e[e.KEY=1]="KEY",e[e.INNER=2]="INNER",e[e.DISPOSABLE=3]="DISPOSABLE",e[e.GENERATED=4]="GENERATED",e[e.INFO=5]="INFO"}(d||(d={}));var _;!function(e){e[e.HEADER=0]="HEADER",e[e.NALU=1]="NALU",e[e.END=2]="END"}(_||(_={}));var g,y=8,v=9,m=50,E=!0;!function(e){e[e.CAN_GENERATE_HEADER=0]="CAN_GENERATE_HEADER",e[e.NEED_HEADER_DATA=1]="NEED_HEADER_DATA",e[e.MAIN_PACKETS=2]="MAIN_PACKETS"}(g||(g={}));var b=function(){function o(e){var t=this;this.oncodecinfo=function(e){},this.ondata=function(e){throw new Error("MP4Mux.ondata is not set")},this.metadata=e,this.trackStates=this.metadata.tracks.map(function(e,r){var n={trackId:r+1,trackInfo:e,cachedDuration:0,samplesProcessed:0,initializationData:[]};return t.metadata.audioTrackId===r&&(t.audioTrackState=n),t.metadata.videoTrackId===r&&(t.videoTrackState=n),n},this),this._checkIfNeedHeaderData(),this.filePos=0,this.cachedPackets=[],this.chunkIndex=0}return o.prototype.pushPacket=function(e,t,o){switch(this.state===g.CAN_GENERATE_HEADER&&this._tryGenerateHeader(),e){case y:var i=this.audioTrackState,s=r(t);if(!i||i.trackInfo.codecId!==s.codecId)throw new Error("Unexpected audio packet codec: "+s.codecDescription);switch(s.codecId){default:throw new Error("Unsupported audio codec: "+s.codecDescription);case l:break;case c:if(s.packetType===a.HEADER)return void i.initializationData.push(s.data)}this.cachedPackets.push({packet:s,timestamp:o,trackId:i.trackId});break;case v:var u=this.videoTrackState,d=n(t);if(!u||u.trackInfo.codecId!==d.codecId)throw new Error("Unexpected video packet codec: "+d.codecDescription);switch(d.codecId){default:throw new Error("unsupported video codec: "+d.codecDescription);case f:break;case h:if(d.packetType===_.HEADER)return void u.initializationData.push(d.data)}this.cachedPackets.push({packet:d,timestamp:o,trackId:u.trackId});break;default:throw new Error("unknown packet type: "+e)}this.state===g.NEED_HEADER_DATA&&this._tryGenerateHeader(),this.cachedPackets.length>=m&&this.state===g.MAIN_PACKETS&&this._chunk()},o.prototype.flush=function(){this.cachedPackets.length>0&&this._chunk()},o.prototype._checkIfNeedHeaderData=function(){this.trackStates.some(function(e){return e.trackInfo.codecId===c||e.trackInfo.codecId===h})?this.state=g.NEED_HEADER_DATA:this.state=g.CAN_GENERATE_HEADER},o.prototype._tryGenerateHeader=function(){var r=this.trackStates.every(function(e){switch(e.trackInfo.codecId){case c:case h:return e.initializationData.length>0;default:return!0}});if(r){for(var n=["isom"],o=1,i=1,a=[],s=0;s>3;d.mimeTypeCodec="mp4a.40."+v;break;case l:u=new e.Iso.AudioSampleEntry(".mp3",o,p.channels,p.samplesize,p.samplerate),d.mimeTypeCodec="mp3";break;case h:var m=d.initializationData[0];u=new e.Iso.VideoSampleEntry("avc1",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("avcC",m)];var E=m[1]<<16|m[2]<<8|m[3];d.mimeTypeCodec="avc1."+(16777216|E).toString(16).substr(1),n.push("iso2","avc1","mp41");break;case f:u=new e.Iso.VideoSampleEntry("VP6F",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("glbl",t("00"))],d.mimeTypeCodec="avc1.42001E";break;default:throw new Error("not supported track type")}var b,w=e.Iso.TrackHeaderFlags.TRACK_ENABLED|e.Iso.TrackHeaderFlags.TRACK_IN_MOVIE;d===this.audioTrackState?b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,0,0,1,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("soun","SoundHandler"),new e.Iso.MediaInformationBox(new e.Iso.SoundMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000")))))):d===this.videoTrackState&&(b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,p.width,p.height,0,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("vide","VideoHandler"),new e.Iso.MediaInformationBox(new e.Iso.VideoMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000"))))))),a.push(b)}var P=new e.Iso.MovieExtendsBox(null,[new e.Iso.TrackExtendsBox(1,1,0,0,0),new e.Iso.TrackExtendsBox(2,1,0,0,0)],null),S=new e.Iso.BoxContainerBox("udat",[new e.Iso.MetaBox(new e.Iso.RawTag("hdlr",t("00000000000000006D6469726170706C000000000000000000")),[new e.Iso.RawTag("ilst",t("00000025A9746F6F0000001D6461746100000001000000004C61766635342E36332E313034"))])]),R=new e.Iso.MovieHeaderBox(1e3,0,this.trackStates.length+1),A=new e.Iso.MovieBox(R,a,P,S),O=new e.Iso.FileTypeBox("isom",512,n),T=O.layout(0),M=A.layout(T),x=new Uint8Array(T+M);O.write(x),A.write(x),this.oncodecinfo(this.trackStates.map(function(e){return e.mimeTypeCodec})),this.ondata(x),this.filePos+=x.length,this.state=g.MAIN_PACKETS}},o.prototype._chunk=function(){var t=this.cachedPackets;if(E&&this.videoTrackState){for(var r=t.length-1,n=this.videoTrackState.trackId;r>0&&(t[r].trackId!==n||t[r].packet.frameType!==d.KEY);)r--;r>0&&(t=t.slice(0,r))}if(0!==t.length){for(var o=[],i=0,a=[],s=[],u=0;u>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r}function n(e){return e.charCodeAt(0)<<24|e.charCodeAt(1)<<16|e.charCodeAt(2)<<8|e.charCodeAt(3)}function a(e){return(e-p)/1e3|0}function s(e){return 65536*e|0}function u(e){return 1073741824*e|0}function l(e){return 256*e|0}function c(e){return(31&e.charCodeAt(0))<<10|(31&e.charCodeAt(1))<<5|31&e.charCodeAt(2)}var d=o.StringUtilities.utf8decode,p=-20828448e5,f=[1,0,0,0,1,0,0,0,1],h=[0,0,0],_=function(){function e(e,t){this.boxtype=e,"uuid"===e&&(this.userType=t)}return e.prototype.layout=function(e){this.offset=e;var t=8;return this.userType&&(t+=16),this.size=t,t},e.prototype.write=function(e){return r(e,this.offset,this.size),r(e,this.offset+4,n(this.boxtype)),this.userType?(e.set(this.userType,this.offset+8),24):8},e.prototype.toUint8Array=function(){var e=this.layout(0),t=new Uint8Array(e);return this.write(t),t},e}();e.Box=_;var g=function(e){function t(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var o=e.call(this,t)||this;return o.version=r,o.flags=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.version<<24|this.flags),n+4},t}(_);e.FullBox=g;var y=function(e){function t(t,r,n){var o=e.call(this,"ftype")||this;return o.majorBrand=t,o.minorVersion=r,o.compatibleBrands=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4*(2+this.compatibleBrands.length),this.size},t.prototype.write=function(t){var o=this,i=e.prototype.write.call(this,t);return r(t,this.offset+i,n(this.majorBrand)),r(t,this.offset+i+4,this.minorVersion),i+=8,this.compatibleBrands.forEach(function(e){r(t,o.offset+i,n(e)),i+=4},this),i},t}(_);e.FileTypeBox=y;var v=function(e){function t(t,r){var n=e.call(this,t)||this;return n.children=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return this.children.forEach(function(e){e&&(r+=e.layout(t+r))}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return this.children.forEach(function(e){e&&(r+=e.write(t))}),r},t}(_);e.BoxContainerBox=v;var m=function(e){function r(r,n,o,i){var a=e.call(this,"moov",t([r],n,[o,i]))||this;return a.header=r,a.tracks=n,a.extendsBox=o,a.userData=i,a}return i(r,e),r}(v);e.MovieBox=m;var E=function(e){function t(t,r,n,o,i,a,s,u){void 0===o&&(o=1),void 0===i&&(i=1),void 0===a&&(a=f),void 0===s&&(s=p),void 0===u&&(u=p);var l=e.call(this,"mvhd",0,0)||this;return l.timescale=t,l.duration=r,l.nextTrackId=n,l.rate=o,l.volume=i,l.matrix=a,l.creationTime=s,l.modificationTime=u,l}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4+2+2+8+36+24+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),n+=16,r(t,this.offset+n,s(this.rate)),r(t,this.offset+n+4,l(this.volume)<<16),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),r(t,this.offset+n+16,0),r(t,this.offset+n+20,0),n+=24,r(t,this.offset+n,this.nextTrackId),n+=4},t}(g);e.MovieHeaderBox=E;var b;!function(e){e[e.TRACK_ENABLED=1]="TRACK_ENABLED",e[e.TRACK_IN_MOVIE=2]="TRACK_IN_MOVIE",e[e.TRACK_IN_PREVIEW=4]="TRACK_IN_PREVIEW"}(b=e.TrackHeaderFlags||(e.TrackHeaderFlags={}));var w=function(e){function t(t,r,n,o,i,a,s,u,l,c,d){void 0===s&&(s=0),void 0===u&&(u=0),void 0===l&&(l=f),void 0===c&&(c=p),void 0===d&&(d=p);var h=e.call(this,"tkhd",0,t)||this;return h.trackId=r,h.duration=n,h.width=o,h.height=i,h.volume=a,h.alternateGroup=s,h.layer=u,h.matrix=l,h.creationTime=c,h.modificationTime=d,h}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20+8+6+2+36+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.trackId),r(t,this.offset+n+12,0),r(t,this.offset+n+16,this.duration),n+=20,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,this.layer<<16|this.alternateGroup),r(t,this.offset+n+12,l(this.volume)<<16),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,s(this.width)),r(t,this.offset+n+4,s(this.height)),n+=8},t}(g);e.TrackHeaderBox=w;var P=function(e){function t(t,r,n,o,i){void 0===n&&(n="unk"),void 0===o&&(o=p),void 0===i&&(i=p);var a=e.call(this,"mdhd",0,0)||this;return a.timescale=t,a.duration=r,a.language=n,a.creationTime=o,a.modificationTime=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),r(t,this.offset+n+16,c(this.language)<<16),n+20},t}(g);e.MediaHeaderBox=P;var S=function(e){function t(t,r){var n=e.call(this,"hdlr",0,0)||this;return n.handlerType=t,n.name=r,n._encodedName=d(n.name),n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8+12+(this._encodedName.length+1),this.size},t.prototype.write=function(t){var o=e.prototype.write.call(this,t);return r(t,this.offset+o,0),r(t,this.offset+o+4,n(this.handlerType)),r(t,this.offset+o+8,0),r(t,this.offset+o+12,0),r(t,this.offset+o+16,0),o+=20,t.set(this._encodedName,this.offset+o),t[this.offset+o+this._encodedName.length]=0,o+=this._encodedName.length+1},t}(g);e.HandlerBox=S;var R=function(e){function t(t){void 0===t&&(t=0);var r=e.call(this,"smhd",0,0)||this;return r.balance=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,l(this.balance)<<16),n+4},t}(g);e.SoundMediaHeaderBox=R;var A=function(e){function t(t,r){void 0===t&&(t=0),void 0===r&&(r=h);var n=e.call(this,"vmhd",0,0)||this;return n.graphicsMode=t,n.opColor=r,n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.graphicsMode<<16|this.opColor[0]),r(t,this.offset+n+4,this.opColor[1]<<16|this.opColor[2]),n+8},t}(g);e.VideoMediaHeaderBox=A,e.SELF_CONTAINED_DATA_REFERENCE_FLAG=1;var O=function(t){function r(r,n){void 0===n&&(n=null);var o=t.call(this,"url ",0,r)||this;return o.location=n,r&e.SELF_CONTAINED_DATA_REFERENCE_FLAG||(o._encodedLocation=d(n)),o}return i(r,t),r.prototype.layout=function(e){var r=t.prototype.layout.call(this,e);return this._encodedLocation&&(r+=this._encodedLocation.length+1),this.size=r},r.prototype.write=function(e){var r=t.prototype.write.call(this,e);return this._encodedLocation&&(e.set(this._encodedLocation,this.offset+r),e[this.offset+r+this._encodedLocation.length]=0,r+=this._encodedLocation.length),r},r}(g);e.DataEntryUrlBox=O;var T=function(e){function t(t){var r=e.call(this,"dref",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4;return this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.DataReferenceBox=T;var M=function(e){function t(t){var r=e.call(this,"dinf",[t])||this;return r.dataReference=t,r}return i(t,e),t}(v);e.DataInformationBox=M;var x=function(e){function t(t){var r=e.call(this,"stsd",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=4,this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),n+=4,this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.SampleDescriptionBox=x;var D=function(e){function t(t,r,n,o,i){var a=e.call(this,"stbl",[t,r,n,o,i])||this;return a.sampleDescriptions=t,a.timeToSample=r,a.sampleToChunk=n,a.sampleSizes=o,a.chunkOffset=i,a}return i(t,e),t}(v);e.SampleTableBox=D;var I=function(e){function t(t,r,n){var o=e.call(this,"minf",[t,r,n])||this;return o.header=t,o.info=r,o.sampleTable=n,o}return i(t,e),t}(v);e.MediaInformationBox=I;var k=function(e){function t(t,r,n){var o=e.call(this,"mdia",[t,r,n])||this;return o.header=t,o.handler=r,o.info=n,o}return i(t,e),t}(v);e.MediaBox=k;var C=function(e){function t(t,r){var n=e.call(this,"trak",[t,r])||this;return n.header=t,n.media=r,n}return i(t,e),t}(v);e.TrackBox=C;var N=function(e){function t(t,r,n,o,i){var a=e.call(this,"trex",0,0)||this;return a.trackId=t,a.defaultSampleDescriptionIndex=r,a.defaultSampleDuration=n,a.defaultSampleSize=o,a.defaultSampleFlags=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.trackId),r(t,this.offset+n+4,this.defaultSampleDescriptionIndex),r(t,this.offset+n+8,this.defaultSampleDuration),r(t,this.offset+n+12,this.defaultSampleSize),r(t,this.offset+n+16,this.defaultSampleFlags),n+20},t}(g);e.TrackExtendsBox=N;var L=function(e){function r(r,n,o){var i=e.call(this,"mvex",t([r],n,[o]))||this;return i.header=r,i.tracDefaults=n,i.levels=o,i}return i(r,e),r}(v);e.MovieExtendsBox=L;var F=function(e){function t(t,r){var n=e.call(this,"meta",0,0)||this;return n.handler=t,n.otherBoxes=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=this.handler.layout(t+r),this.otherBoxes.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return r+=this.handler.write(t),this.otherBoxes.forEach(function(e){r+=e.write(t)}),r},t}(g);e.MetaBox=F;var U=function(e){function t(t){var r=e.call(this,"mfhd",0,0)||this;return r.sequenceNumber=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.sequenceNumber),n+4},t}(g);e.MovieFragmentHeaderBox=U;var j;!function(e){e[e.BASE_DATA_OFFSET_PRESENT=1]="BASE_DATA_OFFSET_PRESENT",e[e.SAMPLE_DESCRIPTION_INDEX_PRESENT=2]="SAMPLE_DESCRIPTION_INDEX_PRESENT",e[e.DEFAULT_SAMPLE_DURATION_PRESENT=8]="DEFAULT_SAMPLE_DURATION_PRESENT",e[e.DEFAULT_SAMPLE_SIZE_PRESENT=16]="DEFAULT_SAMPLE_SIZE_PRESENT",e[e.DEFAULT_SAMPLE_FLAGS_PRESENT=32]="DEFAULT_SAMPLE_FLAGS_PRESENT"}(j=e.TrackFragmentFlags||(e.TrackFragmentFlags={}));var B=function(e){function t(t,r,n,o,i,a,s){var u=e.call(this,"tfhd",0,t)||this;return u.trackId=r,u.baseDataOffset=n,u.sampleDescriptionIndex=o,u.defaultSampleDuration=i,u.defaultSampleSize=a,u.defaultSampleFlags=s,u}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.flags;return n&j.BASE_DATA_OFFSET_PRESENT&&(r+=8),n&j.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_DURATION_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_SIZE_PRESENT&&(r+=4),n&j.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r+=4),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.flags;return r(t,this.offset+n,this.trackId),n+=4,o&j.BASE_DATA_OFFSET_PRESENT&&(r(t,this.offset+n,0),r(t,this.offset+n+4,this.baseDataOffset),n+=8),o&j.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r(t,this.offset+n,this.sampleDescriptionIndex),n+=4),o&j.DEFAULT_SAMPLE_DURATION_PRESENT&&(r(t,this.offset+n,this.defaultSampleDuration),n+=4),o&j.DEFAULT_SAMPLE_SIZE_PRESENT&&(r(t,this.offset+n,this.defaultSampleSize),n+=4),o&j.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.defaultSampleFlags),n+=4),n},t}(g);e.TrackFragmentHeaderBox=B;var q=function(e){function t(t){var r=e.call(this,"tfdt",0,0)||this;return r.baseMediaDecodeTime=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.baseMediaDecodeTime),n+4},t}(g);e.TrackFragmentBaseMediaDecodeTimeBox=q;var H=function(e){function t(t,r,n){var o=e.call(this,"traf",[t,r,n])||this;return o.header=t,o.decodeTime=r,o.run=n,o}return i(t,e),t}(v);e.TrackFragmentBox=H;var z;!function(e){e[e.IS_LEADING_MASK=201326592]="IS_LEADING_MASK",e[e.SAMPLE_DEPENDS_ON_MASK=50331648]="SAMPLE_DEPENDS_ON_MASK",e[e.SAMPLE_DEPENDS_ON_OTHER=16777216]="SAMPLE_DEPENDS_ON_OTHER",e[e.SAMPLE_DEPENDS_ON_NO_OTHERS=33554432]="SAMPLE_DEPENDS_ON_NO_OTHERS",e[e.SAMPLE_IS_DEPENDED_ON_MASK=12582912]="SAMPLE_IS_DEPENDED_ON_MASK",e[e.SAMPLE_HAS_REDUNDANCY_MASK=3145728]="SAMPLE_HAS_REDUNDANCY_MASK",e[e.SAMPLE_PADDING_VALUE_MASK=917504]="SAMPLE_PADDING_VALUE_MASK",e[e.SAMPLE_IS_NOT_SYNC=65536]="SAMPLE_IS_NOT_SYNC",e[e.SAMPLE_DEGRADATION_PRIORITY_MASK=65535]="SAMPLE_DEGRADATION_PRIORITY_MASK"}(z=e.SampleFlags||(e.SampleFlags={}));var G;!function(e){e[e.DATA_OFFSET_PRESENT=1]="DATA_OFFSET_PRESENT",e[e.FIRST_SAMPLE_FLAGS_PRESENT=4]="FIRST_SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_DURATION_PRESENT=256]="SAMPLE_DURATION_PRESENT",e[e.SAMPLE_SIZE_PRESENT=512]="SAMPLE_SIZE_PRESENT",e[e.SAMPLE_FLAGS_PRESENT=1024]="SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_COMPOSITION_TIME_OFFSET=2048]="SAMPLE_COMPOSITION_TIME_OFFSET"}(G=e.TrackRunFlags||(e.TrackRunFlags={}));var V=function(e){function t(t,r,n,o){var i=e.call(this,"trun",1,t)||this;return i.samples=r,i.dataOffset=n,i.firstSampleFlags=o,i}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.samples.length,o=this.flags;return o&G.DATA_OFFSET_PRESENT&&(r+=4),o&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r+=4),o&G.SAMPLE_DURATION_PRESENT&&(r+=4*n),o&G.SAMPLE_SIZE_PRESENT&&(r+=4*n),o&G.SAMPLE_FLAGS_PRESENT&&(r+=4*n),o&G.SAMPLE_COMPOSITION_TIME_OFFSET&&(r+=4*n),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.samples.length,i=this.flags;r(t,this.offset+n,o),n+=4,i&G.DATA_OFFSET_PRESENT&&(r(t,this.offset+n,this.dataOffset),n+=4),i&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.firstSampleFlags),n+=4);for(var a=0;a31)throw new Error("invalid compressor name");return p}return i(n,t),n.prototype.layout=function(e){var r=t.prototype.layout.call(this,e)+16+12+4+2+32+2+2;return this.otherBoxes&&this.otherBoxes.forEach(function(t){r+=t.layout(e+r)}),this.size=r},n.prototype.write=function(e){var n=t.prototype.write.call(this,e);r(e,this.offset+n,0),r(e,this.offset+n+4,0),r(e,this.offset+n+8,0),r(e,this.offset+n+12,0),n+=16,r(e,this.offset+n,this.width<<16|this.height),r(e,this.offset+n+4,s(this.horizResolution)),r(e,this.offset+n+8,s(this.vertResolution)),n+=12,r(e,this.offset+n,0),r(e,this.offset+n+4,this.frameCount<<16),n+=6,e[this.offset+n]=this.compressorName.length;for(var o=0;o<31;o++)e[this.offset+n+o+1]=o>>8^255&g^99,e[f]=g,t[g]=f;var y=p[f],v=p[y],m=p[v],E=257*p[g]^16843008*g;n[f]=E<<24|E>>>8,o[f]=E<<16|E>>>16,i[f]=E<<8|E>>>24,a[f]=E,E=16843009*m^65537*v^257*y^16843008*f,u[g]=E<<24|E>>>8,l[g]=E<<16|E>>>16,c[g]=E<<8|E>>>24,d[g]=E,f?(f=y^p[p[p[m^y]]],h^=p[p[h]]):f=h=1}},e.prototype.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n0&&!r||(n=t+2,!1)}),a=s(t.slice(0,n).map(function(e){return e.entirePage}));return{state:"PRESENT",initData:a,initDataEnded:o}}return{state:"NOT_PRESENT"}}return null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(3),a=o.helpers.abortableJob.AbortableJob,s=o.helpers.arrayBuffer.combine,u=new o.helpers.SCWeakMap;t.OggOpusSegmentParser={getFormat:function(){return{mimeType:"audio/ogg",audioCodec:{id:"opus"}}},parseSegmentData:function(e,r,i){var l=new a(function(){var a=o.helpers.deferred.buildDeferred(),l=new o.eventDispatcher.EventDispatcher,c=[],d=null,p=null,f=null,h=function(t){a.reject(t),e.abort()},_=function(e){u.set(i,e),l.dispatch({initData:e,data:s(c)})};return e.onProgressUpdate(function(e){if(d&&"PRESENT"===d.state&&d.initDataEnded)c.push(e),l.dispatch({initData:d.initData,data:e});else if(d&&"NOT_PRESENT"===d.state)c.push(e);else{c.push(e);var a=s(c);if(d=n(a))if("NOT_PRESENT"===d.state){var g=u.get(i);r.getSequenceNumber()<=i.getFirstSegmentIndex()?h(new Error("Could not find init data.")):g?(d={state:"PRESENT",initData:g,initDataEnded:!0},_(d.initData)):(p=i.getSegment(i.getFirstSegmentIndex()),p.onCompletion(function(e){var r=f=t.OggOpusSegmentParser.parseSegmentData(o.helpers.abortableJob.map(function(){return e.retrieveData()},{convertProgressUpdate:function(e){return e.initData?o.helpers.arrayBuffer.combine([e.initData,e.data]):e.data},convertResult:function(e){return e}}).run(),e,i);r.onProgressUpdate(function(e){var t=e.initData;if(r.abort(),!t){var n=new Error("OggOpusSegmentParser should always provide init data.");throw h(n),n}d={state:"PRESENT",initData:t,initDataEnded:!0},_(t)}),r.onError(function(e){e!==o.helpers.abortableJob.abortedError&&h(e)})}),p.onError(h))}else if("PRESENT"===d.state&&d.initDataEnded){if(c.splice(0),a.byteLength>d.initData.byteLength){var y=new Uint8Array(a.buffer.slice(d.initData.byteLength));c.push(y)}_(d.initData)}}}),e.onCompletion(function(e){d&&"PRESENT"===d.state&&!d.initDataEnded?(_(d.initData),a.resolve(e)):d&&"PRESENT"===d.state?a.resolve(e):a.reject(new Error("Could not find init data."))}),e.onError(h),{result:a.promise,progressUpdates:{onProgressUpdate:l,getProgressSoFar:function(){return d&&"PRESENT"===d.state&&d.initDataEnded?{initData:d.initData,data:s(c)}:null}},abort:function(){e.abort(),p&&p.abort(),f&&f.abort()}}});return l.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(32),o=r(31),i=[n.OggOpusSegmentParser,o.DefaultSegmentParser];t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(2),i=r(33),a=n.helpers.find;t.SegmentParserFactory={retrieveSegmentParser:function(e){var t=a(i.default,function(t){return o.isPartialMatch(t.getFormat(),e)});if(!t)throw new Error("No segment parser found.");return t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(9),i=r(34),a=r(30),s=r(29),u=n.helpers.abortableJob.AbortableJob,l=n.eventDispatcher.EventDispatcher,c=n.logger.noOpLogger,d=function(){function e(e){var t=e.url,r=e.sequenceNumber,d=e.playlist,p=e.timeRange,f=e.encryptionConfig,h=e.initData,_=e.format,g=e.loader,y=e.playlistEventRepresentation,v=e.logger,m=void 0===v?c:v,E=e.delayCalculator,b=void 0===E?n.helpers.retry.buildExponentialDelayCalculator():E,w=e.isResponseCodeAcceptable,P=void 0===w?function(e){return 200===e}:w,S=e.isResponseCodeRetryable,R=void 0===S?function(e){return!(e>=400&&e<500)}:S,A=this;this._onSegmentRequestQueued=new l,this._onSegmentRequestStart=new l,this._onSegmentRetrieved=new l,this._onSegmentRequestFailed=new l,this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this._sequenceNumber=r,this._playlist=d,this._timeRange=p,this._format=_;var O=this._segmentEventRepresentation=new o.Segment(y,t,r),T=a.getSegmentDownloadJob({delayCalculator:b,segmentEventRepresentation:O,url:t,loader:g,onSegmentRequestQueued:this._onSegmentRequestQueued,onSegmentRequestStart:this._onSegmentRequestStart,onSegmentRequestFailed:this._onSegmentRequestFailed,onSegmentRetrieved:this._onSegmentRetrieved,isResponseCodeAcceptable:P,isResponseCodeRetryable:R,logger:m}),M=s.getSegmentDownloadAndDecryptJob({encryptionConfig:f,downloadAbortableJob:T,logger:m});this._retrieveAbortableJob=new u(function(){var e=i.SegmentParserFactory.retrieveSegmentParser(A._format),t=new l,r=n.helpers.deferred.buildDeferred(),o=e.parseSegmentData(n.helpers.abortableJob.map(function(){return M.run()},{convertProgressUpdate:function(e,t){return t&&h?n.helpers.arrayBuffer.combine([h,e]):e},convertResult:function(e){return e}}).run(),A,A._playlist);return o.onProgressUpdate(t.dispatch,{skipPast:!0}),o.onCompletion(function(){return r.resolve(void 0)}),o.onError(r.reject),{result:r.promise,progressUpdates:{onProgressUpdate:t,getProgressSoFar:o.getProgressSoFar},abort:o.abort}})}return e.prototype.getFormat=function(){return this._format},e.prototype.getSequenceNumber=function(){return this._sequenceNumber},e.prototype.isFinalSegment=function(){var e=this._playlist;return e.hasEnded()&&e.getFirstSegmentIndex()+e.getSegmentCount()-1===this._sequenceNumber},e.prototype.getTimeRange=function(){return this._timeRange},e.prototype.getEventRepresentation=function(){return this._segmentEventRepresentation},e.prototype.retrieveData=function(){var e=this,t=new u(function(){var t=n.helpers.deferred.buildDeferred(),r=new l,o=[],i=e._retrieveAbortableJob.run(),a=void 0;return i.onProgressUpdate(function(e){var t=e.data,n=e.initData;o.length||(a=n),o.push(t),r.dispatch({data:t,initData:a})}),i.onCompletion(function(){t.resolve(void 0)}),i.onError(t.reject),{result:t.promise,progressUpdates:{onProgressUpdate:r,getProgressSoFar:function(){return o.length?{initData:a,data:n.helpers.arrayBuffer.combine(o)}:null}},abort:function(){return i.abort()}}});return t.run()},e}();t.Segment=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),i=o.eventDispatcher.EventDispatcher;!function(e){e[e.LIVE=0]="LIVE",e[e.EVENT=1]="EVENT",e[e.VOD=2]="VOD"}(n=t.PlaylistType||(t.PlaylistType={}));var a=function(){function e(){this._onPlaylistRequestQueued=new i,this._onPlaylistRequestStart=new i,this._onPlaylistRetrieved=new i,this._onPlaylistRequestFailed=new i,this._onPlaylistParseStart=new i,this._onPlaylistParseEnd=new i,this._onKeyRequestQueued=new i,this._onKeyRequestStart=new i,this._onKeyRetrieved=new i,this._onKeyRequestFailed=new i,this._onInitDataRequestQueued=new i,this._onInitDataRequestStart=new i,this._onInitDataRetrieved=new i,this._onInitDataRequestFailed=new i,this._onUpdated=new i,this.onPlaylistRequestQueued=this._onPlaylistRequestQueued.getHandle(),this.onPlaylistRequestStart=this._onPlaylistRequestStart.getHandle(),this.onPlaylistRetrieved=this._onPlaylistRetrieved.getHandle(),this.onPlaylistRequestFailed=this._onPlaylistRequestFailed.getHandle(),this.onPlaylistParseStart=this._onPlaylistParseStart.getHandle(),this.onPlaylistParseEnd=this._onPlaylistParseEnd.getHandle(),this.onKeyRequestQueued=this._onKeyRequestQueued.getHandle(),this.onKeyRequestStart=this._onKeyRequestStart.getHandle(),this.onKeyRetrieved=this._onKeyRetrieved.getHandle(),this.onKeyRequestFailed=this._onKeyRequestFailed.getHandle(),this.onInitDataRequestQueued=this._onInitDataRequestQueued.getHandle(),this.onInitDataRequestStart=this._onInitDataRequestStart.getHandle(),this.onInitDataRetrieved=this._onInitDataRetrieved.getHandle(),this.onInitDataRequestFailed=this._onInitDataRequestFailed.getHandle(),this.onUpdated=this._onUpdated.getHandle()}return e.prototype.update=function(){var e=this,t=this._update();return t.onCompletion(function(){return e._onUpdated.dispatch(void 0)}),t},e.prototype.getSegment=function(e){return this.getSegments(e,e+1)[0]},e.prototype.getSegments=function(e,t){var r=this.getSegmentCount(),n=this.getFirstSegmentIndex();if(void 0===t&&(t=n+r),void 0===e&&(e=n),en+r)throw new Error("Invalid range of segments.");for(var o=[],i=e;it?n.end>t&&n.startt||n.start 0.");if(o<0)throw new Error("Cache size must be > 0.");this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this.onSegmentDataRetrieveStarted=this._onSegmentDataRetrieveStarted.getHandle(),this.onSegmentReady=this._onSegmentReady.getHandle(),this.onError=this._onError.getHandle(),this._playlist=t,this._transmuxer=i,this._getPosition=r,this._maxBufferLength=n,this._cacheSize=o,this.update()}return e.prototype.updateMaxBufferLength=function(e){if(this._ensureNotDead(),e<0)throw new Error("Max buffer length must be > 0.");this._logger.debug("updateMaxBufferLength() called.",e),this._maxBufferLength=e,this.update()},e.prototype.updateCacheSize=function(e){if(this._ensureNotDead(),e<0)throw new Error("Cache size must be > 0.");this._cacheSize=e,this.update()},e.prototype.getCacheSize=function(){return this._cacheSize},e.prototype.getCacheUsage=function(){return this._segments.reduce(function(e,t){return t.state===o.RETRIEVING_DATA||t.state===o.COMPLETE?e+t.size:e},0)},e.prototype.switchPlaylist=function(e){if(this._ensureNotDead(),e&&!e.hasInitialUpdateCompleted())throw new Error("Playlist retrieve has not completed.");this._logger.debug("switchPlaylist() called."),this._abortCurrentRetrieve(),this._playlist=e,this._segments=this._segments.filter(function(e){return e.state===o.COMPLETE}),this.update()},e.prototype.getSegmentsWithData=function(){return this._ensureNotDead(),this._segments.filter(function(e){return e.state===o.RETRIEVING_DATA&&e.size||e.state===o.COMPLETE}).map(function(e){var t=e.segment,r=e.dataRetrieveJob;return{segment:t,dataRetrieveJob:r,complete:e.state===o.COMPLETE}})},e.prototype.update=function(){var e=this;this._ensureNotDead(),this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null);var t=this._getPosition(),r=t,n=0;this._segments.some(function(e){if(e.state!==o.COMPLETE)return!1;var i=e.segment.getTimeRange();return i.containsTime(n)&&(n=i.end),!(i.endr||(r=i.end,!1))});var i=t+this._maxBufferLength,a=function(){var t=e._playlist;if(t){var o=t.hasEnded()&&r===t.getDuration();if(o)return r=n,t.getDuration()+n0&&t._onSegmentDataRetrieveStarted.dispatch({segment:e.segment,dataRetrieveJob:r,complete:!1})}),n.onCompletion(function(){if(t._retrievingSegment=null,l.state!==o.RETRIEVING_DATA)throw new Error("Incorrect retrieval state.");t._switchSegment(l,{state:o.COMPLETE,dataRetrieveJob:l.dataRetrieveJob,dataRetrieveJobHandle:l.dataRetrieveJobHandle,segment:e.segment,size:l.size}),t._logger.debug("Segment retrieve completed.",e.segment.getEventRepresentation()),t.update(),t._onSegmentReady.dispatch({segment:e.segment,complete:!0,dataRetrieveJob:l.dataRetrieveJob})}),n.onError(function(r){r!==d&&(t._logger.error("Error retrieving segment data.",r,e.segment.getEventRepresentation()),t._scheduleNextUpdate(),r instanceof a.OggParserError&&(r=r instanceof a.ChecksumFailedError?new s.OggParserError("CHECKSUM_FAILED"):r instanceof a.NoSegmentsInPageError?new s.OggParserError("NO_SEGMENTS_IN_PAGE"):r instanceof a.PageFromDifferentBitstreamError?new s.OggParserError("PAGE_FROM_DIFFERENT_BITSTREAM"):r instanceof a.PageSequenceNumberDidNotIncrementError?new s.OggParserError("SEQUENCE_NUMBER_DID_NOT_INCREMENT"):r instanceof a.UnexpectedBOSError?new s.OggParserError("UNEXPECTED_BOS"):r instanceof a.UnexpectedEOSError?new s.OggParserError("UNEXPECTED_EOS"):new s.OggParserError("UNKNOWN")),t._onError.dispatch(r))})}},e.prototype._retrieveSegment=function(e){var t=this,r=this._retrievingSegment,n=this._playlist,i=n?n.getSegmentIndexContainingTime(e):null;if(!r||r.state!==o.RETRIEVING_SEGMENT||r.segmentIndex!==i)if(this._abortCurrentRetrieve(),n)if(null===i)this._scheduleNextUpdate();else{var a=n.getSegment(i);this._logger.debug("Retrieving segment.",i),a.onCompletion(function(e){if(t._logger.debug("Retrieved segment.",i),!u.isPartialMatch(t._transmuxer.getInputFormat(),e.getFormat())){var r=new Error("Segment format is not supported by transmuxer.");return t._logger.error("Segment incorrect format.",r),t._scheduleNextUpdate(),void t._onError.dispatch(r)}e.onSegmentRequestQueued.subscribe(t._onSegmentRequestQueued.dispatch),e.onSegmentRequestStart.subscribe(t._onSegmentRequestStart.dispatch),e.onSegmentRetrieved.subscribe(t._onSegmentRetrieved.dispatch),e.onSegmentRequestFailed.subscribe(t._onSegmentRequestFailed.dispatch),t._segments.splice(t._segments.indexOf(s),1);var n=e.getTimeRange(),a=t._segments.length;t._segments.some(function(e,t){return e.state!==o.RETRIEVING_SEGMENT&&(e.segment.getTimeRange().start>n.start&&(a=t,!0))}),t._segments.splice(a,0,{state:o.RETRIEVED_SEGMENT,segment:e}),t._retrievingSegment=null,t.update()}),a.onError(function(e){e!==d&&(t._logger.error("Error retrieving segment.",e),t._scheduleNextUpdate(),t._onError.dispatch(e))});var s={state:o.RETRIEVING_SEGMENT,segmentIndex:i,segmentRetrieveJob:a};this._segments.push(s),this._retrievingSegment=s}else this._logger.debug("Cannot retrieve segment as there is no playlist."),this._scheduleNextUpdate()},e.prototype._abortCurrentRetrieve=function(){var e=this._retrievingSegment;e&&(e.state===o.RETRIEVING_SEGMENT?(this._logger.debug("Aborting segment retrieve job."),e.segmentRetrieveJob.abort()):e.state===o.RETRIEVING_DATA&&(this._logger.debug("Aborting segment data retrieve job."),e.dataRetrieveJobHandle.abort(),this._switchSegment(e,{state:o.RETRIEVED_SEGMENT,segment:e.segment})),this._retrievingSegment=null)},e.prototype._switchSegment=function(e,t){var r=this._segments.indexOf(e);if(r===-1)throw new Error("Old segment missing.");this._segments.splice(r,1,t)},e.prototype._garbageCollect=function(e){var t=this._segments,r=this._cacheSize,i=this.getCacheUsage();if(!(i<=r)){var a=this._playlist,s=a&&a.getCompleteDuration(),u=null!==s?s:1/0,l=e+this._maxBufferLength;l>u&&(l-=u,l>=e)||t.filter(function(t){return t.state===o.COMPLETE&&!n(t.segment,e,l)}).map(function(t){var r=t.segment.getTimeRange(),n=r.start,o=Math.min(Math.abs(e-n),n+u-e);return{segment:t,distance:o,size:t.size}}).sort(function(e,t){return t.distance-e.distance}).some(function(e){return i<=r||(t.splice(t.indexOf(e.segment),1),i-=e.size,!1)})}},e.prototype._scheduleNextUpdate=function(){var e=this;this._timerId||(this._timerId=window.setTimeout(function(){e._timerId=null,e.update()},1e3))},e.prototype._ensureNotDead=function(){if(this._dead)throw new Error("Playlist segment retriever has been killed.")},e}();t.PlaylistSegmentRetriever=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(37);t.PlaylistSegmentRetriever=n.PlaylistSegmentRetriever;var o=r(36);t.Playlist=o.Playlist,t.PlaylistType=o.PlaylistType;var i=r(35);t.Segment=i.Segment;var a=r(24);t.TransmuxerFactory=a.TransmuxerFactory;var s=r(4);t.MP3ToMP4Transmuxer=s.MP3ToMP4;var u=r(6);t.PassThroughTransmuxer=u.PassThrough;var l=r(17);t.retrievalErrors=l.retrievalErrors;var c=r(14);t.events=c.events}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=11)}([function(e,t,r){"use strict"; -Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._msg=e}return e.prototype.getMsg=function(){return this._msg},e}();t.OggParserError=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.IncompletePageError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.NoSegmentsInPageError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedEOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedBOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageSequenceNumberDidNotIncrementError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageFromDifferentBitstreamError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.ChecksumFailedError=i},function(e,t,r){"use strict";function n(e){var t=0;return e.forEach(function(e){for(var r=0;r>24&255^e[r]]}),t>>>0}Object.defineProperty(t,"__esModule",{value:!0});var o=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);t.calculateCRC=n},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t,r){if(void 0===r&&(r=1),t<0||t+r>e.byteLength)throw new Error("extract() out of bounds. "+t+" "+r+" "+e.byteLength);return e.slice(t,t+r)}function o(e,t){return void 0===t&&(t=!0),new DataView(e).getUint32(0,t)}function i(e){for(var t=e.buffer,r=[],n=e.byteOffset,o=!0;n0)throw new f.UnexpectedBOSError("Got BOS on a page which is not the first.");var v=!!(4&c);if(v&&s!==e.length-1)throw new h.UnexpectedEOSError("Got EOS on a page which is not the last.");var m=0;l&&(n=null);var E=a.segments.length;a.segments.forEach(function(e,t){if(n?n.data=y([n.data,e]):_&&0===t||(n={granulePosition:null,pageSequenceNumber:r,packetOffset:m,discontinuity:l&&0===m,first:g&&0===m,last:!1,data:e},m++),n&&e.byteLength<255){var s=t===E-1;s&&(n.granulePosition=o(a.header.granulePosition.buffer)),n.last=v&&s,i.push(n),n=null}})}),i}Object.defineProperty(t,"__esModule",{value:!0});var u=r(9),l=r(8),c=r(7),d=r(6),p=r(5),f=r(4),h=r(3),_=r(2),g=r(1),y=u.helpers.arrayBuffer.combine,v=new Uint8Array([79,103,103,83]),m=new Uint8Array([0,0,0,0]),E=27;t.retrievePages=i,t.parsePage=a,t.retrievePackets=s},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819,n(r(10));var o=r(0);t.OggParserError=o.OggParserError;var i=r(7);t.ChecksumFailedError=i.ChecksumFailedError;var a=r(2);t.NoSegmentsInPageError=a.NoSegmentsInPageError;var s=r(6);t.PageFromDifferentBitstreamError=s.PageFromDifferentBitstreamError;var u=r(5);t.PageSequenceNumberDidNotIncrementError=u.PageSequenceNumberDidNotIncrementError;var l=r(4);t.UnexpectedBOSError=l.UnexpectedBOSError;var c=r(3);t.UnexpectedEOSError=c.UnexpectedEOSError;var d=r(1);t.IncompletePageError=d.IncompletePageError}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e,t){var r=s(e),n=u(t.byteLength);return a([r,n,t])}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.arrayBuffer,a=i.combine,s=i.numberToUint8Array,u=i.createVintBuffer;t.IDS={EBML:440786851,EBMLVersion:17030,EBMLReadVersion:17143,EBMLMaxIDLength:17138,EBMLMaxSizeLength:17139,DocType:17026,DocTypeVersion:17031,DocTypeReadVersion:17029,Segment:408125543,Info:357149030,Duration:17545,Tracks:374648427,TrackEntry:174,TrackNumber:215,TrackUID:29637,FlagLacing:156,CodecID:134,CodecDelay:22186,SeekPreRoll:22203,TrackType:131,Audio:225,Channels:159,SamplingFrequency:181,CodecPrivate:25506,Cluster:524531317,Timecode:231,SimpleBlock:163},t.encodeElement=n},function(e,t,r){"use strict";function n(e){var t=3&e[0];return 0===t?1:3!==t?2:63&e[1]}function o(e){var t=e[0]>>>3&31;if(t>=f.length)throw new Error("Invalid configuration.");return f[t]}function i(e){if(!e.first)throw new Error("OpusHead is always in the first packet.");var t=e.data,r=new DataView(t.buffer),n=r.getUint8(9),o=r.getUint8(18),i=void 0,a=void 0,s=void 0;if(o>0){i=r.getUint8(18),a=r.getUint8(19),s=[];for(var u=0;u=128||t<-128)throw new Error("outputGainOverride invalid. It must be >= -128 and < 128.");i(e),new DataView(e.data.buffer).setInt16(16,Math.round(t*Math.pow(2,8)),!0)}function s(e){var t=e[0];if(!t||!t.first)throw new Error("Missing start of stream.");var r=e.slice(2),a=i(t),s=0,u=r.map(function(e){var t=new Uint8Array(4);t[0]=129,new DataView(t.buffer).setInt16(1,s),t[3]=128;var r=n(e.data);return s+=r*o(e.data),l.encodeElement(l.IDS.SimpleBlock,d([t,e.data]))}),c=d([l.encodeElement(l.IDS.EBML,function(){return d([l.encodeElement(l.IDS.EBMLVersion,p(1)),l.encodeElement(l.IDS.EBMLReadVersion,p(1)),l.encodeElement(l.IDS.EBMLMaxIDLength,p(4)),l.encodeElement(l.IDS.EBMLMaxSizeLength,p(8)),l.encodeElement(l.IDS.DocType,new Uint8Array([119,101,98,109])),l.encodeElement(l.IDS.DocTypeVersion,p(1)),l.encodeElement(l.IDS.DocTypeReadVersion,p(2))])}()),l.encodeElement(l.IDS.Segment,function(){return l.encodeElement(l.IDS.Info,function(){return l.encodeElement(l.IDS.Duration,function(){var e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,s),e}())}())}()),l.encodeElement(l.IDS.Tracks,function(){return l.encodeElement(l.IDS.TrackEntry,function(){return d([l.encodeElement(l.IDS.TrackNumber,p(1)),l.encodeElement(l.IDS.TrackUID,p(1)),l.encodeElement(l.IDS.FlagLacing,p(0)),l.encodeElement(l.IDS.CodecID,new Uint8Array([65,95,79,80,85,83])),l.encodeElement(l.IDS.CodecDelay,p(a.preSkip/48e3*1e9)),l.encodeElement(l.IDS.SeekPreRoll,new Uint8Array([4,196,180,0])),l.encodeElement(l.IDS.TrackType,p(2)),l.encodeElement(l.IDS.Audio,function(){return d([l.encodeElement(l.IDS.Channels,p(a.channelCount)),l.encodeElement(l.IDS.SamplingFrequency,new Uint8Array([64,231,112,0,0,0,0,0]))])}()),l.encodeElement(l.IDS.CodecPrivate,t.data)])}())}())]),f=l.encodeElement(l.IDS.Cluster,function(){var e=[l.encodeElement(l.IDS.Timecode,p(0))];return e.push.apply(e,u),d(e)}());return{initData:c,data:f}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(0),l=r(1),c=u.helpers.arrayBuffer,d=c.combine,p=c.numberToUint8Array,f=[10,20,40,60,10,20,40,60,10,20,40,60,10,20,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20];t.parseOpusHead=i,t.setOutputGain=a,t.buildWebm=s},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819,n(r(2))}])})},function(e,t,r){!function(t,n){e.exports=n(r(7),r(2))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function n(e){return 0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1?e.slice(1,-1):e}function o(e){0===e.indexOf("0x")&&(e=e.substr(2));var t=new Uint16Array(8);if(e.length%4!==0)throw new f("Failed to parse IV (length is not multiple of 4).");for(var r=0;r>8*(15-r)&255;return t}function a(e){return!(e>=400&&e<500)}function s(e){var t={};O.lastIndex=0;for(var r;null!==(r=O.exec(e));){var o=r[1].trim().toLowerCase(),i=n(r[2].trim());t[o]=i}return t}var u=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var l,c=r(1),d=r(0),p=d.retrievalErrors.UnacceptableResponseStatusCodeError,f=d.retrievalErrors.PlaylistParseError,h=d.retrievalErrors.UnsupportedEncryptionError,_=c.helpers.abortableJob.AbortableJob,g=c.helpers.deferred.buildDeferred,y=c.helpers.cache.buildCache,v=c.helpers.retry,m=v.retry,E=v.buildExponentialDelayCalculator,b=c.helpers.Promise,w=c.helpers.find,P=c.helpers.url,S=c.logger.prefixLogger,R=c.logger.noOpLogger,A=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(MAP):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF): *(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE): *(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g,O=/(.+?)=(.+?)(?:,|$)/g,T=/^\d*(\.\d+)?$/;!function(e){e[e.NONE=0]="NONE",e[e.AES_128=1]="AES_128",e[e.SAMPLE_AES=2]="SAMPLE_AES"}(l||(l={}));var M=function(e){function t(t){var r=t.url,n=t.playlistLoader,o=t.segmentLoader,i=t.keyLoader,s=void 0===i?null:i,u=t.segmentFormat,l=t.logger,f=void 0===l?R:l,h=t.delayCalculator,v=void 0===h?E():h,w=t.keyDelayCalculator,P=void 0===w?E():w,A=t.segmentDelayCalculator,O=t.isPlaylistResponseCodeAcceptable,T=void 0===O?function(e){return 200===e}:O,M=t.isPlaylistResponseCodeRetryable,x=void 0===M?a:M,D=t.isSegmentResponseCodeAcceptable,I=void 0===D?function(e){return 200===e}:D,k=t.isSegmentResponseCodeRetryable,C=void 0===k?a:k,N=t.isKeyResponseCodeAcceptable,L=void 0===N?function(e){return 200===e}:N,F=t.isKeyResponseCodeRetryable,U=void 0===F?a:F,j=e.call(this)||this;return j._keyRetrievalJobsCache=y(),j._initDataRetrievalJobsCache=y(),j._data=null,j._lastUpdateTime=null,j._playlistEventRepresentation=null,j._logger=S(f,"PlaylistHLS"),j._url=r,j._playlistLoader=n,j._segmentLoader=o,j._keyLoader=s,j._segmentFormat=u,j._keyDelayCalculator=P,j._isPlaylistResponseCodeAcceptable=T,j._isPlaylistResponseCodeRetryable=x,j._isSegmentResponseCodeAcceptable=I,j._isSegmentResponseCodeRetryable=C,j._isKeyOrInitDataResponseCodeAcceptable=L,j._isKeyOrInitDataResponseCodeRetryable=U,j._segmentDelayCalculator=A,j._downloadAbortableJob=new _(function(){var e=c.helpers.deferred.buildDeferred(),t=m(v,function(t){var n=t.scheduleRetry,o=new d.events.Playlist(r);j._onPlaylistRequestQueued.dispatch({playlist:o});var i=j._playlistLoader.request({url:r});return i.onRequestStart(function(){j._onPlaylistRequestStart.dispatch({playlist:o})}),j._logger.debug("Requesting playlist.",r),i.onResponseReceived(function(t){if(!t)return j._logger.warn("Playlist request timed out.",r),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:null}),void n();var i=t.statusCode;if(j._isPlaylistResponseCodeAcceptable(i)){var a=t.getData();return a?(j._logger.debug("Got playlist response.",r,i),j._onPlaylistRetrieved.dispatch({playlist:o,statusCode:i}),void e.resolve({playlistContent:a,eventRepresentation:o})):(j._logger.warn("Playlist response contained no data.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n())}return j._isPlaylistResponseCodeRetryable(i)?(j._logger.debug("Playlist response code was not acceptable. Will retry.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n()):(j._logger.debug("Playlist response code was not acceptable.",r,i),j._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void e.reject(new p(i)))}),i.onError(function(t){return t instanceof c.loaderErrors.LoaderError?(j._logger.warn("Error from loader. Will retry",r,t),void n()):void e.reject(t)}),{onCancel:function(){j._logger.debug("Aborting playlist request.",r),i.hasCompleted()||i.abort(),j._onPlaylistRequestFailed.dispatch({playlist:o,aborted:!0})}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting playlist."))}}).cancel;return{result:e.promise,abort:function(){return t()}}}),j._updateJob=new _(function(){if(j._data&&j._data.ended)return{result:b.resolve(void 0)};var e=g(),t=j._downloadAbortableJob.run();return t.onCompletion(function(t){var r=t.playlistContent,n=t.eventRepresentation;j._lastUpdateTime=c.helpers.time.now(),j._onPlaylistParseStart.dispatch({playlist:n});try{j._data=j._parsePlaylist(r)}catch(t){return j._logger.error("Error when parsing playlist.",t,r),void e.reject(t)}j._playlistEventRepresentation=n,j._onPlaylistParseEnd.dispatch({playlist:n}),e.resolve(void 0)}),t.onError(e.reject),{result:e.promise,abort:function(){return t.abort()}}}),j}return u(t,e),t.prototype.hasInitialUpdateCompleted=function(){return!!this._data},t.prototype.getType=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.type},t.prototype.getExpireTime=function(){var e=this._data,t=this._lastUpdateTime;if(!e||e.type!==d.PlaylistType.LIVE||null===t)return null;var r=e.segments.reduce(function(e,t){return e+t.timeRange.duration},0);return t+r/2},t.prototype.hasEnded=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.ended},t.prototype.getCompleteDuration=function(){return this._data&&this._data.ended?this._data.totalDuration:null},t.prototype.getDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.totalDuration},t.prototype.getTargetDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.targetDuration},t.prototype.getFirstSegmentIndex=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.mediaSequence},t.prototype.getSegmentCount=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.segments.length},t.prototype.getSegmentIndexContainingTime=function(e){var t=this._data;if(!t)throw new Error("Not loaded yet.");var r=w(t.segments,function(t){return t.timeRange.containsTime(e)});return r?t.mediaSequence+t.segments.indexOf(r):null},t.prototype._update=function(){return this._updateJob.run()},t.prototype._getSegment=function(e){var t=this,r=this._data;if(!r)throw new Error("Not loaded yet.");var n=r.segments[e-r.mediaSequence],o=new _(function(){var r=n.encryptionData,o=t._playlistEventRepresentation;if(!o)throw new Error("Playlist event representation should exist.");var i=t._buildEncryptionConfig(r,e),a=n.initDataUrl?t._retrieveInitData(n.initDataUrl):null,s=i.whenComplete().then(function(r){var i=function(i){return new d.Segment({url:n.url,sequenceNumber:e,playlist:t,timeRange:n.timeRange,format:t._segmentFormat,loader:t._segmentLoader,playlistEventRepresentation:o,logger:t._logger,delayCalculator:t._segmentDelayCalculator,isResponseCodeAcceptable:t._isSegmentResponseCodeAcceptable,isResponseCodeRetryable:t._isSegmentResponseCodeRetryable,encryptionConfig:r,initData:i})};return a?a.whenComplete().then(function(e){return i(e)}):i(void 0)});return{result:s,abort:function(){i.abort(),a&&a.abort()}}});return o.run()},t.prototype._buildEncryptionConfig=function(e,t){var r=this,n=new _(function(){if(e.method===l.NONE)return{result:b.resolve(void 0)};if(e.method!==l.AES_128)return r._logger.error("Unsupported encryption method.",e.method),{result:b.reject(new h)};var n=r._keyLoader;if(!n)return{result:b.reject(new Error("Encryption method not supported as no key loader provided."))};var o=r._retrieveKey(e.keyUrl),a=o.whenComplete().then(function(r){return{cipher:"AES-CBC",key:r,iv:e.iv||i(t)}});return{result:a,abort:function(){return o.abort()}}},{storeResult:!0});return n.run()},t.prototype._retrieveKey=function(e){var t=this,r=this._keyLoader;if(!r)throw new Error("No key loader.");var n=this._playlistEventRepresentation;if(!n)throw new Error("Playlist event representation should exist.");var o=new d.events.Key(n,e);return this._retrieveKeyOrInitData({url:e,loader:r,cache:this._keyRetrievalJobsCache,onRequestQueued:function(){return t._onKeyRequestQueued.dispatch({key:o})},onRequestStart:function(){return t._onKeyRequestStart.dispatch({key:o})},onRequestTimedOut:function(){t._onKeyRequestFailed.dispatch({key:o,statusCode:null})},onRequestFailed:function(e){t._onKeyRequestFailed.dispatch({key:o,statusCode:e})},onRequestAborted:function(){t._onKeyRequestFailed.dispatch({key:o,aborted:!0})},onRetrieved:function(e){t._onKeyRetrieved.dispatch({key:o,statusCode:e})},type:"key"})},t.prototype._retrieveInitData=function(e){var t=this,r=this._playlistEventRepresentation;if(!r)throw new Error("Playlist event representation should exist.");var n=new d.events.InitData(r,e);return this._retrieveKeyOrInitData({url:e,loader:this._segmentLoader,cache:this._initDataRetrievalJobsCache,onRequestQueued:function(){return t._onInitDataRequestQueued.dispatch({initData:n})},onRequestStart:function(){return t._onInitDataRequestStart.dispatch({initData:n})},onRequestTimedOut:function(){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:null})},onRequestFailed:function(e){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:e})},onRequestAborted:function(){t._onInitDataRequestFailed.dispatch({initData:n,aborted:!0})},onRetrieved:function(e){t._onInitDataRetrieved.dispatch({initData:n,statusCode:e})},type:"init data"})},t.prototype._retrieveKeyOrInitData=function(e){var t=this,r=e.url,n=e.loader,o=e.cache,i=e.onRequestQueued,a=e.onRequestStart,s=e.onRequestTimedOut,u=e.onRequestFailed,l=e.onRequestAborted,d=e.onRetrieved,f=e.type,h=o.get(r);return h?this._logger.debug(f+" retrieval already in progress.",r):(h=new _(function(){var e=c.helpers.deferred.buildDeferred(),o=m(t._keyDelayCalculator,function(o){var h=o.scheduleRetry;i();var _=n.request({url:r});return _.onRequestStart(a),t._logger.debug("Retrieving "+f+".",r),_.onResponseReceived(function(n){if(!n)return t._logger.warn(f+" request timed out.",r),s(),void h();var o=n.statusCode;if(t._isKeyOrInitDataResponseCodeAcceptable(o)){var i=n.getData();return i?(t._logger.debug("Got "+f+" response.",r,o),d(o),void e.resolve(new Uint8Array(i))):(t._logger.warn(f+" response contained no data.",r,o),u(o),void h())}return t._isKeyOrInitDataResponseCodeRetryable(o)?(t._logger.warn(f+" response code was not acceptable. Will retry.",r,o),u(o),void h()):(t._logger.warn(f+" response code was not acceptable.",r,o),u(o),void e.reject(new p(o)))}),_.onError(function(n){return n instanceof c.loaderErrors.LoaderError?(t._logger.warn("Error from loader. Will retry",r,n),void h()):void e.reject(n)}),{onCancel:function(){t._logger.debug("Aborting "+f+" request.",r),_.hasCompleted()||_.abort(),l()}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting "+f+"."))}}).cancel;return{result:e.promise,abort:function(){return o()}}},{storeResult:!0}),o.set(r,h)),h.run()},t.prototype._parsePlaylist=function(e){var t=this._data,r={version:null,type:d.PlaylistType.LIVE,mediaSequence:null,targetDuration:null,totalDuration:0,ended:!1},n=[],i={method:l.NONE},a=null,u=null;A.lastIndex=0;for(var p,h=0,_=!1;null!==(p=A.exec(e));){var g=p.filter(function(e,t){return 0!==t&&void 0!==e}).map(function(e,t){return 0===t?e.toLowerCase():e}),y=g[0],v=g.slice(1);if(0===h){if("extm3u"!==y)throw new f("First line did not contain EXTM3U tag.")}else{if(!_)switch(y){case"playlist-type":if(r.type!==d.PlaylistType.LIVE)throw new f("Already have playlist type.");switch(v[0].toLowerCase()){case"vod":r.type=d.PlaylistType.VOD;break;case"event":r.type=d.PlaylistType.EVENT;break;default:throw new f("Invalid playlist type.")}break;case"media-sequence":if(null!==r.mediaSequence)throw new f("Already have media sequence number.");var m=parseInt(v[0],10);if(m+""!==v[0])throw new f("Invalid media sequence number.");r.mediaSequence=m;break;case"targetduration":if(null!==r.targetDuration)throw new f("Already have target duration.");var E=parseInt(v[0],10);if(E+""!==v[0]||E<0)throw new f("Invalid target duration.");r.targetDuration=1e3*E;break;case"version":if(null!==r.version)throw new f("Already have version.");var b=parseInt(v[0],10);if(b+""!==v[0])throw new f("Invalid version.");if(b<3)throw new f("HLS version must be 3 or above.");r.version=b;break;default:_=!0}if(_)switch(y){case"key":var w=s(v[0]),S="method"in w?w.method.toLowerCase():null,R="uri"in w?P.buildAbsoluteUrl(this._url,w.uri):null,O="iv"in w?o(w.iv):null;if(!S)throw new f("Missing encryption method.");if(!R&&"none"!==S)throw new f("Missing key url.");switch(S){case"none":if(null!==R)throw new f("Key url not allowed.");if(null!==O)throw new f("IV not allowed.");i={method:l.NONE};break;case"aes-128":if(!R)throw new f("Key url required.");i={method:l.AES_128,keyUrl:R,iv:O};break;case"sample-aes":if(!R)throw new f("Key url required.");i={method:l.SAMPLE_AES,keyUrl:R,iv:O};break;default:throw new f("Unknown encryption method.")}break;case"map":var w=s(v[0]);if(!("uri"in w))throw new f("URI missing from EXT-X-MAP tag.");if("byterange"in w)throw new f("BYTERANGE in EXT-X-MAP tag is currently unsupported.");a=w.uri?P.buildAbsoluteUrl(this._url,w.uri):null;break;case"inf":if(!v[0].match(T))throw new f("Invalid segment duration.");u=1e3*parseFloat(v[0]);break;case"":if(r.ended)throw new f("Already received ENDLIST tag.");if(null===u)throw new f("Not received segment duration.");var M=P.buildAbsoluteUrl(this._url,v[0]);n.push({url:M,timeRange:new c.TimeRange(r.totalDuration,u),initDataUrl:a,encryptionData:i}),r.totalDuration+=u,u=null;break;case"endlist":if(r.ended)throw new f("Already had ENDLIST tag.");r.ended=!0;break;default:this._logger.warn("Unable to parse playlist line.",y)}}h++}var x=r.version,D=r.type,I=r.mediaSequence,k=r.targetDuration,C=r.ended,N=r.totalDuration;if(null===x)throw new f("Missing version.");if(null===k)throw new f("Missing target duration.");if(C&&D===d.PlaylistType.LIVE)throw new f("Cannot be ended if type is LIVE.");if(!C&&D===d.PlaylistType.VOD)throw new f("Must be ended if type is VOD.");if(null===I&&(I=0),t){if(t.type!==D)throw new f("Playlist type has changed since last update.");if(t.type===d.PlaylistType.EVENT&&I!==t.mediaSequence)throw new f("Media sequence number has changed. Not valid for EVENT playlist.");var L=t.segments[I-t.mediaSequence];if(!L)throw new f("Tracking lost. The last segment of the previous playlist is no longer in the new one.");var F=L.timeRange.start;n.forEach(function(e){var t=e.timeRange;e.timeRange=new c.TimeRange(t.start+F,t.duration)}),N+=F}return{version:x,type:D,mediaSequence:I,targetDuration:k,totalDuration:N,ended:C,segments:n}},t}(d.Playlist);t.PlaylistHLS=M},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(2);t.PlaylistHLS=n.PlaylistHLS}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=7)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[] -}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r,n){void 0===r&&(r={}),void 0===n&&(n=2e4);var o=e.call(this)||this;if(o._responseStarted=!1,n<0)throw new Error("Invaid timeout.");o._timeoutTimer=window.setTimeout(function(){return o._onManualTimeout()},n),o._xhr=new XMLHttpRequest,o._xhr.addEventListener("load",function(){return o._onLoad()}),o._xhr.addEventListener("abort",function(){return o._onAbort()}),o._xhr.addEventListener("error",function(e){return o._onError(e)}),o._xhr.addEventListener("timeout",function(){return o._onTimeout()}),o._xhr.addEventListener("loadend",function(){return o._onLoadEnd()}),o._xhr.addEventListener("progress",function(){return o._onProgress()}),o._xhr.open("GET",t,!0),o._xhr.timeout=n;var i=o._getResponseType().some(function(e){return o._xhr.responseType=e,o._xhr.responseType===e});if(!i)throw new Error("Failed setting response type.");return Object.keys(r).forEach(function(e){return o._xhr.setRequestHeader(e,r[e])}),o._signalRequestStart(),o._xhr.send(),o}return n(t,e),t.prototype._abort=function(){this._xhr.abort()},t.prototype._onAbort=function(){this.hasCompleted()||this._onTimeout()},t.prototype._onManualTimeout=function(){this.hasCompleted()||(this._signalTimeout(),this._xhr.abort())},t.prototype._onTimeout=function(){this.hasCompleted()||this._signalTimeout()},t.prototype._onLoad=function(){if(!this.hasCompleted()){if(!this._isChunkedResponse()){var e=this._xhr;this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)}this.hasCompleted()||this._finalize()}},t.prototype._onError=function(e){switch(this.getState()){case o.loader.ResponseState.COMPLETED:case o.loader.ResponseState.ERRORED:break;case o.loader.ResponseState.PENDING:if(0===this._xhr.status){this._provideStatusAndHeaders({statusCode:0,headers:{}},this._getEmptyData()),this._finalize();break}default:this._finalize(new o.loaderErrors.LoaderError("An error occurred.",e))}},t.prototype._onLoadEnd=function(){window.clearTimeout(this._timeoutTimer),this.hasCompleted()||this._finalize(new o.loaderErrors.LoaderError("Unexpected error occurred."))},t.prototype._onProgress=function(){if(!this.hasCompleted()){var e=this._xhr;this._isChunkedResponse()&&(this._responseStarted?this._providePart(e.response):(this._responseStarted=!0,this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)))}},t.prototype._isChunkedResponse=function(){return"moz-chunked-arraybuffer"===this._xhr.responseType},t.prototype._parseHeaders=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0,o=r.length;n0){var s=i.substring(0,a).trim(),u=i.substring(a+2);t[s]=u}}return t},t}(o.loader.LoaderRequest);t.LoaderRequest=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.browser.isFirefox(),a=function(e){function t(r,n,i){void 0===n&&(n={}),void 0===i&&(i=2e4);var a=e.call(this)||this;if(!t.isSupported())throw new Error("Not supported.");var s=a._abortController=new AbortController,u=new Request(r,{headers:n,redirect:"follow",signal:s.signal});a._signalRequestStart();var l=a._abortTimer=window.setTimeout(function(){a._signalTimeout(),a._abort()},i),c=fetch(u).then(function(e){var t={};if(e.headers.forEach(function(e,r){return t[e]=r}),a._provideStatusAndHeaders({statusCode:e.status,headers:t},new ArrayBuffer(0)),e.body){var r=e.body.getReader(),n=function(){return r.read().then(function(e){var t=e.done,r=e.value;if(!t&&!a.hasCompleted())return a._providePart(r.buffer),n()})};return n()}return e.arrayBuffer().then(function(e){e&&a._providePart(e)})}).then(function(){a.hasCompleted()||a._finalize()}).catch(function(e){if(!a.hasCompleted()){var t=e instanceof o.loaderErrors.LoaderError?e:new o.loaderErrors.LoaderError(e);a._finalize(t)}});return o.helpers.always(c,function(){return window.clearTimeout(l)}),a}return n(t,e),t.isSupported=function(){return"fetch"in window&&"Request"in window&&"AbortController"in window&&!i},t.prototype._abort=function(){window.clearTimeout(this._abortTimer),this._abortController.abort()},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(o.loader.LoaderRequest);t.ArrayBufferLoaderRequest=a},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(1),a=o.helpers.browser.getFirefoxVersion(),s=a&&a.major>=60?["moz-chunked-arraybuffer","arraybuffer"]:["arraybuffer"],u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return s},t.prototype._getEmptyData=function(){return new ArrayBuffer(0)},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(i.LoaderRequest);t.ArrayBufferLoaderRequest=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(3),o=r(2),i=function(){function e(e){var t=(void 0===e?{}:e).fetchEnabled,r=void 0===t||t;this._fetchEnabled=r}return e.prototype.request=function(e){var t=e.url,r=e.headers,i=e.timeout;return this._fetchEnabled&&o.ArrayBufferLoaderRequest.isSupported()?new o.ArrayBufferLoaderRequest(t,r,i):new n.ArrayBufferLoaderRequest(t,r,i)},e}();t.ArrayBufferLoader=i,t.arrayBufferLoader=new i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=["text"],a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return i},t.prototype._getEmptyData=function(){return""},t.prototype._reduceParts=function(e){return e.join("")},t}(o.LoaderRequest);t.StringLoaderRequest=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(5);t.stringLoader={request:function(e){var t=e.url,r=e.headers,o=e.timeout;return new n.StringLoaderRequest(t,r,o)}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.0.0",t.buildNumber=1819;var n=r(6);t.stringLoader=n.stringLoader;var o=r(4);t.arrayBufferLoader=o.arrayBufferLoader,t.ArrayBufferLoader=o.ArrayBufferLoader}])})},function(e,t,r){!function(t,n){e.exports=n(r(1),r(2))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){if(void 0===t&&(t=6e4),this._limit=e,this._period=t,this._jobs=[],this._jobsRunInPeriod=0,e<=0)throw new Error("limit must be > 0.");if(t<=0)throw new Error("period must be > 0.")}return e.prototype.execute=function(e){var t=this,r={job:e};return this._jobs.push(r),this._executeNextJob(),{abort:function(){var e=t._jobs.indexOf(r);e>=0&&t._jobs.splice(e,1)}}},e.prototype._executeNextJob=function(){var e=this;if(this._jobsRunInPeriod 0.");if("string"!=typeof h)throw new Error("endpointBaseUrl must be > 0.");if("boolean"!=typeof g)throw new Error("encryptedStreamsEnabled invalid.");return y._loader=r,y._clientId=n,y._requestAuthorization=u,y._trackId=o,y._secretToken=a,y._endpointBaseUrl=h,y._encryptedStreamsEnabled=g,y._excludedRenditions=c,y._maxBitrate=p,y}return n(t,e),t.prototype.getTrackId=function(){return this._trackId},t.prototype.excludeRendition=function(e){this._excludedRenditions.indexOf(e)<0&&this._excludedRenditions.push(e)},t.prototype.updateRequestAuthorization=function(e){if(null!==e&&"string"!=typeof e)throw new Error("requestAuthorizaton invalid.");this._requestAuthorization=e},t.prototype.clearCache=function(){this._clearResponseTimer&&(window.clearTimeout(this._clearResponseTimer),this._clearResponseTimer=null),this._getUrlsJob=null},t.prototype.getMaxBitrate=function(){return this._maxBitrate},t.prototype.setMaxBitrate=function(e){if("number"!=typeof e||e<=0)throw new Error("maxBitrate must be > 0.");this._maxBitrate=e},t.prototype.getUrl=function(){var e=this,t=this._maxBitrate,r=this._excludedRenditions,n=new s(function(){var n=o.helpers.deferred.buildDeferred(),a=e._getUrls();return a.onCompletion(function(e){var o=e.urls,i=e.timeRetrieved,a=null;f.filter(function(e){return r.indexOf(e)<0}).some(function(e){var r=o.filter(function(t){return t.rendition===e}).map(function(e){return{url:e.url,bitrate:e.bitrate}}),n=u(r.sort(function(e,t){return t.bitrate-e.bitrate}),function(e){return e.bitrate<=t});return!!n&&(a={success:!0,url:n.url,rendition:e,bitrate:n.bitrate,timeRetrieved:i},!0)}),n.resolve(a)}),a.onError(function(e){e instanceof i.UrlRetrieverError?n.resolve({success:!1,error:e}):n.reject(e)}),{result:n.promise,abort:function(){return a.abort()}}});return n.run()},t.prototype._getUrls=function(){var e=this;return this._getUrlsJob||(this._getUrlsJob=new s(function(){var t=o.helpers.deferred.buildDeferred(),r=null,n=d.execute(function(){var n=e._requestAuthorization?{Authorization:e._requestAuthorization}:{},o=e._endpointBaseUrl+"i1/tracks/"+encodeURI(e._trackId+"")+"/streams?client_id="+encodeURIComponent(e._clientId);e._encryptedStreamsEnabled&&(o+="&with_encrypted_streams=true"),e._secretToken&&(o+="&secret_token="+encodeURIComponent(e._secretToken)),r=e._loader.request({url:o,headers:n});var a=r.getResponse().then(function(e){if(!e)throw new i.UrlRetrieverError("TIMED_OUT",!0);if(200!==e.statusCode)throw new i.UrlRetrieverError("INVALID_STATUS_"+e.statusCode);var t=e.getData();if(!t)throw new i.UrlRetrieverError("NO_DATA");var r=l.now(),n=JSON.parse(t),o=[];return Object.keys(n).map(function(e){var t=e.split("_"),r=t[0],i=t[1],a=t[2],s=parseInt(a,10);if(r&&i&&!isNaN(s)){var l=u(f,function(e){return e.scProtocol===r&&e.scFormat===i});l&&o.push({rendition:l,bitrate:s,url:n[e]})}}),{urls:o,timeRetrieved:r}});a.then(t.resolve,t.reject)});return{result:t.promise,abort:function(){n.abort(),r&&r.abort()}}}),this._clearResponseTimer=window.setTimeout(function(){e._clearResponseTimer=null,e._getUrlsJob=null},p)),this._getUrlsJob.run()},t}(i.BaseStreamUrlRetriever);t.StreamUrlRetriever=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.1.0",t.buildNumber=845;var n=r(3);t.StreamUrlRetriever=n.StreamUrlRetriever}])})}]); \ No newline at end of file +!function(t,r){e.exports=r()}(this,function(){"use strict";function e(e){return"function"==typeof e||"object"==typeof e&&null!==e}function o(e){return"function"==typeof e}function i(e){Q=e}function a(e){Y=e}function s(){return function(){return t.nextTick(p)}}function u(){return"undefined"!=typeof K?function(){K(p)}:d()}function l(){var e=0,t=new $(p),r=document.createTextNode("");return t.observe(r,{characterData:!0}),function(){r.data=e=++e%2}}function c(){var e=new MessageChannel;return e.port1.onmessage=p,function(){return e.port2.postMessage(0)}}function d(){var e=setTimeout;return function(){return e(p,1)}}function p(){for(var e=0;e1)for(var r=1;r=0&&t._stack.splice(o,1),t._stack.length?t._makeActive(t._stack[0]):(t._active=null,t._updateHandlers({}),t._mediaSession.playbackState="none")}}}},e.prototype._handleUpdate=function(e){var t=e.getPlayer().isPlaying();t&&this._makeActive(e),this._isActive(e)&&(this._mediaSession.playbackState=t?"playing":"paused")},e.prototype._isActive=function(e){return this._active===e},e.prototype._makeActive=function(e){if(!this._isActive(e)){var t=this._stack.indexOf(e);t>=0&&this._stack.splice(t,1),this._stack.unshift(e),this._active=e,this._updateHandlers(e.getHandlers())}},e.prototype._updateHandlers=function(e){this._mediaSession.setActionHandler("play",e.play||null),this._mediaSession.setActionHandler("pause",e.pause||null),this._mediaSession.setActionHandler("seekforward",e.seekForward||null),this._mediaSession.setActionHandler("seekbackward",e.seekBackward||null)},e}();t.MediaSessionManager=i,t.mediaSessionManager=new i(o);var a=function(){function e(e,t){void 0===t&&(t={}),this._player=e,this._handlers=t}return e.prototype.getHandlers=function(){return this._handlers},e.prototype.getPlayer=function(){return this._player},e}();t.MediaSessionItem=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(24),i=r(47),a=r(28),s=r(17),u=r(11),l=r(5);!function(e){e.PlayerError=u.PlayerError,e.PlayerFatalError=l.PlayerFatalError,e.NotSupportedError=o.NotSupportedError,e.URLUpdateError=i.URLUpdateError,e.ImplementationError=a.ImplementationError,e.ProxyProvidedPlayerFatalError=s.ProxyProvidedPlayerFatalError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(5),i=function(e){function t(t,r){return e.call(this,t||"The URL update failed for some reason.",r)||this}return n(t,e),t.prototype.getCode=function(){return"URL_UPDATE_ERROR"},t}(o.PlayerFatalError);t.URLUpdateError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(49);!function(e){e.LoaderError=o.LoaderError}(n=t.loaderErrors||(t.loaderErrors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._msg=e,this._cause=t}return e.prototype.getMsg=function(){return this._msg},e.prototype.getCause=function(){return this._cause},e}();t.LoaderError=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(9),i=r(20),a=r(51),s=r(27),u=r(16),l=r(52),c=r(14),d=r(7),p=r(53),f=r(15),h=r(54),_=r(55),g=r(1),y=r(21),v=r(56),m=r(58);!function(e){e.OnExit=s.OnExit,e.find=u.find,e.Promise=d.Promise,e.promiseWithTimeout=p.promiseWithTimeout,e.always=f.always,e.compact=h.compact,e.deferException=g.deferException,e.SCWeakMap=m.SCWeakMap;var t;!function(e){e.buildCache=l.buildCache}(t=e.cache||(e.cache={}));var r;!function(e){e.buildDeferred=o.buildDeferred}(r=e.deferred||(e.deferred={}));var n;!function(e){e.getExtension=v.getExtension,e.buildAbsoluteUrl=v.buildAbsoluteUrl}(n=e.url||(e.url={}));var E;!function(e){e.AbortableJob=i.AbortableJob,e.map=i.map,e.abortedError=i.abortedError}(E=e.abortableJob||(e.abortableJob={}));var b;!function(e){e.retry=a.retry,e.buildExponentialDelayCalculator=a.buildExponentialDelayCalculator}(b=e.retry||(e.retry={}));var w;!function(e){e.isSafari=y.isSafari,e.getSafariVersion=y.getSafariVersion,e.isIE=y.isIE,e.isEdge=y.isEdge,e.isFirefox=y.isFirefox,e.isChrome=y.isChrome,e.getChromeVersion=y.getChromeVersion,e.getFirefoxVersion=y.getFirefoxVersion}(w=e.browser||(e.browser={}));var S;!function(e){e.combine=_.combine,e.fill=_.fill,e.forEach=_.forEach,e.numberToUint8Array=_.numberToUint8Array,e.createVintBuffer=_.createVintBuffer}(S=e.arrayBuffer||(e.arrayBuffer={}));var P;!function(e){e.now=c.now}(P=e.time||(e.time={}))}(n=t.helpers||(t.helpers={}))},function(e,t,r){"use strict";function n(e,t,r){void 0===r&&(r={});var n=null,o=0,a=!1,s=null,u=function(){var l=!1,c=function(){if(l)throw new Error("scheduleRetry() already called.");if(l=!0,s=null,a)return!1;var t=e(++o);if(null===t){var c=r.onNoMoreRetries;return c&&i.deferException(function(){return c()}),!1}return n=window.setTimeout(u,t),!0};s=t({attemptNum:o,scheduleRetry:c})||null};return u(),{cancel:function(){a||(a=!0,n&&(window.clearTimeout(n),n=null),s&&s.onCancel())}}}function o(e){var t=void 0===e?{}:e,r=t.timeBase,n=void 0===r?500:r,o=t.threshold,i=void 0===o?3:o,a=t.delayCap,s=void 0===a?45e3:a,u=t.jitter,l=void 0===u?200:u,c=t.maxAttempts,d=void 0===c?null:c;if(n<=0)throw new Error("Time base must be > 0.");if(i<=0)throw new Error("Threshold must be > 0.");if(null!==s&&s<=0)throw new Error("Delay cap must be null or > 0.");if(null!==d&&d<1)throw new Error("Max attempts must be >= 1.");return function(e){if(null!==d&&e>=d)return null;var t=e>0?Math.pow(2,e/i-1):0;return Math.min(t*n,s||1/0)+Math.round(Math.random()*l)}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(1);t.retry=n,t.buildExponentialDelayCalculator=o},function(e,t,r){"use strict";function n(){return i?new window.Map:new a}Object.defineProperty(t,"__esModule",{value:!0});var o=r(16),i="undefined"!=typeof window&&"Map"in window;t.buildCache=n;var a=function(){function e(){this._store=[]}return e.prototype.set=function(e,t){var r=o.find(this._store,function(t){return t.key===e});r?r.val=t:this._store.push({key:e,val:t})},e.prototype.get=function(e){var t=o.find(this._store,function(t){return t.key===e});if(t)return t.val},e}()},function(e,t,r){"use strict";function n(e,t,r){return void 0===r&&(r=new Error("Timed out.")),new o.Promise(function(n,o){var a=window.setTimeout(function(){o(r)},t);i.always(e,function(e){return window.clearTimeout(a),e}).then(n,o)})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(7),i=r(15);t.promiseWithTimeout=n},function(e,t,r){"use strict";function n(e){return e.filter(function(e){return null!=e})}Object.defineProperty(t,"__esModule",{value:!0}),t.compact=n},function(e,t,r){"use strict";function n(e){var t=new Uint8Array(e.reduce(function(e,t){return e+t.byteLength},0)),r=0;return e.forEach(function(e){t.set(e,r),r+=e.byteLength}),t}function o(e,t){if(Uint8Array.prototype.fill)e.fill(t);else for(var r=0;r>>=8;return n}function s(e){if(e<0||e>Math.pow(2,53))throw new Error("Unrepresentable value: "+e);var t;for(t=1;t<=8&&!(e-1}},function(e,t,r){"use strict";var n,o=r(18),i=r(35),a=r(8),s=r(2),u=r(37),l=Object.defineProperty;n=e.exports=function(e,t){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");u.call(this,e),t=t?i.call(t,"key+value")?"key+value":i.call(t,"key")?"key":"value":"value",l(this,"__kind__",a("",t))},o&&o(n,u),delete n.prototype.constructor,n.prototype=Object.create(u.prototype,{_resolve:a(function(e){return"value"===this.__kind__?this.__list__[e]:"key+value"===this.__kind__?[e,this.__list__[e]]:e})}),l(n.prototype,s.toStringTag,a("c","Array Iterator"))},function(e,t,r){"use strict";var n={object:!0,symbol:!0};e.exports=function(){var e;if("function"!=typeof Symbol)return!1;e=Symbol("test symbol");try{String(e)}catch(e){return!1}return!!n[typeof Symbol.iterator]&&(!!n[typeof Symbol.toPrimitive]&&!!n[typeof Symbol.toStringTag])}},function(e,t,r){"use strict";var n,o,i,a,s=r(8),u=r(76),l=Object.create,c=Object.defineProperties,d=Object.defineProperty,p=Object.prototype,f=l(null);if("function"==typeof Symbol){n=Symbol;try{String(n()),a=!0}catch(e){}}var h=function(){var e=l(null);return function(t){for(var r,n,o=0;e[t+(o||"")];)++o;return t+=o||"",e[t]=!0,r="@@"+t,d(p,r,s.gs(null,function(e){n||(n=!0,d(this,r,s(e)),n=!1)})),r}}();i=function(e){if(this instanceof i)throw new TypeError("Symbol is not a constructor");return o(e)},e.exports=o=function e(t){var r;if(this instanceof e)throw new TypeError("Symbol is not a constructor");return a?n(t):(r=l(i.prototype),t=void 0===t?"":String(t),c(r,{__description__:s("",t),__name__:s("",h(t))}))},c(o,{for:s(function(e){return f[e]?f[e]:f[e]=o(String(e))}),keyFor:s(function(e){var t;u(e);for(t in f)if(f[t]===e)return t}),hasInstance:s("",n&&n.hasInstance||o("hasInstance")),isConcatSpreadable:s("",n&&n.isConcatSpreadable||o("isConcatSpreadable")),iterator:s("",n&&n.iterator||o("iterator")),match:s("",n&&n.match||o("match")),replace:s("",n&&n.replace||o("replace")),search:s("",n&&n.search||o("search")),species:s("",n&&n.species||o("species")),split:s("",n&&n.split||o("split")),toPrimitive:s("",n&&n.toPrimitive||o("toPrimitive")),toStringTag:s("",n&&n.toStringTag||o("toStringTag")),unscopables:s("",n&&n.unscopables||o("unscopables"))}),c(i.prototype,{constructor:s(o),toString:s("",function(){return this.__name__})}),c(o.prototype,{toString:s(function(){return"Symbol ("+u(this).__description__+")"}),valueOf:s(function(){return u(this)})}),d(o.prototype,o.toPrimitive,s("",function(){var e=u(this);return"symbol"==typeof e?e:e.toString()})),d(o.prototype,o.toStringTag,s("c","Symbol")),d(i.prototype,o.toStringTag,s("c",o.prototype[o.toStringTag])),d(i.prototype,o.toPrimitive,s("c",o.prototype[o.toPrimitive]))},function(e,t,r){"use strict";var n=r(77);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not a symbol");return e}},function(e,t,r){"use strict";e.exports=function(e){return!!e&&("symbol"==typeof e||!!e.constructor&&("Symbol"===e.constructor.name&&"Symbol"===e[e.constructor.toStringTag]))}},function(e,t,r){"use strict";var n=r(0);e.exports=function(){return n(this).length=0,this}},function(e,t,r){"use strict";var n,o=r(80),i=r(34),a=r(3),s=r(90),u=r(3),l=r(0),c=Function.prototype.bind,d=Object.defineProperty,p=Object.prototype.hasOwnProperty;n=function(e,t,r){var n,i=l(t)&&u(t.value);return n=o(t),delete n.writable,delete n.value,n.get=function(){return!r.overwriteDefinition&&p.call(this,e)?i:(t.value=c.call(i,r.resolveContext?r.resolveContext(this):this),d(this,e,t),this[e])},n},e.exports=function(e){var t=i(arguments[1]);return null!=t.resolveContext&&a(t.resolveContext),s(e,function(e,r){return n(r,e,t)})}},function(e,t,r){"use strict";var n=r(81),o=r(19),i=r(0);e.exports=function(e){var t=Object(i(e)),r=arguments[1],a=Object(arguments[2]);if(t!==e&&!r)return t;var s={};return r?n(r,function(t){(a.ensure||t in e)&&(s[t]=e[t])}):o(s,e),s}},function(e,t,r){"use strict";e.exports=r(82)()?Array.from:r(83)},function(e,t,r){"use strict";e.exports=function(){var e,t,r=Array.from;return"function"==typeof r&&(e=["raz","dwa"],t=r(e),Boolean(t&&t!==e&&"dwa"===t[1]))}},function(e,t,r){"use strict";var n=r(2).iterator,o=r(12),i=r(84),a=r(85),s=r(3),u=r(0),l=r(6),c=r(13),d=Array.isArray,p=Function.prototype.call,f={configurable:!0,enumerable:!0,writable:!0,value:null},h=Object.defineProperty;e.exports=function(e){var t,r,_,g,y,v,m,E,b,w,S=arguments[1],P=arguments[2];if(e=Object(u(e)),l(S)&&s(S),this&&this!==Array&&i(this))t=this;else{if(!S){if(o(e))return y=e.length,1!==y?Array.apply(null,e):(g=new Array(1),g[0]=e[0],g);if(d(e)){for(g=new Array(y=e.length),r=0;r=55296&&v<=56319&&(w+=e[++r])),w=S?p.call(S,P,w,_):w,t?(f.value=w,h(g,_,f)):g[_]=w,++_;y=_}if(void 0===y)for(y=a(e.length),t&&(g=new t(y)),r=0;r0?1:-1}},function(e,t,r){"use strict";var n=r(3),o=r(91),i=Function.prototype.call;e.exports=function(e,t){var r={},a=arguments[2];return n(t),o(e,function(e,n,o,s){r[n]=i.call(t,a,e,n,o,s)}),r}},function(e,t,r){"use strict";e.exports=r(92)("forEach")},function(e,t,r){"use strict";var n=r(3),o=r(0),i=Function.prototype.bind,a=Function.prototype.call,s=Object.keys,u=Object.prototype.propertyIsEnumerable;e.exports=function(e,t){return function(r,l){var c,d=arguments[2],p=arguments[3];return r=Object(o(r)),n(l),c=s(r),p&&c.sort("function"==typeof p?i.call(p,r):void 0),"function"!=typeof e&&(e=c[e]),a.call(e,c,function(e,n){return u.call(r,e)?a.call(l,d,r[e],e,r,n):t})}}},function(e,t,r){"use strict";var n,o=r(18),i=r(8),a=r(2),s=r(37),u=Object.defineProperty;n=e.exports=function(e){if(!(this instanceof n))throw new TypeError("Constructor requires 'new'");e=String(e),s.call(this,e),u(this,"__length__",i("",e.length))},o&&o(n,s),delete n.prototype.constructor,n.prototype=Object.create(s.prototype,{_next:i(function(){if(this.__list__)return this.__nextIndex__=55296&&t<=56319?r+this.__list__[this.__nextIndex__++]:r)})}),u(n.prototype,a.toStringTag,i("c","String Iterator"))},function(e,t,r){"use strict";var n=r(95);e.exports=function(e){if(!n(e))throw new TypeError(e+" is not iterable");return e}},function(e,t,r){"use strict";var n=r(12),o=r(6),i=r(13),a=r(2).iterator,s=Array.isArray;e.exports=function(e){return!!o(e)&&(!!s(e)||(!!i(e)||(!!n(e)||"function"==typeof e[a])))}},function(e,t,r){"use strict";var n=r(12),o=r(3),i=r(13),a=r(36),s=Array.isArray,u=Function.prototype.call,l=Array.prototype.some;e.exports=function(e,t){var r,c,d,p,f,h,_,g,y=arguments[2];if(s(e)||n(e)?r="array":i(e)?r="string":e=a(e),o(t),d=function(){p=!0},"array"===r)return void l.call(e,function(e){return u.call(t,y,e,d),p});if("string"!==r)for(c=e.next();!c.done;){if(u.call(t,y,c.value,d),p)return;c=e.next()}else for(h=e.length,f=0;f=55296&&g<=56319&&(_+=e[++f])),u.call(t,y,_,d),!p);++f);}},function(e,t,r){"use strict";e.exports=function(){return"function"==typeof WeakMap&&"[object WeakMap]"===Object.prototype.toString.call(new WeakMap)}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){if(this.start=e,this.duration=t,t<0)throw new RangeError("Duration must be >= 0.");this.end=e+t}return e.normalizeRawTimeRanges=function(e){return e.slice(0).sort(function(e,t){return e.start-t.start}).reduce(function(e,t,r){var n=e.length-1;return r>0&&e[n].end>=t.start?e[n].end=t.end:e.push(t),e},[])},e.normalize=function(t){return e.normalizeRawTimeRanges(t.map(function(e){return{start:e.start,end:e.end}})).map(function(t){return new e(t.start,t.end-t.start)})},e.getCoverage=function(t){if(0===t.length)return new e(0,0);var r=1/0,n=0;return t.forEach(function(e){e.startn&&(n=e.end)}),new e(r,n-r)},e.rangesContainTime=function(e,t){return t.some(function(t){ +return t.containsTime(e)})},e.prototype.containsTime=function(e){return this.start<=e&&this.end>e},e}();t.TimeRange=n}])})},function(e,t,r){!function(t,n){e.exports=n(r(4),r(2),r(1))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.4.4",t.buildNumber=892;var n=r(3);t.HTML5PlayerController=n.HTML5PlayerController;var o=r(5);t.MediaElementManager=o.MediaElementManager;var i=r(0);t.HTML5Player=i.HTML5Player},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(4),i=r(1),a=r(0),s=function(e){function t(t){var r=e.call(this)||this;return r._mediaElementManager=t,r.name="MaestroHTML5",r}return n(t,e),t.errorQualifiesAbort=function(e){return!(e instanceof a.errors.WebAudioInitializeError)},t.prototype.isRenditionSupported=function(e,t){return("http"===e.scProtocol||["hls","encrypted-hls"].indexOf(e.scProtocol)!==-1&&!t.streamUrlExpires)&&a.HTML5Player.isFormatSupported(e.maestroFormat)},t.prototype.buildPlayer=function(e){var t=e.urlAndRendition,r=t.rendition,n=t.timeRetrieved;if(e.streamUrlExpires&&(["hls","encrypted-hls"].indexOf(r.scProtocol)>=0||void 0===n))throw o.notSupportedError;return new u(e,this._mediaElementManager)},t}(o.BaseController);t.HTML5PlayerController=s;var u=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t;var n=e.logger,o=e.playerId,i=e.urlAndRendition,u=e.streamUrlExpires,l=e.reportError,c=e.fadeOnPauseAndPlay,d=e.fadeOnSeek,p=e.releaseControl;this._logger=n;var f=i.rendition,h=i.timeRetrieved;if(u){if(void 0===h)throw new Error("Expecting timeUrlRetrieved to be set.");this._expirationConfig={urlExpires:!0,timeUrlRetrieved:h}}else this._expirationConfig={urlExpires:!1};var _=this._player=new a.HTML5Player({url:i.url,format:f.maestroFormat},{name:o,mediaElement:null,fadeSupportEnabled:c||d,defaultFadeDuration:c?void 0:0,defaultSeekFadeInDuration:d?void 0:0,defaultSeekFadeOutDuration:d?void 0:0,webAudioContext:this._mediaElementManager.getWebAudioContext(),logger:this._logger,registerListeners:function(e){var t=e.onError,n=e.onChange;t.subscribe(function(e){e instanceof a.errors.NetworkError&&r._hasExpired()?(r._logger.info("Releasing control as a network error occurred, and the URL has expired."),p({retry:!0})):(l(e.getCode()),s.errorQualifiesAbort(e)&&p({retry:!1}))}),n.subscribe(function(e){var t=e.dead,n=e.playing,o=e.actuallyPlaying,i=e.seeking,a=e.duration;return t?void p({retry:!1}):a===1/0?(r._logger.info("Releasing control because the duration was Infinity."),void p({retry:!1})):void(r._expirationConfig.urlExpires&&(n||o||i)&&r._checkIfUrlWillExpireBeforeEnd())})}});this._mediaElementManager.registerPlayer(_,function(){return p({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._config.urlAndRendition.url},e.prototype._checkIfUrlWillExpireBeforeEnd=function(){var e=this._player.getDuration(),t=this._getExpireTime();if(null!==e&&null!==t){var r=e-this._player.getPosition();i.helpers.time.now()+r>t&&(this._logger.info("Releasing control because stream URL would expire before reaching end."),this._config.releaseControl({retry:!0}))}},e.prototype._getExpireTime=function(){if(!this._expirationConfig.urlExpires)return null;var e=this._player.getDuration();return null===e?null:this._expirationConfig.timeUrlRetrieved+e+105e3},e.prototype._hasExpired=function(){var e=this._getExpireTime();return null!==e&&e<=i.helpers.time.now()},e}();t.ControlledPlayer=u},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),o=r(0),i=new o.WebAudioContext,a=function(){function e(e,t){this._playerListeners=new n.helpers.SCWeakMap,this._playerWithElement=null,this._canActivate=!0,this._provideMediaElementErrorRunCheck={},this._element=document.createElement(e),this._logger=n.logger.prefixLogger(t,"MediaElementManager")}return e.prototype.activate=function(){this._canActivate&&(this._logger.debug("Activating media element."),this._element.load()),this._logger.debug("Activating web audio context."),i.activate()},e.prototype.registerPlayer=function(e,t){var r=this;if(this._playerListeners.has(e))throw new Error("Player already registered.");var n=function(){if(e.getMediaElement()!==r._element){r._playerWithElement&&(r._playerWithElement.getMediaElement()===r._element&&(r._logger.debug("Revoking media element from previous player."),r._playerWithElement.isPlaying()&&r._logger.warn("Revoking media element from a playing player."),r._playerWithElement.revokeMediaElement()),r._playerWithElement=null),r._canActivate=!1;var n=r._provideMediaElementErrorRunCheck={};r._logger.debug("Providing media element to new player."),e.provideMediaElement(r._element).catch(function(o){e.isDead()||r._provideMediaElementErrorRunCheck!==n||(r._logger.error("Error occurred providing media element to new player.",o),t(o))}),r._playerWithElement=e}},o=e.onChange.subscribe(function(e){var t=e.playing;t&&n()});this._playerListeners.set(e,o),e.getMediaElement()&&e.revokeMediaElement(),e.isPlaying()&&n()},e.prototype.unregisterPlayer=function(e){var t=this._playerListeners.get(e);t&&(t.remove(),this._playerWithElement===e&&(this._playerWithElement=null,e.getMediaElement()===this._element&&e.revokeMediaElement()),this._playerListeners.delete(e))},e.prototype.getWebAudioContext=function(){return i},e}();t.MediaElementManager=a}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=12)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when activating web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_ACTIVATION_ERROR"},t}(o.errors.PlayerFatalError);t.WebAudioActivationError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r){return void 0===t&&(t="An error occurred when initializing web audio."),e.call(this,t,r)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.WEB_AUDIO_INITIALIZE_ERROR"},t}(o.errors.PlayerError);t.WebAudioInitializeError=i},function(e,t,r){"use strict";function n(e,t){void 0===t&&(t={});var r=e.mimeType||t.mimeType;if(!r)return null;var n=e.audioCodec||t.audioCodec,i=e.videoCodec||t.videoCodec,a=o.helpers.compact([n,i]),s=a.length>0?'; codecs="'+a.map(function(e){return e.id}).join(",")+'"':"";return r+s}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0);t.buildMimeTypeFromFormat=n},function(e,t,r){"use strict";function n(){return j?j:j=new v.WebAudioContext}function o(e){e.load()}function i(e){try{var t=document.createElement("audio");return!!t.canPlayType(e)}catch(e){return!1}}var a=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var s=r(0),u=r(5),l=r(13),c=r(6),d=r(7),p=r(8),f=r(14),h=r(9),_=r(2),g=r(10),y=r(1),v=r(11),m=r(3),E=s.helpers.deferred.buildDeferred,b=s.helpers.url.getExtension,w=s.helpers.time.now,S=s.helpers.Promise,P=s.helpers.browser,R=s.logger.prefixLogger,O=s.errors.NotSupportedError,A=s.errors.PlayerFatalError,T=new Error("Media element was revoked."),M=10,x=200,D=500,I=400,k=1,C=500,N=[],L=new s.helpers.SCWeakMap,j=null,F=s.helpers.retry.buildExponentialDelayCalculator({jitter:0,timeBase:50}),U=function(e){function t(t){var r=e.call(this,t)||this;r._duration=null,r._stallDetected=!1,r._fadeManagers=null,r._shouldCoverGlitch=!0,r._initialized=!1,r._muted=!1,r._volume=1,r._deferredProvideMediaElementCallback=null,r._playInProgress={inProgress:!1},r._lastStallCheckPos=null,r._stallCheckTimerId=null,r._timeWhenPositionChanged=0,r._endedOverride=!1,r._pauseEventTimer=null,r._positionWhenMediaElementRevoked=0,r._playingWhenMediaElementRevoked=!1,r._provideMediaElementDeferred=null,r._mediaElementAndState=null,r._listeners=[],r._currentSeek=null,r._playDetectionPosition=0,r._playDetectionTimer=null,r._playDetectionTimerNumAttempts=0,r._fadeRate=null,r._seekFadeRate=null,r._lastSeek=null,r._webAudioOrchestration=null,r._fadeEndedHandle=null,r._onSeekFadeOutCompleted=null,r._fadeRateAfterSeek=1/0,r._mediaElPlayShouldBeAborted=new s.helpers.SCWeakMap,r._mediaElPaused=new s.helpers.SCWeakMap,r._mediaElPlayTracker=null,r._logger=R(r._logger,"HTML5PlayerBase"),r._playerDependencies=t,r._webAudioContext=t.webAudioContext||n();var o=r._webAudioOrchestration=t.fadeSupportEnabled?r._initWebAudio():null;o&&(r._logger.debug("Fading supported."),r._fadeManagers={pausePlay:new l.FadeManager(o.context,o.gainNodes.pausePlay),seek:new l.FadeManager(o.context,o.gainNodes.seek)}),r._handleDurationUpdates();var i=void 0!==t.mediaElement?t.mediaElement:r._createDefaultMediaElement();i&&r.provideMediaElement(i).catch(function(e){return e===T?void r._logger.debug("Initial provideMediaElement() call was aborted."):void r._triggerError(new f.InitializeError(e))});var a=r._fadeManagers;return a&&r.onChange.subscribe(function(e){var t=e.stalled,n=e.seek,o=e.ended;if(o&&a.seek.getDirection()===l.FadeDirection.UP&&a.seek.isFading())r._logger.debug("Completing fade in after seek early because reached end."),a.seek.performFade(1/0),r._notifyFadingForSeek(!1);else{var i=r.getSeekState(),s=i&&"COMPLETED"===i.state,u=n&&"COMPLETED"===n.state;(t===!1&&s||u&&!r.isStalled())&&a.seek.getDirection()===l.FadeDirection.DOWN&&(r._logger.debug("Fading in after seek.",r._fadeRateAfterSeek),a.seek.performFade(r._fadeRateAfterSeek,function(){return r._notifyFadingForSeek(!1)}))}}),r._logger.info("Checking if the player can play the provided descriptor."),r._canPlayTimer=window.setTimeout(function(){r._canPlay().then(function(e){if(!r.isDead())return e instanceof s.errors.NotSupportedError?(r._logger.info("Player not supported.",e),void r._triggerError(e)):e?(r._logger.info("Player supported."),void r._initialize()):(r._logger.info("Player not supported."),void r._triggerError(new O))}).catch(function(e){r._logger.error("Unexpected error during can play check.",e),r._triggerError(new A("An unexpected error occured during initialization.",e))})},0),r}return a(t,e),t.isFormatSupported=function(e){var t=m.buildMimeTypeFromFormat(e);return!!t&&i(t)},t.prototype.getMediaElement=function(){return this._mediaElementAndState&&this._mediaElementAndState.element},t.prototype.provideMediaElement=function(e){var t=this;if(this._ensureNotDead(),this._mediaElementAndState)throw new Error("Already have a media element.");if(N.indexOf(e)>=0)throw new Error("The same media element is currently being used in another player.");if(!this._webAudioOrchestration&&L.has(e))throw new Error("The same media element has been used in another player with fading enabled.");N.push(e);var r=this._provideMediaElementDeferred=E();return this._update(function(){t._logger.debug("provideMediaElement() called.",e),t._initMediaElementLocal(e,!1);var n=t._mediaElementAndState={element:e,state:"INITIALIZING"},o=function(){t._logger.debug("Initializing media element."),t._initMediaElement(e,!0),t._addPausedHandlers(e),t._attachListeners();var o=t._listenToOnce("error",function(){t._provideMediaElementDeferred=null;var n=e.error,o=n?n.code:"unknown";t._logger.error("Error whilst initializing media element.",o),t.revokeMediaElement(),r.reject(new Error("Error when initializing media element. Error: "+o))},{earlyAttach:!0}),i=function(){t._logger.debug("Putting media element in the state that is expected..."),a()},a=function(){null===t._getQueuedSeekPosition()&&t._positionWhenMediaElementRevoked>0?(t._logger.debug("Seeking to expected position..."),t._performSeek(t._positionWhenMediaElementRevoked,function(e){return void 0!==e?(t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to seek to the expected position."),t.revokeMediaElement(),void r.reject(new Error("An error occurred when trying to restore the position."))):(t._logger.debug("Seeked to expected position."),void s())})):s()},s=function(){t.isPlaying()===t.isActuallyPlaying()&&t._playingWhenMediaElementRevoked?(t._logger.debug("Calling play to match previous state..."),t._mediaElementPlay().catch(function(e){t._provideMediaElementDeferred=null,t._logger.error("An error occurred when trying to play.",e),n===t._mediaElementAndState&&t.revokeMediaElement(),r.reject(new Error("Browser refused play() request on media element."))}),t._listenToOnce("play",function(){t._logger.debug("Play succeeded."),u()},{earlyAttach:!0})):u()},u=function(){return t._mediaElementAndState!==n?void t._triggerError(new A("Media element switched unexpectedly.")):(t._provideMediaElementDeferred=null,o.remove(),r.resolve(void 0),t._mediaElementAndState.state="STABLE",t._logger.debug("Finished putting element in expected state."),t._shouldCoverGlitch=!0,void(null!==t._duration&&t._update(function(){t.isReady()||t._signalReady(),t._handleDeferredPauseAndSeek()})))};t._listenToOnce("emptied",function(){t._logger.debug("Got emptied event from media element."),i()},{earlyAttach:!0})};t._initialized?o():t._deferredProvideMediaElementCallback=o}),r.promise},t.prototype.revokeMediaElement=function(){var e=this;if(!this._mediaElementAndState)throw new Error("There is no media element to revoke.");this._deferredProvideMediaElementCallback=null,this._provideMediaElementDeferred&&(this._provideMediaElementDeferred.reject(T),this._provideMediaElementDeferred=null),this._logger.debug("revokeMediaElement() called."),this._detachListeners();var t=this._mediaElementAndState.element,r=N.indexOf(t);r>=0&&N.splice(r,1),this._onSeekFadeOutCompleted=null,this.isDead()||(this._positionWhenMediaElementRevoked=this.getPosition(),this._playingWhenMediaElementRevoked=this.isPlaying()),this._mediaElementAndState=null,this._initMediaElement(t,!1),this._removePausedHandlers(t),this._completeCurrentFade(),this._completeSeekFadeOutAndIn(),this._update(function(){e.isDead()||(!e.isPlaying()&&e.isActuallyPlaying()&&e._notifyPlaying(!1),e._handleStalled())})},t.prototype.getBufferedTimeRanges=function(){return this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state?u.buildTimeRanges(this._mediaElementAndState.element.buffered):[]},t.prototype.getMaxBufferLength=function(){return null},t.prototype._hasInitialized=function(){return this._initialized},t.prototype._inferFormat=function(e){var t=b(e);switch(t){case"mp3":return{mimeType:"audio/mpeg"};case"opus":return{mimeType:"audio/ogg",audioCodec:{id:"opus"}};case"mp4":return{mimeType:"video/mp4"};case"m4a":return{mimeType:"audio/mp4"};case"m3u8":return{mimeType:"application/x-mpegURL"};default:return{}}},t.prototype._canPlayType=function(e){return i(e)},t.prototype._initialize=function(){var e=this;this._initialized=!0,this._listenTo("error",function(){if("INITIALIZING"===e._mediaElementAndState.state)return void e._logger.debug("An error occurred, but the media element is initializing, so ignoring...");var t=e._mediaElementAndState.element.error;switch(t&&t.code){case 2:e._triggerError(new c.NetworkError);break;case 3:e._triggerError(new d.DecodeError);break;default:e._logger.error("Unexpected error from media element.",t&&t.code,t&&t.message),e._triggerError(new p.MediaElementError(t))}},{earlyAttach:!0}),this._listenTo("play",function(){e._logger.debug("Media element play event."),e.isPlaying()||e.isActuallyPlaying()||!e._mediaElementAndState||e._isMediaElementPaused(e._mediaElementAndState.element)||(e._logger.debug("Calling play() because something external called play() on media element."),e.play())}),this._listenTo("playing",function(){e._logger.debug("Media element playing event."),e._mediaElementAndState&&!e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePlayingEvent():e._logger.debug("Ignoring playing event because media element is reporting it is paused.")}),this._listenTo("timeupdate",function(){return e._determineIfPlaying()}),this._listenTo("pause",function(){e._logger.debug("Media element pause event."),e._mediaElementAndState&&e._isMediaElementPaused(e._mediaElementAndState.element)?e._handlePauseEvent():e._logger.debug("Ignoring pause event because media element is reporting it is not paused.")}),this._listenTo("seeking",function(){if(null===e._getQueuedSeekPosition()&&(e._logger.debug("Media element seeking event."),e._mediaElementAndState)){var t=1e3*e._mediaElementAndState.element.currentTime,r=e._lastSeek;if(r&&(null===r.unstallTime||r.unstallTime+C>w())&&Math.abs(r.position-t)<=C)return void e._logger.debug("Ignoring seeking event because we seeked recently to somewhere near.");e.seek(t,{fadeOutDuration:0})}}),this._listenTo("ended",function(){e._logger.debug("Media element ended event."),e._mediaElementAndState&&e._mediaElementAndState.element.ended?e._handleEndedEvent():e._logger.debug("Ignoring ended event because media element is reporting it is not ended.")}),this._listenTo("stalled",function(){e._logger.debug("Media element stalled event."),e._checkIfStalled()}),this._listenTo("volumechange",function(){e._mediaElementAndState&&e._notifyVolumeChangeFromMediaEl(e._mediaElementAndState.element)}),this._stallCheckTimerId=window.setInterval(function(){return e._checkIfStalled()},I),this._deferredProvideMediaElementCallback&&this._deferredProvideMediaElementCallback()},t.prototype._handleDurationChange=function(){var e=this,t=this._duration;null!==t&&this._update(function(){e._provideDuration(t),e._mediaElementAndState&&"STABLE"===e._mediaElementAndState.state&&(e.isReady()||e._signalReady(),e._handleDeferredPauseAndSeek())})},t.prototype._createDefaultMediaElement=function(){return document.createElement(this._playerDependencies.mediaElementType||"audio")},t.prototype._handlePauseEvent=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element should exist.");var t=this._mediaElementAndState.element;this.isActuallyPlaying()&&this._update(function(){t.ended||(e._notifyNotStalled(),e._completeCurrentFade(),e._completeSeekFadeOutAndIn(),e._notifyPlaying(!1))})},t.prototype._handlePlayingEvent=function(){var e=this,t=this._duration;if(null===t)throw new Error("Expecting duration to exist.");var r=this._getTruePosition();return r>=t?void this._logger.warn("Got a media element playing event and the positon was >= the duration.",r,t):this.isEnded()||this._shouldBeEnded()?void this._logger.warn("Got a media element playing event when the player is/should be ended."):void this._update(function(){e._notifyNotStalled(),e._determineIfPlaying(),e.isActuallyPlaying()||(e._playDetectionTimerNumAttempts=0,e._playDetectionTimer||(e._playDetectionTimer=window.setInterval(function(){return e._determineIfPlaying()},M)))})},t.prototype._handleEndedEvent=function(){return null!==this._getQueuedSeekPosition()?void this._logger.warn("Got a media element ended event but ignoring because a seek is in progress."):void this._update()},t.prototype._shouldBeEnded=function(){return this._endedOverride||this._mediaElementReportingEnded()},t.prototype._mediaElementReportingEnded=function(){return!!(this._mediaElementAndState&&this._mediaElementAndState.element.ended&&this._mediaElementAndState.element.paused)},t.prototype._handleDurationUpdates=function(){var e=this;this._listenToOnce("loadedmetadata",function(){return e._updateDurationFromMediaElement()},{reattach:!0,earlyAttach:!0}),this._listenTo("durationchange",function(){return e._updateDurationFromMediaElement()})},t.prototype._updateDurationFromMediaElement=function(){var e=this._mediaElementAndState;e&&(this._duration=1e3*e.element.duration,this._handleDurationChange())},t.prototype._handlePlayPauseChange=function(e,t){var r=this,n=t.fadeRate;this._fadeRate=n||null;var o=function(){r._mediaElementAndState&&"USABLE"===r._mediaElementAndState.state&&r._callMediaElementPause(r._mediaElementAndState.element),r._notifyFading(!1),r._completeSeekFadeOutAndIn(),r._notifyPlaying(!1)};if(this.isEnded())e?this._notifyPlaying(!0):o();else if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state){var i=this._playInProgress.inProgress||!this._isMediaElementPaused(this._mediaElementAndState.element);e&&!i?(this._fadeManagers&&this._fadeManagers.pausePlay.performFade(-(1/0)),this._playDetectionPosition=this._getTruePosition(),this._play(function(e){return r._notifyPlayRejection(e)})):!e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.UP?(r._notifyFading(!0),r._fadeManagers.pausePlay.performFade(n||-(1/0),function(){return o()})):o()}):e&&i?this._update(function(){r._fadeManagers&&r._fadeManagers.pausePlay.getDirection()===l.FadeDirection.DOWN&&r._fadeManagers.pausePlay.performFade(n||1/0,function(){return r._notifyFading(!1)}),r._notifyPlaying(!0)}):this._notifyPlaying(e)}},t.prototype._handleVolumeChange=function(e,t){if(this._mediaElementAndState){var r=this._mediaElementAndState.element;r.muted=t,r.volume=e,this._notifyVolumeChangeFromMediaEl(r)}else this._muted=t,this._volume=e,this._notifyVolumeChange(e,t)},t.prototype._handleSeekChange=function(e,t){var r=this,n=t.fadeRate;this._seekFadeRate=n,this._fadeRateAfterSeek=n.afterSeek||1/0;var o=this._mediaElementAndState;if(o&&"USABLE"===o.state){this._onSeekFadeOutCompleted=function(){r._onSeekFadeOutCompleted=null,a&&a.remove(),i&&i.seek.getDirection()===l.FadeDirection.DOWN&&(r._logger.debug("Fade out for seek completed.",e,n),i.seek.performFade(-(1/0)),r._notifyFadingForSeek(!1));var t=r._mediaElementReportingEnded();r._endedOverride=!1;var o=r._lastSeek={position:e,unstallTime:null};r._performSeek(e,function(t){return void 0!==t?void r._triggerError(new s.errors.PlayerFatalError("An error occurred when trying to seek.",t)):(e===r._duration&&(r._endedOverride=!0),void r._update(function(){r.isActuallyPlaying()&&r._assumeStalled(),r._signalSeekComplete();var e=r.isStalled();if(e)var t=r.onChange.subscribe(function(e){var r=e.dead,n=e.stalled;r?t.remove():n||(o.unstallTime=w(),t.remove())});else o.unstallTime=w();i&&(!r.isActuallyPlaying()||r._fadeRateAfterSeek===1/0||r.isEnded()?i.seek.performFade(1/0):r._notifyFadingForSeek(!0))}))}),t&&r.isPlaying()&&r._play(function(e){r._triggerError(new s.errors.PlayerFatalError("Error when trying to play after seek from end.",e))})},this._fadeEndedHandle&&(this._fadeEndedHandle.remove(),this._fadeEndedHandle=null);var i=this._fadeManagers,a=null,u=function(){r._onSeekFadeOutCompleted&&r._onSeekFadeOutCompleted()};this._update(function(){i&&(n.beforeSeek||n.afterSeek)?(r._logger.debug("Fading out ready for seek.",e,n),(i.seek.getDirection()===l.FadeDirection.UP||i.seek.isFading())&&r.isActuallyPlaying()&&n.beforeSeek&&!r._mediaElementReportingEnded()?(r._notifyFadingForSeek(!0),a=r._fadeEndedHandle=r._listenToOnce("ended",u),i.seek.performFade(n.beforeSeek||-(1/0),u)):(i.seek.performFade(-(1/0)),u())):u()})}},t.prototype._performSeek=function(e,t){var r=this,n=this._mediaElementAndState;if(!n)throw new Error("Media element does not exist.");var o=this._currentSeek;o&&(this._currentSeek=null,o.abort());var i=n.element;if(i.currentTime===e/1e3)return void t();var a=0,s=e,u=function(){var n=[],o=function(){r._currentSeek&&(r._currentSeek.abort(),r._currentSeek=null),t()};try{i.currentTime=s/1e3}catch(t){r._logger.warn("Error when trying to seek.",t,e,s)}r._playDetectionPosition=1e3*i.currentTime;var l=window.setTimeout(function(){r._logger.warn("Seek attempt failed. Retrying...",e,s,a),c(),s+=k/1e3,u()},F(++a));n.push(r._listenToOnce("seeked",function(){var t=1e3*i.currentTime;Math.abs(t-s)<=100?o():(r._logger.warn("Seek attempt failed. Incorect position. Retrying...",t,e,s),c(),u())},{earlyAttach:!0}));var c=function(){n.forEach(function(e){return e.remove()}),window.clearTimeout(l)};r._currentSeek={abort:c}};u()},t.prototype._getPosition=function(){var e=null!==this._duration?this._duration:1/0;if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)return this._positionWhenMediaElementRevoked;this._determineIfPlaying();var t=Math.min(this._getTruePosition(),e);return this._shouldBeEnded()?e:t},t.prototype._getTruePosition=function(){if(!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)throw new Error("Media element does not exist or is in invalid state.");var e=this._mediaElementAndState.element;return 1e3*e.currentTime},t.prototype._kill=function(){window.clearTimeout(this._canPlayTimer),this._playDetectionTimer&&window.clearInterval(this._playDetectionTimer),this._mediaElementAndState&&this.revokeMediaElement(),this._stallCheckTimerId&&window.clearInterval(this._stallCheckTimerId),this._webAudioOrchestration&&this._webAudioOrchestration.gainNodes.glitchCoverup.disconnect(this._webAudioOrchestration.context.destination),this._listeners=[]},t.prototype._listenToOnce=function(e,t,r){void 0===r&&(r={});var n=r.reattach,o=r.earlyAttach;void 0===n&&(n=!1),void 0===o&&(o=!1);var i=function(e){a.remove(),t(e)},a=this._listenTo(e,i,{reattach:n,earlyAttach:o});return a},t.prototype._listenTo=function(e,t,r){var n=this;void 0===r&&(r={});var o=r.reattach,i=r.earlyAttach;void 0===o&&(o=!0),void 0===i&&(i=!1);var a=function(r){if(s.attachedToElement)switch(e){case"play":var o=n._mediaElPlayShouldBeAborted.get(s.attachedToElement);if(n._mediaElPlayShouldBeAborted.delete(s.attachedToElement),o){n._logger.warn("Calling pause() on media element because the play request should have been rejected."),s.attachedToElement.pause();break}default:t(r)}else n._logger.warn("Got media element event after handler was removed. Ignoring.",r)},s={attachedToElement:null,handler:a,eventType:e,once:!1,reattach:o,earlyAttach:i};if(this._listeners.push(s),!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state&&!i)return{remove:function(){var e=n._listeners.indexOf(s);e>=0&&n._listeners.splice(e,1)}};var u=this._mediaElementAndState.element;return u.addEventListener(e,a,!1),s.attachedToElement=u,{remove:function(){var t=n._listeners.indexOf(s);t>=0&&(n._listeners.splice(t,1),s.attachedToElement=null,u.removeEventListener(e,a,!1))}}},t.prototype._notifyNotStalled=function(){this._stallDetected=!1,this._lastStallCheckPos=null,this._handleStalled()},t.prototype._assumeStalled=function(){this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&(this._lastStallCheckPos=this._mediaElementAndState.element.currentTime,this._timeWhenPositionChanged=0,this._stallDetected=!0,this._handleStalled())},t.prototype._initMediaElement=function(e,t){this._initMediaElementLocal(e,t)},t.prototype._callMediaElementPlay=function(e){var t=this;P.isEdge()&&this._mediaElPlayShouldBeAborted.set(e,!1);var r=this._mediaElPaused.get(e);r&&(r.paused=!1);var n=this._mediaElPlayTracker={},o=e.play();return r&&o&&o.catch&&o.catch(function(){n===t._mediaElPlayTracker&&(r.paused=!0)}),o},t.prototype._callMediaElementPause=function(e){this._playInProgress.inProgress=!1,P.isEdge()&&this._mediaElPlayShouldBeAborted.has(e)&&this._mediaElPlayShouldBeAborted.set(e,!0);var t=this._mediaElPaused.get(e);t&&(t.paused=!0),e.pause()},t.prototype._isMediaElementPaused=function(e){var t=this._mediaElPaused.get(e);return!t||t.paused},t.prototype._completeCurrentFade=function(){var e=this._fadeManagers;e&&(e.pausePlay.performFade(this.isPlaying()?1/0:-(1/0)),this.isDead()||this._notifyFading(!1))},t.prototype._completeSeekFadeOutAndIn=function(){var e=this,t=this._fadeManagers;t&&this._update(function(){t.seek.performFade(1/0),e.isDead()||(e._notifyFadingForSeek(!1),e._onSeekFadeOutCompleted&&e._onSeekFadeOutCompleted())})},t.prototype._determineIfPlaying=function(){var e=this;this._playDetectionTimer&&(!this.isPlaying()||++this._playDetectionTimerNumAttempts>=x)&&(window.clearInterval(this._playDetectionTimer),this._playDetectionTimer=null),this._update(function(){e._mediaElementAndState&&"USABLE"===e._mediaElementAndState.state&&(e.isDead()||!e.isReady()||!e.isPlaying()||e.isActuallyPlaying()||e._isMediaElementPaused(e._mediaElementAndState.element)||e._getTruePosition()===e._playDetectionPosition||(e._logger.debug("Detected that playback has started."),e._playDetectionTimer&&(window.clearInterval(e._playDetectionTimer),e._playDetectionTimer=null),e._notifyPlaying(!0),e._fadeManagers&&(e._notifyFading(!0),e._fadeManagers.pausePlay.performFade(e._fadeRate||1/0,function(){return e._notifyFading(!1)}))))})},t.prototype._initMediaElementLocal=function(e,t){if(e.setAttribute("msAudioCategory","BackgroundCapableMedia"),e.mozAudioChannelType="content",e.removeAttribute("src"),o(e),this._activateWebAudio(),this._pauseEventTimer&&(this._logger.debug("Clearing pause event timer."),window.clearTimeout(this._pauseEventTimer),this._pauseEventTimer=null), +this._webAudioOrchestration&&this._webAudioOrchestration.mediaElementSource&&(this._logger.debug("Disconnecting media element from gain node."),this._webAudioOrchestration.mediaElementSource.disconnect(this._webAudioOrchestration.gainNodes.pausePlay),this._webAudioOrchestration.mediaElementSource=void 0),this._currentSeek&&(this._logger.debug("Aborting seek attempt."),this._currentSeek.abort(),this._currentSeek=null),t){this._webAudioOrchestration&&(this._logger.debug("Adding crossorigin attribute to media element because fading enabled."),e.setAttribute("crossorigin","anonymous"));var r=this._getUrlForMediaElement();if(this._logger.debug("Setting media element src.",r),e.src=r,e.volume=this._volume,e.muted=this._muted,this._webAudioOrchestration&&this._fadeManagers){this._logger.debug("Creating media element source node...");var n=L.get(e);if(n?this._logger.debug("Reusing media element source node."):(n=this._webAudioOrchestration.context.createMediaElementSource(e),L.set(e,n)),this._webAudioOrchestration.mediaElementSource=n,n.connect(this._webAudioOrchestration.gainNodes.pausePlay),this._logger.debug("Created media element source node."),this._shouldCoverGlitch){var i=this._webAudioOrchestration.context.currentTime,a=this._webAudioOrchestration.gainNodes.glitchCoverup;a.gain.setValueAtTime(0,i),a.gain.setValueAtTime(1,i+.1),this._shouldCoverGlitch=!1}}}e.playbackRate=1,e.setAttribute("preload","metadata"),this._callMediaElementPause(e),e.load()},t.prototype._addPausedHandlers=function(e){var t={removeListeners:function(){e.removeEventListener("play",r),e.removeEventListener("playing",r),e.removeEventListener("pause",r),e.removeEventListener("ended",r)},paused:!1},r=function(){t.paused=e.paused};r(),e.addEventListener("play",r),e.addEventListener("playing",r),e.addEventListener("pause",r),e.addEventListener("ended",r),this._mediaElPaused.set(e,t)},t.prototype._removePausedHandlers=function(e){var t=this._mediaElPaused.get(e);t&&t.removeListeners(),this._mediaElPaused.delete(e)},t.prototype._checkIfStalled=function(){if(this._mediaElementAndState&&"USABLE"===this._mediaElementAndState.state&&this.isActuallyPlaying()){var e=this._mediaElementAndState.element,t=e.currentTime,r=s.helpers.time.now();t!==this._lastStallCheckPos&&(this._timeWhenPositionChanged=r),this._stallDetected=e.readyState<=2||this._timeWhenPositionChanged<=r-D,this._lastStallCheckPos=t,this._handleStalled()}},t.prototype._handleStalled=function(){this._shouldBeEnded()&&null===this._getQueuedSeekPosition()?this.isEnded()||(this._logger.debug("Updating because stalled near end."),this._update()):this._notifyStalled(this._stallDetected||!this._mediaElementAndState||"USABLE"!==this._mediaElementAndState.state)},t.prototype._play=function(e){var t=this,r=this._activateWebAudio(),n={inProgress:!0};this._playInProgress=n,this._mediaElementPlay().then(function(){n.inProgress=!1,r.catch(function(e){t._logger.error("Error activating web audio.",e),e===v.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR?t._triggerError(new h.WebAudioActivationTimeoutError):t._triggerError(new y.WebAudioActivationError)})}).catch(function(r){return t._playInProgress!==n?void t._logger.debug("Ignoring play error because paused since.",r):(n.inProgress=!1,void(e&&e(r)))})},t.prototype._mediaElementPlay=function(){var e=this;if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");if(this._mediaElementReportingEnded())return this._logger.debug("Not calling play() because we are at the end. It will be called after a seek."),S.resolve();var t=this._mediaElementAndState.element,r=this._callMediaElementPlay(t);return new S(function(t,n){r?(r=r.then(function(){return t()}),r.catch&&(r=r.catch(function(r){"AbortError"===r.name?(e._logger.debug("Media element play() promise rejected with AbortError."),t()):n(r)}))):t()})},t.prototype._notifyVolumeChangeFromMediaEl=function(e){this._volume=e.volume,this._muted=e.muted,this._notifyVolumeChange(e.volume,e.muted)},t.prototype._initWebAudio=function(){try{var e=this._webAudioContext.getAudioContextWithSuspender();if(!e)return this._logger.debug("WebAudio not supported/enabled."),null;this._logger.debug("WebAudio supported.");var t=e.context,r=e.suspender;r.watchPlayer(this);var n=t.createGain(),o=t.createGain(),i=t.createGain();return n.connect(o),o.connect(i),i.connect(t.destination),{context:t,suspender:r,gainNodes:{glitchCoverup:i,pausePlay:n,seek:o}}}catch(e){return e===v.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR?this._triggerError(new g.WebAudioInitializeNoChannelsError(e)):this._triggerError(new _.WebAudioInitializeError(e)),this._logger.error("Failed initializing web audio.",e),null}},t.prototype._activateWebAudio=function(){return this._webAudioOrchestration?this._webAudioContext.activate():S.resolve(void 0)},t.prototype._handleDeferredPauseAndSeek=function(){var e=this;if(!this._mediaElementAndState||"STABLE"!==this._mediaElementAndState.state)throw new Error("Media element must be in the STABLE state.");this._logger.debug("Handling deferred pause and seek..."),this._mediaElementAndState.state="USABLE",this._attachListeners(),this._update(function(){e._handleStalled();var t=e._getQueuedSeekPosition();if(null!==t){var r=e._seekFadeRate?e._seekFadeRate.afterSeek:void 0;e._handleSeekChange(t,{fadeRate:{afterSeek:r}})}e.isPlaying()!==e.isActuallyPlaying()&&e._handlePlayPauseChange(e.isPlaying(),{fadeRate:e._fadeRate||void 0})})},t.prototype._detachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");var e=this._mediaElementAndState.element;this._listeners.forEach(function(t){t.attachedToElement&&(t.attachedToElement=null,e.removeEventListener(t.eventType,t.handler,!1))}),this._listeners=this._listeners.filter(function(e){return e.reattach})},t.prototype._attachListeners=function(){if(!this._mediaElementAndState)throw new Error("Media element doesn't exist.");this._logger.debug("Attaching listeners...");var e=this._mediaElementAndState,t=e.element,r=e.state;this._listeners.forEach(function(e){e.attachedToElement||!e.reattach||"USABLE"!==r&&!e.earlyAttach||(t.addEventListener(e.eventType,e.handler,!1),e.attachedToElement=t)}),this._logger.debug("Attached listeners.")},t}(s.BasePlayer);t.HTML5PlayerBase=U},function(e,t,r){"use strict";function n(e){for(var t=[],r=e.length,n=0;n=48||a.helpers.browser.isEdge())}function o(){if(l)return l;if(!n())throw new Error("Web audio is not enabled.");var e=new window.AudioContext;if(!e.destination.maxChannelCount)throw t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR;return l={context:e,suspender:new s.WebAudioContextSuspender(e)}}function i(e){return e.state&&e.resume&&"running"!==e.state?a.helpers.promiseWithTimeout(e.resume(),t.WEB_AUDIO_ACTIVATION_TIMEOUT,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR):a.helpers.Promise.resolve()}Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(15),u=a.helpers.browser.getFirefoxVersion();t.WEB_AUDIO_ACTIVATION_TIMEOUT=5e3,t.WEB_AUDIO_ACTIVATION_TIMEOUT_ERROR=new Error("Web audio activation timed out."),t.WEB_AUDIO_NO_OUTPUT_CHANNELS_ERROR=new Error("Web audio found no output channels.");var l=null,c=function(){function e(){}return e.prototype.getAudioContextWithSuspender=function(){return n()?o():null},e.prototype.activate=function(){if(!n())return a.helpers.Promise.resolve(void 0);try{var e=o().context;return i(e)}catch(e){return a.helpers.Promise.reject(e)}},e}();t.WebAudioContext=c},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.7",t.buildNumber=1938;var n=r(4);t.HTML5PlayerBase=n.HTML5PlayerBase;var o=r(16);t.HTML5Player=o.HTML5Player;var i=r(17);t.errors=i.errors;var a=r(18);t.helpers=a.helpers;var s=r(11);t.WebAudioContext=s.WebAudioContext},function(e,t,r){"use strict";function n(e,t,r){return Math.min(t,Math.max(e,r))}Object.defineProperty(t,"__esModule",{value:!0});var o;!function(e){e[e.UP=0]="UP",e[e.DOWN=1]="DOWN"}(o=t.FadeDirection||(t.FadeDirection={}));var i=function(){function e(e,t){this._context=e,this._gain=t,this._currentFade={startTime:0,startValue:1,rate:0},this._fadeEndTimer=null}return e.prototype.isFading=function(){return!!this._fadeEndTimer},e.prototype.getDirection=function(){var e=this._currentFade,t=e.rate,r=e.startValue;return 0===t?0===r?o.DOWN:o.UP:t<0?o.DOWN:o.UP},e.prototype.performFade=function(e,t){var r=this;if(0===e)throw new Error("Rate cannot be 0.");this._fadeEndTimer&&window.clearTimeout(this._fadeEndTimer);var o=this._context.currentTime,i=this._gain;if(e===1/0||e===-(1/0)){i.gain.cancelScheduledValues(o);var a=e===1/0?1:0;i.gain.setValueAtTime(a,o),this._currentFade={startTime:o,startValue:a,rate:0},this._fadeEndTimer=null,t&&t()}else{var s=this._currentFade,u=n(0,1,s.startValue+1e3*s.rate*(o-s.startTime)),l=e>0?1-u:u,c=l*(1/Math.abs(1e3*e)),d=o+c;this._currentFade={startTime:o,rate:e,startValue:u},i.gain.cancelScheduledValues(o),i.gain.setValueAtTime(u,o),i.gain.linearRampToValueAtTime(e>0?1:0,d),this._fadeEndTimer=window.setTimeout(function(){r._fadeEndTimer=null,t&&t()},1e3*c)}},e}();t.FadeManager=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred when initializing the media element.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HTML5_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=2e4,o=function(){function e(e,t){void 0===t&&(t=n),this._audioContext=e,this._idleTime=t,this._players=[],this._prevPlayingCount=0,this._playingCount=0,this._timerId=null,this._suspendTimerId=null,this._suspendSupported="function"==typeof e.suspend}return e.prototype.watchPlayer=function(e){var t=this;!this._suspendSupported||e.isDead()||this._players.indexOf(e)>=0||(e.onChange.subscribe(function(r){var n=r.dead,o=r.playing;if(void 0!==o&&t._handleCountChange(o),n){var i=t._players.indexOf(e);i>=0&&(t._players.splice(i,1),!t._players.length&&t._suspendTimerId&&(window.clearInterval(t._suspendTimerId),t._suspendTimerId=null))}}),this._players.length||(this._suspendTimerId=window.setInterval(function(){0===t._playingCount&&null===t._timerId&&"suspended"!==t._audioContext.state&&t._scheduleSuspend(5e3)},5e3)),this._players.push(e),e.isPlaying()&&this._handleCountChange(!0))},e.prototype._handleCountChange=function(e){e?this._playingCount++:this._playingCount--,this._playingCount!==this._prevPlayingCount&&(this._prevPlayingCount=this._playingCount,0===this._playingCount?this._scheduleSuspend(this._idleTime):1===this._playingCount&&this._abortSuspend())},e.prototype._scheduleSuspend=function(e){var t=this;this._timerId=window.setTimeout(function(){t._timerId=null,t._audioContext.suspend()},e)},e.prototype._abortSuspend=function(){this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null)},e}();t.WebAudioContextSuspender=o},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(4),a=r(3),s=o.helpers.Promise,u=function(e){function t(t,r){var n=e.call(this,r)||this;return n._descriptor=t,n._mimeType=t.format.mimeType||a.buildMimeTypeFromFormat(t.format,n._inferFormat(t.url)),n}return n(t,e),t.prototype._getUrlForMediaElement=function(){return this._descriptor.url},t.prototype._canPlay=function(){return this._mimeType&&this._canPlayType(this._mimeType)?s.resolve(!0):s.resolve(!1)},t}(i.HTML5PlayerBase);t.HTML5Player=u},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(7),i=r(6),a=r(8),s=r(2),u=r(10),l=r(1),c=r(9);!function(e){e.DecodeError=o.DecodeError,e.NetworkError=i.NetworkError,e.MediaElementError=a.MediaElementError,e.WebAudioInitializeError=s.WebAudioInitializeError,e.WebAudioInitializeNoChannelsError=u.WebAudioInitializeNoChannelsError,e.WebAudioActivationError=l.WebAudioActivationError,e.WebAudioActivationTimeoutError=c.WebAudioActivationTimeoutError}(n=t.errors||(t.errors={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(5),i=r(3);!function(e){var t;!function(e){e.buildTimeRanges=o.buildTimeRanges}(t=e.timeRanges||(e.timeRanges={}));var r;!function(e){e.buildMimeTypeFromFormat=i.buildMimeTypeFromFormat}(r=e.mimeType||(e.mimeType={}))}(n=t.helpers||(t.helpers={}))}])})},function(e,t,r){!function(t,n){e.exports=n(r(6),r(1),r(3),r(2),r(10),r(11))}(window,function(e,t,r,n,o,i){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.4.4",t.buildNumber=892;var n=r(2);t.HLSMSEPlayerController=n.HLSMSEPlayerController;var o=r(0);t.HLSMSEPlayer=o.HLSMSEPlayer},function(e,t,r){"use strict";function n(e){return e.match(d)[0]}var o=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var i=r(3),a=r(4),s=r(5),u=r(6),l=r(7),c=r(0),d=/^[^\?#]*/,p=function(e){function t(t){var r=e.call(this)||this;return r._mediaElementManager=t,r.name="MaestroHLSMSE",r}return o(t,e),t.prototype.isRenditionSupported=function(e){return["hls","encrypted-hls"].indexOf(e.scProtocol)!==-1&&c.HLSMSEPlayer.isFormatSupported(e.maestroSegmentFormat||{})},t.prototype.buildPlayer=function(e){return new f(e,this._mediaElementManager)},t}(i.BaseController);t.HLSMSEPlayerController=p;var f=function(){function e(e,t){var r=this;this._config=e,this._mediaElementManager=t,this._urlRefreshRetrieveHandle=null;var o=e.logger,i=e.playerId,u=e.urlAndRendition,l=e.streamUrlExpires,d=e.reportError,p=e.fadeOnPauseAndPlay,f=e.fadeOnSeek,h=e.releaseControl,_=e.getNewUrl;this._currentUrl=u.url;var g=u.rendition.maestroSegmentFormat||{},y=this._buildPlaylist(u.url),v=this._player=new c.HLSMSEPlayer({playlist:y,segmentFormat:g},{name:i,mediaElement:null,fadeSupportEnabled:p||f,defaultFadeDuration:p?void 0:0,defaultSeekFadeInDuration:f?void 0:0,defaultSeekFadeOutDuration:f?void 0:0,logger:o,registerListeners:function(e){var t=e.onError,i=e.onChange;t.subscribe(function(e){if(l){if(e instanceof s.errors.URLUpdateError)return o.error("URL refresh failed for some reason.",e),void h({retry:!0});if(r._isErrorWhichShouldTriggerURLRefresh(e)){if(r._urlRefreshRetrieveHandle)return void o.debug("Got a 403 status code, but URL refresh already in progress.");o.info("Got a 403 status code. Peforming a URL refresh...");var t=r._urlRefreshRetrieveHandle=_();return void t.whenComplete().then(function(e){r._urlRefreshRetrieveHandle=null,e?n(e)!==n(r._currentUrl)?(o.warn("Got a new URL but the rendition did not match the original."),h({retry:!1})):(r._currentUrl=e,o.info("Got a new URL. Updating..."),v.switchPlaylist(r._buildPlaylist(e))):(o.warn("Could not get a new URL."),h({retry:!1}))}).catch(function(e){o.error("Unexpected error when trying to retrieve a new URL.",e),h({retry:!1})})}}d(e.getCode()),a.HTML5PlayerController.errorQualifiesAbort(e)&&h({retry:!1})}),i.subscribe(function(e){var t=e.dead;t&&(r._urlRefreshRetrieveHandle&&(r._urlRefreshRetrieveHandle.abort(),r._urlRefreshRetrieveHandle=null),h({retry:!1}))})}});this._mediaElementManager.registerPlayer(v,function(){return h({retry:!1})})}return e.prototype.getPlayer=function(){return this._player},e.prototype.getUrl=function(){return this._currentUrl},e.prototype._buildPlaylist=function(e){var t=new u.ArrayBufferLoader({fetchEnabled:this._config.fetchEnabled});return new l.PlaylistHLS({url:e,playlistLoader:u.stringLoader,segmentLoader:t,keyLoader:t,segmentFormat:this._config.urlAndRendition.rendition.maestroSegmentFormat||{},logger:this._config.logger})},e.prototype._isErrorWhichShouldTriggerURLRefresh=function(e){if(e instanceof c.errors.RetrievalError){var t=e.getCause();if(t instanceof c.retrievalErrors.UnacceptableResponseStatusCodeError)return 403===t.getStatusCode()}return!1},e}();t.ControlledPlayer=f},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t){e.exports=n},function(e,t){e.exports=o},function(e,t){e.exports=i}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(7),r(4))}(window,function(e,t,r){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t){e.exports=r},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to append to the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.APPEND_ERROR"},t}(o.errors.PlayerFatalError);t.AppendError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){return e.call(this,"An error occurred trying to initialize the buffer.",t)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.INITIALIZE_ERROR"},t}(o.errors.PlayerFatalError);t.InitializeError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t){var r=e.call(this,"An error occurred when trying to retrieve a playlist/segment/key.",t)||this;return r._internalRetrievalError=t,r}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.RETRIEVAL_ERROR."+this._internalRetrievalError.getCode()},t}(o.errors.PlayerError);t.RetrievalError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return e.call(this,"A transmuxer could not be found.")||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.NO_TRANSMUXER_ERROR"},t}(o.errors.NotSupportedError);t.NoTransmuxerError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"HLS_MSE_PLAYER.PLAYLIST_UPDATE_ERROR"},t}(o.errors.PlayerFatalError);t.PlaylistUpdateError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.7",t.buildNumber=1938;var n=r(9);t.HLSMSEPlayer=n.HLSMSEPlayer;var o=r(15);t.errors=o.errors;var i=r(1);t.retrievalErrors=i.retrievalErrors},function(e,t,r){"use strict";function n(e){if(e.hasEnded()){var t=e.getCompleteDuration();if(null===t)throw new Error("Expected playlist duration to be available.");return t}return 1/0}function o(e){var t=s.TransmuxerFactory.retrieveTransmuxers(e),r=g(t,function(t){var r=u.helpers.mimeType.buildMimeTypeFromFormat(t.getOutputFormat(),e);return!!r&&l.MSE.isSupported(r)})||null;if(!r)return null;var n=r.getOutputFormat(),o=u.helpers.mimeType.buildMimeTypeFromFormat(n,e);return o?{transmuxer:r,mimeType:o}:null}var i=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var a=r(0),s=r(1),u=r(2),l=r(10),c=r(14),d=r(3),p=r(4),f=r(5),h=r(6),_=r(7),g=a.helpers.find,y=a.helpers.Promise,v=a.helpers.time.now,m=a.errors.PlayerFatalError,E=a.eventDispatcher.EventDispatcher,b=a.logger.prefixLogger,w=a.helpers.abortableJob.abortedError,S=a.helpers.browser.isSafari(),P=3e4,R=1e8,O=2e3,A=1e4,T=1e3,M=600,x=function(e){function t(t,r){var n=e.call(this,r)||this;if(n._onSegmentRequestQueued=new E,n._onSegmentRequestStart=new E,n._onSegmentRetrieved=new E,n._onSegmentRequestFailed=new E,n._onSegmentReady=new E,n._onSegmentAppendQueued=new E,n._onSegmentAppendEnd=new E,n._playlist=null,n._playlistSegmentRetriever=null,n._playlistUpdateJob=null,n._initialPlaylistRetrieveCompleted=!1,n._playlistUpdateTimer=null,n._earliestAllowedNextUpdateTime=v(),n._mse=null,n._simpleMSE=null,n._transmuxerAndMimeType=null,n._lastSegmentAppended=null,n._maxBufferLength=null,n._cacheSize=null,n._playlistUpdateEventHandle=null,n._playlistDuration=null,n._logger=b(n._logger,"HLSMSEPlayer"),void 0!==r.maxBufferLength&&r.maxBufferLength<0)throw new Error("maxBufferLength cannot be < 0.");if(void 0!==r.memoryCacheSize&&r.memoryCacheSize<0)throw new Error("memoryCacheSize cannot be < 0.");return n.onSegmentRequestQueued=n._onSegmentRequestQueued.getHandle(),n.onSegmentRequestStart=n._onSegmentRequestStart.getHandle(),n.onSegmentRetrieved=n._onSegmentRetrieved.getHandle(),n.onSegmentRequestFailed=n._onSegmentRequestFailed.getHandle(),n.onSegmentReady=n._onSegmentReady.getHandle(),n.onSegmentAppendQueued=n._onSegmentAppendQueued.getHandle(),n.onSegmentAppendEnd=n._onSegmentAppendEnd.getHandle(),n.__descriptor=t,n.__playerDependencies=r,n._queuedPlaylist=t.playlist,n}return i(t,e),t.isFormatSupported=function(e){return!!l.MSE.isSupported()&&!!o(e)},t.prototype.getBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getCompleteBufferedTimeRanges=function(){var e=this._playlistSegmentRetriever;return e?a.TimeRange.normalize(e.getSegmentsWithData().filter(function(e){return e.complete}).map(function(e){return e.segment.getTimeRange()})):[]},t.prototype.getMaxBufferLength=function(){return this._maxBufferLength},t.prototype.getBufferController=function(){var e=this;return{setMaxBufferLength:function(t){if(t<0)throw new Error("Max buffer length cannot be < 0.");e._logger.debug("Updating max buffer length.",t),e._maxBufferLength=t,e._playlistSegmentRetriever?e._playlistSegmentRetriever.updateMaxBufferLength(t):e._logger.debug("Cannot update right now. Playlist segment retriever doesn't exist.")}}},t.prototype.switchPlaylist=function(e){return this._logger.debug("Updating playlist."),this._hasInitialized()?(this._playlistSegmentRetriever&&(this._playlistSegmentRetriever.switchPlaylist(null),this._logger.debug("Removed current URL.")),this._disposePlaylist(),void this._setPlaylist(e)):(this._logger.debug("Cannot update right now. Still initializing."),void(this._queuedPlaylist=e))},t.prototype.getMemoryCacheMaxSize=function(){return null!==this._cacheSize?this._cacheSize:R},t.prototype.getMemoryCacheUsage=function(){return this._playlistSegmentRetriever?this._playlistSegmentRetriever.getCacheUsage():0},t.prototype.getMemoryCacheController=function(){var e=this;return{setMaxCacheSize:function(t){if(t<0)throw new Error("Max size cannot be < 0.");e._cacheSize=t,e._playlistSegmentRetriever&&e._playlistSegmentRetriever.updateCacheSize(t)}}},t.prototype._canPlay=function(){if(!l.MSE.isSupported())return this._logger.debug("MSE not supported."),y.resolve(!1);var e=this.__descriptor.segmentFormat,t=o(e);return t?(this._transmuxerAndMimeType=t,y.resolve(!0)):(this._logger.debug("No transmuxer found."),y.resolve(new h.NoTransmuxerError))},t.prototype._getUrlForMediaElement=function(){if(!this._mse)throw new Error("MSE does not exist.");return this._mse.getUrl()},t.prototype._handleDurationUpdates=function(){},t.prototype._initialize=function(){var t=this.__playerDependencies;if(null===this._maxBufferLength&&(void 0!==t.maxBufferLength?this._maxBufferLength=t.maxBufferLength:this._maxBufferLength=P),this._logger.debug("Initialized max buffer length.",this._maxBufferLength),null===this._cacheSize&&(void 0!==t.memoryCacheSize?this._cacheSize=t.memoryCacheSize:this._cacheSize=R),this._logger.debug("Initialized cache size.",this._cacheSize),e.prototype._initialize.call(this),!this._queuedPlaylist)throw new Error("Playlist should exist."); +this._setPlaylist(this._queuedPlaylist),this._queuedPlaylist=null},t.prototype._initMediaElement=function(t,r){this._simpleMSE&&(this._simpleMSE.kill(),this._simpleMSE=null,this._logger.debug("Killed SimpleMSE.")),this._mse&&(this._mse.kill(),this._mse=null,this._logger.debug("Killed MSE.")),r?(this._initMSE(),this._initSimpleMSE(),e.prototype._initMediaElement.call(this,t,!0)):e.prototype._initMediaElement.call(this,t,!1)},t.prototype._shouldBeEnded=function(){var t=this._lastSegmentAppended;if(!t||!t.isFinalSegment())return!1;if(!S)return e.prototype._shouldBeEnded.call(this);if(e.prototype._shouldBeEnded.call(this))return!0;if(!this.getMediaElement())return!1;var r=this._duration;return this._stallDetected&&null!==r&&this._getMediaElementPosition()>=r-M},t.prototype._handleSeekChange=function(t,r){e.prototype._handleSeekChange.call(this,t,r),this._playlistSegmentRetriever&&(this._logger.debug("Explicitly updating playlist segment retriever, as seek requested."),this._playlistSegmentRetriever.update(),this._findSegmentAndAppendToMSE())},t.prototype._performSeek=function(t,r){return this._mse&&!a.TimeRange.rangesContainTime(t,this._mse.getBuffered())&&(this._logger.debug("Seeking to an unbuffered area."),this._initSimpleMSE()),e.prototype._performSeek.call(this,t,r)},t.prototype._kill=function(){this._simpleMSE&&(this._logger.debug("Killing SimpleMSE."),this._simpleMSE.kill(),this._simpleMSE=null),this._mse&&(this._logger.debug("Killing MSE."),this._mse.kill(),this._mse=null),this._playlistSegmentRetriever&&(this._logger.debug("Killing playlist segment retriever."),this._playlistSegmentRetriever.kill(),this._playlistSegmentRetriever=null),this._disposePlaylist(),e.prototype._kill.call(this)},t.prototype._disposePlaylist=function(){this._playlistUpdateJob&&(this._logger.debug("Aborting playlist retrieve job."),this._playlistUpdateJob.abort(),this._playlistUpdateJob=null),this._playlistUpdateTimer&&(window.clearTimeout(this._playlistUpdateTimer),this._playlistUpdateTimer=null),this._playlistUpdateEventHandle&&(this._playlistUpdateEventHandle.remove(),this._playlistUpdateEventHandle=null),this._playlist=null},t.prototype._initMSE=function(){var e=this;if(!this._transmuxerAndMimeType)throw new Error("Transmuxer should have been configured.");var t=this._mse=new l.MSE(this._transmuxerAndMimeType.mimeType,this._logger);t.whenInitialized().then(function(){e._duration&&t.updateDuration(e._duration).catch(function(t){e._logger.warn("Error updating MSE duration.",t)})}).catch(function(t){t!==l.killedError&&(e._logger.error("Error during mse initialization.",t),e._triggerError(new p.InitializeError(t)))})},t.prototype._initSimpleMSE=function(){var e=this;if(!this._mse)throw new Error("MSE should exist.");this._simpleMSE&&this._simpleMSE.kill(),this._lastSegmentAppended=null;var t=this._simpleMSE=new c.SimpleMSE(this._mse,function(){return e._getSegmentDataToAppendNext()},function(){return e._getMediaElementPosition()},function(t){e._triggerError(new d.AppendError(t))},this._logger);t.onAppendQueued.subscribe(this._onSegmentAppendQueued.dispatch),t.onAppendEnd.subscribe(function(t){if(S){var r=e.getMediaElement();r&&e._isMediaElementPaused(r)&&r.ended&&e.isActuallyPlaying()&&(e._logger.debug("Calling play() on media element because we just appended something and should be playing."),e._callMediaElementPlay(r))}e._onSegmentAppendEnd.dispatch(t)}),t.start()},t.prototype._getMediaElementPosition=function(){var e=this.getMediaElement();if(!e)throw new Error("No media element.");return 1e3*e.currentTime},t.prototype._whenPlaylistRetrieved=function(){var e=this,t=this._playlist;if(!t)throw new Error("Playlist should have been retrieved.");this._playlistUpdateEventHandle=t.onUpdated.subscribe(function(){e._updateLocalDurationsFromPlaylist(),e._handleDurationChange(),e._schedulePlaylistUpdate()});var r=!this._initialPlaylistRetrieveCompleted;if(!r){var o=n(t);if(this._playlistDuration 0.");this._ensureNotDead(),this._ensureInitialized(),this._logger.debug("remove() called.",e);var t=a();return this._pendingActions.push({type:"remove",range:e,deferred:t,abort:!1}),this._eosSignalled=!1,this._performNextAction(),t.promise},e.prototype.signalEOS=function(){if(this._ensureNotDead(),this._ensureInitialized(),this._logger.debug("signalEOS() called."),this._eosSignalled)return this._logger.debug("Ignoring because already signalled EOS."),u.resolve();this._eosSignalled=!0;var e=a();return this._pendingActions.push({type:"eos",deferred:e}),this._performNextAction(),e.promise},e.prototype.updateDuration=function(e){if(e<=0)throw new Error("Duration must be > 0.");this._ensureNotDead(),this._ensureInitialized(),this._logger.debug("updateDuration() called.",e);var t=a();return this._pendingActions.push({type:"duration",duration:e,deferred:t}),this._performNextAction(),t.promise},e.prototype.eosSignalled=function(){return this._eosSignalled},e.prototype.kill=function(){if(!this._dead){this._logger.debug("kill() called."),this._dead=!0,this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1),this._mediaSource.removeEventListener("sourceended",this._onSourceBufferUpdateEnd,!1),this._mediaSource.removeEventListener("error",this._onMediaSourceError,!1),this._sourceBuffer&&(this._sourceBuffer.removeEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.removeEventListener("error",this._onSourceBufferError,!1)),URL.revokeObjectURL(this._url);var e=this._error||t.killedError,r=this._currentAction?[this._currentAction]:[];r=r.concat(this._pendingActions),r.forEach(function(t){t.deferred.reject(e)}),this._whenIdleDeferred||(this._whenIdleDeferred=a()),this._whenIdleDeferred.reject(e),this._initialized||this._initializeDeferred.reject(e),this._pendingActions.length=0,this._logger.debug("Killed.")}},e.prototype._ensureInitialized=function(){if(!this._initialized)throw new Error("Not initialized yet.")},e.prototype._ensureNotDead=function(){if(this._error)throw new Error("MSE is dead because of error: "+this._error.message);if(this._dead)throw new Error("MSE is dead.")},e.prototype._onMediaSourceInit=function(){this._logger.debug("MSE initialized."),this._mediaSource.removeEventListener("sourceopen",this._onMediaSourceInit,!1);try{this._logger.debug("Creating source buffer.",this._type),this._sourceBuffer=this._mediaSource.addSourceBuffer(this._type),this._sourceBuffer.mode=this._useSegmentsMode?"segments":"sequence",this._logger.debug("Using append mode: "+this._sourceBuffer.mode),this._sourceBuffer.addEventListener("updateend",this._onSourceBufferUpdateEnd,!1),this._sourceBuffer.addEventListener("error",this._onSourceBufferError,!1)}catch(e){this._handleError(e)}this._initializeDeferred.resolve(void 0),this._whenIdleDeferred.resolve(void 0),this._initialized=!0,this._performNextAction()},e.prototype._onMediaSourceError=function(e){this._handleError(e)},e.prototype._handleError=function(e){this._logger.error("Error occurred.",e),this._dead||(this._error=e||new Error("Unknown error."),this.kill())},e.prototype._onSourceBufferUpdateEnd=function(){if(!this._dead){var e=this._currentAction;if(!e)return void this._logger.debug("Ignoring stray updateend event.");var t=this.getBuffered();this._logger.debug("Update ended.",t),null!==this._pendingStartTime&&n.TimeRange.getCoverage(t).end>this._pendingStartTime&&(this._pendingStartTime=null),this._currentAction=null,e.deferred.resolve(void 0),this._performNextAction()}},e.prototype._onSourceBufferError=function(e){this._handleError(e)},e.prototype._performNextAction=function(){var e=this,t=this._whenIdleDeferred;if(!this._currentAction&&this._sourceBuffer){var r=this._pendingActions.shift();if(!r)return this._logger.debug("No more actions."),void(t&&(this._whenIdleDeferred=null,t.resolve(void 0)));switch(t||(this._whenIdleDeferred=a()),this._currentAction=r,this._logger.debug("Performing next action...",r),r.type){case"append":null!==r.startTime&&(this._pendingStartTime=r.startTime);var o=n.TimeRange.getCoverage(this.getBuffered());try{if(null!==this._pendingStartTime)this._setTimestampOffset(this._sourceBuffer,this._pendingStartTime);else if("segments"===this._sourceBuffer.mode){var i=o.end;this._logger.debug('Setting timestampOffset because in "segments" mode.',i),this._setTimestampOffset(this._sourceBuffer,i)}this._logger.debug("Calling appendBuffer()."),this._sourceBuffer.appendBuffer(r.data)}catch(e){this._handleError(e)}break;case"remove":try{var s=r.range;this._logger.debug("Calling remove().",s.start,s.end),!r.abort||p||f||"open"!==this._mediaSource.readyState||this._sourceBuffer.abort(),this._sourceBuffer.remove(s.start/1e3,s.end/1e3)}catch(e){this._handleError(e)}break;case"duration":this._logger.debug("Updating duration.",r.duration);try{this._mediaSource.duration=r.duration/1e3,window.setTimeout(function(){return e._onSourceBufferUpdateEnd()},0)}catch(t){this._mediaSource.duration>=r.duration/1e3?(this._logger.warn("Failed to update MSE durtion but ignoring because current one is higher.",t),window.setTimeout(function(){return e._onSourceBufferUpdateEnd()},0)):(this._logger.error("Could not update MSE durtion.",t),this._handleError(t))}break;case"eos":try{this._logger.debug("Calling endOfStream()."),this._mediaSource.endOfStream()}catch(e){this._handleError(e)}break;default:this._handleError(new Error("Unknown action."))}}},e.prototype._setTimestampOffset=function(e,t){try{return e.timestampOffset=t/1e3,!0}catch(e){if(11===e.code)return this._logger.debug("Failed to set timestampOffset.",e),!1;throw e}},e}();t.MSE=b},function(e,t,r){"use strict";function n(e,t){for(var r=e.byteLength,n=0;n0&&e.setUint32(16,0)},o=function(e){n(e,function(e,t){return e===c&&(s(t),!0)})},s=function(e){n(e,function(e,t){return e===d&&(p(t),!0)})},p=function(e){var r,n=e.getUint8(0);t?r=a(0):(r=a(e.getUint32(4)),n>0&&(r=r.shiftLeft(32),r=r.add(e.getUint32(8))),null===h&&(h=r),r=r.subtract(h)),n>0?(e.setUint32(4,r.shiftRight(32).toJSNumber()),e.setUint32(8,r.and(65535).toJSNumber())):e.setUint32(4,r.toJSNumber())},f=i.helpers.arrayBuffer.combine([e]),h=null;return n(new DataView(f.buffer,f.byteOffset,f.byteLength),function(e,t){switch(e){case u:r(t);break;case l:o(t)}return!1}),f}Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(12),s=8,u=1936286840,l=1836019558,c=1953653094,d=1952867444;t.clearMP4InternalTimestamp=o},function(e,t,r){(function(e){var r,n,o=function(e){"use strict";function t(e,r){return"undefined"==typeof e?t[0]:"undefined"!=typeof r?10===+r?V(e):re(e,r):V(e)}function r(e,t){this.value=e,this.sign=t,this.isSmall=!1}function n(e){this.value=e,this.sign=e<0,this.isSmall=!0}function i(e){return-K0?Math.floor(e):Math.ceil(e)}function d(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,u=W;for(n=0;n=u?1:0,a[n]=r-s*u;for(;n0&&a.push(s),a}function p(e,t){return e.length>=t.length?d(e,t):d(t,e)}function f(e,t){var r,n,o=e.length,i=new Array(o),a=W;for(n=0;n0;)i[n++]=t%a,t=Math.floor(t/a);return i}function h(e,t){var r,n,o=e.length,i=t.length,a=new Array(o),s=0,l=W;for(r=0;r=0?i=h(e,t):(i=h(t,e),o=!o),i=s(i),"number"==typeof i?(o&&(i=-i),new n(i)):new r(i,o)}function g(e,t,o){var i,a,u=e.length,l=new Array(u),c=-t,d=W;for(i=0;i0;)i[n++]=s%a,s=Math.floor(s/a);return i}function m(e,t){for(var r=[];t-- >0;)r.push(0);return r.concat(e)}function E(e,t){var r=Math.max(e.length,t.length);if(r<=30)return y(e,t);r=Math.ceil(r/2);var n=e.slice(r),o=e.slice(0,r),i=t.slice(r),a=t.slice(0,r),s=E(o,a),l=E(n,i),c=E(p(o,n),p(a,i)),d=p(p(s,m(h(h(c,s),l),r)),m(l,2*r));return u(d),d}function b(e,t){return-.012*e-.012*t+15e-6*e*t>0}function w(e,t,n){return e=0;n--){for(r=f-1,y[n+p]!==_&&(r=Math.floor((y[n+p]*f+y[n+p-1])/_)),o=0,i=0,u=m.length,a=0;ac&&(o=(o+1)*f),r=Math.ceil(o/i);do{if(a=v(t,r),T(a,p)<=0)break;r--}while(r);d.push(r),p=h(p,a)}return d.reverse(),[s(d),s(p)]}function O(e,t){var r,n,o,i,a=e.length,s=l(a),u=W;for(o=0,r=a-1;r>=0;--r)i=o*u+e[r],n=c(i/t),o=i-n*t,s[r]=0|n;return[s,0|o]}function A(e,o){var i,u,l=V(o),d=e.value,p=l.value;if(0===p)throw new Error("Cannot divide by zero");if(e.isSmall)return l.isSmall?[new n(c(d/p)),new n(d%p)]:[t[0],e];if(l.isSmall){if(1===p)return[e,t[0]];if(p==-1)return[e.negate(),t[0]];var f=Math.abs(p);if(ft.length?1:-1;for(var r=e.length-1;r>=0;r--)if(e[r]!==t[r])return e[r]>t[r]?1:-1;return 0}function M(e){var t=e.abs();return!t.isUnit()&&(!!(t.equals(2)||t.equals(3)||t.equals(5))||!(t.isEven()||t.isDivisibleBy(3)||t.isDivisibleBy(5))&&(!!t.lesser(25)||void 0))}function x(e){return("number"==typeof e||"string"==typeof e)&&+Math.abs(e)<=W||e instanceof r&&e.value.length<=1}function D(e,t,r){t=V(t);for(var n=e.isNegative(),i=t.isNegative(),a=n?e.not():e,s=i?t.not():t,u=0,l=0,c=null,d=null,p=[];!a.isZero()||!s.isZero();)c=A(a,$),u=c[1].toJSNumber(),n&&(u=$-1-u),d=A(s,$),l=d[1].toJSNumber(),i&&(l=$-1-l),a=c[0],s=d[0],p.push(r(u,l));for(var f=o(0!==r(n?1:0,i?1:0)?-1:0),h=p.length-1;h>=0;h-=1)f=f.multiply($).add(o(p[h]));return f}function I(e){var t=e.value,r="number"==typeof t?t|ee:t[0]+t[1]*W|te;return r&-r}function k(e,t){if(t.compareTo(e)<=0){var r=k(e,t.square(t)),n=r.p,i=r.e,a=n.multiply(t);return a.compareTo(e)<=0?{p:a,e:2*i+1}:{p:n,e:2*i}}return{p:o(1),e:0}}function C(e,t){return e=V(e),t=V(t),e.greater(t)?e:t}function N(e,t){return e=V(e),t=V(t),e.lesser(t)?e:t}function L(e,r){if(e=V(e).abs(),r=V(r).abs(),e.equals(r))return e;if(e.isZero())return r;if(r.isZero())return e;for(var n,o,i=t[1];e.isEven()&&r.isEven();)n=Math.min(I(e),I(r)),e=e.divide(n),r=r.divide(n),i=i.multiply(n);for(;e.isEven();)e=e.divide(I(e));do{for(;r.isEven();)r=r.divide(I(r));e.greater(r)&&(o=r,r=e,e=o),r=r.subtract(e)}while(!r.isZero());return i.isUnit()?e:e.multiply(i)}function j(e,t){return e=V(e).abs(),t=V(t).abs(),e.divide(L(e,t)).multiply(t)}function F(e,t){e=V(e),t=V(t);var o=N(e,t),i=C(e,t),a=i.subtract(o).add(1);if(a.isSmall)return o.add(Math.floor(Math.random()*a));for(var u=a.value.length-1,l=[],d=!0,p=u;p>=0;p--){var f=d?a.value[p]:W,h=c(Math.random()*f);l.unshift(h),h=0;o--)i=i.add(e[o].times(a)),a=a.times(r);return n?i.negate():i}function B(e){return e<=35?"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e):"<"+e+">"}function q(e,t){if(t=o(t),t.isZero()){if(e.isZero())return{value:[0],isNegative:!1};throw new Error("Cannot convert nonzero numbers to base 0.")}if(t.equals(-1)){if(e.isZero())return{value:[0],isNegative:!1};if(e.isNegative())return{value:[].concat.apply([],Array.apply(null,Array(-e)).map(Array.prototype.valueOf,[1,0])),isNegative:!1};var r=Array.apply(null,Array(+e-1)).map(Array.prototype.valueOf,[0,1]);return r.unshift([1]),{value:[].concat.apply([],r),isNegative:!1}}var n=!1;if(e.isNegative()&&t.isPositive()&&(n=!0,e=e.abs()),t.equals(1))return e.isZero()?{value:[0],isNegative:!1}:{value:Array.apply(null,Array(+e)).map(Number.prototype.valueOf,1),isNegative:n};for(var i,a=[],s=e;s.isNegative()||s.compareAbs(t)>=0;){i=s.divmod(t),s=i.quotient;var u=i.remainder;u.isNegative()&&(u=t.minus(u).abs(),s=s.next()),a.push(u.toJSNumber())}return a.push(s.toJSNumber()),{value:a.reverse(),isNegative:n}}function H(e,t){var r=q(e,t);return(r.isNegative?"-":"")+r.value.map(B).join("")}function z(e){if(i(+e)){var t=+e;if(t===c(t))return new n(t);throw new Error("Invalid integer: "+e)}var o="-"===e[0];o&&(e=e.slice(1));var a=e.split(/e/i);if(a.length>2)throw new Error("Invalid integer: "+a.join("e"));if(2===a.length){var s=a[1];if("+"===s[0]&&(s=s.slice(1)),s=+s,s!==c(s)||!i(s))throw new Error("Invalid integer: "+s+" is not a valid exponent.");var l=a[0],d=l.indexOf(".");if(d>=0&&(s-=l.length-d-1,l=l.slice(0,d)+l.slice(d+1)),s<0)throw new Error("Cannot include negative exponent part for integers");l+=new Array(s+1).join("0"),e=l}var p=/^([0-9][0-9]*)$/.test(e);if(!p)throw new Error("Invalid integer: "+e);for(var f=[],h=e.length,_=J,g=h-_;h>0;)f.push(+e.slice(g,h)),g-=_,g<0&&(g=0),h-=_;return u(f),new r(f,o)}function G(e){if(i(e)){if(e!==c(e))throw new Error(e+" is not an integer.");return new n(e)}return z(e.toString())}function V(e){return"number"==typeof e?G(e):"string"==typeof e?z(e):e}var W=1e7,J=7,K=9007199254740992,Q=a(K),Y=Math.log(K);r.prototype=Object.create(t.prototype),n.prototype=Object.create(t.prototype),r.prototype.add=function(e){var t=V(e);if(this.sign!==t.sign)return this.subtract(t.negate());var n=this.value,o=t.value;return t.isSmall?new r(f(n,Math.abs(o)),this.sign):new r(p(n,o),this.sign)},r.prototype.plus=r.prototype.add,n.prototype.add=function(e){var t=V(e),o=this.value;if(o<0!==t.sign)return this.subtract(t.negate());var s=t.value;if(t.isSmall){if(i(o+s))return new n(o+s);s=a(Math.abs(s))}return new r(f(s,Math.abs(o)),o<0)},n.prototype.plus=n.prototype.add,r.prototype.subtract=function(e){var t=V(e);if(this.sign!==t.sign)return this.add(t.negate());var r=this.value,n=t.value;return t.isSmall?g(r,Math.abs(n),this.sign):_(r,n,this.sign)},r.prototype.minus=r.prototype.subtract,n.prototype.subtract=function(e){var t=V(e),r=this.value;if(r<0!==t.sign)return this.add(t.negate());var o=t.value;return t.isSmall?new n(r-o):g(o,Math.abs(r),r>=0)},n.prototype.minus=n.prototype.subtract,r.prototype.negate=function(){return new r(this.value,!this.sign)},n.prototype.negate=function(){var e=this.sign,t=new n(-this.value);return t.sign=!e,t},r.prototype.abs=function(){return new r(this.value,!1)},n.prototype.abs=function(){return new n(Math.abs(this.value))},r.prototype.multiply=function(e){var n,o=V(e),i=this.value,s=o.value,u=this.sign!==o.sign;if(o.isSmall){if(0===s)return t[0];if(1===s)return this;if(s===-1)return this.negate();if(n=Math.abs(s),nn?1:-1):-1},r.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return this.sign!==t.sign?t.sign?1:-1:t.isSmall?this.sign?-1:1:T(r,n)*(this.sign?-1:1)},r.prototype.compareTo=r.prototype.compare,n.prototype.compare=function(e){if(e===1/0)return-1;if(e===-(1/0))return 1;var t=V(e),r=this.value,n=t.value;return t.isSmall?r==n?0:r>n?1:-1:r<0!==t.sign?r<0?-1:1:r<0?1:-1},n.prototype.compareTo=n.prototype.compare,r.prototype.equals=function(e){return 0===this.compare(e)},n.prototype.eq=n.prototype.equals=r.prototype.eq=r.prototype.equals,r.prototype.notEquals=function(e){return 0!==this.compare(e)},n.prototype.neq=n.prototype.notEquals=r.prototype.neq=r.prototype.notEquals,r.prototype.greater=function(e){return this.compare(e)>0},n.prototype.gt=n.prototype.greater=r.prototype.gt=r.prototype.greater,r.prototype.lesser=function(e){return this.compare(e)<0},n.prototype.lt=n.prototype.lesser=r.prototype.lt=r.prototype.lesser,r.prototype.greaterOrEquals=function(e){return this.compare(e)>=0},n.prototype.geq=n.prototype.greaterOrEquals=r.prototype.geq=r.prototype.greaterOrEquals,r.prototype.lesserOrEquals=function(e){return this.compare(e)<=0},n.prototype.leq=n.prototype.lesserOrEquals=r.prototype.leq=r.prototype.lesserOrEquals,r.prototype.isEven=function(){return 0===(1&this.value[0])},n.prototype.isEven=function(){return 0===(1&this.value)},r.prototype.isOdd=function(){return 1===(1&this.value[0])},n.prototype.isOdd=function(){return 1===(1&this.value)},r.prototype.isPositive=function(){return!this.sign},n.prototype.isPositive=function(){return this.value>0},r.prototype.isNegative=function(){return this.sign},n.prototype.isNegative=function(){return this.value<0},r.prototype.isUnit=function(){return!1},n.prototype.isUnit=function(){return 1===Math.abs(this.value)},r.prototype.isZero=function(){return!1},n.prototype.isZero=function(){return 0===this.value},r.prototype.isDivisibleBy=function(e){var r=V(e),n=r.value;return 0!==n&&(1===n||(2===n?this.isEven():this.mod(r).equals(t[0])))},n.prototype.isDivisibleBy=r.prototype.isDivisibleBy,r.prototype.isPrime=function(){var r=M(this);if(r!==e)return r;for(var n,i,a,s,u=this.abs(),l=u.prev(),c=[2,3,5,7,11,13,17,19],d=l;d.isEven();)d=d.divide(2);for(a=0;a-K?new n(e-1):new r(Q,!0)};for(var X=[1];2*X[X.length-1]<=W;)X.push(2*X[X.length-1]);var Z=X.length,$=X[Z-1];r.prototype.shiftLeft=function(e){if(!x(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftRight(-e);var t=this;if(t.isZero())return t;for(;e>=Z;)t=t.multiply($),e-=Z-1;return t.multiply(X[e])},n.prototype.shiftLeft=r.prototype.shiftLeft,r.prototype.shiftRight=function(e){var t;if(!x(e))throw new Error(String(e)+" is too large for shifting.");if(e=+e,e<0)return this.shiftLeft(-e);for(var r=this;e>=Z;){if(r.isZero()||r.isNegative()&&r.isUnit())return r;t=A(r,$),r=t[1].isNegative()?t[0].prev():t[0],e-=Z-1}return t=A(r,X[e]),t[1].isNegative()?t[0].prev():t[0]},n.prototype.shiftRight=r.prototype.shiftRight,r.prototype.not=function(){return this.negate().prev()},n.prototype.not=r.prototype.not,r.prototype.and=function(e){return D(this,e,function(e,t){return e&t})},n.prototype.and=r.prototype.and,r.prototype.or=function(e){return D(this,e,function(e,t){return e|t})},n.prototype.or=r.prototype.or,r.prototype.xor=function(e){return D(this,e,function(e,t){return e^t})},n.prototype.xor=r.prototype.xor;var ee=1<<30,te=(W&-W)*(W&-W)|ee;r.prototype.bitLength=function(){var e=this;return e.compareTo(o(0))<0&&(e=e.negate().subtract(o(1))),0===e.compareTo(o(0))?o(0):o(k(e,o(2)).e).add(o(1))},n.prototype.bitLength=r.prototype.bitLength;var re=function(e,t){for(var r,o=e.length,i=Math.abs(t),r=0;r=i){if("1"===a&&1===i)continue;throw new Error(a+" is not a valid digit in base "+t+".")}if(a.charCodeAt(0)-87>=i)throw new Error(a+" is not a valid digit in base "+t+".")}}if(2<=t&&t<=36&&o<=Y/Math.log(t)){var s=parseInt(e,t);if(isNaN(s))throw new Error(a+" is not a valid digit in base "+t+".");return new n(parseInt(e,t))}t=V(t);var u=[],l="-"===e[0];for(r=l?1:0;r"!==e[r]);u.push(V(e.slice(d+1,r)))}}return U(u,t,l)};r.prototype.toArray=function(e){return q(this,e)},n.prototype.toArray=function(e){return q(this,e)},r.prototype.toString=function(t){if(t===e&&(t=10),10!==t)return H(this,t);for(var r,n=this.value,o=n.length,i=String(n[--o]),a="0000000";--o>=0;)r=String(n[o]),i+=a.slice(r.length)+r;var s=this.sign?"-":"";return s+i},n.prototype.toString=function(t){return t===e&&(t=10),10!=t?H(this,t):String(this.value)},r.prototype.toJSON=n.prototype.toJSON=function(){return this.toString()},r.prototype.valueOf=function(){return parseInt(this.toString(),10)},r.prototype.toJSNumber=r.prototype.valueOf,n.prototype.valueOf=function(){return this.value},n.prototype.toJSNumber=n.prototype.valueOf;for(var ne=0;ne<1e3;ne++)t[ne]=new n(ne),ne>0&&(t[-ne]=new n(-ne));return t.one=t[1],t.zero=t[0],t.minusOne=t[-1],t.max=C,t.min=N,t.gcd=L,t.lcm=j,t.isInstance=function(e){return e instanceof r||e instanceof n},t.randBetween=F,t.fromArray=function(e,t,r){return U(e.map(V),V(t||10),r)},t}();e.hasOwnProperty("exports")&&(e.exports=o),r=[],n=function(){return o}.apply(t,r),!(void 0!==n&&(e.exports=n))}).call(this,r(13)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=n.eventDispatcher.EventDispatcher,i=n.logger.prefixLogger,a=n.logger.noOpLogger,s=15e3,u=2e4,l=function(){function e(e,t,r,n,s){void 0===s&&(s=a);var u=this;this._onAppendQueued=new o,this._onAppendEnd=new o,this._providedStartTime=!1,this._needsInitData=!0,this._updateTimerId=null,this._gcTimerId=null,this._waitingForData=!1,this._started=!1,this._error=null,this._currentRetrieveHandle=null,this._mseInitialized=!1,this._logger=i(s,"SimpleMSE"),this.onAppendQueued=this._onAppendQueued.getHandle(),this.onAppendEnd=this._onAppendEnd.getHandle(),this._mse=e,this._getNextSegmentData=t,this._getPosition=r,this._onError=n,e.whenInitialized().then(function(){u._mseInitialized=!0,!u._error&&u._started&&(u._logger.debug("MSE initialized. Preparing to update."),u._prepareUpdate())}).catch(function(e){u._error||(u._logger.error("Error when waiting for MSE to initialize.",e),u._handleError(e||new Error("Error waiting for MSE to initialize.")))})}return e.prototype.start=function(){if(this._checkNotErrored(),this._started)throw new Error("Already started.");this._logger.debug("start() called."),this._scheduleGC(),this._started=!0,this._prepareUpdate()},e.prototype.kill=function(){this._error||(this._logger.debug("kill() called."),this._error=new Error("Killed."),this._clearTimers(),this._logger.debug("Killed."))},e.prototype.waitingForSegmentData=function(){return this._checkNotErrored(),this._waitingForData},e.prototype.provideNextSegmentData=function(e){if(this._checkNotErrored(),!this._waitingForData)throw new Error("Not waiting for data.");this._logger.debug("Segment data provided."),this._waitingForData=!1,this._update(e)},e.prototype._prepareUpdate=function(){if(!this._updateTimerId){var e=this._mse;if(this._mseInitialized){var t=e.getBuffered(),r=this._getPosition(),o=n.helpers.find(t,function(e){return e.containsTime(r)});if(!o||o.end<=this._getPosition()+s){this._logger.debug("Requesting next segment data.");var i=this._getNextSegmentData();i?(this._logger.debug("Got segment data."),this._update(i)):(this._logger.debug("Did not get any data."),this._waitingForData=!0)}else this._scheduleUpdate()}}},e.prototype._gc=function(){var e=this;if(!this._mseInitialized)return void this._scheduleGC();var t=this._mse,r=n.TimeRange.getCoverage(t.getBuffered()),o=this._getPosition()-5e3;if(r.start0){var r=e.length+this.bufferSize;if(!this.buffer||this.buffer.length0&&n.set(this.buffer.subarray(0,this.bufferSize)),this.buffer=n}this.buffer.set(e,this.bufferSize),this.bufferSize=r,e=this.buffer,t=r}else t=e.length;for(var o,i=0;i0;)i+=o;var a=t-i;a>0&&(!this.buffer||this.buffer.lengthr)return-1;if(255===e[t]||224===(224&e[t+1])){if(t+24>r)return-1;var n=e[t+1]>>3&3,a=e[t+1]>>1&3,s=e[t+2]>>4&15,u=e[t+2]>>2&3,l=!!(2&e[t+2]);if(1!==n&&0!==s&&15!==s&&3!==u){var c=3===n?3-a:3===a?3:4,d=1e3*o[14*c+s-1],p=3===n?0:2===n?1:2,f=i[3*p+u],h=l?1:0,_=3===a?(3===n?12:6)*d/f+h<<2:(3===n?144:72)*d/f+h|0;return t+_>r?-1:(this.onFrame&&this.onFrame(new Uint8Array(e.subarray(t,t+_))),_)}}for(var g=t+2;g0&&this.onNoise&&this.onNoise(new Uint8Array(this.buffer.subarray(0,this.bufferSize))),this.buffer=null,this.bufferSize=0,this.onClose&&this.onClose()}},function(e,t,r){"use strict";function n(e){return e.byteLength>=3&&73===e[0]&&68===e[1]&&51===e[2]}Object.defineProperty(t,"__esModule",{value:!0}),t.isID3Tag=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(12),i=r(32),a=r(4),s=r(13),u={rate:44100,id:3},l=16,c=2,d=u.rate,p=2,f=8;t.MP3ToMP4={getInputFormat:function(){return{mimeType:"audio/mpeg"}},getOutputFormat:function(){return{mimeType:"audio/mp4",audioCodec:{id:"mp3"}}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(){E.close(),b.flush()}function r(r){m=!0;try{t()}catch(e){}h.reject(r),e.abort()}var h=n.helpers.deferred.buildDeferred(),_=new n.eventDispatcher.EventDispatcher,g=[],y=!1,v=null,m=!1,E=new o.MP3Parser,b=new i.MP4Mux({audioTrackId:0,videoTrackId:-1,tracks:[{codecId:p,channels:c,samplerate:u.rate,samplesize:l,timescale:d}]});return b.ondata=function(e){m||(v?(g.push(e),_.dispatch({initData:v,data:e})):v=e)},E.onNoise=function(e){m||s.isID3Tag(e)||r(new a.Mp3NoiseError)},E.onFrame=function(e){if(!m)try{var t=new Uint8Array(e.length+1),n=p<<4;n|=u.id<<2,n|=(16===l?1:0)<<1,n|=2===c?1:0,t[0]=n,t.set(e,1);var o=0;b.pushPacket(f,t,o)}catch(e){r(e)}},e.onProgressUpdate(function(e){var t=e.data;!y&&e.initData&&(t=n.helpers.arrayBuffer.combine([e.initData,e.data])),y=!0;try{E.push(t)}catch(e){r(e)}}),e.onCompletion(function(e){try{t(),h.resolve(e)}catch(e){r(e)}}),e.onError(r),{result:h.promise,progressUpdates:{onProgressUpdate:_,getProgressSoFar:function(){return g.length?{initData:v,data:n.helpers.arrayBuffer.combine(g)}:null}},abort:function(){m=!0,e.abort(),t()}}});return t.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905;var n=r(16);t.PlaylistSegmentRetriever=n.PlaylistSegmentRetriever;var o=r(17);t.Playlist=o.Playlist,t.PlaylistType=o.PlaylistType;var i=r(18);t.Segment=i.Segment;var a=r(29);t.TransmuxerFactory=a.TransmuxerFactory;var s=r(14);t.MP3ToMP4Transmuxer=s.MP3ToMP4;var u=r(11);t.PassThroughTransmuxer=u.PassThrough;var l=r(36);t.retrievalErrors=l.retrievalErrors;var c=r(39);t.events=c.events},function(e,t,r){"use strict";function n(e,t,r){var n=e.getTimeRange();return r!==t&&(r>t?n.end>t&&n.startt||n.start 0.");if(o<0)throw new Error("Cache size must be > 0.");this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this.onSegmentDataRetrieveStarted=this._onSegmentDataRetrieveStarted.getHandle(),this.onSegmentReady=this._onSegmentReady.getHandle(),this.onError=this._onError.getHandle(),this._playlist=t,this._transmuxer=i,this._getPosition=r,this._maxBufferLength=n,this._cacheSize=o,this._scheduleNextUpdate(0)}return e.prototype.updateMaxBufferLength=function(e){if(this._ensureNotDead(),e<0)throw new Error("Max buffer length must be > 0.");this._logger.debug("updateMaxBufferLength() called.",e),this._maxBufferLength=e,this.update()},e.prototype.updateCacheSize=function(e){if(this._ensureNotDead(),e<0)throw new Error("Cache size must be > 0.");this._cacheSize=e,this.update()},e.prototype.getCacheSize=function(){return this._cacheSize},e.prototype.getCacheUsage=function(){return this._segments.reduce(function(e,t){return t.state===o.RETRIEVING_DATA||t.state===o.COMPLETE?e+t.size:e},0)},e.prototype.switchPlaylist=function(e){if(this._ensureNotDead(),e&&!e.hasInitialUpdateCompleted())throw new Error("Playlist retrieve has not completed.");this._logger.debug("switchPlaylist() called."),this._abortCurrentRetrieve(),this._playlist=e,this._segments=this._segments.filter(function(e){return e.state===o.COMPLETE}),this.update()},e.prototype.getSegmentsWithData=function(){return this._ensureNotDead(),this._segments.filter(function(e){return e.state===o.RETRIEVING_DATA&&e.size||e.state===o.COMPLETE}).map(function(e){var t=e.segment,r=e.dataRetrieveJob;return{segment:t,dataRetrieveJob:r,complete:e.state===o.COMPLETE}})},e.prototype.update=function(){var e=this;this._ensureNotDead(),this._timerId&&(window.clearTimeout(this._timerId),this._timerId=null);var t=this._getPosition(),r=t,n=0;this._segments.some(function(e){if(e.state!==o.COMPLETE)return!1;var i=e.segment.getTimeRange();return i.containsTime(n)&&(n=i.end),!(i.endr||(r=i.end,!1))});var i=t+this._maxBufferLength,a=function(){var t=e._playlist;if(t){var o=t.hasEnded()&&r===t.getDuration();if(o)return r=n,t.getDuration()+n0&&t._onSegmentDataRetrieveStarted.dispatch({segment:e.segment,dataRetrieveJob:r,complete:!1})}),n.onCompletion(function(){if(t._retrievingSegment=null,p.state!==o.RETRIEVING_DATA)throw new Error("Incorrect retrieval state.");t._switchSegment(p,{state:o.COMPLETE,dataRetrieveJob:p.dataRetrieveJob,dataRetrieveJobHandle:p.dataRetrieveJobHandle,segment:e.segment,size:p.size}),t._logger.debug("Segment retrieve completed.",e.segment.getEventRepresentation()),t.update(),t._onSegmentReady.dispatch({segment:e.segment,complete:!0,dataRetrieveJob:p.dataRetrieveJob})}),n.onError(function(r){r!==h&&(t._logger.error("Error retrieving segment data.",r,e.segment.getEventRepresentation()),t._scheduleNextUpdate(),r instanceof a.OggParserError?r=r instanceof a.ChecksumFailedError?new s.OggParserError("CHECKSUM_FAILED"):r instanceof a.NoSegmentsInPageError?new s.OggParserError("NO_SEGMENTS_IN_PAGE"):r instanceof a.PageFromDifferentBitstreamError?new s.OggParserError("PAGE_FROM_DIFFERENT_BITSTREAM"):r instanceof a.PageSequenceNumberDidNotIncrementError?new s.OggParserError("SEQUENCE_NUMBER_DID_NOT_INCREMENT"):r instanceof a.UnexpectedBOSError?new s.OggParserError("UNEXPECTED_BOS"):r instanceof a.UnexpectedEOSError?new s.OggParserError("UNEXPECTED_EOS"):new s.OggParserError("UNKNOWN"):r instanceof c.Mp3TransmuxerError&&(r=r instanceof d.Mp3NoiseError?new l.Mp3TransmuxerRetrievalError("NOISE"):new l.Mp3TransmuxerRetrievalError("UNKNOWN")),t._onError.dispatch(r))})}},e.prototype._retrieveSegment=function(e){var t=this,r=this._retrievingSegment,n=this._playlist,i=n?n.getSegmentIndexContainingTime(e):null;if(!r||r.state!==o.RETRIEVING_SEGMENT||r.segmentIndex!==i)if(this._abortCurrentRetrieve(),n)if(null===i)this._scheduleNextUpdate();else{var a=n.getSegment(i);this._logger.debug("Retrieving segment.",i),a.onCompletion(function(e){if(t._logger.debug("Retrieved segment.",i),!u.isPartialMatch(t._transmuxer.getInputFormat(),e.getFormat())){var r=new Error("Segment format is not supported by transmuxer.");return t._logger.error("Segment incorrect format.",r),t._scheduleNextUpdate(),void t._onError.dispatch(r)}e.onSegmentRequestQueued.subscribe(t._onSegmentRequestQueued.dispatch),e.onSegmentRequestStart.subscribe(t._onSegmentRequestStart.dispatch),e.onSegmentRetrieved.subscribe(t._onSegmentRetrieved.dispatch),e.onSegmentRequestFailed.subscribe(t._onSegmentRequestFailed.dispatch),t._segments.splice(t._segments.indexOf(s),1);var n=e.getTimeRange(),a=t._segments.length;t._segments.some(function(e,t){return e.state!==o.RETRIEVING_SEGMENT&&(e.segment.getTimeRange().start>n.start&&(a=t,!0))}),t._segments.splice(a,0,{state:o.RETRIEVED_SEGMENT,segment:e}),t._retrievingSegment=null,t.update()}),a.onError(function(e){e!==h&&(t._logger.error("Error retrieving segment.",e),t._scheduleNextUpdate(),t._onError.dispatch(e))});var s={state:o.RETRIEVING_SEGMENT,segmentIndex:i,segmentRetrieveJob:a};this._segments.push(s),this._retrievingSegment=s}else this._logger.debug("Cannot retrieve segment as there is no playlist."),this._scheduleNextUpdate()},e.prototype._abortCurrentRetrieve=function(){var e=this._retrievingSegment;e&&(e.state===o.RETRIEVING_SEGMENT?(this._logger.debug("Aborting segment retrieve job."),e.segmentRetrieveJob.abort()):e.state===o.RETRIEVING_DATA&&(this._logger.debug("Aborting segment data retrieve job."),e.dataRetrieveJobHandle.abort(),this._switchSegment(e,{state:o.RETRIEVED_SEGMENT,segment:e.segment})),this._retrievingSegment=null)},e.prototype._switchSegment=function(e,t){var r=this._segments.indexOf(e);if(r===-1)throw new Error("Old segment missing.");this._segments.splice(r,1,t)},e.prototype._garbageCollect=function(e){var t=this._segments,r=this._cacheSize,i=this.getCacheUsage();if(!(i<=r)){var a=this._playlist,s=a&&a.getCompleteDuration(),u=null!==s?s:1/0,l=e+this._maxBufferLength;l>u&&(l-=u,l>=e)||t.filter(function(t){return t.state===o.COMPLETE&&!n(t.segment,e,l)}).map(function(t){var r=t.segment.getTimeRange(),n=r.start,o=Math.min(Math.abs(e-n),n+u-e);return{segment:t,distance:o,size:t.size}}).sort(function(e,t){return t.distance-e.distance}).some(function(e){return i<=r||(t.splice(t.indexOf(e.segment),1),i-=e.size,!1)})}},e.prototype._scheduleNextUpdate=function(e){var t=this;void 0===e&&(e=1e3),this._timerId||(this._timerId=window.setTimeout(function(){t._timerId=null,t.update()},e))},e.prototype._ensureNotDead=function(){if(this._dead)throw new Error("Playlist segment retriever has been killed.")},e}();t.PlaylistSegmentRetriever=y},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(0),i=o.eventDispatcher.EventDispatcher;!function(e){e[e.LIVE=0]="LIVE",e[e.EVENT=1]="EVENT",e[e.VOD=2]="VOD"}(n=t.PlaylistType||(t.PlaylistType={})); +var a=function(){function e(){this._onPlaylistRequestQueued=new i,this._onPlaylistRequestStart=new i,this._onPlaylistRetrieved=new i,this._onPlaylistRequestFailed=new i,this._onPlaylistParseStart=new i,this._onPlaylistParseEnd=new i,this._onKeyRequestQueued=new i,this._onKeyRequestStart=new i,this._onKeyRetrieved=new i,this._onKeyRequestFailed=new i,this._onInitDataRequestQueued=new i,this._onInitDataRequestStart=new i,this._onInitDataRetrieved=new i,this._onInitDataRequestFailed=new i,this._onUpdated=new i,this.onPlaylistRequestQueued=this._onPlaylistRequestQueued.getHandle(),this.onPlaylistRequestStart=this._onPlaylistRequestStart.getHandle(),this.onPlaylistRetrieved=this._onPlaylistRetrieved.getHandle(),this.onPlaylistRequestFailed=this._onPlaylistRequestFailed.getHandle(),this.onPlaylistParseStart=this._onPlaylistParseStart.getHandle(),this.onPlaylistParseEnd=this._onPlaylistParseEnd.getHandle(),this.onKeyRequestQueued=this._onKeyRequestQueued.getHandle(),this.onKeyRequestStart=this._onKeyRequestStart.getHandle(),this.onKeyRetrieved=this._onKeyRetrieved.getHandle(),this.onKeyRequestFailed=this._onKeyRequestFailed.getHandle(),this.onInitDataRequestQueued=this._onInitDataRequestQueued.getHandle(),this.onInitDataRequestStart=this._onInitDataRequestStart.getHandle(),this.onInitDataRetrieved=this._onInitDataRetrieved.getHandle(),this.onInitDataRequestFailed=this._onInitDataRequestFailed.getHandle(),this.onUpdated=this._onUpdated.getHandle()}return e.prototype.update=function(){var e=this,t=this._update();return t.onCompletion(function(){return e._onUpdated.dispatch(void 0)}),t},e.prototype.getSegment=function(e){return this.getSegments(e,e+1)[0]},e.prototype.getSegments=function(e,t){var r=this.getSegmentCount(),n=this.getFirstSegmentIndex();if(void 0===t&&(t=n+r),void 0===e&&(e=n),en+r)throw new Error("Invalid range of segments.");for(var o=[],i=e;i=400&&e<500)}:P,O=this;this._onSegmentRequestQueued=new l,this._onSegmentRequestStart=new l,this._onSegmentRetrieved=new l,this._onSegmentRequestFailed=new l,this.onSegmentRequestQueued=this._onSegmentRequestQueued.getHandle(),this.onSegmentRequestStart=this._onSegmentRequestStart.getHandle(),this.onSegmentRetrieved=this._onSegmentRetrieved.getHandle(),this.onSegmentRequestFailed=this._onSegmentRequestFailed.getHandle(),this._sequenceNumber=r,this._playlist=d,this._timeRange=p,this._format=_;var A=this._segmentEventRepresentation=new o.Segment(y,t,r),T=a.getSegmentDownloadJob({delayCalculator:b,segmentEventRepresentation:A,url:t,loader:g,onSegmentRequestQueued:this._onSegmentRequestQueued,onSegmentRequestStart:this._onSegmentRequestStart,onSegmentRequestFailed:this._onSegmentRequestFailed,onSegmentRetrieved:this._onSegmentRetrieved,isResponseCodeAcceptable:S,isResponseCodeRetryable:R,logger:m}),M=s.getSegmentDownloadAndDecryptJob({encryptionConfig:f,downloadAbortableJob:T,logger:m});this._retrieveAbortableJob=new u(function(){var e=i.SegmentParserFactory.retrieveSegmentParser(O._format),t=new l,r=n.helpers.deferred.buildDeferred(),o=e.parseSegmentData(n.helpers.abortableJob.map(function(){return M.run()},{convertProgressUpdate:function(e,t){return t&&h?n.helpers.arrayBuffer.combine([h,e]):e},convertResult:function(e){return e}}).run(),O,O._playlist);return o.onProgressUpdate(t.dispatch,{skipPast:!0}),o.onCompletion(function(){return r.resolve(void 0)}),o.onError(r.reject),{result:r.promise,progressUpdates:{onProgressUpdate:t,getProgressSoFar:o.getProgressSoFar},abort:o.abort}})}return e.prototype.getFormat=function(){return this._format},e.prototype.getSequenceNumber=function(){return this._sequenceNumber},e.prototype.isFinalSegment=function(){var e=this._playlist;return e.hasEnded()&&e.getFirstSegmentIndex()+e.getSegmentCount()-1===this._sequenceNumber},e.prototype.getTimeRange=function(){return this._timeRange},e.prototype.getEventRepresentation=function(){return this._segmentEventRepresentation},e.prototype.retrieveData=function(){var e=this,t=new u(function(){var t=n.helpers.deferred.buildDeferred(),r=new l,o=[],i=e._retrieveAbortableJob.run(),a=void 0;return i.onProgressUpdate(function(e){var t=e.data,n=e.initData;o.length||(a=n),o.push(t),r.dispatch({data:t,initData:a})}),i.onCompletion(function(){t.resolve(void 0)}),i.onError(t.reject),{result:t.promise,progressUpdates:{onProgressUpdate:r,getProgressSoFar:function(){return o.length?{initData:a,data:n.helpers.arrayBuffer.combine(o)}:null}},abort:function(){return i.abort()}}});return t.run()},e}();t.Segment=d},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(3),i=r(20),a=n.helpers.find;t.SegmentParserFactory={retrieveSegmentParser:function(e){var t=a(i.default,function(t){return o.isPartialMatch(t.getFormat(),e)});if(!t)throw new Error("No segment parser found.");return t}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(21),o=r(22),i=[n.OggOpusSegmentParser,o.DefaultSegmentParser];t.default=i},function(e,t,r){"use strict";function n(e){var t=i.retrievePages(e).pages;if(t.length){var r=i.retrievePackets([t[0]])[0];if(r&&r.first){var n=1,o=t.slice(1).some(function(e,t){var r=!!(1&e.header.type[0]);return t>0&&!r||(n=t+2,!1)}),a=s(t.slice(0,n).map(function(e){return e.entirePage}));return{state:"PRESENT",initData:a,initDataEnded:o}}return{state:"NOT_PRESENT"}}return null}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(2),a=o.helpers.abortableJob.AbortableJob,s=o.helpers.arrayBuffer.combine,u=new o.helpers.SCWeakMap;t.OggOpusSegmentParser={getFormat:function(){return{mimeType:"audio/ogg",audioCodec:{id:"opus"}}},parseSegmentData:function(e,r,i){var l=new a(function(){var a=o.helpers.deferred.buildDeferred(),l=new o.eventDispatcher.EventDispatcher,c=[],d=null,p=null,f=null,h=function(t){a.reject(t),e.abort()},_=function(e){u.set(i,e),l.dispatch({initData:e,data:s(c)})};return e.onProgressUpdate(function(e){if(d&&"PRESENT"===d.state&&d.initDataEnded)c.push(e),l.dispatch({initData:d.initData,data:e});else if(d&&"NOT_PRESENT"===d.state)c.push(e);else{c.push(e);var a=s(c);if(d=n(a))if("NOT_PRESENT"===d.state){var g=u.get(i);r.getSequenceNumber()<=i.getFirstSegmentIndex()?h(new Error("Could not find init data.")):g?(d={state:"PRESENT",initData:g,initDataEnded:!0},_(d.initData)):(p=i.getSegment(i.getFirstSegmentIndex()),p.onCompletion(function(e){var r=f=t.OggOpusSegmentParser.parseSegmentData(o.helpers.abortableJob.map(function(){return e.retrieveData()},{convertProgressUpdate:function(e){return e.initData?o.helpers.arrayBuffer.combine([e.initData,e.data]):e.data},convertResult:function(e){return e}}).run(),e,i);r.onProgressUpdate(function(e){var t=e.initData;if(r.abort(),!t){var n=new Error("OggOpusSegmentParser should always provide init data.");throw h(n),n}d={state:"PRESENT",initData:t,initDataEnded:!0},_(t)}),r.onError(function(e){e!==o.helpers.abortableJob.abortedError&&h(e)})}),p.onError(h))}else if("PRESENT"===d.state&&d.initDataEnded){if(c.splice(0),a.byteLength>d.initData.byteLength){var y=new Uint8Array(a.buffer.slice(d.initData.byteLength));c.push(y)}_(d.initData)}}}),e.onCompletion(function(e){d&&"PRESENT"===d.state&&!d.initDataEnded?(_(d.initData),a.resolve(e)):d&&"PRESENT"===d.state?a.resolve(e):a.reject(new Error("Could not find init data."))}),e.onError(h),{result:a.promise,progressUpdates:{onProgressUpdate:l,getProgressSoFar:function(){return d&&"PRESENT"===d.state&&d.initDataEnded?{initData:d.initData,data:s(c)}:null}},abort:function(){e.abort(),p&&p.abort(),f&&f.abort()}}});return l.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.DefaultSegmentParser={getFormat:function(){return{}},parseSegmentData:function(e){return n.helpers.abortableJob.map(function(){return e},{convertProgressUpdate:function(e){return{data:e}},convertResult:function(e){return e}}).run()}}},function(e,t,r){"use strict";function n(e){var t=e.delayCalculator,r=e.segmentEventRepresentation,n=e.url,a=e.loader,s=e.onSegmentRequestQueued,u=e.onSegmentRequestStart,l=e.onSegmentRequestFailed,c=e.onSegmentRetrieved,d=e.isResponseCodeAcceptable,p=e.isResponseCodeRetryable,f=e.logger;return new o.helpers.abortableJob.AbortableJob(function(){var e=o.helpers.deferred.buildDeferred(),h=new o.eventDispatcher.EventDispatcher,_=[],g=0,y=o.helpers.retry.retry(t,function(t){var y=t.scheduleRetry,v=!1,m=0;s.dispatch({segment:r}),f.debug("Requesting segment.",n);var E=a.request({url:n});E.onRequestStart(function(){return u.dispatch({segment:r})});var b=function(e){var t=e.byteLength;if(t)if(m+=t,m<=g)f.debug("Already downloaded this part. Skipping...",m,g);else{var r=t-(m-g),n=new Uint8Array(e,r);g=m,_.push(n),h.dispatch(n)}};return E.onProgress(function(t){var o=t.initial,a=t.statusCode,s=t.part;if(o)if(d(a))f.debug("Segment response started.",n,a),b(s);else{var u=null;p(a)?f.debug("Segment response code was not acceptable. Will retry.",n,a):(f.debug("Segment response code was not acceptable.",n,a),u=new i.UnacceptableResponseStatusCodeError(a)),E.abort(),l.dispatch({segment:r,statusCode:a}),u?e.reject(u):(v=!0,y())}else f.debug("Got segment response part.",n,a),b(s)}),E.onResponseReceived(function(t){v||(t?(c.dispatch({segment:r,statusCode:t.statusCode}),e.resolve(void 0)):(f.warn("Segment request timed out.",n),l.dispatch({segment:r,statusCode:null}),y()))}),E.onError(function(t){v||t!==o.helpers.abortableJob.abortedError&&(t instanceof o.loaderErrors.LoaderError?(f.warn("Error from loader. Will retry",n,t),y()):(f.error("Unexpected error when requesting segment.",t),e.reject(t)))}),{onCancel:function(){f.debug("Aborting segment request.",n),E.hasCompleted()||E.abort(),l.dispatch({segment:r,aborted:!0})}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting segment."))}}).cancel;return{result:e.promise,progressUpdates:{onProgressUpdate:h,getProgressSoFar:function(){return _.length?o.helpers.arrayBuffer.combine(_):null}},abort:function(){return y()}}})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(9);t.getSegmentDownloadJob=n},function(e,t,r){"use strict";function n(e){var t=e.encryptionConfig,r=e.downloadAbortableJob,n=e.logger;return new o.helpers.abortableJob.AbortableJob(function(){var e=new o.eventDispatcher.EventDispatcher,s=o.helpers.deferred.buildDeferred(),u=null;if(t&&(n.info("Finding a decryptor..."),u=i.DecryptorFactory.retrieveDecryptor(t),!u))return n.error("Could not find a decryptor."),s.reject(new a.NoDecryptorError),{result:s.promise,progressUpdates:{onProgressUpdate:e,getProgressSoFar:function(){return null}}};var l=r.run(),c=null,d=[];return t&&u?(c=u.decrypt(l,t),c.onProgressUpdate(function(t){d.push(t),e.dispatch(t)}),c.onError(function(e){e!==o.helpers.abortableJob.abortedError&&n.error("Error occurred during decryption.",e),s.reject(e),l.abort()})):l.onProgressUpdate(function(t){d.push(t),e.dispatch(t)}),l.onCompletion(function(){var e=function(){return s.resolve(void 0)};c?c.whenComplete().then(function(){return e()}):e()}),l.onError(s.reject),{result:s.promise,progressUpdates:{onProgressUpdate:e,getProgressSoFar:function(){return d.length?o.helpers.arrayBuffer.combine(d):null}},abort:function(){l.abort(),c&&c.abort()}}})}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(25),a=r(10);t.getSegmentDownloadAndDecryptJob=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(26),i=n.helpers.find;t.DecryptorFactory={retrieveDecryptor:function(e){return i(o.default,function(t){return t.canDecrypt(e)})||null}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(27),o=[n.JSCrypto];t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),o=r(28),i=null,a=16;t.JSCrypto={canDecrypt:function(e){return"AES-CBC"===e.cipher},decrypt:function(e,t){i||(i=new o.AESDecryptor);var r=i,s=new n.helpers.abortableJob.AbortableJob(function(){var i,s=new n.eventDispatcher.EventDispatcher,u=n.helpers.deferred.buildDeferred(),l=[],c=null,d=[],p=0,f=new Uint8Array(t.iv),h=!1;r.expandKey(t.key.buffer);var _=function(e){var t=c;c=new Uint8Array(r.decrypt(e.buffer,0,f.buffer,!1));var n=e.byteLength-a;if(n<0)throw new Error("lastBlockOffset invalid.");for(var o=0;o>>8^255&g^99,e[f]=g,t[g]=f;var y=p[f],v=p[y],m=p[v],E=257*p[g]^16843008*g;n[f]=E<<24|E>>>8,o[f]=E<<16|E>>>16,i[f]=E<<8|E>>>24,a[f]=E,E=16843009*m^65537*v^257*y^16843008*f,u[g]=E<<24|E>>>8,l[g]=E<<16|E>>>16,c[g]=E<<8|E>>>24,d[g]=E,f?(f=y^p[p[p[m^y]]],h^=p[p[h]]):f=h=1}},e.prototype.expandKey=function(e){for(var t=this.uint8ArrayToUint32Array_(e),r=!0,n=0;n>>24&3,t[r++]=128|i>>>18&63,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294901760&i)?(t[r++]=240|i>>>18&7,t[r++]=128|i>>>12&63,t[r++]=128|i>>>6&63,t[r++]=128|63&i):0!==(4294965248&i)?(t[r++]=224|i>>>12&15,t[r++]=128|i>>>6&63,t[r++]=128|63&i):(t[r++]=192|i>>>6&31,t[r++]=128|63&i)}}return t.subarray(0,r)}function r(e){for(var t=0,r="";t>1|128;if((n&a)===o)break;o=o>>1|128,--i}while(i>=0);if(i<=0)throw new Error("Invalid UTF8 character");for(var s=n&(1<=i;--u){var l=e[t++];if(128!==(192&l))throw new Error("Invalid UTF8 character sequence");s=s<<6|63&l}r+=s>=65536?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}}return r}e.utf8decode=t,e.utf8encode=r}(t=e.StringUtilities||(e.StringUtilities={}))}(o||(o={})),function(e){var t;!function(e){function t(e){for(var t=e.length>>1,r=new Uint8Array(t),n=0;n>4,d=o>>2&3,p=2&o?16:8,f=1&o?2:1;switch(r++,i){case c:var h=e[r++];n=h,t=1024;break;case l:var _=e[r+1]>>3&3,g=e[r+1]>>1&3;t=1===g?3===_?1152:576:3===g?384:1152}return{codecDescription:u[i],codecId:i,data:e.subarray(r),rate:s[d],size:p,channels:f,samples:t,packetType:n}}function n(e){var t=0,r=e[t]>>4,n=15&e[t];t++;var o={frameType:r,codecId:n,codecDescription:p[n]};switch(n){case h:var i=e[t++];o.packetType=i,o.compositionTime=(e[t]<<24|e[t+1]<<16|e[t+2]<<8)>>8,t+=3;break;case f:o.packetType=_.NALU,o.horizontalOffset=e[t]>>4&15,o.verticalOffset=15&e[t],o.compositionTime=0,t++}return o.data=e.subarray(t),o}function o(e){var t,r,n=[],o=-1,i=-1,a=+e.asGetPublicProperty("duration"),s=e.asGetPublicProperty("audiocodecid");switch(s){case l:case"mp3":t="mp3",r=l;break;case c:case"mp4a":t="mp4a",r=c;break;default:if(!isNaN(s))throw new Error("Unsupported audio codec: "+s);t=null,r=-1}var u,d,p=e.asGetPublicProperty("videocodecid");switch(p){case f:case"vp6f":u="vp6f",d=f;break;case h:case"avc1":u="avc1",d=h;break;default:if(!isNaN(p))throw new Error("Unsupported video codec: "+p);u=null,d=-1}var _=null===t?null:{codecDescription:t,codecId:r,language:"und",timescale:+e.asGetPublicProperty("audiosamplerate")||44100,samplerate:+e.asGetPublicProperty("audiosamplerate")||44100,channels:+e.asGetPublicProperty("audiochannels")||2,samplesize:16},g=null===u?null:{codecDescription:u,codecId:d,language:"und",timescale:6e4,framerate:+e.asGetPublicProperty("videoframerate")||+e.asGetPublicProperty("framerate"),width:+e.asGetPublicProperty("width"),height:+e.asGetPublicProperty("height")},y=e.asGetPublicProperty("trackinfo");if(y)for(var v=0;v=0&&t.push({tracks:[e.tracks[e.audioTrackId]],duration:e.duration,audioTrackId:0,videoTrackId:-1}),e.videoTrackId>=0&&t.push({tracks:[e.tracks[e.videoTrackId]],duration:e.duration,audioTrackId:-1,videoTrackId:0}),t}var a,s=[5500,11025,22050,44100],u=["PCM","ADPCM","MP3","PCM le","Nellymouser16","Nellymouser8","Nellymouser","G.711 A-law","G.711 mu-law",null,"AAC","Speex","MP3 8khz"],l=2,c=10;!function(e){e[e.HEADER=0]="HEADER",e[e.RAW=1]="RAW"}(a||(a={}));var d,p=[null,"JPEG","Sorenson","Screen","VP6","VP6 alpha","Screen2","AVC"],f=4,h=7;!function(e){e[e.KEY=1]="KEY",e[e.INNER=2]="INNER",e[e.DISPOSABLE=3]="DISPOSABLE",e[e.GENERATED=4]="GENERATED",e[e.INFO=5]="INFO"}(d||(d={}));var _;!function(e){e[e.HEADER=0]="HEADER",e[e.NALU=1]="NALU",e[e.END=2]="END"}(_||(_={}));var g,y=8,v=9,m=50,E=!0;!function(e){e[e.CAN_GENERATE_HEADER=0]="CAN_GENERATE_HEADER",e[e.NEED_HEADER_DATA=1]="NEED_HEADER_DATA",e[e.MAIN_PACKETS=2]="MAIN_PACKETS"}(g||(g={}));var b=function(){function o(e){var t=this;this.oncodecinfo=function(e){},this.ondata=function(e){throw new Error("MP4Mux.ondata is not set")},this.metadata=e,this.trackStates=this.metadata.tracks.map(function(e,r){var n={trackId:r+1,trackInfo:e,cachedDuration:0,samplesProcessed:0,initializationData:[]};return t.metadata.audioTrackId===r&&(t.audioTrackState=n),t.metadata.videoTrackId===r&&(t.videoTrackState=n),n},this),this._checkIfNeedHeaderData(),this.filePos=0,this.cachedPackets=[],this.chunkIndex=0}return o.prototype.pushPacket=function(e,t,o){switch(this.state===g.CAN_GENERATE_HEADER&&this._tryGenerateHeader(),e){case y:var i=this.audioTrackState,s=r(t);if(!i||i.trackInfo.codecId!==s.codecId)throw new Error("Unexpected audio packet codec: "+s.codecDescription);switch(s.codecId){default:throw new Error("Unsupported audio codec: "+s.codecDescription);case l:break;case c:if(s.packetType===a.HEADER)return void i.initializationData.push(s.data)}this.cachedPackets.push({packet:s,timestamp:o,trackId:i.trackId});break;case v:var u=this.videoTrackState,d=n(t);if(!u||u.trackInfo.codecId!==d.codecId)throw new Error("Unexpected video packet codec: "+d.codecDescription);switch(d.codecId){default:throw new Error("unsupported video codec: "+d.codecDescription);case f:break;case h:if(d.packetType===_.HEADER)return void u.initializationData.push(d.data)}this.cachedPackets.push({packet:d,timestamp:o,trackId:u.trackId});break;default:throw new Error("unknown packet type: "+e)}this.state===g.NEED_HEADER_DATA&&this._tryGenerateHeader(),this.cachedPackets.length>=m&&this.state===g.MAIN_PACKETS&&this._chunk()},o.prototype.flush=function(){this.cachedPackets.length>0&&this._chunk()},o.prototype._checkIfNeedHeaderData=function(){this.trackStates.some(function(e){return e.trackInfo.codecId===c||e.trackInfo.codecId===h})?this.state=g.NEED_HEADER_DATA:this.state=g.CAN_GENERATE_HEADER},o.prototype._tryGenerateHeader=function(){var r=this.trackStates.every(function(e){switch(e.trackInfo.codecId){case c:case h:return e.initializationData.length>0;default:return!0}});if(r){for(var n=["isom"],o=1,i=1,a=[],s=0;s>3;d.mimeTypeCodec="mp4a.40."+v;break;case l:u=new e.Iso.AudioSampleEntry(".mp3",o,p.channels,p.samplesize,p.samplerate),d.mimeTypeCodec="mp3";break;case h:var m=d.initializationData[0];u=new e.Iso.VideoSampleEntry("avc1",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("avcC",m)];var E=m[1]<<16|m[2]<<8|m[3];d.mimeTypeCodec="avc1."+(16777216|E).toString(16).substr(1),n.push("iso2","avc1","mp41");break;case f:u=new e.Iso.VideoSampleEntry("VP6F",i,p.width,p.height),u.otherBoxes=[new e.Iso.RawTag("glbl",t("00"))],d.mimeTypeCodec="avc1.42001E";break;default:throw new Error("not supported track type")}var b,w=e.Iso.TrackHeaderFlags.TRACK_ENABLED|e.Iso.TrackHeaderFlags.TRACK_IN_MOVIE;d===this.audioTrackState?b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,0,0,1,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("soun","SoundHandler"),new e.Iso.MediaInformationBox(new e.Iso.SoundMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000")))))):d===this.videoTrackState&&(b=new e.Iso.TrackBox(new e.Iso.TrackHeaderBox(w,d.trackId,-1,p.width,p.height,0,s),new e.Iso.MediaBox(new e.Iso.MediaHeaderBox(p.timescale,-1,p.language),new e.Iso.HandlerBox("vide","VideoHandler"),new e.Iso.MediaInformationBox(new e.Iso.VideoMediaHeaderBox,new e.Iso.DataInformationBox(new e.Iso.DataReferenceBox([new e.Iso.DataEntryUrlBox(e.Iso.SELF_CONTAINED_DATA_REFERENCE_FLAG)])),new e.Iso.SampleTableBox(new e.Iso.SampleDescriptionBox([u]),new e.Iso.RawTag("stts",t("0000000000000000")),new e.Iso.RawTag("stsc",t("0000000000000000")),new e.Iso.RawTag("stsz",t("000000000000000000000000")),new e.Iso.RawTag("stco",t("0000000000000000"))))))),a.push(b)}var S=new e.Iso.MovieExtendsBox(null,[new e.Iso.TrackExtendsBox(1,1,0,0,0),new e.Iso.TrackExtendsBox(2,1,0,0,0)],null),P=new e.Iso.BoxContainerBox("udat",[new e.Iso.MetaBox(new e.Iso.RawTag("hdlr",t("00000000000000006D6469726170706C000000000000000000")),[new e.Iso.RawTag("ilst",t("00000025A9746F6F0000001D6461746100000001000000004C61766635342E36332E313034"))])]),R=new e.Iso.MovieHeaderBox(1e3,0,this.trackStates.length+1),O=new e.Iso.MovieBox(R,a,S,P),A=new e.Iso.FileTypeBox("isom",512,n),T=A.layout(0),M=O.layout(T),x=new Uint8Array(T+M);A.write(x),O.write(x),this.oncodecinfo(this.trackStates.map(function(e){return e.mimeTypeCodec})),this.ondata(x),this.filePos+=x.length,this.state=g.MAIN_PACKETS}},o.prototype._chunk=function(){var t=this.cachedPackets;if(E&&this.videoTrackState){for(var r=t.length-1,n=this.videoTrackState.trackId;r>0&&(t[r].trackId!==n||t[r].packet.frameType!==d.KEY);)r--;r>0&&(t=t.slice(0,r))}if(0!==t.length){for(var o=[],i=0,a=[],s=[],u=0;u>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255, +e[t+3]=255&r}function n(e){return e.charCodeAt(0)<<24|e.charCodeAt(1)<<16|e.charCodeAt(2)<<8|e.charCodeAt(3)}function a(e){return(e-p)/1e3|0}function s(e){return 65536*e|0}function u(e){return 1073741824*e|0}function l(e){return 256*e|0}function c(e){return(31&e.charCodeAt(0))<<10|(31&e.charCodeAt(1))<<5|31&e.charCodeAt(2)}var d=o.StringUtilities.utf8decode,p=-20828448e5,f=[1,0,0,0,1,0,0,0,1],h=[0,0,0],_=function(){function e(e,t){this.boxtype=e,"uuid"===e&&(this.userType=t)}return e.prototype.layout=function(e){this.offset=e;var t=8;return this.userType&&(t+=16),this.size=t,t},e.prototype.write=function(e){return r(e,this.offset,this.size),r(e,this.offset+4,n(this.boxtype)),this.userType?(e.set(this.userType,this.offset+8),24):8},e.prototype.toUint8Array=function(){var e=this.layout(0),t=new Uint8Array(e);return this.write(t),t},e}();e.Box=_;var g=function(e){function t(t,r,n){void 0===r&&(r=0),void 0===n&&(n=0);var o=e.call(this,t)||this;return o.version=r,o.flags=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.version<<24|this.flags),n+4},t}(_);e.FullBox=g;var y=function(e){function t(t,r,n){var o=e.call(this,"ftype")||this;return o.majorBrand=t,o.minorVersion=r,o.compatibleBrands=n,o}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4*(2+this.compatibleBrands.length),this.size},t.prototype.write=function(t){var o=this,i=e.prototype.write.call(this,t);return r(t,this.offset+i,n(this.majorBrand)),r(t,this.offset+i+4,this.minorVersion),i+=8,this.compatibleBrands.forEach(function(e){r(t,o.offset+i,n(e)),i+=4},this),i},t}(_);e.FileTypeBox=y;var v=function(e){function t(t,r){var n=e.call(this,t)||this;return n.children=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return this.children.forEach(function(e){e&&(r+=e.layout(t+r))}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return this.children.forEach(function(e){e&&(r+=e.write(t))}),r},t}(_);e.BoxContainerBox=v;var m=function(e){function r(r,n,o,i){var a=e.call(this,"moov",t([r],n,[o,i]))||this;return a.header=r,a.tracks=n,a.extendsBox=o,a.userData=i,a}return i(r,e),r}(v);e.MovieBox=m;var E=function(e){function t(t,r,n,o,i,a,s,u){void 0===o&&(o=1),void 0===i&&(i=1),void 0===a&&(a=f),void 0===s&&(s=p),void 0===u&&(u=p);var l=e.call(this,"mvhd",0,0)||this;return l.timescale=t,l.duration=r,l.nextTrackId=n,l.rate=o,l.volume=i,l.matrix=a,l.creationTime=s,l.modificationTime=u,l}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4+2+2+8+36+24+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),n+=16,r(t,this.offset+n,s(this.rate)),r(t,this.offset+n+4,l(this.volume)<<16),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,0),r(t,this.offset+n+12,0),r(t,this.offset+n+16,0),r(t,this.offset+n+20,0),n+=24,r(t,this.offset+n,this.nextTrackId),n+=4},t}(g);e.MovieHeaderBox=E;var b;!function(e){e[e.TRACK_ENABLED=1]="TRACK_ENABLED",e[e.TRACK_IN_MOVIE=2]="TRACK_IN_MOVIE",e[e.TRACK_IN_PREVIEW=4]="TRACK_IN_PREVIEW"}(b=e.TrackHeaderFlags||(e.TrackHeaderFlags={}));var w=function(e){function t(t,r,n,o,i,a,s,u,l,c,d){void 0===s&&(s=0),void 0===u&&(u=0),void 0===l&&(l=f),void 0===c&&(c=p),void 0===d&&(d=p);var h=e.call(this,"tkhd",0,t)||this;return h.trackId=r,h.duration=n,h.width=o,h.height=i,h.volume=a,h.alternateGroup=s,h.layer=u,h.matrix=l,h.creationTime=c,h.modificationTime=d,h}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20+8+6+2+36+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.trackId),r(t,this.offset+n+12,0),r(t,this.offset+n+16,this.duration),n+=20,r(t,this.offset+n,0),r(t,this.offset+n+4,0),r(t,this.offset+n+8,this.layer<<16|this.alternateGroup),r(t,this.offset+n+12,l(this.volume)<<16),n+=16,r(t,this.offset+n,s(this.matrix[0])),r(t,this.offset+n+4,s(this.matrix[1])),r(t,this.offset+n+8,s(this.matrix[2])),r(t,this.offset+n+12,s(this.matrix[3])),r(t,this.offset+n+16,s(this.matrix[4])),r(t,this.offset+n+20,s(this.matrix[5])),r(t,this.offset+n+24,u(this.matrix[6])),r(t,this.offset+n+28,u(this.matrix[7])),r(t,this.offset+n+32,u(this.matrix[8])),n+=36,r(t,this.offset+n,s(this.width)),r(t,this.offset+n+4,s(this.height)),n+=8},t}(g);e.TrackHeaderBox=w;var S=function(e){function t(t,r,n,o,i){void 0===n&&(n="unk"),void 0===o&&(o=p),void 0===i&&(i=p);var a=e.call(this,"mdhd",0,0)||this;return a.timescale=t,a.duration=r,a.language=n,a.creationTime=o,a.modificationTime=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+16+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,a(this.creationTime)),r(t,this.offset+n+4,a(this.modificationTime)),r(t,this.offset+n+8,this.timescale),r(t,this.offset+n+12,this.duration),r(t,this.offset+n+16,c(this.language)<<16),n+20},t}(g);e.MediaHeaderBox=S;var P=function(e){function t(t,r){var n=e.call(this,"hdlr",0,0)||this;return n.handlerType=t,n.name=r,n._encodedName=d(n.name),n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8+12+(this._encodedName.length+1),this.size},t.prototype.write=function(t){var o=e.prototype.write.call(this,t);return r(t,this.offset+o,0),r(t,this.offset+o+4,n(this.handlerType)),r(t,this.offset+o+8,0),r(t,this.offset+o+12,0),r(t,this.offset+o+16,0),o+=20,t.set(this._encodedName,this.offset+o),t[this.offset+o+this._encodedName.length]=0,o+=this._encodedName.length+1},t}(g);e.HandlerBox=P;var R=function(e){function t(t){void 0===t&&(t=0);var r=e.call(this,"smhd",0,0)||this;return r.balance=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,l(this.balance)<<16),n+4},t}(g);e.SoundMediaHeaderBox=R;var O=function(e){function t(t,r){void 0===t&&(t=0),void 0===r&&(r=h);var n=e.call(this,"vmhd",0,0)||this;return n.graphicsMode=t,n.opColor=r,n}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+8,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.graphicsMode<<16|this.opColor[0]),r(t,this.offset+n+4,this.opColor[1]<<16|this.opColor[2]),n+8},t}(g);e.VideoMediaHeaderBox=O,e.SELF_CONTAINED_DATA_REFERENCE_FLAG=1;var A=function(t){function r(r,n){void 0===n&&(n=null);var o=t.call(this,"url ",0,r)||this;return o.location=n,r&e.SELF_CONTAINED_DATA_REFERENCE_FLAG||(o._encodedLocation=d(n)),o}return i(r,t),r.prototype.layout=function(e){var r=t.prototype.layout.call(this,e);return this._encodedLocation&&(r+=this._encodedLocation.length+1),this.size=r},r.prototype.write=function(e){var r=t.prototype.write.call(this,e);return this._encodedLocation&&(e.set(this._encodedLocation,this.offset+r),e[this.offset+r+this._encodedLocation.length]=0,r+=this._encodedLocation.length),r},r}(g);e.DataEntryUrlBox=A;var T=function(e){function t(t){var r=e.call(this,"dref",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4;return this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.DataReferenceBox=T;var M=function(e){function t(t){var r=e.call(this,"dinf",[t])||this;return r.dataReference=t,r}return i(t,e),t}(v);e.DataInformationBox=M;var x=function(e){function t(t){var r=e.call(this,"stsd",0,0)||this;return r.entries=t,r}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=4,this.entries.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.entries.length),n+=4,this.entries.forEach(function(e){n+=e.write(t)}),n},t}(g);e.SampleDescriptionBox=x;var D=function(e){function t(t,r,n,o,i){var a=e.call(this,"stbl",[t,r,n,o,i])||this;return a.sampleDescriptions=t,a.timeToSample=r,a.sampleToChunk=n,a.sampleSizes=o,a.chunkOffset=i,a}return i(t,e),t}(v);e.SampleTableBox=D;var I=function(e){function t(t,r,n){var o=e.call(this,"minf",[t,r,n])||this;return o.header=t,o.info=r,o.sampleTable=n,o}return i(t,e),t}(v);e.MediaInformationBox=I;var k=function(e){function t(t,r,n){var o=e.call(this,"mdia",[t,r,n])||this;return o.header=t,o.handler=r,o.info=n,o}return i(t,e),t}(v);e.MediaBox=k;var C=function(e){function t(t,r){var n=e.call(this,"trak",[t,r])||this;return n.header=t,n.media=r,n}return i(t,e),t}(v);e.TrackBox=C;var N=function(e){function t(t,r,n,o,i){var a=e.call(this,"trex",0,0)||this;return a.trackId=t,a.defaultSampleDescriptionIndex=r,a.defaultSampleDuration=n,a.defaultSampleSize=o,a.defaultSampleFlags=i,a}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+20,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.trackId),r(t,this.offset+n+4,this.defaultSampleDescriptionIndex),r(t,this.offset+n+8,this.defaultSampleDuration),r(t,this.offset+n+12,this.defaultSampleSize),r(t,this.offset+n+16,this.defaultSampleFlags),n+20},t}(g);e.TrackExtendsBox=N;var L=function(e){function r(r,n,o){var i=e.call(this,"mvex",t([r],n,[o]))||this;return i.header=r,i.tracDefaults=n,i.levels=o,i}return i(r,e),r}(v);e.MovieExtendsBox=L;var j=function(e){function t(t,r){var n=e.call(this,"meta",0,0)||this;return n.handler=t,n.otherBoxes=r,n}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t);return r+=this.handler.layout(t+r),this.otherBoxes.forEach(function(e){r+=e.layout(t+r)}),this.size=r},t.prototype.write=function(t){var r=e.prototype.write.call(this,t);return r+=this.handler.write(t),this.otherBoxes.forEach(function(e){r+=e.write(t)}),r},t}(g);e.MetaBox=j;var F=function(e){function t(t){var r=e.call(this,"mfhd",0,0)||this;return r.sequenceNumber=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.sequenceNumber),n+4},t}(g);e.MovieFragmentHeaderBox=F;var U;!function(e){e[e.BASE_DATA_OFFSET_PRESENT=1]="BASE_DATA_OFFSET_PRESENT",e[e.SAMPLE_DESCRIPTION_INDEX_PRESENT=2]="SAMPLE_DESCRIPTION_INDEX_PRESENT",e[e.DEFAULT_SAMPLE_DURATION_PRESENT=8]="DEFAULT_SAMPLE_DURATION_PRESENT",e[e.DEFAULT_SAMPLE_SIZE_PRESENT=16]="DEFAULT_SAMPLE_SIZE_PRESENT",e[e.DEFAULT_SAMPLE_FLAGS_PRESENT=32]="DEFAULT_SAMPLE_FLAGS_PRESENT"}(U=e.TrackFragmentFlags||(e.TrackFragmentFlags={}));var B=function(e){function t(t,r,n,o,i,a,s){var u=e.call(this,"tfhd",0,t)||this;return u.trackId=r,u.baseDataOffset=n,u.sampleDescriptionIndex=o,u.defaultSampleDuration=i,u.defaultSampleSize=a,u.defaultSampleFlags=s,u}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.flags;return n&U.BASE_DATA_OFFSET_PRESENT&&(r+=8),n&U.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r+=4),n&U.DEFAULT_SAMPLE_DURATION_PRESENT&&(r+=4),n&U.DEFAULT_SAMPLE_SIZE_PRESENT&&(r+=4),n&U.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r+=4),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.flags;return r(t,this.offset+n,this.trackId),n+=4,o&U.BASE_DATA_OFFSET_PRESENT&&(r(t,this.offset+n,0),r(t,this.offset+n+4,this.baseDataOffset),n+=8),o&U.SAMPLE_DESCRIPTION_INDEX_PRESENT&&(r(t,this.offset+n,this.sampleDescriptionIndex),n+=4),o&U.DEFAULT_SAMPLE_DURATION_PRESENT&&(r(t,this.offset+n,this.defaultSampleDuration),n+=4),o&U.DEFAULT_SAMPLE_SIZE_PRESENT&&(r(t,this.offset+n,this.defaultSampleSize),n+=4),o&U.DEFAULT_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.defaultSampleFlags),n+=4),n},t}(g);e.TrackFragmentHeaderBox=B;var q=function(e){function t(t){var r=e.call(this,"tfdt",0,0)||this;return r.baseMediaDecodeTime=t,r}return i(t,e),t.prototype.layout=function(t){return this.size=e.prototype.layout.call(this,t)+4,this.size},t.prototype.write=function(t){var n=e.prototype.write.call(this,t);return r(t,this.offset+n,this.baseMediaDecodeTime),n+4},t}(g);e.TrackFragmentBaseMediaDecodeTimeBox=q;var H=function(e){function t(t,r,n){var o=e.call(this,"traf",[t,r,n])||this;return o.header=t,o.decodeTime=r,o.run=n,o}return i(t,e),t}(v);e.TrackFragmentBox=H;var z;!function(e){e[e.IS_LEADING_MASK=201326592]="IS_LEADING_MASK",e[e.SAMPLE_DEPENDS_ON_MASK=50331648]="SAMPLE_DEPENDS_ON_MASK",e[e.SAMPLE_DEPENDS_ON_OTHER=16777216]="SAMPLE_DEPENDS_ON_OTHER",e[e.SAMPLE_DEPENDS_ON_NO_OTHERS=33554432]="SAMPLE_DEPENDS_ON_NO_OTHERS",e[e.SAMPLE_IS_DEPENDED_ON_MASK=12582912]="SAMPLE_IS_DEPENDED_ON_MASK",e[e.SAMPLE_HAS_REDUNDANCY_MASK=3145728]="SAMPLE_HAS_REDUNDANCY_MASK",e[e.SAMPLE_PADDING_VALUE_MASK=917504]="SAMPLE_PADDING_VALUE_MASK",e[e.SAMPLE_IS_NOT_SYNC=65536]="SAMPLE_IS_NOT_SYNC",e[e.SAMPLE_DEGRADATION_PRIORITY_MASK=65535]="SAMPLE_DEGRADATION_PRIORITY_MASK"}(z=e.SampleFlags||(e.SampleFlags={}));var G;!function(e){e[e.DATA_OFFSET_PRESENT=1]="DATA_OFFSET_PRESENT",e[e.FIRST_SAMPLE_FLAGS_PRESENT=4]="FIRST_SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_DURATION_PRESENT=256]="SAMPLE_DURATION_PRESENT",e[e.SAMPLE_SIZE_PRESENT=512]="SAMPLE_SIZE_PRESENT",e[e.SAMPLE_FLAGS_PRESENT=1024]="SAMPLE_FLAGS_PRESENT",e[e.SAMPLE_COMPOSITION_TIME_OFFSET=2048]="SAMPLE_COMPOSITION_TIME_OFFSET"}(G=e.TrackRunFlags||(e.TrackRunFlags={}));var V=function(e){function t(t,r,n,o){var i=e.call(this,"trun",1,t)||this;return i.samples=r,i.dataOffset=n,i.firstSampleFlags=o,i}return i(t,e),t.prototype.layout=function(t){var r=e.prototype.layout.call(this,t)+4,n=this.samples.length,o=this.flags;return o&G.DATA_OFFSET_PRESENT&&(r+=4),o&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r+=4),o&G.SAMPLE_DURATION_PRESENT&&(r+=4*n),o&G.SAMPLE_SIZE_PRESENT&&(r+=4*n),o&G.SAMPLE_FLAGS_PRESENT&&(r+=4*n),o&G.SAMPLE_COMPOSITION_TIME_OFFSET&&(r+=4*n),this.size=r},t.prototype.write=function(t){var n=e.prototype.write.call(this,t),o=this.samples.length,i=this.flags;r(t,this.offset+n,o),n+=4,i&G.DATA_OFFSET_PRESENT&&(r(t,this.offset+n,this.dataOffset),n+=4),i&G.FIRST_SAMPLE_FLAGS_PRESENT&&(r(t,this.offset+n,this.firstSampleFlags),n+=4);for(var a=0;a31)throw new Error("invalid compressor name");return p}return i(n,t),n.prototype.layout=function(e){var r=t.prototype.layout.call(this,e)+16+12+4+2+32+2+2;return this.otherBoxes&&this.otherBoxes.forEach(function(t){r+=t.layout(e+r)}),this.size=r},n.prototype.write=function(e){var n=t.prototype.write.call(this,e);r(e,this.offset+n,0),r(e,this.offset+n+4,0),r(e,this.offset+n+8,0),r(e,this.offset+n+12,0),n+=16,r(e,this.offset+n,this.width<<16|this.height),r(e,this.offset+n+4,s(this.horizResolution)),r(e,this.offset+n+8,s(this.vertResolution)),n+=12,r(e,this.offset+n,0),r(e,this.offset+n+4,this.frameCount<<16),n+=6,e[this.offset+n]=this.compressorName.length;for(var o=0;o<31;o++)e[this.offset+n+o+1]=o-2&&i.setOutputGain(g[0],-2),u=[g[0],g[1]],g=g.slice(2)}if(g.length&&u){s.push.apply(s,g);var v=i.buildWebm(u.concat(g));d||(d=v.initData),a.dispatch({initData:d,data:v.data})}}catch(e){t(e)}}}),e.onCompletion(function(e){l.byteLength?r.reject(new Error("Still data left in buffer.")):r.resolve(e)}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:a,getProgressSoFar:function(){if(s.length&&u){var e=i.buildWebm(u.concat(s)).data;return{initData:d,data:e}}return null}},abort:function(){p=!0,e.abort()}}});return t.run()}}},function(e,t){e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.MP4ToMP4={getInputFormat:function(){return{mimeType:"audio/mp4"}},getOutputFormat:function(){return{mimeType:"audio/mp4"}},transmux:function(e){var t=new n.helpers.abortableJob.AbortableJob(function(){function t(t){r.reject(t),e.abort()}var r=n.helpers.deferred.buildDeferred(),o=new n.eventDispatcher.EventDispatcher,i=[],a=[],s=new Uint8Array(0),u=null,l=!1,c=function(e){if(e.byteLength<4)return void(s=e);if(null===u){var t=new DataView(e.buffer).getUint32(0);if(1===t)throw new Error("Large atom size not supported.");u=t}if(0!==u&&e.byteLength>=u){var r=new Uint8Array(e.buffer.slice(0,u));a.push(r),s=new Uint8Array(e.buffer.slice(u)),u=null,c(s)}else s=e};return e.onProgressUpdate(function(e){var r=e.data;!l&&e.initData&&(r=n.helpers.arrayBuffer.combine([e.initData,e.data])),l=!0;try{var u=n.helpers.arrayBuffer.combine([s,r]);if(c(u),a.length){var d=n.helpers.arrayBuffer.combine(a);a.splice(0),i.push(d),o.dispatch({data:d})}}catch(e){t(e)}}),e.onCompletion(function(e){try{if(0===u)i.push(s),o.dispatch({data:s});else if(s.byteLength)throw new Error("Part way through an atom.");r.resolve(e)}catch(e){t(e)}}),e.onError(t),{result:r.promise,progressUpdates:{onProgressUpdate:o,getProgressSoFar:function(){return i.length?{data:n.helpers.arrayBuffer.combine(i)}:null}},abort:function(){e.abort()}}});return t.run()}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(10),i=r(37),a=r(5),s=r(1),u=r(6),l=r(9),c=r(38);!function(e){e.NoDecryptorError=o.NoDecryptorError,e.PlaylistParseError=i.PlaylistParseError,e.OggParserError=a.OggParserError,e.Mp3TransmuxerRetrievalError=u.Mp3TransmuxerRetrievalError,e.RetrievalError=s.RetrievalError,e.UnacceptableResponseStatusCodeError=l.UnacceptableResponseStatusCodeError,e.UnsupportedEncryptionError=c.UnsupportedEncryptionError}(n=t.retrievalErrors||(t.retrievalErrors={}))},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(t){var r=e.call(this)||this;return r._details=t,r}return n(t,e),t.prototype.getDetails=function(){return this._details},t.prototype.getCode=function(){return"PLAYLIST_PARSE"},t}(o.RetrievalError);t.PlaylistParseError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.getCode=function(){return"UNSUPPORTED_ENCRYPTION_ERROR"},t}(o.RetrievalError);t.UnsupportedEncryptionError=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n,o=r(40),i=r(41),a=r(42),s=r(8);!function(e){e.InitData=o.InitData,e.Key=i.Key,e.Playlist=a.Playlist,e.Segment=s.Segment}(n=t.events||(t.events={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.InitData=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){this._playlist=e,this._url=t}return e.prototype.getPlaylist=function(){return this._playlist},e.prototype.getUrl=function(){return this._url},e}();t.Key=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._url=e}return e.prototype.getUrl=function(){return this._url},e}();t.Playlist=n}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=8)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e){this._msg=e}return e.prototype.getMsg=function(){return this._msg},e}();t.OggParserError=n},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.ChecksumFailedError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageFromDifferentBitstreamError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.PageSequenceNumberDidNotIncrementError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedBOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.UnexpectedEOSError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.NoSegmentsInPageError=i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(o.OggParserError);t.IncompletePageError=i},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905,n(r(9));var o=r(0);t.OggParserError=o.OggParserError;var i=r(1);t.ChecksumFailedError=i.ChecksumFailedError;var a=r(6);t.NoSegmentsInPageError=a.NoSegmentsInPageError;var s=r(2);t.PageFromDifferentBitstreamError=s.PageFromDifferentBitstreamError;var u=r(3);t.PageSequenceNumberDidNotIncrementError=u.PageSequenceNumberDidNotIncrementError;var l=r(4);t.UnexpectedBOSError=l.UnexpectedBOSError;var c=r(5);t.UnexpectedEOSError=c.UnexpectedEOSError;var d=r(7);t.IncompletePageError=d.IncompletePageError},function(e,t,r){"use strict";function n(e,t,r){if(void 0===r&&(r=1),t<0||t+r>e.byteLength)throw new Error("extract() out of bounds. "+t+" "+r+" "+e.byteLength);return e.slice(t,t+r)}function o(e,t){return void 0===t&&(t=!0),new DataView(e).getUint32(0,t)}function i(e){for(var t=e.buffer,r=[],n=e.byteOffset,o=!0;n0)throw new f.UnexpectedBOSError("Got BOS on a page which is not the first.");var v=!!(4&c);if(v&&s!==e.length-1)throw new h.UnexpectedEOSError("Got EOS on a page which is not the last.");var m=0;l&&(n=null);var E=a.segments.length;a.segments.forEach(function(e,t){if(n?n.data=y([n.data,e]):_&&0===t||(n={granulePosition:null,pageSequenceNumber:r,packetOffset:m,discontinuity:l&&0===m,first:g&&0===m,last:!1,data:e},m++),n&&e.byteLength<255){var s=t===E-1;s&&(n.granulePosition=o(a.header.granulePosition.buffer)),n.last=v&&s,i.push(n),n=null}})}),i}Object.defineProperty(t,"__esModule",{value:!0});var u=r(10),l=r(11),c=r(1),d=r(2),p=r(3),f=r(4),h=r(5),_=r(6),g=r(7),y=u.helpers.arrayBuffer.combine,v=new Uint8Array([79,103,103,83]),m=new Uint8Array([0,0,0,0]),E=27;t.retrievePages=i,t.parsePage=a,t.retrievePackets=s},function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){var t=0;return e.forEach(function(e){for(var r=0;r>24&255^e[r]]}),t>>>0}Object.defineProperty(t,"__esModule",{value:!0});var o=new Uint32Array([0,79764919,159529838,222504665,319059676,398814059,445009330,507990021,638119352,583659535,797628118,726387553,890018660,835552979,1015980042,944750013,1276238704,1221641927,1167319070,1095957929,1595256236,1540665371,1452775106,1381403509,1780037320,1859660671,1671105958,1733955601,2031960084,2111593891,1889500026,1952343757,2552477408,2632100695,2443283854,2506133561,2334638140,2414271883,2191915858,2254759653,3190512472,3135915759,3081330742,3009969537,2905550212,2850959411,2762807018,2691435357,3560074640,3505614887,3719321342,3648080713,3342211916,3287746299,3467911202,3396681109,4063920168,4143685023,4223187782,4286162673,3779000052,3858754371,3904687514,3967668269,881225847,809987520,1023691545,969234094,662832811,591600412,771767749,717299826,311336399,374308984,453813921,533576470,25881363,88864420,134795389,214552010,2023205639,2086057648,1897238633,1976864222,1804852699,1867694188,1645340341,1724971778,1587496639,1516133128,1461550545,1406951526,1302016099,1230646740,1142491917,1087903418,2896545431,2825181984,2770861561,2716262478,3215044683,3143675388,3055782693,3001194130,2326604591,2389456536,2200899649,2280525302,2578013683,2640855108,2418763421,2498394922,3769900519,3832873040,3912640137,3992402750,4088425275,4151408268,4197601365,4277358050,3334271071,3263032808,3476998961,3422541446,3585640067,3514407732,3694837229,3640369242,1762451694,1842216281,1619975040,1682949687,2047383090,2127137669,1938468188,2001449195,1325665622,1271206113,1183200824,1111960463,1543535498,1489069629,1434599652,1363369299,622672798,568075817,748617968,677256519,907627842,853037301,1067152940,995781531,51762726,131386257,177728840,240578815,269590778,349224269,429104020,491947555,4046411278,4126034873,4172115296,4234965207,3794477266,3874110821,3953728444,4016571915,3609705398,3555108353,3735388376,3664026991,3290680682,3236090077,3449943556,3378572211,3174993278,3120533705,3032266256,2961025959,2923101090,2868635157,2813903052,2742672763,2604032198,2683796849,2461293480,2524268063,2284983834,2364738477,2175806836,2238787779,1569362073,1498123566,1409854455,1355396672,1317987909,1246755826,1192025387,1137557660,2072149281,2135122070,1912620623,1992383480,1753615357,1816598090,1627664531,1707420964,295390185,358241886,404320391,483945776,43990325,106832002,186451547,266083308,932423249,861060070,1041341759,986742920,613929101,542559546,756411363,701822548,3316196985,3244833742,3425377559,3370778784,3601682597,3530312978,3744426955,3689838204,3819031489,3881883254,3928223919,4007849240,4037393693,4100235434,4180117107,4259748804,2310601993,2373574846,2151335527,2231098320,2596047829,2659030626,2470359227,2550115596,2947551409,2876312838,2788305887,2733848168,3165939309,3094707162,3040238851,2985771188]);t.calculateCRC=n}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(t,r){t.exports=e},function(e,t,r){"use strict";function n(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905,n(r(2))},function(e,t,r){"use strict";function n(e){var t=3&e[0];return 0===t?1:3!==t?2:63&e[1]}function o(e){var t=e[0]>>>3&31;if(t>=f.length)throw new Error("Invalid configuration.");return f[t]}function i(e){if(!e.first)throw new Error("OpusHead is always in the first packet.");var t=e.data,r=new DataView(t.buffer),n=r.getUint8(9),o=r.getUint8(18),i=void 0,a=void 0,s=void 0;if(o>0){i=r.getUint8(18),a=r.getUint8(19),s=[];for(var u=0;u=128||t<-128)throw new Error("outputGainOverride invalid. It must be >= -128 and < 128.");i(e),new DataView(e.data.buffer).setInt16(16,Math.round(t*Math.pow(2,8)),!0)}function s(e){var t=e[0];if(!t||!t.first)throw new Error("Missing start of stream.");var r=e.slice(2),a=i(t),s=0,u=r.map(function(e){var t=new Uint8Array(4);t[0]=129,new DataView(t.buffer).setInt16(1,s),t[3]=128;var r=n(e.data);return s+=r*o(e.data),l.encodeElement(l.IDS.SimpleBlock,d([t,e.data]))}),c=d([l.encodeElement(l.IDS.EBML,function(){return d([l.encodeElement(l.IDS.EBMLVersion,p(1)),l.encodeElement(l.IDS.EBMLReadVersion,p(1)),l.encodeElement(l.IDS.EBMLMaxIDLength,p(4)),l.encodeElement(l.IDS.EBMLMaxSizeLength,p(8)),l.encodeElement(l.IDS.DocType,new Uint8Array([119,101,98,109])),l.encodeElement(l.IDS.DocTypeVersion,p(1)),l.encodeElement(l.IDS.DocTypeReadVersion,p(2))])}()),l.encodeElement(l.IDS.Segment,function(){return l.encodeElement(l.IDS.Info,function(){return l.encodeElement(l.IDS.Duration,function(){var e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,s),e}())}())}()),l.encodeElement(l.IDS.Tracks,function(){return l.encodeElement(l.IDS.TrackEntry,function(){return d([l.encodeElement(l.IDS.TrackNumber,p(1)),l.encodeElement(l.IDS.TrackUID,p(1)),l.encodeElement(l.IDS.FlagLacing,p(0)),l.encodeElement(l.IDS.CodecID,new Uint8Array([65,95,79,80,85,83])),l.encodeElement(l.IDS.CodecDelay,p(a.preSkip/48e3*1e9)),l.encodeElement(l.IDS.SeekPreRoll,new Uint8Array([4,196,180,0])),l.encodeElement(l.IDS.TrackType,p(2)),l.encodeElement(l.IDS.Audio,function(){return d([l.encodeElement(l.IDS.Channels,p(a.channelCount)),l.encodeElement(l.IDS.SamplingFrequency,new Uint8Array([64,231,112,0,0,0,0,0]))])}()),l.encodeElement(l.IDS.CodecPrivate,t.data)])}())}())]),f=l.encodeElement(l.IDS.Cluster,function(){var e=[l.encodeElement(l.IDS.Timecode,p(0))];return e.push.apply(e,u),d(e)}());return{initData:c,data:f}}Object.defineProperty(t,"__esModule",{value:!0});var u=r(0),l=r(3),c=u.helpers.arrayBuffer,d=c.combine,p=c.numberToUint8Array,f=[10,20,40,60,10,20,40,60,10,20,40,60,10,20,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20,2.5,5,10,20];t.parseOpusHead=i,t.setOutputGain=a,t.buildWebm=s},function(e,t,r){"use strict";function n(e,t){var r=s(e),n=u(t.byteLength);return a([r,n,t])}Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.arrayBuffer,a=i.combine,s=i.numberToUint8Array,u=i.createVintBuffer;t.IDS={EBML:440786851,EBMLVersion:17030,EBMLReadVersion:17143,EBMLMaxIDLength:17138,EBMLMaxSizeLength:17139,DocType:17026,DocTypeVersion:17031,DocTypeReadVersion:17029,Segment:408125543,Info:357149030,Duration:17545,Tracks:374648427,TrackEntry:174,TrackNumber:215,TrackUID:29637,FlagLacing:156,CodecID:134,CodecDelay:22186,SeekPreRoll:22203,TrackType:131,Audio:225,Channels:159,SamplingFrequency:181,CodecPrivate:25506,Cluster:524531317,Timecode:231,SimpleBlock:163},t.encodeElement=n}])})},function(e,t,r){!function(t,n){e.exports=n(r(2))}(window,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(t,r){t.exports=e},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=function(e){function t(t,r,n){void 0===r&&(r={}),void 0===n&&(n=2e4);var o=e.call(this)||this;if(o._responseStarted=!1,n<0)throw new Error("Invaid timeout.");o._timeoutTimer=window.setTimeout(function(){return o._onManualTimeout()},n),o._xhr=new XMLHttpRequest,o._xhr.addEventListener("load",function(){return o._onLoad()}),o._xhr.addEventListener("abort",function(){return o._onAbort()}),o._xhr.addEventListener("error",function(e){return o._onError(e)}),o._xhr.addEventListener("timeout",function(){return o._onTimeout()}),o._xhr.addEventListener("loadend",function(){return o._onLoadEnd()}),o._xhr.addEventListener("progress",function(){return o._onProgress()}),o._xhr.open("GET",t,!0),o._xhr.timeout=n;var i=o._getResponseType().some(function(e){return o._xhr.responseType=e,o._xhr.responseType===e});if(!i)throw new Error("Failed setting response type.");return Object.keys(r).forEach(function(e){return o._xhr.setRequestHeader(e,r[e])}),o._signalRequestStart(),o._xhr.send(),o}return n(t,e),t.prototype._abort=function(){this._xhr.abort()},t.prototype._onAbort=function(){this.hasCompleted()||this._onTimeout()},t.prototype._onManualTimeout=function(){this.hasCompleted()||(this._signalTimeout(),this._xhr.abort())},t.prototype._onTimeout=function(){this.hasCompleted()||this._signalTimeout()},t.prototype._onLoad=function(){if(!this.hasCompleted()){if(!this._isChunkedResponse()){var e=this._xhr;this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)}this.hasCompleted()||this._finalize()}},t.prototype._onError=function(e){switch(this.getState()){case o.loader.ResponseState.COMPLETED:case o.loader.ResponseState.ERRORED:break;case o.loader.ResponseState.PENDING:if(0===this._xhr.status){this._provideStatusAndHeaders({statusCode:0,headers:{}},this._getEmptyData()),this._finalize();break}default:this._finalize(new o.loaderErrors.LoaderError("An error occurred.",e))}},t.prototype._onLoadEnd=function(){window.clearTimeout(this._timeoutTimer),this.hasCompleted()||this._finalize(new o.loaderErrors.LoaderError("Unexpected error occurred."))},t.prototype._onProgress=function(){if(!this.hasCompleted()){var e=this._xhr;this._isChunkedResponse()&&(this._responseStarted?this._providePart(e.response):(this._responseStarted=!0,this._provideStatusAndHeaders({statusCode:e.status,headers:this._parseHeaders(e.getAllResponseHeaders()||"")},e.response)))}},t.prototype._isChunkedResponse=function(){return"moz-chunked-arraybuffer"===this._xhr.responseType},t.prototype._parseHeaders=function(e){var t={};if(!e)return t;for(var r=e.split("\r\n"),n=0,o=r.length;n0){var s=i.substring(0,a).trim(),u=i.substring(a+2);t[s]=u}}return t},t}(o.loader.LoaderRequest);t.LoaderRequest=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905;var n=r(3);t.stringLoader=n.stringLoader;var o=r(5);t.arrayBufferLoader=o.arrayBufferLoader,t.ArrayBufferLoader=o.ArrayBufferLoader},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(4);t.stringLoader={request:function(e){var t=e.url,r=e.headers,o=e.timeout;return new n.StringLoaderRequest(t,r,o)}}},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=["text"],a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return i},t.prototype._getEmptyData=function(){return""},t.prototype._reduceParts=function(e){return e.join("")},t}(o.LoaderRequest);t.StringLoaderRequest=a},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(6),o=r(7),i=function(){function e(e){var t=(void 0===e?{}:e).fetchEnabled,r=void 0===t||t;this._fetchEnabled=r}return e.prototype.request=function(e){var t=e.url,r=e.headers,i=e.timeout;return this._fetchEnabled&&o.ArrayBufferLoaderRequest.isSupported()?new o.ArrayBufferLoaderRequest(t,r,i):new n.ArrayBufferLoaderRequest(t,r,i)},e}();t.ArrayBufferLoader=i,t.arrayBufferLoader=new i},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=r(1),a=o.helpers.browser.getFirefoxVersion(),s=a&&a.major>=60?["moz-chunked-arraybuffer","arraybuffer"]:["arraybuffer"],u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype._getResponseType=function(){return s},t.prototype._getEmptyData=function(){return new ArrayBuffer(0)},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(i.LoaderRequest);t.ArrayBufferLoaderRequest=u},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(0),i=o.helpers.browser.isFirefox(),a=function(e){function t(r,n,i){void 0===n&&(n={}),void 0===i&&(i=2e4);var a=e.call(this)||this;if(!t.isSupported())throw new Error("Not supported.");var s=a._abortController=new AbortController,u=new Request(r,{headers:n,redirect:"follow",signal:s.signal});a._signalRequestStart();var l=a._abortTimer=window.setTimeout(function(){a._signalTimeout(),a._abort()},i),c=fetch(u).then(function(e){var t={};if(e.headers.forEach(function(e,r){return t[e]=r}),a._provideStatusAndHeaders({statusCode:e.status,headers:t},new ArrayBuffer(0)),e.body){var r=e.body.getReader(),n=function(){return r.read().then(function(e){var t=e.done,r=e.value;if(!t&&!a.hasCompleted())return a._providePart(r.buffer),n()})};return n()}return e.arrayBuffer().then(function(e){e&&a._providePart(e)})}).then(function(){a.hasCompleted()||a._finalize()}).catch(function(e){if(!a.hasCompleted()){var t=e instanceof o.loaderErrors.LoaderError?e:new o.loaderErrors.LoaderError(e);a._finalize(t)}});return o.helpers.always(c,function(){return window.clearTimeout(l)}),a}return n(t,e),t.isSupported=function(){return"fetch"in window&&"Request"in window&&"AbortController"in window&&!i},t.prototype._abort=function(){window.clearTimeout(this._abortTimer),this._abortController.abort()},t.prototype._reduceParts=function(e){return o.helpers.arrayBuffer.combine(e.map(function(e){return new Uint8Array(e)})).buffer},t}(o.loader.LoaderRequest);t.ArrayBufferLoaderRequest=a}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(7))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="29.3.0",t.buildNumber=1905;var n=r(1);t.PlaylistHLS=n.PlaylistHLS},function(e,t,r){"use strict";function n(e){return 0===e.indexOf('"')&&e.lastIndexOf('"')===e.length-1?e.slice(1,-1):e}function o(e){0===e.indexOf("0x")&&(e=e.substr(2));var t=new Uint16Array(8);if(e.length%4!==0)throw new f("Failed to parse IV (length is not multiple of 4).");for(var r=0;r>8*(15-r)&255;return t}function a(e){return!(e>=400&&e<500)}function s(e){var t={};A.lastIndex=0;for(var r;null!==(r=A.exec(e));){var o=r[1].trim().toLowerCase(),i=n(r[2].trim());t[o]=i}return t}var u=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var l,c=r(2),d=r(3),p=d.retrievalErrors.UnacceptableResponseStatusCodeError,f=d.retrievalErrors.PlaylistParseError,h=d.retrievalErrors.UnsupportedEncryptionError,_=c.helpers.abortableJob.AbortableJob,g=c.helpers.deferred.buildDeferred,y=c.helpers.cache.buildCache,v=c.helpers.retry,m=v.retry,E=v.buildExponentialDelayCalculator,b=c.helpers.Promise,w=c.helpers.find,S=c.helpers.url,P=c.logger.prefixLogger,R=c.logger.noOpLogger,O=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(MAP):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF): *(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE): *(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g,A=/(.+?)=(.+?)(?:,|$)/g,T=/^\d*(\.\d+)?$/;!function(e){e[e.NONE=0]="NONE",e[e.AES_128=1]="AES_128",e[e.SAMPLE_AES=2]="SAMPLE_AES"}(l||(l={}));var M=function(e){function t(t){var r=t.url,n=t.playlistLoader,o=t.segmentLoader,i=t.keyLoader,s=t.segmentFormat,u=t.logger,l=void 0===u?R:u,f=t.delayCalculator,h=void 0===f?E():f,v=t.keyDelayCalculator,w=void 0===v?E():v,S=t.segmentDelayCalculator,O=t.isPlaylistResponseCodeAcceptable,A=void 0===O?function(e){return 200===e}:O,T=t.isPlaylistResponseCodeRetryable,M=void 0===T?a:T,x=t.isSegmentResponseCodeAcceptable,D=void 0===x?function(e){return 200===e}:x,I=t.isSegmentResponseCodeRetryable,k=void 0===I?a:I,C=t.isKeyResponseCodeAcceptable,N=void 0===C?function(e){return 200===e}:C,L=t.isKeyResponseCodeRetryable,j=void 0===L?a:L,F=e.call(this)||this;return F._keyRetrievalJobsCache=y(),F._initDataRetrievalJobsCache=y(),F._data=null,F._lastUpdateTime=null,F._playlistEventRepresentation=null,F._logger=P(l,"PlaylistHLS"),F._url=r,F._playlistLoader=n,F._segmentLoader=o,F._keyLoader=i||null,F._segmentFormat=s,F._keyDelayCalculator=w,F._isPlaylistResponseCodeAcceptable=A,F._isPlaylistResponseCodeRetryable=M,F._isSegmentResponseCodeAcceptable=D,F._isSegmentResponseCodeRetryable=k,F._isKeyOrInitDataResponseCodeAcceptable=N,F._isKeyOrInitDataResponseCodeRetryable=j,F._segmentDelayCalculator=S,F._downloadAbortableJob=new _(function(){var e=c.helpers.deferred.buildDeferred(),t=m(h,function(t){var n=t.scheduleRetry,o=new d.events.Playlist(r);F._onPlaylistRequestQueued.dispatch({playlist:o});var i=F._playlistLoader.request({url:r});return i.onRequestStart(function(){F._onPlaylistRequestStart.dispatch({playlist:o})}),F._logger.debug("Requesting playlist.",r),i.onResponseReceived(function(t){if(!t)return F._logger.warn("Playlist request timed out.",r),F._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:null}),void n();var i=t.statusCode;if(F._isPlaylistResponseCodeAcceptable(i)){var a=t.getData();return a?(F._logger.debug("Got playlist response.",r,i),F._onPlaylistRetrieved.dispatch({playlist:o,statusCode:i}),void e.resolve({playlistContent:a,eventRepresentation:o})):(F._logger.warn("Playlist response contained no data.",r,i),F._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n())}return F._isPlaylistResponseCodeRetryable(i)?(F._logger.debug("Playlist response code was not acceptable. Will retry.",r,i),F._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void n()):(F._logger.debug("Playlist response code was not acceptable.",r,i),F._onPlaylistRequestFailed.dispatch({playlist:o,statusCode:i}),void e.reject(new p(i)))}),i.onError(function(t){return t instanceof c.loaderErrors.LoaderError?(F._logger.warn("Error from loader. Will retry",r,t),void n()):void e.reject(t)}),{onCancel:function(){F._logger.debug("Aborting playlist request.",r),i.hasCompleted()||i.abort(),F._onPlaylistRequestFailed.dispatch({playlist:o,aborted:!0})}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting playlist."))}}).cancel;return{result:e.promise,abort:function(){return t()}}}),F._updateJob=new _(function(){if(F._data&&F._data.ended)return{result:b.resolve(void 0)};var e=g(),t=F._downloadAbortableJob.run();return t.onCompletion(function(t){var r=t.playlistContent,n=t.eventRepresentation;F._lastUpdateTime=c.helpers.time.now(),F._onPlaylistParseStart.dispatch({playlist:n});try{F._data=F._parsePlaylist(r)}catch(t){return F._logger.error("Error when parsing playlist.",t,r),void e.reject(t)}F._playlistEventRepresentation=n,F._onPlaylistParseEnd.dispatch({playlist:n}),e.resolve(void 0)}),t.onError(e.reject),{result:e.promise,abort:function(){return t.abort()}}}),F}return u(t,e),t.prototype.hasInitialUpdateCompleted=function(){return!!this._data},t.prototype.getType=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.type},t.prototype.getExpireTime=function(){var e=this._data,t=this._lastUpdateTime;if(!e||e.type!==d.PlaylistType.LIVE||null===t)return null;var r=e.segments.reduce(function(e,t){return e+t.timeRange.duration},0);return t+r/2},t.prototype.hasEnded=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.ended},t.prototype.getCompleteDuration=function(){return this._data&&this._data.ended?this._data.totalDuration:null},t.prototype.getDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.totalDuration},t.prototype.getTargetDuration=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.targetDuration},t.prototype.getFirstSegmentIndex=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.mediaSequence},t.prototype.getSegmentCount=function(){if(!this._data)throw new Error("Not loaded yet.");return this._data.segments.length},t.prototype.getSegmentIndexContainingTime=function(e){var t=this._data;if(!t)throw new Error("Not loaded yet.");var r=w(t.segments,function(t){return t.timeRange.containsTime(e)});return r?t.mediaSequence+t.segments.indexOf(r):null},t.prototype._update=function(){return this._updateJob.run()},t.prototype._getSegment=function(e){var t=this,r=this._data;if(!r)throw new Error("Not loaded yet.");var n=r.segments[e-r.mediaSequence],o=new _(function(){var r=n.encryptionData,o=t._playlistEventRepresentation;if(!o)throw new Error("Playlist event representation should exist.");var i=t._buildEncryptionConfig(r,e),a=n.initDataUrl?t._retrieveInitData(n.initDataUrl):null,s=i.whenComplete().then(function(r){var i=function(i){return new d.Segment({url:n.url,sequenceNumber:e,playlist:t,timeRange:n.timeRange,format:t._segmentFormat,loader:t._segmentLoader,playlistEventRepresentation:o,logger:t._logger,delayCalculator:t._segmentDelayCalculator,isResponseCodeAcceptable:t._isSegmentResponseCodeAcceptable,isResponseCodeRetryable:t._isSegmentResponseCodeRetryable,encryptionConfig:r,initData:i})};return a?a.whenComplete().then(function(e){return i(e)}):i(void 0)});return{result:s,abort:function(){i.abort(),a&&a.abort()}}});return o.run()},t.prototype._buildEncryptionConfig=function(e,t){var r=this,n=new _(function(){if(e.method===l.NONE)return{result:b.resolve(void 0)};if(e.method!==l.AES_128)return r._logger.error("Unsupported encryption method.",e.method),{result:b.reject(new h)};var n=r._keyLoader;if(!n)return{result:b.reject(new Error("Encryption method not supported as no key loader provided."))};var o=r._retrieveKey(e.keyUrl),a=o.whenComplete().then(function(r){return{cipher:"AES-CBC",key:r,iv:e.iv||i(t)}});return{result:a,abort:function(){return o.abort()}}},{storeResult:!0});return n.run()},t.prototype._retrieveKey=function(e){var t=this,r=this._keyLoader;if(!r)throw new Error("No key loader.");var n=this._playlistEventRepresentation;if(!n)throw new Error("Playlist event representation should exist.");var o=new d.events.Key(n,e);return this._retrieveKeyOrInitData({url:e,loader:r,cache:this._keyRetrievalJobsCache,onRequestQueued:function(){return t._onKeyRequestQueued.dispatch({key:o})},onRequestStart:function(){return t._onKeyRequestStart.dispatch({key:o})},onRequestTimedOut:function(){t._onKeyRequestFailed.dispatch({key:o,statusCode:null})},onRequestFailed:function(e){t._onKeyRequestFailed.dispatch({key:o,statusCode:e})},onRequestAborted:function(){t._onKeyRequestFailed.dispatch({key:o,aborted:!0})},onRetrieved:function(e){t._onKeyRetrieved.dispatch({key:o,statusCode:e})},type:"key"})},t.prototype._retrieveInitData=function(e){var t=this,r=this._playlistEventRepresentation;if(!r)throw new Error("Playlist event representation should exist.");var n=new d.events.InitData(r,e);return this._retrieveKeyOrInitData({url:e,loader:this._segmentLoader,cache:this._initDataRetrievalJobsCache,onRequestQueued:function(){return t._onInitDataRequestQueued.dispatch({initData:n})},onRequestStart:function(){return t._onInitDataRequestStart.dispatch({initData:n})},onRequestTimedOut:function(){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:null})},onRequestFailed:function(e){t._onInitDataRequestFailed.dispatch({initData:n,statusCode:e})},onRequestAborted:function(){t._onInitDataRequestFailed.dispatch({initData:n,aborted:!0})},onRetrieved:function(e){t._onInitDataRetrieved.dispatch({initData:n,statusCode:e})},type:"init data"})},t.prototype._retrieveKeyOrInitData=function(e){var t=this,r=e.url,n=e.loader,o=e.cache,i=e.onRequestQueued,a=e.onRequestStart,s=e.onRequestTimedOut,u=e.onRequestFailed,l=e.onRequestAborted,d=e.onRetrieved,f=e.type,h=o.get(r);return h?this._logger.debug(f+" retrieval already in progress.",r):(h=new _(function(){var e=c.helpers.deferred.buildDeferred(),o=m(t._keyDelayCalculator,function(o){var h=o.scheduleRetry;i();var _=n.request({url:r});return _.onRequestStart(a),t._logger.debug("Retrieving "+f+".",r),_.onResponseReceived(function(n){if(!n)return t._logger.warn(f+" request timed out.",r),s(),void h();var o=n.statusCode;if(t._isKeyOrInitDataResponseCodeAcceptable(o)){var i=n.getData();return i?(t._logger.debug("Got "+f+" response.",r,o),d(o),void e.resolve(new Uint8Array(i))):(t._logger.warn(f+" response contained no data.",r,o),u(o),void h())}return t._isKeyOrInitDataResponseCodeRetryable(o)?(t._logger.warn(f+" response code was not acceptable. Will retry.",r,o),u(o),void h()):(t._logger.warn(f+" response code was not acceptable.",r,o),u(o),void e.reject(new p(o)))}),_.onError(function(n){return n instanceof c.loaderErrors.LoaderError?(t._logger.warn("Error from loader. Will retry",r,n),void h()):void e.reject(n)}),{onCancel:function(){t._logger.debug("Aborting "+f+" request.",r),_.hasCompleted()||_.abort(),l()}}},{onNoMoreRetries:function(){return e.reject(new Error("No more retries for requesting "+f+"."))}}).cancel;return{result:e.promise,abort:function(){return o()}}},{storeResult:!0}),o.set(r,h)),h.run()},t.prototype._parsePlaylist=function(e){var t=this._data,r={version:null,type:d.PlaylistType.LIVE,mediaSequence:null,targetDuration:null,totalDuration:0,ended:!1},n=[],i={method:l.NONE},a=null,u=null;O.lastIndex=0;for(var p,h=0,_=!1;null!==(p=O.exec(e));){var g=p.filter(function(e,t){return 0!==t&&void 0!==e}).map(function(e,t){return 0===t?e.toLowerCase():e}),y=g[0],v=g.slice(1);if(0===h){if("extm3u"!==y)throw new f("First line did not contain EXTM3U tag.")}else{if(!_)switch(y){case"playlist-type":if(r.type!==d.PlaylistType.LIVE)throw new f("Already have playlist type.");switch(v[0].toLowerCase()){case"vod":r.type=d.PlaylistType.VOD;break;case"event":r.type=d.PlaylistType.EVENT;break;default:throw new f("Invalid playlist type.")}break;case"media-sequence":if(null!==r.mediaSequence)throw new f("Already have media sequence number.");var m=parseInt(v[0],10);if(m+""!==v[0])throw new f("Invalid media sequence number.");r.mediaSequence=m;break;case"targetduration":if(null!==r.targetDuration)throw new f("Already have target duration."); +var E=parseInt(v[0],10);if(E+""!==v[0]||E<0)throw new f("Invalid target duration.");r.targetDuration=1e3*E;break;case"version":if(null!==r.version)throw new f("Already have version.");var b=parseInt(v[0],10);if(b+""!==v[0])throw new f("Invalid version.");if(b<3)throw new f("HLS version must be 3 or above.");r.version=b;break;default:_=!0}if(_)switch(y){case"key":var w=s(v[0]),P="method"in w?w.method.toLowerCase():null,R="uri"in w?S.buildAbsoluteUrl(this._url,w.uri):null,A="iv"in w?o(w.iv):null;if(!P)throw new f("Missing encryption method.");if(!R&&"none"!==P)throw new f("Missing key url.");switch(P){case"none":if(null!==R)throw new f("Key url not allowed.");if(null!==A)throw new f("IV not allowed.");i={method:l.NONE};break;case"aes-128":if(!R)throw new f("Key url required.");i={method:l.AES_128,keyUrl:R,iv:A};break;case"sample-aes":if(!R)throw new f("Key url required.");i={method:l.SAMPLE_AES,keyUrl:R,iv:A};break;default:throw new f("Unknown encryption method.")}break;case"map":var w=s(v[0]);if(!("uri"in w))throw new f("URI missing from EXT-X-MAP tag.");if("byterange"in w)throw new f("BYTERANGE in EXT-X-MAP tag is currently unsupported.");a=w.uri?S.buildAbsoluteUrl(this._url,w.uri):null;break;case"inf":if(!v[0].match(T))throw new f("Invalid segment duration.");u=1e3*parseFloat(v[0]);break;case"":if(r.ended)throw new f("Already received ENDLIST tag.");if(null===u)throw new f("Not received segment duration.");var M=S.buildAbsoluteUrl(this._url,v[0]);n.push({url:M,timeRange:new c.TimeRange(r.totalDuration,u),initDataUrl:a,encryptionData:i}),r.totalDuration+=u,u=null;break;case"endlist":if(r.ended)throw new f("Already had ENDLIST tag.");r.ended=!0;break;default:this._logger.warn("Unable to parse playlist line.",y)}}h++}var x=r.version,D=r.type,I=r.mediaSequence,k=r.targetDuration,C=r.ended,N=r.totalDuration;if(null===x)throw new f("Missing version.");if(null===k)throw new f("Missing target duration.");if(C&&D===d.PlaylistType.LIVE)throw new f("Cannot be ended if type is LIVE.");if(!C&&D===d.PlaylistType.VOD)throw new f("Must be ended if type is VOD.");if(null===I&&(I=0),t){if(t.type!==D)throw new f("Playlist type has changed since last update.");if(t.type===d.PlaylistType.EVENT&&I!==t.mediaSequence)throw new f("Media sequence number has changed. Not valid for EVENT playlist.");var L=t.segments[I-t.mediaSequence];if(!L)throw new f("Tracking lost. The last segment of the previous playlist is no longer in the new one.");var j=L.timeRange.start;n.forEach(function(e){var t=e.timeRange;e.timeRange=new c.TimeRange(t.start+j,t.duration)}),N+=j}return{version:x,type:D,mediaSequence:I,targetDuration:k,totalDuration:N,ended:C,segments:n}},t}(d.Playlist);t.PlaylistHLS=M},function(t,r){t.exports=e},function(e,r){e.exports=t}])})},function(e,t,r){!function(t,n){e.exports=n(r(2),r(1))}(window,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(t){return e[t]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.version="23.4.0",t.buildNumber=883;var n=r(1);t.StreamUrlRetriever=n.StreamUrlRetriever},function(e,t,r){"use strict";var n=this&&this.__extends||function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=r(2),i=r(3),a=o.helpers.abortableJob.AbortableJob,s=o.helpers.find,u=o.helpers.time,l=new i.Limiter,c=5e3,d=[i.renditions.encryptedHlsMp3,i.renditions.hlsMp3,i.renditions.encryptedHlsOpus,i.renditions.hlsOpus,i.renditions.httpMp3],p=function(e){function t(t){var r=t.loader,n=t.clientId,o=t.trackId,i=t.secretToken,a=void 0===i?null:i,s=t.requestAuthorization,u=void 0===s?null:s,l=t.excludedRenditions,c=void 0===l?[]:l,d=t.maxBitrate,p=void 0===d?1/0:d,f=t.endpointBaseUrl,h=void 0===f?"https://api.soundcloud.com/":f,_=t.encryptedStreamsEnabled,g=void 0!==_&&_,y=e.call(this)||this;if(y.name="PublicAPI",y._getUrlsJob=null,y._clearResponseTimer=null,!r)throw new Error("loader required.");if("string"!=typeof n)throw new Error("clientId invalid.");if("number"!=typeof o)throw new Error("trackId invalid.");if(null!==a&&"string"!=typeof a)throw new Error("secretToken invalid.");if(null!==u&&"string"!=typeof u)throw new Error("requestAuthorizaton invalid.");if("number"!=typeof p||p<=0)throw new Error("maxBitrate must be > 0.");if("string"!=typeof h)throw new Error("endpointBaseUrl must be > 0.");if("boolean"!=typeof g)throw new Error("encryptedStreamsEnabled invalid.");return y._loader=r,y._clientId=n,y._requestAuthorization=u,y._trackId=o,y._secretToken=a,y._endpointBaseUrl=h,y._encryptedStreamsEnabled=g,y._excludedRenditions=c,y._maxBitrate=p,y}return n(t,e),t.prototype.getTrackId=function(){return this._trackId},t.prototype.excludeRendition=function(e){this._excludedRenditions.indexOf(e)<0&&this._excludedRenditions.push(e)},t.prototype.updateRequestAuthorization=function(e){if(null!==e&&"string"!=typeof e)throw new Error("requestAuthorizaton invalid.");this._requestAuthorization=e},t.prototype.clearCache=function(){this._clearResponseTimer&&(window.clearTimeout(this._clearResponseTimer),this._clearResponseTimer=null),this._getUrlsJob=null},t.prototype.getMaxBitrate=function(){return this._maxBitrate},t.prototype.setMaxBitrate=function(e){if("number"!=typeof e||e<=0)throw new Error("maxBitrate must be > 0.");this._maxBitrate=e},t.prototype.getUrl=function(){var e=this,t=this._maxBitrate,r=this._excludedRenditions,n=new a(function(){var n=o.helpers.deferred.buildDeferred(),a=e._getUrls();return a.onCompletion(function(e){var o=e.urls,i=e.timeRetrieved,a=null;d.filter(function(e){return r.indexOf(e)<0}).some(function(e){var r=o.filter(function(t){return t.rendition===e}).map(function(e){return{url:e.url,bitrate:e.bitrate}}),n=s(r.sort(function(e,t){return t.bitrate-e.bitrate}),function(e){return e.bitrate<=t});return!!n&&(a={success:!0,url:n.url,rendition:e,bitrate:n.bitrate,timeRetrieved:i},!0)}),n.resolve(a)}),a.onError(function(e){e instanceof i.UrlRetrieverError?n.resolve({success:!1,error:e}):n.reject(e)}),{result:n.promise,abort:function(){return a.abort()}}});return n.run()},t.prototype._getUrls=function(){var e=this;return this._getUrlsJob||(this._getUrlsJob=new a(function(){var t=o.helpers.deferred.buildDeferred(),r=null,n=l.execute(function(){var n=e._requestAuthorization?{Authorization:e._requestAuthorization}:{},o=e._endpointBaseUrl+"i1/tracks/"+encodeURI(e._trackId+"")+"/streams?client_id="+encodeURIComponent(e._clientId);e._encryptedStreamsEnabled&&(o+="&with_encrypted_streams=true"),e._secretToken&&(o+="&secret_token="+encodeURIComponent(e._secretToken)),r=e._loader.request({url:o,headers:n});var a=r.getResponse().then(function(e){if(!e)throw new i.UrlRetrieverError("TIMED_OUT",!0);if(200!==e.statusCode)throw new i.UrlRetrieverError("INVALID_STATUS_"+e.statusCode);var t=e.getData();if(!t)throw new i.UrlRetrieverError("NO_DATA");var r=u.now(),n=JSON.parse(t),o=[];return Object.keys(n).map(function(e){var t=e.split("_"),r=t[0],i=t[1],a=t[2],u=parseInt(a,10);if(r&&i&&!isNaN(u)){var l=s(d,function(e){return e.scProtocol===r&&e.scFormat===i});l&&o.push({rendition:l,bitrate:u,url:n[e]})}}),{urls:o,timeRetrieved:r}});return a.then(t.resolve,t.reject),a});return{result:t.promise,abort:function(){n.abort(),r&&r.abort()}}}),this._clearResponseTimer=window.setTimeout(function(){e._clearResponseTimer=null,e._getUrlsJob=null},c)),this._getUrlsJob.run()},t}(i.BaseStreamUrlRetriever);t.StreamUrlRetriever=p},function(t,r){t.exports=e},function(e,r){e.exports=t}])})}]); \ No newline at end of file