diff options
Diffstat (limited to '')
-rw-r--r-- | assets/clapprio/dash-shaka-playback.min.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/assets/clapprio/dash-shaka-playback.min.js b/assets/clapprio/dash-shaka-playback.min.js index d7cb91e..6c746b6 100644 --- a/assets/clapprio/dash-shaka-playback.min.js +++ b/assets/clapprio/dash-shaka-playback.min.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):"object"==typeof exports?exports.DashShakaPlayback=e(require("clappr")):t.DashShakaPlayback=e(t.Clappr)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="dist/",e(e.s=0)}([function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(n)},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=i(1),h=i(2),c=function(t){return t&&t.__esModule?t:{default:t}}(h),l=function(t){function e(t){n(this,e);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i._levels=[],i._pendingAdaptationEvent=!1,i._isShakaReadyState=!1,t.autoPlay&&i.play(),i}return a(e,t),o(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=-1===this._currentLevelId;this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i?(this._player.configure({abr:{enabled:!0}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var i=c.default.Player.isBrowserSupported(),n=t.split("?")[0].match(/.*\.(.*)$/)||[];return i&&("mpd"===n[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),o(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(u.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){u.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){u.Log.error("shaka could not be unloaded")})):s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectAudioLanguage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._player.selectAudioLanguage(t,e)}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(u.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),u.Log.error("shaka could not be destroyed")}):this._destroy()}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.slice(0).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var e=this;u.Log.error("Shaka error event:",t.detail),this.trigger(u.Events.PLAYBACK_ERROR,t,this.name),2==t.detail.severity&&1002==t.detail.code&&(console.log("retrying"),this.stop(),setTimeout(function(){return e.play()},1e3))}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),u.Log.debug("an adaptation has happened:",t),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,language:t.language,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioLanguages",get:function(){return this.isReady&&this._player.getAudioLanguages()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,i=void 0;if(-1!==t){if(!(i=e.find(function(e){return e.id===t})))return void u.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===i.track.active)return void u.Log.info('Track id "'+t+'" already showing')}i?(this._player.selectTextTrack(i.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(u.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(u.HTML5Video);e.default=l,t.exports=e.default},function(e,i){e.exports=t},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=$s;i[0]in n||!n.execScript||n.execScript("var "+i[0]);for(var r;i.length&&(r=i.shift());)i.length||void 0===e?n=n[r]?n[r]:n[r]={}:n[r]=e}function i(t){function e(){}var i=Se;e.prototype=i.prototype,t.Te=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.Re=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function a(t){return t.a/(1-Math.pow(t.c,t.b))}function s(){this.b=new n(2),this.c=new n(5),this.a=0}function o(){}function u(){}function h(t,e,i,n){this.severity=t,this.category=e,this.code=i,this.data=Array.prototype.slice.call(arguments,3),this.handled=!1}function c(t){var e;t instanceof c?(l(this,t.ea),this.Aa=t.Aa,this.ja=t.ja,d(this,t.Ia),this.ba=t.ba,f(this,b(t.a)),this.ta=t.ta):t&&(e=String(t).match(Ws))?(l(this,e[1]||"",!0),this.Aa=p(e[2]||""),this.ja=p(e[3]||"",!0),d(this,e[4]),this.ba=p(e[5]||"",!0),f(this,e[6]||"",!0),this.ta=p(e[7]||"")):this.a=new g(null)}function l(t,e,i){t.ea=i?p(e,!0):e,t.ea&&(t.ea=t.ea.replace(/:$/,""))}function d(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.Ia=e}else t.Ia=null}function f(t,e,i){e instanceof g?t.a=e:(i||(e=m(e,to)),t.a=new g(e))}function p(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function m(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,v),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function v(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function g(t){this.b=t||null}function b(t){var e=new g;if(e.b=t.b,t.a){var i,n={};for(i in t.a)n[i]=t.a[i].concat();e.a=n,e.c=t.c}return e}function y(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function T(t,e,i){var n=E();this.j=null==t.maxAttempts?n.maxAttempts:t.maxAttempts,this.f=null==t.baseDelay?n.baseDelay:t.baseDelay,this.i=null==t.fuzzFactor?n.fuzzFactor:t.fuzzFactor,this.h=null==t.backoffFactor?n.backoffFactor:t.backoffFactor,this.a=0,this.b=this.f,this.c=e||!1,this.g=i||null,this.c&&(this.a=1)}function w(t){if(t.a>=t.j){if(!t.c)return Promise.reject();t.a=1,t.b=t.f}var e=new y;return t.a?(S(t,e.resolve,t.b*(1+(2*Math.random()-1)*t.i)),t.b*=t.h):e.resolve(),t.a++,e}function E(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function S(t,e,i){if(t.g)if(t.g()||!i)e();else{var n=Math.min(200,i);A(function(){S(this,e,i-n)}.bind(t),n)}else A(e,i)}function A(e,i){t.setTimeout(e,i)}function k(t,e,i,n,r){var a,s=r in n;for(a in e){var o=r+"."+a,u=s?n[r]:i[a];(s||a in t)&&(void 0===e[a]?void 0===u||s?delete t[a]:t[a]=u:u.constructor==Object&&e[a]&&e[a].constructor==Object?(t[a]||(t[a]=u),k(t[a],e[a],u,n,o)):typeof e[a]==typeof u&&null!=e[a]&&e[a].constructor==u.constructor&&(t[a]=e[a]))}}function I(t){function e(t){switch(typeof t){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return t;default:if(!t)return t;if(0<=i.indexOf(t))return null;var n=t.constructor==Array;if(t.constructor!=Object&&!n)return null;i.push(t);var r,a=n?[]:{};for(r in t)a[r]=e(t[r]);return n&&(a.length=t.length),a}}var i=[];return e(t)}function P(t,e){return t.reduce(function(t,e,i){return e.catch(t.bind(null,i))}.bind(null,e),Promise.reject())}function _(t,e){return t.concat(e)}function x(){}function R(t){return null!=t}function N(t,e,i){return i.indexOf(t)==e}function D(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.g=t||null}function L(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function C(t,e,i,n,r,a,s){if(t.f||s())return Promise.reject();var o=new c(i.uris[r]),u=o.ea;if(u||(u=location.protocol,u=u.slice(0,-1),l(o,u),i.uris[r]=o.toString()),!(u=io[u]))return Promise.reject(new h(2,1,1e3,o));var d=Date.now();return u(i.uris[r],i,e).then(function(t){void 0==t.timeMs&&(t.timeMs=Date.now()-d);var i=Date.now(),n=Promise.resolve();return this.c.forEach(function(i){n=n.then(function(){return Promise.resolve(i(e,t))}.bind(this))}.bind(this)),n=n.catch(function(t){var e=2;throw t instanceof h&&(e=t.severity),new h(e,1,1007,t)}),n.then(function(){return t.timeMs+=Date.now()-i,t.timeMs+=a,t})}.bind(t)).catch(function(t){if(t&&1==t.severity)return r=(r+1)%i.uris.length,s()?Promise.reject():w(n).then(function(){return C(this,e,i,n,r,a,s)}.bind(this),function(){throw t});throw t}.bind(t))}function M(t,e){for(var i=[],n=0;n<t.length;++n){for(var r=!1,a=0;a<i.length&&!(r=e?e(t[n],i[a]):t[n]===i[a]);++a);r||i.push(t[n])}return i}function O(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function U(t,e){var i=t.indexOf(e);-1<i&&t.splice(i,1)}function j(){this.a={}}function B(){this.a=new j}function F(t,e,i,n){t.a&&(e=new K(e,i,n),t.a.push(i,e))}function V(t,e,i,n){F(t,e,i,function(t){this.ha(e,i),n(t)}.bind(t))}function H(t){if(t.a){var e,i=t.a,n=[];for(e in i.a)n.push.apply(n,i.a[e]);for(i=0;i<n.length;++i)n[i].ha();t.a.a={}}}function K(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function G(e,i){var n,r=i||{};for(n in r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=t.performance&&t.performance.now?t.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function q(t,e){if(!e.length)return t;var i=e.map(function(t){return new c(t)});return t.map(function(t){return new c(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(_,[]).map(function(t){return t.toString()})}function X(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function Y(t){return!t||!Object.keys(t).length}function z(t){return Object.keys(t).map(function(e){return t[e]})}function $(t,e){return Object.keys(t).reduce(function(i,n){return i[n]=e(t[n],n),i},{})}function W(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function J(t,e){Object.keys(t).forEach(function(i){e(i,t[i])})}function Q(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function Z(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape(nt(t));try{return decodeURIComponent(t)}catch(t){throw new h(2,2,2004)}}function tt(t,e,i){if(!t)return"";if(!i&&t.byteLength%2)throw new h(2,2,2004);if(t instanceof ArrayBuffer)var n=t;else i=new Uint8Array(t.byteLength),i.set(new Uint8Array(t)),n=i.buffer;t=Math.floor(t.byteLength/2),i=new Uint16Array(t),n=new DataView(n);for(var r=0;r<t;r++)i[r]=n.getUint16(2*r,e);return nt(i)}function et(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return Z(e);if(254==e[0]&&255==e[1])return tt(e.subarray(2),!1);if(255==e[0]&&254==e[1])return tt(e.subarray(2),!0);var i=function(t,e){return t.byteLength<=e||32<=t[e]&&126>=t[e]}.bind(null,e);if(!e[0]&&!e[2])return tt(t,!1);if(!e[1]&&!e[3])return tt(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return Z(t);throw new h(2,2,2003)}function it(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=t.charCodeAt(i);return e.buffer}function nt(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function rt(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function at(t,e){t.cancel(),t.a=setTimeout(t.b,1e3*e)}function st(t,e){t.cancel();var i=function(){this.b(),this.a=setTimeout(i,1e3*e)}.bind(t);t.a=setTimeout(i,1e3*e)}function ot(e,i){var n=void 0==i||i,r=t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_");return n?r:r.replace(/=*$/,"")}function ut(e){e=t.atob(e.replace(/-/g,"+").replace(/_/g,"/"));for(var i=new Uint8Array(e.length),n=0;n<e.length;++n)i[n]=e.charCodeAt(n);return i}function ht(e){for(var i=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)i[n/2]=t.parseInt(e.substr(n,2),16);return i}function ct(t){for(var e="",i=0;i<t.length;++i){var n=t[i].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function lt(t,e){if(!t&&!e)return!0;if(!t||!e||t.length!=e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!=e[i])return!1;return!0}function dt(t){this.s=t,this.l=this.j=this.w=null,this.L=!1,this.b=null,this.f=new B,this.a=[],this.m=[],this.i=new y,this.h=null,this.g=function(e){this.i.reject(e),t.onError(e)}.bind(this),this.C={},this.D=new rt(this.$d.bind(this)),this.ia=this.c=!1,this.J=[],this.X=!1,this.B=new rt(this.Zd.bind(this)),st(this.B,1),this.i.catch(function(){})}function ft(t,e){if(!t.j)return V(t.f,e,"encrypted",function(){this.g(new h(2,6,6010))}.bind(t)),Promise.resolve();t.l=e,V(t.f,t.l,"play",t.Gd.bind(t));var i=t.l.setMediaKeys(t.j),i=i.catch(function(t){return Promise.reject(new h(2,6,6003,t.message))}),n=null;return t.b.serverCertificate&&t.b.serverCertificate.length&&(n=t.j.setServerCertificate(t.b.serverCertificate).then(function(){}).catch(function(t){return Promise.reject(new h(2,6,6004,t.message))})),Promise.all([i,n]).then(function(){if(this.c)return Promise.reject();mt(this),this.b.initData.length||this.m.length||F(this.f,this.l,"encrypted",this.vd.bind(this))}.bind(t)).catch(function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function pt(t,e){return Promise.all(e.map(function(t){return St(this,t).then(function(t){if(t){for(var e=new y,i=0;i<this.a.length;i++)if(this.a[i].fa==t){this.a[i].na=e;break}return Promise.all([t.remove(),e])}}.bind(this))}.bind(t)))}function mt(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){At(this,t.initDataType,t.initData)}.bind(t)),t.m.forEach(function(t){St(this,t)}.bind(t)),e.length||t.m.length||t.i.resolve(),t.i}function vt(t){return t.a.map(function(t){return t.fa.sessionId})}function gt(e,i,n,r,a){var s=Tt(e);i.periods.forEach(function(e){e.variants.forEach(function(e){s&&(e.drmInfos=[s]),e.drmInfos.forEach(function(i){yt(this,i),t.cast&&t.cast.__platform__&&"com.microsoft.playready"==i.keySystem&&(i.keySystem="com.chromecast.playready");var s=r[i.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:n?"required":"optional",sessionTypes:[n?"persistent-license":"temporary"],label:i.keySystem,drmInfos:[]},r[i.keySystem]=s,a.push(i.keySystem)),s.drmInfos.push(i),i.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),i.persistentStateRequired&&(s.persistentState="required");var o=[];e.video&&o.push(e.video),e.audio&&o.push(e.audio),o.forEach(function(t){("video"==t.type?s.videoCapabilities:s.audioCapabilities).push({robustness:("video"==t.type?i.videoRobustness:i.audioRobustness)||"",contentType:Q(t.mimeType,t.codecs)})}.bind(this))}.bind(this))}.bind(this))}.bind(e))}function bt(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new h(2,6,6e3));var n=new y,r=n;return[!0,!1].forEach(function(t){i.forEach(function(i){var n=e[i];n.drmInfos.some(function(t){return!!t.licenseServerUri})==t&&(n.audioCapabilities.length||delete n.audioCapabilities,n.videoCapabilities.length||delete n.videoCapabilities,r=r.catch(function(){return this.c?Promise.reject():navigator.requestMediaKeySystemAccess(i,[n])}.bind(this)))}.bind(this))}.bind(t)),r=r.catch(function(){return Promise.reject(new h(2,6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=0<=navigator.userAgent.indexOf("Edge/"),n=t.getConfiguration();return this.w=(n.audioCapabilities||[]).concat(n.videoCapabilities||[]).map(function(t){return t.contentType}),i&&(this.w=null),i=e[t.keySystem],wt(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new h(2,6,6012))}.bind(t)).then(function(t){if(this.c)return Promise.reject();this.j=t,this.L=!0}.bind(t)).catch(function(t){return this.c?Promise.resolve():(this.w=this.b=null,t instanceof h?Promise.reject(t):Promise.reject(new h(2,6,6002,t.message)))}.bind(t)),n.reject(),r}function yt(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.h.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.h.advanced[i])&&(e.distinctiveIdentifierRequired||(e.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),e.persistentStateRequired||(e.persistentStateRequired=i.persistentStateRequired),e.videoRobustness||(e.videoRobustness=i.videoRobustness),e.audioRobustness||(e.audioRobustness=i.audioRobustness),e.serverCertificate||(e.serverCertificate=i.serverCertificate))}}function Tt(e){if(Y(e.h.clearKeys))return null;var i,n=[],r=[];for(i in e.h.clearKeys){var a=e.h.clearKeys[i],s=ht(i),a=ht(a),s={kty:"oct",kid:ot(s,!1),k:ot(a,!1)};n.push(s),r.push(s.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(it(r)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+t.btoa(e),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:r,keyIds:[]}}function wt(t,e,i,n){var r=[],a=[],s=[],o=[];Et(n,r,a,s,o),t.b={keySystem:e,licenseServerUri:r[0],distinctiveIdentifierRequired:"required"==i.distinctiveIdentifier,persistentStateRequired:"required"==i.persistentState,audioRobustness:i.audioCapabilities?i.audioCapabilities[0].robustness:"",videoRobustness:i.videoCapabilities?i.videoCapabilities[0].robustness:"",serverCertificate:a[0],initData:s,keyIds:o}}function Et(t,e,i,n,r){function a(t,e){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&<(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==O(i,t.serverCertificate,lt)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==O(n,t,a)&&n.push(t)}),t.keyIds)for(var s=0;s<t.keyIds.length;++s)-1==r.indexOf(t.keyIds[s])&&r.push(t.keyIds[s])})}function St(t,e){try{var i=t.j.createSession("persistent-license")}catch(e){var n=new h(2,6,6005,e.message);return t.g(n),Promise.reject(n)}F(t.f,i,"message",t.uc.bind(t)),F(t.f,i,"keystatuseschange",t.oc.bind(t));var r={initData:null,fa:i,loaded:!1,Gb:1/0,na:null};return t.a.push(r),i.load(e).then(function(t){if(!this.c){if(t)return r.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve(),i;this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6005,t.message)))}.bind(t))}function At(t,e,i){try{var n=t.ia?t.j.createSession("persistent-license"):t.j.createSession()}catch(e){return void t.g(new h(2,6,6005,e.message))}F(t.f,n,"message",t.uc.bind(t)),F(t.f,n,"keystatuseschange",t.oc.bind(t)),t.a.push({initData:i,fa:n,loaded:!1,Gb:1/0,na:null}),n.generateRequest(e,i.buffer).catch(function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].fa==n){this.a.splice(e,1);break}this.g(new h(2,6,6006,t.message))}}.bind(t))}function kt(t,e){for(var i,n=e.target,r=0;r<t.a.length;r++)if(t.a[r].fa==n){i=t.a[r];break}r=L([t.b.licenseServerUri],t.h.retryParameters),r.body=e.message,r.method="POST","com.microsoft.playready"!=t.b.keySystem&&"com.chromecast.playready"!=t.b.keySystem||It(r),t.s.Sa.request(2,r).then(function(t){return this.c?Promise.reject():n.update(t.data).then(function(){this.s.onEvent(new G("drmsessionupdate")),i&&(i.na&&i.na.resolve(),setTimeout(function(){i.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()}.bind(this),5e3))}.bind(this))}.bind(t),function(t){if(this.c)return Promise.resolve();t=new h(2,6,6007,t),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t)).catch(function(t){if(this.c)return Promise.resolve();t=new h(2,6,6008,t.message),this.g(t),i&&i.na&&i.na.reject(t)}.bind(t))}function It(t){var e=tt(t.body,!0,!0);if(-1==e.indexOf("PlayReadyKeyMessage"))t.headers["Content-Type"]="text/xml; charset=utf-8";else{for(var e=(new DOMParser).parseFromString(e,"application/xml"),i=e.getElementsByTagName("HttpHeader"),n=0;n<i.length;++n)t.headers[i[n].querySelector("name").textContent]=i[n].querySelector("value").textContent;t.body=ut(e.querySelector("Challenge").textContent).buffer}}function Pt(){var t=[],e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],i=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n={};return"org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").forEach(function(e){var r=navigator.requestMediaKeySystemAccess(e,i).then(function(t){var i=t.getConfiguration().sessionTypes,i=!!i&&0<=i.indexOf("persistent-license");return 0<=navigator.userAgent.indexOf("Tizen 3")&&(i=!1),n[e]={persistentState:i},t.createMediaKeys()}).catch(function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function _t(t,e){var i=t.keySystem();return!e.drmInfos.length||e.drmInfos.some(function(t){return t.keySystem==i})}function xt(t,e){if(!t.length)return e;if(!e.length)return t;for(var i=[],n=0;n<t.length;n++)for(var r=0;r<e.length;r++)if(t[n].keySystem==e[r].keySystem){var a=t[n],r=e[r],s=[],s=s.concat(a.initData||[]),s=s.concat(r.initData||[]),o=[],o=o.concat(a.keyIds),o=o.concat(r.keyIds);i.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||r.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||r.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||r.persistentStateRequired,videoRobustness:a.videoRobustness||r.videoRobustness,audioRobustness:a.audioRobustness||r.audioRobustness,serverCertificate:a.serverCertificate||r.serverCertificate,initData:s,keyIds:o});break}return i}function Rt(t){return!t||1==t.length&&1e-6>t.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function Nt(t,e){return!(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))&&(e>=t.start(0)&&e<=t.end(t.length-1))}function Dt(t,e){if(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))return 0;for(var i=0,n=t.length-1;0<=n&&t.end(n)>e;--n)i+=t.end(n)-Math.max(t.start(n),e);return i}function Lt(t){if(!t)return[];for(var e=[],i=0;i<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e}function Ct(t){this.f=null,this.c=t,this.h=this.i=0,this.g=1/0,this.b=this.a=null}function Mt(t,e){e.length?(o("The use of stateless text parsers is deprecated."),ao[t]=Ut.bind(null,e)):ao[t]=e}function Ot(t,e,i,n){return Promise.resolve().then(function(){if(this.f&&this.c)if(null==i||null==n)this.f.parseInit(e);else{var t=this.f.parseMedia(e,{periodStart:this.i,segmentStart:i,segmentEnd:n}).filter(function(t){return t.startTime>=this.h&&t.startTime<this.g}.bind(this));this.c.append(t),null==this.a&&(this.a=Math.max(i,this.h)),this.b=Math.min(n,this.g)}}.bind(t))}function Ut(t){this.Ta=t}function jt(t,e,i){this.g=t,this.f=e,this.j=i,this.b={},this.a=null,this.c={},this.h=new B,this.i=!1}function Bt(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!ao[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function Ft(t,e){t.a||(t.a=new Ct(t.j)),t.a.f=new ao[e]}function Vt(t,e){if("text"==e)var i=t.a.a;else i=Ht(t,e),i=!i||1==i.length&&1e-6>i.end(0)-i.start(0)?null:1==i.length&&0>i.start(0)?0:i.length?i.start(0):null;return i}function Ht(t,e){try{return t.b[e].buffered}catch(t){return null}}function Kt(t,e,i,n,r){return"text"==e?Ot(t.a,i,n,r):Xt(t,e,t.Ae.bind(t,e,i))}function Gt(t,e){return"text"==e?t.a.remove(0,1/0):Xt(t,e,t.Ac.bind(t,e,0,t.f.duration))}function qt(t,e,i,n,r){return"text"==e?(t.a.i=i,t=t.a,t.h=n,t.g=r,Promise.resolve()):Promise.all([Xt(t,e,t.Pc.bind(t,e)),Xt(t,e,t.re.bind(t,e,i)),Xt(t,e,t.oe.bind(t,e,n,r))])}function Xt(t,e,i){if(t.i)return Promise.reject();if(i={start:i,p:new y},t.c[e].push(i),1==t.c[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new h(2,3,3017,e)):i.p.reject(new h(2,3,3015,n)),zt(t,e)}return i.p}function Yt(t,e){if(t.i)return Promise.reject();var i,n=[];for(i in t.b){var r=new y,a={start:function(t){t.resolve()}.bind(null,r),p:r};t.c[i].push(a),n.push(r),1==t.c[i].length&&a.start()}return Promise.all(n).then(function(){var t;try{e()}catch(t){var i=Promise.reject(new h(2,3,3015,t))}for(t in this.b)zt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function zt(t,e){t.c[e].shift();var i=t.c[e][0];if(i)try{i.start()}catch(n){i.p.reject(new h(2,3,3015,n)),zt(t,e)}}function $t(t,e,i){return i==e||t>=so&&i==e.split("-")[0]||t>=oo&&i.split("-")[0]==e.split("-")[0]}function Wt(t){t=t.toLowerCase().split("-");var e=uo[t[0]];return e&&(t[0]=e),t.join("-")}function Jt(t,e,i){var n=t.video;return!(n&&(n.width<e.minWidth||n.width>e.maxWidth||n.width>i.width||n.height<e.minHeight||n.height>e.maxHeight||n.height>i.height||n.width*n.height<e.minPixels||n.width*n.height>e.maxPixels)||t.bandwidth<e.minBandwidth||t.bandwidth>e.maxBandwidth)}function Qt(t,e,i){var n=!1;return t.variants.forEach(function(t){var r=t.allowedByApplication;t.allowedByApplication=Jt(t,e,i),r!=t.allowedByApplication&&(n=!0)}),n}function Zt(t,e,i){var n=e.video,r=e.audio;for(e=0;e<i.variants.length;++e){var a=i.variants[e],s=t,o=r,u=n;(s&&s.L&&!_t(s,a)?0:te(a.audio,s,o)&&te(a.video,s,u))||(i.variants.splice(e,1),--e)}for(e=0;e<i.textStreams.length;++e)t=i.textStreams[e],ao[Q(t.mimeType,t.codecs)]||(i.textStreams.splice(e,1),--e)}function te(t,e,i){if(!t)return!0;var n=null;e&&e.L&&(n=e.w),e=Q(t.mimeType,t.codecs);var r,a=t.mimeType;for(r in ro){var s=t[r],o=ro[r];s&&(a+="; "+o+'="'+s+'"')}return!(!ao[Q(t.mimeType,t.codecs)]&&!MediaSource.isTypeSupported(a)||n&&t.encrypted&&0>n.indexOf(e)||i&&(t.mimeType!=i.mimeType||t.codecs.split(".")[0]!=i.codecs.split(".")[0]))}function ee(t,e,i){var n=null;return ae(t.variants).map(function(t){var r;r=t.video&&t.audio?i==t.video.id&&e==t.audio.id:t.video&&i==t.video.id||t.audio&&e==t.audio.id;var a="";t.video&&(a+=t.video.codecs),t.audio&&(""!=a&&(a+=", "),a+=t.audio.codecs,n=t.audio.label);var s=t.audio?t.audio.codecs:null,o=t.video?t.video.codecs:null,u=null;t.video?u=t.video.mimeType:t.audio&&(u=t.audio.mimeType);var h=null;t.audio?h=t.audio.kind:t.video&&(h=t.video.kind);var c=M((t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[]));return{id:t.id,active:r,type:"variant",bandwidth:t.bandwidth,language:t.language,label:n,kind:h||null,width:t.video?t.video.width:null,height:t.video?t.video.height:null,frameRate:t.video?t.video.frameRate:void 0,mimeType:u,codecs:a,audioCodec:s,videoCodec:o,primary:t.primary,roles:c,videoId:t.video?t.video.id:null,audioId:t.audio?t.audio.id:null,channelsCount:t.audio?t.audio.channelsCount:null,audioBandwidth:t.audio&&t.audio.bandwidth?t.audio.bandwidth:null,videoBandwidth:t.video&&t.video.bandwidth?t.video.bandwidth:null}})}function ie(t,e){return t.textStreams.map(function(t){return{id:t.id,active:e==t.id,type:"text",language:t.language,label:t.label,kind:t.kind,mimeType:t.mimeType,codecs:t.codecs||null,audioCodec:null,videoCodec:null,primary:t.primary,roles:t.roles,channelsCount:null,audioBandwidth:null,videoBandwidth:null}})}function ne(t,e){for(var i=0;i<t.variants.length;i++)if(t.variants[i].id==e.id)return t.variants[i];return null}function re(t,e){for(var i=0;i<t.textStreams.length;i++)if(t.textStreams[i].id==e.id)return t.textStreams[i];return null}function ae(t){return t.filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem})}function se(t,e,i,n){var r=ae(t.variants),a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){o=Wt(o);var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.audio=!0))})})}return i&&(t=ue(a,i),t.length)?t:(t=a.map(function(t){return(t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[])}).reduce(_,[]),t.length?ue(a,t[0]):a)}function oe(t,e,i,n){var r=t.textStreams,a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Wt(e);[oo,so,0].forEach(function(t){var e=!1;r.forEach(function(i){var r=Wt(i.language);$t(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.text=!0))})})}return i&&(t=he(a,i),t.length)?t:(t=a.map(function(t){return t.roles}).reduce(_,[]),t.length?he(a,t[0]):a)}function ue(t,e){return t.filter(function(t){return t.audio&&0<=t.audio.roles.indexOf(e)||t.video&&0<=t.video.roles.indexOf(e)})}function he(t,e){return t.filter(function(t){return 0<=t.roles.indexOf(e)})}function ce(t,e,i){for(var n=0;n<i.length;n++)if(i[n].audio==t&&i[n].video==e)return i[n];return null}function le(t,e,i){function n(t,e){return null==t?null==e:e.id==t}for(var r=0;r<i.length;r++)if(n(t,i[r].audio)&&n(e,i[r].video))return i[r];return null}function de(t,e){for(var i=t.periods.length-1;0<i;--i)if(e+no>=t.periods[i].startTime)return i;return 0}function fe(t,e){for(var i=0;i<t.periods.length;++i){var n=t.periods[i];if("text"==e.type){for(var r=0;r<n.textStreams.length;++r)if(n.textStreams[r]==e)return i}else for(r=0;r<n.variants.length;++r){var a=n.variants[r];if(a.audio==e||a.video==e||a.video&&a.video.trickModeVideo==e)return i}}return-1}function pe(){this.h=null,this.c=!1,this.b=new s,this.g=[],this.i=!1,this.a=this.f=null}function me(t,e){return e.filter(function(e){return Jt(e,t,{width:1/0,height:1/0})}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function ve(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof G){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof r?"detail"==i&&(n[i]=r):i in Event||(n[i]=r)}return n}if(e instanceof TimeRanges)for(n={__type__:"TimeRanges",length:e.length,start:[],end:[]},i=0;i<e.length;++i)n.start.push(e.start(i)),n.end.push(e.end(i));else n="number"==typeof e?isNaN(e)?"NaN":isFinite(e)?e:0>e?"-Infinity":"Infinity":e;return n}})}function ge(t){return JSON.parse(t,function(t,e){return"NaN"==e?NaN:"-Infinity"==e?-1/0:"Infinity"==e?1/0:e&&"object"==typeof e&&"TimeRanges"==e.__type__?be(e):e})}function be(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ye(t,e,i,n,r,a){this.J=t,this.g=e,this.L=i,this.j=!1,this.C=n,this.D=r,this.w=a,this.b=this.h=!1,this.B="",this.i=null,this.l=this.mc.bind(this),this.m=this.Cd.bind(this),this.a={video:{},player:{}},this.s=0,this.c={},this.f=null}function Te(t){var e=Eo;e.removeUpdateListener(t.l),e.removeMessageListener("urn:x-cast:com.google.shaka.v2",t.m)}function we(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new h(1,7,7e3))}}function Ee(t){t=ve(t),Eo.sendMessage("urn:x-cast:com.google.shaka.v2",t,function(){},u)}function Se(){this.vb=new j,this.bb=this}function Ae(t,e,i){Se.call(this),this.c=t,this.b=e,this.i=this.g=this.f=this.j=this.h=null,this.a=new ye(i,this.ve.bind(this),this.we.bind(this),this.xe.bind(this),this.ye.bind(this),this.fc.bind(this)),ke(this)}function ke(t){t.a.init(),t.i=new B,ho.forEach(function(t){F(this.i,this.c,t,this.Me.bind(this))}.bind(t)),po.forEach(function(t){F(this.i,this.b,t,this.Yd.bind(this))}.bind(t)),t.h={};for(var e in t.c)Object.defineProperty(t.h,e,{configurable:!1,enumerable:!0,get:t.Le.bind(t,e),set:t.Ne.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.Xd.bind(t,e)});t.f=new Se,t.f.bb=t.h,t.g=new Se,t.g.bb=t.j}function Ie(t,e,i,n){Se.call(this),this.a=t,this.b=e,this.j={video:t,player:e},this.l=i||function(){},this.m=n||function(t){return t},this.i=!1,this.f=!0,this.h=this.g=this.c=null,Pe(this)}function Pe(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.tc.bind(e),i.onSenderDisconnected=e.tc.bind(e),i.onSystemVolumeChanged=e.Xc.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.g.onMessage=e.xd.bind(e),e.c=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.c.onMessage=e.Ld.bind(e),i.start(),ho.forEach(function(t){this.a.addEventListener(t,this.wc.bind(this,"video"))}.bind(e)),po.forEach(function(t){this.b.addEventListener(t,this.wc.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.b.Sb(3840,2160):e.b.Sb(1920,1080),e.b.addEventListener("loading",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("playing",function(){this.f=!1,_e(this)}.bind(e)),e.a.addEventListener("pause",function(){_e(this)}.bind(e)),e.b.addEventListener("unloading",function(){this.f=!0,_e(this)}.bind(e)),e.a.addEventListener("ended",function(){t.setTimeout(function(){this.a&&this.a.ended&&(this.f=!0,_e(this))}.bind(this),5e3)}.bind(e))}function _e(t){Promise.resolve().then(function(){this.dispatchEvent(new G("caststatuschanged")),Ne(this,0)}.bind(t))}function xe(t,e,i){for(var n in e.player)t.b[n](e.player[n]);t.l(i),i=Promise.resolve();var r=t.a.autoplay;e.manifest&&(t.a.autoplay=!1,i=t.b.load(e.manifest,e.startTime),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(t))),i.then(function(){var t;for(t in e.video){var i=e.video[t];this.a[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.b[t](i);this.a.autoplay=r,e.manifest&&(this.a.play(),Ne(this,0))}.bind(t))}function Re(t,e,i,n){t.i&&(t=ve(e),n?i.getCastChannel(n).send(t):i.broadcast(t))}function Ne(t,e,i){var n=So,n={mediaSessionId:0,playbackRate:t.a.playbackRate,playerState:t.f?n.IDLE:t.b.Oa?n.Lc:t.a.paused?n.Mc:n.Nc,currentTime:t.a.currentTime,supportedMediaCommands:15,volume:{level:t.a.volume,muted:t.a.muted}};i&&(n.media=i),Re(t,{requestId:e,type:"MEDIA_STATUS",status:[n]},t.g)}function De(t,e){var i=Le(t,e);return 1!=i.length?null:i[0]}function Le(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function Ce(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function Me(t,e,i,n){var r=null;return t=t.getAttribute(e),null!=t&&(r=i(t)),null==r?void 0!=n?n:null:r}function Oe(t){return t?(/^\d+\-\d+\-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function Ue(t){return t&&(t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(t))?(t=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(t)?t:null):null}function je(t){var e=/([0-9]+)-([0-9]+)/.exec(t);return e?(t=Number(e[1]),isFinite(t)?(e=Number(e[2]),isFinite(e)?{start:t,end:e}:null):null):null}function Be(t){return t=Number(t),t%1?null:t}function Fe(t){return t=Number(t),!(t%1)&&0<t?t:null}function Ve(t){return t=Number(t),!(t%1)&&0<=t?t:null}function He(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function Ke(t,e,i){t=Xe(t);var n=null,r=[],a=[],s=t.map(function(t){return t.keyId}).filter(R);if(s.length&&1<s.filter(N).length)throw new h(2,4,4010);i||(a=t.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.Dc||(n=t.init||n,!1)}),a.length&&(r=qe(n,e,a),r.length||(r=[X("",n)]))),!t.length||!i&&a.length||(r=z(Ao).map(function(t){return X(t,n)}));var o=s[0]||null;return o&&r.forEach(function(t){t.initData.forEach(function(t){t.keyId=o})}),{ac:o,Se:n,drmInfos:r,dc:!0}}function Ge(t,e,i,n){var r=Ke(t,e,n);if(i.dc)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!r.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=r.drmInfos),i.dc=!1;else if(0<r.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return r.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new h(2,4,4008);return r.ac||i.ac}function qe(t,e,i){return i.map(function(i){var n=Ao[i.Dc];return n?[X(n,i.init||t)]:e(i.node)||[]}).reduce(_,[])}function Xe(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=Le(t,"cenc:pssh").map(Ce);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new h(2,4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:ut(t),keyId:null}})}catch(t){throw new h(2,4,4007)}return{node:t,Dc:e,keyId:i,init:0<r.length?r:null}}).filter(R)}function Ye(e,i,n,r,a){null!=a&&(a=Math.round(a));var s={RepresentationID:i,Number:n,Bandwidth:r,Time:a};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=s[i];return null==r?e:("RepresentationID"==i&&n&&(n=void 0),e=r.toString(),n=t.parseInt(n,10)||1,Array(Math.max(0,n-e.length)+1).join("0")+e)})}function ze(t,e){var i=$e(t,e,"timescale"),n=1;i&&(n=Fe(i)||1),i=$e(t,e,"duration"),(i=Fe(i||""))&&(i/=n);var r=$e(t,e,"startNumber"),a=Number($e(t,e,"presentationTimeOffset"))||0,s=Ve(r||"");null!=r&&null!=s||(s=1);var o=We(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=t.S.duration||1/0,o=Le(o,"S"),h=[],c=0,l=0;l<o.length;++l){var d=o[l],f=Me(d,"t",Ve),p=Me(d,"d",Ve),d=Me(d,"r",Be);if(null!=f&&(f-=a),!p)break;if(f=null!=f?f:c,0>(d=d||0))if(l+1<o.length){if(null==(d=Me(o[l+1],"t",Ve)))break;if(f>=d)break;d=Math.ceil((d-f)/p)-1}else{if(1/0==u)break;if(f/r>=u)break;d=Math.ceil((u*r-f)/p)-1}0<h.length&&f!=c&&(h[h.length-1].end=f/r);for(var m=0;m<=d;++m)c=f+p,h.push({start:f/r,end:c/r,Je:f}),f=c}r=h}return{timescale:n,P:i,ya:s,Z:a/n||0,Xb:a,H:r}}function $e(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function We(t,e,i){return[e(t.A),e(t.V),e(t.Y)].filter(R).map(function(t){return De(t,i)}).reduce(function(t,e){return t||e})}function Je(t,e){var i=new DOMParser;try{var n=Z(t),r=i.parseFromString(n,"text/xml")}catch(t){}if(r&&r.documentElement.tagName==e)var a=r.documentElement;return a&&0<a.getElementsByTagName("parsererror").length?null:a}function Qe(t,e,i,n,r,a){for(var s=t.getAttribute("xlink:href"),o=t.getAttribute("xlink:actuate")||"onRequest",u=0;u<t.attributes.length;u++){var c=t.attributes[u].nodeName;-1!=c.indexOf("xlink:")&&(t.removeAttribute(c),--u)}if(5<=a)return Promise.reject(new h(2,4,4028));if("onLoad"!=o)return Promise.reject(new h(2,4,4027));var l=q([n],[s]);return r.request(0,L(l,e)).then(function(n){if(!(n=Je(n.data,t.tagName)))return Promise.reject(new h(2,4,4001,s));for(;t.childNodes.length;)t.removeChild(t.childNodes[0]);for(;n.childNodes.length;){var o=n.childNodes[0];n.removeChild(o),t.appendChild(o)}for(o=0;o<n.attributes.length;o++){var u=n.attributes[o].nodeName,c=n.getAttribute(u);t.setAttribute(u,c)}return Ze(t,e,i,l[0],r,a+1)}.bind(t))}function Ze(t,e,i,n,r,a){if(a=a||0,t.getAttribute("xlink:href")){var s=Qe(t,e,i,n,r,a);return i&&(s=s.catch(function(){return Ze(t,e,i,n,r,a)})),s}for(s=0;s<t.childNodes.length;s++){var o=t.childNodes[s];o instanceof Element&&"urn:mpeg:dash:resolve-to-zero:2013"==o.getAttribute("xlink:href")&&(t.removeChild(o),--s)}for(var u=[],s=0;s<t.childNodes.length;s++)o=t.childNodes[s],o.nodeType==Node.ELEMENT_NODE&&(o=Ze(o,e,i,n,r,a),u.push(o));return Promise.all(u).then(function(){return t})}function ti(t,e,i){this.a=t,this.T=e,this.K=i}function ei(t,e,i,n,r,a){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.T=r,this.K=a}function ii(t,e){this.O=t,this.a=e==ko,this.v=0}function ni(){throw new h(2,3,3e3)}function ri(t,e,i){var n=new Uint8Array(i-e);return n.set(new Uint8Array(t.O.buffer,e,i-e)),n.buffer}function ai(){this.b=[],this.a=[]}function si(t){for(;t.u.da();)t.Ta.qb(t.start,t.u)}function oi(t){for(var e=t.u.F();0<e;--e)t.Ta.qb(t.start,t.u)}function ui(t){return function(e){t(e.u.Ja(e.u.O.byteLength-e.u.v))}}function hi(t){for(var e=0,i=0;i<t.length;i++)e=e<<8|t.charCodeAt(i);return e}function ci(t,e,i,n){var r,a=(new ai).ca("sidx",function(t){r=li(e,n,i,t)});if(t&&a.parse(t),r)return r;throw new h(2,3,3004)}function li(t,e,i,n){var r=[];n.u.I(4);var a=n.u.F();if(!a)throw new h(2,3,3005);if(n.version)var s=n.u.Va(),o=n.u.Va();else s=n.u.F(),o=n.u.F();n.u.I(2);var u=n.u.yc();for(t=t+n.size+o,o=0;o<u;o++){var c=n.u.F(),l=(2147483648&c)>>>31,c=2147483647&c,d=n.u.F();if(n.u.I(4),1==l)throw new h(2,3,3006);r.push(new ei(r.length,s/a-e,(s+d)/a-e,function(){return i},t,t+c-1)),s+=d,t+=c}return r}function di(t){this.a=t}function fi(t,e){for(var i;t.a.length&&(i=t.a[t.a.length-1],i.startTime>=e);)t.a.pop();for(;t.a.length&&(i=t.a[0],0>=i.endTime);)t.a.shift();t.a.length&&(i=t.a[0],i.startTime<no&&(t.a[0]=new ei(i.position,0,i.endTime,i.a,i.T,i.K)),i=t.a[t.a.length-1],t.a[t.a.length-1]=new ei(i.position,i.startTime,e,i.a,i.T,i.K))}function pi(t){this.b=t,this.a=new ii(t,0),Io||(Io=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function mi(t){var e=vi(t);if(7<e.length)throw new h(2,3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=vi(t);t:{for(n=0;n<Io.length;n++)if(lt(i,Io[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.v;else{if(8==i.length&&224&i[1])throw new h(2,3,3001);for(var n=i[0]&(1<<8-i.length)-1,r=1;r<i.length;r++)n=256*n+i[r];i=n}return i=t.a.v+i<=t.b.byteLength?i:t.b.byteLength-t.a.v,n=new DataView(t.b.buffer,t.b.byteOffset+t.a.v,i),t.a.I(i),new gi(e,n)}function vi(t){var e,i=t.a.Mb();for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new h(2,3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=t.a.Mb();return n}function gi(t,e){this.id=t,this.a=e}function bi(t){if(8<t.a.byteLength)throw new h(2,3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new h(2,3,3001);for(var e=0,i=0;i<t.a.byteLength;i++)var n=t.a.getUint8(i),e=256*e+n;return e}function yi(){}function Ti(t,e,i,n,r,a){function s(){return r}var o=[];t=new pi(t.a);for(var u=null,h=null;t.da();){var c=mi(t);if(187==c.id){var l=wi(c);l&&(c=i*l.Ke,l=e+l.ce,null!=u&&o.push(new ei(o.length,u-a,c-a,s,h,l-1)),u=c,h=l)}}return null!=u&&o.push(new ei(o.length,u-a,n-a,s,h,null)),o}function wi(t){var e=new pi(t.a);if(t=mi(e),179!=t.id)throw new h(2,3,3013);if(t=bi(t),e=mi(e),183!=e.id)throw new h(2,3,3012);for(var e=new pi(e.a),i=0;e.da();){var n=mi(e);if(241==n.id){i=bi(n);break}}return{Ke:t,ce:i}}function Ei(t,e){var i=We(t,e,"Initialization");if(!i)return null;var n=t.A.$,r=i.getAttribute("sourceURL");r&&(n=q(t.A.$,[r]));var r=0,a=null;return(i=Me(i,"range",je))&&(r=i.start,a=i.end),new ti(function(){return n},r,a)}function Si(t,e){var i=Number($e(t,ki,"presentationTimeOffset"))||0,n=$e(t,ki,"timescale"),r=1;n&&(r=Fe(n)||1);var i=i/r||0,n=Ei(t,ki),a=t.A.contentType,r=t.A.mimeType.split("/")[1];if("text"!=a&&"mp4"!=r&&"webm"!=r)throw new h(2,4,4006);if("webm"==r&&!n)throw new h(2,4,4005);var a=We(t,ki,"RepresentationIndex"),s=$e(t,ki,"indexRange"),o=t.A.$,s=je(s||"");if(a){var u=a.getAttribute("sourceURL");u&&(o=q(t.A.$,[u])),s=Me(a,"range",je,s)}if(!s)throw new h(2,4,4002);return r=Ai(t,e,n,o,s.start,s.end,r,i),{createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:n,Z:i}}function Ai(t,e,i,n,r,a,s,o){var u=t.presentationTimeline,h=!t.Ca||!t.S.Ab,c=t.S.duration,l=e,d=null;return{createSegmentIndex:function(){var t=[l(n,r,a),"webm"==s?l(i.a(),i.T,i.K):null];return l=null,Promise.all(t).then(function(t){var e=t[0];t=t[1]||null,e="mp4"==s?ci(e,r,n,o):(new yi).parse(e,t,n,o),u.Ga(0,e),d=new di(e),h&&fi(d,c)})},findSegmentPosition:function(t){return d.find(t)},getSegmentReference:function(t){return d.get(t)}}}function ki(t){return t.Wa}function Ii(t,e){var i=Ei(t,Pi),n=xi(t),r=ze(t,Pi),a=r.ya;a||(a=1);var s=0;if(r.P?s=r.P*(a-1):r.H&&0<r.H.length&&(s=r.H[0].start),n={P:r.P,startTime:s,ya:a,Z:r.Z,H:r.H,Fa:n},!n.P&&!n.H&&1<n.Fa.length)throw new h(2,4,4002);if(!n.P&&!t.S.duration&&!n.H&&1==n.Fa.length)throw new h(2,4,4002);if(n.H&&!n.H.length)throw new h(2,4,4002);return a=r=null,t.Y.id&&t.A.id&&(a=t.Y.id+","+t.A.id,r=e[a]),s=_i(t.S.duration,n.ya,t.A.$,n),r?(r.ob(s),r.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),r=new di(s),a&&t.Ca&&(e[a]=r)),t.Ca&&t.S.Ab||fi(r,t.S.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:i,Z:n.Z}}function Pi(t){return t.pa}function _i(t,e,i,n){var r=n.Fa.length;n.H&&n.H.length!=n.Fa.length&&(r=Math.min(n.H.length,n.Fa.length));for(var a=[],s=n.startTime,o=0;o<r;o++){var u=n.Fa[o],h=q(i,[u.sd]),c=null!=n.P?s+n.P:n.H?n.H[o].end:s+t;a.push(new ei(o+e,s,c,function(t){return t}.bind(null,h),u.start,u.end)),s=c}return a}function xi(t){return[t.A.pa,t.V.pa,t.Y.pa].filter(R).map(function(t){return Le(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(e){e.getAttribute("indexRange")&&!t.ic&&(t.ic=!0);var i=e.getAttribute("media");return e=Me(e,"mediaRange",je,{start:0,end:null}),{sd:i,start:e.start,end:e.end}})}function Ri(t,e,i,n){var r=Ci(t),a=ze(t,Ni),s=$e(t,Ni,"media"),o=$e(t,Ni,"index");if(a={P:a.P,timescale:a.timescale,ya:a.ya,Z:a.Z,Xb:a.Xb,H:a.H,Db:s,Ra:o},s=0+(a.Ra?1:0),s+=a.H?1:0,!(s+=a.P?1:0))throw new h(2,4,4002);if(1!=s&&(a.Ra&&(a.H=null),a.P=null),!a.Ra&&!a.Db)throw new h(2,4,4002);if(a.Ra){if("mp4"!=(i=t.A.mimeType.split("/")[1])&&"webm"!=i)throw new h(2,4,4006);if("webm"==i&&!r)throw new h(2,4,4005);n=Ye(a.Ra,t.A.id,null,t.bandwidth||null,null),n=q(t.A.$,[n]),t=Ai(t,e,r,n,0,null,i,a.Z)}else a.P?(n||t.presentationTimeline.Eb(a.P),t=Di(t,a)):(n=e=null,t.Y.id&&t.A.id&&(n=t.Y.id+","+t.A.id,e=i[n]),s=Li(t,a),e?(e.ob(s),e.xb(t.presentationTimeline.ka()-t.S.start)):(t.presentationTimeline.Ga(0,s),e=new di(s),n&&t.Ca&&(i[n]=e)),t.Ca&&t.S.Ab||fi(e,t.S.duration),t={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e)});return{createSegmentIndex:t.createSegmentIndex,findSegmentPosition:t.findSegmentPosition,getSegmentReference:t.getSegmentReference,initSegmentReference:r,Z:a.Z}}function Ni(t){return t.Xa}function Di(t,e){var i=t.S.duration,n=e.P,r=e.ya,a=e.timescale,s=e.Db,o=t.bandwidth||null,u=t.A.id,h=t.A.$;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0>t||i&&t>=i?null:Math.floor(t/n)},getSegmentReference:function(t){var e=t*n;return 0>e||i&&e>=i?null:new ei(t,e,e+n,function(){var i=Ye(s,u,t+r,o,e*a);return q(h,[i])},0,null)}}}function Li(t,e){for(var i=[],n=0;n<e.H.length;n++){var r=n+e.ya;i.push(new ei(r,e.H[n].start,e.H[n].end,function(t,e,i,n,r,a){return t=Ye(t,e,r,i,a),q(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Db,t.A.id,t.bandwidth||null,t.A.$,r,e.H[n].Je+e.Xb),0,null))}return i}function Ci(t){var e=$e(t,Ni,"initialization");if(!e)return null;var i=t.A.id,n=t.bandwidth||null,r=t.A.$;return new ti(function(){var t=Ye(e,i,null,n,null);return q(r,[t])},0,null)}function Mi(){var t,e={};for(t in Po)e[t]=!0;for(t in _o)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!Po[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!_o[t]}),e}function Oi(t,e,i,n){var r=n;return r||(n=new c(t).ba.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=_o[n])),r?Promise.resolve(r):(i=L([t],i),i.method="HEAD",e.request(0,i).then(function(e){return(e=e.headers["content-type"])&&(e=e.toLowerCase()),(r=Po[e])?r:Promise.reject(new h(2,4,4e3,t))},function(t){return t.severity=2,Promise.reject(t)}))}function Ui(t,e){this.c=t,this.j=e,this.f=this.a=1/0,this.b=1,this.i=0,this.h=!0,this.g=0}function ji(){this.a=this.b=null,this.g=[],this.c=null,this.i=[],this.h=1,this.j={},this.l=0,this.f=null}function Bi(t){return t.a.networkingEngine.request(0,L(t.g,t.b.retryParameters),function(){return!this.a}.bind(t)).then(function(t){if(this.a)return Fi(this,t.data,t.uri)}.bind(t))}function Fi(t,e,i){if(!(e=Je(e,"MPD")))throw new h(2,4,4001,i);return Ze(e,t.b.retryParameters,t.b.dash.xlinkFailGracefully,i,t.a.networkingEngine).then(function(t){return Vi(this,t,i)}.bind(t))}function Vi(t,e,i){i=[i];var n=Le(e,"Location").map(Ce).filter(R);0<n.length&&(i=t.g=n),n=Le(e,"BaseURL").map(Ce),i=q(i,n);var r=Me(e,"minBufferTime",Ue);t.l=Me(e,"minimumUpdatePeriod",Ue,-1);var a=Me(e,"availabilityStartTime",Oe),n=Me(e,"timeShiftBufferDepth",Ue),s=Me(e,"suggestedPresentationDelay",Ue),o=Me(e,"maxSegmentDuration",Ue),u=e.getAttribute("type")||"static";if(t.c)var h=t.c.presentationTimeline;else{var c=Math.max(10,1.5*r);h=new Ui(a,null!=s?s:c)}var a=Hi(t,{Ca:"static"!=u,presentationTimeline:h,Y:null,S:null,V:null,A:null,bandwidth:0,ic:!1},i,e),s=a.duration,l=a.periods;return h.rb("static"==u),"static"!=u&&a.bc||h.ga(s||1/0),h.Ic(null!=n?n:1/0),h.Eb(o||1),t.c?Promise.resolve():(e=Le(e,"UTCTiming"),Ji(t,i,e,h.R()).then(function(t){this.a&&(h.Gc(t),this.c={presentationTimeline:h,periods:l,offlineSessionIds:[],minBufferTime:r||0})}.bind(t)))}function Hi(t,e,i,n){var r=Me(n,"mediaPresentationDuration",Ue),a=[],s=0;n=Le(n,"Period");for(var o=0;o<n.length;o++){var u=n[o],s=Me(u,"start",Ue,s),h=Me(u,"duration",Ue),c=null;if(o!=n.length-1){var l=Me(n[o+1],"start",Ue);null!=l&&(c=l-s)}else null!=r&&(c=r-s);if(null==c&&(c=h),u=Ki(t,e,i,{start:s,duration:c,node:u,Ab:null==c||o==n.length-1}),a.push(u),h=e.Y.id,-1==t.i.indexOf(h)&&(t.i.push(h),t.c&&(t.a.filterNewPeriod(u),t.c.periods.push(u))),null==c){s=null;break}s+=c}return t.c||t.a.filterAllPeriods(a),null!=r?{periods:a,duration:r,bc:!1}:{periods:a,duration:s,bc:!0}}function Ki(t,e,i,n){e.Y=Yi(n.node,null,i),e.S=n,e.Y.id||(e.Y.id="__shaka_period_"+n.start),Le(n.node,"EventStream").forEach(t.Vd.bind(t,n.start,n.duration)),i=Le(n.node,"AdaptationSet").map(t.Td.bind(t,e)).filter(R);var r=i.map(function(t){return t.ee}).reduce(_,[]),a=r.filter(N);if(e.Ca&&r.length!=a.length)throw new h(2,4,4018);var s=i.filter(function(t){return!t.Wb});if(i.filter(function(t){return t.Wb}).forEach(function(t){var e=t.streams[0],i=t.Wb;s.forEach(function(t){t.id==i&&t.streams.forEach(function(t){t.trickModeVideo=e})})}),r=Gi(s,"video"),a=Gi(s,"audio"),!r.length&&!a.length)throw new h(2,4,4004);for(a.length||(a=[null]),r.length||(r=[null]),e=[],i=0;i<a.length;i++)for(var o=0;o<r.length;o++)qi(t,a[i],r[o],e);for(t=Gi(s,"text"),r=[],i=0;i<t.length;i++)r.push.apply(r,t[i].streams);return{startTime:n.start,textStreams:r,variants:e}}function Gi(t,e){return t.filter(function(t){return t.contentType==e})}function qi(t,e,i,n){if(e||i)if(e&&i){var r=e.drmInfos,a=i.drmInfos;if(r.length&&a.length?0<xt(r,a).length:1)for(var s=xt(e.drmInfos,i.drmInfos),r=0;r<e.streams.length;r++)for(var o=0;o<i.streams.length;o++)a=(i.streams[o].bandwidth||0)+(e.streams[r].bandwidth||0),a={id:t.h++,language:e.language,primary:e.Cb||i.Cb,audio:e.streams[r],video:i.streams[o],bandwidth:a,drmInfos:s,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}else for(s=e||i,r=0;r<s.streams.length;r++)a=s.streams[r].bandwidth||0,a={id:t.h++,language:s.language||"und",primary:s.Cb,audio:e?s.streams[r]:null,video:i?s.streams[r]:null,bandwidth:a,drmInfos:s.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}function Xi(e,i){0>e.l||(e.f=t.setTimeout(e.ze.bind(e),1e3*Math.max(Math.max(3,e.l)-i,0)))}function Yi(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",containsEmsgBoxes:!1,frameRate:void 0,Fb:null},i=i||e.$;var n=Le(t,"BaseURL").map(Ce),r=t.getAttribute("contentType")||e.contentType,a=t.getAttribute("mimeType")||e.mimeType,s=t.getAttribute("codecs")||e.codecs,o=Me(t,"frameRate",He)||e.frameRate,u=!!Le(t,"InbandEventStream").length,h=Le(t,"AudioChannelConfiguration"),h=zi(h)||e.Fb;return r||(r=Qi(a,s)),{$:q(i,n),Wa:De(t,"SegmentBase")||e.Wa,pa:De(t,"SegmentList")||e.pa,Xa:De(t,"SegmentTemplate")||e.Xa,width:Me(t,"width",Ve)||e.width,height:Me(t,"height",Ve)||e.height,contentType:r,mimeType:a,codecs:s,frameRate:o,containsEmsgBoxes:u||e.containsEmsgBoxes,id:t.getAttribute("id"),Fb:h}}function zi(t){for(var e=0;e<t.length;++e){var i=t[e],n=i.getAttribute("schemeIdUri");if(n&&(i=i.getAttribute("value")))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return i.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(n=parseInt(i,10)))continue;return n;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(n=parseInt(i,16)){for(t=0;n;)1&n&&++t,n>>=1;return t}}}return null}function $i(t){var e=0+(t.Wa?1:0);return e+=t.pa?1:0,(e+=t.Xa?1:0)?(1!=e&&(t.Wa&&(t.pa=null),t.Xa=null),!0):"text"==t.contentType||"application"==t.contentType}function Wi(t,e,i,n){return e=q(e,[i]),e=L(e,t.b.retryParameters),e.method=n,t.a.networkingEngine.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=Z(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function Ji(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.b.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),P(i,function(t){var i=t.value;switch(t.scheme){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return Wi(this,e,i,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return Wi(this,e,i,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return t=Date.parse(i),isNaN(t)?0:t-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:return Promise.reject()}}.bind(t)).catch(function(){return 0})}function Qi(t,e){return ao[Q(t,e)]?"text":t.split("/")[0]}function Zi(t,e,i,n){this.uri=t,this.type=e,this.U=i,this.segments=n||null}function tn(t,e,i,n){this.id=t,this.name=e,this.a=i,this.value=n||null}function en(t,e){this.name=t,this.value=e}function nn(t,e,i){return i=i||null,(t=t.getAttribute(e))?t.value:i}function rn(t,e){this.U=e,this.uri=t}function an(t,e){return t.filter(function(t){return t.name==e})}function sn(t,e){var i=an(t,e);return i.length?i[0]:null}function on(t,e,i){return t.filter(function(t){var n=t.getAttribute("TYPE");return t=t.getAttribute("GROUP-ID"),n.value==e&&t.value==i})}function un(t){this.b=t,this.a=0}function hn(t,e){e.lastIndex=t.a;var i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,he:i}:null;return t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.he):null}function cn(t){return t.a==t.b.length?null:(t=hn(t,/[^ \t\n]*/gm))?t[0]:null}function ln(){this.a=0}function dn(t,e,i){e=Z(e),e=e.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var n=e.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(n[0]))throw new h(2,4,4015);e=0;for(var r=[],a=1;a<n.length;)if(/^#(?!EXT)/m.test(n[a]))a+=1;else{var s=n[a];if(s=pn(t.a++,s),0<=xo.indexOf(s.name))e=1;else if(0<=Ro.indexOf(s.name)){if(1!=e)throw new h(2,4,4017);return n=n.splice(a,n.length-a),t=fn(t,n,r),new Zi(i,e,r,t)}r.push(s),a+=1,"EXT-X-STREAM-INF"==s.name&&(s.a.push(new en("URI",n[a])),a+=1)}return new Zi(i,e,r)}function fn(t,e,i){var n=[],r=[];return e.forEach(function(t){/^(#EXT)/.test(t)?(t=pn(this.a++,t),0<=xo.indexOf(t.name)?i.push(t):r.push(t)):/^#(?!EXT)/m.test(t)||(n.push(new rn(t.trim(),r)),r=[])}.bind(t)),n}function pn(t,e){var i=e.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!i)throw new h(2,4,4016);var n=i[1],r=i[2],i=[];if(r&&0<=r.indexOf("="))for(var a,r=new un(r),s=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;a=hn(r,s);)i.push(new en(a[1],a[2]||a[3]));else if(r)return new tn(t,n,i,r);return new tn(t,n,i)}function mn(t){return new Promise(function(e){var i=mn.parse(t);e({uri:t,data:i.data,headers:{"content-type":i.contentType}})})}function vn(){this.h=this.b=null,this.D=1,this.g={},this.C={},this.j={},this.s={},this.a=null,this.m="",this.w=new ln,this.i=this.c=null,this.f=!1,this.B=null,this.l=0}function gn(t,e,i){Bn(t,i).then(function(t){if(t=dn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);for(var i=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),i=Nn(this,t,i?Number(i.value):0),n=e.Bb,r=[],a=n.endTime,s=0;s<i.length;s++){var o=i[s];if(o.position>n.position){var u=o.endTime-o.startTime,c=a,l=a+u,a=a+u;r.push(new ei(o.position,c,l,o.a,o.T,o.K))}}i=r,e.je.ob(i),i.length&&(e.Bb=i[i.length-1]),sn(t.U,"EXT-X-ENDLIST")&&(t=e.Bb.endTime,Vn(this,!1),this.a.ga(t))}.bind(t))}function bn(t,e,i){if(e=dn(t.w,e,i),0!=e.type)throw new h(2,4,4022);return yn(t,e).then(function(t){this.b.filterAllPeriods([t]),this.f&&this.a.Hc(3*this.l),this.B={presentationTimeline:this.a,periods:[t],offlineSessionIds:[],minBufferTime:0}}.bind(t))}function yn(t,e){var i=e.U,n=an(e.U,"EXT-X-MEDIA").filter(function(t){return"SUBTITLES"==Un(t,"TYPE")}.bind(t)).map(function(t){return Sn(this,t,e)}.bind(t));return Promise.all(n).then(function(t){var n=an(i,"EXT-X-STREAM-INF").map(function(t){return Tn(this,t,e)}.bind(this));return Promise.all(n).then(function(e){return e=e.reduce(_,[]),this.f||Dn(this,e),{startTime:0,variants:e,textStreams:t}}.bind(this))}.bind(t))}function Tn(t,e,i){var n=nn(e,"CODECS","avc1.42E01E,mp4a.40.2").split(","),r=e.getAttribute("RESOLUTION"),a=null,s=null,o=nn(e,"FRAME-RATE"),u=Number(Un(e,"BANDWIDTH"));if(r)var h=r.value.split("x"),a=h[0],s=h[1];var c=On(t,i);i=an(i.U,"EXT-X-MEDIA");var l=nn(e,"AUDIO"),d=nn(e,"VIDEO");if(l?i=on(i,"AUDIO",l):d&&(i=on(i,"VIDEO",d)),h=Ln("text",n)){var f=nn(e,"SUBTITLES");f&&(f=on(i,"SUBTITLES",f),f.length&&(t.g[f[0].id].stream.codecs=h)),n.splice(n.indexOf(h),1)}i=i.map(function(t){return An(this,t,n,c)}.bind(t));var p=[],m=[];return Promise.all(i).then(function(t){if(l?p=t:d&&(m=t),p.length||m.length)if(p.length)if(Un(e,"URI")==p[0].Pb){t="audio";var i=!0}else t="video";else t="audio";else i=!1,1==n.length?(t=Ln("video",n),t=r||o||t?"video":"audio"):(t="video",n=[n.join(",")]);return i?Promise.resolve():In(this,e,n,t,c)}.bind(t)).then(function(t){return t&&("audio"==t.stream.type?p=[t]:m=[t]),wn(this,p,m,u,a,s,o)}.bind(t))}function wn(t,e,i,n,r,a,s){i.forEach(function(t){(t=t.stream)&&(t.width=Number(r)||void 0,t.height=Number(a)||void 0,t.frameRate=Number(s)||void 0)}.bind(t)),e.length||(e=[null]),i.length||(i=[null]);for(var o=[],u=0;u<e.length;u++)for(var h=0;h<i.length;h++){var c=e[u]?e[u].stream:null,l=i[h]?i[h].stream:null,d=e[u]?e[u].drmInfos:null,f=i[h]?i[h].drmInfos:null;if(c&&l){if(!(d.length&&f.length?0<xt(d,f).length:1))continue;var p=xt(d,f)}else c?p=d:l&&(p=f);d=(i[u]?i[u].Pb:"")+" - "+(e[u]?e[u].Pb:""),t.C[d]||(c=En(t,c,l,n,p),o.push(c),t.C[d]=c)}return o}function En(t,e,i,n,r){return{id:t.D++,language:e?e.language:"und",primary:!!e&&e.primary||!!i&&i.primary,audio:e,video:i,bandwidth:n,drmInfos:r,allowedByApplication:!0,allowedByKeySystem:!0}}function Sn(t,e,i){return Un(e,"TYPE"),i=On(t,i),An(t,e,[],i).then(function(t){return t.stream})}function An(t,e,i,n){if(t.g[e.id])return Promise.resolve().then(function(){return this.g[e.id]}.bind(t));var r=Un(e,"TYPE").toLowerCase();"subtitles"==r&&(r="text");var a=Wt(nn(e,"LANGUAGE","und")),s=nn(e,"NAME"),o=e.getAttribute("DEFAULT"),u=e.getAttribute("AUTOSELECT"),h=nn(e,"CHANNELS"),h="audio"==r?kn(h):null,c=Un(e,"URI"),c=q([t.m],[c])[0];return Pn(t,c,i,r,n,a,!!o||!!u,s,h).then(function(t){return this.g[e.id]=t,this.s[c]=t}.bind(t))}function kn(t){return t?(t=t.split("/")[0],parseInt(t,10)):null}function In(t,e,i,n,r){var a=Un(e,"URI"),a=q([t.m],[a])[0];return Pn(t,a,i,n,r,"und",!1,null,null).then(function(t){return this.s[a]=t}.bind(t))}function Pn(t,e,i,n,r,a,s,o,u){var c=e;return e=q([t.m],[e])[0],Bn(t,e).then(function(t){if(t=dn(this.w,t.data,t.uri),1!=t.type)throw new h(2,4,4017);var e=sn(t.U,"EXT-X-MEDIA-SEQUENCE"),l=Nn(this,t,e?Number(e.value):0),d=new di(l);_n(this,t),this.a||xn(this,l[l.length-1].endTime),r=On(this,t)||r;var f=null;if("text"!=n&&(f=Rn(t)),this.a.Ga(0,l),!this.f){var e=l[l.length-1].endTime-l[0].startTime,p=this.a.W();(1/0==p||p<e)&&this.a.ga(e)}var m=Cn(n,i),v=void 0;"text"==n&&(v="subtitle");var g=[];t.segments.forEach(function(t){t=an(t.U,"EXT-X-KEY"),g.push.apply(g,t)});var b=!1,y=[],T=null;if(g.forEach(function(t){if("NONE"!=Un(t,"METHOD")){b=!0;var e=Un(t,"KEYFORMAT");(t=(e=Lo[e])?e(t):null)&&(t.keyIds.length&&(T=t.keyIds[0]),y.push(t))}}),b&&!y.length)throw new h(2,4,4026);return Mn(this,n,m,l[0].a()[0]).then(function(t){return t={id:this.D++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:d.find.bind(d),getSegmentReference:d.get.bind(d),initSegmentReference:f,presentationTimeOffset:r||0,mimeType:t,codecs:m,kind:v,encrypted:b,keyId:T,language:a,label:o||null,type:n,primary:s,trickModeVideo:null,containsEmsgBoxes:!1,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:u},this.j[t.id]=d,{stream:t,je:d,drmInfos:y,Pb:c,Bb:l[l.length-1]}}.bind(this))}.bind(t))}function _n(t,e){var i=sn(e.U,"EXT-X-PLAYLIST-TYPE");if(sn(e.U,"EXT-X-ENDLIST")||i&&"VOD"==i.value)Vn(t,!1);else{if(!i)throw new h(2,4,4029);i=jn(e.U,"EXT-X-TARGETDURATION"),i=Number(i.value),t.c?t.c>i&&(t.c=i):(Vn(t,!0),t.c=i),t.l=Math.max(i,t.l)}}function xn(t,e){var i=null,n=0;t.f&&(i=Date.now()/1e3-e,n=3*t.l),t.a=new Ui(i,n),t.a.rb(!t.f)}function Rn(t){var e=an(t.U,"EXT-X-MAP");if(!e.length)return null;if(1<e.length)throw new h(2,4,4020);var e=e[0],i=Un(e,"URI"),n=q([t.uri],[i])[0];return t=0,i=null,(e=nn(e,"BYTERANGE"))&&(t=e.split("@"),e=Number(t[0]),t=Number(t[1]),i=t+e-1),new ti(function(){return[n]},t,i)}function Nn(t,e,i){var n=e.segments,r=[];return n.forEach(function(t){var a,s=t.U,o=q([e.uri],[t.uri])[0],u=jn(s,"EXTINF").value.split(","),u=Number(u[0]);a=(t=n.indexOf(t))?r[t-1].endTime:0;var u=a+u,h=0,c=null;(s=sn(s,"EXT-X-BYTERANGE"))&&(s=s.value.split("@"),c=Number(s[0]),h=s[1]?Number(s[1]):r[t-1].K+1,c=h+c-1,t==n.length-1&&(c=null)),r.push(new ei(i+t,a,u,function(){return[o]},h,c))}.bind(t)),r}function Dn(t,e){e.forEach(function(t){var e=this.a.W(),i=t.video;t=t.audio,i&&this.j[i.id]&&fi(this.j[i.id],e),t&&this.j[t.id]&&fi(this.j[t.id],e)}.bind(t))}function Ln(t,e){for(var i=No[t],n=0;n<i.length;n++)for(var r=0;r<e.length;r++)if(i[n].test(e[r].trim()))return e[r].trim();return"text"==t?"":null}function Cn(t,e){if(1==e.length)return e[0];var i=Ln(t,e);if(null!=i)return i;throw new h(2,4,4025,e)}function Mn(t,e,i,n){var r=n.split("."),a=r[r.length-1];return(r=Do[e][a])?Promise.resolve(r):"text"==e?i&&"vtt"!=i?Promise.resolve("application/mp4"):Promise.resolve("text/vtt"):(e=L([n],t.h.retryParameters),e.method="HEAD",t.b.networkingEngine.request(1,e).then(function(t){if(!(t=t.headers["content-type"]))throw new h(2,4,4021,a);return t.split(";")[0]}))}function On(t,e){var i=sn(e.U,"EXT-X-START");return i?Number(Un(i,"TIME-OFFSET")):t.h.hls.defaultTimeOffset}function Un(t,e){var i=t.getAttribute(e);if(!i)throw new h(2,4,4023,e);return i.value}function jn(t,e){var i=sn(t,e);if(!i)throw new h(2,4,4024,e);return i}function Bn(t,e){return t.b.networkingEngine.request(0,L([e],t.h.retryParameters),function(){return!this.b}.bind(t))}function Fn(e,i){null!=e.c&&null!=i&&(e.i=t.setTimeout(e.J.bind(e),1e3*i))}function Vn(e,i){e.f=i,e.a&&e.a.rb(!i),i||null==e.i||(t.clearTimeout(e.i),e.i=null,e.c=null)}function Hn(t,e,i,n,r,a){this.a=t,this.c=e,this.l=i,this.m=null==n?null:Gn(this,n),this.L=r,this.J=a,this.b=new B,this.j=!1,this.i=1,this.h=this.f=null,this.g=new rt(this.ud.bind(this)),this.D=t.readyState,this.s=!1,this.C=this.X=-1,this.w=this.B=!1,0<t.readyState?this.pc():(V(this.b,t,"loadedmetadata",this.pc.bind(this)),F(this.b,t,"timeupdate",function(){at(this.g,.1)}.bind(this))),e=this.rc.bind(this),F(this.b,t,"ratechange",this.Hd.bind(this)),F(this.b,t,"waiting",e),this.h=new rt(e),st(this.h,.25)}function Kn(t,e){0<t.a.readyState?t.a.currentTime=Wn(t,e):t.m=e}function Gn(t,e){var i=t.c.presentationTimeline.W();return e>=i?i-t.l.durationBackoff:e}function qn(t){return 0<t.a.readyState?t.a.paused?t.a.currentTime:Wn(t,t.a.currentTime):Xn(t)}function Xn(t){if(null!=t.m)return Wn(t,t.m);var e=t.c.presentationTimeline;return e=1/0>e.W()?e.ka():e.nb(),t.m=Gn(t,e),e}function Yn(t,e){t.f&&(t.f.cancel(),t.f=null),t.i=e,t.a.playbackRate=t.j||0>e?0:e,!t.j&&0>e&&(t.f=new rt(function(){this.a.currentTime+=e/4}.bind(t)),st(t.f,.25))}function zn(t,e){var i=Nt.bind(null,t.a.buffered),n=1*Math.max(t.c.minBufferTime||0,t.l.rebufferingGoal),r=t.c.presentationTimeline,a=r.ua(),s=r.Da(n),o=r.Da(5),n=r.Da(n+5);return e>=r.W()?Gn(t,e):e>a?a:e<r.Da(0)?i(o)?o:n:e>=s||i(e)?e:n}function $n(t,e,i){t.a.currentTime=i;var n=0,r=function(){!this.a||10<=n++||this.a.currentTime!=e||(this.a.currentTime=i,setTimeout(r,100))}.bind(t);setTimeout(r,100)}function Wn(t,e){var i=t.c.presentationTimeline.ka();return e<i?i:(i=t.c.presentationTimeline.ua(),e>i?i:e)}function Jn(t,e,i,n,r,a,s){this.a=t,this.B=e,this.g=i,this.w=n,this.l=r,this.h=a,this.C=s,this.c=[],this.j=new B,this.b=!1,this.i=-1,this.f=null,Zn(this)}function Qn(t){var e=I(t);return e.eventElement=t.eventElement,e}function Zn(e){tr(e),e.f=t.setTimeout(e.D.bind(e),250)}function tr(e){e.f&&(t.clearTimeout(e.f),e.f=null)}function er(t,e){this.a=e,this.b=t,this.h=null,this.i=1,this.m=Promise.resolve(),this.g=[],this.j={},this.c={},this.s=!1,this.w=null,this.f=this.l=!1}function ir(t){var e=qn(t.a.Ua);return t.b.periods[de(t.b,e)]}function nr(t){var e=t.c.video||t.c.audio;return e?t.b.periods[e.wa]:null}function rr(t){return $(t.c,function(t){return t.oa||t.stream})}function ar(t,e){var i=t.c.video;if(i){var n=i.stream;if(n)if(e){var r=n.trickModeVideo;if(r){var a=i.oa;a||(or(t,r,!1),i.oa=n)}}else(a=i.oa)&&(i.oa=null,or(t,a,!0))}}function sr(t,e,i){e.video&&or(t,e.video,i),e.audio&&or(t,e.audio,i)}function or(t,e,i){var n=t.c[e.type];if(!n&&"text"==e.type&&t.h.ignoreTextStreamFailures)cr(t,{text:e});else if(n){var r=fe(t.b,e);i&&r!=n.wa?hr(t):(n.oa&&(e.trickModeVideo?(n.oa=e,e=e.trickModeVideo):n.oa=null),(r=t.g[r])&&r.Ka&&(r=t.j[e.id])&&r.Ka&&n.stream!=e&&("text"==e.type&&Ft(t.a.M,Q(e.mimeType,e.codecs)),n.stream=e,n.pb=!0,i&&(n.sa?n.tb=!0:n.xa?(n.ra=!0,n.tb=!0):(Pr(n),kr(t,n,!0)))))}}function ur(t){var e=qn(t.a.Ua);Object.keys(t.c).every(function(t){var i=this.a.M;return"text"==t?(t=i.a,t=e>=t.a&&e<t.b):(t=Ht(i,t),t=Nt(t,e)),t}.bind(t))||hr(t)}function hr(t){for(var e in t.c){var i=t.c[e];i.sa||i.ra||(i.xa?i.ra=!0:null==Vt(t.a.M,e)?null==i.qa&&Ir(t,i,0):(Pr(i),kr(t,i,!1)))}}function cr(t,e,i){var n=qn(t.a.Ua),r=de(t.b,n),a={},n=[];return e.variant&&e.variant.audio&&(a.audio=e.variant.audio,n.push(e.variant.audio)),e.variant&&e.variant.video&&(a.video=e.variant.video,n.push(e.variant.video)),e.text&&(a.text=e.text,n.push(e.text)),t.a.M.init(a),fr(t),dr(t,n).then(function(){if(!this.f)for(var t in a){var e=a[t];this.c[t]||(this.c[t]={stream:e,type:t,Ea:null,la:null,oa:null,pb:!0,wa:r,endOfStream:!1,xa:!1,qa:null,ra:!1,tb:!1,sa:!1,Ob:!1,Qa:!1,Bc:i||0},Ir(this,this.c[t],0))}}.bind(t))}function lr(t,e){var i=t.g[e];if(i)return i.N;i={N:new y,Ka:!1},t.g[e]=i;var n=t.b.periods[e].variants.map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),t.video&&t.video.trickModeVideo&&e.push(t.video.trickModeVideo),e}).reduce(_,[]).filter(N);return n.push.apply(n,t.b.periods[e].textStreams),t.m=t.m.then(function(){if(!this.f)return dr(this,n)}.bind(t)).then(function(){this.f||(this.g[e].N.resolve(),this.g[e].Ka=!0)}.bind(t)).catch(function(t){this.f||(this.g[e].N.reject(),delete this.g[e],this.a.onError(t))}.bind(t)),i.N}function dr(t,e){e.map(function(t){return t.id}).filter(N);for(var i=[],n=0;n<e.length;++n){var r=e[n],a=t.j[r.id];a?i.push(a.N):(t.j[r.id]={N:new y,Ka:!1},i.push(r.createSegmentIndex()))}return Promise.all(i).then(function(){if(!this.f)for(var t=0;t<e.length;++t){var i=this.j[e[t].id];i.Ka||(i.N.resolve(),i.Ka=!0)}}.bind(t)).catch(function(t){if(!this.f)return this.j[r.id].N.reject(),delete this.j[r.id],Promise.reject(t)}.bind(t))}function fr(t){var e=t.b.presentationTimeline.W();1/0>e?t.a.M.ga(e):t.a.M.ga(Math.pow(2,32))}function pr(t,e){var i=qn(t.a.Ua),n=e.Ea&&e.la?t.b.periods[fe(t.b,e.Ea)].startTime+e.la.endTime:Math.max(i,e.Bc),r=fe(t.b,e.stream),a=de(t.b,n),s=t.a.M,o=e.type;return"text"==o?(s=s.a,s=null==s.b||s.b<i?0:s.b-Math.max(i,s.a)):(s=Ht(s,o),s=Dt(s,i)),o=Math.max(t.i*Math.max(t.b.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal),n>=t.b.presentationTimeline.W()?(e.endOfStream=!0,null):(e.endOfStream=!1,e.wa=a,a!=r?null:s>=o?.5:(n=t.a.M,a=e.type,n="text"==a?n.a.b:Rt(Ht(n,a)),e.la&&e.stream==e.Ea?(a=e.la.position+1,n=mr(t,e,r,a)):(a=e.la?e.stream.findSegmentPosition(Math.max(0,t.b.periods[fe(t.b,e.Ea)].startTime+e.la.endTime-t.b.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.b.periods[r].startTime)),null==a?n=null:(s=null,null==n&&(s=mr(t,e,r,Math.max(0,a-1))),n=s||mr(t,e,r,a))),n?(e.Bc=0,vr(t,e,i,r,n),null):1))}function mr(t,e,i,n){return i=t.b.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.b.presentationTimeline,n=t.ua(),i.startTime+e.endTime<t.ka()||i.startTime+e.startTime>n?null:e):null}function vr(t,e,i,n,r){var a=t.b.periods[n],s=e.stream,o=t.b.presentationTimeline.W(),u=t.b.periods[n+1];n=br(t,e,n,a.startTime,u?u.startTime:o),e.xa=!0,e.pb=!1,o=Ar(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.l)return yr(this,e,i,a,s,r,t[1])}.bind(t)).then(function(){this.f||this.l||(e.xa=!1,e.Ob=!1,e.ra||this.a.Ib(),Ir(this,e,0),wr(this,s))}.bind(t)).catch(function(t){this.f||this.l||(e.xa=!1,"text"==e.type&&this.h.ignoreTextStreamFailures?delete this.c.text:3017==t.code?gr(this,e,t):(e.Qa=!0,t.severity=2,_r(this,t)))}.bind(t))}function gr(t,e,i){if(!z(t.c).some(function(t){return t!=e&&t.Ob})){var n=Math.round(100*t.i);if(20<n)t.i-=.2;else{if(!(4<n))return e.Qa=!0,t.l=!0,void t.a.onError(i);t.i-=.04}e.Ob=!0}Ir(t,e,4)}function br(t,e,i,n,r){return e.pb?(i=qt(t.a.M,e.type,t.b.periods[i].startTime-e.stream.presentationTimeOffset,n,r),e.stream.initSegmentReference?(t=Ar(t,e.stream.initSegmentReference).then(function(t){if(!this.f)return Kt(this.a.M,e.type,t,null,null)}.bind(t)).catch(function(t){return e.pb=!0,Promise.reject(t)}),Promise.all([i,t])):i):Promise.resolve()}function yr(t,e,i,n,r,a,s){return r.containsEmsgBoxes&&(new ai).ca("emsg",t.Ud.bind(t,n,a)).parse(s),Tr(t,e,i).then(function(){if(!this.f)return Kt(this.a.M,e.type,s,a.startTime+n.startTime,a.endTime+n.startTime)}.bind(t)).then(function(){if(!this.f)return e.Ea=r,e.la=a,Promise.resolve()}.bind(t))}function Tr(t,e,i){var n=Vt(t.a.M,e.type);return null==n?Promise.resolve():(i=i-n-t.h.bufferBehind,0>=i?Promise.resolve():t.a.M.remove(e.type,n,n+i).then(function(){}.bind(t)))}function wr(t,e){if(!t.s&&(t.s=z(t.c).every(function(t){return"text"==t.type||!t.ra&&!t.sa&&t.la}),t.s)){var i=fe(t.b,e);for(t.g[i]||lr(t,i).then(function(){this.a.jc()}.bind(t)).catch(x),i=0;i<t.b.periods.length;++i)lr(t,i).catch(x);t.a.Md&&t.a.Md()}}function Er(t,e){if(e.wa!=fe(t.b,e.stream)){var i=e.wa,n=z(t.c);n.every(function(t){return t.wa==i})&&n.every(Sr)&&lr(t,i).then(function(){if(!this.f&&n.every(function(t){var e=fe(this.b,t.stream);return Sr(t)&&t.wa==i&&e!=i}.bind(this))){var t=this.b.periods[i],e=this.a.kc(t),r={};e.variant&&e.variant.video&&(r.video=e.variant.video),e.variant&&e.variant.audio&&(r.audio=e.variant.audio),e.text&&(r.text=e.text);for(var a in this.c)if(!r[a]&&"text"!=a)return void this.a.onError(new h(2,5,5005));for(a in r)if(!this.c[a]){if("text"!=a)return void this.a.onError(new h(2,5,5005));cr(this,{text:r.text},t.startTime),delete r[a]}for(a in this.c)(t=r[a])?(or(this,t,!1),Ir(this,this.c[a],0)):delete this.c[a];this.a.jc()}}.bind(t)).catch(x)}}function Sr(t){return!t.xa&&null==t.qa&&!t.ra&&!t.sa}function Ar(t,e){var i=L(e.a(),t.h.retryParameters);if(e.T||null!=e.K){var n="bytes="+e.T+"-";null!=e.K&&(n+=e.K),i.headers.Range=n}return t.a.Sa.request(1,i).then(function(t){return t.data})}function kr(t,e,i){e.ra=!1,e.tb=!1,e.sa=!0,Gt(t.a.M,e.type).then(function(){if(!this.f&&i){var t=this.a.M,n=e.type;return"text"==n?Promise.resolve():Xt(t,n,t.Yc.bind(t,n))}}.bind(t)).then(function(){this.f||(e.Ea=null,e.la=null,e.sa=!1,e.endOfStream=!1,Ir(this,e,0))}.bind(t))}function Ir(e,i,n){i.qa=t.setTimeout(e.Ce.bind(e,i),1e3*n)}function Pr(e){null!=e.qa&&(t.clearTimeout(e.qa),e.qa=null)}function _r(t,e){w(t.w).then(function(){this.a.onError(e),e.handled||this.h.failureCallback(e)}.bind(t))}function xr(t,e){return new Promise(function(i,n){var r=new XMLHttpRequest;r.open(e.method,t,!0),r.responseType="arraybuffer",r.timeout=e.retryParameters.timeout,r.withCredentials=e.allowCrossSiteCredentials,r.onload=function(e){e=e.target;var r=e.getAllResponseHeaders().split("\r\n").reduce(function(t,e){var i=e.split(": ");return t[i[0].toLowerCase()]=i.slice(1).join(": "),t},{});if(200<=e.status&&299>=e.status&&202!=e.status)e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r,fromCache:!!r["x-shaka-from-cache"]});else{var a=null;try{a=et(e.response)}catch(t){}n(new h(401==e.status||403==e.status?2:1,1,1001,t,e.status,a,r))}},r.onerror=function(){n(new h(1,1,1002,t))},r.ontimeout=function(){n(new h(1,1,1003,t))};for(var a in e.headers)r.setRequestHeader(a,e.headers[a]);r.send(e.body)})}function Rr(){this.a=null,this.b=[],this.c={}}function Nr(t,e,i){return Cr(t,e,"readwrite",function(t){t.put(i)})}function Dr(t,e,i){return Cr(t,"segment","readwrite",function(t){for(var n=0;n<e.length;n++)t.delete(e[n]).onsuccess=i||function(){}})}function Lr(t,e){var i=0;return Cr(t,e,"readonly",function(t){t.openCursor(null,"prev").onsuccess=function(t){(t=t.target.result)&&(i=t.key+1)}}).then(function(){return i})}function Cr(t,e,i,n){var r={transaction:t.a.transaction([e],i),N:new y};return r.transaction.oncomplete=function(){this.b.splice(this.b.indexOf(r),1),r.N.resolve()}.bind(t),r.transaction.onabort=function(t){this.b.splice(this.b.indexOf(r),1),Or(r.transaction,r.N,t)}.bind(t),r.transaction.onerror=function(t){t.preventDefault()}.bind(t),e=r.transaction.objectStore(e),n(e),t.b.push(r),r.N}function Mr(e,i,n){var r=t.indexedDB.open("shaka_offline_db",1),a=!1,s=new y;return r.onupgradeneeded=function(t){a=!0,t=t.target.result;for(var e in i)t.createObjectStore(e,{keyPath:i[e]})},r.onsuccess=function(t){n&&!a?(t.target.result.close(),setTimeout(function(){Mr(this,i,n-1).then(s.resolve,s.reject)}.bind(this),1e3)):(this.a=t.target.result,s.resolve())}.bind(e),r.onerror=Or.bind(null,r,s),s}function Or(t,e,i){t.error?e.reject(new h(2,9,9001,t.error)):e.reject(new h(2,9,9002)),i.preventDefault()}function Ur(t){var e=jr(t.periods[0],[],new Ui(null,0)),i=ee(e,null,null),e=ie(e,null);return i.push.apply(i,e),{offlineUri:"offline:"+t.key,originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:void 0==t.expiration?1/0:t.expiration,tracks:i,appMetadata:t.appMetadata}}function jr(t,e,i){var n=t.streams.filter(function(t){return"text"==t.contentType});return e=Fr(t.streams.filter(function(t){return"audio"==t.contentType}),t.streams.filter(function(t){return"video"==t.contentType}),e),n=n.map(Hr),t.streams.forEach(function(t){t=Br(t),i.Ga(0,t)}),{startTime:t.startTime,variants:e,textStreams:n}}function Br(t){return t.segments.map(function(t,e){return new ei(e,t.startTime,t.endTime,function(){return[t.uri]},0,null)})}function Fr(t,e,i){var n=[];if(!t.length&&!e.length)return n;t.length?e.length||(e=[null]):t=[null];for(var r=0,a=0;a<t.length;a++)for(var s=0;s<e.length;s++)if(Vr(t[a],e[s])){var o=t[a],u=e[s],h=i;o={id:r++,language:o?o.language:"",primary:!!o&&o.primary||!!u&&u.primary,audio:Hr(o),video:Hr(u),bandwidth:0,drmInfos:h,allowedByApplication:!0,allowedByKeySystem:!0},n.push(o)}return n}function Vr(t,e){if(!(t&&e&&t.variantIds&&e.variantIds))return!0;for(var i=0;i<t.variantIds.length;i++)if(e.variantIds.some(function(e){return e==t.variantIds[i]}))return!0;return!1}function Hr(t){if(!t)return null;var e=Br(t),e=new di(e);return{id:t.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e),initSegmentReference:t.initSegmentUri?new ti(function(){return[t.initSegmentUri]},0,null):null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null}}function Kr(){return t.indexedDB?new Rr:null}function Gr(t,e,i,n){this.b={},this.l=[],this.m=n,this.j=t,this.s=e,this.w=i,this.i=this.a=null,this.f=this.g=this.h=this.c=0}function qr(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),T:i.T,K:i.K,$b:n,Qb:r})}function Xr(t,e){t.c=0,t.h=0,t.g=0,t.f=0,z(t.b).forEach(function(t){t.forEach(function(t){null!=t.K?this.c+=t.K-t.T+1:this.g+=t.$b}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=z(t.b).map(function(t){var e=0,i=function(){return this.m?e>=t.length?Promise.resolve():Yr(this,t[e++]).then(i):Promise.reject(new h(2,9,9002))}.bind(this);return i()}.bind(t));return t.b={},t.i=Promise.all(i).then(function(){return Nr(this.j,"manifest",e)}.bind(t)).then(function(){this.l=[]}.bind(t)),t.i}function Yr(t,e){var i=L(e.uris,t.w);(e.T||null!=e.K)&&(i.headers.Range="bytes="+e.T+"-"+(null==e.K?"":e.K));var n;return t.s.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,this.l.push(e.Qb.key),e.Qb.data=t.data,Nr(this.j,"segment",e.Qb)):Promise.reject(new h(2,9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new h(2,9,9002));null==e.K?(this.a.size+=n,this.f+=e.$b):this.h+=n;var t=(this.h+this.f)/(this.c+this.g),i=Ur(this.a);this.m.progressCallback(i,t)}.bind(t))}function zr(){this.a=-1}function $r(t){var e=new Ui(null,0);e.ga(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:10,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return jr(t,i,e)})}}function Wr(t){if(/^offline:([0-9]+)$/.exec(t)){var e={uri:t,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}};return Promise.resolve(e)}if(e=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t)){var i=Number(e[1]),n=Kr();return n?n.init(Co).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new h(2,9,9003,i);return{uri:t,data:e.data,headers:{}}})}):Promise.reject(new h(2,9,9e3))}return Promise.reject(new h(2,1,9004,t))}function Jr(t){this.a=null;for(var e=0;e<t.textTracks.length;++e){var i=t.textTracks[e];i.mode="disabled","Shaka Player TextTrack"==i.label&&(this.a=i)}this.a||(this.a=t.addTextTrack("subtitles","Shaka Player TextTrack")),this.a.mode="hidden",this.b=this.a.cues}function Qr(e){if(e.startTime>=e.endTime)return null;var i=new VTTCue(e.startTime,e.endTime,e.payload);i.lineAlign=e.lineAlign,i.positionAlign=e.positionAlign,i.size=e.size;try{i.align=e.textAlign}catch(t){}if("center"==e.textAlign&&"center"!=i.align&&(i.align="middle"),e.writingDirection==Wo?i.vertical="lr":e.writingDirection==Jo&&(i.vertical="rl"),e.lineInterpretation==Zo&&(i.snapToLines=!1),null!=e.line&&(i.line=e.line),null!=e.position&&(i.position=e.position),t.VTTRegion&&e.region){var n=new VTTRegion;n.viewportAnchorX=e.region.x,n.viewportAnchorY=e.region.y,n.width=e.region.width,n.height=e.region.height,i.region=n}return i}function Zr(t,e){for(var i=t.b,n=[],r=0;r<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.a.removeCue(n[r])}function ta(){this.a=Promise.resolve(),this.b=this.c=this.f=!1,this.i=new Promise(function(t){this.g=t}.bind(this))}function ea(t){return t.f||(t.a=t.a.then(function(t){return this.c=!0,Promise.resolve(t)}.bind(t),function(t){return this.c=!0,this.b?(this.g(),Promise.reject(this.h)):Promise.reject(t)}.bind(t))),t.f=!0,t.a}function ia(t,e){Se.call(this),this.D=!1,this.f=t,this.jb=!1,this.w=null,this.m=new B,this.g=this.ib=this.b=this.i=this.a=this.B=this.h=this.gb=this.J=this.L=this.l=this.s=null,this.Oc=1e9,this.eb=[],this.Oa=!1,this.Ba=!0,this.Na=this.Pa=this.ia=null,this.Yb=!1,this.X=null,this.hb=[],this.C={},this.c=pa(this),this.fb={width:1/0,height:1/0},this.j=ma(),this.cb=0,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage,this.ub=this.ab="",this.Zb=!0,e&&e(this),this.s=new D(this.ue.bind(this)),this.gb=aa(this),F(this.m,this.f,"error",this.Od.bind(this))}function na(t){if(!t.ia)return Promise.resolve();var e=Promise.resolve();return t.i&&(e=t.i.stop(),t.i=null),t=t.ia.cancel(new h(2,7,7e3)),Promise.all([e,t])}function ra(t){function e(t){return(t.video?t.video.codecs.split(".")[0]:"")+"-"+(t.audio?t.audio.codecs.split(".")[0]:"")}var i={};t.b.periods.forEach(function(t){t.variants.forEach(function(t){var n=e(t);n in i||(i[n]=[]),i[n].push(t)})});var n=null,r=1/0;J(i,function(t,e){var i=0,a=0;e.forEach(function(t){i+=t.bandwidth||0,++a});var s=i/a;s<r&&(n=t,r=s)}),t.b.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return e(t)==n})})}function aa(e){e.L=new MediaSource;var i=new y;return F(e.m,e.L,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.L),i}function sa(t){if(t.i&&t.i.configure(t.c.manifest),t.l&&t.l.configure(t.c.drm),t.a){t.a.configure(t.c.streaming);try{t.b.periods.forEach(t.kb.bind(t))}catch(e){t.La(e)}var e=rr(t.a),i=e.audio,n=e.video,e=ir(t.a);(i=ce(i,n,e.variants))&&i.allowedByApplication&&i.allowedByKeySystem||Ta(t,e)}t.g&&(oa(t),t.c.abr.enabled&&!t.Ba?t.g.enable():t.g.disable())}function oa(t){t.g.configure?t.g.configure(t.c.abr):(o("AbrManager API has changed. AbrManager.setDefaultEstimate() and AbrManager.setRestrictions() are deprecated. AbrManager.configure() is used instead. Please upgrade to the new API. The old API will be removed in v2.3."),t.g.setDefaultEstimate(t.c.abr.defaultBandwidthEstimate),t.g.setRestrictions(t.c.abr.restrictions))}function ua(t,e,i){e.video&&ca(t,e.video),e.audio&&ca(t,e.audio);var n=nr(t.a),r=rr(t.a);e!=ce(r.audio,r.video,n?n.variants:[])&&t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"variant",fromAdaptation:i,bandwidth:e.bandwidth})}function ha(t,e,i){ca(t,e),t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"text",fromAdaptation:i,bandwidth:null})}function ca(t,e){var i=fe(t.b,e);t.C[i]||(t.C[i]={}),t.C[i][e.type]=e.id}function la(t){t.m&&(t.m.ha(t.L,"sourceopen"),t.m.ha(t.f,"loadeddata"),t.m.ha(t.f,"playing"),t.m.ha(t.f,"pause"),t.m.ha(t.f,"ended")),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.g?t.g.stop():null,t.l?t.l.o():null,t.J?t.J.o():null,t.h?t.h.o():null,t.B?t.B.o():null,t.a?t.a.o():null,t.i?t.i.stop():null,t.w?t.w.o():null]);return t.l=null,t.J=null,t.h=null,t.B=null,t.a=null,t.i=null,t.w=null,t.b=null,t.ib=null,t.gb=null,t.L=null,t.hb=[],t.C={},t.j=ma(),e}function da(t){return t.i?la(t).then(function(){this.D||(this.Jc(!1),this.gb=aa(this))}.bind(t)):Promise.resolve()}function fa(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0)}}}function pa(t){return{drm:{retryParameters:E(),servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1},manifest:{retryParameters:E(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1},hls:{defaultTimeOffset:0}},streaming:{retryParameters:E(),failureCallback:t.Vc.bind(t),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1},abrFactory:pe,textDisplayFactory:function(t){return new Jr(t)}.bind(null,t.f),abr:{enabled:!0,defaultBandwidthEstimate:5e5,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0}}function ma(){return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:0,bufferingTime:0,switchHistory:[],stateHistory:[]}}function va(t,e,i){t.Ba?(t.Na=e,t.Yb=i||!1):sr(t.a,e,i||!1)}function ga(t){if(t.b){var e=Date.now()/1e3;t.Oa?t.j.bufferingTime+=e-t.cb:t.j.playTime+=e-t.cb,t.cb=e}}function ba(t,e){function i(t,e){if(!t)return null;var i=t.findSegmentPosition(e-r.startTime);return null==i?null:(i=t.getSegmentReference(i))?i.startTime+r.startTime:null}var n=rr(t.a),r=ir(t.a),a=i(n.video,e),n=i(n.audio,e);return null!=a&&null!=n?Math.max(a,n):null!=a?a:null!=n?n:e}function ya(t,e){if(!e||!e.length)return t.La(new h(2,4,4012)),null;if(t.g.setVariants(e),t.g.chooseStreams){o("AbrManager API has changed. AbrManager.chooseStreams() is deprecated. Please implement AbrManager.chooseVariant() to upgrade. The old API will be removed in v2.3.");var i=t.g.chooseStreams(["video","audio"]);return ce(i.audio,i.video,e)}return t.g.chooseVariant()}function Ta(t,e){var i=se(e,t.Ma,t.ab),n=oe(e,t.$a,t.ub);(i=ya(t,i))&&(ua(t,i,!0),va(t,i,!0)),(n=n[0])&&(ha(t,n,!0),t.Ba?t.X=n:or(t.a,n,!0)),wa(t)}function wa(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("adaptation"))}.bind(t))}function Ea(t){Promise.resolve().then(function(){this.D||this.dispatchEvent(new G("trackschanged"))}.bind(t))}function Sa(t){t.dispatchEvent(new G("texttrackvisibility"))}function Aa(t){if(!t||t.constructor!=ia)throw new h(2,9,9008);this.a=Kr(),this.g=t,this.b=Pa(this),this.c=null,this.s=!1,this.j=null,this.h=-1,this.l=0,this.f=null,this.i=new Gr(this.a,t.s,t.getConfiguration().streaming.retryParameters,this.b)}function ka(){return!!t.indexedDB}function Ia(t,e,i,n){function r(){}var a,s,o,u=t.g.s,h=t.g.getConfiguration();return Oi(e,u,h.manifest.retryParameters,n).then(function(t){return Da(this),o=new t,o.configure(h.manifest),o.start(e,{networkingEngine:u,filterAllPeriods:this.m.bind(this),filterNewPeriod:this.w.bind(this),onTimelineRegionAdded:function(){},onEvent:function(){},onError:i})}.bind(t)).then(function(t){return Da(this),a=t,s=new dt({Sa:u,onError:i,Hb:r,onExpirationUpdated:function(){},onEvent:function(){}}),s.configure(h.drm),s.init(a,this.b.usePersistentLicense||!1)}.bind(t)).then(function(){return Da(this),Ra(a)}.bind(t)).then(function(){return Da(this),mt(s)}.bind(t)).then(function(){return Da(this),o.stop()}.bind(t)).then(function(){return Da(this),{manifest:a,Wc:s}}.bind(t)).catch(function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Pa(t){return{trackSelectionCallback:t.B.bind(t),progressCallback:function(t,e){if(t||e)return null},usePersistentLicense:!0}}function _a(t){return t.a?t.a.a?Promise.resolve():t.a.init(Co):Promise.reject(new h(2,9,9e3))}function xa(t){var e=t.c?t.c.o():Promise.resolve();return t.c=null,t.f=null,t.s=!1,t.j=null,t.h=-1,e}function Ra(t){var e=t.periods.map(function(t){return t.variants}).reduce(_,[]).map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),e}).reduce(_,[]).filter(N);return t=t.periods.map(function(t){return t.textStreams}).reduce(_,[]),e.push.apply(e,t),Promise.all(e.map(function(t){return t.createSegmentIndex()}))}function Na(t,e,i,n,r){for(var a=[],s=t.f.presentationTimeline.ka(),o=s,u=i.findSegmentPosition(s),h=null!=u?i.getSegmentReference(u):null;h;)o=t.a.c.segment++,qr(t.i,i.type,h,(h.endTime-h.startTime)*n/8,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:o}),a.push({startTime:h.startTime,endTime:h.endTime,uri:"offline:"+t.h+"/"+i.id+"/"+o}),o=h.endTime+e.startTime,h=i.getSegmentReference(++u);return t.l=Math.max(t.l,o-s),e=null,i.initSegmentReference&&(o=t.a.c.segment++,e="offline:"+t.h+"/"+i.id+"/"+o,qr(t.i,i.contentType,i.initSegmentReference,0,{key:o,data:null,manifestKey:t.h,streamNumber:i.id,segmentNumber:-1})),t=[],null!=r&&t.push(r),{id:i.id,primary:i.primary,presentationTimeOffset:i.presentationTimeOffset||0,contentType:i.type,mimeType:i.mimeType,codecs:i.codecs,frameRate:i.frameRate,kind:i.kind,language:i.language,label:i.label,width:i.width||null,height:i.height||null,initSegmentUri:e,encrypted:i.encrypted,keyId:i.keyId,segments:a,variantIds:t}}function Da(t){if(!t.g)throw new h(2,9,9002)}function La(t){Oo.push(t)}function Ca(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var i=new Event(e,t);else i=document.createEvent("Event"),i.initEvent(e,t.bubbles,t.cancelable);t.target.dispatchEvent(i)}function Ma(t,e,i){if("input"==t)switch(this.type){case"range":t="change"}Uo.call(this,t,e,i)}function Oa(t){this.f=[],this.b=[],this.a=[],(new ai).ca("pssh",this.c.bind(this)).parse(t.buffer)}function Ua(t,e){try{var i=new ja(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ja(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},s=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){s=!0;var h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(s=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.videoCapabilities.push(u),i=!0));if(s||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(i=!1),i)return void(this.a=a)}throw r=Error("Unsupported keySystem"),r.name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function Ba(t){var e=this.mediaKeys;return e&&e!=t&&Va(e,null),delete this.mediaKeys,(this.mediaKeys=t)?Va(t,this):Promise.resolve()}function Fa(t){this.a=new MSMediaKeys(t),this.b=new B}function Va(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(H(t.b),!e)return Promise.resolve();F(t.b,e,"msneedkey",Ka);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(t){return Promise.reject(t)}}function Ha(t){Se.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new B,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new Xa}function Ka(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc";var i=t.initData;if(i){var n=new Oa(i);if(1>=n.a.length)t=i;else{var r=[];for(t=0;t<n.a.length;t++)r.push(i.subarray(n.a[t].start,n.a[t].end+1));for(i=M(r,Ga),t=n=0;t<i.length;t++)n+=i[t].length;for(n=new Uint8Array(n),t=r=0;t<i.length;t++)n.set(i[t],r),r+=i[t].length;t=n}}else t=i;e.initData=t,this.dispatchEvent(e)}function Ga(t,e){return lt(t,e)}function qa(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function Xa(){this.size=0,this.a=void 0}function Ya(){return Promise.reject(Error("The key system specified is not supported."))}function za(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function $a(){throw new TypeError("Illegal constructor.")}function Wa(){throw new TypeError("Illegal constructor.")}function Ja(e){Bo=e,Fo=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Za,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ts,t.MediaKeys=is,t.MediaKeySystemAccess=es}function Qa(t){var e=Bo;return e?e+t.charAt(0).toUpperCase()+t.slice(1):t}function Za(t,e){try{var i=new es(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ts(t){var e=this.mediaKeys;return e&&e!=t&&ns(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&ns(t,this),Promise.resolve()}function es(t,e){this.a=this.keySystem=t;var i=!1;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);for(var n=!1,r=document.getElementsByTagName("video"),a=r.length?r[0]:document.createElement("video"),s=0;s<e.length;++s){r=e[s];var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},u=!1;if(r.audioCapabilities)for(var h=0;h<r.audioCapabilities.length;++h){var c=r.audioCapabilities[h];if(c.contentType){var u=!0,l=c.contentType.split(";")[0];a.canPlayType(l,this.a)&&(o.audioCapabilities.push(c),n=!0)}}if(r.videoCapabilities)for(h=0;h<r.videoCapabilities.length;++h)c=r.videoCapabilities[h],c.contentType&&(u=!0,a.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),n=!0));if(u||(n=a.canPlayType("video/mp4",this.a)||a.canPlayType("video/webm",this.a)),"required"==r.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):n=!1),n)return void(this.b=o)}throw i="Unsupported keySystem","org.w3.clearkey"!=t&&"com.widevine.alpha"!=t||(i="None of the requested configurations were supported."),i=Error(i),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function is(t){this.g=t,this.b=null,this.a=new B,this.c=[],this.f={}}function ns(t,e){t.b=e,H(t.a);var i=Bo;e&&(F(t.a,e,i+"needkey",t.Sd.bind(t)),F(t.a,e,i+"keymessage",t.Rd.bind(t)),F(t.a,e,i+"keyadded",t.Pd.bind(t)),F(t.a,e,i+"keyerror",t.Qd.bind(t)))}function rs(t,e){var i=t.f[e];return i||((i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null)}function as(t,e,i){Se.call(this),this.f=t,this.h=!1,this.a=this.b=null,this.c=e,this.g=i,this.sessionId="",this.expiration=NaN,this.closed=new y,this.keyStatuses=new us}function ss(t,e,i){if(t.h)return Promise.reject(Error("The session is already initialized."));t.h=!0;try{if("persistent-license"==t.g)if(i)var n=new Uint8Array(it("LOAD_SESSION|"+i));else{var r=it("PERSISTENT|"),a=new Uint8Array(r.byteLength+e.byteLength);a.set(new Uint8Array(r),0),a.set(new Uint8Array(e),r.byteLength),n=a}else n=new Uint8Array(e)}catch(t){return Promise.reject(t)}t.b=new y;var s=Qa("generateKeyRequest");try{t.f[s](t.c,n)}catch(e){if("InvalidStateError"!=e.name)return t.b=null,Promise.reject(e);setTimeout(function(){try{this.f[s](this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function os(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new G("keystatuseschange"))}function us(){this.size=0,this.a=void 0}function hs(){var t=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var e=t.apply(this,arguments);return e.abort=function(){},e}}function cs(){var t=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(e,i){return t.call(this,e,i-.001)}}function ls(){var t=MediaSource.prototype.endOfStream;MediaSource.prototype.endOfStream=function(){for(var e,i=0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e=e.buffered.end(e.buffered.length-1),i=Math.max(i,e);if(!isNaN(this.duration)&&i<this.duration)for(this.hc=!0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e.cc=!1;return t.apply(this,arguments)};var e=!1,i=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=i.apply(this,arguments);return t.mediaSource_=this,t.addEventListener("updateend",ds,!1),e||(this.addEventListener("sourceclose",fs,!1),e=!0),t}}function ds(t){var e=t.target,i=e.mediaSource_;if(i.hc){for(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.cc=!0,t=0;t<i.sourceBuffers.length;++t)if(0==i.sourceBuffers[t].cc)return;i.hc=!1}}function fs(t){t=t.target;for(var e=0;e<t.sourceBuffers.length;++e)t.sourceBuffers[e].removeEventListener("updateend",ds,!1);t.removeEventListener("sourceclose",fs,!1)}function ps(){var t=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(e){return"mp2t"!=e.split(/ *; */)[0].split("/")[1]&&t(e)}}function ms(){var t=MediaSource.isTypeSupported,e=/^dv(?:he|av)\./;MediaSource.isTypeSupported=function(i){for(var n,r,a=i.split(/ *; */),s=a[0],o={},u=1;u<a.length;++u)n=a[u].split("="),r=n[0],n=n[1].replace(/"(.*)"/,"$1"),o[r]=n;if(!(n=o.codecs))return t(i);var h=!1,c=!1;i=n.split(",").filter(function(t){return e.test(t)?(c=!0,!1):(/^(hev|hvc)1\.2/.test(t)&&(h=!0),!0)}),c&&(h=!1),o.codecs=i.join(","),h&&(o.eotf="smpte2084");for(r in o)n=o[r],s+="; "+r+'="'+n+'"';return cast.__platform__.canDisplayType(s)}}function vs(t){if(this.c=[],this.b=[],this.za=Vo,t)try{t(this.ma.bind(this),this.a.bind(this))}catch(t){this.a(t)}}function gs(t){var e=new vs;return e.ma(void 0),e.then(function(){return t})}function bs(t){var e=new vs;return e.a(t),e}function ys(t){function e(t,e,i){t.za==Vo&&(r[e]=i,++n==r.length&&t.ma(r))}var i=new vs;if(!t.length)return i.ma([]),i;for(var n=0,r=Array(t.length),a=i.a.bind(i),s=0;s<t.length;++s)t[s]&&t[s].then?t[s].then(e.bind(null,i,s),a):e(i,s,t[s]);return i}function Ts(t){for(var e=new vs,i=e.ma.bind(e),n=e.a.bind(e),r=0;r<t.length;++r)t[r]&&t[r].then?t[r].then(i,n):i(t[r]);return e}function ws(t,e,i){Ko.push(function(){if(i&&"function"==typeof i){try{var t=i(this.f)}catch(t){return void e.a(t)}try{var n=t&&t.then}catch(t){return void e.a(t)}t instanceof vs?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.ma.bind(e),e.a.bind(e)):n?Es(t,n,e):e.ma(t)}else 1==this.za?e.ma(this.f):e.a(this.f)}.bind(t)),null==Ho&&(Ho=As(Ss))}function Es(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;try{var e=t&&t.then}catch(t){return void i.a(t)}e?Es(t,e,i):i.ma(t)}},i.a.bind(i))}catch(t){i.a(t)}}function Ss(){for(;Ko.length;){null!=Ho&&(ks(Ho),Ho=null);var t=Ko;Ko=[];for(var e=0;e<t.length;++e)t[e]()}}function As(){return 0}function ks(){}function Is(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function Ps(e,i,n){return new t.TextTrackCue(e,i,n)}function _s(e,i,n){return new t.TextTrackCue(e+"-"+i+"-"+n,e,i,n)}function xs(t,e,i){this.startTime=t,this.endTime=e,this.payload=i,this.region={x:0,y:0,width:100,height:100},this.position=null,this.positionAlign=Go,this.size=100,this.textAlign=qo,this.writingDirection=$o,this.lineInterpretation=Qo,this.line=null,this.lineHeight="",this.lineAlign=tu,this.displayAlign=Yo,this.fontSize=this.backgroundColor=this.color="",this.fontWeight=iu,this.fontStyle=nu,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id=""}function Rs(){}function Ns(t){var e=[];if(!t)return e;for(var i=t.childNodes,n=0;n<i.length;n++){var r="span"==i[n].nodeName&&"p"==t.nodeName;i[n].nodeType!=Node.ELEMENT_NODE||"br"==i[n].nodeName||r||(r=Ns(i[n]),e=e.concat(r))}return e.length||e.push(t),e}function Ds(t,e){for(var i=t.childNodes,n=0;n<i.length;n++)if("br"==i[n].nodeName&&0<n)i[n-1].textContent+="\n";else if(0<i[n].childNodes.length)Ds(i[n],e);else if(e){var r=i[n].textContent.trim(),r=r.replace(/\s+/g," ");i[n].textContent=r}}function Ls(t,e){for(var i=e.split(" "),n=0;n<i.length;n++)switch(i[n]){case"underline":0>t.textDecoration.indexOf("underline")&&t.textDecoration.push("underline");break;case"noUnderline":0<=t.textDecoration.indexOf("underline")&&U(t.textDecoration,"underline");break;case"lineThrough":0>t.textDecoration.indexOf("lineThrough")&&t.textDecoration.push("lineThrough");break;case"noLineThrough":0<=t.textDecoration.indexOf("lineThrough")&&U(t.textDecoration,"lineThrough");break;case"overline":0>t.textDecoration.indexOf("overline")&&t.textDecoration.push("overline");break;case"noOverline":0<=t.textDecoration.indexOf("overline")&&U(t.textDecoration,"overline")}}function Cs(t,e,i,n){return(t=Os(t,i,n))?t:Ms(e,i,n)}function Ms(t,e,i){for(var n=Ns(t),r=0;r<n.length;r++){var a=n[r].getAttribute(i);if(a)return a}return(t=Us(t,"style",e))?t.getAttribute(i):null}function Os(t,e,i){return(t=Us(t,"style",e))?t.getAttribute(i):null}function Us(t,e,i){if(!t||1>i.length)return null;var n=null,r=t;for(t=null;r&&!(t=r.getAttribute(e))&&(r=r.parentNode)instanceof Element;);if(e=t)for(t=0;t<i.length;t++)if(i[t].getAttribute("xml:id")==e){n=i[t];break}return n}function js(t,e){var i=null;if(au.test(t))var i=au.exec(t),n=Number(i[1]),r=Number(i[2]),a=Number(i[3]),s=Number(i[4]),s=s+(Number(i[5])||0)/e.b,a=a+s/e.frameRate,i=a+60*r+3600*n;else su.test(t)?i=Bs(su,t):ou.test(t)?i=Bs(ou,t):uu.test(t)?(i=uu.exec(t),i=Number(i[1])/e.frameRate):hu.test(t)?(i=hu.exec(t),i=Number(i[1])/e.a):cu.test(t)&&(i=Bs(cu,t));return i}function Bs(t,e){var i=t.exec(e);return i&&""!=i[0]?(Number(i[4])||0)/1e3+(Number(i[3])||0)+60*(Number(i[2])||0)+3600*(Number(i[1])||0):null}function Fs(t,e,i,n){this.frameRate=Number(t)||30,this.b=Number(e)||1,this.a=Number(n),this.a||(this.a=t?this.frameRate*this.b:1),i&&(t=/^(\d+) (\d+)$/g.exec(i))&&(this.frameRate*=t[1]/t[2])}function Vs(){this.a=new Rs}function Hs(){}function Ks(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(i=i[1],t.textAlign="middle"==i?qo:Xo[i.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(e))?t.writingDirection="lr"==i[1]?Wo:Jo:(i=/^size:([\d\.]+)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:([\d\.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(i=i[2],t.positionAlign="line-left"==i||"start"==i?"line-left":"line-right"==i||"end"==i?"line-right":"center")):(i=/^line:([\d\.]+)%(?:,(start|end|center))?$/.exec(e))?(t.lineInterpretation=Zo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.lineInterpretation=Qo,t.line=Number(i[1]),i[2]&&(t.lineAlign=eu[i[2].toUpperCase()]))}function Gs(t){if(!(t=hn(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var e=Number(t[2]),i=Number(t[3]);return 59<e||59<i?null:Number(t[4])/1e3+i+60*e+3600*(Number(t[1])||0)}function qs(){this.a=null}function Xs(t,e,i){var n,r,a;return(new ai).G("payl",ui(function(t){n=Z(t)})).G("iden",ui(function(t){r=Z(t)})).G("sttg",ui(function(t){a=Z(t)})).parse(t),n?Ys(n,r,a,e,i):null}function Ys(t,e,i,n,r){if(t=new xs(n,r,t),e&&(t.id=e),i)for(e=new un(i),i=cn(e);i;)Ks(t,i),hn(e,/[ \t]+/gm),i=cn(e);return t}var zs,$s=this;$s.Pe=!0,s.prototype.getBandwidthEstimate=function(t){return 128e3>this.a?t:Math.min(a(this.b),a(this.c))},t.console&&t.console.log.bind&&(o=console.warn.bind(console)),e("shaka.util.Error",h),h.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},h.Severity={RECOVERABLE:1,CRITICAL:2},h.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},h.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_LIVE_CONTENT_NOT_SUPPORTED:4029,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,LOAD_INTERRUPTED:7e3,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,CONTENT_UNSUPPORTED_BY_BROWSER:9009};var Ws=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;zs=c.prototype,zs.ea="",zs.Aa="",zs.ja="",zs.Ia=null,zs.ba="",zs.ta="",zs.toString=function(){var t=[],e=this.ea;if(e&&t.push(m(e,Js,!0),":"),e=this.ja){t.push("//");var i=this.Aa;i&&t.push(m(i,Js,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.Ia,null!=e&&t.push(":",String(e))}return(e=this.ba)&&(this.ja&&"/"!=e.charAt(0)&&t.push("/"),t.push(m(e,"/"==e.charAt(0)?Zs:Qs,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ta)&&t.push("#",m(e,eo)),t.join("")},zs.resolve=function(t){var e=new c(this);"data"===e.ea&&(e=new c);var i=!!t.ea;i?l(e,t.ea):i=!!t.Aa,i?e.Aa=t.Aa:i=!!t.ja,i?e.ja=t.ja:i=null!=t.Ia;var n=t.ba;if(i)d(e,t.Ia);else if(i=!!t.ba){if("/"!=n.charAt(0))if(this.ja&&!this.ba)n="/"+n;else{var r=e.ba.lastIndexOf("/");-1!=r&&(n=e.ba.substr(0,r+1)+n)}if(".."==n||"."==n)n="";else if(-1!=n.indexOf("./")||-1!=n.indexOf("/.")){for(var r=!n.lastIndexOf("/",0),n=n.split("/"),a=[],s=0;s<n.length;){var o=n[s++];"."==o?r&&s==n.length&&a.push(""):".."==o?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),r&&s==n.length&&a.push("")):(a.push(o),r=!0)}n=a.join("/")}}return i?e.ba=n:i=""!==t.a.toString(),i?f(e,b(t.a)):i=!!t.ta,i&&(e.ta=t.ta),e};var Js=/[#\/\?@]/g,Qs=/[\#\?:]/g,Zs=/[\#\?]/g,to=/[\#\?@]/g,eo=/#/g;g.prototype.a=null,g.prototype.c=null,g.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var t,e=[];for(t in this.a)for(var i=encodeURIComponent(t),n=this.a[t],r=0;r<n.length;r++){var a=i;""!==n[r]&&(a+="="+encodeURIComponent(n[r])),e.push(a)}return this.b=e.join("&")},e("shaka.net.NetworkingEngine",D),D.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3};var io={};D.registerScheme=function(t,e){io[t]=e},D.unregisterScheme=function(t){delete io[t]},D.prototype.ae=function(t){this.b.push(t)},D.prototype.registerRequestFilter=D.prototype.ae,D.prototype.He=function(t){var e=this.b;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterRequestFilter=D.prototype.He,D.prototype.Tc=function(){this.b=[]},D.prototype.clearAllRequestFilters=D.prototype.Tc,D.prototype.be=function(t){this.c.push(t)},D.prototype.registerResponseFilter=D.prototype.be,D.prototype.Ie=function(t){var e=this.c;0<=(t=e.indexOf(t))&&e.splice(t,1)},D.prototype.unregisterResponseFilter=D.prototype.Ie,D.prototype.Uc=function(){this.c=[]},D.prototype.clearAllResponseFilters=D.prototype.Uc,D.prototype.o=function(){this.f=!0,this.b=[],this.c=[];for(var t=[],e=0;e<this.a.length;++e)t.push(this.a[e].catch(x));return Promise.all(t)},D.prototype.destroy=D.prototype.o,D.prototype.request=function(t,e,i){var n=i||function(){return!1};if(this.f)return Promise.reject();e.method=e.method||"GET",e.headers=e.headers||{},e.retryParameters=e.retryParameters?I(e.retryParameters):E(),e.uris=I(e.uris);var r=Date.now(),a=Promise.resolve();return this.b.forEach(function(i){a=a.then(i.bind(null,t,e))}),a=a.catch(function(t){throw new h(2,1,1006,t)}),a=a.then(function(){var a=Date.now()-r,s=new T(e.retryParameters,!1,i);return w(s).then(function(){return C(this,t,e,s,0,a,n)}.bind(this))}.bind(this)),this.a.push(a),a.then(function(e){return 0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),this.g&&!e.fromCache&&1==t&&this.g(e.timeMs,e.data.byteLength),e}.bind(this)).catch(function(t){return t&&(t.severity=2),0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),Promise.reject(t)}.bind(this))},D.prototype.request=D.prototype.request,j.prototype.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},j.prototype.get=function(t){return(t=this.a[t])?t.slice():null},j.prototype.remove=function(t,e){var i=this.a[t];if(i)for(var n=0;n<i.length;++n)i[n]==e&&(i.splice(n,1),--n)},B.prototype.o=function(){return H(this),this.a=null,Promise.resolve()},B.prototype.ha=function(t,e){if(this.a)for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ha(),this.a.remove(e,r))}},K.prototype.ha=function(){this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null},G.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},G.prototype.stopImmediatePropagation=function(){this.a=!0},G.prototype.stopPropagation=function(){};var no=1/15,ro={codecs:"codecs",frameRate:"framerate",bandwidth:"bitrate",width:"width",height:"height",channelsCount:"channels"};e("shaka.util.StringUtils.fromUTF8",Z),e("shaka.util.StringUtils.fromUTF16",tt),e("shaka.util.StringUtils.fromBytesAutoDetect",et),e("shaka.util.StringUtils.toUTF8",it),rt.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},e("shaka.util.Uint8ArrayUtils.toBase64",ot),e("shaka.util.Uint8ArrayUtils.fromBase64",ut),e("shaka.util.Uint8ArrayUtils.fromHex",ht),e("shaka.util.Uint8ArrayUtils.toHex",ct),e("shaka.util.Uint8ArrayUtils.equal",lt),e("shaka.util.Uint8ArrayUtils.concat",function(t){for(var e=0,i=0;i<arguments.length;++i)e+=arguments[i].length;for(var e=new Uint8Array(e),n=0,i=0;i<arguments.length;++i)e.set(arguments[i],n),n+=arguments[i].length;return e}),zs=dt.prototype,zs.o=function(){this.c=!0;var t=[];return this.a.forEach(function(e){e=e.fa.close().catch(x);var i=new Promise(function(t){setTimeout(t,1e3)});t.push(Promise.race([e,i]))}),this.i.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null).catch(x)),this.B&&(this.B.cancel(),this.B=null),this.D&&(this.D.cancel(),this.D=null),this.f=this.l=this.j=this.w=this.b=null,this.a=[],this.m=[],this.s=this.g=this.h=null,Promise.all(t)},zs.configure=function(t){this.h=t},zs.init=function(t,e){var i={},n=[];return this.ia=e,this.m=t.offlineSessionIds,gt(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?bt(this,i,n):(this.L=!0,Promise.resolve())},zs.keySystem=function(){return this.b?this.b.keySystem:""},zs.mb=function(){var t=this.a.map(function(t){return t=t.fa.expiration,isNaN(t)?1/0:t});return Math.min.apply(Math,t)},zs.vd=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(lt(e,this.a[i].initData))return;At(this,t.initDataType,e)},zs.uc=function(t){this.h.delayLicenseRequestUntilPlayed&&this.l.paused&&!this.X?this.J.push(t):kt(this,t)},zs.oc=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].fa!=t;++e);if(e!=this.a.length){var i=!1;t.keyStatuses.forEach(function(t,n){if("string"==typeof n){var r=n;n=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==n.byteLength){var r=new DataView(n),a=r.getUint32(0,!0),s=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,a,!1),r.setUint16(4,s,!1),r.setUint16(6,o,!1)}"com.microsoft.playready"==this.b.keySystem&&"status-pending"==t&&(t="usable"),"status-pending"!=t&&(this.a[e].loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()),"expired"==t&&(i=!0),r=ct(new Uint8Array(n)),this.C[r]=t}.bind(this));var n=t.expiration-Date.now();(0>n||i&&1e3>n)&&!this.a[e].na&&(this.a.splice(e,1),t.close()),at(this.D,.5)}},zs.$d=function(){function t(t,e){return"expired"==e}!Y(this.C)&&W(this.C,t)&&this.g(new h(2,6,6014)),this.s.Hb(this.C)},zs.Gd=function(){for(var t=0;t<this.J.length;t++)kt(this,this.J[t]);this.X=!0,this.J=[]},zs.Zd=function(){this.a.forEach(function(t){var e=t.Gb,i=t.fa.expiration;isNaN(i)&&(i=1/0),i!=e&&(this.s.onExpirationUpdated(t.fa.sessionId,i),t.Gb=i)}.bind(this))};var ao={};e("shaka.text.TextEngine.registerParser",Mt),e("shaka.text.TextEngine.unregisterParser",function(t){delete ao[t]}),Ct.prototype.o=function(){return this.c=this.f=null,Promise.resolve()},Ct.prototype.pe=function(t){this.c=t},Ct.prototype.setDisplayer=Ct.prototype.pe,Ct.prototype.remove=function(t,e){return Promise.resolve().then(function(){!this.c||!this.c.remove(t,e)||null==this.a||e<=this.a||t>=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&e<this.b?this.a=e:t>this.a&&e>=this.b&&(this.b=t))}.bind(this))},Ut.prototype.parseInit=function(t){this.Ta(t,0,null,null)},Ut.prototype.parseMedia=function(t,e){return this.Ta(t,e.periodStart,e.segmentStart,e.segmentEnd)},zs=jt.prototype,zs.o=function(){this.i=!0;var t,e=[];for(t in this.c){var i=this.c[t],n=i[0];for(this.c[t]=i.slice(0,1),n&&e.push(n.p.catch(x)),n=1;n<i.length;++n)i[n].p.catch(x),i[n].p.reject()}return this.a&&e.push(this.a.o()),Promise.all(e).then(function(){this.h.o(),this.j=this.a=this.f=this.g=this.h=null,this.b={},this.c={}}.bind(this))},zs.init=function(t){for(var e in t){var i=t[e],i=Q(i.mimeType,i.codecs);"text"==e?Ft(this,i):(i=this.f.addSourceBuffer(i),F(this.h,i,"error",this.Be.bind(this,e)),F(this.h,i,"updateend",this.Ha.bind(this,e)),this.b[e]=i,this.c[e]=[])}},zs.yb=function(){var t=this.a&&null!=this.a.a?[{start:this.a.a,end:this.a.b}]:[];return{total:Lt(this.g.buffered),audio:Lt(Ht(this,"audio")),video:Lt(Ht(this,"video")),text:t}},zs.remove=function(t,e,i){return"text"==t?this.a.remove(e,i):Xt(this,t,this.Ac.bind(this,t,e,i))},zs.endOfStream=function(t){return Yt(this,function(){t?this.f.endOfStream(t):this.f.endOfStream()}.bind(this))},zs.ga=function(t){return Yt(this,function(){this.f.duration=t}.bind(this))},zs.W=function(){return this.f.duration},zs.Ae=function(t,e){this.b[t].appendBuffer(e)},zs.Ac=function(t,e,i){i<=e?this.Ha(t):this.b[t].remove(e,i)},zs.Pc=function(t){var e=this.b[t].appendWindowStart,i=this.b[t].appendWindowEnd;this.b[t].abort(),this.b[t].appendWindowStart=e,this.b[t].appendWindowEnd=i,this.Ha(t)},zs.Yc=function(t){this.g.currentTime-=.001,this.Ha(t)},zs.re=function(t,e){this.b[t].timestampOffset=e,this.Ha(t)},zs.oe=function(t,e,i){this.b[t].appendWindowStart=0,this.b[t].appendWindowEnd=i,this.b[t].appendWindowStart=e,this.Ha(t)},zs.Be=function(t){this.c[t][0].p.reject(new h(2,3,3014,this.g.error?this.g.error.code:0))},zs.Ha=function(t){var e=this.c[t][0];e&&(e.p.resolve(),zt(this,t))};var so=1,oo=2,uo={aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bod:"bo",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",div:"dv",dut:"nl",dzo:"dz",ell:"el",eng:"en",epo:"eo",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",hye:"hy",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu",lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mkd:"mk",mlg:"mg",mlt:"mt",mon:"mn",mri:"mi",msa:"ms",mya:"my",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",sqi:"sq",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zho:"zh",zul:"zu"};e("shaka.abr.SimpleAbrManager",pe),pe.prototype.stop=function(){this.h=null,this.c=!1,this.g=[],this.f=null},pe.prototype.stop=pe.prototype.stop,pe.prototype.init=function(t){this.h=t},pe.prototype.init=pe.prototype.init,pe.prototype.chooseVariant=function(){var t=me(this.a.restrictions,this.g),e=this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate);if(this.g.length&&!t.length)throw new h(2,4,4012);for(var i=t[0]||null,n=0;n<t.length;++n){var r=t[n],a=(t[n+1]||{bandwidth:1/0}).bandwidth/this.a.bandwidthUpgradeTarget;e>=r.bandwidth/this.a.bandwidthDowngradeTarget&&e<=a&&(i=r)}return this.f=Date.now(),i},pe.prototype.chooseVariant=pe.prototype.chooseVariant,pe.prototype.enable=function(){this.c=!0},pe.prototype.enable=pe.prototype.enable,pe.prototype.disable=function(){this.c=!1},pe.prototype.disable=pe.prototype.disable,pe.prototype.segmentDownloaded=function(t,e){var i=this.b;if(!(16e3>e)){var n=8e3*e/t,a=t/1e3;i.a+=e,r(i.b,a,n),r(i.c,a,n)}if(null!=this.f&&this.c)t:{if(this.i){if(Date.now()-this.f<1e3*this.a.switchInterval)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i=this.chooseVariant(),this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate),this.h(i)}},pe.prototype.segmentDownloaded=pe.prototype.segmentDownloaded,pe.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate)},pe.prototype.getBandwidthEstimate=pe.prototype.getBandwidthEstimate,pe.prototype.setVariants=function(t){this.g=t},pe.prototype.setVariants=pe.prototype.setVariants,pe.prototype.configure=function(t){this.a=t},pe.prototype.configure=pe.prototype.configure;var ho="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),co="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),lo=["loop","playbackRate"],fo=["pause","play"],po="adaptation buffering emsg error loading streaming texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading".split(" "),mo="drmInfo getAudioLanguages getBufferedInfo getConfiguration getExpiration getManifest getManifestUri getPlaybackRate getTextLanguages getTextTracks getStats getVariantTracks isAudioOnly isBuffering isInProgress isLive isTextTrackVisible keySystem seekRange".split(" "),vo=["getPlayheadTimeAsDate","getPresentationStartTimeAsDate"],go=[["getConfiguration","configure"]],bo=[["isTextTrackVisible","setTextTrackVisibility"]],yo="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectTextLanguage selectTextTrack selectVariantTrack setTextTrackVisibility trickPlay".split(" "),To=["load","unload"],wo=!1,Eo=null;zs=ye.prototype,zs.o=function(){return we(this),Eo&&Te(this),this.D=this.C=this.g=null,this.b=this.h=!1,this.m=this.l=this.f=this.c=this.a=this.i=null,Promise.resolve()},zs.aa=function(){return this.b},zs.Nb=function(){return this.B},zs.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.h=!0,this.g();var e=new chrome.cast.SessionRequest(this.J),e=new chrome.cast.ApiConfig(e,this.nc.bind(this),this.Id.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){}),wo&&setTimeout(this.g.bind(this),20),(e=Eo)&&e.status!=chrome.cast.SessionStatus.STOPPED?this.nc(e):Eo=null}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},zs.Rb=function(t){this.i=t,this.b&&Ee({type:"appData",appData:this.i})},zs.cast=function(t){return this.h?wo?this.b?Promise.reject(new h(1,8,8002)):(this.f=new y,chrome.cast.requestSession(this.Jb.bind(this,t),this.lc.bind(this)),this.f):Promise.reject(new h(1,8,8001)):Promise.reject(new h(1,8,8e3))},zs.lb=function(){this.b&&(we(this),Eo&&(Te(this),Eo.stop(function(){},function(){}),Eo=null))},zs.get=function(t,e){if("video"==t){if(0<=fo.indexOf(e))return this.zc.bind(this,t,e)}else if("player"==t){if(0<=vo.indexOf(e)&&!this.get("player","isLive")())return function(){};if(0<=yo.indexOf(e))return this.zc.bind(this,t,e);if(0<=To.indexOf(e))return this.de.bind(this,t,e);if(0<=mo.indexOf(e))return this.vc.bind(this,t,e)}return this.vc(t,e)},zs.set=function(t,e,i){this.a[t][e]=i,Ee({type:"set",targetName:t,property:e,value:i})},zs.Jb=function(t,e){Eo=e,e.addUpdateListener(this.l),e.addMessageListener("urn:x-cast:com.google.shaka.v2",this.m),this.mc(),Ee({type:"init",initState:t,appData:this.i}),this.f.resolve()},zs.lc=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.f.reject(new h(2,8,e,t))},zs.vc=function(t,e){return this.a[t][e]},zs.zc=function(t,e){Ee({type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},zs.de=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new y,r=this.s.toString();return this.s++,this.c[r]=n,Ee({type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},zs.nc=function(t){var e=this.w();this.f=new y,this.j=!0,this.Jb(e,t)},zs.Id=function(t){wo="available"==t,this.g()},zs.mc=function(){var t=!!Eo&&"connected"==Eo.status;if(this.b&&!t){this.D();for(var e in this.a)this.a[e]={};we(this)}this.B=(this.b=t)?Eo.receiver.friendlyName:"",this.g()},zs.Cd=function(t,e){var i=ge(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.C(n,new G(r.type,r));break;case"update":r=i.update;for(n in r){var i=this.a[n]||{};for(a in r[n])i[a]=r[n][a]}this.j&&(this.L(),this.j=!1);break;case"asyncComplete":n=i.id;var a=i.error;if(i=this.c[n],delete this.c[n],i)if(a){n=new h(a.severity,a.category,a.code);for(r in a)n[r]=a[r];i.reject(n)}else i.resolve()}},Se.prototype.addEventListener=function(t,e){this.vb.push(t,e)},Se.prototype.removeEventListener=function(t,e){this.vb.remove(t,e)},Se.prototype.dispatchEvent=function(t){for(var e=this.vb.get(t.type)||[],i=0;i<e.length;++i){t.target=this.bb,t.currentTarget=this.bb;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(t){}if(t.a)break}return t.defaultPrevented},i(Ae),e("shaka.cast.CastProxy",Ae),Ae.prototype.o=function(t){return t&&this.a&&this.a.lb(),t=[this.i?this.i.o():null,this.b?this.b.o():null,this.a?this.a.o():null],this.a=this.i=this.j=this.h=this.b=this.c=null,Promise.all(t)},Ae.prototype.destroy=Ae.prototype.o,Ae.prototype.nd=function(){return this.h},Ae.prototype.getVideo=Ae.prototype.nd,Ae.prototype.dd=function(){return this.j},Ae.prototype.getPlayer=Ae.prototype.dd,Ae.prototype.Qc=function(){return!!this.a&&(this.a.h&&wo)},Ae.prototype.canCast=Ae.prototype.Qc,Ae.prototype.aa=function(){return!!this.a&&this.a.aa()},Ae.prototype.isCasting=Ae.prototype.aa,Ae.prototype.Nb=function(){return this.a?this.a.Nb():""},Ae.prototype.receiverName=Ae.prototype.Nb,Ae.prototype.cast=function(){var t=this.fc();return this.a.cast(t).then(function(){return this.b.sb()}.bind(this))},Ae.prototype.cast=Ae.prototype.cast,Ae.prototype.Rb=function(t){this.a.Rb(t)},Ae.prototype.setAppData=Ae.prototype.Rb,Ae.prototype.Ee=function(){var t=this.a;if(t.b){var e=t.w();chrome.cast.requestSession(t.Jb.bind(t,e),t.lc.bind(t))}},Ae.prototype.suggestDisconnect=Ae.prototype.Ee,Ae.prototype.lb=function(){this.a.lb()},Ae.prototype.forceDisconnect=Ae.prototype.lb,zs=Ae.prototype,zs.fc=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.ib,startTime:null};return this.c.pause(),lo.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),go.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),bo.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},zs.ve=function(){this.dispatchEvent(new G("caststatuschanged"))},zs.we=function(){this.f.dispatchEvent(new G(this.h.paused?"pause":"play"))},zs.ye=function(){go.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this));var t=this.a.get("player","getManifestUri")(),e=this.a.get("video","ended"),i=Promise.resolve(),n=this.c.autoplay,r=null;e||(r=this.a.get("video","currentTime")),t&&(this.c.autoplay=!1,i=this.b.load(t,r),i.catch(function(t){this.b.dispatchEvent(new G("error",{detail:t}))}.bind(this)));var a={};lo.forEach(function(t){a[t]=this.a.get("video",t)}.bind(this)),i.then(function(){lo.forEach(function(t){this.c[t]=a[t]}.bind(this)),bo.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this)),this.c.autoplay=n,t&&this.c.play()}.bind(this))},zs.Le=function(t){if("addEventListener"==t)return this.f.addEventListener.bind(this.f);if("removeEventListener"==t)return this.f.removeEventListener.bind(this.f);if(this.a.aa()&&!Object.keys(this.a.a.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.aa()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},zs.Ne=function(t,e){this.a.aa()?this.a.set("video",t,e):this.c[t]=e},zs.Me=function(t){this.a.aa()||this.f.dispatchEvent(new G(t.type,t))},zs.Xd=function(t){return"addEventListener"==t?this.g.addEventListener.bind(this.g):"removeEventListener"==t?this.g.removeEventListener.bind(this.g):"getMediaElement"==t?function(){return this.h}.bind(this):"getNetworkingEngine"==t?this.b.gc.bind(this.b):this.a.aa()&&!Object.keys(this.a.a.video).length&&0<=mo.indexOf(t)||!this.a.aa()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},zs.Yd=function(t){this.a.aa()||this.g.dispatchEvent(t)},zs.xe=function(t,e){this.a.aa()&&("video"==t?this.f.dispatchEvent(e):"player"==t&&this.g.dispatchEvent(e))},i(Ie),e("shaka.cast.CastReceiver",Ie),Ie.prototype.isConnected=function(){return this.i},Ie.prototype.isConnected=Ie.prototype.isConnected,Ie.prototype.qd=function(){return this.f},Ie.prototype.isIdle=Ie.prototype.qd,Ie.prototype.o=function(){var e=this.b?this.b.o():Promise.resolve();return null!=this.h&&t.clearTimeout(this.h),this.l=this.j=this.b=this.a=null,this.i=!1,this.f=!0,this.h=this.g=this.c=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},Ie.prototype.destroy=Ie.prototype.o,zs=Ie.prototype,zs.tc=function(){this.i=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,_e(this)},zs.wc=function(t,e){this.b&&(this.Kb(),Re(this,{type:"event",targetName:t,event:e},this.c))},zs.Kb=function(){null!=this.h&&t.clearTimeout(this.h),this.h=t.setTimeout(this.Kb.bind(this),500);var e={video:{},player:{}};co.forEach(function(t){e.video[t]=this.a[t]}.bind(this));var i=mo;this.b.R()&&(i=i.concat(vo)),i.forEach(function(t){e.player[t]=this.b[t]()}.bind(this)),(i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(e.video.volume=i.level,e.video.muted=i.muted),Re(this,{type:"update",update:e},this.c)},zs.Xc=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&Re(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}},this.c),Re(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.c)},zs.Ld=function(t){var e=ge(t.data);switch(e.type){case"init":xe(this,e.initState,e.appData),this.Kb();break;case"appData":this.l(e.appData);break;case"set":var i=e.targetName,n=e.property,r=e.value;if("video"==i){if(e=cast.receiver.CastReceiverManager.getInstance(),"volume"==n){e.setSystemVolumeLevel(r);break}if("muted"==n){e.setSystemVolumeMuted(r);break}}this.j[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.j[i],i[n].apply(i,r);break;case"asyncCall":i=e.targetName,n=e.methodName,r=e.args,e=e.id,t=t.senderId,i=this.j[i],i[n].apply(i,r).then(this.Ec.bind(this,t,e,null),this.Ec.bind(this,t,e))}},zs.xd=function(t){var e=ge(t.data);switch(e.type){case"PLAY":this.a.play(),Ne(this,0);break;case"PAUSE":this.a.pause(),Ne(this,0);break;case"SEEK":t=e.currentTime;var i=e.resumeState;null!=t&&(this.a.currentTime=Number(t)),i&&"PLAYBACK_START"==i?(this.a.play(),Ne(this,0)):i&&"PLAYBACK_PAUSE"==i&&(this.a.pause(),Ne(this,0));break;case"STOP":this.b.sb().then(function(){Ne(this,0)}.bind(this));break;case"GET_STATUS":Ne(this,Number(e.requestId));break;case"VOLUME":i=e.volume,t=i.level;var i=i.muted,n=this.a.volume,r=this.a.muted;null!=t&&(this.a.volume=Number(t)),null!=i&&(this.a.muted=i),n==this.a.volume&&r==this.a.muted||Ne(this,0);break;case"LOAD":i=e.media.contentId,t=e.currentTime;var a=this.m(i);this.a.autoplay=!0,this.b.load(a,t).then(function(){Ne(this,0,{contentId:a,streamType:this.b.R()?"LIVE":"BUFFERED",contentType:""})}.bind(this)).catch(function(t){var i="LOAD_FAILED";7==t.category&&7e3==t.code&&(i="LOAD_CANCELLED"),Re(this,{requestId:Number(e.requestId),type:i},this.g)}.bind(this));break;default:Re(this,{requestId:Number(e.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.g)}},zs.Ec=function(t,e,i){Re(this,{type:"asyncComplete",id:e,error:i},this.c,t)};var So={IDLE:"IDLE",Nc:"PLAYING",Lc:"BUFFERING",Mc:"PAUSED"},Ao={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"};e("shaka.media.InitSegmentReference",ti),e("shaka.media.SegmentReference",ei),e("shaka.util.DataViewReader",ii);var ko=1;ii.Endianness={Oe:0,Qe:ko},ii.prototype.da=function(){return this.v<this.O.byteLength},ii.prototype.hasMoreData=ii.prototype.da,ii.prototype.fd=function(){return this.v},ii.prototype.getPosition=ii.prototype.fd,ii.prototype.$c=function(){return this.O.byteLength},ii.prototype.getLength=ii.prototype.$c,ii.prototype.Mb=function(){try{var t=this.O.getUint8(this.v)}catch(t){ni()}return this.v+=1,t},ii.prototype.readUint8=ii.prototype.Mb,ii.prototype.yc=function(){try{var t=this.O.getUint16(this.v,this.a)}catch(t){ni()}return this.v+=2,t},ii.prototype.readUint16=ii.prototype.yc,ii.prototype.F=function(){try{var t=this.O.getUint32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readUint32=ii.prototype.F,ii.prototype.xc=function(){try{var t=this.O.getInt32(this.v,this.a)}catch(t){ni()}return this.v+=4,t},ii.prototype.readInt32=ii.prototype.xc,ii.prototype.Va=function(){try{if(this.a)var t=this.O.getUint32(this.v,!0),e=this.O.getUint32(this.v+4,!0);else e=this.O.getUint32(this.v,!1),t=this.O.getUint32(this.v+4,!1)}catch(t){ni()}if(2097151<e)throw new h(2,3,3001);return this.v+=8,e*Math.pow(2,32)+t},ii.prototype.readUint64=ii.prototype.Va,ii.prototype.Ja=function(t){this.v+t>this.O.byteLength&&ni();var e=ri(this,this.v,this.v+t);return this.v+=t,new Uint8Array(e)},ii.prototype.readBytes=ii.prototype.Ja,ii.prototype.I=function(t){this.v+t>this.O.byteLength&&ni(),this.v+=t},ii.prototype.skip=ii.prototype.I,ii.prototype.Lb=function(){for(var t=this.v;this.da()&&this.O.getUint8(this.v);)this.v+=1;return t=ri(this,t,this.v),this.v+=1,Z(t)},ii.prototype.readTerminatedString=ii.prototype.Lb,e("shaka.util.Mp4Parser",ai),ai.prototype.G=function(t,e){var i=hi(t);return this.b[i]=0,this.a[i]=e,this},ai.prototype.box=ai.prototype.G,ai.prototype.ca=function(t,e){var i=hi(t);return this.b[i]=1,this.a[i]=e,this},ai.prototype.fullBox=ai.prototype.ca,ai.prototype.parse=function(t){for(t=new ii(new DataView(t),0);t.da();)this.qb(0,t)},ai.prototype.parse=ai.prototype.parse,ai.prototype.qb=function(t,e){var i=e.v,n=e.F(),r=e.F();switch(n){case 0:n=e.O.byteLength-i;break;case 1:n=e.Va()}var a=this.a[r];if(a){var s=null,o=null;1==this.b[r]&&(o=e.F(),s=o>>>24,o&=16777215),r=i+n-e.v,r=0<r?e.Ja(r).buffer:new ArrayBuffer(0),r=new ii(new DataView(r),0),a({Ta:this,version:s,ec:o,u:r,size:n,start:i+t})}else e.I(i+n-e.v)},ai.prototype.parseNext=ai.prototype.qb,ai.children=si,ai.sampleDescription=oi,ai.allData=ui,e("shaka.media.SegmentIndex",di),di.prototype.o=function(){return this.a=null,Promise.resolve()},di.prototype.destroy=di.prototype.o,di.prototype.find=function(t){for(var e=this.a.length-1;0<=e;--e){var i=this.a[e];if(t>=i.startTime&&t<i.endTime)return i.position}return this.a.length&&t<this.a[0].startTime?this.a[0].position:null},di.prototype.find=di.prototype.find,di.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||t>=this.a.length?null:this.a[t]):null},di.prototype.get=di.prototype.get,di.prototype.ob=function(t){for(var e,i,n,r=[],a=e=0;e<this.a.length&&a<t.length;)i=this.a[e],n=t[a],i.startTime<n.startTime?(r.push(i),e++):(i.startTime>n.startTime?e||r.push(n):(.1<Math.abs(i.endTime-n.endTime)?(n=new ei(i.position,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n)):r.push(i),e++),a++);for(;e<this.a.length;)r.push(this.a[e++]);if(r.length)for(e=r[r.length-1].position+1;a<t.length;)n=t[a++],n=new ei(e++,n.startTime,n.endTime,n.a,n.T,n.K),r.push(n);else r=t;this.a=r},di.prototype.merge=di.prototype.ob,di.prototype.xb=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++e);this.a.splice(0,e)},di.prototype.evict=di.prototype.xb;var Io;pi.prototype.da=function(){return this.a.da()},yi.prototype.parse=function(t,e,i,n){var r;if(e=new pi(new DataView(e)),440786851!=mi(e).id)throw new h(2,3,3008);var a=mi(e);if(408125543!=a.id)throw new h(2,3,3009);for(e=a.a.byteOffset,a=new pi(a.a),r=null;a.da();){var s=mi(a);if(357149030==s.id){r=s;break}}if(!r)throw new h(2,3,3010);for(a=new pi(r.a),r=1e6,s=null;a.da();){var o=mi(a);if(2807729==o.id)r=bi(o);else if(17545==o.id)if(s=o,4==s.a.byteLength)s=s.a.getFloat32(0);else{if(8!=s.a.byteLength)throw new h(2,3,3003);s=s.a.getFloat64(0)}}if(null==s)throw new h(2,3,3011);if(a=r/1e9,r=s*a,t=mi(new pi(new DataView(t))),475249515!=t.id)throw new h(2,3,3007);return Ti(t,e,a,r,i,n)};var Po={},_o={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){_o[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){Po[t]=e}),e("shaka.media.PresentationTimeline",Ui),Ui.prototype.W=function(){return this.a},Ui.prototype.getDuration=Ui.prototype.W,Ui.prototype.ga=function(t){this.a=t},Ui.prototype.setDuration=Ui.prototype.ga,Ui.prototype.gd=function(){return this.c},Ui.prototype.getPresentationStartTime=Ui.prototype.gd,Ui.prototype.Gc=function(t){this.i=t},Ui.prototype.setClockOffset=Ui.prototype.Gc,Ui.prototype.rb=function(t){this.h=t},Ui.prototype.setStatic=Ui.prototype.rb,Ui.prototype.jd=function(){return this.f},Ui.prototype.getSegmentAvailabilityDuration=Ui.prototype.jd,Ui.prototype.Ic=function(t){this.f=t},Ui.prototype.setSegmentAvailabilityDuration=Ui.prototype.Ic,Ui.prototype.Hc=function(t){this.j=t},Ui.prototype.setDelay=Ui.prototype.Hc,Ui.prototype.Ga=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b))},Ui.prototype.notifySegments=Ui.prototype.Ga,Ui.prototype.Eb=function(t){this.b=Math.max(this.b,t)},Ui.prototype.notifyMaxSegmentDuration=Ui.prototype.Eb,Ui.prototype.R=function(){return 1/0==this.a&&!this.h},Ui.prototype.isLive=Ui.prototype.R,Ui.prototype.va=function(){return 1/0!=this.a&&!this.h},Ui.prototype.isInProgress=Ui.prototype.va,Ui.prototype.ka=function(){return this.Da(0)},Ui.prototype.getSegmentAvailabilityStart=Ui.prototype.ka,Ui.prototype.Da=function(t){if(1/0==this.f)return this.g;var e=this.ua();return Math.max(this.g,Math.min(e-this.f+t,e))},Ui.prototype.getSafeAvailabilityStart=Ui.prototype.Da,Ui.prototype.Fc=function(t){this.g=t},Ui.prototype.setAvailabilityStart=Ui.prototype.Fc,Ui.prototype.ua=function(){return this.R()||this.va()?Math.min(Math.max(0,(Date.now()+this.i)/1e3-this.b-this.c),this.a):this.a},Ui.prototype.getSegmentAvailabilityEnd=Ui.prototype.ua,Ui.prototype.nb=function(){return Math.max(0,this.ua()-(this.R()||this.va()?this.j:0))},Ui.prototype.getSeekRangeEnd=Ui.prototype.nb,e("shaka.dash.DashParser",ji),zs=ji.prototype,zs.configure=function(t){this.b=t},zs.start=function(t,e){return this.g=[t],this.a=e,Bi(this).then(function(){return this.a&&Xi(this,0),this.c}.bind(this))},zs.stop=function(){return this.b=this.a=null,this.g=[],this.c=null,this.i=[],this.j={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},zs.update=function(){Bi(this).catch(function(t){this.a&&this.a.onError(t)}.bind(this))},zs.onExpirationUpdated=function(){},zs.Td=function(t,e){t.V=Yi(e,t.Y,null);var i=!1,n=Le(e,"Role"),r=n.map(function(t){return t.getAttribute("value")}).filter(R),a=void 0;"text"==t.V.contentType&&(a="subtitle");for(var s=0;s<n.length;s++){var o=n[s].getAttribute("schemeIdUri");if(null==o||"urn:mpeg:dash:role:2011"==o)switch(o=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":a=o}}var u=null,c=!1;if(Le(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")?u=t.getAttribute("value"):c=!0}),c)return null;var n=Le(e,"ContentProtection"),l=Ke(n,this.b.dash.customScheme,this.b.dash.ignoreDrmInfo),n=Wt(e.getAttribute("lang")||"und"),o=e.getAttribute("label"),s=Le(e,"Representation"),r=s.map(this.Wd.bind(this,t,l,a,n,o,i,r)).filter(function(t){return!!t});if(!r.length)throw new h(2,4,4003);return t.V.contentType&&"application"!=t.V.contentType||(t.V.contentType=Qi(r[0].mimeType,r[0].codecs),r.forEach(function(e){e.type=t.V.contentType})),r.forEach(function(t){l.drmInfos.forEach(function(e){t.keyId&&e.keyIds.push(t.keyId)})}),a=s.map(function(t){return t.getAttribute("id")}).filter(R),{id:t.V.id||"__fake__"+this.h++,contentType:t.V.contentType,language:n,Cb:i,streams:r,drmInfos:l.drmInfos,Wb:u,ee:a}},zs.Wd=function(t,e,i,n,r,a,s,o){if(t.A=Yi(o,t.V,null),!$i(t.A))return null;t.bandwidth=Me(o,"bandwidth",Fe)||0;var u=this.fe.bind(this);if(t.A.Wa)u=Si(t,u);else if(t.A.pa)u=Ii(t,this.j);else if(t.A.Xa)u=Ri(t,u,this.j,!!this.c);else{var h=t.A.$,c=t.S.duration||0;u={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<c?1:null},getSegmentReference:function(t){return 1!=t?null:new ei(1,0,c,function(){return h},0,null)},initSegmentReference:null,Z:0}}return o=Le(o,"ContentProtection"),o=Ge(o,this.b.dash.customScheme,e,this.b.dash.ignoreDrmInfo),{id:this.h++,createSegmentIndex:u.createSegmentIndex,findSegmentPosition:u.findSegmentPosition,getSegmentReference:u.getSegmentReference,initSegmentReference:u.initSegmentReference,presentationTimeOffset:u.Z,mimeType:t.A.mimeType,codecs:t.A.codecs,frameRate:t.A.frameRate,bandwidth:t.bandwidth,width:t.A.width,height:t.A.height,kind:i,encrypted:0<e.drmInfos.length,keyId:o,language:n,label:r,type:t.V.contentType,primary:a,trickModeVideo:null,containsEmsgBoxes:t.A.containsEmsgBoxes,roles:s,channelsCount:t.A.Fb}},zs.ze=function(){this.f=null;var t=Date.now();Bi(this).then(function(){this.a&&Xi(this,(Date.now()-t)/1e3)}.bind(this)).catch(function(t){this.a&&(t.severity=1,this.a.onError(t),Xi(this,0))}.bind(this))},zs.Vd=function(t,e,i){var n=i.getAttribute("schemeIdUri")||"",r=i.getAttribute("value")||"",a=Me(i,"timescale",Ve)||1;Le(i,"Event").forEach(function(i){var s=Me(i,"presentationTime",Ve)||0,o=Me(i,"duration",Ve)||0,s=s/a+t,o=s+o/a;null!=e&&(s=Math.min(s,t+e),o=Math.min(o,t+e)),i={schemeIdUri:n,value:r,startTime:s,endTime:o,id:i.getAttribute("id")||"",eventElement:i},this.a.onTimelineRegionAdded(i)}.bind(this))},zs.fe=function(t,e,i){return t=L(t,this.b.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.networkingEngine.request(1,t).then(function(t){return t.data})},_o.mpd=ji,Po["application/dash+xml"]=ji,tn.prototype.toString=function(){function t(t){return t.name+'="'+t.value+'"'}return this.value?"#"+this.name+":"+this.value:0<this.a.length?"#"+this.name+":"+this.a.map(t).join(","):"#"+this.name},tn.prototype.getAttribute=function(t){var e=this.a.filter(function(e){return e.name==t});return e.length?e[0]:null};var xo="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),Ro="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");e("shaka.net.DataUriPlugin",mn),mn.parse=function(e){var i=e.split(":");if(2>i.length||"data"!=i[0])throw new h(2,1,1004,e);if(i=i.slice(1).join(":").split(","),2>i.length)throw new h(2,1,1004,e);var n=i[0],i=t.decodeURIComponent(i.slice(1).join(",")),n=n.split(";"),r=null;if(1<n.length&&(r=n[1]),"base64"==r)e=ut(i).buffer;else{if(r)throw new h(2,1,1005,e);e=it(i)}return{data:e,contentType:n[0]}},io.data=mn,e("shaka.hls.HlsParser",vn),zs=vn.prototype,zs.configure=function(t){this.h=t},zs.start=function(t,e){return this.b=e,this.m=t,Bn(this,t).then(function(e){return bn(this,e.data,t).then(function(){return Fn(this,this.c),this.B}.bind(this))}.bind(this))},zs.stop=function(){return this.h=this.b=null,this.g={},this.C={},this.B=null,Promise.resolve()},zs.update=function(){if(this.f){for(var t=[],e=Object.keys(this.s),i=0;i<e.length;i++){var n=e[i];t.push(gn(this,this.s[n],n))}return Promise.all(t)}},zs.onExpirationUpdated=function(){};var No={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},Do={audio:{mp4:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",ts:"video/mp2t"},video:{mp4:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};vn.prototype.J=function(){this.b&&(this.i=null,this.update().then(function(){Fn(this,this.c)}.bind(this)).catch(function(t){this.b&&(t.severity=1,this.b.onError(t),Fn(this,0))}.bind(this)))};var Lo={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(t){if("SAMPLE-AES-CENC"!=Un(t,"METHOD"))return null;var e=Un(t,"URI"),e=mn.parse(e),e=new Uint8Array(e.data),e=X("com.widevine.alpha",[{initDataType:"cenc",initData:e}]);return(t=nn(t,"KEYID"))&&(e.keyIds=[t.substr(2).toLowerCase()]),e}};_o.m3u8=vn,Po["application/x-mpegurl"]=vn,Po["application/vnd.apple.mpegurl"]=vn,zs=Hn.prototype,zs.o=function(){var t=this.b.o();return this.b=null,this.f&&(this.f.cancel(),this.f=null),this.h&&(this.h.cancel(),this.h=null),this.g&&(this.g.cancel(),this.g=null),this.J=this.L=this.l=this.c=this.a=null,t},zs.zb=function(){return this.i},zs.Ib=function(){this.w=!0,this.rc()},zs.Hd=function(){var t=this.j||0>this.i?0:this.i;this.a.playbackRate&&this.a.playbackRate!=t&&Yn(this,this.a.playbackRate)},zs.pc=function(){var t=Xn(this);this.b.ha(this.a,"timeupdate"),this.g.cancel(),.001>Math.abs(this.a.currentTime-t)?(F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))):(V(this.b,this.a,"seeking",this.Jd.bind(this)),this.a.currentTime=t)},zs.Jd=function(){F(this.b,this.a,"seeking",this.sc.bind(this)),F(this.b,this.a,"playing",this.qc.bind(this))},zs.rc=function(){if(this.a.readyState&&!this.a.paused){this.a.readyState!=this.D&&(this.s=!1,this.D=this.a.readyState);var t=this.l.smallGapLimit,e=this.a.currentTime,i=this.a.buffered;if(e<this.c.presentationTimeline.ka())i=zn(this,e),$n(this,e,i);else{t:{if(i&&i.length&&!(1==i.length&&1e-6>i.end(0)-i.start(0))){var n=.1;/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;r<i.length;r++)if(i.start(r)>e&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0<this.a.playbackRate)if(this.C!=e)this.C=e,this.X=Date.now(),this.B=!1;else if(!this.B&&this.X<Date.now()-1e3)for(n=0;n<i.length;n++)if(e>=i.start(n)&&e<i.end(n)-.5){this.a.currentTime+=.1,this.C=this.a.currentTime,this.B=!0;break}}else if((n||this.w)&&!((r=i.start(n))>=this.c.presentationTimeline.nb())){var a=r-e,t=a<=t,s=!1;t||this.s||(this.s=!0,a=new G("largegap",{currentTime:e,gapSize:a}),a.cancelable=!0,this.J(a),this.l.jumpLargeGaps&&!a.defaultPrevented&&(s=!0)),(t||s)&&(n&&i.end(n-1),$n(this,e,r))}}}},zs.ud=function(){this.m=zn(this,this.a.currentTime)},zs.sc=function(){this.w=!1;var t=this.a.currentTime,e=zn(this,t);.001<Math.abs(e-t)?$n(this,t,e):(this.s=!1,this.L())},zs.qc=function(){var t=this.a.currentTime,e=zn(this,t);.001<Math.abs(e-t)&&$n(this,t,e)},Jn.prototype.o=function(){var t=this.j?this.j.o():Promise.resolve();return this.j=null,tr(this),this.C=this.h=this.l=this.w=this.g=this.B=this.a=null,this.c=[],t},Jn.prototype.s=function(t){if(!this.c.some(function(e){return e.info.schemeIdUri==t.schemeIdUri&&e.info.startTime==t.startTime&&e.info.endTime==t.endTime})){var e={info:t,status:1};this.c.push(e);var i=new G("timelineregionadded",{detail:Qn(t)});this.h(i),this.m(!0,e)}},Jn.prototype.m=function(t,e){var i=e.info.startTime>this.a.currentTime?1:e.info.endTime<this.a.currentTime?3:2,n=2==e.status,r=2==i;i!=e.status&&((!t||n||r)&&(n||this.h(new G("timelineregionenter",{detail:Qn(e.info)})),r||this.h(new G("timelineregionexit",{detail:Qn(e.info)}))),e.status=i)},Jn.prototype.D=function(){this.f=null,Zn(this);var t=de(this.g,this.a.currentTime);t!=this.i&&(-1!=this.i&&this.C(),this.i=t);var t=Dt(this.a.buffered,this.a.currentTime),e=Rt(this.a.buffered),i=this.g.presentationTimeline,n=i.ua(),r="ended"==this.B.readyState,e=i.R()&&e>=n||this.a.ended||r;this.b?(i=1*Math.max(this.g.minBufferTime||0,this.w.rebufferingGoal),(e||t>=i)&&0!=this.b&&(this.b=!1,this.l(!1))):!e&&.5>t&&1!=this.b&&(this.b=!0,this.l(!0)),this.c.forEach(this.m.bind(this,!1))},zs=er.prototype,zs.o=function(){for(var t in this.c)Pr(this.c[t]);return this.h=this.c=this.j=this.g=this.m=this.b=this.a=null,this.f=!0,Promise.resolve()},zs.configure=function(t){this.h=t,this.w=new T({maxAttempts:Math.max(t.retryParameters.maxAttempts,2),baseDelay:t.retryParameters.baseDelay,backoffFactor:t.retryParameters.backoffFactor,fuzzFactor:t.retryParameters.fuzzFactor,timeout:0},!0)},zs.init=function(){var t=qn(this.a.Ua),t=this.a.kc(this.b.periods[de(this.b,t)]);return t.variant||t.text?cr(this,t).then(function(){this.a&&this.a.yd&&this.a.yd()}.bind(this)):Promise.reject(new h(2,5,5005))},zs.Ce=function(t){if(!this.f&&!t.xa&&null!=t.qa&&!t.sa)if(t.qa=null,t.ra)kr(this,t,t.tb);else{try{var e=pr(this,t);null!=e&&(Ir(this,t,e),t.Qa=!1)}catch(t){return void _r(this,t)}e=z(this.c),Er(this,t),e.every(function(t){return t.endOfStream})&&this.a.M.endOfStream().then(function(){this.b.presentationTimeline.ga(this.a.M.W())}.bind(this))}},zs.Ud=function(t,e,i){var n=i.u.Lb(),r=i.u.Lb(),a=i.u.F(),s=i.u.F(),o=i.u.F(),u=i.u.F();i=i.u.Ja(i.u.O.byteLength-i.u.v),t=t.startTime+e.startTime+s/a,"urn:mpeg:dash:event:2012"==n?this.a.Ad():this.a.onEvent(new G("emsg",{detail:{startTime:t,endTime:t+o/a,schemeIdUri:n,value:r,timescale:a,presentationTimeDelta:s,eventDuration:o,id:u,messageData:i}}))},e("shaka.net.HttpPlugin",xr),io.http=xr,io.https=xr,zs=Rr.prototype,zs.init=function(t,e){return Mr(this,t,e).then(function(){var e=Object.keys(t);return Promise.all(e.map(function(t){return Lr(this,t).then(function(e){this.c[t]=e}.bind(this))}.bind(this)))}.bind(this))},zs.o=function(){return Promise.all(this.b.map(function(t){try{t.transaction.abort()}catch(t){}return t.N.catch(x)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))},zs.get=function(t,e){var i;return Cr(this,t,"readonly",function(t){i=t.get(e)}).then(function(){return i.result})},zs.forEach=function(t,e){return Cr(this,t,"readonly",function(t){t.openCursor().onsuccess=function(t){(t=t.target.result)&&(e(t.value),t.continue())}})},zs.remove=function(t,e){return Cr(this,t,"readwrite",function(t){t.delete(e)})};var Co={manifest:"key",segment:"key"};Gr.prototype.o=function(){var t=this.j,e=this.l,i=this.i||Promise.resolve();return e.length&&(i=i.then(function(){return Dr(t,e)})),this.b={},this.l=[],this.i=this.a=this.w=this.s=this.j=this.m=null,i},zs=zr.prototype,zs.configure=function(){},zs.start=function(t){var e=/^offline:([0-9]+)$/.exec(t);if(!e)return Promise.reject(new h(2,1,9004,t));var i=Number(e[1]),n=Kr();return this.a=i,n?n.init(Co).then(function(){return n.get("manifest",i)}).then(function(t){if(!t)throw new h(2,9,9003,i);return $r(t)}).then(function(t){return n.o().then(function(){return t})},function(t){return n.o().then(function(){throw t})}):Promise.reject(new h(2,9,9e3))},zs.stop=function(){return Promise.resolve()},zs.update=function(){},zs.onExpirationUpdated=function(t,e){var i=Kr();i.init(Co).then(function(){return i.get("manifest",this.a)}.bind(this)).then(function(n){if(n&&!(0>n.sessionIds.indexOf(t))&&(void 0==n.expiration||n.expiration>e))return n.expiration=e,Nr(i,"manifest",n)}).catch(function(){}).then(function(){return i.o()})},Po["application/x-offline-manifest"]=zr,e("shaka.offline.OfflineScheme",Wr),io.offline=Wr,e("shaka.text.SimpleTextDisplayer",Jr),Jr.prototype.remove=function(t,e){return!!this.a&&(Zr(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),!0)},Jr.prototype.remove=Jr.prototype.remove,Jr.prototype.append=function(t){for(var e=[],i=0;i<t.length;i++){var n=Qr(t[i]);n&&e.push(n)}e.slice().sort(function(t,i){return t.startTime!=i.startTime?t.startTime-i.startTime:t.endTime!=i.endTime?t.endTime-i.startTime:e.indexOf(i)-e.indexOf(t)}).forEach(function(t){this.a.addCue(t)}.bind(this))},Jr.prototype.append=Jr.prototype.append,Jr.prototype.o=function(){return this.a&&Zr(this,function(){return!0}),this.a=null,Promise.resolve()},Jr.prototype.destroy=Jr.prototype.o,Jr.prototype.isTextVisible=function(){return"showing"==this.a.mode},Jr.prototype.isTextVisible=Jr.prototype.isTextVisible,Jr.prototype.setTextVisibility=function(t){this.a.mode=t?"showing":"hidden"},Jr.prototype.setTextVisibility=Jr.prototype.setTextVisibility,ta.prototype.then=function(t){return this.a=this.a.then(t).then(function(t){return this.b?(this.g(),Promise.reject(this.h)):Promise.resolve(t)}.bind(this)),this},ta.prototype.cancel=function(t){return this.c?Promise.resolve():(this.b=!0,this.h=t,this.i)},i(ia),e("shaka.Player",ia),ia.prototype.o=function(){return this.D=!0,na(this).then(function(){var t=Promise.all([this.Pa,la(this),this.m?this.m.o():null,this.s?this.s.o():null]);return this.f=null,this.jb=!1,this.c=this.s=this.g=this.m=null,t}.bind(this))},ia.prototype.destroy=ia.prototype.o,ia.version="v2.2.8";var Mo={};ia.registerSupportPlugin=function(t,e){Mo[t]=e},ia.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&MediaSource.isTypeSupported&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},ia.probeSupport=function(){return Pt().then(function(t){t={manifest:Mi(),media:Bt(),drm:t};for(var e in Mo)t[e]=Mo[e]();return t})},ia.prototype.load=function(t,e,i){var n=this.sb(),r=new ta;this.ia=r,this.dispatchEvent(new G("loading"));var a=Date.now();return ea(r.then(function(){return n}).then(function(){return this.j=ma(),F(this.m,this.f,"playing",this.Za.bind(this)),F(this.m,this.f,"pause",this.Za.bind(this)),F(this.m,this.f,"ended",this.Za.bind(this)),this.g=new this.c.abrFactory,oa(this),this.w=new this.c.textDisplayFactory,this.w.setTextVisibility(this.jb),Oi(t,this.s,this.c.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.i=new e,this.i.configure(this.c.manifest),e={networkingEngine:this.s,filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this),onTimelineRegionAdded:this.Nd.bind(this),onEvent:this.Ya.bind(this),onError:this.La.bind(this)},2<this.i.start.length?(o("The ManifestParser interface has changed. Please upgrade your plugin to accept the PlayerInterface structure. See the ManifestParser documentation for details."),this.i.start(t,this.s,e.filterNewPeriod,e.onError,e.onEvent)):this.i.start(t,e)}.bind(this)).then(function(e){if(e.periods.some(function(t){return t.variants.some(function(t){return t.video&&t.audio})})&&e.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return t.video&&t.audio})}),0==e.periods.length)throw new h(2,4,4014);return this.b=e,this.ib=t,this.l=new dt({Sa:this.s,onError:this.La.bind(this),Hb:this.zd.bind(this),onExpirationUpdated:this.wd.bind(this),onEvent:this.Ya.bind(this)}),this.l.configure(this.c.drm),this.l.init(e,!1)}.bind(this)).then(function(){this.Tb(this.b.periods),this.cb=Date.now()/1e3,this.Ma=this.c.preferredAudioLanguage,this.$a=this.c.preferredTextLanguage;var t=this.b.presentationTimeline.W(),e=this.c.playRangeEnd,i=this.c.playRangeStart;return 0<i&&(this.R()||this.b.presentationTimeline.Fc(i)),e<t&&(this.R()||this.b.presentationTimeline.ga(e)),Promise.all([ft(this.l,this.f),this.gb])}.bind(this)).then(function(){return this.g.chooseStreams?(o("AbrManager API has changed. The SwitchCallback signature has changed to accept a variant instead of a map. Please update your AbrManager. The old API will be removed in v2.3."),this.g.init(this.Fe.bind(this))):this.g.init(this.Kc.bind(this)),this.h=new Hn(this.f,this.b,this.c.streaming,void 0==e?null:e,this.te.bind(this),this.Ya.bind(this)),this.B=new Jn(this.f,this.L,this.b,this.c.streaming,this.Jc.bind(this),this.Ya.bind(this),this.se.bind(this)),this.J=new jt(this.f,this.L,this.w),this.a=new er(this.b,{Ua:this.h,M:this.J,Sa:this.s,kc:this.td.bind(this),jc:this.Rc.bind(this),onError:this.La.bind(this),onEvent:this.Ya.bind(this),Ad:this.Bd.bind(this),Ib:this.Kd.bind(this),filterNewPeriod:this.kb.bind(this),filterAllPeriods:this.Tb.bind(this)}),this.a.configure(this.c.streaming),this.dispatchEvent(new G("streaming")),ra(this),this.a.init()}.bind(this)).then(function(){if(this.c.streaming.startAtSegmentBoundary){var t=ba(this,qn(this.h));Kn(this.h,t)}this.b.periods.forEach(this.kb.bind(this)),Ea(this),wa(this);var t=ir(this.a),e=se(t,this.Ma,this.ab);this.g.setVariants(e),t.variants.some(function(t){return t.primary}),this.hb.forEach(this.B.s.bind(this.B)),this.hb=[],V(this.m,this.f,"loadeddata",function(){this.j.loadLatency=(Date.now()-a)/1e3}.bind(this)),this.ia=null}.bind(this))).catch(function(t){return this.ia==r&&(this.ia=null,this.dispatchEvent(new G("unloading"))),Promise.reject(t)}.bind(this))},ia.prototype.load=ia.prototype.load,ia.prototype.configure=function(t){if(t.abr&&t.abr.manager){o("AbrManager configuration has changed. Please use abrFactory instead of abr.manager. The old API will be removed in v2.3.");var e=t.abr.manager;delete t.abr.manager,t.abrFactory=function(){return e}}t.streaming&&null!=t.streaming.infiniteRetriesForLiveStreams&&(o("Streaming configuration has changed. Please use streaming.failureCallback instead of streaming.infiniteRetriesForLiveStreams. The old API will be removed in v2.3."),this.Zb=!!t.streaming.infiniteRetriesForLiveStreams,delete t.streaming.infiniteRetriesForLiveStreams),k(this.c,t,pa(this),fa(),""),sa(this)},ia.prototype.configure=ia.prototype.configure,ia.prototype.getConfiguration=function(){var t=pa(this);return k(t,this.c,pa(this),fa(),""),t},ia.prototype.getConfiguration=ia.prototype.getConfiguration,ia.prototype.ge=function(){this.c=pa(this),sa(this)},ia.prototype.resetConfiguration=ia.prototype.ge,ia.prototype.cd=function(){return this.f},ia.prototype.getMediaElement=ia.prototype.cd,ia.prototype.gc=function(){return this.s},ia.prototype.getNetworkingEngine=ia.prototype.gc,ia.prototype.bd=function(){return this.ib},ia.prototype.getManifestUri=ia.prototype.bd,ia.prototype.R=function(){return!!this.b&&this.b.presentationTimeline.R()},ia.prototype.isLive=ia.prototype.R,ia.prototype.va=function(){return!!this.b&&this.b.presentationTimeline.va()},ia.prototype.isInProgress=ia.prototype.va,ia.prototype.od=function(){if(!this.b||!this.b.periods.length)return!1;var t=this.b.periods[0].variants;return!!t.length&&!t[0].video},ia.prototype.isAudioOnly=ia.prototype.od,ia.prototype.ie=function(){var t=0,e=0;return this.b&&(e=this.b.presentationTimeline,t=e.ka(),e=e.nb()),{start:t,end:e}},ia.prototype.seekRange=ia.prototype.ie,ia.prototype.keySystem=function(){return this.l?this.l.keySystem():""},ia.prototype.keySystem=ia.prototype.keySystem,ia.prototype.drmInfo=function(){return this.l?this.l.b:null},ia.prototype.drmInfo=ia.prototype.drmInfo,ia.prototype.mb=function(){return this.l?this.l.mb():1/0},ia.prototype.getExpiration=ia.prototype.mb,ia.prototype.pd=function(){return this.Oa},ia.prototype.isBuffering=ia.prototype.pd,ia.prototype.sb=function(){return this.D?Promise.resolve():(this.dispatchEvent(new G("unloading")),na(this).then(function(){return this.Pa||(this.Pa=da(this).then(function(){this.Pa=null}.bind(this))),this.Pa}.bind(this)))},ia.prototype.unload=ia.prototype.sb,ia.prototype.zb=function(){return this.h?this.h.zb():0},ia.prototype.getPlaybackRate=ia.prototype.zb,ia.prototype.Ge=function(t){this.h&&Yn(this.h,t),this.a&&ar(this.a,1!=t)},ia.prototype.trickPlay=ia.prototype.Ge,ia.prototype.Sc=function(){this.h&&Yn(this.h,1),this.a&&ar(this.a,!1)},ia.prototype.cancelTrickPlay=ia.prototype.Sc,ia.prototype.md=function(){if(!this.b||!this.h)return[];var t=de(this.b,qn(this.h)),e=this.C[t]||{};return ee(this.b.periods[t],e.audio,e.video)},ia.prototype.getVariantTracks=ia.prototype.md,ia.prototype.ld=function(){if(!this.b||!this.h)return[];var t=de(this.b,qn(this.h));return ie(this.b.periods[t],(this.C[t]||{}).text).filter(function(t){return 0>this.eb.indexOf(t.id)}.bind(this))},ia.prototype.getTextTracks=ia.prototype.ld,ia.prototype.me=function(t){if(this.a){(t=re(ir(this.a),t))&&(ha(this,t,!1),this.Ba?this.X=t:or(this.a,t,!0))}},ia.prototype.selectTextTrack=ia.prototype.me,ia.prototype.ne=function(t,e){if(this.a){this.c.abr.enabled&&o("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=ir(this.a);(i=ne(i,t))&&i.allowedByApplication&&i.allowedByKeySystem&&(ua(this,i,!1),va(this,i,e))}},ia.prototype.selectVariantTrack=ia.prototype.ne,ia.prototype.Zc=function(){return this.a?ae(ir(this.a).variants).map(function(t){return t.language}).filter(N):[]},ia.prototype.getAudioLanguages=ia.prototype.Zc,ia.prototype.kd=function(){return this.a?ir(this.a).textStreams.map(function(t){return t.language}).filter(N):[]},ia.prototype.getTextLanguages=ia.prototype.kd,ia.prototype.ke=function(t,e){if(this.a){var i=ir(this.a);this.Ma=t,this.ab=e||"",Ta(this,i)}},ia.prototype.selectAudioLanguage=ia.prototype.ke,ia.prototype.le=function(t,e){if(this.a){var i=ir(this.a);this.$a=t,this.ub=e||"",Ta(this,i)}},ia.prototype.selectTextLanguage=ia.prototype.le,ia.prototype.rd=function(){return this.w?this.w.isTextVisible():this.jb},ia.prototype.isTextTrackVisible=ia.prototype.rd,ia.prototype.qe=function(t){this.w?this.w.setTextVisibility(t):this.jb=t,Sa(this)},ia.prototype.setTextTrackVisibility=ia.prototype.qe,ia.prototype.ed=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c+1e3*this.f.currentTime):null},ia.prototype.getPlayheadTimeAsDate=ia.prototype.ed,ia.prototype.hd=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c):null},ia.prototype.getPresentationStartTimeAsDate=ia.prototype.hd,ia.prototype.yb=function(){return this.J?this.J.yb():{total:[],audio:[],video:[],text:[]}},ia.prototype.getBufferedInfo=ia.prototype.yb,ia.prototype.getStats=function(){ga(this),this.Za();var t=null,e=null,i=this.f,i=i&&i.getVideoPlaybackQuality?i.getVideoPlaybackQuality():{};return this.h&&this.b&&(t=de(this.b,qn(this.h)),e=this.C[t],e=le(e.audio,e.video,this.b.periods[t].variants),t=e.video||{}),t||(t={}),e||(e={}),{width:t.width||0,height:t.height||0,streamBandwidth:e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.g?this.g.getBandwidthEstimate():NaN,loadLatency:this.j.loadLatency,playTime:this.j.playTime,bufferingTime:this.j.bufferingTime,switchHistory:I(this.j.switchHistory),stateHistory:I(this.j.stateHistory)}},ia.prototype.getStats=ia.prototype.getStats,ia.prototype.addTextTrack=function(t,e,i,n,r,a){if(!this.a)return Promise.reject();for(var s,o=ir(this.a),u=0;u<this.b.periods.length;u++)if(this.b.periods[u]==o){if(u==this.b.periods.length-1){if(s=this.b.presentationTimeline.W()-o.startTime,1/0==s)return Promise.reject()}else s=this.b.periods[u+1].startTime-o.startTime;break}var h={id:this.Oc++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new ei(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",kind:i,encrypted:!1,keyId:null,language:e,label:a||null,type:"text",primary:!1,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null};return this.eb.push(h.id),o.textStreams.push(h),cr(this.a,{text:h}).then(function(){if(!this.D){var t=this.b.periods.indexOf(o),n=rr(this.a);return n.text&&(this.C[t].text=n.text.id),this.eb.splice(this.eb.indexOf(h.id),1),Ta(this,o),Ea(this),{id:h.id,active:!1,type:"text",bandwidth:0,language:e,label:a||null,kind:i,width:null,height:null}}}.bind(this))},ia.prototype.addTextTrack=ia.prototype.addTextTrack,ia.prototype.Sb=function(t,e){this.fb.width=t,this.fb.height=e},ia.prototype.setMaxHardwareResolution=ia.prototype.Sb,ia.prototype.Cc=function(){if(this.a){var t=this.a;if(t.f)t=!1;else if(t.l)t=!1;else{for(var e in t.c){var i=t.c[e];i.Qa&&(i.Qa=!1,Ir(t,i,.1))}t=!0}}else t=!1;return t},ia.prototype.retryStreaming=ia.prototype.Cc,ia.prototype.ad=function(){return this.b},ia.prototype.getManifest=ia.prototype.ad,zs=ia.prototype,zs.Vc=function(t){var e=[1001,1002,1003];this.R()&&this.Zb&&0<=e.indexOf(t.code)&&(t.severity=1,this.Cc())},zs.Tb=function(t){var e=this.a?rr(this.a):{};t.forEach(function(t){Zt(this.l,e,t)}.bind(this));var i=0;if(t.forEach(function(t){0<ae(t.variants).length&&i++}.bind(this)),!i)throw new h(2,4,9009);if(i<t.length)throw new h(2,4,4011);t.forEach(function(t){if(Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),1>ae(t.variants).length)throw new h(2,4,4012)}.bind(this))},zs.kb=function(t){var e=this.a?rr(this.a):{};if(Zt(this.l,e,t),e=0<ae(t.variants).length,Qt(t,this.c.restrictions,this.fb)&&this.a&&ir(this.a)==t&&Ea(this),t=1>ae(t.variants).length,!e)throw new h(2,4,4011);if(t)throw new h(2,4,4012)},zs.ue=function(t,e){this.g&&this.g.segmentDownloaded(t,e)},zs.Jc=function(t){if(ga(this),this.Oa=t,this.Za(),this.h){var e=this.h;t!=e.j&&(e.j=t,Yn(e,e.i))}this.dispatchEvent(new G("buffering",{buffering:t}))},zs.se=function(){Ea(this)},zs.Za=function(){if(!this.D){var t=this.Oa?"buffering":this.f.ended?"ended":this.f.paused?"paused":"playing",e=Date.now()/1e3;if(this.j.stateHistory.length){var i=this.j.stateHistory[this.j.stateHistory.length-1];if(i.duration=e-i.timestamp,t==i.state)return}this.j.stateHistory.push({timestamp:e,state:t,duration:0})}},zs.te=function(){if(this.B){var t=this.B;t.c.forEach(t.m.bind(t,!0))}this.a&&ur(this.a)},zs.td=function(t){this.Ba=!0,this.g.disable();var e={audio:!1,text:!1},i=se(t,this.Ma,this.ab,e);return t=oe(t,this.$a,this.ub,e),i=ya(this,i),t=t[0]||null,this.X=this.Na=null,i&&ua(this,i,!0),t&&(ha(this,t,!0),!nr(this.a)&&i&&i.audio&&e.text&&t.language!=i.audio.language&&(this.w.setTextVisibility(!0),Sa(this))),{variant:i,text:t}},zs.Rc=function(){this.Ba=!1,this.c.abr.enabled&&this.g.enable(),this.Na&&(sr(this.a,this.Na,this.Yb),this.Na=null),this.X&&(or(this.a,this.X,!0),this.X=null)},zs.Bd=function(){this.i&&this.i.update&&this.i.update()},zs.Kd=function(){this.h&&this.h.Ib()},zs.Kc=function(t,e){ua(this,t,!0),this.a&&(sr(this.a,t,e||!1),wa(this))},zs.Fe=function(t,e){if(this.a){var i=nr(this.a);(i=ce(t.audio,t.video,i?i.variants:[]))&&this.Kc(i,e)}},zs.La=function(t){if(!this.D){var e=new G("error",{detail:t});this.dispatchEvent(e),e.defaultPrevented&&(t.handled=!0)}},zs.Nd=function(t){this.B?this.B.s(t):this.hb.push(t)},zs.Ya=function(t){this.dispatchEvent(t)},zs.Od=function(){if(this.f.error){var t=this.f.error.code;if(1!=t){var e=this.f.error.msExtendedCode;e&&(0>e&&(e+=Math.pow(2,32)),e=e.toString(16)),this.La(new h(2,3,3016,t,e,this.f.error.message))}}},zs.zd=function(t){var e=["output-restricted","internal-error"],i=ir(this.a),n=!1,r=1==Object.keys(t).length&&"00"==Object.keys(t)[0];i.variants.forEach(function(i){var a=[];i.audio&&a.push(i.audio),i.video&&a.push(i.video),a.forEach(function(a){var s=i.allowedByKeySystem;a.keyId&&(a=t[r?"00":a.keyId],i.allowedByKeySystem=!!a&&0>e.indexOf(a)),s!=i.allowedByKeySystem&&(n=!0)})});var a=rr(this.a);(a=ce(a.audio,a.video,i.variants))&&!a.allowedByKeySystem&&Ta(this,i),n&&Ea(this)},zs.wd=function(t,e){this.i&&this.i.onExpirationUpdated&&this.i.onExpirationUpdated(t,e),this.dispatchEvent(new G("expirationupdated"))},e("shaka.offline.Storage",Aa),Aa.support=ka,Aa.prototype.o=function(){var t=this.a,e=this.i?this.i.o().catch(function(){}).then(function(){if(t)return t.o()}):Promise.resolve();return this.b=this.g=this.i=this.a=null,e},Aa.prototype.destroy=Aa.prototype.o,Aa.prototype.configure=function(t){k(this.b,t,Pa(this),{},"")},Aa.prototype.configure=Aa.prototype.configure,Aa.prototype.De=function(t,e,i){function n(t){a=t}if(this.s)return Promise.reject(new h(2,9,9006));this.s=!0;var r,a=null;return _a(this).then(function(){return Da(this),Ia(this,t,n,i)}.bind(this)).then(function(i){if(Da(this),this.f=i.manifest,this.c=i.Wc,this.f.presentationTimeline.R()||this.f.presentationTimeline.va())throw new h(2,9,9005,t);this.m(this.f.periods),this.h=this.a.c.manifest++,this.l=0,i=e||{};var n=this.f.periods.map(this.C.bind(this)),a=this.c.b,s=vt(this.c);if(a){if(!s.length)throw new h(2,9,9007,t);a.initData=[]}return r={key:this.h,originalManifestUri:t,duration:this.l,size:0,expiration:this.c.mb(),periods:n,sessionIds:this.b.usePersistentLicense?s:[],drmInfo:a,appMetadata:i},Xr(this.i,r)}.bind(this)).then(function(){if(Da(this),a)throw a;return xa(this)}.bind(this)).then(function(){return Ur(r)}.bind(this)).catch(function(t){return xa(this).catch(x).then(function(){throw t})}.bind(this))},Aa.prototype.store=Aa.prototype.De,Aa.prototype.remove=function(t){function e(t){6013!=t.code&&(s=t)}var i=t.offlineUri,n=/^offline:([0-9]+)$/.exec(i);if(!n)return Promise.reject(new h(2,9,9004,i));var r,a,s=null,o=Number(n[1]);return _a(this).then(function(){return Da(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(Da(this),!t)throw new h(2,9,9003,i);return r=t,t=$r(r),a=new dt({Sa:this.g.s,onError:e,Hb:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a.configure(this.g.getConfiguration().drm),a.init(t,this.b.usePersistentLicense||!1)}.bind(this)).then(function(){return pt(a,r.sessionIds)}.bind(this)).then(function(){return a.o()}.bind(this)).then(function(){if(Da(this),s)throw s;var e=r.periods.map(function(t){return t.streams.map(function(t){var e=t.segments.map(function(t){return t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.uri),Number(t[1])});return t.initSegmentUri&&(t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.initSegmentUri),e.push(Number(t[1]))),e}).reduce(_,[])}).reduce(_,[]),i=0,n=e.length,a=this.b.progressCallback;return Dr(this.a,e,function(){i++,a(t,i/n)})}.bind(this)).then(function(){return Da(this),this.b.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},Aa.prototype.remove=Aa.prototype.remove,Aa.prototype.list=function(){var t=[];return _a(this).then(function(){return Da(this),this.a.forEach("manifest",function(e){t.push(Ur(e))})}.bind(this)).then(function(){return t})},Aa.prototype.list=Aa.prototype.list,Aa.prototype.B=function(t){for(var e,i=[],n=Wt(this.g.getConfiguration().preferredAudioLanguage),r=[0,so,oo],a=t.filter(function(t){return"variant"==t.type}),r=r.map(function(t){return a.filter(function(e){return e=Wt(e.language),$t(t,n,e)})}),s=0;s<r.length;s++)if(r[s].length){e=r[s];break}e||(r=a.filter(function(t){return t.primary}),r.length&&(e=r)),e||(e=a,a.map(function(t){return t.language}).filter(N));var o=e.filter(function(t){return t.height&&480>=t.height});return o.length&&(o.sort(function(t,e){return e.height-t.height}),e=o.filter(function(t){return t.height==o[0].height})),e.sort(function(t,e){return t.bandwidth-e.bandwidth}),e.length&&i.push(e[Math.floor(e.length/2)]),i.push.apply(i,t.filter(function(t){return"text"==t.type})),i},Aa.prototype.m=function(t){t.forEach(this.w.bind(this))},Aa.prototype.w=function(t){var e={};if(this.j){var i=this.j.filter(function(t){return"variant"==t.type}),n=null;i.length&&(n=ne(t,i[0])),n&&(n.video&&(e.video=n.video),n.audio&&(e.audio=n.audio))}Zt(this.c,e,t),Qt(t,this.g.getConfiguration().restrictions,{width:1/0,height:1/0})},Aa.prototype.C=function(t){var e,i,n=ee(t,null,null),r=ie(t,null),n=this.b.trackSelectionCallback(n.concat(r));for(this.j||(this.j=n,this.m(this.f.periods)),r=n.length-1;0<r;--r){var a=!1;for(i=r-1;0<=i;--i)if(n[r].type==n[i].type&&n[r].kind==n[i].kind&&n[r].language==n[i].language){a=!0;break}if(a)break}for(a=[],r=0;r<n.length;r++)(e=ne(t,n[r]))?(e.audio&&((i=a.filter(function(t){return t.id==e.audio.id})[0])?i.variantIds.push(e.id):(i=e.video?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.audio,i,e.id)))),e.video&&((i=a.filter(function(t){return t.id==e.video.id})[0])?i.variantIds.push(e.id):(i=e.audio?e.bandwidth/2:e.bandwidth,a.push(Na(this,t,e.video,i,e.id))))):a.push(Na(this,t,re(t,n[r]),0));return{startTime:t.startTime,streams:a}},Mo.offline=ka,e("shaka.polyfill.installAll",function(){for(var t=0;t<Oo.length;++t)Oo[t]()});var Oo=[];e("shaka.polyfill.register",La),La(function(){if(t.Document){var e=Element.prototype;e.requestFullscreen=e.requestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullscreen,e=Document.prototype,e.exitFullscreen=e.exitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen||e.webkitExitFullscreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",Ca),document.addEventListener("webkitfullscreenerror",Ca),document.addEventListener("mozfullscreenchange",Ca),document.addEventListener("mozfullscreenerror",Ca),document.addEventListener("MSFullscreenChange",Ca),document.addEventListener("MSFullscreenError",Ca)}}),La(function(){var e=navigator.userAgent;e&&0<=e.indexOf("CrKey")&&delete t.indexedDB});var Uo;La(function(){0>navigator.userAgent.indexOf("Trident/")||HTMLInputElement.prototype.addEventListener==Ma||(Uo=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=Ma)}),La(function(){if(4503599627370497!=Math.round(4503599627370497)){var t=Math.round;Math.round=function(e){var i=e;return 4503599627370496>=e&&(i=t(e)),i}}}),Oa.prototype.c=function(t){if(!(1<t.version)){var e=ct(t.u.Ja(16)),i=[];if(0<t.version)for(var n=t.u.F(),r=0;r<n;++r){var a=ct(t.u.Ja(16));i.push(a)}n=t.u.F(),t.u.I(n),this.b.push.apply(this.b,i),this.f.push(e),this.a.push({start:t.start,end:t.start+t.size-1})}},ja.prototype.createMediaKeys=function(){var t=new Fa(this.keySystem);return Promise.resolve(t)},ja.prototype.getConfiguration=function(){return this.a},Fa.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new Ha(this.a)},Fa.prototype.setServerCertificate=function(){return Promise.resolve(!1)},i(Ha),zs=Ha.prototype,zs.generateRequest=function(t,e){this.a=new y;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),F(this.f,this.c,"mskeymessage",this.Fd.bind(this)),F(this.f,this.c,"mskeyadded",this.Dd.bind(this)),F(this.f,this.c,"mskeyerror",this.Ed.bind(this)),qa(this,"status-pending")}catch(t){this.a.reject(t)}return this.a},zs.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},zs.update=function(t){this.b=new y;try{this.c.update(new Uint8Array(t))}catch(t){this.b.reject(t)}return this.b},zs.close=function(){try{this.c.close(),this.closed.resolve(),H(this.f)}catch(t){this.closed.reject(t)}return this.closed},zs.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},zs.Fd=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new G("message",{messageType:void 0==this.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message.buffer}))},zs.Dd=function(){this.a?(qa(this,"usable"),this.a.resolve(),this.a=null):this.b&&(qa(this,"usable"),this.b.resolve(),this.b=null)},zs.Ed=function(){var t=Error("EME PatchedMediaKeysMs key error");if(t.errorCode=this.c.error,this.a)this.a.reject(t),this.a=null;else if(this.b)this.b.reject(t),this.b=null;else switch(this.c.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:qa(this,"output-not-allowed");default:qa(this,"internal-error")}};var jo;zs=Xa.prototype,zs.forEach=function(t){this.a&&t(this.a,jo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=jo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},$a.prototype.createSession=function(){},$a.prototype.setServerCertificate=function(){},Wa.prototype.getConfiguration=function(){},Wa.prototype.createMediaKeys=function(){};var Bo="";es.prototype.createMediaKeys=function(){var t=new is(this.a);return Promise.resolve(t)},es.prototype.getConfiguration=function(){return this.b},zs=is.prototype,zs.createSession=function(t){var e=t||"temporary";if("temporary"!=e&&"persistent-license"!=e)throw new TypeError("Session type "+t+" is unsupported on this platform.");return t=this.b||document.createElement("video"),t.src||(t.src="about:blank"),e=new as(t,this.g,e),this.c.push(e),e},zs.setServerCertificate=function(){return Promise.resolve(!1)},zs.Sd=function(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="webm",e.initData=t.initData,this.b.dispatchEvent(e)},zs.Rd=function(t){var e=rs(this,t.sessionId);e&&(t=new G("message",{messageType:void 0==e.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},zs.Pd=function(t){(t=rs(this,t.sessionId))&&(os(t,"usable"),t.a&&t.a.resolve(),t.a=null)},zs.Qd=function(t){var e=rs(this,t.sessionId);if(e){var i=Error("EME v0.1b key error");i.errorCode=t.errorCode,i.errorCode.systemCode=t.systemCode,!t.sessionId&&e.b?(i.method="generateRequest",45==t.systemCode&&(i.message="Unsupported session type."),e.b.reject(i),e.b=null):t.sessionId&&e.a?(i.method="update",e.a.reject(i),e.a=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?os(e,"output-restricted"):1==i?os(e,"expired"):os(e,"internal-error"))}},i(as),zs=as.prototype,zs.Ub=function(t,e){if(this.a)this.a.then(this.Ub.bind(this,t,e)).catch(this.Ub.bind(this,t,e));else{if(this.a=t,"webkit-org.w3.clearkey"==this.c){var i=Z(e),n=JSON.parse(i);"oct"!=n.keys[0].kty&&(this.a.reject(Error("Response is not a valid JSON Web Key Set.")),this.a=null),i=ut(n.keys[0].k),n=ut(n.keys[0].kid)}else i=new Uint8Array(e),n=null;var r=Qa("addKey");try{this.f[r](this.c,i,n,this.sessionId)}catch(t){this.a.reject(t),this.a=null}}},zs.generateRequest=function(t,e){return ss(this,e,null)},zs.load=function(t){return"persistent-license"==this.g?ss(this,null,t):Promise.reject(Error("Not a persistent session."))},zs.update=function(t){var e=new y;return this.Ub(e,t),e},zs.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var t=Qa("cancelKeyRequest");try{this.f[t](this.c,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},zs.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var Fo;zs=us.prototype,zs.forEach=function(t){this.a&&t(this.a,Fo)},zs.get=function(t){if(this.has(t))return this.a},zs.has=function(t){var e=Fo;return!(!this.a||!lt(new Uint8Array(t),new Uint8Array(e)))},zs.entries=function(){},zs.keys=function(){},zs.values=function(){},La(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?Ja("webkit"):HTMLMediaElement.prototype.generateKeyRequest?Ja(""):t.MSMediaKeys?(jo=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Ba,t.MediaKeys=Fa,t.MediaKeySystemAccess=ja,navigator.requestMediaKeySystemAccess=Ua):(navigator.requestMediaKeySystemAccess=Ya,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=za,t.MediaKeys=$a,t.MediaKeySystemAccess=Wa))}),La(function(){if(t.MediaSource)if(t.cast&&cast.__platform__&&cast.__platform__.canDisplayType)ms();else if(navigator.vendor&&0<=navigator.vendor.indexOf("Apple")){var e=navigator.appVersion;ps(),0<=e.indexOf("Version/8")?t.MediaSource=null:0<=e.indexOf("Version/9")?hs():0<=e.indexOf("Version/10")?(hs(),ls()):0<=e.indexOf("Version/11")&&(hs(),cs())}});var Vo=0;vs.prototype.then=function(t,e){var i=new vs;switch(this.za){case 1:ws(this,i,t);break;case 2:ws(this,i,e);break;case Vo:this.c.push({N:i,wb:t}),this.b.push({N:i,wb:e})}return i},vs.prototype.catch=function(t){return this.then(void 0,t)},vs.prototype.ma=function(t){if(this.za==Vo){for(this.f=t,this.za=1,t=0;t<this.c.length;++t)ws(this,this.c[t].N,this.c[t].wb);this.c=[],this.b=[]}},vs.prototype.a=function(t){if(this.za==Vo){for(this.f=t,this.za=2,t=0;t<this.b.length;++t)ws(this,this.b[t].N,this.b[t].wb);this.c=[],this.b=[]}};var Ho=null,Ko=[];La(function(e){t.setImmediate?(As=function(e){return t.setImmediate(e)},ks=function(e){return t.clearImmediate(e)}):(As=function(e){return t.setTimeout(e,0)},ks=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=vs,t.Promise.resolve=gs,t.Promise.reject=bs,t.Promise.all=ys,t.Promise.race=Ts,t.Promise.prototype.then=vs.prototype.then,t.Promise.prototype.catch=vs.prototype.catch)}),La(function(){if(t.HTMLMediaElement){var e=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var t=e.apply(this,arguments);return t&&t.catch(function(){}),t}}}),La(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=Is)}}),La(function(){if(!t.VTTCue&&t.TextTrackCue){var e=TextTrackCue.length;if(3==e)t.VTTCue=Ps;else if(6==e)t.VTTCue=_s;else{try{var i=!!Ps(1,2,"")}catch(t){i=!1}i&&(t.VTTCue=Ps)}}}),e("shaka.text.Cue",xs);var Go="auto";xs.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Go};var qo="center",Xo={LEFT:"left",RIGHT:"right",CENTER:qo,START:"start",END:"end"};xs.textAlign=Xo;var Yo="before",zo={BEFORE:Yo,CENTER:"center",AFTER:"after"};xs.displayAlign=zo;var $o=0,Wo=2,Jo=3;xs.writingDirection={HORIZONTAL_LEFT_TO_RIGHT:$o,HORIZONTAL_RIGHT_TO_LEFT:1,VERTICAL_LEFT_TO_RIGHT:Wo,VERTICAL_RIGHT_TO_LEFT:Jo};var Qo=0,Zo=1;xs.lineInterpretation={LINE_NUMBER:Qo,PERCENTAGE:Zo};var tu="center",eu={CENTER:tu,START:"start",END:"end"};xs.lineAlign=eu;var iu=400;xs.fontWeight={NORMAL:iu,BOLD:700};var nu="normal",ru={NORMAL:nu,ITALIC:"italic",OBLIQUE:"oblique"};xs.fontStyle=ru,xs.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},Rs.prototype.parseInit=function(){},Rs.prototype.parseMedia=function(t,e){var i=Z(t),n=[],r=new DOMParser,a=null;try{a=r.parseFromString(i,"text/xml")}catch(t){throw new h(2,2,2005)}if(a){var s=a.getElementsByTagName("tt")[0];if(!s)throw new h(2,2,2005);r=s.getAttribute("ttp:frameRate"),a=s.getAttribute("ttp:subFrameRate");var o=s.getAttribute("ttp:frameRateMultiplier"),u=s.getAttribute("ttp:tickRate");if("default"!=(i=s.getAttribute("xml:space")||"default")&&"preserve"!=i)throw new h(2,2,2005);for(i="default"==i,r=new Fs(r,a,o,u),a=Ns(s.getElementsByTagName("styling")[0]),o=Ns(s.getElementsByTagName("layout")[0]),s=Ns(s.getElementsByTagName("body")[0]),u=0;u<s.length;u++){var c=s[u],l=e.periodStart,d=r,f=a,p=o,m=i;if(c.hasAttribute("begin")||c.hasAttribute("end")||!/^\s*$/.test(c.textContent)){Ds(c,m);var m=js(c.getAttribute("begin"),d),v=js(c.getAttribute("end"),d),d=js(c.getAttribute("dur"),d),g=c.textContent;if(null==v&&null!=d&&(v=m+d),null==m||null==v)throw new h(2,2,2001);l=new xs(m+l,v+l,g),m=Us(c,"region",p),p=l,"rtl"==Cs(c,m,f,"tts:direction")&&(p.writingDirection=1),v=Cs(c,m,f,"tts:writingMode"),"tb"==v||"tblr"==v?p.writingDirection=Wo:"tbrl"==v?p.writingDirection=Jo:"rltb"==v||"rl"==v?p.writingDirection=1:v&&(p.writingDirection=$o),(v=Cs(c,m,f,"tts:origin"))&&(v=lu.exec(v))&&(p.region.x=Number(v[1]),p.region.y=Number(v[2])),(v=Cs(c,m,f,"tts:extent"))&&(v=lu.exec(v))&&(p.region.width=Number(v[1]),p.region.height=Number(v[2])),(v=Cs(c,m,f,"tts:textAlign"))&&(p.positionAlign=pu[v],p.lineAlign=fu[v],p.textAlign=Xo[v.toUpperCase()]),(v=Cs(c,m,f,"tts:displayAlign"))&&(p.displayAlign=zo[v.toUpperCase()]),(v=Cs(c,m,f,"tts:color"))&&(p.color=v),(v=Cs(c,m,f,"tts:backgroundColor"))&&(p.backgroundColor=v),(v=Cs(c,m,f,"tts:fontFamily"))&&(p.fontFamily=v),(v=Cs(c,m,f,"tts:fontWeight"))&&"bold"==v&&(p.fontWeight=700),(v=Cs(c,m,f,"tts:wrapOption"))&&"noWrap"==v&&(p.wrapLine=!1),(v=Cs(c,m,f,"tts:lineHeight"))&&v.match(du)&&(p.lineHeight=v),(v=Cs(c,m,f,"tts:fontSize"))&&v.match(du)&&(p.fontSize=v),(v=Cs(c,m,f,"tts:fontStyle"))&&(p.fontStyle=ru[v.toUpperCase()]),(m=Ms(m,f,"tts:textDecoration"))&&Ls(p,m),(c=Os(c,f,"tts:textDecoration"))&&Ls(p,c)}else l=null;l&&n.push(l)}}return n};var au=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,su=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,ou=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,uu=/^(\d*\.?\d*)f$/,hu=/^(\d*\.?\d*)t$/,cu=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,lu=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,du=/^(\d+px|\d+em)$/,fu={left:"start",center:"center",right:"end",start:"start",end:"end"},pu={left:"line-left",center:"center",right:"line-right"};Mt("application/ttml+xml",Rs),Vs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).G("minf",si).G("stbl",si).ca("stsd",oi).G("stpp",function(){e=!0}).parse(t),!e)throw new h(2,2,2007)},Vs.prototype.parseMedia=function(t,e){var i=!1,n=[];if((new ai).G("mdat",ui(function(t){i=!0,n=n.concat(this.a.parseMedia(t.buffer,e))}.bind(this))).parse(t),!i)throw new h(2,2,2007);return n},Mt('application/mp4; codecs="stpp"',Vs),Mt('application/mp4; codecs="stpp.TTML.im1t"',Vs),Hs.prototype.parseInit=function(){},Hs.prototype.parseMedia=function(t,e){var i=Z(t),i=i.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),i=i.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(i[0]))throw new h(2,2,2e3);var n=e.segmentStart;if(0<=i[0].indexOf("X-TIMESTAMP-MAP")){var r=i[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=i[0].match(/MPEGTS:(\d+)/m);r&&a&&(n=Gs(new un(r[1])),n=e.periodStart+(Number(a[1])/9e4-n))}for(a=[],r=1;r<i.length;r++){var s=i[r].split("\n"),o=n;if(1==s.length&&!s[0]||/^NOTE($|[ \t])/.test(s[0])||"STYLE"==s[0])var u=null;else{u=null,0>s[0].indexOf("--\x3e")&&(u=s[0],s.splice(0,1));var c=new un(s[0]),l=Gs(c),d=hn(c,/[ \t]+--\x3e[ \t]+/g),f=Gs(c);if(null==l||!d||null==f)throw new h(2,2,2001);for(s=new xs(l+o,f+o,s.slice(1).join("\n").trim()),hn(c,/[ \t]+/gm),o=cn(c);o;)Ks(s,o),hn(c,/[ \t]+/gm),o=cn(c);null!=u&&(s.id=u),u=s}u&&a.push(u)}return a},Mt("text/vtt",Hs),Mt('text/vtt; codecs="vtt"',Hs),qs.prototype.parseInit=function(t){var e=!1;if((new ai).G("moov",si).G("trak",si).G("mdia",si).ca("mdhd",function(t){0==t.version?(t.u.I(4),t.u.I(4),this.a=t.u.F(),t.u.I(4)):(t.u.I(8),t.u.I(8),this.a=t.u.F(),t.u.I(8)),t.u.I(4)}.bind(this)).G("minf",si).G("stbl",si).ca("stsd",oi).G("wvtt",function(){e=!0}).parse(t),!this.a)throw new h(2,2,2008);if(!e)throw new h(2,2,2008)},qs.prototype.parseMedia=function(t,e){var i=0,n=[],r=[],a=[],s=!1,o=!1,u=!1,c=null;if((new ai).G("moof",si).G("traf",si).ca("tfdt",function(t){s=!0,i=t.version?t.u.Va():t.u.F()}).ca("tfhd",function(t){var e=t.ec;t=t.u,t.I(4),1&e&&t.I(8),2&e&&t.I(4),c=8&e?t.F():null}).ca("trun",function(t){o=!0;var e=t.version,i=t.ec;t=t.u;var r=t.F();1&i&&t.I(4),4&i&&t.I(4);for(var a=[],s=0;s<r;s++){var u={duration:null,Vb:null};256&i&&(u.duration=t.F()),512&i&&t.I(4),1024&i&&t.I(4),2048&i&&(u.Vb=e?t.xc():t.F()),a.push(u)}n=a}).G("vtte",function(){r.push(null)}).G("vttc",ui(function(t){r.push(t.buffer)})).G("mdat",function(t){u=!0,si(t)}).parse(t),!u&&!s&&!o)throw new h(2,2,2008);for(var l=i,d=0;d<n.length;d++){var f=n[d],p=r[d],m=f.duration||c;m&&(f=f.Vb?i+f.Vb:l,l=f+m,p&&a.push(Xs(p,e.periodStart+f/this.a,e.periodStart+l/this.a)))}return a.filter(R)},Mt('application/mp4; codecs="wvtt"',qs)}).call(r,this),void 0!==t&&t.exports?t.exports=r.shaka:void 0!==(n=function(){return r.shaka}.call(e,i,e,t))&&(t.exports=n)}()}])}); +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("clappr")):"function"==typeof define&&define.amd?define(["clappr"],e):"object"==typeof exports?exports.DashShakaPlayback=e(require("clappr")):t.DashShakaPlayback=e(t.Clappr)}("undefined"!=typeof self?self:this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="dist/",e(e.s=0)}([function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function t(e,i,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,i);if(void 0===r){var a=Object.getPrototypeOf(e);return null===a?void 0:t(a,i,n)}if("value"in r)return r.value;var s=r.get;if(void 0!==s)return s.call(n)},o=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),u=i(1),h=i(2),c=function(t){return t&&t.__esModule?t:{default:t}}(h),l=function(t){function e(t){n(this,e);var i=r(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));return i._levels=[],i._pendingAdaptationEvent=!1,i._isShakaReadyState=!1,t.autoPlay&&i.play(),i}return a(e,t),o(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c.default.player.Player.version}},{key:"shakaPlayerInstance",get:function(){return this._player}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=-1===this._currentLevelId;this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i?(this._player.configure({abr:{enabled:!0}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)):(this._player.configure({abr:{enabled:!1}}),this._pendingAdaptationEvent=!0,this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]))},get:function(){return this._currentLevelId||-1}}],[{key:"canPlay",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";c.default.polyfill.installAll();var i=c.default.Player.isBrowserSupported(),n=t.split("?")[0].match(/.*\.(.*)$/)||[];return i&&("mpd"===n[1]||e.indexOf("application/dash+xml")>-1)}},{key:"Events",get:function(){return{SHAKA_READY:"shaka:ready"}}}]),o(e,[{key:"play",value:function(){if(this._player||this._setup(),!this.isReady)return void this.once(e.Events.SHAKA_READY,this.play);this._stopped=!1,this._src=this.el.src,s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"play",this).call(this)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{key:"_onShakaReady",value:function(){this._isShakaReadyState=!0,this.trigger(e.Events.SHAKA_READY),this.trigger(u.Events.PLAYBACK_READY,this.name)}},{key:"error",value:function(t){u.Log.error("an error was raised by the video tag",t,this.el.error)}},{key:"isHighDefinitionInUse",value:function(){return!1}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._stopped=!0,this._player?(this._sendStats(),this._player.unload().then(function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1}).catch(function(){u.Log.error("shaka could not be unloaded")})):s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"stop",this).call(this)}},{key:"getPlaybackType",value:function(){return(this.isReady&&this._player.isLive()?"live":"vod")||""}},{key:"selectAudioLanguage",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._player.selectAudioLanguage(t,e)}},{key:"selectTrack",value:function(t){if("text"===t.type)this._player.selectTextTrack(t);else{if("variant"!==t.type)throw new Error("Unhandled track type:",t.type);this._player.selectVariantTrack(t),t.mimeType.startsWith("video/")&&this._onAdaptation()}}},{key:"_enableShakaTextTrack",value:function(t){this.el.textTracks&&(this._shakaTTVisible=t,Array.from(this.el.textTracks).filter(function(t){return"subtitles"===t.kind}).forEach(function(e){return e.mode=!0===t?"showing":"hidden"}))}},{key:"_checkForClosedCaptions",value:function(){if(!this._ccIsSetup){if(this.hasClosedCaptionsTracks){this.trigger(u.Events.PLAYBACK_SUBTITLE_AVAILABLE);var t=this.closedCaptionsTrackId;this.closedCaptionsTrackId=t}this._ccIsSetup=!0}}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._player.destroy().then(function(){return t._destroy()}).catch(function(){t._destroy(),u.Log.error("shaka could not be destroyed")}):this._destroy()}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._ccIsSetup=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration),this._options.shakaOnBeforeLoad&&this._options.shakaOnBeforeLoad(this._player),this._player.load(this._options.src).then(function(){return t._loaded()}).catch(function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=new c.default.Player(this.el);return t.addEventListener("error",this._onError.bind(this)),t.addEventListener("adaptation",this._onAdaptation.bind(this)),t.addEventListener("buffering",this._onBuffering.bind(this)),t}},{key:"_onBuffering",value:function(t){if(!this._stopped){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}}},{key:"_loaded",value:function(){this._onShakaReady(),this._startToSendStats(),this._fillLevels(),this._checkForClosedCaptions()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.slice(0).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this,e=this._options.shakaSendStatsInterval||3e4;this.sendStatsId=setInterval(function(){return t._sendStats()},e)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._onError(t)}},{key:"_onError",value:function(t){var e=this;u.Log.error("Shaka error event:",t.detail),this.trigger(u.Events.PLAYBACK_ERROR,t,this.name),t.detail&&2==t.detail.severity&&1002==t.detail.code&&(console.log("retrying"),this.stop(),setTimeout(function(){return e.play()},1e3))}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return!0===t.active})[0];this._fillLevels(),this._sendStats(),this._pendingAdaptationEvent_&&(this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END),this._pendingAdaptationEvent=!1),u.Log.debug("an adaptation has happened:",t),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,language:t.language,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this.isReady&&this._player.getTextTracks()}},{key:"audioLanguages",get:function(){return this.isReady&&this._player.getAudioLanguages()}},{key:"audioTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("audio/")})}},{key:"videoTracks",get:function(){return this.isReady&&this._player.getVariantTracks().filter(function(t){return t.mimeType.startsWith("video/")})}},{key:"closedCaptionsTracks",get:function(){var t=0,e=function(){return t++};return(this.textTracks||[]).filter(function(t){return"subtitle"===t.kind}).map(function(t){return{id:e(),name:t.label||t.language,track:t}})}},{key:"closedCaptionsTrackId",get:function(){return s(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"closedCaptionsTrackId",this)},set:function(t){if(this._player){var e=this.closedCaptionsTracks,i=void 0;if(-1!==t){if(!(i=e.find(function(e){return e.id===t})))return void u.Log.warn('Track id "'+t+'" not found');if(this._shakaTTVisible&&!0===i.track.active)return void u.Log.info('Track id "'+t+'" already showing')}i?(this._player.selectTextTrack(i.track),this._enableShakaTextTrack(!0)):this._enableShakaTextTrack(!1),this._ccTrackId=t,this.trigger(u.Events.PLAYBACK_SUBTITLE_CHANGED,{id:t})}}}]),e}(u.HTML5Video);e.default=l,t.exports=e.default},function(e,i){e.exports=t},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=Do;i[0]in n||!n.execScript||n.execScript("var "+i[0]);for(var r;i.length&&(r=i.shift());)i.length||void 0===e?n=n[r]?n[r]:n[r]={}:n[r]=e}function i(t){function e(){}var i=Re;e.prototype=i.prototype,t.ff=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.df=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function a(t){return t.a/(1-Math.pow(t.c,t.b))}function s(){this.b=new n(2),this.c=new n(5),this.a=0}function o(){}function u(){}function h(t,e,i,n){this.severity=t,this.category=e,this.code=i,this.data=Array.prototype.slice.call(arguments,3),this.handled=!1}function c(t){var e;t instanceof c?(l(this,t.da),this.Ba=t.Ba,this.ia=t.ia,f(this,t.La),this.Y=t.Y,d(this,g(t.a)),this.ua=t.ua):t&&(e=String(t).match(Mo))?(l(this,e[1]||"",!0),this.Ba=p(e[2]||""),this.ia=p(e[3]||"",!0),f(this,e[4]),this.Y=p(e[5]||"",!0),d(this,e[6]||"",!0),this.ua=p(e[7]||"")):this.a=new v(null)}function l(t,e,i){t.da=i?p(e,!0):e,t.da&&(t.da=t.da.replace(/:$/,""))}function f(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.La=e}else t.La=null}function d(t,e,i){e instanceof v?t.a=e:(i||(e=m(e,jo)),t.a=new v(e))}function p(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function m(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,y),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function y(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function v(t){this.b=t||null}function g(t){var e=new v;if(e.b=t.b,t.a){var i,n={};for(i in t.a)n[i]=t.a[i].concat();e.a=n,e.c=t.c}return e}function b(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function T(t,e,i){var n=E();this.j=null==t.maxAttempts?n.maxAttempts:t.maxAttempts,this.f=null==t.baseDelay?n.baseDelay:t.baseDelay,this.i=null==t.fuzzFactor?n.fuzzFactor:t.fuzzFactor,this.h=null==t.backoffFactor?n.backoffFactor:t.backoffFactor,this.a=0,this.b=this.f,this.c=e||!1,this.g=i||null,this.c&&(this.a=1)}function w(t){if(t.a>=t.j){if(!t.c)return Promise.reject();t.a=1,t.b=t.f}var e=new b;return t.a?(S(t,e.resolve,t.b*(1+(2*Math.random()-1)*t.i)),t.b*=t.h):e.resolve(),t.a++,e}function E(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function S(t,e,i){if(t.g)if(t.g()||!i)e();else{var n=Math.min(200,i);A(function(){S(this,e,i-n)}.bind(t),n)}else A(e,i)}function A(e,i){t.setTimeout(e,i)}function k(t,e,i,n,r){var a,s=r in n;for(a in e){var o=r+"."+a,u=s?n[r]:i[a];(s||a in t)&&(void 0===e[a]?void 0===u||s?delete t[a]:t[a]=u:u.constructor==Object&&e[a]&&e[a].constructor==Object?(t[a]||(t[a]=u),k(t[a],e[a],u,n,o)):typeof e[a]==typeof u&&null!=e[a]&&e[a].constructor==u.constructor&&(t[a]=e[a]))}}function I(t){function e(t){switch(typeof t){case"undefined":case"boolean":case"number":case"string":case"symbol":case"function":return t;default:if(!t)return t;if(0<=i.indexOf(t))return null;var n=t.constructor==Array;if(t.constructor!=Object&&!n)return null;i.push(t);var r,a=n?[]:{};for(r in t)a[r]=e(t[r]);return n&&(a.length=t.length),a}}var i=[];return e(t)}function _(t,e){return t.reduce(function(t,e,i){return e.catch(t.bind(null,i))}.bind(null,e),Promise.reject())}function P(t,e){return t.concat(e)}function x(){}function R(t){return null!=t}function N(t,e,i){return i.indexOf(t)==e}function L(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.g=t||null}function D(t,e,i){i=i||3;var n=Fo[t];(!n||i>=n.ke)&&(Fo[t]={ke:i,ie:e})}function M(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function C(t,e,i,n,r,a,s){if(t.f||s())return Promise.reject();var o=new c(i.uris[r]),u=o.da;if(u||(u=location.protocol,u=u.slice(0,-1),l(o,u),i.uris[r]=o.toString()),!(u=(u=Fo[u])?u.ie:null))return Promise.reject(new h(2,1,1e3,o));var f=Date.now();return u(i.uris[r],i,e).then(function(t){void 0==t.timeMs&&(t.timeMs=Date.now()-f);var i=Date.now(),n=Promise.resolve();return this.c.forEach(function(i){n=n.then(function(){return Promise.resolve(i(e,t))}.bind(this))}.bind(this)),n=n.catch(function(t){var e=2;throw t instanceof h&&(e=t.severity),new h(e,1,1007,t)}),n.then(function(){return t.timeMs+=Date.now()-i,t.timeMs+=a,t})}.bind(t)).catch(function(t){if(t&&1==t.severity)return r=(r+1)%i.uris.length,s()?Promise.reject():w(n).then(function(){return C(this,e,i,n,r,a,s)}.bind(this),function(){throw t});throw t}.bind(t))}function O(t,e){for(var i=[],n=0;n<t.length;++n){for(var r=!1,a=0;a<i.length&&!(r=e?e(t[n],i[a]):t[n]===i[a]);++a);r||i.push(t[n])}return i}function U(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function j(t,e){var i=t.indexOf(e);-1<i&&t.splice(i,1)}function B(t,e){var i=0;return t.forEach(function(t){i+=e(t)?1:0}),i}function F(){this.a={}}function V(){this.a=new F}function H(t,e,i,n){t.a&&(e=new G(e,i,n),t.a.push(i,e))}function K(t,e,i,n){H(t,e,i,function(t){this.ga(e,i),n(t)}.bind(t))}function q(t){if(t.a){var e,i=t.a,n=[];for(e in i.a)n.push.apply(n,i.a[e]);for(i=0;i<n.length;++i)n[i].ga();t.a.a={}}}function G(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function X(e,i){var n,r=i||{};for(n in r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=t.performance&&t.performance.now?t.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function Y(t,e){if(!e.length)return t;var i=e.map(function(t){return new c(t)});return t.map(function(t){return new c(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(P,[]).map(function(t){return t.toString()})}function z(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function $(t){return!t||!Object.keys(t).length}function W(t){return Object.keys(t).map(function(e){return t[e]})}function J(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function Q(t,e){Object.keys(t).forEach(function(i){e(i,t[i])})}function Z(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function tt(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape(rt(t));try{return decodeURIComponent(t)}catch(t){throw new h(2,2,2004)}}function et(t,e,i){if(!t)return"";if(!i&&t.byteLength%2)throw new h(2,2,2004);if(t instanceof ArrayBuffer)var n=t;else i=new Uint8Array(t.byteLength),i.set(new Uint8Array(t)),n=i.buffer;t=Math.floor(t.byteLength/2),i=new Uint16Array(t),n=new DataView(n);for(var r=0;r<t;r++)i[r]=n.getUint16(2*r,e);return rt(i)}function it(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return tt(e);if(254==e[0]&&255==e[1])return et(e.subarray(2),!1);if(255==e[0]&&254==e[1])return et(e.subarray(2),!0);var i=function(t,e){return t.byteLength<=e||32<=t[e]&&126>=t[e]}.bind(null,e);if(!e[0]&&!e[2])return et(t,!1);if(!e[1]&&!e[3])return et(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return tt(t);throw new h(2,2,2003)}function nt(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;i<t.length;++i)e[i]=t.charCodeAt(i);return e.buffer}function rt(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function at(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function st(t,e){t.cancel(),t.a=setTimeout(t.b,1e3*e)}function ot(t,e){t.cancel();var i=function(){this.b(),this.a=setTimeout(i,1e3*e)}.bind(t);t.a=setTimeout(i,1e3*e)}function ut(e,i){var n=void 0==i||i,r=t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_");return n?r:r.replace(/=*$/,"")}function ht(e){e=t.atob(e.replace(/-/g,"+").replace(/_/g,"/"));for(var i=new Uint8Array(e.length),n=0;n<e.length;++n)i[n]=e.charCodeAt(n);return i}function ct(e){for(var i=new Uint8Array(e.length/2),n=0;n<e.length;n+=2)i[n/2]=t.parseInt(e.substr(n,2),16);return i}function lt(t){for(var e="",i=0;i<t.length;++i){var n=t[i].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function ft(t,e){if(!t&&!e)return!0;if(!t||!e||t.length!=e.length)return!1;for(var i=0;i<t.length;++i)if(t[i]!=e[i])return!1;return!0}function dt(t){for(var e=0,i=0;i<arguments.length;++i)e+=arguments[i].length;for(var e=new Uint8Array(e),n=0,i=0;i<arguments.length;++i)e.set(arguments[i],n),n+=arguments[i].length;return e}function pt(t){this.s=t,this.l=this.j=this.u=null,this.K=!1,this.b=null,this.f=new V,this.a=[],this.m=[],this.i=new b,this.h=null,this.g=function(e){this.i.reject(e),t.onError(e)}.bind(this),this.A={},this.F=new at(this.le.bind(this)),this.ha=this.c=!1,this.J=[],this.W=!1,this.w=new at(this.je.bind(this)),ot(this.w,1),this.i.catch(function(){})}function mt(t,e){if(!t.j)return K(t.f,e,"encrypted",function(){this.g(new h(2,6,6010))}.bind(t)),Promise.resolve();t.l=e,K(t.f,t.l,"play",t.Pd.bind(t));var i=t.l.setMediaKeys(t.j),i=i.catch(function(t){return Promise.reject(new h(2,6,6003,t.message))}),n=null;return t.b.serverCertificate&&t.b.serverCertificate.length&&(n=t.j.setServerCertificate(t.b.serverCertificate).then(function(){}).catch(function(t){return Promise.reject(new h(2,6,6004,t.message))})),Promise.all([i,n]).then(function(){if(this.c)return Promise.reject();vt(this),this.b.initData.length||this.m.length||H(this.f,this.l,"encrypted",this.Ed.bind(this))}.bind(t)).catch(function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function yt(t,e){return Promise.all(e.map(function(t){return kt(this,t).then(function(t){if(t){for(var e=new b,i=0;i<this.a.length;i++)if(this.a[i].ea==t){this.a[i].ma=e;break}return Promise.all([t.remove(),e])}}.bind(this))}.bind(t)))}function vt(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){It(this,t.initDataType,t.initData)}.bind(t)),t.m.forEach(function(t){kt(this,t)}.bind(t)),e.length||t.m.length||t.i.resolve(),t.i}function gt(t){return t.a.map(function(t){return t.ea.sessionId})}function bt(e,i,n,r,a){var s=Et(e);i.periods.forEach(function(e){e.variants.forEach(function(e){s&&(e.drmInfos=[s]),e.drmInfos.forEach(function(i){wt(this,i),t.cast&&t.cast.__platform__&&"com.microsoft.playready"==i.keySystem&&(i.keySystem="com.chromecast.playready");var s=r[i.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:n?"required":"optional",sessionTypes:[n?"persistent-license":"temporary"],label:i.keySystem,drmInfos:[]},r[i.keySystem]=s,a.push(i.keySystem)),s.drmInfos.push(i),i.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),i.persistentStateRequired&&(s.persistentState="required");var o=[];e.video&&o.push(e.video),e.audio&&o.push(e.audio),o.forEach(function(t){("video"==t.type?s.videoCapabilities:s.audioCapabilities).push({robustness:("video"==t.type?i.videoRobustness:i.audioRobustness)||"",contentType:Z(t.mimeType,t.codecs)})}.bind(this))}.bind(this))}.bind(this))}.bind(e))}function Tt(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new h(2,6,6e3));var n=new b,r=n;return[!0,!1].forEach(function(t){i.forEach(function(i){var n=e[i];n.drmInfos.some(function(t){return!!t.licenseServerUri})==t&&(n.audioCapabilities.length||delete n.audioCapabilities,n.videoCapabilities.length||delete n.videoCapabilities,r=r.catch(function(){return this.c?Promise.reject():navigator.requestMediaKeySystemAccess(i,[n])}.bind(this)))}.bind(this))}.bind(t)),r=r.catch(function(){return Promise.reject(new h(2,6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=0<=navigator.userAgent.indexOf("Edge/"),n=t.getConfiguration();return this.u=(n.audioCapabilities||[]).concat(n.videoCapabilities||[]).map(function(t){return t.contentType}),i&&(this.u=null),i=e[t.keySystem],St(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new h(2,6,6012))}.bind(t)).then(function(t){if(this.c)return Promise.reject();this.j=t,this.K=!0}.bind(t)).catch(function(t){return this.c?Promise.resolve():(this.u=this.b=null,t instanceof h?Promise.reject(t):Promise.reject(new h(2,6,6002,t.message)))}.bind(t)),n.reject(),r}function wt(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.h.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.h.advanced[i])&&(e.distinctiveIdentifierRequired||(e.distinctiveIdentifierRequired=i.distinctiveIdentifierRequired),e.persistentStateRequired||(e.persistentStateRequired=i.persistentStateRequired),e.videoRobustness||(e.videoRobustness=i.videoRobustness),e.audioRobustness||(e.audioRobustness=i.audioRobustness),e.serverCertificate||(e.serverCertificate=i.serverCertificate))}}function Et(e){if($(e.h.clearKeys))return null;var i,n=[],r=[];for(i in e.h.clearKeys){var a=e.h.clearKeys[i],s=ct(i),a=ct(a),s={kty:"oct",kid:ut(s,!1),k:ut(a,!1)};n.push(s),r.push(s.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(nt(r)),initDataType:"keyids"}],{keySystem:"org.w3.clearkey",licenseServerUri:"data:application/json;base64,"+t.btoa(e),distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:r,keyIds:[]}}function St(t,e,i,n){var r=[],a=[],s=[],o=[];At(n,r,a,s,o),t.b={keySystem:e,licenseServerUri:r[0],distinctiveIdentifierRequired:"required"==i.distinctiveIdentifier,persistentStateRequired:"required"==i.persistentState,audioRobustness:i.audioCapabilities?i.audioCapabilities[0].robustness:"",videoRobustness:i.videoCapabilities?i.videoCapabilities[0].robustness:"",serverCertificate:a[0],initData:s,keyIds:o}}function At(t,e,i,n,r){function a(t,e){return!(!t.keyId||t.keyId!=e.keyId)||t.initDataType==e.initDataType&&ft(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==U(i,t.serverCertificate,ft)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==U(n,t,a)&&n.push(t)}),t.keyIds)for(var s=0;s<t.keyIds.length;++s)-1==r.indexOf(t.keyIds[s])&&r.push(t.keyIds[s])})}function kt(t,e){try{var i=t.j.createSession("persistent-license")}catch(e){var n=new h(2,6,6005,e.message);return t.g(n),Promise.reject(n)}H(t.f,i,"message",t.Dc.bind(t)),H(t.f,i,"keystatuseschange",t.xc.bind(t));var r={initData:null,ea:i,loaded:!1,Ob:1/0,ma:null};return t.a.push(r),i.load(e).then(function(t){if(!this.c){if(t)return r.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve(),i;this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(r),1),this.g(new h(2,6,6005,t.message)))}.bind(t))}function It(t,e,i){try{var n=t.ha?t.j.createSession("persistent-license"):t.j.createSession()}catch(e){return void t.g(new h(2,6,6005,e.message))}H(t.f,n,"message",t.Dc.bind(t)),H(t.f,n,"keystatuseschange",t.xc.bind(t)),t.a.push({initData:i,ea:n,loaded:!1,Ob:1/0,ma:null}),n.generateRequest(e,i.buffer).catch(function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].ea==n){this.a.splice(e,1);break}this.g(new h(2,6,6006,t.message))}}.bind(t))}function _t(t,e){for(var i,n=e.target,r=0;r<t.a.length;r++)if(t.a[r].ea==n){i=t.a[r];break}r=M([t.b.licenseServerUri],t.h.retryParameters),r.body=e.message,r.method="POST","com.microsoft.playready"!=t.b.keySystem&&"com.chromecast.playready"!=t.b.keySystem||Pt(r),t.s.Wa.request(2,r).then(function(t){return this.c?Promise.reject():n.update(t.data).then(function(){this.s.onEvent(new X("drmsessionupdate")),i&&(i.ma&&i.ma.resolve(),setTimeout(function(){i.loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()}.bind(this),5e3))}.bind(this))}.bind(t),function(t){if(this.c)return Promise.resolve();t=new h(2,6,6007,t),this.g(t),i&&i.ma&&i.ma.reject(t)}.bind(t)).catch(function(t){if(this.c)return Promise.resolve();t=new h(2,6,6008,t.message),this.g(t),i&&i.ma&&i.ma.reject(t)}.bind(t))}function Pt(t){var e=et(t.body,!0,!0);if(-1==e.indexOf("PlayReadyKeyMessage"))t.headers["Content-Type"]="text/xml; charset=utf-8";else{for(var e=(new DOMParser).parseFromString(e,"application/xml"),i=e.getElementsByTagName("HttpHeader"),n=0;n<i.length;++n)t.headers[i[n].querySelector("name").textContent]=i[n].querySelector("value").textContent;t.body=ht(e.querySelector("Challenge").textContent).buffer}}function xt(){var t=[],e=[{contentType:'video/mp4; codecs="avc1.42E01E"'},{contentType:'video/webm; codecs="vp8"'}],i=[{videoCapabilities:e,persistentState:"required",sessionTypes:["persistent-license"]},{videoCapabilities:e}],n={};return"org.w3.clearkey com.widevine.alpha com.microsoft.playready com.apple.fps.2_0 com.apple.fps.1_0 com.apple.fps com.adobe.primetime".split(" ").forEach(function(e){var r=navigator.requestMediaKeySystemAccess(e,i).then(function(t){var i=t.getConfiguration().sessionTypes,i=!!i&&0<=i.indexOf("persistent-license");return 0<=navigator.userAgent.indexOf("Tizen 3")&&(i=!1),n[e]={persistentState:i},t.createMediaKeys()}).catch(function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function Rt(t,e){var i=t.keySystem();return!e.drmInfos.length||e.drmInfos.some(function(t){return t.keySystem==i})}function Nt(t,e){if(!t.length)return e;if(!e.length)return t;for(var i=[],n=0;n<t.length;n++)for(var r=0;r<e.length;r++)if(t[n].keySystem==e[r].keySystem){var a=t[n],r=e[r],s=[],s=s.concat(a.initData||[]),s=s.concat(r.initData||[]),o=[],o=o.concat(a.keyIds),o=o.concat(r.keyIds);i.push({keySystem:a.keySystem,licenseServerUri:a.licenseServerUri||r.licenseServerUri,distinctiveIdentifierRequired:a.distinctiveIdentifierRequired||r.distinctiveIdentifierRequired,persistentStateRequired:a.persistentStateRequired||r.persistentStateRequired,videoRobustness:a.videoRobustness||r.videoRobustness,audioRobustness:a.audioRobustness||r.audioRobustness,serverCertificate:a.serverCertificate||r.serverCertificate,initData:s,keyIds:o});break}return i}function Lt(t){return!t||1==t.length&&1e-6>t.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function Dt(t,e){return!(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))&&(e>=t.start(0)&&e<=t.end(t.length-1))}function Mt(t,e){if(!t||!t.length||1==t.length&&1e-6>t.end(0)-t.start(0))return 0;for(var i=0,n=t.length-1;0<=n&&t.end(n)>e;--n)i+=t.end(n)-Math.max(t.start(n),e);return i}function Ct(t){if(!t)return[];for(var e=[],i=0;i<t.length;i++)e.push({start:t.start(i),end:t.end(i)});return e}function Ot(){this.a=new muxjs.mp4.Transmuxer,this.b=null,this.c=[],this.f=!1,this.a.on("data",this.h.bind(this)),this.a.on("done",this.g.bind(this))}function Ut(t,e){var i=e.replace("mp2t","mp4");"audio"==t&&(i=i.replace("video","audio"));var n=/avc1\.(66|77|100)\.(\d+)/.exec(i);if(n)var r="avc1.",a=n[1],s=Number(n[2]),r=("66"==a?r+"4200":"77"==a?r+"4d00":r+"6400")+(s>>4).toString(16),r=r+(15&s).toString(16),i=i.replace(n[0],r);return i}function jt(t,e,i){return t.b=new b,t.c=[],null==i||t.f||(t.a.setBaseMediaDecodeTime(9e4*i),t.f=!0),e=new Uint8Array(e),t.a.push(e),t.a.flush(),t.b}function Bt(t){this.c=null,this.f=t,this.h=this.i=0,this.g=1/0,this.b=this.a=null}function Ft(t,e,i,n){return Promise.resolve().then(function(){if(this.c&&this.f)if(null==i||null==n)this.c.parseInit(new Uint8Array(e));else{var t={periodStart:this.i,segmentStart:i,segmentEnd:n},t=this.c.parseMedia(new Uint8Array(e),t).filter(function(t){return t.startTime>=this.h&&t.startTime<this.g}.bind(this));this.f.append(t),null==this.a&&(this.a=Math.max(i,this.h)),this.b=Math.min(n,this.g)}}.bind(t))}function Vt(t,e,i){this.g=t,this.f=e,this.l=i,this.b={},this.a=null,this.c={},this.i=new V,this.j=!1,this.h={}}function Ht(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hev1.1.6.L93.90",video/mp4; codecs="hvc1.1.6.L93.90",video/mp4; codecs="hev1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="hvc1.2.4.L153.B0"; eotf="smpte2084",video/mp4; codecs="vp9",video/mp4; codecs="vp09.00.10.08",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",audio/mp4; codecs="opus",audio/mp4; codecs="flac",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!Ko[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function Kt(t,e){t.a||(t.a=new Bt(t.l)),t.a.c=new Ko[e]}function qt(t,e){if("text"==e)var i=t.a.a;else i=Gt(t,e),i=!i||1==i.length&&1e-6>i.end(0)-i.start(0)?null:1==i.length&&0>i.start(0)?0:i.length?i.start(0):null;return i}function Gt(t,e){try{return t.b[e].buffered}catch(t){return null}}function Xt(t,e,i,n,r){return"text"==e?Ft(t.a,i,n,r):t.h[e]?jt(t.h[e],i,n).then(function(t){return $t(this,e,this.Sc.bind(this,e,t.buffer))}.bind(t)):$t(t,e,t.Sc.bind(t,e,i))}function Yt(t,e){return"text"==e?t.a.remove(0,1/0):$t(t,e,t.Tc.bind(t,e,0,t.f.duration))}function zt(t,e,i,n,r){return"text"==e?(t.a.i=i,t=t.a,t.h=n,t.g=r,Promise.resolve()):Promise.all([$t(t,e,t.Zc.bind(t,e)),$t(t,e,t.Ce.bind(t,e,i)),$t(t,e,t.ze.bind(t,e,n,r))])}function $t(t,e,i){if(t.j)return Promise.reject();if(i={start:i,p:new b},t.c[e].push(i),1==t.c[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new h(2,3,3017,e)):i.p.reject(new h(2,3,3015,n)),Jt(t,e)}return i.p}function Wt(t,e){if(t.j)return Promise.reject();var i,n=[];for(i in t.b){var r=new b,a={start:function(t){t.resolve()}.bind(null,r),p:r};t.c[i].push(a),n.push(r),1==t.c[i].length&&a.start()}return Promise.all(n).then(function(){var t;try{e()}catch(t){var i=Promise.reject(new h(2,3,3015,t))}for(t in this.b)Jt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function Jt(t,e){t.c[e].shift();var i=t.c[e][0];if(i)try{i.start()}catch(n){i.p.reject(new h(2,3,3015,n)),Jt(t,e)}}function Qt(t,e,i){return i==e||t>=qo&&i==e.split("-")[0]||t>=Go&&i.split("-")[0]==e.split("-")[0]}function Zt(t){t=t.toLowerCase().split("-");var e=Xo[t[0]];return e&&(t[0]=e),t.join("-")}function te(t,e,i){var n=t.video;return!(n&&(n.width<e.minWidth||n.width>e.maxWidth||n.width>i.width||n.height<e.minHeight||n.height>e.maxHeight||n.height>i.height||n.width*n.height<e.minPixels||n.width*n.height>e.maxPixels)||t.bandwidth<e.minBandwidth||t.bandwidth>e.maxBandwidth)}function ee(t,e,i){var n=!1;return t.variants.forEach(function(t){var r=t.allowedByApplication;t.allowedByApplication=te(t,e,i),r!=t.allowedByApplication&&(n=!0)}),n}function ie(t,e,i,n){n.variants=n.variants.filter(function(n){return!(t&&t.K&&!Rt(t,n))&&(ne(n.audio,t,e)&&ne(n.video,t,i))}),n.textStreams=n.textStreams.filter(function(t){return!!Ko[Z(t.mimeType,t.codecs)]})}function ne(e,i,n){if(!e)return!0;var r=null;i&&i.K&&(r=i.u),i=Z(e.mimeType,e.codecs);var a,s=Z(e.mimeType,e.codecs),o=e.mimeType;for(a in Ho){var u=e[a],h=Ho[a];u&&(o+="; "+h+'="'+u+'"')}return!(!(Ko[s]||MediaSource.isTypeSupported(o)||t.muxjs&&"mp2t"==s.split(";")[0].split("/")[1]&&MediaSource.isTypeSupported(Ut(e.type,s)))||r&&e.encrypted&&0>r.indexOf(i)||n&&(e.mimeType!=n.mimeType||e.codecs.split(".")[0]!=n.codecs.split(".")[0]))}function re(t){var e=t.audio,i=t.video,n=e?e.codecs:null,r=i?i.codecs:null,a=[];r&&a.push(r),n&&a.push(n);var s=[];i&&s.push(i.mimeType),e&&s.push(e.mimeType);var s=s[0]||null,o=[];e&&o.push(e.kind),i&&o.push(i.kind);var o=o[0]||null,u=[];return e&&u.push.apply(u,e.roles),i&&u.push.apply(u,i.roles),u=O(u),t={id:t.id,active:!1,type:"variant",bandwidth:t.bandwidth,language:t.language,label:null,kind:o,width:null,height:null,frameRate:null,mimeType:s,codecs:a.join(", "),audioCodec:n,videoCodec:r,primary:t.primary,roles:u,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null},i&&(t.videoId=i.id,t.width=i.width||null,t.height=i.height||null,t.frameRate=i.frameRate||null,t.videoBandwidth=i.bandwidth||null),e&&(t.audioId=e.id,t.channelsCount=e.channelsCount,t.audioBandwidth=e.bandwidth||null,t.label=e.label),t}function ae(t){return{id:t.id,active:!1,type:"text",bandwidth:0,language:t.language,label:t.label,kind:t.kind||null,width:null,height:null,frameRate:null,mimeType:t.mimeType,codecs:t.codecs||null,audioCodec:null,videoCodec:null,primary:t.primary,roles:t.roles,videoId:null,audioId:null,channelsCount:null,audioBandwidth:null,videoBandwidth:null}}function se(t){var e=[],i=fe(t.variants);return t=t.textStreams,i.forEach(function(t){e.push(re(t))}),t.forEach(function(t){e.push(ae(t))}),e}function oe(t,e,i){return fe(t.variants).map(function(t){var n=re(t);return t.video&&t.audio?n.active=i==t.video.id&&e==t.audio.id:t.video?n.active=i==t.video.id:t.audio&&(n.active=e==t.audio.id),n})}function ue(t,e){return t.textStreams.map(function(t){var i=ae(t);return i.active=e==t.id,i})}function he(t,e){for(var i=0;i<t.variants.length;i++)if(t.variants[i].id==e.id)return t.variants[i];return null}function ce(t,e){for(var i=0;i<t.textStreams.length;i++)if(t.textStreams[i].id==e.id)return t.textStreams[i];return null}function le(t){return t.allowedByApplication&&t.allowedByKeySystem}function fe(t){return t.filter(function(t){return le(t)})}function de(t,e,i,n){var r=fe(t.variants),a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Zt(e);[Go,qo,0].forEach(function(t){var e=!1;r.forEach(function(i){o=Zt(o);var r=Zt(i.language);Qt(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.audio=!0))})})}return i&&(t=me(a,i),t.length)?t:(t=a.map(function(t){return(t.audio?t.audio.roles:[]).concat(t.video?t.video.roles:[])}).reduce(P,[]),t.length?me(a,t[0]):a)}function pe(t,e,i,n){var r=t.textStreams,a=r.filter(function(t){return t.primary});a.length||(a=r);var s=a.length?a[0].language:"",a=a.filter(function(t){return t.language==s});if(e){var o=Zt(e);[Go,qo,0].forEach(function(t){var e=!1;r.forEach(function(i){var r=Zt(i.language);Qt(t,o,r)&&(e?a.push(i):(a=[i],e=!0),n&&(n.text=!0))})})}return i&&(t=ye(a,i),t.length)?t:(t=a.map(function(t){return t.roles}).reduce(P,[]),t.length?ye(a,t[0]):a)}function me(t,e){return t.filter(function(t){return t.audio&&0<=t.audio.roles.indexOf(e)||t.video&&0<=t.video.roles.indexOf(e)})}function ye(t,e){return t.filter(function(t){return 0<=t.roles.indexOf(e)})}function ve(t,e,i){for(var n=0;n<i.length;n++)if(i[n].audio==t&&i[n].video==e)return i[n];return null}function ge(t,e,i){function n(t,e){return null==t?null==e:e.id==t}for(var r=0;r<i.length;r++)if(n(t,i[r].audio)&&n(e,i[r].video))return i[r];return null}function be(t,e){for(var i=t.periods.length-1;0<i;--i)if(e+Vo>=t.periods[i].startTime)return i;return 0}function Te(t,e){for(var i=0;i<t.periods.length;++i){var n=t.periods[i];if("text"==e.type){for(var r=0;r<n.textStreams.length;++r)if(n.textStreams[r]==e)return i}else for(r=0;r<n.variants.length;++r){var a=n.variants[r];if(a.audio==e||a.video==e||a.video&&a.video.trickModeVideo==e)return i}}return-1}function we(){this.h=null,this.c=!1,this.b=new s,this.g=[],this.i=!1,this.a=this.f=null}function Ee(t,e){return e.filter(function(e){return te(e,t,{width:1/0,height:1/0})}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function Se(t){return JSON.stringify(t,function(t,e){if("function"!=typeof e){if(e instanceof Event||e instanceof X){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof r?"detail"==i&&(n[i]=r):i in Event||(n[i]=r)}return n}if(e instanceof TimeRanges)for(n={__type__:"TimeRanges",length:e.length,start:[],end:[]},i=0;i<e.length;++i)n.start.push(e.start(i)),n.end.push(e.end(i));else n="number"==typeof e?isNaN(e)?"NaN":isFinite(e)?e:0>e?"-Infinity":"Infinity":e;return n}})}function Ae(t){return JSON.parse(t,function(t,e){return"NaN"==e?NaN:"-Infinity"==e?-1/0:"Infinity"==e?1/0:e&&"object"==typeof e&&"TimeRanges"==e.__type__?ke(e):e})}function ke(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function Ie(t,e,i,n,r,a){this.J=t,this.g=e,this.K=i,this.j=!1,this.A=n,this.F=r,this.u=a,this.b=this.h=!1,this.w="",this.i=null,this.l=this.vc.bind(this),this.m=this.Ld.bind(this),this.a={video:{},player:{}},this.s=0,this.c={},this.f=null}function _e(t){var e=au;e.removeUpdateListener(t.l),e.removeMessageListener("urn:x-cast:com.google.shaka.v2",t.m)}function Pe(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new h(1,7,7e3))}}function xe(t){t=Se(t),au.sendMessage("urn:x-cast:com.google.shaka.v2",t,function(){},u)}function Re(){this.xb=new F,this.eb=this}function Ne(t,e,i){Re.call(this),this.c=t,this.b=e,this.i=this.g=this.f=this.j=this.h=null,this.a=new Ie(i,this.He.bind(this),this.Ie.bind(this),this.Je.bind(this),this.Ke.bind(this),this.mc.bind(this)),Le(this)}function Le(t){t.a.init(),t.i=new V,Yo.forEach(function(t){H(this.i,this.c,t,this.We.bind(this))}.bind(t)),Jo.forEach(function(t){H(this.i,this.b,t,this.he.bind(this))}.bind(t)),t.h={};for(var e in t.c)Object.defineProperty(t.h,e,{configurable:!1,enumerable:!0,get:t.Ve.bind(t,e),set:t.Xe.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.ge.bind(t,e)});t.f=new Re,t.f.eb=t.h,t.g=new Re,t.g.eb=t.j}function De(t,e,i,n){Re.call(this),this.a=t,this.b=e,this.m={video:t,player:e},this.s=i||function(){},this.u=n||function(t){return t},this.l=!1,this.f=!0,this.g=0,this.j=!1,this.i=this.h=this.c=null,Me(this)}function Me(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.Cc.bind(e),i.onSenderDisconnected=e.Cc.bind(e),i.onSystemVolumeChanged=e.gd.bind(e),e.h=i.getCastMessageBus("urn:x-cast:com.google.cast.media"),e.h.onMessage=e.Gd.bind(e),e.c=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.c.onMessage=e.Ud.bind(e),i.start(),Yo.forEach(function(t){this.a.addEventListener(t,this.Gc.bind(this,"video"))}.bind(e)),Jo.forEach(function(t){this.b.addEventListener(t,this.Gc.bind(this,"player"))}.bind(e)),cast.__platform__&&cast.__platform__.canDisplayType('video/mp4; codecs="avc1.640028"; width=3840; height=2160')?e.b.Yb(3840,2160):e.b.Yb(1920,1080),e.a.addEventListener("loadeddata",function(){this.j=!0}.bind(e)),e.b.addEventListener("loading",function(){this.f=!1,Ce(this)}.bind(e)),e.a.addEventListener("playing",function(){this.f=!1,Ce(this)}.bind(e)),e.a.addEventListener("pause",function(){Ce(this)}.bind(e)),e.b.addEventListener("unloading",function(){this.f=!0,Ce(this)}.bind(e)),e.a.addEventListener("ended",function(){t.setTimeout(function(){this.a&&this.a.ended&&(this.f=!0,Ce(this))}.bind(this),5e3)}.bind(e))}function Ce(t){Promise.resolve().then(function(){this.dispatchEvent(new X("caststatuschanged")),je(this,0)}.bind(t))}function Oe(t,e,i){for(var n in e.player)t.b[n](e.player[n]);t.s(i),i=Promise.resolve();var r=t.a.autoplay;e.manifest&&(t.a.autoplay=!1,i=t.b.load(e.manifest,e.startTime),i.catch(function(t){this.b.dispatchEvent(new X("error",{detail:t}))}.bind(t))),i.then(function(){var t;for(t in e.video){var i=e.video[t];this.a[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.b[t](i);this.a.autoplay=r,e.manifest&&(this.a.play(),je(this,0))}.bind(t))}function Ue(t,e,i,n){t.l&&(t=Se(e),n?i.getCastChannel(n).send(t):i.broadcast(t))}function je(t,e,i){var n=t.a.playbackRate,r=su;r=t.f?r.IDLE:t.b.rc()?r.Uc:t.a.paused?r.Wc:r.Xc,n={mediaSessionId:0,playbackRate:n,playerState:r,currentTime:t.a.currentTime,supportedMediaCommands:15,volume:{level:t.a.volume,muted:t.a.muted}},i&&(n.media=i),Ue(t,{requestId:e,type:"MEDIA_STATUS",status:[n]},t.h)}function Be(t,e){var i=Fe(t,e);return 1!=i.length?null:i[0]}function Fe(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function Ve(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function He(t,e,i,n){var r=null;return t=t.getAttribute(e),null!=t&&(r=i(t)),null==r?void 0!=n?n:null:r}function Ke(t){return t?(/^\d+\-\d+\-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t)&&(t+="Z"),t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function qe(t){return t&&(t=/^P(?:([0-9]*)Y)?(?:([0-9]*)M)?(?:([0-9]*)D)?(?:T(?:([0-9]*)H)?(?:([0-9]*)M)?(?:([0-9.]*)S)?)?$/.exec(t))?(t=31536e3*Number(t[1]||null)+2592e3*Number(t[2]||null)+86400*Number(t[3]||null)+3600*Number(t[4]||null)+60*Number(t[5]||null)+Number(t[6]||null),isFinite(t)?t:null):null}function Ge(t){var e=/([0-9]+)-([0-9]+)/.exec(t);return e?(t=Number(e[1]),isFinite(t)?(e=Number(e[2]),isFinite(e)?{start:t,end:e}:null):null):null}function Xe(t){return t=Number(t),t%1?null:t}function Ye(t){return t=Number(t),!(t%1)&&0<t?t:null}function ze(t){return t=Number(t),!(t%1)&&0<=t?t:null}function $e(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function We(t,e,i){t=Ze(t);var n=null,r=[],a=[],s=t.map(function(t){return t.keyId}).filter(R);if(s.length&&1<s.filter(N).length)throw new h(2,4,4010);i||(a=t.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.Mc||(n=t.init||n,!1)}),a.length&&(r=Qe(n,e,a),r.length||(r=[z("",n)]))),!t.length||!i&&a.length||(r=W(ou).map(function(t){return z(t,n)}));var o=s[0]||null;return o&&r.forEach(function(t){t.initData.forEach(function(t){t.keyId=o})}),{hc:o,ef:n,drmInfos:r,kc:!0}}function Je(t,e,i,n){var r=We(t,e,n);if(i.kc)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!r.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=r.drmInfos),i.kc=!1;else if(0<r.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return r.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new h(2,4,4008);return r.hc||i.hc}function Qe(t,e,i){return i.map(function(i){var n=ou[i.Mc];return n?[z(n,i.init||t)]:e(i.node)||[]}).reduce(P,[])}function Ze(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=Fe(t,"cenc:pssh").map(Ve);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new h(2,4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:ht(t),keyId:null}})}catch(t){throw new h(2,4,4007)}return{node:t,Mc:e,keyId:i,init:0<r.length?r:null}}).filter(R)}function ti(e,i,n,r,a){null!=a&&(a=Math.round(a));var s={RepresentationID:i,Number:n,Bandwidth:r,Time:a};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=s[i];return null==r?e:("RepresentationID"==i&&n&&(n=void 0),e=r.toString(),n=t.parseInt(n,10)||1,Array(Math.max(0,n-e.length)+1).join("0")+e)})}function ei(t,e){var i=ii(t,e,"timescale"),n=1;i&&(n=Ye(i)||1),i=ii(t,e,"duration"),(i=Ye(i||""))&&(i/=n);var r=ii(t,e,"startNumber"),a=Number(ii(t,e,"presentationTimeOffset"))||0,s=ze(r||"");null!=r&&null!=s||(s=1);var o=ni(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=t.R.duration||1/0,o=Fe(o,"S"),h=[],c=0,l=0;l<o.length;++l){var f=o[l],d=He(f,"t",ze),p=He(f,"d",ze),f=He(f,"r",Xe);if(null!=d&&(d-=a),!p)break;if(d=null!=d?d:c,0>(f=f||0))if(l+1<o.length){if(null==(f=He(o[l+1],"t",ze)))break;if(d>=f)break;f=Math.ceil((f-d)/p)-1}else{if(1/0==u)break;if(d/r>=u)break;f=Math.ceil((u*r-d)/p)-1}0<h.length&&d!=c&&(h[h.length-1].end=d/r);for(var m=0;m<=f;++m)c=d+p,h.push({start:d/r,end:c/r,Te:d}),d=c}r=h}return{timescale:n,O:i,za:s,V:a/n||0,dc:a,I:r}}function ii(t,e,i){return[e(t.v),e(t.S),e(t.Z)].filter(R).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function ni(t,e,i){return[e(t.v),e(t.S),e(t.Z)].filter(R).map(function(t){return Be(t,i)}).reduce(function(t,e){return t||e})}function ri(t,e){var i=new DOMParser;try{var n=tt(t),r=i.parseFromString(n,"text/xml")}catch(t){}if(r&&r.documentElement.tagName==e)var a=r.documentElement;return a&&0<a.getElementsByTagName("parsererror").length?null:a}function ai(t,e,i,n,r,a){for(var s=t.getAttribute("xlink:href"),o=t.getAttribute("xlink:actuate")||"onRequest",u=0;u<t.attributes.length;u++){var c=t.attributes[u].nodeName;-1!=c.indexOf("xlink:")&&(t.removeAttribute(c),--u)}if(5<=a)return Promise.reject(new h(2,4,4028));if("onLoad"!=o)return Promise.reject(new h(2,4,4027));var l=Y([n],[s]);return r.request(0,M(l,e)).then(function(n){if(!(n=ri(n.data,t.tagName)))return Promise.reject(new h(2,4,4001,s));for(;t.childNodes.length;)t.removeChild(t.childNodes[0]);for(;n.childNodes.length;){var o=n.childNodes[0];n.removeChild(o),t.appendChild(o)}for(o=0;o<n.attributes.length;o++){var u=n.attributes[o].nodeName,c=n.getAttribute(u);t.setAttribute(u,c)}return si(t,e,i,l[0],r,a+1)}.bind(t))}function si(t,e,i,n,r,a){if(a=a||0,t.getAttribute("xlink:href")){var s=ai(t,e,i,n,r,a);return i&&(s=s.catch(function(){return si(t,e,i,n,r,a)})),s}for(s=0;s<t.childNodes.length;s++){var o=t.childNodes[s];o instanceof Element&&"urn:mpeg:dash:resolve-to-zero:2013"==o.getAttribute("xlink:href")&&(t.removeChild(o),--s)}for(var u=[],s=0;s<t.childNodes.length;s++)o=t.childNodes[s],o.nodeType==Node.ELEMENT_NODE&&(o=si(o,e,i,n,r,a),u.push(o));return Promise.all(u).then(function(){return t})}function oi(t,e,i){this.a=t,this.N=e,this.D=i}function ui(t,e,i,n,r,a){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.N=r,this.D=a}function hi(t,e){this.G=t,this.b=e==uu,this.a=0}function ci(){throw new h(2,3,3e3)}function li(){this.c=[],this.b=[],this.a=!1}function fi(t){for(;t.o.ca()&&!t.oa.a;)t.oa.rb(t.start,t.o,t.Ec)}function di(t){for(var e=t.o.B();0<e&&!t.oa.a;--e)t.oa.rb(t.start,t.o,t.Ec)}function pi(t){return function(e){t(e.o.Ma(e.o.G.byteLength-e.o.U()))}}function mi(t){for(var e=0,i=0;i<t.length;i++)e=e<<8|t.charCodeAt(i);return e}function yi(t,e,i,n){var r,a=(new li).ba("sidx",function(t){r=vi(e,n,i,t)});if(t&&a.parse(t),r)return r;throw new h(2,3,3004)}function vi(t,e,i,n){var r=[];n.o.H(4);var a=n.o.B();if(!a)throw new h(2,3,3005);if(n.version)var s=n.o.Na(),o=n.o.Na();else s=n.o.B(),o=n.o.B();n.o.H(2);var u=n.o.Xa();for(t=t+n.size+o,o=0;o<u;o++){var c=n.o.B(),l=(2147483648&c)>>>31,c=2147483647&c,f=n.o.B();if(n.o.H(4),1==l)throw new h(2,3,3006);r.push(new ui(r.length,s/a-e,(s+f)/a-e,function(){return i},t,t+c-1)),s+=f,t+=c}return n.oa.stop(),r}function gi(t){this.a=t}function bi(t,e){for(var i;t.a.length&&(i=t.a[t.a.length-1],i.startTime>=e);)t.a.pop();for(;t.a.length&&(i=t.a[0],0>=i.endTime);)t.a.shift();t.a.length&&(i=t.a[0],i.startTime<Vo&&(t.a[0]=new ui(i.position,0,i.endTime,i.a,i.N,i.D)),i=t.a[t.a.length-1],t.a[t.a.length-1]=new ui(i.position,i.startTime,e,i.a,i.N,i.D))}function Ti(t){this.b=t,this.a=new hi(t,0),hu||(hu=[new Uint8Array([255]),new Uint8Array([127,255]),new Uint8Array([63,255,255]),new Uint8Array([31,255,255,255]),new Uint8Array([15,255,255,255,255]),new Uint8Array([7,255,255,255,255,255]),new Uint8Array([3,255,255,255,255,255,255]),new Uint8Array([1,255,255,255,255,255,255,255])])}function wi(t){var e=Ei(t);if(7<e.length)throw new h(2,3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=Ei(t);t:{for(n=0;n<hu.length;n++)if(ft(i,hu[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.U();else{if(8==i.length&&224&i[1])throw new h(2,3,3001);for(var n=i[0]&(1<<8-i.length)-1,r=1;r<i.length;r++)n=256*n+i[r];i=n}return i=t.a.U()+i<=t.b.byteLength?i:t.b.byteLength-t.a.U(),n=new DataView(t.b.buffer,t.b.byteOffset+t.a.U(),i),t.a.H(i),new Si(e,n)}function Ei(t){var e,i=t.a.$();for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new h(2,3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=t.a.$();return n}function Si(t,e){this.id=t,this.a=e}function Ai(t){if(8<t.a.byteLength)throw new h(2,3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new h(2,3,3001);for(var e=0,i=0;i<t.a.byteLength;i++)var n=t.a.getUint8(i),e=256*e+n;return e}function ki(){}function Ii(t,e,i,n,r,a){function s(){return r}var o=[];t=new Ti(t.a);for(var u=null,h=null;t.ca();){var c=wi(t);if(187==c.id){var l=_i(c);l&&(c=i*l.Ue,l=e+l.oe,null!=u&&o.push(new ui(o.length,u-a,c-a,s,h,l-1)),u=c,h=l)}}return null!=u&&o.push(new ui(o.length,u-a,n-a,s,h,null)),o}function _i(t){var e=new Ti(t.a);if(t=wi(e),179!=t.id)throw new h(2,3,3013);if(t=Ai(t),e=wi(e),183!=e.id)throw new h(2,3,3012);for(var e=new Ti(e.a),i=0;e.ca();){var n=wi(e);if(241==n.id){i=Ai(n);break}}return{Ue:t,oe:i}}function Pi(t,e){var i=ni(t,e,"Initialization");if(!i)return null;var n=t.v.aa,r=i.getAttribute("sourceURL");r&&(n=Y(t.v.aa,[r]));var r=0,a=null;return(i=He(i,"range",Ge))&&(r=i.start,a=i.end),new oi(function(){return n},r,a)}function xi(t,e){var i=Number(ii(t,Ni,"presentationTimeOffset"))||0,n=ii(t,Ni,"timescale"),r=1;n&&(r=Ye(n)||1);var i=i/r||0,n=Pi(t,Ni),a=t.v.contentType,r=t.v.mimeType.split("/")[1];if("text"!=a&&"mp4"!=r&&"webm"!=r)throw new h(2,4,4006);if("webm"==r&&!n)throw new h(2,4,4005);var a=ni(t,Ni,"RepresentationIndex"),s=ii(t,Ni,"indexRange"),o=t.v.aa,s=Ge(s||"");if(a){var u=a.getAttribute("sourceURL");u&&(o=Y(t.v.aa,[u])),s=He(a,"range",Ge,s)}if(!s)throw new h(2,4,4002);return r=Ri(t,e,n,o,s.start,s.end,r,i),{createSegmentIndex:r.createSegmentIndex,findSegmentPosition:r.findSegmentPosition,getSegmentReference:r.getSegmentReference,initSegmentReference:n,V:i}}function Ri(t,e,i,n,r,a,s,o){var u=t.presentationTimeline,h=!t.Da||!t.R.Hb,c=t.R.duration,l=e,f=null;return{createSegmentIndex:function(){var t=[l(n,r,a),"webm"==s?l(i.a(),i.N,i.D):null];return l=null,Promise.all(t).then(function(t){var e=t[0];t=t[1]||null,e="mp4"==s?yi(e,r,n,o):(new ki).parse(e,t,n,o),u.Ia(0,e),f=new gi(e),h&&bi(f,c)})},findSegmentPosition:function(t){return f.find(t)},getSegmentReference:function(t){return f.get(t)}}}function Ni(t){return t.Ya}function Li(t,e){var i=Pi(t,Di),n=Ci(t),r=ei(t,Di),a=r.za;a||(a=1);var s=0;if(r.O?s=r.O*(a-1):r.I&&0<r.I.length&&(s=r.I[0].start),n={O:r.O,startTime:s,za:a,V:r.V,I:r.I,Ha:n},!n.O&&!n.I&&1<n.Ha.length)throw new h(2,4,4002);if(!n.O&&!t.R.duration&&!n.I&&1==n.Ha.length)throw new h(2,4,4002);if(n.I&&!n.I.length)throw new h(2,4,4002);return a=r=null,t.Z.id&&t.v.id&&(a=t.Z.id+","+t.v.id,r=e[a]),s=Mi(t.R.duration,n.za,t.v.aa,n),r?(r.Lb(s),a=t.presentationTimeline.ja(),r.Bb(a-t.R.start)):(t.presentationTimeline.Ia(0,s),r=new gi(s),a&&t.Da&&(e[a]=r)),t.Da&&t.R.Hb||bi(r,t.R.duration),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:i,V:n.V}}function Di(t){return t.qa}function Mi(t,e,i,n){var r=n.Ha.length;n.I&&n.I.length!=n.Ha.length&&(r=Math.min(n.I.length,n.Ha.length));for(var a=[],s=n.startTime,o=0;o<r;o++){var u=n.Ha[o],h=Y(i,[u.Ad]),c=null!=n.O?s+n.O:n.I?n.I[o].end:s+t;a.push(new ui(o+e,s,c,function(t){return t}.bind(null,h),u.start,u.end)),s=c}return a}function Ci(t){return[t.v.qa,t.S.qa,t.Z.qa].filter(R).map(function(t){return Fe(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(e){e.getAttribute("indexRange")&&!t.qc&&(t.qc=!0);var i=e.getAttribute("media");return e=He(e,"mediaRange",Ge,{start:0,end:null}),{Ad:i,start:e.start,end:e.end}})}function Oi(t,e,i,n){var r=Fi(t),a=ei(t,Ui),s=ii(t,Ui,"media"),o=ii(t,Ui,"index");if(a={O:a.O,timescale:a.timescale,za:a.za,V:a.V,dc:a.dc,I:a.I,Kb:s,Va:o},s=0+(a.Va?1:0),s+=a.I?1:0,!(s+=a.O?1:0))throw new h(2,4,4002);if(1!=s&&(a.Va&&(a.I=null),a.O=null),!a.Va&&!a.Kb)throw new h(2,4,4002);if(a.Va){if("mp4"!=(i=t.v.mimeType.split("/")[1])&&"webm"!=i)throw new h(2,4,4006);if("webm"==i&&!r)throw new h(2,4,4005);n=ti(a.Va,t.v.id,null,t.bandwidth||null,null),n=Y(t.v.aa,[n]),t=Ri(t,e,r,n,0,null,i,a.V)}else a.O?(n||t.presentationTimeline.Mb(a.O),t=ji(t,a)):(n=e=null,t.Z.id&&t.v.id&&(n=t.Z.id+","+t.v.id,e=i[n]),s=Bi(t,a),e?(e.Lb(s),i=t.presentationTimeline.ja(),e.Bb(i-t.R.start)):(t.presentationTimeline.Ia(0,s),e=new gi(s),n&&t.Da&&(i[n]=e)),t.Da&&t.R.Hb||bi(e,t.R.duration),t={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e)});return{createSegmentIndex:t.createSegmentIndex,findSegmentPosition:t.findSegmentPosition,getSegmentReference:t.getSegmentReference,initSegmentReference:r,V:a.V}}function Ui(t){return t.Za}function ji(t,e){var i=t.R.duration,n=e.O,r=e.za,a=e.timescale,s=e.V,o=e.Kb,u=t.bandwidth||null,h=t.v.id,c=t.v.aa;return{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0>t||i&&t>=i?null:Math.floor((t+s)/n)},getSegmentReference:function(t){var e=t*n-s,l=Math.min(e+n,i);return 0>l||i&&e>=i?null:new ui(t,e,l,function(){var i=ti(o,h,t+r,u,e*a);return Y(c,[i])},0,null)}}}function Bi(t,e){for(var i=[],n=0;n<e.I.length;n++){var r=n+e.za;i.push(new ui(r,e.I[n].start,e.I[n].end,function(t,e,i,n,r,a){return t=ti(t,e,r,i,a),Y(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Kb,t.v.id,t.bandwidth||null,t.v.aa,r,e.I[n].Te+e.dc),0,null))}return i}function Fi(t){var e=ii(t,Ui,"initialization");if(!e)return null;var i=t.v.id,n=t.bandwidth||null,r=t.v.aa;return new oi(function(){var t=ti(e,i,null,n,null);return Y(r,[t])},0,null)}function Vi(){var t,e={};for(t in cu)e[t]=!0;for(t in lu)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!cu[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!lu[t]}),e}function Hi(t,e,i,n){var r=n;return r||(n=new c(t).Y.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=lu[n])),r?Promise.resolve(r):(i=M([t],i),i.method="HEAD",e.request(0,i).then(function(e){return(e=e.headers["content-type"])&&(e=e.toLowerCase()),(r=cu[e])?r:Promise.reject(new h(2,4,4e3,t))},function(t){return t.severity=2,Promise.reject(t)}))}function Ki(t,e){this.c=t,this.j=e,this.f=this.a=1/0,this.b=1,this.i=0,this.h=!0,this.g=0}function qi(){this.a=this.b=null,this.g=[],this.c=null,this.i=[],this.h=1,this.j={},this.l=0,this.f=null}function Gi(t){return t.a.networkingEngine.request(0,M(t.g,t.b.retryParameters),function(){return!this.a}.bind(t)).then(function(t){if(this.a)return Xi(this,t.data,t.uri)}.bind(t))}function Xi(t,e,i){if(!(e=ri(e,"MPD")))throw new h(2,4,4001,i);return si(e,t.b.retryParameters,t.b.dash.xlinkFailGracefully,i,t.a.networkingEngine).then(function(t){return Yi(this,t,i)}.bind(t))}function Yi(t,e,i){i=[i];var n=Fe(e,"Location").map(Ve).filter(R);0<n.length&&(i=t.g=n),n=Fe(e,"BaseURL").map(Ve),i=Y(i,n);var r=He(e,"minBufferTime",qe);t.l=He(e,"minimumUpdatePeriod",qe,-1);var a=He(e,"availabilityStartTime",Ke),n=He(e,"timeShiftBufferDepth",qe),s=He(e,"suggestedPresentationDelay",qe),o=He(e,"maxSegmentDuration",qe),u=e.getAttribute("type")||"static";if(t.c)var h=t.c.presentationTimeline;else{var c=Math.max(10,1.5*r);h=new Ki(a,null!=s?s:c)}var a=zi(t,{Da:"static"!=u,presentationTimeline:h,Z:null,R:null,S:null,v:null,bandwidth:0,qc:!1},i,e),s=a.duration,l=a.periods;return h.ub("static"==u),"static"!=u&&a.ic||h.fa(s||1/0),h.Zb(null!=n?n:1/0),h.Mb(o||1),t.c?Promise.resolve():(e=Fe(e,"UTCTiming"),n=h.P(),rn(t,i,e,n).then(function(t){this.a&&(h.Pc(t),this.c={presentationTimeline:h,periods:l,offlineSessionIds:[],minBufferTime:r||0})}.bind(t)))}function zi(t,e,i,n){var r=He(n,"mediaPresentationDuration",qe),a=[],s=0;n=Fe(n,"Period");for(var o=0;o<n.length;o++){var u=n[o],s=He(u,"start",qe,s),h=He(u,"duration",qe),c=null;if(o!=n.length-1){var l=He(n[o+1],"start",qe);null!=l&&(c=l-s)}else null!=r&&(c=r-s);if(null==c&&(c=h),u=$i(t,e,i,{start:s,duration:c,node:u,Hb:null==c||o==n.length-1}),a.push(u),h=e.Z.id,-1==t.i.indexOf(h)&&(t.i.push(h),t.c&&(t.a.filterNewPeriod(u),t.c.periods.push(u))),null==c){s=null;break}s+=c}return t.c||t.a.filterAllPeriods(a),null!=r?{periods:a,duration:r,ic:!1}:{periods:a,duration:s,ic:!0}}function $i(t,e,i,n){e.Z=Zi(n.node,null,i),e.R=n,e.Z.id||(e.Z.id="__shaka_period_"+n.start),Fe(n.node,"EventStream").forEach(t.ee.bind(t,n.start,n.duration)),i=Fe(n.node,"AdaptationSet").map(t.ce.bind(t,e)).filter(R);var r=i.map(function(t){return t.qe}).reduce(P,[]),a=r.filter(N);if(e.Da&&r.length!=a.length)throw new h(2,4,4018);var s=i.filter(function(t){return!t.cc});if(i.filter(function(t){return t.cc}).forEach(function(t){var e=t.streams[0],i=t.cc;s.forEach(function(t){t.id==i&&t.streams.forEach(function(t){t.trickModeVideo=e})})}),r=Wi(s,"video"),a=Wi(s,"audio"),!r.length&&!a.length)throw new h(2,4,4004);for(a.length||(a=[null]),r.length||(r=[null]),e=[],i=0;i<a.length;i++)for(var o=0;o<r.length;o++)Ji(t,a[i],r[o],e);for(t=Wi(s,"text"),r=[],i=0;i<t.length;i++)r.push.apply(r,t[i].streams);return{startTime:n.start,textStreams:r,variants:e}}function Wi(t,e){return t.filter(function(t){return t.contentType==e})}function Ji(t,e,i,n){if(e||i)if(e&&i){var r=e.drmInfos,a=i.drmInfos;if(r.length&&a.length?0<Nt(r,a).length:1)for(var s=Nt(e.drmInfos,i.drmInfos),r=0;r<e.streams.length;r++)for(var o=0;o<i.streams.length;o++)a=(i.streams[o].bandwidth||0)+(e.streams[r].bandwidth||0),a={id:t.h++,language:e.language,primary:e.Jb||i.Jb,audio:e.streams[r],video:i.streams[o],bandwidth:a,drmInfos:s,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}else for(s=e||i,r=0;r<s.streams.length;r++)a=s.streams[r].bandwidth||0,a={id:t.h++,language:s.language||"und",primary:s.Jb,audio:e?s.streams[r]:null,video:i?s.streams[r]:null,bandwidth:a,drmInfos:s.drmInfos,allowedByApplication:!0,allowedByKeySystem:!0},n.push(a)}function Qi(e,i){0>e.l||(e.f=t.setTimeout(e.Le.bind(e),1e3*Math.max(Math.max(3,e.l)-i,0)))}function Zi(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",containsEmsgBoxes:!1,frameRate:void 0,Nb:null},i=i||e.aa;var n=Fe(t,"BaseURL").map(Ve),r=t.getAttribute("contentType")||e.contentType,a=t.getAttribute("mimeType")||e.mimeType,s=t.getAttribute("codecs")||e.codecs,o=He(t,"frameRate",$e)||e.frameRate,u=!!Fe(t,"InbandEventStream").length,h=Fe(t,"AudioChannelConfiguration"),h=tn(h)||e.Nb;return r||(r=an(a,s)),{aa:Y(i,n),Ya:Be(t,"SegmentBase")||e.Ya,qa:Be(t,"SegmentList")||e.qa,Za:Be(t,"SegmentTemplate")||e.Za,width:He(t,"width",ze)||e.width,height:He(t,"height",ze)||e.height,contentType:r,mimeType:a,codecs:s,frameRate:o,containsEmsgBoxes:u||e.containsEmsgBoxes,id:t.getAttribute("id"),Nb:h}}function tn(t){for(var e=0;e<t.length;++e){var i=t[e],n=i.getAttribute("schemeIdUri");if(n&&(i=i.getAttribute("value")))switch(n){case"urn:mpeg:dash:outputChannelPositionList:2012":return i.trim().split(/ +/).length;case"urn:mpeg:dash:23003:3:audio_channel_configuration:2011":case"urn:dts:dash:audio_channel_configuration:2012":if(!(n=parseInt(i,10)))continue;return n;case"tag:dolby.com,2014:dash:audio_channel_configuration:2011":case"urn:dolby:dash:audio_channel_configuration:2011":if(n=parseInt(i,16)){for(t=0;n;)1&n&&++t,n>>=1;return t}}}return null}function en(t){var e=0+(t.Ya?1:0);return e+=t.qa?1:0,(e+=t.Za?1:0)?(1!=e&&(t.Ya&&(t.qa=null),t.Za=null),!0):"text"==t.contentType||"application"==t.contentType}function nn(t,e,i,n){return e=Y(e,[i]),e=M(e,t.b.retryParameters),e.method=n,t.a.networkingEngine.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=tt(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function rn(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.b.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),_(i,function(t){var i=t.value;switch(t.scheme){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":return nn(this,e,i,"HEAD");case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":return nn(this,e,i,"GET");case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":return t=Date.parse(i),isNaN(t)?0:t-Date.now();case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:return Promise.reject()}}.bind(t)).catch(function(){return 0})}function an(t,e){return Ko[Z(t,e)]?"text":t.split("/")[0]}function sn(t,e,i,n){this.uri=t,this.type=e,this.a=i,this.segments=n||null}function on(t,e,i,n){this.id=t,this.name=e,this.a=i,this.value=n||null}function un(t,e){this.name=t,this.value=e}function hn(t,e,i){return i=i||null,(t=t.getAttribute(e))?t.value:i}function cn(t,e){this.a=e,this.uri=t}function ln(t,e){return t.filter(function(t){return t.name==e})}function fn(t,e){var i=ln(t,e);return i.length?i[0]:null}function dn(t,e,i){return t.filter(function(t){var n=t.getAttribute("TYPE");return t=t.getAttribute("GROUP-ID"),n.value==e&&t.value==i})}function pn(t,e){return Y([t],[e])[0]}function mn(t){this.b=t,this.a=0}function yn(t,e){e.lastIndex=t.a;var i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,te:i}:null;return t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.te):null}function vn(t){return t.a==t.b.length?null:(t=yn(t,/[^ \t\n]*/gm))?t[0]:null}function gn(){this.a=0}function bn(t,e,i){e=tt(e),e=e.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n").trim();var n=e.split(/\n+/m);if(!/^#EXTM3U($|[ \t\n])/m.test(n[0]))throw new h(2,4,4015);e=0;for(var r=[],a=1;a<n.length;)if(/^#(?!EXT)/m.test(n[a]))a+=1;else{var s=n[a];if(s=wn(t.a++,s),0<=fu.indexOf(s.name))e=1;else if(0<=du.indexOf(s.name)){if(1!=e)throw new h(2,4,4017);return n=n.splice(a,n.length-a),t=Tn(t,n,r),new sn(i,e,r,t)}r.push(s),a+=1,"EXT-X-STREAM-INF"==s.name&&(s.a.push(new un("URI",n[a])),a+=1)}return new sn(i,e,r)}function Tn(t,e,i){var n=[],r=[];return e.forEach(function(t){/^(#EXT)/.test(t)?(t=wn(this.a++,t),0<=fu.indexOf(t.name)?i.push(t):r.push(t)):/^#(?!EXT)/m.test(t)||(n.push(new cn(t.trim(),r)),r=[])}.bind(t)),n}function wn(t,e){var i=e.match(/^#(EXT[^:]*)(?::(.*))?$/);if(!i)throw new h(2,4,4016);var n=i[1],r=i[2],i=[];if(r&&0<=r.indexOf("="))for(var a,r=new mn(r),s=/([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;a=yn(r,s);)i.push(new un(a[1],a[2]||a[3]));else if(r)return new on(t,n,i,r);return new on(t,n,i)}function En(t){return new Promise(function(e){var i=En.parse(t);e({uri:t,data:i.data,headers:{"content-type":i.contentType}})})}function Sn(){this.g=this.c=null,this.F=1,this.u={},this.A={},this.K={},this.a={},this.b=null,this.l="",this.s=new gn,this.i=this.h=null,this.f=vu,this.m=null,this.j=0,this.w=1/0}function An(t,e,i){Yn(t,i).then(function(t){var n=gu,r=bn(this.s,t.data,i);if(1!=r.type)throw new h(2,4,4017);t=fn(r.a,"EXT-X-MEDIA-SEQUENCE");var a=e.stream;jn(this,r,t?Number(t.value):0,a.mimeType,a.codecs).then(function(t){e.tb.a=t,t=t[t.length-1],fn(r.a,"EXT-X-ENDLIST")&&($n(this,n.na),this.b.fa(t.endTime))}.bind(this))}.bind(t))}function kn(t,e,i){if(e=bn(t.s,e,i),0!=e.type)throw new h(2,4,4022);return In(t,e).then(function(t){if(this.c.filterAllPeriods([t]),this.f!=gu.na){var e=3*this.j;this.b.Qc(e),this.h=this.w,this.f==gu.ec&&this.b.Zb(e)}else{var i,n=1/0,r=1/0;for(i in this.a)e=this.a[i],n=Math.min(n,e.Bd),r=Math.min(r,e.duration);this.b.fa(r);for(i in this.a)e=this.a[i],e.stream.presentationTimeOffset=n,e.tb.offset(-n),bi(e.tb,r)}this.m={presentationTimeline:this.b,periods:[t],offlineSessionIds:[],minBufferTime:0}}.bind(t))}function In(t,e){var i=e.a,n=ln(e.a,"EXT-X-MEDIA").filter(function(t){return"SUBTITLES"==Gn(t,"TYPE")}.bind(t)).map(function(t){return Rn(this,t)}.bind(t));return Promise.all(n).then(function(t){var n=ln(i,"EXT-X-STREAM-INF").map(function(t){return _n(this,t,e)}.bind(this));return Promise.all(n).then(function(e){return{startTime:0,variants:e.reduce(P,[]),textStreams:t}}.bind(this))}.bind(t))}function _n(t,e,i){var n=hn(e,"CODECS","avc1.42E01E,mp4a.40.2").split(","),r=e.getAttribute("RESOLUTION"),a=null,s=null,o=hn(e,"FRAME-RATE"),u=Number(Gn(e,"BANDWIDTH"));if(r)var h=r.value.split("x"),a=h[0],s=h[1];i=ln(i.a,"EXT-X-MEDIA");var c=hn(e,"AUDIO"),l=hn(e,"VIDEO");if(c?i=dn(i,"AUDIO",c):l&&(i=dn(i,"VIDEO",l)),h=Kn("text",n)){var f=hn(e,"SUBTITLES");f&&(f=dn(i,"SUBTITLES",f),f.length&&(t.u[f[0].id].stream.codecs=h)),n.splice(n.indexOf(h),1)}i=i.map(function(t){return Nn(this,t,n)}.bind(t));var d=[],p=[];return Promise.all(i).then(function(t){if(c?d=t:l&&(p=t),d.length||p.length)if(d.length)if(Gn(e,"URI")==d[0].Wb){t="audio";var i=!0}else t="video";else t="audio";else i=!1,1==n.length?(t=Kn("video",n),t=r||o||t?"video":"audio"):(t="video",n=[n.join(",")]);return i?Promise.resolve():Dn(this,e,n,t)}.bind(t)).then(function(t){return t&&("audio"==t.stream.type?d=[t]:p=[t]),Pn(this,d,p,u,a,s,o)}.bind(t))}function Pn(t,e,i,n,r,a,s){i.forEach(function(t){(t=t.stream)&&(t.width=Number(r)||void 0,t.height=Number(a)||void 0,t.frameRate=Number(s)||void 0)}.bind(t)),e.length||(e=[null]),i.length||(i=[null]);for(var o=[],u=0;u<e.length;u++)for(var h=0;h<i.length;h++){var c=e[u]?e[u].stream:null,l=i[h]?i[h].stream:null,f=e[u]?e[u].drmInfos:null,d=i[h]?i[h].drmInfos:null;if(c&&l){if(!(f.length&&d.length?0<Nt(f,d).length:1))continue;var p=Nt(f,d)}else c?p=f:l&&(p=d);f=(i[u]?i[u].Wb:"")+" - "+(e[u]?e[u].Wb:""),t.A[f]||(c=xn(t,c,l,n,p),o.push(c),t.A[f]=c)}return o}function xn(t,e,i,n,r){return{id:t.F++,language:e?e.language:"und",primary:!!e&&e.primary||!!i&&i.primary,audio:e,video:i,bandwidth:n,drmInfos:r,allowedByApplication:!0,allowedByKeySystem:!0}}function Rn(t,e){return Gn(e,"TYPE"),Nn(t,e,[]).then(function(t){return t.stream})}function Nn(t,e,i){var n=Gn(e,"URI"),n=pn(t.l,n);if(t.a[n])return Promise.resolve(t.a[n]);var r=Gn(e,"TYPE").toLowerCase();"subtitles"==r&&(r="text");var a=Zt(hn(e,"LANGUAGE","und")),s=hn(e,"NAME"),o=e.getAttribute("DEFAULT"),u=e.getAttribute("AUTOSELECT"),h=hn(e,"CHANNELS");return Mn(t,n,i,r,a,!!o||!!u,s,"audio"==r?Ln(h):null).then(function(t){return this.a[n]?this.a[n]:(this.u[e.id]=t,this.a[n]=t)}.bind(t))}function Ln(t){return t?(t=t.split("/")[0],parseInt(t,10)):null}function Dn(t,e,i,n){var r=Gn(e,"URI"),r=pn(t.l,r);return t.a[r]?Promise.resolve(t.a[r]):Mn(t,r,i,n,"und",!1,null,null).then(function(t){return this.a[r]?this.a[r]:this.a[r]=t}.bind(t))}function Mn(t,e,i,n,r,a,s,o){var u=e;e=pn(t.l,e);var c,l,f="";return Yn(t,e).then(function(t){if(c=bn(this.s,t.data,e),1!=c.type)throw new h(2,4,4017);t=c;var r=gu,a=fn(t.a,"EXT-X-PLAYLIST-TYPE"),s=fn(t.a,"EXT-X-ENDLIST"),s=a&&"VOD"==a.value||s,a=a&&"EVENT"==a.value&&!s,a=!s&&!a;if(s?$n(this,r.na):(a?$n(this,r.ec):$n(this,r.Vc),t=Xn(t.a,"EXT-X-TARGETDURATION"),t=Number(t.value),this.j=Math.max(t,this.j),this.w=Math.min(t,this.w)),1==i.length)f=i[0];else{if(null==(t=Kn(n,i)))throw new h(2,4,4025,i);f=t}return qn(this,n,f,c)}.bind(t)).then(function(t){return l=t,t=fn(c.a,"EXT-X-MEDIA-SEQUENCE"),jn(this,c,t?Number(t.value):0,l,f)}.bind(t)).then(function(t){var e=t[0].startTime,i=t[t.length-1].endTime,d=i-e,p=new gi(t);this.b||Cn(this,i),i=null,"text"!=n&&(i=On(c)),this.b.Ia(0,t),t=void 0,"text"==n&&(t="subtitle");var m=[];c.segments.forEach(function(t){t=ln(t.a,"EXT-X-KEY"),m.push.apply(m,t)});var y=!1,v=[],g=null;if(m.forEach(function(t){if("NONE"!=Gn(t,"METHOD")){y=!0;var e=Gn(t,"KEYFORMAT");(t=(e=yu[e])?e(t):null)&&(t.keyIds.length&&(g=t.keyIds[0]),v.push(t))}}),y&&!v.length)throw new h(2,4,4026);return t={id:this.F++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:p.find.bind(p),getSegmentReference:p.get.bind(p),initSegmentReference:i,presentationTimeOffset:0,mimeType:l,codecs:f,kind:t,encrypted:y,keyId:g,language:r,label:s||null,type:n,primary:a,trickModeVideo:null,containsEmsgBoxes:!1,frameRate:void 0,width:void 0,height:void 0,bandwidth:void 0,roles:[],channelsCount:o},this.K[t.id]=p,{stream:t,tb:p,drmInfos:v,Wb:u,Bd:e,duration:d}}.bind(t))}function Cn(t,e){var i=null,n=0;t.f!=gu.na&&(i=Date.now()/1e3-e,n=3*t.j),t.b=new Ki(i,n),t.b.ub(t.f==gu.na)}function On(t){var e=ln(t.a,"EXT-X-MAP");if(!e.length)return null;if(1<e.length)throw new h(2,4,4020);var e=e[0],i=Gn(e,"URI"),n=pn(t.uri,i);return t=0,i=null,(e=hn(e,"BYTERANGE"))&&(t=e.split("@"),e=Number(t[0]),t=Number(t[1]),i=t+e-1),new oi(function(){return[n]},t,i)}function Un(t,e,i,n,r){var a=i.a,s=pn(t.uri,i.uri);t=Xn(a,"EXTINF").value.split(","),t=r+Number(t[0]),i=0;var o=null;return(a=fn(a,"EXT-X-BYTERANGE"))&&(i=a.value.split("@"),a=Number(i[0]),i=i[1]?Number(i[1]):e.D+1,o=i+a-1),new ui(n,r,t,function(){return[s]},i,o)}function jn(t,e,i,n,r){var a=e.segments,s=[],o=pn(e.uri,a[0].uri),u=Un(e,null,a[0],i,0);return Fn(t,e.uri,u,n,r).then(function(t){o.split("/").pop();for(var n=0;n<a.length;++n){var r=s[s.length-1],r=Un(e,r,a[n],i+n,n?r.endTime:t);s.push(r)}return s}.bind(t))}function Bn(t,e){var i=t.c.networkingEngine,n=M(e.a(),t.g.retryParameters),r={},a=e.N;r.Range="bytes="+a+"-"+(a+2048-1);var s={};return(a||null!=e.D)&&(a="bytes="+a+"-",null!=e.D&&(a+=e.D),s.Range=a),n.headers=r,i.request(1,n).catch(function(){return o("Unable to fetch a partial HLS segment! Falling back to a full segment request, which is expensive! Your server should support Range requests and CORS preflights.",n.uris[0]),n.headers=s,i.request(1,n)})}function Fn(t,e,i,n,r){return t.m&&(e=t.a[e].tb.get(i.position))?Promise.resolve(e.startTime):Bn(t,i).then(function(t){if("video/mp4"==n||"audio/mp4"==n)return Vn(t.data);if("video/mp2t"==n)return Hn(t.data);if("application/mp4"!=n&&n.indexOf("text/"))throw new h(2,4,4030);t=t.data;var e=Z(n,r);if(Ko[e]){var i=new Bt(null);i.c=new Ko[e],t=i.Gb(t)}else t=0;return t}.bind(t))}function Vn(t){var e=0,i=!1;if((new li).C("moof",fi).C("traf",fi).ba("tfdt",function(t){e=(t.version?t.o.Na():t.o.B())/9e4,i=!0,t.oa.stop()}).parse(t,!0),!i)throw new h(2,4,4030);return e}function Hn(t){function e(){throw new h(2,4,4030)}t=new hi(new DataView(t),0);for(var i=0;;){i=t.U();var n=t.$();if(71!=n&&e(),16384&t.Xa()||e(),(n=(48&t.$())>>4)&&2!=n||e(),3==n&&(n=t.$(),t.H(n)),1==t.B()>>8)return t.H(3),(i=t.$()>>6)&&1!=i||e(),t.$()||e(),i=t.$(),n=t.Xa(),t=t.Xa(),(1073741824*((14&i)>>1)+((65534&n)<<14|(65534&t)>>1))/9e4;t.seek(i+188),n=t.$(),71!=n&&(t.seek(i+192),n=t.$()),71!=n&&(t.seek(i+204),n=t.$()),71!=n&&e(),t.Lc(1)}}function Kn(t,e){for(var i=pu[t],n=0;n<i.length;n++)for(var r=0;r<e.length;r++)if(i[n].test(e[r].trim()))return e[r].trim();return"text"==t?"":null}function qn(t,e,i,n){n=pn(n.uri,n.segments[0].uri);var r=new c(n).Y.split(".").pop(),a=mu[e][r];return a?Promise.resolve(a):"text"==e?i&&"vtt"!=i?Promise.resolve("application/mp4"):Promise.resolve("text/vtt"):(e=M([n],t.g.retryParameters),e.method="HEAD",t.c.networkingEngine.request(1,e).then(function(t){if(!(t=t.headers["content-type"]))throw new h(2,4,4021,r);return t.split(";")[0]}))}function Gn(t,e){var i=t.getAttribute(e);if(!i)throw new h(2,4,4023,e);return i.value}function Xn(t,e){var i=fn(t,e);if(!i)throw new h(2,4,4024,e);return i}function Yn(t,e){return t.c.networkingEngine.request(0,M([e],t.g.retryParameters),function(){return!this.c}.bind(t))}function zn(e,i){null!=e.h&&null!=i&&(e.i=t.setTimeout(e.J.bind(e),1e3*i))}function $n(e,i){e.f=i,e.b&&e.b.ub(e.f==gu.na),e.f==gu.na&&null!=e.i&&(t.clearTimeout(e.i),e.i=null,e.h=null)}function Wn(t,e,i,n,r,a){this.a=t,this.c=e,this.l=i,this.m=null==n?null:Qn(this,n),this.K=r,this.J=a,this.b=new V,this.j=!1,this.i=1,this.h=this.f=null,this.g=new at(this.Dd.bind(this)),this.F=t.readyState,this.s=!1,this.A=this.W=-1,this.u=this.w=!1,0<t.readyState?this.yc():(K(this.b,t,"loadedmetadata",this.yc.bind(this)),H(this.b,t,"timeupdate",function(){st(this.g,.1)}.bind(this))),e=this.Ac.bind(this),H(this.b,t,"ratechange",this.Qd.bind(this)),H(this.b,t,"waiting",e),this.h=new at(e),ot(this.h,.25)}function Jn(t,e){0<t.a.readyState?t.a.currentTime=rr(t,e):t.m=e}function Qn(t,e){var i=t.c.presentationTimeline.T();return e>=i?i-t.l.durationBackoff:e}function Zn(t){return 0<t.a.readyState?t.a.paused?t.a.currentTime:rr(t,t.a.currentTime):tr(t)}function tr(t){if(null!=t.m)return rr(t,t.m);var e=t.c.presentationTimeline;return e=1/0>e.T()?e.ja():e.pb(),t.m=Qn(t,e),e}function er(t,e){t.f&&(t.f.cancel(),t.f=null),t.i=e,t.a.playbackRate=t.j||0>e?0:e,!t.j&&0>e&&(t.f=new at(function(){this.a.currentTime+=e/4}.bind(t)),ot(t.f,.25))}function ir(t,e){var i=Dt.bind(null,t.a.buffered),n=1*Math.max(t.c.minBufferTime||0,t.l.rebufferingGoal),r=t.c.presentationTimeline,a=r.Fa(0),s=r.va(),o=r.T(),u=r.Fa(n),h=r.Fa(5),n=r.Fa(n+5);return e>=o?Qn(t,e):e>s?s:e<a?i(h)?h:n:e>=u||i(e)?e:n}function nr(t,e,i){t.a.currentTime=i;var n=0,r=function(){!this.a||10<=n++||this.a.currentTime!=e||(this.a.currentTime=i,setTimeout(r,100))}.bind(t);setTimeout(r,100)}function rr(t,e){var i=t.c.presentationTimeline.ja();return e<i?i:(i=t.c.presentationTimeline.va(),e>i?i:e)}function ar(t,e,i,n,r,a,s){this.a=t,this.w=e,this.g=i,this.u=n,this.l=r,this.h=a,this.A=s,this.c=[],this.j=new V,this.b=!1,this.i=-1,this.f=null,or(this)}function sr(t){var e=I(t);return e.eventElement=t.eventElement,e}function or(e){ur(e),e.f=t.setTimeout(e.F.bind(e),250)}function ur(e){e.f&&(t.clearTimeout(e.f),e.f=null)}function hr(t,e){this.a=e,this.b=t,this.h=null,this.i=1,this.m=Promise.resolve(),this.g=[],this.j={},this.c={},this.s=!1,this.A=null,this.w=this.f=this.l=!1,this.u=0}function cr(t){var e=Zn(t.a.Ka);return t.b.periods[be(t.b,e)]}function lr(t){var e=t.c.video||t.c.audio;return e?t.b.periods[e.xa]:null}function fr(t){return pr(t,"audio")}function dr(t){return pr(t,"video")}function pr(t,e){var i=t.c[e];return i?i.pa||i.stream:null}function mr(t,e){t.u++,t.w=!1;var i=t.u;return t.a.L.init({text:e}),Ar(t,[e]).then(function(){if(this.u==i&&!this.c.text&&!this.w){var t=Zn(this.a.Ka);this.c.text=Er(e,be(this.b,t)),jr(this,this.c.text,0)}}.bind(t))}function yr(t,e){var i=t.c.video;if(i){var n=i.stream;if(n)if(e){var r=n.trickModeVideo;if(r){var a=i.pa;a||(gr(t,r,!1),i.pa=n)}}else(a=i.pa)&&(i.pa=null,gr(t,a,!0))}}function vr(t,e,i){e.video&&gr(t,e.video,i),e.audio&&gr(t,e.audio,i)}function gr(t,e,i){var n=t.c[e.type];if(!n&&"text"==e.type&&t.h.ignoreTextStreamFailures)mr(t,e);else if(n){var r=Te(t.b,e);i&&r!=n.xa?Tr(t):(n.pa&&(e.trickModeVideo?(n.pa=e,e=e.trickModeVideo):n.pa=null),(r=t.g[r])&&r.Oa&&(r=t.j[e.id])&&r.Oa&&n.stream!=e&&("text"==e.type&&Kt(t.a.L,Z(e.mimeType,e.codecs)),n.stream=e,n.qb=!0,i&&(n.ta?n.wb=!0:n.ya?(n.sa=!0,n.wb=!0):(Br(n),Ur(t,n,!0)))))}}function br(t){var e=Zn(t.a.Ka);Object.keys(t.c).every(function(t){var i=this.a.L;return"text"==t?(t=i.a,t=e>=t.a&&e<t.b):(t=Gt(i,t),t=Dt(t,e)),t}.bind(t))||Tr(t)}function Tr(t){for(var e in t.c){var i=t.c[e];i.ta||i.sa||(i.ya?i.sa=!0:null==qt(t.a.L,e)?null==i.ra&&jr(t,i,0):(Br(i),Ur(t,i,!1)))}}function wr(t,e,i){var n=Zn(t.a.Ka),r=be(t.b,n),a={},n=[];return e.variant&&e.variant.audio&&(a.audio=e.variant.audio,n.push(e.variant.audio)),e.variant&&e.variant.video&&(a.video=e.variant.video,n.push(e.variant.video)),e.text&&(a.text=e.text,n.push(e.text)),t.a.L.init(a),kr(t),Ar(t,n).then(function(){if(!this.f)for(var t in a){var e=a[t];this.c[t]||(this.c[t]=Er(e,r,i),jr(this,this.c[t],0))}}.bind(t))}function Er(t,e,i){return{stream:t,type:t.type,Ga:null,ka:null,pa:null,qb:!0,xa:e,endOfStream:!1,ya:!1,ra:null,sa:!1,wb:!1,ta:!1,Vb:!1,Ua:!1,Jc:i||0}}function Sr(t,e){var i=t.g[e];if(i)return i.M;i={M:new b,Oa:!1},t.g[e]=i;var n=t.b.periods[e].variants.map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),t.video&&t.video.trickModeVideo&&e.push(t.video.trickModeVideo),e}).reduce(P,[]).filter(N);return n.push.apply(n,t.b.periods[e].textStreams),t.m=t.m.then(function(){if(!this.f)return Ar(this,n)}.bind(t)).then(function(){this.f||(this.g[e].M.resolve(),this.g[e].Oa=!0)}.bind(t)).catch(function(t){this.f||(this.g[e].M.reject(),delete this.g[e],this.a.onError(t))}.bind(t)),i.M}function Ar(t,e){e.map(function(t){return t.id}).filter(N);for(var i=[],n=0;n<e.length;++n){var r=e[n],a=t.j[r.id];a?i.push(a.M):(t.j[r.id]={M:new b,Oa:!1},i.push(r.createSegmentIndex()))}return Promise.all(i).then(function(){if(!this.f)for(var t=0;t<e.length;++t){var i=this.j[e[t].id];i.Oa||(i.M.resolve(),i.Oa=!0)}}.bind(t)).catch(function(t){if(!this.f)return this.j[r.id].M.reject(),delete this.j[r.id],Promise.reject(t)}.bind(t))}function kr(t){var e=t.b.presentationTimeline.T();1/0>e?t.a.L.fa(e):t.a.L.fa(Math.pow(2,32))}function Ir(t,e){var i=Zn(t.a.Ka),n=e.Ga&&e.ka?t.b.periods[Te(t.b,e.Ga)].startTime+e.ka.endTime:Math.max(i,e.Jc),r=Te(t.b,e.stream),a=be(t.b,n),s=t.a.L,o=e.type;return"text"==o?(s=s.a,s=null==s.b||s.b<i?0:s.b-Math.max(i,s.a)):(s=Gt(s,o),s=Mt(s,i)),o=Math.max(t.i*Math.max(t.b.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal),n>=t.b.presentationTimeline.T()?(e.endOfStream=!0,null):(e.endOfStream=!1,e.xa=a,a!=r?null:s>=o?.5:(n=t.a.L,a=e.type,n="text"==a?n.a.b:Lt(Gt(n,a)),e.ka&&e.stream==e.Ga?(a=e.ka.position+1,n=_r(t,e,r,a)):(a=e.ka?e.stream.findSegmentPosition(Math.max(0,t.b.periods[Te(t.b,e.Ga)].startTime+e.ka.endTime-t.b.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.b.periods[r].startTime)),null==a?n=null:(s=null,null==n&&(s=_r(t,e,r,Math.max(0,a-1))),n=s||_r(t,e,r,a))),n?(e.Jc=0,Pr(t,e,i,r,n),null):1))}function _r(t,e,i,n){return i=t.b.periods[i],(e=e.stream.getSegmentReference(n))?(n=t.b.presentationTimeline,t=n.ja(),n=n.va(),i.startTime+e.endTime<t||i.startTime+e.startTime>n?null:e):null}function Pr(t,e,i,n,r){var a=t.b.periods[n],s=e.stream,o=t.b.presentationTimeline.T(),u=t.b.periods[n+1];n=Rr(t,e,n,a.startTime,u?u.startTime:o),e.ya=!0,e.qb=!1,o=Or(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.l)return Nr(this,e,i,a,s,r,t[1])}.bind(t)).then(function(){this.f||this.l||(e.ya=!1,e.Vb=!1,e.sa||this.a.Qb(),jr(this,e,0),Dr(this,s))}.bind(t)).catch(function(t){this.f||this.l||(e.ya=!1,"text"==e.type&&this.h.ignoreTextStreamFailures?delete this.c.text:3017==t.code?xr(this,e,t):(e.Ua=!0,t.severity=2,Fr(this,t)))}.bind(t))}function xr(t,e,i){if(!W(t.c).some(function(t){return t!=e&&t.Vb})){var n=Math.round(100*t.i);if(20<n)t.i-=.2;else{if(!(4<n))return e.Ua=!0,t.l=!0,void t.a.onError(i);t.i-=.04}e.Vb=!0}jr(t,e,4)}function Rr(t,e,i,n,r){return e.qb?(i=zt(t.a.L,e.type,t.b.periods[i].startTime-e.stream.presentationTimeOffset,n,r),e.stream.initSegmentReference?(t=Or(t,e.stream.initSegmentReference).then(function(t){if(!this.f)return Xt(this.a.L,e.type,t,null,null)}.bind(t)).catch(function(t){return e.qb=!0,Promise.reject(t)}),Promise.all([i,t])):i):Promise.resolve()}function Nr(t,e,i,n,r,a,s){return r.containsEmsgBoxes&&(new li).ba("emsg",t.de.bind(t,n,a)).parse(s),Lr(t,e,i).then(function(){if(!this.f)return Xt(this.a.L,e.type,s,a.startTime+n.startTime,a.endTime+n.startTime)}.bind(t)).then(function(){if(!this.f)return e.Ga=r,e.ka=a,Promise.resolve()}.bind(t))}function Lr(t,e,i){var n=qt(t.a.L,e.type);return null==n?Promise.resolve():(i=i-n-t.h.bufferBehind,0>=i?Promise.resolve():t.a.L.remove(e.type,n,n+i).then(function(){}.bind(t)))}function Dr(t,e){if(!t.s&&(t.s=W(t.c).every(function(t){return"text"==t.type||!t.sa&&!t.ta&&t.ka}),t.s)){var i=Te(t.b,e);for(t.g[i]||Sr(t,i).then(function(){this.a.sc()}.bind(t)).catch(x),i=0;i<t.b.periods.length;++i)Sr(t,i).catch(x);t.a.Vd&&t.a.Vd()}}function Mr(t,e){if(e.xa!=Te(t.b,e.stream)){var i=e.xa,n=W(t.c);n.every(function(t){return t.xa==i})&&n.every(Cr)&&Sr(t,i).then(function(){if(!this.f&&n.every(function(t){var e=Te(this.b,t.stream);return Cr(t)&&t.xa==i&&e!=i}.bind(this))){var t=this.b.periods[i],e=this.a.tc(t),r={};e.variant&&e.variant.video&&(r.video=e.variant.video),e.variant&&e.variant.audio&&(r.audio=e.variant.audio),e.text&&(r.text=e.text);for(var a in this.c)if(!r[a]&&"text"!=a)return void this.a.onError(new h(2,5,5005));for(a in r)if(!this.c[a]){if("text"!=a)return void this.a.onError(new h(2,5,5005));wr(this,{text:r.text},t.startTime),delete r[a]}for(a in this.c)(t=r[a])?(gr(this,t,!1),jr(this,this.c[a],0)):delete this.c[a];this.a.sc()}}.bind(t)).catch(x)}}function Cr(t){return!t.ya&&null==t.ra&&!t.sa&&!t.ta}function Or(t,e){var i=M(e.a(),t.h.retryParameters);if(e.N||null!=e.D){var n="bytes="+e.N+"-";null!=e.D&&(n+=e.D),i.headers.Range=n}return t.a.Wa.request(1,i).then(function(t){return t.data})}function Ur(t,e,i){e.sa=!1,e.wb=!1,e.ta=!0,Yt(t.a.L,e.type).then(function(){if(!this.f&&i){var t=this.a.L,n=e.type;return"text"==n?Promise.resolve():$t(t,n,t.hd.bind(t,n))}}.bind(t)).then(function(){this.f||(e.Ga=null,e.ka=null,e.ta=!1,e.endOfStream=!1,jr(this,e,0))}.bind(t))}function jr(e,i,n){i.ra=t.setTimeout(e.Ne.bind(e,i),1e3*n)}function Br(e){null!=e.ra&&(t.clearTimeout(e.ra),e.ra=null)}function Fr(t,e){w(t.A).then(function(){this.a.onError(e),e.handled||this.h.failureCallback(e)}.bind(t))}function Vr(t,e){return new Promise(function(i,n){var r=new XMLHttpRequest;r.open(e.method,t,!0),r.responseType="arraybuffer",r.timeout=e.retryParameters.timeout,r.withCredentials=e.allowCrossSiteCredentials,r.onload=function(e){e=e.target;var r=e.getAllResponseHeaders().trim().split("\r\n").reduce(function(t,e){var i=e.split(": ");return t[i[0].toLowerCase()]=i.slice(1).join(": "),t},{});if(200<=e.status&&299>=e.status&&202!=e.status)e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r,fromCache:!!r["x-shaka-from-cache"]});else{var a=null;try{a=it(e.response)}catch(t){}n(new h(401==e.status||403==e.status?2:1,1,1001,t,e.status,a,r))}},r.onerror=function(){n(new h(1,1,1002,t))},r.ontimeout=function(){n(new h(1,1,1003,t))};for(var a in e.headers)r.setRequestHeader(a,e.headers[a]);r.send(e.body)})}function Hr(t,e,i){t.openCursor().onsuccess=function(t){var n=t.target.result;n?e(n.key,n.value,function(){n.continue()}):i()}}function Kr(t,e){function i(t){return c?t:(t.close(),Promise.reject(new h(2,9,9001,"Failed to issue upgrade after "+u+" retries")))}function n(t){return c?t:(t.close(),a().then(function(){return r()}))}function r(){return qr(t,s)}function a(){return new Promise(function(t){setTimeout(t,1e3)})}function s(t,e,i){o(t,e,i),c=!0}var o=sa,u=e||0,c=!1,l=Promise.resolve().then(r);if(u){for(var f=0;f<u;f++)l=l.then(n);l=l.then(i)}return l}function qr(e,i){var n=t.indexedDB.open(e,2),r=new b;return n.onupgradeneeded=function(t){var e=t.target.transaction;i(t.oldVersion,e.db,e)},n.onsuccess=function(t){r.resolve(t.target.result)},n.onerror=function(){r.reject(new h(2,9,9001,"Failed to open indexeddb"))},r}function Gr(){}function Xr(){}function Yr(t){var e=t.periods.map(function(t){return zr(t)});return{originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,expiration:t.expiration,periods:e,sessionIds:t.sessionIds,drmInfo:t.drmInfo,appMetadata:t.appMetadata}}function zr(t){Wr(t);var e=t.streams.map(function(t){return $r(t)});return{startTime:t.startTime,streams:e}}function $r(t){var e=t.segments.map(function(t){var e=Jr(t.uri);return{startTime:t.startTime,endTime:t.endTime,dataKey:e}}),i=t.initSegmentUri?Jr(t.initSegmentUri):null;return{id:t.id,primary:t.primary,presentationTimeOffset:t.presentationTimeOffset,contentType:t.contentType,mimeType:t.mimeType,codecs:t.codecs,frameRate:t.frameRate,kind:t.kind,language:t.language,label:t.label,width:t.width,height:t.height,initSegmentKey:i,encrypted:t.encrypted,keyId:t.keyId,segments:e,variantIds:t.variantIds}}function Wr(t){var e=[];e.push.apply(e,t.streams),t=e.filter(function(t){return"audio"==t.contentType});var i=e.filter(function(t){return"video"==t.contentType}),n=[];n.push.apply(n,t),n.push.apply(n,i);var r=e.every(function(t){return null==t.variantIds});if(e.every(function(t){return null!=(t=t.variantIds)&&void 0!=t}),r){e.forEach(function(t){t.variantIds=[]});var a=0;t.length&&i.length?t.forEach(function(t){i.forEach(function(e){t.variantIds.push(a),e.variantIds.push(a),a++})}):n.forEach(function(t){t.variantIds.push(a),a++})}}function Jr(t){var e=(e=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t))?Number(e[1]):null;return null==e&&(e=(t=/^offline:segment\/([0-9]+)$/.exec(t))?Number(t[1]):null),e}function Qr(t){this.c=t,this.b=null,this.a=[]}function Zr(t,e){return ea(t,e)}function ta(t,e,i){var n;return aa(t,e,"readonly",function(t){n=t.get(i)}).then(function(){return n.result})}function ea(t,e){function i(){}return aa(t,"manifest-v2","readonly",function(t){Hr(t,function(t,i,n){e(t,i),n()},i)})}function ia(t,e,i){return aa(t,"manifest-v2","readwrite",function(t){t.put(i,e)})}function na(t,e,i){var n;return aa(t,e,"readwrite",function(t){t.add(i).onsuccess=function(t){n=t.target.result}}).then(function(){return n})}function ra(t,e,i,n){return aa(t,e,"readwrite",function(t){i.forEach(function(e){t.delete(e).onsuccess=function(){n&&n(e)}})})}function aa(t,e,i,n){var r={transaction:t.b.transaction([e],i),M:new b};return r.transaction.oncomplete=function(){t.a.splice(t.a.indexOf(r),1),r.M.resolve()},r.transaction.onabort=function(e){t.a.splice(t.a.indexOf(r),1);var i=r.transaction;r.M.reject(i.error?new h(2,9,9001,i.error):new h(2,9,9002)),e.preventDefault()},r.transaction.onerror=function(t){t.preventDefault()},e=r.transaction.objectStore(e),n(e),t.a.push(r),r.M}function sa(t,e,i){var n={0:new Gr,1:new Xr}[t];if(!n)throw new h(1,9,9001,"Attemping to upgrade from version "+t+" which is not supported. To use offline, please delete the offline storage.");n.a(e,i)}function oa(t,e,i){this.b={},this.i=[],this.h=t,this.j=e,this.m=i,this.g=this.a=null,this.f=this.c=0,this.l=[]}function ua(t,e){t.l.push(e)}function ha(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),N:i.N,D:i.D,gc:n,Wd:r})}function ca(t,e){t.c=0,t.f=0,W(t.b).forEach(function(t){t.forEach(this.s.bind(this))}.bind(t)),t.a=e;var i=W(t.b).map(function(t){var e=0,i=function(){return this.a?e>=t.length?Promise.resolve():la(this,t[e++]).then(i):Promise.reject(new h(2,9,9002))}.bind(this);return i()}.bind(t));return t.b={},t.g=Promise.all(i).then(function(){return na(this.h,"manifest-v2",e)}.bind(t)).then(function(t){return this.i=[],t}.bind(t)),t.g}function la(t,e){var i=M(e.uris,t.m);(e.N||null!=e.D)&&(i.headers.Range="bytes="+e.N+"-"+(null==e.D?"":e.D));var n;return t.j.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,na(this.h,"segment-v2",{data:t.data})):Promise.reject(new h(2,9,9002))}.bind(t)).then(function(t){if(!this.a)return Promise.reject(new h(2,9,9002));this.a.size+=n,this.f+=null==e.D?e.gc:e.D-e.N+1,this.i.push(t),e.Wd(t),fa(this)}.bind(t))}function fa(t){var e=t.c?t.f/t.c:0,i=t.a.size;t.l.forEach(function(t){t(e,i)})}function da(t){return(t=/^offline:manifest\/([0-9]+)$/.exec(t))?Number(t[1]):null}function pa(t,e,i){var n=void 0==e.expiration?1/0:e.expiration,r=e.presentationTimeline.T();return e=se(e.periods[0]),{offlineUri:null,originalManifestUri:t,duration:r,size:0,expiration:n,tracks:e,appMetadata:i}}function ma(t,e){var i=ya(e.periods[0],[],new Ki(null,0)),n=e.appMetadata||{},i=se(i);return{offlineUri:t,originalManifestUri:e.originalManifestUri,duration:e.duration,size:e.size,expiration:e.expiration,tracks:i,appMetadata:n}}function ya(t,e,i){var n=t.streams.filter(wa);return e=ga(n,t.streams.filter(Ea),e),n=t.streams.filter(Sa).map(ba),t.streams.forEach(function(t){t=t.segments.map(function(t,e){return va(e,t)}),i.Ia(0,t)}),{startTime:t.startTime,variants:e,textStreams:n}}function va(t,e){var i="offline:segment/"+e.dataKey;return new ui(t,e.startTime,e.endTime,function(){return[i]},0,null)}function ga(t,e,i){var n={},r=[];return r.push.apply(r,t),r.push.apply(r,e),r.forEach(function(t){t.variantIds.forEach(function(t){n[t]||(n[t]={id:t,language:"",primary:!1,audio:null,video:null,bandwidth:0,drmInfos:i,allowedByApplication:!0,allowedByKeySystem:!0})})}),t.forEach(function(t){var e=ba(t);t.variantIds.forEach(function(t){t=n[t],t.language=e.language,t.primary=t.primary||e.primary,t.audio=e})}),e.forEach(function(t){var e=ba(t);t.variantIds.forEach(function(t){t=n[t],t.primary=t.primary||e.primary,t.video=e})}),W(n)}function ba(t){var e=t.segments.map(function(t,e){return va(e,t)}),e=new gi(e),e={id:t.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:e.find.bind(e),getSegmentReference:e.get.bind(e),initSegmentReference:null,presentationTimeOffset:t.presentationTimeOffset,mimeType:t.mimeType,codecs:t.codecs,width:t.width||void 0,height:t.height||void 0,frameRate:t.frameRate||void 0,kind:t.kind,encrypted:t.encrypted,keyId:t.keyId,language:t.language,label:t.label||null,type:t.contentType,primary:t.primary,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null};return null!=t.initSegmentKey&&(e.initSegmentReference=Ta(t.initSegmentKey)),e}function Ta(t){var e="offline:segment/"+t;return new oi(function(){return[e]},0,null)}function wa(t){return"audio"==t.contentType}function Ea(t){return"video"==t.contentType}function Sa(t){return"text"==t.contentType}function Aa(){if(!t.indexedDB)return Promise.reject(new h(2,9,9e3));var e=new Qr("shaka_offline_db");return e.init().then(function(){return e})}function ka(){this.a=-1}function Ia(t){var e=new Ki(null,0);e.fa(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:2,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return ya(t,i,e)})}}function _a(t){if(null!=da(t))return _a.a(t);var e=(e=/^offline:segment\/([0-9]+)$/.exec(t))?Number(e[1]):null;return null!=e?_a.b(e,t):Promise.reject(new h(2,1,9004,t))}function Pa(t){this.a=null;for(var e=0;e<t.textTracks.length;++e){var i=t.textTracks[e];i.mode="disabled","Shaka Player TextTrack"==i.label&&(this.a=i)}this.a||(this.a=t.addTextTrack("subtitles","Shaka Player TextTrack")),this.a.mode="hidden",this.b=this.a.cues}function xa(t){if(t.startTime>=t.endTime)return null;var e=new VTTCue(t.startTime,t.endTime,t.payload);e.lineAlign=t.lineAlign,e.positionAlign=t.positionAlign,e.size=t.size;try{e.align=t.textAlign}catch(t){}return"center"==t.textAlign&&"center"!=e.align&&(e.align="middle"),t.writingDirection==Mu?e.vertical="lr":t.writingDirection==Cu&&(e.vertical="rl"),t.lineInterpretation==Uu&&(e.snapToLines=!1),null!=t.line&&(e.line=t.line),null!=t.position&&(e.position=t.position),e}function Ra(t,e){for(var i=t.b,n=[],r=0;r<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.a.removeCue(n[r])}function Na(){this.a=Promise.resolve(),this.b=this.c=this.f=!1,this.i=new Promise(function(t){this.g=t}.bind(this)),this.l=[],this.j=[]}function La(t){return t.f||(t.a=t.a.then(function(t){return this.c=!0,this.l.forEach(function(t){t()}),Promise.resolve(t)}.bind(t),function(t){return this.c=!0,this.b?(this.g(),Promise.reject(this.h)):Promise.reject(t)}.bind(t))),t.f=!0,t.a}function Da(t,e){Re.call(this),this.F=!1,this.f=t,this.lb=!1,this.u=null,this.m=new V,this.h=this.yb=this.b=this.i=this.a=this.w=this.g=this.ib=this.J=this.K=this.l=this.s=null,this.Yc=1e9,this.gb=[],this.kb=!1,this.Ca=!0,this.Sa=this.Ta=this.ha=null,this.fc=!1,this.W=null,this.jb=[],this.A={},this.c=Ga(this),this.hb={width:1/0,height:1/0},this.j=Xa(),this.fb=0,this.Qa=this.c.preferredAudioLanguage,this.Ra=this.c.preferredTextLanguage,this.bb=this.cb="",e&&e(this),this.s=new L(this.Fe.bind(this)),this.ib=Oa(this),H(this.m,this.f,"error",this.Yd.bind(this))}function Ma(t){if(!t.ha)return Promise.resolve();var e=Promise.resolve();return t.i&&(e=t.i.stop(),t.i=null),t=t.ha.cancel(new h(2,7,7e3)),Promise.all([e,t])}function Ca(t){function e(t){return(t.video?t.video.codecs.split(".")[0]:"")+"-"+(t.audio?t.audio.codecs.split(".")[0]:"")}var i={};t.b.periods.forEach(function(t){t.variants.forEach(function(t){var n=e(t);n in i||(i[n]=[]),i[n].push(t)})});var n=null,r=1/0;Q(i,function(t,e){var i=0,a=0;e.forEach(function(t){i+=t.bandwidth||0,++a});var s=i/a;s<r&&(n=t,r=s)}),t.b.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return e(t)==n})})}function Oa(e){e.K=new MediaSource;var i=new b;return H(e.m,e.K,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.K),i}function Ua(t){if(t.i&&t.i.configure(t.c.manifest),t.l&&t.l.configure(t.c.drm),t.a){t.a.configure(t.c.streaming);try{t.b.periods.forEach(t.mb.bind(t))}catch(e){t.Pa(e)}var e=fr(t.a),i=dr(t.a),n=cr(t.a);(e=ve(e,i,n.variants))&&e.allowedByApplication&&e.allowedByKeySystem||Ja(t,n)}t.h&&(t.h.configure(t.c.abr),t.c.abr.enabled&&!t.Ca?t.h.enable():t.h.disable())}function ja(t){var e=[];return t.forEach(function(t){if(t){var i=t.language;t.roles.length?t.roles.forEach(function(t){e.push({language:i,sb:t})}):e.push({language:i,sb:""})}else e.push({language:"und",sb:""})}),O(e,function(t,e){return t.language==e.language&&t.sb==e.sb})}function Ba(t,e,i){e.video&&Va(t,e.video),e.audio&&Va(t,e.audio);var n=lr(t.a);e!=ve(fr(t.a),dr(t.a),n?n.variants:[])&&t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"variant",fromAdaptation:i,bandwidth:e.bandwidth})}function Fa(t,e,i){Va(t,e),t.j.switchHistory.push({timestamp:Date.now()/1e3,id:e.id,type:"text",fromAdaptation:i,bandwidth:null})}function Va(t,e){var i=Te(t.b,e);t.A[i]||(t.A[i]={}),t.A[i][e.type]=e.id}function Ha(t){t.m&&(t.m.ga(t.K,"sourceopen"),t.m.ga(t.f,"loadeddata"),t.m.ga(t.f,"playing"),t.m.ga(t.f,"pause"),t.m.ga(t.f,"ended")),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.h?t.h.stop():null,t.l?t.l.destroy():null,t.J?t.J.destroy():null,t.g?t.g.destroy():null,t.w?t.w.destroy():null,t.a?t.a.destroy():null,t.i?t.i.stop():null,t.u?t.u.destroy():null]);return t.l=null,t.J=null,t.g=null,t.w=null,t.a=null,t.i=null,t.u=null,t.b=null,t.yb=null,t.ib=null,t.K=null,t.jb=[],t.A={},t.j=Xa(),e}function Ka(t){return t.i?Ha(t).then(function(){this.F||(this.Rc(!1),this.ib=Oa(this))}.bind(t)):Promise.resolve()}function qa(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:new Uint8Array(0)}}}function Ga(t){var e=5e5;return navigator.connection&&navigator.connection.type&&(e=1e6*navigator.connection.downlink),{drm:{retryParameters:E(),servers:{},clearKeys:{},advanced:{},delayLicenseRequestUntilPlayed:!1},manifest:{retryParameters:E(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:"",ignoreDrmInfo:!1,xlinkFailGracefully:!1}},streaming:{retryParameters:E(),failureCallback:t.ed.bind(t),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,startAtSegmentBoundary:!1,smallGapLimit:.5,jumpLargeGaps:!1,durationBackoff:1},abrFactory:we,textDisplayFactory:function(t){return new Pa(t)}.bind(null,t.f),abr:{enabled:!0,defaultBandwidthEstimate:e,switchInterval:8,bandwidthUpgradeTarget:.85,bandwidthDowngradeTarget:.95,restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0}},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minBandwidth:0,maxBandwidth:1/0},playRangeStart:0,playRangeEnd:1/0}}function Xa(){return{width:NaN,height:NaN,streamBandwidth:NaN,decodedFrames:NaN,droppedFrames:NaN,estimatedBandwidth:NaN,loadLatency:NaN,playTime:0,bufferingTime:0,switchHistory:[],stateHistory:[]}}function Ya(t,e,i){t.Ca?(t.Sa=e,t.fc=i||!1):vr(t.a,e,i||!1)}function za(t){if(t.b){var e=Date.now()/1e3;t.kb?t.j.bufferingTime+=e-t.fb:t.j.playTime+=e-t.fb,t.fb=e}}function $a(t,e){function i(t,e){if(!t)return null;var i=t.findSegmentPosition(e-a.startTime);return null==i?null:(i=t.getSegmentReference(i))?i.startTime+a.startTime:null}var n=fr(t.a),r=dr(t.a),a=cr(t.a),n=i(n,e),r=i(r,e);return null!=r&&null!=n?Math.max(r,n):null!=r?r:null!=n?n:e}function Wa(t,e){return e&&e.length?(t.h.setVariants(e),t.h.chooseVariant()):(t.Pa(new h(2,4,4012)),null)}function Ja(t,e){var i=de(e,t.Qa,t.cb),n=pe(e,t.Ra,t.bb);(i=Wa(t,i))&&(Ba(t,i,!0),Ya(t,i,!0)),(n=n[0])&&t.Ib()&&(Fa(t,n,!0),t.Ca?t.W=n:gr(t.a,n,!0)),Qa(t)}function Qa(t){Promise.resolve().then(function(){this.F||this.dispatchEvent(new X("adaptation"))}.bind(t))}function Za(t){Promise.resolve().then(function(){this.F||this.dispatchEvent(new X("trackschanged"))}.bind(t))}function ts(t){t.dispatchEvent(new X("texttrackvisibility"))}function es(t){if(!t||t.constructor!=Da)throw new h(2,9,9008);this.g=null,this.a=t,this.b=os(this),this.f=null,this.l=!1,this.c=this.s=this.h=this.i=null}function is(){return!!t.indexedDB}function ns(t,e,i,n,r){if(i.presentationTimeline.P()||i.presentationTimeline.wa())throw new h(2,9,9005,e);t.h=i,t.f=r,t.j(i.periods),t.s=pa(e,i,n);var a=ls(t,e,n);return ca(t.c,a).then(function(t){return ma("offline:manifest/"+t,a)})}function rs(t,e){function i(t){6013!=t.code&&(s=t)}var n=da(e);if(null==n)return Promise.reject(new h(2,9,9004,e));var r,a,s=null;return us(t).then(function(){return ps(this),this.g.Ea(n)}.bind(t)).then(function(t){if(ps(this),!t)throw new h(2,9,9003,e);return r=t,t=Ia(r),a=new pt({Wa:this.a.s,onError:i,Pb:function(){},onExpirationUpdated:function(){},onEvent:function(){}}),a.configure(this.a.getConfiguration().drm),a.init(t,this.b.usePersistentLicense||!1)}.bind(t)).then(function(){return yt(a,r.sessionIds)}.bind(t)).then(function(){return a.destroy()}.bind(t)).then(function(){if(ps(this),s)throw s;return as(this,e,n,r)}.bind(t))}function as(t,e,i,n){function r(){u++,a(s,u/h)}var a=t.b.progressCallback,s=ma(e,n),o=ms(n),u=0,h=o.length+1;return Promise.resolve().then(function(){return ps(this),ra(this.g,"segment-v2",o,r)}.bind(t)).then(function(){return ps(this),ra(this.g,"manifest-v2",[i],r)}.bind(t))}function ss(t,e,i,n){function r(){}var a,s,o,u=t.a.s,h=t.a.getConfiguration();return Hi(e,u,h.manifest.retryParameters,n).then(function(t){return ps(this),o=new t,o.configure(h.manifest),o.start(e,{networkingEngine:u,filterAllPeriods:this.j.bind(this),filterNewPeriod:this.m.bind(this),onTimelineRegionAdded:function(){},onEvent:function(){},onError:i})}.bind(t)).then(function(t){return ps(this),a=t,s=new pt({Wa:u,onError:i,Pb:r,onExpirationUpdated:function(){},onEvent:function(){}}),s.configure(h.drm),s.init(a,this.b.usePersistentLicense||!1)}.bind(t)).then(function(){return ps(this),cs(a)}.bind(t)).then(function(){return ps(this),vt(s)}.bind(t)).then(function(){return ps(this),o.stop()}.bind(t)).then(function(){return ps(this),{manifest:a,fd:s}}.bind(t)).catch(function(t){if(o)return o.stop().then(function(){throw t});throw t})}function os(t){return{trackSelectionCallback:t.u.bind(t),progressCallback:function(t,e){if(t||e)return null},usePersistentLicense:!0}}function us(e){if(!t.indexedDB)return Promise.reject(new h(2,9,9e3));if(e.g)return Promise.resolve();var i=e.a.s,n=e.a.getConfiguration().streaming.retryParameters;return Aa().then(function(t){this.g=t,this.c=new oa(t,i,n),ua(this.c,function(t,e){var i=this.s;i.size=e,this.b.progressCallback(i,t)}.bind(this))}.bind(e))}function hs(t){var e=t.f?t.f.destroy():Promise.resolve();return t.f=null,t.h=null,t.l=!1,t.i=null,e}function cs(t){var e=t.periods.map(function(t){return t.variants}).reduce(P,[]).map(function(t){var e=[];return t.audio&&e.push(t.audio),t.video&&e.push(t.video),e}).reduce(P,[]).filter(N);return t=t.periods.map(function(t){return t.textStreams}).reduce(P,[]),e.push.apply(e,t),Promise.all(e.map(function(t){return t.createSegmentIndex()}))}function ls(t,e,i){var n=t.h.periods.map(t.w.bind(t)),r=t.f.b,a=gt(t.f);if(r&&t.b.usePersistentLicense){if(!a.length)throw new h(2,9,9007,e);r.initData=[]}return{originalManifestUri:e,duration:t.h.presentationTimeline.T(),size:0,expiration:t.f.ob(),periods:n,sessionIds:t.b.usePersistentLicense?a:[],drmInfo:r,appMetadata:i}}function fs(t,e,i,n){var r={id:e.id,primary:e.primary,presentationTimeOffset:e.presentationTimeOffset||0,contentType:e.type,mimeType:e.mimeType,codecs:e.codecs,frameRate:e.frameRate,kind:e.kind,language:e.language,label:e.label,width:e.width||null,height:e.height||null,initSegmentKey:null,encrypted:e.encrypted,keyId:e.keyId,segments:[],variantIds:[]};return null!=n&&r.variantIds.push(n),n=t.h.presentationTimeline.ja(),ds(e,n,function(t){var n=t.startTime,a=t.endTime;ha(this.c,e.type,t,(a-n)*i/8,function(t){r.segments.push({startTime:n,endTime:a,dataKey:t})})}.bind(t)),(n=e.initSegmentReference)&&ha(t.c,e.contentType,n,0,function(t){r.initSegmentKey=t}),r}function ds(t,e,i){e=t.findSegmentPosition(e);for(var n=null==e?null:t.getSegmentReference(e);n;)i(n),n=t.getSegmentReference(++e)}function ps(t){if(!t.a)throw new h(2,9,9002)}function ms(t){var e=[];return t.periods.forEach(function(t){t.streams.forEach(function(t){null!=t.initSegmentKey&&e.push(t.initSegmentKey),t.segments.forEach(function(t){e.push(t.dataKey)})})}),e}function ys(t){Tu.push(t)}function vs(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase();if("function"==typeof Event)var i=new Event(e,t);else i=document.createEvent("Event"),i.initEvent(e,t.bubbles,t.cancelable);t.target.dispatchEvent(i)}function gs(t,e,i){if("input"==t)switch(this.type){case"range":t="change"}wu.call(this,t,e,i)}function bs(t){this.f=[],this.b=[],this.a=[],(new li).ba("pssh",this.c.bind(this)).parse(t.buffer)}function Ts(t,e){try{var i=new ws(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function ws(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],a={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},s=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){s=!0;var h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(s=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(a.videoCapabilities.push(u),i=!0));if(s||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(i=!1),i)return void(this.a=a)}throw r=Error("Unsupported keySystem"),r.name="NotSupportedError",r.code=DOMException.NOT_SUPPORTED_ERR,r}function Es(t){var e=this.mediaKeys;return e&&e!=t&&As(e,null),delete this.mediaKeys,(this.mediaKeys=t)?As(t,this):Promise.resolve()}function Ss(t){this.a=new MSMediaKeys(t),this.b=new V}function As(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(q(t.b),!e)return Promise.resolve();H(t.b,e,"msneedkey",Is);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(t){return Promise.reject(t)}}function ks(t){Re.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new V,this.sessionId="",this.expiration=NaN,this.closed=new b,this.keyStatuses=new xs}function Is(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc";var i=t.initData;if(i){var n=new bs(i);if(1>=n.a.length)t=i;else{var r=[];for(t=0;t<n.a.length;t++)r.push(i.subarray(n.a[t].start,n.a[t].end+1));for(i=O(r,_s),t=n=0;t<i.length;t++)n+=i[t].length;for(n=new Uint8Array(n),t=r=0;t<i.length;t++)n.set(i[t],r),r+=i[t].length;t=n}}else t=i;e.initData=t,this.dispatchEvent(e)}function _s(t,e){return ft(t,e)}function Ps(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new X("keystatuseschange"))}function xs(){this.size=0,this.a=void 0}function Rs(){return Promise.reject(Error("The key system specified is not supported."))}function Ns(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function Ls(){throw new TypeError("Illegal constructor.")}function Ds(){throw new TypeError("Illegal constructor.")}function Ms(e){Su=e,Au=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=Os,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Us,t.MediaKeys=Bs,t.MediaKeySystemAccess=js}function Cs(t){var e=Su;return e?e+t.charAt(0).toUpperCase()+t.slice(1):t}function Os(t,e){try{var i=new js(t,e);return Promise.resolve(i)}catch(t){return Promise.reject(t)}}function Us(t){var e=this.mediaKeys;return e&&e!=t&&Fs(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&Fs(t,this),Promise.resolve()}function js(t,e){this.a=this.keySystem=t;var i=!1;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);for(var n=!1,r=document.getElementsByTagName("video"),a=r.length?r[0]:document.createElement("video"),s=0;s<e.length;++s){r=e[s];var o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},u=!1;if(r.audioCapabilities)for(var h=0;h<r.audioCapabilities.length;++h){var c=r.audioCapabilities[h];if(c.contentType){var u=!0,l=c.contentType.split(";")[0];a.canPlayType(l,this.a)&&(o.audioCapabilities.push(c),n=!0)}}if(r.videoCapabilities)for(h=0;h<r.videoCapabilities.length;++h)c=r.videoCapabilities[h],c.contentType&&(u=!0,a.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),n=!0));if(u||(n=a.canPlayType("video/mp4",this.a)||a.canPlayType("video/webm",this.a)),"required"==r.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):n=!1),n)return void(this.b=o)}throw i="Unsupported keySystem","org.w3.clearkey"!=t&&"com.widevine.alpha"!=t||(i="None of the requested configurations were supported."),i=Error(i),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function Bs(t){this.g=t,this.b=null,this.a=new V,this.c=[],this.f={}}function Fs(t,e){t.b=e,q(t.a);var i=Su;e&&(H(t.a,e,i+"needkey",t.be.bind(t)),H(t.a,e,i+"keymessage",t.ae.bind(t)),H(t.a,e,i+"keyadded",t.Zd.bind(t)),H(t.a,e,i+"keyerror",t.$d.bind(t)))}function Vs(t,e){var i=t.f[e];return i||((i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null)}function Hs(t,e,i){Re.call(this),this.f=t,this.h=!1,this.a=this.b=null,this.c=e,this.g=i,this.sessionId="",this.expiration=NaN,this.closed=new b,this.keyStatuses=new Gs}function Ks(t,e,i){if(t.h)return Promise.reject(Error("The session is already initialized."));t.h=!0;try{if("persistent-license"==t.g)if(i)var n=new Uint8Array(nt("LOAD_SESSION|"+i));else{var r=nt("PERSISTENT|"),a=new Uint8Array(r.byteLength+e.byteLength);a.set(new Uint8Array(r),0),a.set(new Uint8Array(e),r.byteLength),n=a}else n=new Uint8Array(e)}catch(t){return Promise.reject(t)}t.b=new b;var s=Cs("generateKeyRequest");try{t.f[s](t.c,n)}catch(e){if("InvalidStateError"!=e.name)return t.b=null,Promise.reject(e);setTimeout(function(){try{this.f[s](this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function qs(t,e){var i=t.keyStatuses;i.size=void 0==e?0:1,i.a=e,t.dispatchEvent(new X("keystatuseschange"))}function Gs(){this.size=0,this.a=void 0}function Xs(){var t=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var e=t.apply(this,arguments);return e.abort=function(){},e}}function Ys(){var t=SourceBuffer.prototype.remove;SourceBuffer.prototype.remove=function(e,i){return t.call(this,e,i-.001)}}function zs(){var t=MediaSource.prototype.endOfStream;MediaSource.prototype.endOfStream=function(){for(var e,i=0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e=e.buffered.end(e.buffered.length-1),i=Math.max(i,e);if(!isNaN(this.duration)&&i<this.duration)for(this.pc=!0,n=0;n<this.sourceBuffers.length;++n)e=this.sourceBuffers[n],e.jc=!1;return t.apply(this,arguments)};var e=!1,i=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=i.apply(this,arguments);return t.mediaSource_=this,t.addEventListener("updateend",$s,!1),e||(this.addEventListener("sourceclose",Ws,!1),e=!0),t}}function $s(t){var e=t.target,i=e.mediaSource_;if(i.pc){for(t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),e.jc=!0,t=0;t<i.sourceBuffers.length;++t)if(0==i.sourceBuffers[t].jc)return;i.pc=!1}}function Ws(t){t=t.target;for(var e=0;e<t.sourceBuffers.length;++e)t.sourceBuffers[e].removeEventListener("updateend",$s,!1);t.removeEventListener("sourceclose",Ws,!1)}function Js(){var t=MediaSource.isTypeSupported;MediaSource.isTypeSupported=function(e){return"mp2t"!=e.split(/ *; */)[0].split("/")[1]&&t(e)}}function Qs(){var t=MediaSource.isTypeSupported,e=/^dv(?:he|av)\./;MediaSource.isTypeSupported=function(i){for(var n,r,a=i.split(/ *; */),s=a[0],o={},u=1;u<a.length;++u)n=a[u].split("="),r=n[0],n=n[1].replace(/"(.*)"/,"$1"),o[r]=n;if(!(n=o.codecs))return t(i);var h=!1,c=!1;i=n.split(",").filter(function(t){return e.test(t)?(c=!0,!1):(/^(hev|hvc)1\.2/.test(t)&&(h=!0),!0)}),c&&(h=!1),o.codecs=i.join(","),h&&(o.eotf="smpte2084");for(r in o)n=o[r],s+="; "+r+'="'+n+'"';return cast.__platform__.canDisplayType(s)}}function Zs(t){if(this.c=[],this.b=[],this.Aa=ku,t)try{t(this.la.bind(this),this.a.bind(this))}catch(t){this.a(t)}}function to(t){var e=new Zs;return e.la(void 0),e.then(function(){return t})}function eo(t){var e=new Zs;return e.a(t),e}function io(t){function e(t,e,i){t.Aa==ku&&(r[e]=i,++n==r.length&&t.la(r))}var i=new Zs;if(!t.length)return i.la([]),i;for(var n=0,r=Array(t.length),a=i.a.bind(i),s=0;s<t.length;++s)t[s]&&t[s].then?t[s].then(e.bind(null,i,s),a):e(i,s,t[s]);return i}function no(t){for(var e=new Zs,i=e.la.bind(e),n=e.a.bind(e),r=0;r<t.length;++r)t[r]&&t[r].then?t[r].then(i,n):i(t[r]);return e}function ro(t,e,i){_u.push(function(){if(i&&"function"==typeof i){try{var t=i(this.f)}catch(t){return void e.a(t)}try{var n=t&&t.then}catch(t){return void e.a(t)}t instanceof Zs?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.la.bind(e),e.a.bind(e)):n?ao(t,n,e):e.la(t)}else 1==this.Aa?e.la(this.f):e.a(this.f)}.bind(t)),null==Iu&&(Iu=oo(so))}function ao(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;try{var e=t&&t.then}catch(t){return void i.a(t)}e?ao(t,e,i):i.la(t)}},i.a.bind(i))}catch(t){i.a(t)}}function so(){for(;_u.length;){null!=Iu&&(uo(Iu),Iu=null);var t=_u;_u=[];for(var e=0;e<t.length;++e)t[e]()}}function oo(){return 0}function uo(){}function ho(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}function co(e,i,n){return new t.TextTrackCue(e,i,n)}function lo(e,i,n){return new t.TextTrackCue(e+"-"+i+"-"+n,e,i,n)}function fo(t,e,i){this.startTime=t,this.endTime=e,this.payload=i,this.region={x:0,y:0,width:100,height:100},this.position=null,this.positionAlign=Pu,this.size=100,this.textAlign=xu,this.writingDirection=Du,this.lineInterpretation=Ou,this.line=null,this.lineHeight="",this.lineAlign=ju,this.displayAlign=Nu,this.fontSize=this.backgroundColor=this.color="",this.fontWeight=Fu,this.fontStyle=Vu,this.fontFamily="",this.textDecoration=[],this.wrapLine=!0,this.id=""}function po(){}function mo(t){var e=[];if(!t)return e;for(var i=t.childNodes,n=0;n<i.length;n++){var r="span"==i[n].nodeName&&"p"==t.nodeName;i[n].nodeType!=Node.ELEMENT_NODE||"br"==i[n].nodeName||r||(r=mo(i[n]),e=e.concat(r))}return e.length||e.push(t),e}function yo(t,e){for(var i=t.childNodes,n=0;n<i.length;n++)if("br"==i[n].nodeName&&0<n)i[n-1].textContent+="\n";else if(0<i[n].childNodes.length)yo(i[n],e);else if(e){var r=i[n].textContent.trim(),r=r.replace(/\s+/g," ");i[n].textContent=r}}function vo(t,e){for(var i=e.split(" "),n=0;n<i.length;n++)switch(i[n]){case"underline":0>t.textDecoration.indexOf("underline")&&t.textDecoration.push("underline");break;case"noUnderline":0<=t.textDecoration.indexOf("underline")&&j(t.textDecoration,"underline");break;case"lineThrough":0>t.textDecoration.indexOf("lineThrough")&&t.textDecoration.push("lineThrough");break;case"noLineThrough":0<=t.textDecoration.indexOf("lineThrough")&&j(t.textDecoration,"lineThrough");break;case"overline":0>t.textDecoration.indexOf("overline")&&t.textDecoration.push("overline");break;case"noOverline":0<=t.textDecoration.indexOf("overline")&&j(t.textDecoration,"overline")}}function go(t,e,i,n){return(t=To(t,i,n))?t:bo(e,i,n)}function bo(t,e,i){for(var n=mo(t),r=0;r<n.length;r++){var a=n[r].getAttribute(i);if(a)return a}return(t=wo(t,"style",e))?t.getAttribute(i):null}function To(t,e,i){return(t=wo(t,"style",e))?t.getAttribute(i):null}function wo(t,e,i){if(!t||1>i.length)return null;var n=null,r=t;for(t=null;r&&!(t=r.getAttribute(e))&&(r=r.parentNode)instanceof Element;);if(e=t)for(t=0;t<i.length;t++)if(i[t].getAttribute("xml:id")==e){n=i[t];break}return n}function Eo(t,e){var i=null;if(Ku.test(t))var i=Ku.exec(t),n=Number(i[1]),r=Number(i[2]),a=Number(i[3]),s=Number(i[4]),s=s+(Number(i[5])||0)/e.b,a=a+s/e.frameRate,i=a+60*r+3600*n;else qu.test(t)?i=So(qu,t):Gu.test(t)?i=So(Gu,t):Xu.test(t)?(i=Xu.exec(t),i=Number(i[1])/e.frameRate):Yu.test(t)?(i=Yu.exec(t),i=Number(i[1])/e.a):zu.test(t)&&(i=So(zu,t));return i}function So(t,e){var i=t.exec(e);return i&&""!=i[0]?(Number(i[4])||0)/1e3+(Number(i[3])||0)+60*(Number(i[2])||0)+3600*(Number(i[1])||0):null}function Ao(t,e,i,n){this.frameRate=Number(t)||30,this.b=Number(e)||1,this.a=Number(n),this.a||(this.a=t?this.frameRate*this.b:1),i&&(t=/^(\d+) (\d+)$/g.exec(i))&&(this.frameRate*=t[1]/t[2])}function ko(){this.a=new po}function Io(){}function _o(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(i=i[1],t.textAlign="middle"==i?xu:Ru[i.toUpperCase()]):(i=/^vertical:(lr|rl)$/.exec(e))?t.writingDirection="lr"==i[1]?Mu:Cu:(i=/^size:([\d\.]+)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:([\d\.]+)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(i=i[2],t.positionAlign="line-left"==i||"start"==i?"line-left":"line-right"==i||"end"==i?"line-right":"center")):(i=/^line:([\d\.]+)%(?:,(start|end|center))?$/.exec(e))?(t.lineInterpretation=Uu,t.line=Number(i[1]),i[2]&&(t.lineAlign=Bu[i[2].toUpperCase()])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.lineInterpretation=Ou,t.line=Number(i[1]),i[2]&&(t.lineAlign=Bu[i[2].toUpperCase()]))}function Po(t){if(!(t=yn(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g)))return null;var e=Number(t[2]),i=Number(t[3]);return 59<e||59<i?null:Number(t[4])/1e3+i+60*e+3600*(Number(t[1])||0)}function xo(){this.a=null}function Ro(t,e,i){var n,r,a;return(new li).C("payl",pi(function(t){n=tt(t)})).C("iden",pi(function(t){r=tt(t)})).C("sttg",pi(function(t){a=tt(t)})).parse(t),n?No(n,r,a,e,i):null}function No(t,e,i,n,r){if(t=new fo(n,r,t),e&&(t.id=e),i)for(e=new mn(i),i=vn(e);i;)_o(t,i),yn(e,/[ \t]+/gm),i=vn(e);return t}var Lo,Do=this;Do.$e=!0,s.prototype.getBandwidthEstimate=function(t){return 128e3>this.a?t:Math.min(a(this.b),a(this.c))},t.console&&t.console.log.bind&&(o=console.warn.bind(console)),e("shaka.util.Error",h),h.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},h.Severity={RECOVERABLE:1,CRITICAL:2},h.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},h.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,REQUEST_FILTER_ERROR:1006,RESPONSE_FILTER_ERROR:1007,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_MP4_TTML:2007,INVALID_MP4_VTT:2008,UNABLE_TO_EXTRACT_CUE_START_TIME:2009,BUFFER_READ_OUT_OF_BOUNDS:3e3,JS_INTEGER_OVERFLOW:3001,EBML_OVERFLOW:3002,EBML_BAD_FLOATING_POINT_SIZE:3003,MP4_SIDX_WRONG_BOX_TYPE:3004,MP4_SIDX_INVALID_TIMESCALE:3005,MP4_SIDX_TYPE_NOT_SUPPORTED:3006,WEBM_CUES_ELEMENT_MISSING:3007,WEBM_EBML_HEADER_ELEMENT_MISSING:3008,WEBM_SEGMENT_ELEMENT_MISSING:3009,WEBM_INFO_ELEMENT_MISSING:3010,WEBM_DURATION_ELEMENT_MISSING:3011,WEBM_CUE_TRACK_POSITIONS_ELEMENT_MISSING:3012,WEBM_CUE_TIME_ELEMENT_MISSING:3013,MEDIA_SOURCE_OPERATION_FAILED:3014,MEDIA_SOURCE_OPERATION_THREW:3015,VIDEO_ERROR:3016,QUOTA_EXCEEDED_ERROR:3017,UNABLE_TO_GUESS_MANIFEST_TYPE:4e3,DASH_INVALID_XML:4001,DASH_NO_SEGMENT_INFO:4002,DASH_EMPTY_ADAPTATION_SET:4003,DASH_EMPTY_PERIOD:4004,DASH_WEBM_MISSING_INIT:4005,DASH_UNSUPPORTED_CONTAINER:4006,DASH_PSSH_BAD_ENCODING:4007,DASH_NO_COMMON_KEY_SYSTEM:4008,DASH_MULTIPLE_KEY_IDS_NOT_SUPPORTED:4009,DASH_CONFLICTING_KEY_IDS:4010,UNPLAYABLE_PERIOD:4011,RESTRICTIONS_CANNOT_BE_MET:4012,NO_PERIODS:4014,HLS_PLAYLIST_HEADER_MISSING:4015,INVALID_HLS_TAG:4016,HLS_INVALID_PLAYLIST_HIERARCHY:4017,DASH_DUPLICATE_REPRESENTATION_ID:4018,HLS_MULTIPLE_MEDIA_INIT_SECTIONS_FOUND:4020,HLS_COULD_NOT_GUESS_MIME_TYPE:4021,HLS_MASTER_PLAYLIST_NOT_PROVIDED:4022,HLS_REQUIRED_ATTRIBUTE_MISSING:4023,HLS_REQUIRED_TAG_MISSING:4024,HLS_COULD_NOT_GUESS_CODECS:4025,HLS_KEYFORMATS_NOT_SUPPORTED:4026,DASH_UNSUPPORTED_XLINK_ACTUATE:4027,DASH_XLINK_DEPTH_LIMIT:4028,HLS_COULD_NOT_PARSE_SEGMENT_START_TIME:4030,INVALID_STREAMS_CHOSEN:5005,NO_RECOGNIZED_KEY_SYSTEMS:6e3,REQUESTED_KEY_SYSTEM_CONFIG_UNAVAILABLE:6001,FAILED_TO_CREATE_CDM:6002,FAILED_TO_ATTACH_TO_VIDEO:6003,INVALID_SERVER_CERTIFICATE:6004,FAILED_TO_CREATE_SESSION:6005,FAILED_TO_GENERATE_LICENSE_REQUEST:6006,LICENSE_REQUEST_FAILED:6007,LICENSE_RESPONSE_REJECTED:6008,ENCRYPTED_CONTENT_WITHOUT_DRM_INFO:6010,NO_LICENSE_SERVER_GIVEN:6012,OFFLINE_SESSION_REMOVED:6013,EXPIRED:6014,LOAD_INTERRUPTED:7e3,CAST_API_UNAVAILABLE:8e3,NO_CAST_RECEIVERS:8001,ALREADY_CASTING:8002,UNEXPECTED_CAST_ERROR:8003,CAST_CANCELED_BY_USER:8004,CAST_CONNECTION_TIMED_OUT:8005,CAST_RECEIVER_APP_UNAVAILABLE:8006,STORAGE_NOT_SUPPORTED:9e3,INDEXED_DB_ERROR:9001,OPERATION_ABORTED:9002,REQUESTED_ITEM_NOT_FOUND:9003,MALFORMED_OFFLINE_URI:9004,CANNOT_STORE_LIVE_OFFLINE:9005,STORE_ALREADY_IN_PROGRESS:9006,NO_INIT_DATA_FOR_OFFLINE:9007,LOCAL_PLAYER_INSTANCE_REQUIRED:9008,CONTENT_UNSUPPORTED_BY_BROWSER:9009,UNSUPPORTED_UPGRADE_REQUEST:9010};var Mo=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;Lo=c.prototype,Lo.da="",Lo.Ba="",Lo.ia="",Lo.La=null,Lo.Y="",Lo.ua="",Lo.toString=function(){var t=[],e=this.da;if(e&&t.push(m(e,Co,!0),":"),e=this.ia){t.push("//");var i=this.Ba;i&&t.push(m(i,Co,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.La,null!=e&&t.push(":",String(e))}return(e=this.Y)&&(this.ia&&"/"!=e.charAt(0)&&t.push("/"),t.push(m(e,"/"==e.charAt(0)?Uo:Oo,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ua)&&t.push("#",m(e,Bo)),t.join("")},Lo.resolve=function(t){var e=new c(this);"data"===e.da&&(e=new c);var i=!!t.da;i?l(e,t.da):i=!!t.Ba,i?e.Ba=t.Ba:i=!!t.ia,i?e.ia=t.ia:i=null!=t.La;var n=t.Y;if(i)f(e,t.La);else if(i=!!t.Y){if("/"!=n.charAt(0))if(this.ia&&!this.Y)n="/"+n;else{var r=e.Y.lastIndexOf("/");-1!=r&&(n=e.Y.substr(0,r+1)+n)}if(".."==n||"."==n)n="";else if(-1!=n.indexOf("./")||-1!=n.indexOf("/.")){for(var r=!n.lastIndexOf("/",0),n=n.split("/"),a=[],s=0;s<n.length;){var o=n[s++];"."==o?r&&s==n.length&&a.push(""):".."==o?((1<a.length||1==a.length&&""!=a[0])&&a.pop(),r&&s==n.length&&a.push("")):(a.push(o),r=!0)}n=a.join("/")}}return i?e.Y=n:i=""!==t.a.toString(),i?d(e,g(t.a)):i=!!t.ua,i&&(e.ua=t.ua),e};var Co=/[#\/\?@]/g,Oo=/[\#\?:]/g,Uo=/[\#\?]/g,jo=/[\#\?@]/g,Bo=/#/g;v.prototype.a=null,v.prototype.c=null,v.prototype.toString=function(){if(this.b)return this.b;if(!this.a)return"";var t,e=[];for(t in this.a)for(var i=encodeURIComponent(t),n=this.a[t],r=0;r<n.length;r++){var a=i;""!==n[r]&&(a+="="+encodeURIComponent(n[r])),e.push(a)}return this.b=e.join("&")},e("shaka.net.NetworkingEngine",L),L.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2,APP:3},L.PluginPriority={af:1,cf:2,Ye:3};var Fo={};L.registerScheme=D,L.unregisterScheme=function(t){delete Fo[t]},L.prototype.me=function(t){this.b.push(t)},L.prototype.registerRequestFilter=L.prototype.me,L.prototype.Re=function(t){var e=this.b;0<=(t=e.indexOf(t))&&e.splice(t,1)},L.prototype.unregisterRequestFilter=L.prototype.Re,L.prototype.cd=function(){this.b=[]},L.prototype.clearAllRequestFilters=L.prototype.cd,L.prototype.ne=function(t){this.c.push(t)},L.prototype.registerResponseFilter=L.prototype.ne,L.prototype.Se=function(t){var e=this.c;0<=(t=e.indexOf(t))&&e.splice(t,1)},L.prototype.unregisterResponseFilter=L.prototype.Se,L.prototype.dd=function(){this.c=[]},L.prototype.clearAllResponseFilters=L.prototype.dd,L.prototype.destroy=function(){this.f=!0,this.b=[],this.c=[];for(var t=[],e=0;e<this.a.length;++e)t.push(this.a[e].catch(x));return Promise.all(t)},L.prototype.destroy=L.prototype.destroy,L.prototype.request=function(t,e,i){var n=i||function(){return!1};if(this.f)return Promise.reject();e.method=e.method||"GET",e.headers=e.headers||{},e.retryParameters=e.retryParameters?I(e.retryParameters):E(),e.uris=I(e.uris);var r=Date.now(),a=Promise.resolve();return this.b.forEach(function(i){a=a.then(i.bind(null,t,e))}),a=a.catch(function(t){throw new h(2,1,1006,t)}),a=a.then(function(){var a=Date.now()-r,s=new T(e.retryParameters,!1,i);return w(s).then(function(){return C(this,t,e,s,0,a,n)}.bind(this))}.bind(this)),this.a.push(a),a.then(function(e){return 0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),this.g&&!e.fromCache&&1==t&&this.g(e.timeMs,e.data.byteLength),e}.bind(this)).catch(function(t){return t&&(t.severity=2),0<=this.a.indexOf(a)&&this.a.splice(this.a.indexOf(a),1),Promise.reject(t)}.bind(this))},L.prototype.request=L.prototype.request,F.prototype.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},F.prototype.get=function(t){return(t=this.a[t])?t.slice():null},F.prototype.remove=function(t,e){var i=this.a[t];if(i)for(var n=0;n<i.length;++n)i[n]==e&&(i.splice(n,1),--n)},V.prototype.destroy=function(){return q(this),this.a=null,Promise.resolve()},V.prototype.ga=function(t,e){if(this.a)for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ga(),this.a.remove(e,r))}},G.prototype.ga=function(){this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null},X.prototype.preventDefault=function(){this.cancelable&&(this.defaultPrevented=!0)},X.prototype.stopImmediatePropagation=function(){this.a=!0},X.prototype.stopPropagation=function(){};var Vo=1/15,Ho={codecs:"codecs",frameRate:"framerate",bandwidth:"bitrate",width:"width",height:"height",channelsCount:"channels"};e("shaka.util.StringUtils.fromUTF8",tt),e("shaka.util.StringUtils.fromUTF16",et),e("shaka.util.StringUtils.fromBytesAutoDetect",it),e("shaka.util.StringUtils.toUTF8",nt),at.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},e("shaka.util.Uint8ArrayUtils.toBase64",ut),e("shaka.util.Uint8ArrayUtils.fromBase64",ht),e("shaka.util.Uint8ArrayUtils.fromHex",ct),e("shaka.util.Uint8ArrayUtils.toHex",lt),e("shaka.util.Uint8ArrayUtils.equal",ft),e("shaka.util.Uint8ArrayUtils.concat",dt),Lo=pt.prototype,Lo.destroy=function(){this.c=!0;var t=[];return this.a.forEach(function(e){e=e.ea.close().catch(x);var i=new Promise(function(t){setTimeout(t,1e3)});t.push(Promise.race([e,i]))}),this.i.reject(),this.f&&t.push(this.f.destroy()),this.l&&t.push(this.l.setMediaKeys(null).catch(x)),this.w&&(this.w.cancel(),this.w=null),this.F&&(this.F.cancel(),this.F=null),this.f=this.l=this.j=this.u=this.b=null,this.a=[],this.m=[],this.s=this.g=this.h=null,Promise.all(t)},Lo.configure=function(t){this.h=t},Lo.init=function(t,e){var i={},n=[];return this.ha=e,this.m=t.offlineSessionIds,bt(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?Tt(this,i,n):(this.K=!0,Promise.resolve())},Lo.keySystem=function(){return this.b?this.b.keySystem:""},Lo.ob=function(){var t=this.a.map(function(t){return t=t.ea.expiration,isNaN(t)?1/0:t});return Math.min.apply(Math,t)},Lo.Ed=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(ft(e,this.a[i].initData))return;It(this,t.initDataType,e)},Lo.Dc=function(t){this.h.delayLicenseRequestUntilPlayed&&this.l.paused&&!this.W?this.J.push(t):_t(this,t)},Lo.xc=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].ea!=t;++e);if(e!=this.a.length){var i=!1;t.keyStatuses.forEach(function(t,n){if("string"==typeof n){var r=n;n=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==n.byteLength){var r=new DataView(n),a=r.getUint32(0,!0),s=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,a,!1),r.setUint16(4,s,!1),r.setUint16(6,o,!1)}"com.microsoft.playready"==this.b.keySystem&&"status-pending"==t&&(t="usable"),"status-pending"!=t&&(this.a[e].loaded=!0,this.a.every(function(t){return t.loaded})&&this.i.resolve()),"expired"==t&&(i=!0),r=lt(new Uint8Array(n)),this.A[r]=t}.bind(this));var n=t.expiration-Date.now();(0>n||i&&1e3>n)&&!this.a[e].ma&&(this.a.splice(e,1),t.close()),st(this.F,.5)}},Lo.le=function(){function t(t,e){return"expired"==e}!$(this.A)&&J(this.A,t)&&this.g(new h(2,6,6014)),this.s.Pb(this.A)},Lo.Pd=function(){for(var t=0;t<this.J.length;t++)_t(this,this.J[t]);this.W=!0,this.J=[]},Lo.je=function(){this.a.forEach(function(t){var e=t.Ob,i=t.ea.expiration;isNaN(i)&&(i=1/0),i!=e&&(this.s.onExpirationUpdated(t.ea.sessionId,i),t.Ob=i)}.bind(this))},Ot.prototype.destroy=function(){return this.a.dispose(),this.a=null,Promise.resolve()},Ot.prototype.h=function(t){var e=new Uint8Array(t.data.byteLength+t.initSegment.byteLength);e.set(t.initSegment,0),e.set(t.data,t.initSegment.byteLength),this.c.push(e)},Ot.prototype.g=function(){var t=dt.apply(null,this.c);this.b.resolve(t)};var Ko={};e("shaka.text.TextEngine.registerParser",function(t,e){Ko[t]=e}),e("shaka.text.TextEngine.unregisterParser",function(t){delete Ko[t]}),Bt.prototype.destroy=function(){return this.f=this.c=null,Promise.resolve()},Bt.prototype.Ae=function(t){this.f=t},Bt.prototype.setDisplayer=Bt.prototype.Ae,Bt.prototype.Gb=function(t){var e={periodStart:0,segmentStart:0,segmentEnd:0};try{return this.c.parseMedia(new Uint8Array(t),e)[0].startTime}catch(t){throw new h(2,2,2009,t)}},Bt.prototype.remove=function(t,e){return Promise.resolve().then(function(){!this.f||!this.f.remove(t,e)||null==this.a||e<=this.a||t>=this.b||(t<=this.a&&e>=this.b?this.a=this.b=null:t<=this.a&&e<this.b?this.a=e:t>this.a&&e>=this.b&&(this.b=t))}.bind(this))},Lo=Vt.prototype,Lo.destroy=function(){this.j=!0;var t,e=[];for(t in this.c){var i=this.c[t],n=i[0];for(this.c[t]=i.slice(0,1),n&&e.push(n.p.catch(x)),n=1;n<i.length;++n)i[n].p.catch(x),i[n].p.reject()}this.a&&e.push(this.a.destroy());for(t in this.h)e.push(this.h[t].destroy());return Promise.all(e).then(function(){this.i.destroy(),this.l=this.a=this.f=this.g=this.i=null,this.b={},this.h={},this.c={}}.bind(this))},Lo.init=function(e){for(var i in e){var n=e[i],n=Z(n.mimeType,n.codecs);"text"==i?Kt(this,n):(!MediaSource.isTypeSupported(n)&&t.muxjs&&"mp2t"==n.split(";")[0].split("/")[1]&&MediaSource.isTypeSupported(Ut(i,n))&&(this.h[i]=new Ot,n=Ut(i,n)),n=this.f.addSourceBuffer(n),H(this.i,n,"error",this.Me.bind(this,i)),H(this.i,n,"updateend",this.Ja.bind(this,i)),this.b[i]=n,this.c[i]=[])}},Lo.Cb=function(){var t=this.a&&null!=this.a.a?[{start:this.a.a,end:this.a.b}]:[];return{total:Ct(this.g.buffered),audio:Ct(Gt(this,"audio")),video:Ct(Gt(this,"video")),text:t}},Lo.remove=function(t,e,i){return"text"==t?this.a.remove(e,i):$t(this,t,this.Tc.bind(this,t,e,i))},Lo.endOfStream=function(t){return Wt(this,function(){t?this.f.endOfStream(t):this.f.endOfStream()}.bind(this))},Lo.fa=function(t){return Wt(this,function(){this.f.duration=t}.bind(this))},Lo.T=function(){return this.f.duration},Lo.Sc=function(t,e){this.b[t].appendBuffer(e)},Lo.Tc=function(t,e,i){i<=e?this.Ja(t):this.b[t].remove(e,i)},Lo.Zc=function(t){var e=this.b[t].appendWindowStart,i=this.b[t].appendWindowEnd;this.b[t].abort(),this.b[t].appendWindowStart=e,this.b[t].appendWindowEnd=i,this.Ja(t)},Lo.hd=function(t){this.g.currentTime-=.001,this.Ja(t)},Lo.Ce=function(t,e){this.b[t].timestampOffset=e,this.Ja(t)},Lo.ze=function(t,e,i){this.b[t].appendWindowStart=0,this.b[t].appendWindowEnd=i,this.b[t].appendWindowStart=e,this.Ja(t)},Lo.Me=function(t){this.c[t][0].p.reject(new h(2,3,3014,this.g.error?this.g.error.code:0))},Lo.Ja=function(t){var e=this.c[t][0];e&&(e.p.resolve(),Jt(this,t))};var qo=1,Go=2,Xo={aar:"aa",abk:"ab",afr:"af",aka:"ak",alb:"sq",amh:"am",ara:"ar",arg:"an",arm:"hy",asm:"as",ava:"av",ave:"ae",aym:"ay",aze:"az",bak:"ba",bam:"bm",baq:"eu",bel:"be",ben:"bn",bih:"bh",bis:"bi",bod:"bo",bos:"bs",bre:"br",bul:"bg",bur:"my",cat:"ca",ces:"cs",cha:"ch",che:"ce",chi:"zh",chu:"cu",chv:"cv",cor:"kw",cos:"co",cre:"cr",cym:"cy",cze:"cs",dan:"da",deu:"de",div:"dv",dut:"nl",dzo:"dz",ell:"el",eng:"en",epo:"eo",est:"et",eus:"eu",ewe:"ee",fao:"fo",fas:"fa",fij:"fj",fin:"fi",fra:"fr",fre:"fr",fry:"fy",ful:"ff",geo:"ka",ger:"de",gla:"gd",gle:"ga",glg:"gl",glv:"gv",gre:"el",grn:"gn",guj:"gu",hat:"ht",hau:"ha",heb:"he",her:"hz",hin:"hi",hmo:"ho",hrv:"hr",hun:"hu",hye:"hy",ibo:"ig",ice:"is",ido:"io",iii:"ii",iku:"iu",ile:"ie",ina:"ia",ind:"id",ipk:"ik",isl:"is",ita:"it",jav:"jv",jpn:"ja",kal:"kl",kan:"kn",kas:"ks",kat:"ka",kau:"kr",kaz:"kk",khm:"km",kik:"ki",kin:"rw",kir:"ky",kom:"kv",kon:"kg",kor:"ko",kua:"kj",kur:"ku",lao:"lo",lat:"la",lav:"lv",lim:"li",lin:"ln",lit:"lt",ltz:"lb",lub:"lu",lug:"lg",mac:"mk",mah:"mh",mal:"ml",mao:"mi",mar:"mr",may:"ms",mkd:"mk",mlg:"mg",mlt:"mt",mon:"mn",mri:"mi",msa:"ms",mya:"my",nau:"na",nav:"nv",nbl:"nr",nde:"nd",ndo:"ng",nep:"ne",nld:"nl",nno:"nn",nob:"nb",nor:"no",nya:"ny",oci:"oc",oji:"oj",ori:"or",orm:"om",oss:"os",pan:"pa",per:"fa",pli:"pi",pol:"pl",por:"pt",pus:"ps",que:"qu",roh:"rm",ron:"ro",rum:"ro",run:"rn",rus:"ru",sag:"sg",san:"sa",sin:"si",slk:"sk",slo:"sk",slv:"sl",sme:"se",smo:"sm",sna:"sn",snd:"sd",som:"so",sot:"st",spa:"es",sqi:"sq",srd:"sc",srp:"sr",ssw:"ss",sun:"su",swa:"sw",swe:"sv",tah:"ty",tam:"ta",tat:"tt",tel:"te",tgk:"tg",tgl:"tl",tha:"th",tib:"bo",tir:"ti",ton:"to",tsn:"tn",tso:"ts",tuk:"tk",tur:"tr",twi:"tw",uig:"ug",ukr:"uk",urd:"ur",uzb:"uz",ven:"ve",vie:"vi",vol:"vo",wel:"cy",wln:"wa",wol:"wo",xho:"xh",yid:"yi",yor:"yo",zha:"za",zho:"zh",zul:"zu"};e("shaka.abr.SimpleAbrManager",we),we.prototype.stop=function(){this.h=null,this.c=!1,this.g=[],this.f=null},we.prototype.stop=we.prototype.stop,we.prototype.init=function(t){this.h=t},we.prototype.init=we.prototype.init,we.prototype.chooseVariant=function(){var t=Ee(this.a.restrictions,this.g),e=this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate);if(this.g.length&&!t.length)throw new h(2,4,4012);for(var i=t[0]||null,n=0;n<t.length;++n){var r=t[n],a=(t[n+1]||{bandwidth:1/0}).bandwidth/this.a.bandwidthUpgradeTarget;e>=r.bandwidth/this.a.bandwidthDowngradeTarget&&e<=a&&(i=r)}return this.f=Date.now(),i},we.prototype.chooseVariant=we.prototype.chooseVariant,we.prototype.enable=function(){this.c=!0},we.prototype.enable=we.prototype.enable,we.prototype.disable=function(){this.c=!1},we.prototype.disable=we.prototype.disable,we.prototype.segmentDownloaded=function(t,e){var i=this.b;if(!(16e3>e)){var n=8e3*e/t,a=t/1e3;i.a+=e,r(i.b,a,n),r(i.c,a,n)}if(null!=this.f&&this.c)t:{if(this.i){if(Date.now()-this.f<1e3*this.a.switchInterval)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i=this.chooseVariant(),this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate),this.h(i)}},we.prototype.segmentDownloaded=we.prototype.segmentDownloaded,we.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate(this.a.defaultBandwidthEstimate)},we.prototype.getBandwidthEstimate=we.prototype.getBandwidthEstimate,we.prototype.setVariants=function(t){this.g=t},we.prototype.setVariants=we.prototype.setVariants,we.prototype.configure=function(t){this.a=t},we.prototype.configure=we.prototype.configure;var Yo="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),zo="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),$o=["loop","playbackRate"],Wo=["pause","play"],Jo="adaptation buffering emsg error loading streaming texttrackvisibility timelineregionadded timelineregionenter timelineregionexit trackschanged unloading".split(" "),Qo={drmInfo:20,getAudioLanguages:2,getAudioLanguagesAndRoles:2,getBufferedInfo:2,getConfiguration:2,getExpiration:2,getManifestUri:2,getPlaybackRate:2,getTextLanguages:2,getTextLanguagesAndRoles:2,getTextTracks:2,getStats:5,getVariantTracks:2,isAudioOnly:10,isBuffering:1,isInProgress:1,isLive:10,isTextTrackVisible:1,keySystem:10,seekRange:1},Zo={getPlayheadTimeAsDate:1,getPresentationStartTimeAsDate:20},tu=[["getConfiguration","configure"]],eu=[["isTextTrackVisible","setTextTrackVisibility"]],iu="addTextTrack cancelTrickPlay configure resetConfiguration retryStreaming selectAudioLanguage selectTextLanguage selectTextTrack selectVariantTrack setTextTrackVisibility trickPlay".split(" "),nu=["load","unload"],ru=!1,au=null;Lo=Ie.prototype,Lo.destroy=function(){return Pe(this),au&&_e(this),this.F=this.A=this.g=null,this.b=this.h=!1,this.m=this.l=this.f=this.c=this.a=this.i=null,Promise.resolve()},Lo.X=function(){return this.b},Lo.Ub=function(){return this.w},Lo.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.h=!0,this.g();var e=new chrome.cast.SessionRequest(this.J),e=new chrome.cast.ApiConfig(e,this.wc.bind(this),this.Rd.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){}),ru&&setTimeout(this.g.bind(this),20),(e=au)&&e.status!=chrome.cast.SessionStatus.STOPPED?this.wc(e):au=null}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},Lo.Xb=function(t){this.i=t,this.b&&xe({type:"appData",appData:this.i})},Lo.cast=function(t){return this.h?ru?this.b?Promise.reject(new h(1,8,8002)):(this.f=new b,chrome.cast.requestSession(this.Rb.bind(this,t),this.uc.bind(this)),this.f):Promise.reject(new h(1,8,8001)):Promise.reject(new h(1,8,8e3))},Lo.nb=function(){this.b&&(Pe(this),au&&(_e(this),au.stop(function(){},function(){}),au=null))},Lo.get=function(t,e){if("video"==t){if(0<=Wo.indexOf(e))return this.Ic.bind(this,t,e)}else if("player"==t){if(Zo[e]&&!this.get("player","isLive")())return function(){};if(0<=iu.indexOf(e))return this.Ic.bind(this,t,e);if(0<=nu.indexOf(e))return this.pe.bind(this,t,e);if(Qo[e])return this.Fc.bind(this,t,e)}return this.Fc(t,e)},Lo.set=function(t,e,i){this.a[t][e]=i,xe({type:"set",targetName:t,property:e,value:i})},Lo.Rb=function(t,e){au=e,e.addUpdateListener(this.l),e.addMessageListener("urn:x-cast:com.google.shaka.v2",this.m),this.vc(),xe({type:"init",initState:t,appData:this.i}),this.f.resolve()},Lo.uc=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.f.reject(new h(2,8,e,t))},Lo.Fc=function(t,e){return this.a[t][e]},Lo.Ic=function(t,e){xe({type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},Lo.pe=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new b,r=this.s.toString();return this.s++,this.c[r]=n,xe({type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},Lo.wc=function(t){var e=this.u();this.f=new b,this.j=!0,this.Rb(e,t)},Lo.Rd=function(t){ru="available"==t,this.g()},Lo.vc=function(){var t=!!au&&"connected"==au.status;if(this.b&&!t){this.F();for(var e in this.a)this.a[e]={};Pe(this)}this.w=(this.b=t)?au.receiver.friendlyName:"",this.g()},Lo.Ld=function(t,e){var i=Ae(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.A(n,new X(r.type,r));break;case"update":r=i.update;for(n in r){var i=this.a[n]||{};for(a in r[n])i[a]=r[n][a]}this.j&&(this.K(),this.j=!1);break;case"asyncComplete":n=i.id;var a=i.error;if(i=this.c[n],delete this.c[n],i)if(a){n=new h(a.severity,a.category,a.code);for(r in a)n[r]=a[r];i.reject(n)}else i.resolve()}},Re.prototype.addEventListener=function(t,e){this.xb.push(t,e)},Re.prototype.removeEventListener=function(t,e){this.xb.remove(t,e)},Re.prototype.dispatchEvent=function(t){for(var e=this.xb.get(t.type)||[],i=0;i<e.length;++i){t.target=this.eb,t.currentTarget=this.eb;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(t){}if(t.a)break}return t.defaultPrevented},i(Ne),e("shaka.cast.CastProxy",Ne),Ne.prototype.destroy=function(t){return t&&this.a&&this.a.nb(),t=[this.i?this.i.destroy():null,this.b?this.b.destroy():null,this.a?this.a.destroy():null],this.a=this.i=this.j=this.h=this.b=this.c=null,Promise.all(t)},Ne.prototype.destroy=Ne.prototype.destroy,Ne.prototype.xd=function(){return this.h},Ne.prototype.getVideo=Ne.prototype.xd,Ne.prototype.od=function(){return this.j},Ne.prototype.getPlayer=Ne.prototype.od,Ne.prototype.$c=function(){return!!this.a&&(this.a.h&&ru)},Ne.prototype.canCast=Ne.prototype.$c,Ne.prototype.X=function(){return!!this.a&&this.a.X()},Ne.prototype.isCasting=Ne.prototype.X,Ne.prototype.Ub=function(){return this.a?this.a.Ub():""},Ne.prototype.receiverName=Ne.prototype.Ub,Ne.prototype.cast=function(){var t=this.mc();return this.a.cast(t).then(function(){return this.b.vb()}.bind(this))},Ne.prototype.cast=Ne.prototype.cast,Ne.prototype.Xb=function(t){this.a.Xb(t)},Ne.prototype.setAppData=Ne.prototype.Xb,Ne.prototype.Pe=function(){var t=this.a;if(t.b){var e=t.u();chrome.cast.requestSession(t.Rb.bind(t,e),t.uc.bind(t))}},Ne.prototype.suggestDisconnect=Ne.prototype.Pe,Ne.prototype.nb=function(){this.a.nb()},Ne.prototype.forceDisconnect=Ne.prototype.nb,Lo=Ne.prototype,Lo.mc=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.nc(),startTime:null};return this.c.pause(),$o.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),tu.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),eu.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},Lo.He=function(){this.dispatchEvent(new X("caststatuschanged"))},Lo.Ie=function(){this.f.dispatchEvent(new X(this.h.paused?"pause":"play"))},Lo.Ke=function(){tu.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this));var t=this.a.get("player","getManifestUri")(),e=this.a.get("video","ended"),i=Promise.resolve(),n=this.c.autoplay,r=null;e||(r=this.a.get("video","currentTime")),t&&(this.c.autoplay=!1,i=this.b.load(t,r),i.catch(function(t){this.b.dispatchEvent(new X("error",{detail:t}))}.bind(this)));var a={};$o.forEach(function(t){a[t]=this.a.get("video",t)}.bind(this)),i.then(function(){$o.forEach(function(t){this.c[t]=a[t]}.bind(this)),eu.forEach(function(t){var e=t[1];t=this.a.get("player",t[0])(),this.b[e](t)}.bind(this)),this.c.autoplay=n,t&&this.c.play()}.bind(this))},Lo.Ve=function(t){if("addEventListener"==t)return this.f.addEventListener.bind(this.f);if("removeEventListener"==t)return this.f.removeEventListener.bind(this.f);if(this.a.X()&&!Object.keys(this.a.a.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.X()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},Lo.Xe=function(t,e){this.a.X()?this.a.set("video",t,e):this.c[t]=e},Lo.We=function(t){this.a.X()||this.f.dispatchEvent(new X(t.type,t))},Lo.ge=function(t){return"addEventListener"==t?this.g.addEventListener.bind(this.g):"removeEventListener"==t?this.g.removeEventListener.bind(this.g):"getMediaElement"==t?function(){return this.h}.bind(this):"getNetworkingEngine"==t?this.b.oc.bind(this.b):"getManifest"==t?this.a.X()?function(){return null}:this.b.Ea.bind(this.b):this.a.X()&&!Object.keys(this.a.a.video).length&&Qo[t]||!this.a.X()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},Lo.he=function(t){this.a.X()||this.g.dispatchEvent(t)},Lo.Je=function(t,e){this.a.X()&&("video"==t?this.f.dispatchEvent(e):"player"==t&&this.g.dispatchEvent(e))},i(De),e("shaka.cast.CastReceiver",De),De.prototype.isConnected=function(){return this.l},De.prototype.isConnected=De.prototype.isConnected,De.prototype.zd=function(){return this.f},De.prototype.isIdle=De.prototype.zd,De.prototype.destroy=function(){var e=this.b?this.b.destroy():Promise.resolve();return null!=this.i&&t.clearTimeout(this.i),this.s=this.m=this.b=this.a=null,this.l=!1,this.f=!0,this.i=this.h=this.c=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},De.prototype.destroy=De.prototype.destroy,Lo=De.prototype,Lo.Cc=function(){this.l=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,Ce(this)},Lo.Gc=function(t,e){this.b&&(this.Sb(),Ue(this,{type:"event",targetName:t,event:e},this.c))},Lo.Sb=function(){null!=this.i&&t.clearTimeout(this.i),this.i=t.setTimeout(this.Sb.bind(this),500);var e={video:{},player:{}};if(zo.forEach(function(t){e.video[t]=this.a[t]}.bind(this)),this.b.P())for(var i in Zo){var n=Zo[i];this.g%n||(e.player[i]=this.b[i]())}for(i in Qo)n=Qo[i],this.g%n||(e.player[i]=this.b[i]());(n=cast.receiver.CastReceiverManager.getInstance().getSystemVolume())&&(e.video.volume=n.level,e.video.muted=n.muted),this.j&&(this.g+=1),Ue(this,{type:"update",update:e},this.c)},Lo.gd=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&Ue(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}},this.c),Ue(this,{type:"event",targetName:"video",event:{type:"volumechange"}},this.c)},Lo.Ud=function(t){var e=Ae(t.data);switch(e.type){case"init":this.g=0,this.j=!1,Oe(this,e.initState,e.appData),this.Sb();break;case"appData":this.s(e.appData);break;case"set":var i=e.targetName,n=e.property,r=e.value;if("video"==i){if(e=cast.receiver.CastReceiverManager.getInstance(),"volume"==n){e.setSystemVolumeLevel(r);break}if("muted"==n){e.setSystemVolumeMuted(r);break}}this.m[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.m[i],i[n].apply(i,r);break;case"asyncCall":i=e.targetName,n=e.methodName,"player"==i&&"load"==n&&(this.g=0,this.j=!1),r=e.args,e=e.id,t=t.senderId,i=this.m[i],i[n].apply(i,r).then(this.Nc.bind(this,t,e,null),this.Nc.bind(this,t,e))}},Lo.Gd=function(t){var e=Ae(t.data);switch(e.type){case"PLAY":this.a.play(),je(this,0);break;case"PAUSE":this.a.pause(),je(this,0);break;case"SEEK":t=e.currentTime;var i=e.resumeState;null!=t&&(this.a.currentTime=Number(t)),i&&"PLAYBACK_START"==i?(this.a.play(),je(this,0)):i&&"PLAYBACK_PAUSE"==i&&(this.a.pause(),je(this,0));break;case"STOP":this.b.vb().then(function(){je(this,0)}.bind(this));break;case"GET_STATUS":je(this,Number(e.requestId));break;case"VOLUME":i=e.volume,t=i.level;var i=i.muted,n=this.a.volume,r=this.a.muted;null!=t&&(this.a.volume=Number(t)),null!=i&&(this.a.muted=i),n==this.a.volume&&r==this.a.muted||je(this,0);break;case"LOAD":this.g=0,this.j=!1,i=e.media.contentId,t=e.currentTime;var a=this.u(i);this.a.autoplay=!0,this.b.load(a,t).then(function(){je(this,0,{contentId:a,streamType:this.b.P()?"LIVE":"BUFFERED",contentType:""})}.bind(this)).catch(function(t){var i="LOAD_FAILED";7==t.category&&7e3==t.code&&(i="LOAD_CANCELLED"),Ue(this,{requestId:Number(e.requestId),type:i},this.h)}.bind(this));break;default:Ue(this,{requestId:Number(e.requestId),type:"INVALID_REQUEST",reason:"INVALID_COMMAND"},this.h)}},Lo.Nc=function(t,e,i){Ue(this,{type:"asyncComplete",id:e,error:i},this.c,t)};var su={IDLE:"IDLE",Xc:"PLAYING",Uc:"BUFFERING",Wc:"PAUSED"},ou={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"};e("shaka.media.InitSegmentReference",oi),oi.prototype.Ab=function(){return this.a()},oi.prototype.createUris=oi.prototype.Ab,oi.prototype.Fb=function(){return this.N},oi.prototype.getStartByte=oi.prototype.Fb,oi.prototype.Db=function(){return this.D},oi.prototype.getEndByte=oi.prototype.Db,e("shaka.media.SegmentReference",ui),ui.prototype.U=function(){return this.position},ui.prototype.getPosition=ui.prototype.U,ui.prototype.Gb=function(){return this.startTime},ui.prototype.getStartTime=ui.prototype.Gb,ui.prototype.ld=function(){return this.endTime},ui.prototype.getEndTime=ui.prototype.ld,ui.prototype.Ab=function(){return this.a()},ui.prototype.createUris=ui.prototype.Ab,ui.prototype.Fb=function(){return this.N},ui.prototype.getStartByte=ui.prototype.Fb,ui.prototype.Db=function(){return this.D},ui.prototype.getEndByte=ui.prototype.Db,e("shaka.util.DataViewReader",hi);var uu=1;hi.Endianness={Ze:0,bf:uu},hi.prototype.ca=function(){return this.a<this.G.byteLength},hi.prototype.hasMoreData=hi.prototype.ca,hi.prototype.U=function(){return this.a},hi.prototype.getPosition=hi.prototype.U,hi.prototype.md=function(){return this.G.byteLength},hi.prototype.getLength=hi.prototype.md,hi.prototype.$=function(){try{var t=this.G.getUint8(this.a)}catch(t){ci()}return this.a+=1,t},hi.prototype.readUint8=hi.prototype.$,hi.prototype.Xa=function(){try{var t=this.G.getUint16(this.a,this.b)}catch(t){ci()}return this.a+=2,t},hi.prototype.readUint16=hi.prototype.Xa,hi.prototype.B=function(){try{var t=this.G.getUint32(this.a,this.b)}catch(t){ci()}return this.a+=4,t},hi.prototype.readUint32=hi.prototype.B,hi.prototype.Hc=function(){try{var t=this.G.getInt32(this.a,this.b)}catch(t){ci()}return this.a+=4,t},hi.prototype.readInt32=hi.prototype.Hc,hi.prototype.Na=function(){try{if(this.b)var t=this.G.getUint32(this.a,!0),e=this.G.getUint32(this.a+4,!0);else e=this.G.getUint32(this.a,!1),t=this.G.getUint32(this.a+4,!1)}catch(t){ci()}if(2097151<e)throw new h(2,3,3001);return this.a+=8,e*Math.pow(2,32)+t},hi.prototype.readUint64=hi.prototype.Na,hi.prototype.Ma=function(t){this.a+t>this.G.byteLength&&ci();var e=new Uint8Array(this.G.buffer,this.G.byteOffset+this.a,t);return this.a+=t,new Uint8Array(e)},hi.prototype.readBytes=hi.prototype.Ma,hi.prototype.H=function(t){this.a+t>this.G.byteLength&&ci(),this.a+=t},hi.prototype.skip=hi.prototype.H,hi.prototype.Lc=function(t){this.a<t&&ci(),this.a-=t},hi.prototype.rewind=hi.prototype.Lc,hi.prototype.seek=function(t){(0>t||t>this.G.byteLength)&&ci(),this.a=t},hi.prototype.seek=hi.prototype.seek,hi.prototype.Tb=function(){for(var t=this.a;this.ca()&&this.G.getUint8(this.a);)this.a+=1;return t=new Uint8Array(this.G.buffer,this.G.byteOffset+t,this.a-t),this.a+=1,tt(t)},hi.prototype.readTerminatedString=hi.prototype.Tb,e("shaka.util.Mp4Parser",li),li.prototype.C=function(t,e){var i=mi(t);return this.c[i]=0,this.b[i]=e,this},li.prototype.box=li.prototype.C,li.prototype.ba=function(t,e){var i=mi(t);return this.c[i]=1,this.b[i]=e,this},li.prototype.fullBox=li.prototype.ba,li.prototype.stop=function(){this.a=!0},li.prototype.stop=li.prototype.stop,li.prototype.parse=function(t,e){var i=new Uint8Array(t),i=new hi(new DataView(i.buffer,i.byteOffset,i.byteLength),0);for(this.a=!1;i.ca()&&!this.a;)this.rb(0,i,e)},li.prototype.parse=li.prototype.parse,li.prototype.rb=function(t,e,i){var n=e.U(),r=e.B(),a=e.B();switch(r){case 0:r=e.G.byteLength-n;break;case 1:r=e.Na()}var s=this.b[a];if(s){var o=null,u=null;1==this.c[a]&&(u=e.B(),o=u>>>24,u&=16777215),a=n+r,i&&a>e.G.byteLength&&(a=e.G.byteLength),a-=e.U(),e=0<a?e.Ma(a):new Uint8Array(0),e=new hi(new DataView(e.buffer,e.byteOffset,e.byteLength),0),s({oa:this,Ec:i||!1,version:o,lc:u,o:e,size:r,start:n+t})}else e.H(n+r-e.U())},li.prototype.parseNext=li.prototype.rb,li.children=fi,li.sampleDescription=di,li.allData=pi,e("shaka.media.SegmentIndex",gi),gi.prototype.destroy=function(){return this.a=null,Promise.resolve()},gi.prototype.destroy=gi.prototype.destroy,gi.prototype.find=function(t){for(var e=this.a.length-1;0<=e;--e){var i=this.a[e];if(t>=i.startTime&&t<i.endTime)return i.position}return this.a.length&&t<this.a[0].startTime?this.a[0].position:null},gi.prototype.find=gi.prototype.find,gi.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||t>=this.a.length?null:this.a[t]):null},gi.prototype.get=gi.prototype.get,gi.prototype.offset=function(t){for(var e=0;e<this.a.length;++e)this.a[e].startTime+=t,this.a[e].endTime+=t},gi.prototype.offset=gi.prototype.offset,gi.prototype.Lb=function(t){for(var e,i,n,r=[],a=e=0;e<this.a.length&&a<t.length;)i=this.a[e],n=t[a],i.startTime<n.startTime?(r.push(i),e++):(i.startTime>n.startTime?e||r.push(n):(.1<Math.abs(i.endTime-n.endTime)?(n=new ui(i.position,n.startTime,n.endTime,n.a,n.N,n.D),r.push(n)):r.push(i),e++),a++);for(;e<this.a.length;)r.push(this.a[e++]);if(r.length)for(e=r[r.length-1].position+1;a<t.length;)n=t[a++],n=new ui(e++,n.startTime,n.endTime,n.a,n.N,n.D),r.push(n);else r=t;this.a=r},gi.prototype.merge=gi.prototype.Lb,gi.prototype.Bb=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++e);this.a.splice(0,e)},gi.prototype.evict=gi.prototype.Bb;var hu;Ti.prototype.ca=function(){return this.a.ca()},ki.prototype.parse=function(t,e,i,n){var r;if(e=new Ti(new DataView(e)),440786851!=wi(e).id)throw new h(2,3,3008);var a=wi(e);if(408125543!=a.id)throw new h(2,3,3009);for(e=a.a.byteOffset,a=new Ti(a.a),r=null;a.ca();){var s=wi(a);if(357149030==s.id){r=s;break}}if(!r)throw new h(2,3,3010);for(a=new Ti(r.a),r=1e6,s=null;a.ca();){var o=wi(a);if(2807729==o.id)r=Ai(o);else if(17545==o.id)if(s=o,4==s.a.byteLength)s=s.a.getFloat32(0);else{if(8!=s.a.byteLength)throw new h(2,3,3003);s=s.a.getFloat64(0)}}if(null==s)throw new h(2,3,3011);if(a=r/1e9,r=s*a,t=wi(new Ti(new DataView(t))),475249515!=t.id)throw new h(2,3,3007);return Ii(t,e,a,r,i,n)};var cu={},lu={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){lu[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){cu[t]=e}),e("shaka.media.PresentationTimeline",Ki),Ki.prototype.T=function(){return this.a},Ki.prototype.getDuration=Ki.prototype.T,Ki.prototype.fa=function(t){this.a=t},Ki.prototype.setDuration=Ki.prototype.fa,Ki.prototype.qd=function(){return this.c},Ki.prototype.getPresentationStartTime=Ki.prototype.qd,Ki.prototype.Pc=function(t){this.i=t},Ki.prototype.setClockOffset=Ki.prototype.Pc,Ki.prototype.ub=function(t){this.h=t},Ki.prototype.setStatic=Ki.prototype.ub,Ki.prototype.sd=function(){return this.f},Ki.prototype.getSegmentAvailabilityDuration=Ki.prototype.sd,Ki.prototype.Zb=function(t){this.f=t},Ki.prototype.setSegmentAvailabilityDuration=Ki.prototype.Zb,Ki.prototype.Qc=function(t){this.j=t},Ki.prototype.setDelay=Ki.prototype.Qc,Ki.prototype.Ia=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b))},Ki.prototype.notifySegments=Ki.prototype.Ia,Ki.prototype.Mb=function(t){this.b=Math.max(this.b,t)},Ki.prototype.notifyMaxSegmentDuration=Ki.prototype.Mb,Ki.prototype.P=function(){return 1/0==this.a&&!this.h},Ki.prototype.isLive=Ki.prototype.P,Ki.prototype.wa=function(){return 1/0!=this.a&&!this.h},Ki.prototype.isInProgress=Ki.prototype.wa,Ki.prototype.ja=function(){return this.Fa(0)},Ki.prototype.getSegmentAvailabilityStart=Ki.prototype.ja,Ki.prototype.Fa=function(t){if(1/0==this.f)return this.g;var e=this.va();return Math.max(this.g,Math.min(e-this.f+t,e))},Ki.prototype.getSafeAvailabilityStart=Ki.prototype.Fa,Ki.prototype.Oc=function(t){this.g=t},Ki.prototype.setAvailabilityStart=Ki.prototype.Oc,Ki.prototype.va=function(){return this.P()||this.wa()?Math.min(Math.max(0,(Date.now()+this.i)/1e3-this.b-this.c),this.a):this.a},Ki.prototype.getSegmentAvailabilityEnd=Ki.prototype.va,Ki.prototype.pb=function(){var t=this.P()||this.wa()?this.j:0;return Math.max(0,this.va()-t)},Ki.prototype.getSeekRangeEnd=Ki.prototype.pb,e("shaka.dash.DashParser",qi),Lo=qi.prototype,Lo.configure=function(t){this.b=t},Lo.start=function(t,e){return this.g=[t],this.a=e,Gi(this).then(function(){return this.a&&Qi(this,0),this.c}.bind(this))},Lo.stop=function(){return this.b=this.a=null,this.g=[],this.c=null,this.i=[],this.j={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},Lo.update=function(){Gi(this).catch(function(t){this.a&&this.a.onError(t)}.bind(this))},Lo.onExpirationUpdated=function(){},Lo.ce=function(t,e){t.S=Zi(e,t.Z,null);var i=!1,n=Fe(e,"Role"),r=n.map(function(t){return t.getAttribute("value")}).filter(R),a=void 0;"text"==t.S.contentType&&(a="subtitle");for(var s=0;s<n.length;s++){var o=n[s].getAttribute("schemeIdUri");if(null==o||"urn:mpeg:dash:role:2011"==o)switch(o=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":a=o}}var u=null,c=!1;if(Fe(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")?u=t.getAttribute("value"):c=!0}),c)return null;var n=Fe(e,"ContentProtection"),l=We(n,this.b.dash.customScheme,this.b.dash.ignoreDrmInfo),n=Zt(e.getAttribute("lang")||"und"),o=e.getAttribute("label"),s=Fe(e,"Representation"),r=s.map(this.fe.bind(this,t,l,a,n,o,i,r)).filter(function(t){return!!t});if(!r.length)throw new h(2,4,4003);return t.S.contentType&&"application"!=t.S.contentType||(t.S.contentType=an(r[0].mimeType,r[0].codecs),r.forEach(function(e){e.type=t.S.contentType})),r.forEach(function(t){l.drmInfos.forEach(function(e){t.keyId&&e.keyIds.push(t.keyId)})}),a=s.map(function(t){return t.getAttribute("id")}).filter(R),{id:t.S.id||"__fake__"+this.h++,contentType:t.S.contentType,language:n,Jb:i,streams:r,drmInfos:l.drmInfos,cc:u,qe:a}},Lo.fe=function(t,e,i,n,r,a,s,o){if(t.v=Zi(o,t.S,null),!en(t.v))return null;t.bandwidth=He(o,"bandwidth",Ye)||0;var u=this.re.bind(this);if(t.v.Ya)u=xi(t,u);else if(t.v.qa)u=Li(t,this.j);else if(t.v.Za)u=Oi(t,u,this.j,!!this.c);else{var h=t.v.aa,c=t.R.duration||0;u={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<c?1:null},getSegmentReference:function(t){return 1!=t?null:new ui(1,0,c,function(){return h},0,null)},initSegmentReference:null,V:0}}return o=Fe(o,"ContentProtection"),o=Je(o,this.b.dash.customScheme,e,this.b.dash.ignoreDrmInfo),{id:this.h++,createSegmentIndex:u.createSegmentIndex,findSegmentPosition:u.findSegmentPosition,getSegmentReference:u.getSegmentReference,initSegmentReference:u.initSegmentReference,presentationTimeOffset:u.V,mimeType:t.v.mimeType,codecs:t.v.codecs,frameRate:t.v.frameRate,bandwidth:t.bandwidth,width:t.v.width,height:t.v.height,kind:i,encrypted:0<e.drmInfos.length,keyId:o,language:n,label:r,type:t.S.contentType,primary:a,trickModeVideo:null,containsEmsgBoxes:t.v.containsEmsgBoxes,roles:s,channelsCount:t.v.Nb}},Lo.Le=function(){this.f=null;var t=Date.now();Gi(this).then(function(){this.a&&Qi(this,(Date.now()-t)/1e3)}.bind(this)).catch(function(t){this.a&&(t.severity=1,this.a.onError(t),Qi(this,0))}.bind(this))},Lo.ee=function(t,e,i){var n=i.getAttribute("schemeIdUri")||"",r=i.getAttribute("value")||"",a=He(i,"timescale",ze)||1;Fe(i,"Event").forEach(function(i){var s=He(i,"presentationTime",ze)||0,o=He(i,"duration",ze)||0,s=s/a+t,o=s+o/a;null!=e&&(s=Math.min(s,t+e),o=Math.min(o,t+e)),i={schemeIdUri:n,value:r,startTime:s,endTime:o,id:i.getAttribute("id")||"",eventElement:i},this.a.onTimelineRegionAdded(i)}.bind(this))},Lo.re=function(t,e,i){return t=M(t,this.b.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.networkingEngine.request(1,t).then(function(t){return t.data})},lu.mpd=qi,cu["application/dash+xml"]=qi,on.prototype.toString=function(){function t(t){return t.name+'="'+t.value+'"'}return this.value?"#"+this.name+":"+this.value:0<this.a.length?"#"+this.name+":"+this.a.map(t).join(","):"#"+this.name},on.prototype.getAttribute=function(t){var e=this.a.filter(function(e){return e.name==t});return e.length?e[0]:null};var fu="EXT-X-TARGETDURATION EXT-X-MEDIA-SEQUENCE EXT-X-DISCONTINUITY-SEQUENCE EXT-X-PLAYLIST-TYPE EXT-X-MAP EXT-X-I-FRAMES-ONLY EXT-X-ENDLIST".split(" "),du="EXTINF EXT-X-BYTERANGE EXT-X-DISCONTINUITY EXT-X-PROGRAM-DATE-TIME EXT-X-KEY EXT-X-DATERANGE".split(" ");e("shaka.net.DataUriPlugin",En),En.parse=function(e){var i=e.split(":");if(2>i.length||"data"!=i[0])throw new h(2,1,1004,e);if(i=i.slice(1).join(":").split(","),2>i.length)throw new h(2,1,1004,e);var n=i[0],i=t.decodeURIComponent(i.slice(1).join(",")),n=n.split(";"),r=null;if(1<n.length&&(r=n[1]),"base64"==r)e=ht(i).buffer;else{if(r)throw new h(2,1,1005,e);e=nt(i)}return{data:e,contentType:n[0]}},D("data",En),e("shaka.hls.HlsParser",Sn),Lo=Sn.prototype,Lo.configure=function(t){this.g=t},Lo.start=function(t,e){return this.c=e,this.l=t,Yn(this,t).then(function(e){return kn(this,e.data,t).then(function(){return zn(this,this.h),this.m}.bind(this))}.bind(this))},Lo.stop=function(){return this.g=this.c=null,this.u={},this.A={},this.m=null,Promise.resolve()},Lo.update=function(){if(this.f!=gu.na){var t,e=[];for(t in this.a)e.push(An(this,this.a[t],t));return Promise.all(e)}},Lo.onExpirationUpdated=function(){};var pu={audio:[/^vorbis$/,/^opus$/,/^flac$/,/^mp4a/,/^[ae]c-3$/],video:[/^avc/,/^hev/,/^hvc/,/^vp0?[89]/,/^av1$/],text:[/^vtt$/,/^wvtt/,/^stpp/]},mu={audio:{mp4:"audio/mp4",m4s:"audio/mp4",m4i:"audio/mp4",m4a:"audio/mp4",ts:"video/mp2t"},video:{mp4:"video/mp4",m4s:"video/mp4",m4i:"video/mp4",m4v:"video/mp4",ts:"video/mp2t"},text:{mp4:"application/mp4",m4s:"application/mp4",m4i:"application/mp4",vtt:"text/vtt",ttml:"application/ttml+xml"}};Sn.prototype.J=function(){this.c&&(this.i=null,this.update().then(function(){zn(this,this.h)}.bind(this)).catch(function(t){this.c&&(t.severity=1,this.c.onError(t),zn(this,0))}.bind(this)))};var yu={"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":function(t){if("SAMPLE-AES-CENC"!=Gn(t,"METHOD"))return null;var e=Gn(t,"URI"),e=En.parse(e),e=new Uint8Array(e.data),e=z("com.widevine.alpha",[{initDataType:"cenc",initData:e}]);return(t=hn(t,"KEYID"))&&(e.keyIds=[t.substr(2).toLowerCase()]),e}},vu="VOD",gu={na:vu,Vc:"EVENT",ec:"LIVE"};lu.m3u8=Sn,cu["application/x-mpegurl"]=Sn,cu["application/vnd.apple.mpegurl"]=Sn,Lo=Wn.prototype,Lo.destroy=function(){var t=this.b.destroy();return this.b=null,this.f&&(this.f.cancel(),this.f=null),this.h&&(this.h.cancel(),this.h=null),this.g&&(this.g.cancel(),this.g=null),this.J=this.K=this.l=this.c=this.a=null,t},Lo.Eb=function(){return this.i},Lo.Qb=function(){this.u=!0,this.Ac()},Lo.Qd=function(){var t=this.j||0>this.i?0:this.i;this.a.playbackRate&&this.a.playbackRate!=t&&er(this,this.a.playbackRate)},Lo.yc=function(){var t=tr(this);this.b.ga(this.a,"timeupdate"),this.g.cancel(),.001>Math.abs(this.a.currentTime-t)?(H(this.b,this.a,"seeking",this.Bc.bind(this)),H(this.b,this.a,"playing",this.zc.bind(this))):(K(this.b,this.a,"seeking",this.Sd.bind(this)),this.a.currentTime=t)},Lo.Sd=function(){H(this.b,this.a,"seeking",this.Bc.bind(this)),H(this.b,this.a,"playing",this.zc.bind(this))},Lo.Ac=function(){if(this.a.readyState&&!this.a.paused){this.a.readyState!=this.F&&(this.s=!1,this.F=this.a.readyState);var t=this.l.smallGapLimit,e=this.a.currentTime,i=this.a.buffered,n=this.c.presentationTimeline.ja();if(e<n)i=ir(this,e),nr(this,e,i);else{t:{if(i&&i.length&&!(1==i.length&&1e-6>i.end(0)-i.start(0))){n=.1,/(Edge\/|Trident\/|Tizen)/.test(navigator.userAgent)&&(n=.5);for(var r=0;r<i.length;r++)if(i.start(r)>e&&(!r||i.end(r-1)-e<=n)){n=r;break t}}n=null}if(null==n){if(3>this.a.readyState&&0<this.a.playbackRate)if(this.A!=e)this.A=e,this.W=Date.now(),this.w=!1;else if(!this.w&&this.W<Date.now()-1e3)for(t=0;t<i.length;t++)if(e>=i.start(t)&&e<i.end(t)-.5){this.a.currentTime+=.1,this.A=this.a.currentTime,this.w=!0;break}}else if(n||this.u){var r=i.start(n),a=this.c.presentationTimeline.pb();if(!(r>=a)){var a=r-e,t=a<=t,s=!1;t||this.s||(this.s=!0,a=new X("largegap",{currentTime:e,gapSize:a}),a.cancelable=!0,this.J(a),this.l.jumpLargeGaps&&!a.defaultPrevented&&(s=!0)),(t||s)&&(n&&i.end(n-1),nr(this,e,r))}}}}},Lo.Dd=function(){this.m=ir(this,this.a.currentTime)},Lo.Bc=function(){this.u=!1;var t=this.a.currentTime,e=ir(this,t);.001<Math.abs(e-t)?nr(this,t,e):(this.s=!1,this.K())},Lo.zc=function(){var t=this.a.currentTime,e=ir(this,t);.001<Math.abs(e-t)&&nr(this,t,e)},ar.prototype.destroy=function(){var t=this.j?this.j.destroy():Promise.resolve();return this.j=null,ur(this),this.A=this.h=this.l=this.u=this.g=this.w=this.a=null,this.c=[],t},ar.prototype.s=function(t){if(!this.c.some(function(e){return e.info.schemeIdUri==t.schemeIdUri&&e.info.startTime==t.startTime&&e.info.endTime==t.endTime})){var e={info:t,status:1};this.c.push(e);var i=new X("timelineregionadded",{detail:sr(t)});this.h(i),this.m(!0,e)}},ar.prototype.m=function(t,e){var i=e.info.startTime>this.a.currentTime?1:e.info.endTime<this.a.currentTime?3:2,n=2==e.status,r=2==i;i!=e.status&&((!t||n||r)&&(n||this.h(new X("timelineregionenter",{detail:sr(e.info)})),r||this.h(new X("timelineregionexit",{detail:sr(e.info)}))),e.status=i)},ar.prototype.F=function(){this.f=null,or(this);var t=be(this.g,this.a.currentTime);t!=this.i&&(-1!=this.i&&this.A(),this.i=t);var t=Mt(this.a.buffered,this.a.currentTime),e=Lt(this.a.buffered),i=this.g.presentationTimeline,n=i.va(),e=i.P()&&e>=n,i="ended"==this.w.readyState,e=e||this.a.ended||i;this.b?(i=1*Math.max(this.g.minBufferTime||0,this.u.rebufferingGoal),(e||t>=i)&&0!=this.b&&(this.b=!1,this.l(!1))):!e&&.5>t&&1!=this.b&&(this.b=!0,this.l(!0)),this.c.forEach(this.m.bind(this,!1))},Lo=hr.prototype,Lo.destroy=function(){for(var t in this.c)Br(this.c[t]);return this.h=this.c=this.j=this.g=this.m=this.b=this.a=null,this.f=!0,Promise.resolve()},Lo.configure=function(t){this.h=t,this.A=new T({maxAttempts:Math.max(t.retryParameters.maxAttempts,2),baseDelay:t.retryParameters.baseDelay,backoffFactor:t.retryParameters.backoffFactor,fuzzFactor:t.retryParameters.fuzzFactor,timeout:0},!0)},Lo.init=function(){var t=Zn(this.a.Ka),t=this.a.tc(this.b.periods[be(this.b,t)]);return t.variant||t.text?wr(this,t).then(function(){this.a&&this.a.Hd&&this.a.Hd()}.bind(this)):Promise.reject(new h(2,5,5005))},Lo.Ne=function(t){if(!this.f&&!t.ya&&null!=t.ra&&!t.ta)if(t.ra=null,t.sa)Ur(this,t,t.wb);else{try{var e=Ir(this,t);null!=e&&(jr(this,t,e),t.Ua=!1)}catch(t){return void Fr(this,t)}e=W(this.c),Mr(this,t),e.every(function(t){return t.endOfStream})&&this.a.L.endOfStream().then(function(){this.b.presentationTimeline.fa(this.a.L.T())}.bind(this))}},Lo.de=function(t,e,i){var n=i.o.Tb(),r=i.o.Tb(),a=i.o.B(),s=i.o.B(),o=i.o.B(),u=i.o.B(),h=i.o.Ma(i.o.G.byteLength-i.o.U());t=t.startTime+e.startTime+s/a,"urn:mpeg:dash:event:2012"==n?this.a.Jd():this.a.onEvent(new X("emsg",{detail:{startTime:t,endTime:t+o/a,schemeIdUri:n,value:r,timescale:a,presentationTimeDelta:s,eventDuration:o,id:u,messageData:h}})),i.oa.stop()},e("shaka.net.HttpPlugin",Vr),D("http",Vr,1),D("https",Vr,1),Gr.prototype.a=function(t){t.createObjectStore("manifest-v2",{autoIncrement:!0}),t.createObjectStore("segment-v2",{autoIncrement:!0})},Xr.prototype.a=function(t,e){function i(){o.clear(),s.clear()}function n(t,e,i){e=Yr(e),a.add(e,t).onsuccess=i}var r=t.createObjectStore("segment-v2"),a=t.createObjectStore("manifest-v2"),s=e.objectStore("segment"),o=e.objectStore("manifest");Hr(s,function(t,e,i){r.add({data:e.data},t).onsuccess=i},function(){Hr(o,n,i)})},Qr.prototype.init=function(t){var e=this.c;return Promise.resolve().then(function(){return Kr(e,t)}).then(function(t){this.b=t}.bind(this))},Qr.prototype.destroy=function(){return Promise.all(this.a.map(function(t){try{t.transaction.abort()}catch(t){}return t.M.catch(x)})).then(function(){this.b&&(this.b.close(),this.b=null)}.bind(this))},Qr.prototype.Ea=function(t){return ta(this,"manifest-v2",t)},oa.prototype.destroy=function(){var t=this.h,e=this.i,i=this.g||Promise.resolve();return e.length&&(i=i.then(function(){return ra(t,"segment-v2",e,null)})),this.b={},this.i=[],this.g=this.a=this.m=this.j=this.h=null,i},oa.prototype.s=function(t){this.c+=null==t.D?t.gc:t.D-t.N+1},Lo=ka.prototype,Lo.configure=function(){},Lo.start=function(t){var e=da(t);if(null==e)return Promise.reject(new h(2,1,9004,t));this.a=e;var i;return Aa().then(function(t){return i=t,i.Ea(e)}.bind(this)).then(function(t){if(!t)throw new h(2,9,9003,e);return Ia(t)}).then(function(t){return i.destroy().then(function(){return t})},function(t){return i.destroy().then(function(){throw t})})},Lo.stop=function(){return Promise.resolve()},Lo.update=function(){},Lo.onExpirationUpdated=function(t,e){var i,n=this.a;Aa().then(function(t){return i=t,i.Ea(n)}).then(function(r){if(r&&!(0>r.sessionIds.indexOf(t))&&(void 0==r.expiration||r.expiration>e))return r.expiration=e,ia(i,n,r)}).catch(function(){}).then(function(){return i.destroy()})},cu["application/x-offline-manifest"]=ka,e("shaka.offline.OfflineScheme",_a),_a.a=function(t){return t={uri:t,data:new ArrayBuffer(0),headers:{"content-type":"application/x-offline-manifest"}},Promise.resolve(t)},_a.b=function(t,e){var i,n;return Aa().then(function(e){return i=e,ta(i,"segment-v2",t)}).then(function(t){return n=t,i.destroy()}).then(function(){if(!n)throw new h(2,9,9003,t);return{uri:e,data:n.data,headers:{}}})},D("offline",_a),e("shaka.text.SimpleTextDisplayer",Pa),Pa.prototype.remove=function(t,e){return!!this.a&&(Ra(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),!0)},Pa.prototype.remove=Pa.prototype.remove,Pa.prototype.append=function(t){for(var e=[],i=0;i<t.length;i++){var n=xa(t[i]);n&&e.push(n)}e.slice().sort(function(t,i){return t.startTime!=i.startTime?t.startTime-i.startTime:t.endTime!=i.endTime?t.endTime-i.startTime:e.indexOf(i)-e.indexOf(t)}).forEach(function(t){this.a.addCue(t)}.bind(this))},Pa.prototype.append=Pa.prototype.append,Pa.prototype.destroy=function(){return this.a&&Ra(this,function(){return!0}),this.a=null,Promise.resolve()},Pa.prototype.destroy=Pa.prototype.destroy,Pa.prototype.isTextVisible=function(){return"showing"==this.a.mode},Pa.prototype.isTextVisible=Pa.prototype.isTextVisible,Pa.prototype.setTextVisibility=function(t){this.a.mode=t?"showing":"hidden"},Pa.prototype.setTextVisibility=Pa.prototype.setTextVisibility,Na.prototype.then=function(t){return this.a=this.a.then(t).then(function(t){return this.b?(this.g(),Promise.reject(this.h)):Promise.resolve(t)}.bind(this)),this},Na.prototype.cancel=function(t){return this.c?Promise.resolve():(this.b=!0,this.h=t,this.j.forEach(function(t){t()}),this.i)},i(Da),e("shaka.Player",Da),Da.prototype.destroy=function(){return this.F=!0,Ma(this).then(function(){var t=Promise.all([this.Ta,Ha(this),this.m?this.m.destroy():null,this.s?this.s.destroy():null]);return this.f=null,this.lb=!1,this.c=this.s=this.h=this.m=null,t}.bind(this))},Da.prototype.destroy=Da.prototype.destroy,Da.version="v2.3.0";var bu={};Da.registerSupportPlugin=function(t,e){bu[t]=e},Da.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&MediaSource.isTypeSupported&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},Da.probeSupport=function(){return xt().then(function(t){t={manifest:Vi(),media:Ht(),drm:t};for(var e in bu)t[e]=bu[e]();return t})},Da.prototype.load=function(t,e,i){var n=this.vb(),r=new Na;this.ha=r,this.dispatchEvent(new X("loading"));var a=Date.now();return La(r.then(function(){return n}).then(function(){return this.j=Xa(),H(this.m,this.f,"playing",this.ab.bind(this)),H(this.m,this.f,"pause",this.ab.bind(this)),H(this.m,this.f,"ended",this.ab.bind(this)),this.h=new this.c.abrFactory,this.h.configure(this.c.abr),this.u=new this.c.textDisplayFactory,this.u.setTextVisibility(this.lb),Hi(t,this.s,this.c.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.i=new e,this.i.configure(this.c.manifest),this.i.start(t,{networkingEngine:this.s,filterNewPeriod:this.mb.bind(this),filterAllPeriods:this.$b.bind(this),onTimelineRegionAdded:this.Xd.bind(this),onEvent:this.$a.bind(this),onError:this.Pa.bind(this)})}.bind(this)).then(function(e){if(e.periods.some(function(t){return t.variants.some(function(t){return t.video&&t.audio})})&&e.periods.forEach(function(t){t.variants=t.variants.filter(function(t){return t.video&&t.audio})}),0==e.periods.length)throw new h(2,4,4014);return this.b=e,this.yb=t,this.l=new pt({Wa:this.s,onError:this.Pa.bind(this),Pb:this.Id.bind(this),onExpirationUpdated:this.Fd.bind(this),onEvent:this.$a.bind(this)}),this.l.configure(this.c.drm),this.l.init(e,!1)}.bind(this)).then(function(){this.$b(this.b.periods),this.fb=Date.now()/1e3,this.Qa=this.c.preferredAudioLanguage,this.Ra=this.c.preferredTextLanguage;var t=this.b.presentationTimeline.T(),e=this.c.playRangeEnd,i=this.c.playRangeStart;return 0<i&&(this.P()||this.b.presentationTimeline.Oc(i)),e<t&&(this.P()||this.b.presentationTimeline.fa(e)),Promise.all([mt(this.l,this.f),this.ib])}.bind(this)).then(function(){return this.h.init(this.Ge.bind(this)),this.g=new Wn(this.f,this.b,this.c.streaming,void 0==e?null:e,this.Ee.bind(this),this.$a.bind(this)),this.w=new ar(this.f,this.K,this.b,this.c.streaming,this.Rc.bind(this),this.$a.bind(this),this.De.bind(this)),this.J=new Vt(this.f,this.K,this.u),this.a=new hr(this.b,{Ka:this.g,L:this.J,Wa:this.s,tc:this.Cd.bind(this),sc:this.ad.bind(this),onError:this.Pa.bind(this),onEvent:this.$a.bind(this),Jd:this.Kd.bind(this),Qb:this.Td.bind(this),filterNewPeriod:this.mb.bind(this),filterAllPeriods:this.$b.bind(this)}),this.a.configure(this.c.streaming),this.dispatchEvent(new X("streaming")),Ca(this),this.a.init()}.bind(this)).then(function(){if(this.c.streaming.startAtSegmentBoundary){var t=$a(this,Zn(this.g));Jn(this.g,t)}this.b.periods.forEach(this.mb.bind(this)),Za(this),Qa(this);var t=cr(this.a),e=de(t,this.Qa,this.cb);this.h.setVariants(e),t.variants.some(function(t){return t.primary}),this.jb.forEach(this.w.s.bind(this.w)),this.jb=[],K(this.m,this.f,"loadeddata",function(){this.j.loadLatency=(Date.now()-a)/1e3}.bind(this)),this.ha=null}.bind(this))).catch(function(t){return this.ha==r&&(this.ha=null,this.dispatchEvent(new X("unloading"))),Promise.reject(t)}.bind(this))},Da.prototype.load=Da.prototype.load,Da.prototype.configure=function(t){k(this.c,t,Ga(this),qa(),""),Ua(this)},Da.prototype.configure=Da.prototype.configure,Da.prototype.getConfiguration=function(){var t=Ga(this);return k(t,this.c,Ga(this),qa(),""),t},Da.prototype.getConfiguration=Da.prototype.getConfiguration,Da.prototype.se=function(){this.c=Ga(this),Ua(this)},Da.prototype.resetConfiguration=Da.prototype.se,Da.prototype.nd=function(){return this.f},Da.prototype.getMediaElement=Da.prototype.nd,Da.prototype.oc=function(){return this.s},Da.prototype.getNetworkingEngine=Da.prototype.oc,Da.prototype.nc=function(){return this.yb},Da.prototype.getManifestUri=Da.prototype.nc,Da.prototype.P=function(){return!!this.b&&this.b.presentationTimeline.P()},Da.prototype.isLive=Da.prototype.P,Da.prototype.wa=function(){return!!this.b&&this.b.presentationTimeline.wa()},Da.prototype.isInProgress=Da.prototype.wa,Da.prototype.yd=function(){if(!this.b||!this.b.periods.length)return!1;var t=this.b.periods[0].variants;return!!t.length&&!t[0].video},Da.prototype.isAudioOnly=Da.prototype.yd,Da.prototype.ue=function(){var t=0,e=0;return this.b&&(e=this.b.presentationTimeline,t=e.ja(),e=e.pb()),{start:t,end:e}},Da.prototype.seekRange=Da.prototype.ue,Da.prototype.keySystem=function(){return this.l?this.l.keySystem():""},Da.prototype.keySystem=Da.prototype.keySystem,Da.prototype.drmInfo=function(){return this.l?this.l.b:null},Da.prototype.drmInfo=Da.prototype.drmInfo,Da.prototype.ob=function(){return this.l?this.l.ob():1/0},Da.prototype.getExpiration=Da.prototype.ob,Da.prototype.rc=function(){return this.kb},Da.prototype.isBuffering=Da.prototype.rc,Da.prototype.vb=function(){return this.F?Promise.resolve():(this.dispatchEvent(new X("unloading")),Ma(this).then(function(){return this.Ta||(this.Ta=Ka(this).then(function(){this.Ta=null}.bind(this))),this.Ta}.bind(this)))},Da.prototype.unload=Da.prototype.vb,Da.prototype.Eb=function(){return this.g?this.g.Eb():0},Da.prototype.getPlaybackRate=Da.prototype.Eb,Da.prototype.Qe=function(t){this.g&&er(this.g,t),this.a&&yr(this.a,1!=t)},Da.prototype.trickPlay=Da.prototype.Qe,Da.prototype.bd=function(){this.g&&er(this.g,1),this.a&&yr(this.a,!1)},Da.prototype.cancelTrickPlay=Da.prototype.bd,Da.prototype.wd=function(){if(!this.b||!this.g)return[];var t=be(this.b,Zn(this.g)),e=this.A[t]||{};return oe(this.b.periods[t],e.audio,e.video)},Da.prototype.getVariantTracks=Da.prototype.wd,Da.prototype.vd=function(){if(!this.b||!this.g)return[];var t=be(this.b,Zn(this.g));return ue(this.b.periods[t],(this.A[t]||{}).text).filter(function(t){return 0>this.gb.indexOf(t.id)}.bind(this))},Da.prototype.getTextTracks=Da.prototype.vd,Da.prototype.xe=function(t){if(this.a){(t=ce(cr(this.a),t))&&(Fa(this,t,!1),this.Ca?this.W=t:gr(this.a,t,!0))}},Da.prototype.selectTextTrack=Da.prototype.xe,Da.prototype.ye=function(t,e){if(this.a){this.c.abr.enabled&&o("Changing tracks while abr manager is enabled will likely result in the selected track being overriden. Consider disabling abr before calling selectVariantTrack().");var i=cr(this.a);(i=he(i,t))&&le(i)&&(Ba(this,i,!1),Ya(this,i,e))}},Da.prototype.selectVariantTrack=Da.prototype.ye,Da.prototype.kd=function(){if(!this.a)return[];var t=cr(this.a),t=fe(t.variants).map(function(t){return t.audio}).filter(N);return ja(t)},Da.prototype.getAudioLanguagesAndRoles=Da.prototype.kd,Da.prototype.ud=function(){return this.a?ja(cr(this.a).textStreams):[]},Da.prototype.getTextLanguagesAndRoles=Da.prototype.ud,Da.prototype.jd=function(){return this.a?fe(cr(this.a).variants).map(function(t){return t.language}).filter(N):[]},Da.prototype.getAudioLanguages=Da.prototype.jd,Da.prototype.td=function(){return this.a?cr(this.a).textStreams.map(function(t){return t.language}).filter(N):[]},Da.prototype.getTextLanguages=Da.prototype.td,Da.prototype.ve=function(t,e){if(this.a){var i=cr(this.a);this.Qa=t,this.cb=e||"",Ja(this,i)}},Da.prototype.selectAudioLanguage=Da.prototype.ve,Da.prototype.we=function(t,e){if(this.a){var i=cr(this.a);this.Ra=t,this.bb=e||"",Ja(this,i)}},Da.prototype.selectTextLanguage=Da.prototype.we,Da.prototype.Ib=function(){return this.u?this.u.isTextVisible():this.lb},Da.prototype.isTextTrackVisible=Da.prototype.Ib,Da.prototype.Be=function(t){this.u&&this.u.setTextVisibility(t),this.lb=t,ts(this),this.a&&(t?(t=cr(this.a),t=pe(t,this.Ra,this.bb)[0],mr(this.a,t)):(t=this.a,t.w=!0,t.c.text&&(Br(t.c.text),delete t.c.text)))},Da.prototype.setTextTrackVisibility=Da.prototype.Be,Da.prototype.pd=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c+1e3*this.f.currentTime):null},Da.prototype.getPlayheadTimeAsDate=Da.prototype.pd,Da.prototype.rd=function(){return this.b?new Date(1e3*this.b.presentationTimeline.c):null},Da.prototype.getPresentationStartTimeAsDate=Da.prototype.rd,Da.prototype.Cb=function(){return this.J?this.J.Cb():{total:[],audio:[],video:[],text:[]}},Da.prototype.getBufferedInfo=Da.prototype.Cb,Da.prototype.getStats=function(){za(this),this.ab();var t=null,e=null,i=this.f,i=i&&i.getVideoPlaybackQuality?i.getVideoPlaybackQuality():{};if(this.g&&this.b){var n=be(this.b,Zn(this.g)),r=this.b.periods[n];(n=this.A[n])&&(e=ge(n.audio,n.video,r.variants),t=e.video||{})}return t||(t={}),e||(e={}),{width:t.width||0,height:t.height||0,streamBandwidth:e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.h?this.h.getBandwidthEstimate():NaN,loadLatency:this.j.loadLatency,playTime:this.j.playTime,bufferingTime:this.j.bufferingTime,switchHistory:I(this.j.switchHistory),stateHistory:I(this.j.stateHistory)}},Da.prototype.getStats=Da.prototype.getStats,Da.prototype.addTextTrack=function(t,e,i,n,r,a){if(!this.a)return Promise.reject();for(var s,o=cr(this.a),u=0;u<this.b.periods.length;u++)if(this.b.periods[u]==o){if(u==this.b.periods.length-1){if(s=this.b.presentationTimeline.T()-o.startTime,1/0==s)return Promise.reject()}else s=this.b.periods[u+1].startTime-o.startTime;break}var h={id:this.Yc++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new ui(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",kind:i,encrypted:!1,keyId:null,language:e,label:a||null,type:"text",primary:!1,trickModeVideo:null,containsEmsgBoxes:!1,roles:[],channelsCount:null};return this.gb.push(h.id),o.textStreams.push(h),mr(this.a,h).then(function(){if(!this.F){var t=this.b.periods.indexOf(o),n=pr(this.a,"text");return n&&(this.A[t].text=n.id),this.gb.splice(this.gb.indexOf(h.id),1),Ja(this,o),Za(this),{id:h.id,active:!1,type:"text",bandwidth:0,language:e,label:a||null,kind:i,width:null,height:null}}}.bind(this))},Da.prototype.addTextTrack=Da.prototype.addTextTrack,Da.prototype.Yb=function(t,e){this.hb.width=t,this.hb.height=e},Da.prototype.setMaxHardwareResolution=Da.prototype.Yb,Da.prototype.Kc=function(){if(this.a){var t=this.a;if(t.f)t=!1;else if(t.l)t=!1;else{for(var e in t.c){var i=t.c[e];i.Ua&&(i.Ua=!1,jr(t,i,.1))}t=!0}}else t=!1;return t},Da.prototype.retryStreaming=Da.prototype.Kc,Da.prototype.Ea=function(){return this.b},Da.prototype.getManifest=Da.prototype.Ea,Lo=Da.prototype,Lo.ed=function(t){var e=[1001,1002,1003];this.P()&&0<=e.indexOf(t.code)&&(t.severity=1,this.Kc())},Lo.$b=function(t){t.forEach(ie.bind(null,this.l,this.a?fr(this.a):null,this.a?dr(this.a):null));var e=B(t,function(t){return t.variants.some(le)});if(!e)throw new h(2,4,9009);if(e<t.length)throw new h(2,4,4011);t.forEach(function(t){if(ee(t,this.c.restrictions,this.hb)&&this.a&&cr(this.a)==t&&Za(this),!t.variants.some(le))throw new h(2,4,4012)}.bind(this))},Lo.mb=function(t){ie(this.l,this.a?fr(this.a):null,this.a?dr(this.a):null,t);var e=t.variants,i=e.some(le);if(ee(t,this.c.restrictions,this.hb)&&this.a&&cr(this.a)==t&&Za(this),t=e.some(le),!i)throw new h(2,4,4011);if(!t)throw new h(2,4,4012)},Lo.Fe=function(t,e){this.h&&this.h.segmentDownloaded(t,e)},Lo.Rc=function(t){if(za(this),this.kb=t,this.ab(),this.g){var e=this.g;t!=e.j&&(e.j=t,er(e,e.i))}this.dispatchEvent(new X("buffering",{buffering:t}))},Lo.De=function(){Za(this)},Lo.ab=function(){if(!this.F){var t=this.kb?"buffering":this.f.ended?"ended":this.f.paused?"paused":"playing",e=Date.now()/1e3;if(this.j.stateHistory.length){var i=this.j.stateHistory[this.j.stateHistory.length-1];if(i.duration=e-i.timestamp,t==i.state)return}this.j.stateHistory.push({timestamp:e,state:t,duration:0})}},Lo.Ee=function(){if(this.w){var t=this.w;t.c.forEach(t.m.bind(t,!0))}this.a&&br(this.a)},Lo.Cd=function(t){this.Ca=!0,this.h.disable();var e={audio:!1,text:!1},i=de(t,this.Qa,this.cb,e);return t=pe(t,this.Ra,this.bb,e),i=Wa(this,i),t=t[0]||null,this.W=this.Sa=null,i&&Ba(this,i,!0),t&&(Fa(this,t,!0),!lr(this.a)&&i&&i.audio&&e.text&&t.language!=i.audio.language&&(this.u.setTextVisibility(!0),ts(this))),this.Ib()?{variant:i,text:t}:{variant:i,text:null}},Lo.ad=function(){this.Ca=!1,this.c.abr.enabled&&this.h.enable(),this.Sa&&(vr(this.a,this.Sa,this.fc),this.Sa=null),this.W&&(gr(this.a,this.W,!0),this.W=null)},Lo.Kd=function(){this.i&&this.i.update&&this.i.update()},Lo.Td=function(){this.g&&this.g.Qb()},Lo.Ge=function(t,e){Ba(this,t,!0),this.a&&(vr(this.a,t,e||!1),Qa(this))},Lo.Pa=function(t){if(!this.F){var e=new X("error",{detail:t});this.dispatchEvent(e),e.defaultPrevented&&(t.handled=!0)}},Lo.Xd=function(t){this.w?this.w.s(t):this.jb.push(t)},Lo.$a=function(t){this.dispatchEvent(t)},Lo.Yd=function(){if(this.f.error){var t=this.f.error.code;if(1!=t){var e=this.f.error.msExtendedCode;e&&(0>e&&(e+=Math.pow(2,32)),e=e.toString(16)),this.Pa(new h(2,3,3016,t,e,this.f.error.message))}}},Lo.Id=function(t){var e=["output-restricted","internal-error"],i=cr(this.a),n=!1,r=Object.keys(t),a=1==r.length&&"00"==r[0];r.length&&i.variants.forEach(function(i){var r=[];i.audio&&r.push(i.audio),i.video&&r.push(i.video),r.forEach(function(r){var s=i.allowedByKeySystem;r.keyId&&(r=t[a?"00":r.keyId],i.allowedByKeySystem=!!r&&0>e.indexOf(r)),s!=i.allowedByKeySystem&&(n=!0)})}),(r=ve(fr(this.a),dr(this.a),i.variants))&&!r.allowedByKeySystem&&Ja(this,i),n&&Za(this)},Lo.Fd=function(t,e){this.i&&this.i.onExpirationUpdated&&this.i.onExpirationUpdated(t,e),this.dispatchEvent(new X("expirationupdated"))},e("shaka.offline.Storage",es),es.support=is,es.prototype.destroy=function(){var t=this.g,e=this.c?this.c.destroy().catch(function(){}).then(function(){if(t)return t.destroy()}):Promise.resolve();return this.b=this.a=this.c=this.g=null,e},es.prototype.destroy=es.prototype.destroy,es.prototype.configure=function(t){k(this.b,t,os(this),{},"")},es.prototype.configure=es.prototype.configure,es.prototype.Oe=function(t,e,i){function n(t){a=t}if(this.l)return Promise.reject(new h(2,9,9006));this.l=!0;var r=e||{},a=null;return us(this).then(function(){return ps(this),ss(this,t,n,i)}.bind(this)).then(function(e){if(ps(this),a)throw a;return ns(this,t,e.manifest,r,e.fd)}.bind(this)).then(function(t){return ps(this),hs(this).then(function(){return t})}.bind(this)).catch(function(t){return a=a||t,hs(this).then(function(){throw a})}.bind(this))},es.prototype.store=es.prototype.Oe,es.prototype.remove=function(t){return t.offlineUri?(o("Removing downloaded content using shakaExtern.StoredContent is deprecated. Please remove using the offline uri."),rs(this,t.offlineUri)):rs(this,t)},es.prototype.remove=es.prototype.remove,es.prototype.list=function(){var t=[];return us(this).then(function(){return ps(this),Zr(this.g,function(e,i){var n=ma("offline:manifest/"+e,i);t.push(n)})}.bind(this)).then(function(){return t})},es.prototype.list=es.prototype.list,es.prototype.u=function(t){for(var e,i=[],n=Zt(this.a.getConfiguration().preferredAudioLanguage),r=[0,qo,Go],a=t.filter(function(t){return"variant"==t.type}),r=r.map(function(t){return a.filter(function(e){return e=Zt(e.language),Qt(t,n,e)})}),s=0;s<r.length;s++)if(r[s].length){e=r[s];break}e||(r=a.filter(function(t){return t.primary}),r.length&&(e=r)),e||(e=a,a.map(function(t){return t.language}).filter(N));var o=e.filter(function(t){return t.height&&480>=t.height});return o.length&&(o.sort(function(t,e){return e.height-t.height}),e=o.filter(function(t){return t.height==o[0].height})),e.sort(function(t,e){return t.bandwidth-e.bandwidth}),e.length&&i.push(e[Math.floor(e.length/2)]),i.push.apply(i,t.filter(function(t){return"text"==t.type})),i},es.prototype.j=function(t){t.forEach(this.m.bind(this))},es.prototype.m=function(t){var e=null;if(this.i){var i=this.i.filter(function(t){return"variant"==t.type})[0];i&&(e=he(t,i))}var n=i=null;e&&(e.audio&&(i=e.audio),e.video&&(n=e.video)),ie(this.f,i,n,t),ee(t,this.a.getConfiguration().restrictions,{width:1/0,height:1/0})},es.prototype.w=function(t){var e,i,n=oe(t,null,null),r=ue(t,null),n=this.b.trackSelectionCallback(n.concat(r));for(this.i||(this.i=n,this.j(this.h.periods)),r=n.length-1;0<r;--r){var a=!1;for(i=r-1;0<=i;--i)if(n[r].type==n[i].type&&n[r].kind==n[i].kind&&n[r].language==n[i].language){a=!0;break}if(a)break}for(a=[],r=0;r<n.length;r++)(e=he(t,n[r]))?(e.audio&&((i=a.filter(function(t){return t.id==e.audio.id})[0])?i.variantIds.push(e.id):(i=e.video?e.bandwidth/2:e.bandwidth,a.push(fs(this,e.audio,i,e.id)))),e.video&&((i=a.filter(function(t){return t.id==e.video.id})[0])?i.variantIds.push(e.id):(i=e.audio?e.bandwidth/2:e.bandwidth,a.push(fs(this,e.video,i,e.id))))):a.push(fs(this,ce(t,n[r]),0));return{startTime:t.startTime,streams:a}},bu.offline=is,e("shaka.polyfill.installAll",function(){for(var t=0;t<Tu.length;++t)Tu[t]()});var Tu=[];e("shaka.polyfill.register",ys),ys(function(){if(t.Document){var e=Element.prototype;e.requestFullscreen=e.requestFullscreen||e.mozRequestFullScreen||e.msRequestFullscreen||e.webkitRequestFullscreen,e=Document.prototype,e.exitFullscreen=e.exitFullscreen||e.mozCancelFullScreen||e.msExitFullscreen||e.webkitExitFullscreen,"fullscreenElement"in document||(Object.defineProperty(document,"fullscreenElement",{get:function(){return document.mozFullScreenElement||document.msFullscreenElement||document.webkitFullscreenElement}}),Object.defineProperty(document,"fullscreenEnabled",{get:function(){return document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled}})),document.addEventListener("webkitfullscreenchange",vs),document.addEventListener("webkitfullscreenerror",vs),document.addEventListener("mozfullscreenchange",vs),document.addEventListener("mozfullscreenerror",vs),document.addEventListener("MSFullscreenChange",vs),document.addEventListener("MSFullscreenError",vs)}}),ys(function(){var e=navigator.userAgent;e&&0<=e.indexOf("CrKey")&&delete t.indexedDB});var wu;ys(function(){0>navigator.userAgent.indexOf("Trident/")||HTMLInputElement.prototype.addEventListener==gs||(wu=HTMLInputElement.prototype.addEventListener,HTMLInputElement.prototype.addEventListener=gs)}),ys(function(){if(4503599627370497!=Math.round(4503599627370497)){var t=Math.round;Math.round=function(e){var i=e;return 4503599627370496>=e&&(i=t(e)),i}}}),bs.prototype.c=function(t){if(!(1<t.version)){var e=lt(t.o.Ma(16)),i=[];if(0<t.version)for(var n=t.o.B(),r=0;r<n;++r){var a=lt(t.o.Ma(16));i.push(a)}n=t.o.B(),t.o.H(n),this.b.push.apply(this.b,i),this.f.push(e),this.a.push({start:t.start,end:t.start+t.size-1})}},ws.prototype.createMediaKeys=function(){var t=new Ss(this.keySystem);return Promise.resolve(t)},ws.prototype.getConfiguration=function(){return this.a},Ss.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new ks(this.a)},Ss.prototype.setServerCertificate=function(){return Promise.resolve(!1)},i(ks),Lo=ks.prototype,Lo.generateRequest=function(t,e){this.a=new b;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),H(this.f,this.c,"mskeymessage",this.Od.bind(this)),H(this.f,this.c,"mskeyadded",this.Md.bind(this)),H(this.f,this.c,"mskeyerror",this.Nd.bind(this)),Ps(this,"status-pending")}catch(t){this.a.reject(t)}return this.a},Lo.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},Lo.update=function(t){this.b=new b;try{this.c.update(new Uint8Array(t))}catch(t){this.b.reject(t)}return this.b},Lo.close=function(){try{this.c.close(),this.closed.resolve(),q(this.f)}catch(t){this.closed.reject(t)}return this.closed},Lo.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},Lo.Od=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new X("message",{messageType:void 0==this.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message.buffer}))},Lo.Md=function(){this.a?(Ps(this,"usable"),this.a.resolve(),this.a=null):this.b&&(Ps(this,"usable"),this.b.resolve(),this.b=null)},Lo.Nd=function(){var t=Error("EME PatchedMediaKeysMs key error");if(t.errorCode=this.c.error,this.a)this.a.reject(t),this.a=null;else if(this.b)this.b.reject(t),this.b=null;else switch(this.c.error.code){case MSMediaKeyError.MS_MEDIA_KEYERR_OUTPUT:case MSMediaKeyError.MS_MEDIA_KEYERR_HARDWARECHANGE:Ps(this,"output-not-allowed");default:Ps(this,"internal-error")}};var Eu;Lo=xs.prototype,Lo.forEach=function(t){this.a&&t(this.a,Eu)},Lo.get=function(t){if(this.has(t))return this.a},Lo.has=function(t){var e=Eu;return!(!this.a||!ft(new Uint8Array(t),new Uint8Array(e)))},Lo.entries=function(){},Lo.keys=function(){},Lo.values=function(){},Ls.prototype.createSession=function(){},Ls.prototype.setServerCertificate=function(){},Ds.prototype.getConfiguration=function(){},Ds.prototype.createMediaKeys=function(){};var Su="";js.prototype.createMediaKeys=function(){var t=new Bs(this.a);return Promise.resolve(t)},js.prototype.getConfiguration=function(){return this.b},Lo=Bs.prototype,Lo.createSession=function(t){var e=t||"temporary";if("temporary"!=e&&"persistent-license"!=e)throw new TypeError("Session type "+t+" is unsupported on this platform.");return t=this.b||document.createElement("video"),t.src||(t.src="about:blank"),e=new Hs(t,this.g,e),this.c.push(e),e},Lo.setServerCertificate=function(){return Promise.resolve(!1)},Lo.be=function(t){var e=document.createEvent("CustomEvent");e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="webm",e.initData=t.initData,this.b.dispatchEvent(e)},Lo.ae=function(t){var e=Vs(this,t.sessionId);e&&(t=new X("message",{messageType:void 0==e.keyStatuses.a?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},Lo.Zd=function(t){(t=Vs(this,t.sessionId))&&(qs(t,"usable"),t.a&&t.a.resolve(),t.a=null)},Lo.$d=function(t){var e=Vs(this,t.sessionId);if(e){var i=Error("EME v0.1b key error");i.errorCode=t.errorCode,i.errorCode.systemCode=t.systemCode,!t.sessionId&&e.b?(i.method="generateRequest",45==t.systemCode&&(i.message="Unsupported session type."),e.b.reject(i),e.b=null):t.sessionId&&e.a?(i.method="update",e.a.reject(i),e.a=null):(i=t.systemCode,t.errorCode.code==MediaKeyError.MEDIA_KEYERR_OUTPUT?qs(e,"output-restricted"):1==i?qs(e,"expired"):qs(e,"internal-error"))}},i(Hs),Lo=Hs.prototype,Lo.ac=function(t,e){if(this.a)this.a.then(this.ac.bind(this,t,e)).catch(this.ac.bind(this,t,e));else{if(this.a=t,"webkit-org.w3.clearkey"==this.c){var i=tt(e),n=JSON.parse(i);"oct"!=n.keys[0].kty&&(this.a.reject(Error("Response is not a valid JSON Web Key Set.")),this.a=null),i=ht(n.keys[0].k),n=ht(n.keys[0].kid)}else i=new Uint8Array(e),n=null;var r=Cs("addKey");try{this.f[r](this.c,i,n,this.sessionId)}catch(t){this.a.reject(t),this.a=null}}},Lo.generateRequest=function(t,e){return Ks(this,e,null)},Lo.load=function(t){return"persistent-license"==this.g?Ks(this,null,t):Promise.reject(Error("Not a persistent session."))},Lo.update=function(t){var e=new b;return this.ac(e,t),e},Lo.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;var t=Cs("cancelKeyRequest");try{this.f[t](this.c,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},Lo.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var Au;Lo=Gs.prototype,Lo.forEach=function(t){this.a&&t(this.a,Au)},Lo.get=function(t){if(this.has(t))return this.a},Lo.has=function(t){var e=Au;return!(!this.a||!ft(new Uint8Array(t),new Uint8Array(e)))},Lo.entries=function(){},Lo.keys=function(){},Lo.values=function(){},ys(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?Ms("webkit"):HTMLMediaElement.prototype.generateKeyRequest?Ms(""):t.MSMediaKeys?(Eu=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Es,t.MediaKeys=Ss,t.MediaKeySystemAccess=ws,navigator.requestMediaKeySystemAccess=Ts):(navigator.requestMediaKeySystemAccess=Rs,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=Ns,t.MediaKeys=Ls,t.MediaKeySystemAccess=Ds))}),ys(function(){if(t.MediaSource)if(t.cast&&cast.__platform__&&cast.__platform__.canDisplayType)Qs();else if(navigator.vendor&&0<=navigator.vendor.indexOf("Apple")){var e=navigator.appVersion;Js(),0<=e.indexOf("Version/8")?t.MediaSource=null:0<=e.indexOf("Version/9")?Xs():0<=e.indexOf("Version/10")?(Xs(),zs()):0<=e.indexOf("Version/11")&&(Xs(),Ys())}});var ku=0;Zs.prototype.then=function(t,e){var i=new Zs;switch(this.Aa){case 1:ro(this,i,t);break;case 2:ro(this,i,e);break;case ku:this.c.push({M:i,zb:t}),this.b.push({M:i,zb:e})}return i},Zs.prototype.catch=function(t){return this.then(void 0,t)},Zs.prototype.la=function(t){if(this.Aa==ku){for(this.f=t,this.Aa=1,t=0;t<this.c.length;++t)ro(this,this.c[t].M,this.c[t].zb);this.c=[],this.b=[]}},Zs.prototype.a=function(t){if(this.Aa==ku){for(this.f=t,this.Aa=2,t=0;t<this.b.length;++t)ro(this,this.b[t].M,this.b[t].zb);this.c=[],this.b=[]}};var Iu=null,_u=[];ys(function(e){t.setImmediate?(oo=function(e){return t.setImmediate(e)},uo=function(e){return t.clearImmediate(e)}):(oo=function(e){return t.setTimeout(e,0)},uo=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=Zs,t.Promise.resolve=to,t.Promise.reject=eo,t.Promise.all=io,t.Promise.race=no,t.Promise.prototype.then=Zs.prototype.then,t.Promise.prototype.catch=Zs.prototype.catch)}),ys(function(){if(t.HTMLMediaElement){var e=HTMLMediaElement.prototype.play;HTMLMediaElement.prototype.play=function(){var t=e.apply(this,arguments);return t&&t.catch(function(){}),t}}}),ys(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=ho)}}),ys(function(){if(!t.VTTCue&&t.TextTrackCue){var e=TextTrackCue.length;if(3==e)t.VTTCue=co;else if(6==e)t.VTTCue=lo;else{try{var i=!!co(1,2,"")}catch(t){i=!1}i&&(t.VTTCue=co)}}}),e("shaka.text.Cue",fo);var Pu="auto";fo.positionAlign={LEFT:"line-left",RIGHT:"line-right",CENTER:"center",AUTO:Pu};var xu="center",Ru={LEFT:"left",RIGHT:"right",CENTER:xu,START:"start",END:"end"};fo.textAlign=Ru;var Nu="before",Lu={BEFORE:Nu,CENTER:"center",AFTER:"after"};fo.displayAlign=Lu;var Du=0,Mu=2,Cu=3;fo.writingDirection={HORIZONTAL_LEFT_TO_RIGHT:Du,HORIZONTAL_RIGHT_TO_LEFT:1,VERTICAL_LEFT_TO_RIGHT:Mu,VERTICAL_RIGHT_TO_LEFT:Cu};var Ou=0,Uu=1;fo.lineInterpretation={LINE_NUMBER:Ou,PERCENTAGE:Uu};var ju="center",Bu={CENTER:ju,START:"start",END:"end"};fo.lineAlign=Bu;var Fu=400;fo.fontWeight={NORMAL:Fu,BOLD:700};var Vu="normal",Hu={NORMAL:Vu,ITALIC:"italic",OBLIQUE:"oblique"};fo.fontStyle=Hu,fo.textDecoration={UNDERLINE:"underline",LINE_THROUGH:"lineThrough",OVERLINE:"overline"},po.prototype.parseInit=function(){},po.prototype.parseMedia=function(t,e){var i=tt(t),n=[],r=new DOMParser,a=null;try{a=r.parseFromString(i,"text/xml")}catch(t){throw new h(2,2,2005)}if(a){var s=a.getElementsByTagName("tt")[0];if(!s)throw new h(2,2,2005);r=s.getAttribute("ttp:frameRate"),a=s.getAttribute("ttp:subFrameRate");var o=s.getAttribute("ttp:frameRateMultiplier"),u=s.getAttribute("ttp:tickRate");if("default"!=(i=s.getAttribute("xml:space")||"default")&&"preserve"!=i)throw new h(2,2,2005);for(i="default"==i,r=new Ao(r,a,o,u),a=mo(s.getElementsByTagName("styling")[0]),o=mo(s.getElementsByTagName("layout")[0]),s=mo(s.getElementsByTagName("body")[0]),u=0;u<s.length;u++){var c=s[u],l=e.periodStart,f=r,d=a,p=o,m=i;if(c.hasAttribute("begin")||c.hasAttribute("end")||!/^\s*$/.test(c.textContent)){yo(c,m);var m=Eo(c.getAttribute("begin"),f),y=Eo(c.getAttribute("end"),f),f=Eo(c.getAttribute("dur"),f),v=c.textContent;if(null==y&&null!=f&&(y=m+f),null==m||null==y)throw new h(2,2,2001);l=new fo(m+l,y+l,v),m=wo(c,"region",p),p=l,"rtl"==go(c,m,d,"tts:direction")&&(p.writingDirection=1),y=go(c,m,d,"tts:writingMode"),"tb"==y||"tblr"==y?p.writingDirection=Mu:"tbrl"==y?p.writingDirection=Cu:"rltb"==y||"rl"==y?p.writingDirection=1:y&&(p.writingDirection=Du),(y=go(c,m,d,"tts:origin"))&&(y=$u.exec(y))&&(p.region.x=Number(y[1]),p.region.y=Number(y[2])),(y=go(c,m,d,"tts:extent"))&&(y=$u.exec(y))&&(p.region.width=Number(y[1]),p.region.height=Number(y[2])),(y=go(c,m,d,"tts:textAlign"))&&(p.positionAlign=Qu[y],p.lineAlign=Ju[y],p.textAlign=Ru[y.toUpperCase()]),(y=go(c,m,d,"tts:displayAlign"))&&(p.displayAlign=Lu[y.toUpperCase()]),(y=go(c,m,d,"tts:color"))&&(p.color=y),(y=go(c,m,d,"tts:backgroundColor"))&&(p.backgroundColor=y),(y=go(c,m,d,"tts:fontFamily"))&&(p.fontFamily=y),(y=go(c,m,d,"tts:fontWeight"))&&"bold"==y&&(p.fontWeight=700),(y=go(c,m,d,"tts:wrapOption"))&&"noWrap"==y&&(p.wrapLine=!1),(y=go(c,m,d,"tts:lineHeight"))&&y.match(Wu)&&(p.lineHeight=y),(y=go(c,m,d,"tts:fontSize"))&&y.match(Wu)&&(p.fontSize=y),(y=go(c,m,d,"tts:fontStyle"))&&(p.fontStyle=Hu[y.toUpperCase()]),(m=bo(m,d,"tts:textDecoration"))&&vo(p,m),(c=To(c,d,"tts:textDecoration"))&&vo(p,c)}else l=null;l&&n.push(l)}}return n};var Ku=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,qu=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,Gu=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,Xu=/^(\d*\.?\d*)f$/,Yu=/^(\d*\.?\d*)t$/,zu=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,$u=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,Wu=/^(\d+px|\d+em)$/,Ju={left:"start",center:"center",right:"end",start:"start",end:"end"},Qu={left:"line-left",center:"center",right:"line-right"};Ko["application/ttml+xml"]=po,ko.prototype.parseInit=function(t){var e=!1;if((new li).C("moov",fi).C("trak",fi).C("mdia",fi).C("minf",fi).C("stbl",fi).ba("stsd",di).C("stpp",function(t){e=!0,t.oa.stop()}).parse(t),!e)throw new h(2,2,2007)},ko.prototype.parseMedia=function(t,e){var i=!1,n=[];if((new li).C("mdat",pi(function(t){i=!0,n=n.concat(this.a.parseMedia(t,e))}.bind(this))).parse(t),!i)throw new h(2,2,2007);return n},Ko['application/mp4; codecs="stpp"']=ko,Ko['application/mp4; codecs="stpp.TTML.im1t"']=ko,Io.prototype.parseInit=function(){},Io.prototype.parseMedia=function(t,e){var i=tt(t),i=i.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),i=i.split(/\n{2,}/m);if(!/^WEBVTT($|[ \t\n])/m.test(i[0]))throw new h(2,2,2e3);var n=e.segmentStart;if(0<=i[0].indexOf("X-TIMESTAMP-MAP")){var r=i[0].match(/LOCAL:((?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3}))/m),a=i[0].match(/MPEGTS:(\d+)/m);r&&a&&(n=Po(new mn(r[1])),n=e.periodStart+(Number(a[1])/9e4-n))}for(a=[],r=1;r<i.length;r++){var s=i[r].split("\n"),o=n;if(1==s.length&&!s[0]||/^NOTE($|[ \t])/.test(s[0])||"STYLE"==s[0])var u=null;else{u=null,0>s[0].indexOf("--\x3e")&&(u=s[0],s.splice(0,1));var c=new mn(s[0]),l=Po(c),f=yn(c,/[ \t]+--\x3e[ \t]+/g),d=Po(c);if(null==l||!f||null==d)throw new h(2,2,2001);for(s=new fo(l+o,d+o,s.slice(1).join("\n").trim()),yn(c,/[ \t]+/gm),o=vn(c);o;)_o(s,o),yn(c,/[ \t]+/gm),o=vn(c);null!=u&&(s.id=u),u=s}u&&a.push(u)}return a},Ko["text/vtt"]=Io,Ko['text/vtt; codecs="vtt"']=Io,xo.prototype.parseInit=function(t){var e=!1;if((new li).C("moov",fi).C("trak",fi).C("mdia",fi).ba("mdhd",function(t){0==t.version?(t.o.H(4),t.o.H(4),this.a=t.o.B(),t.o.H(4)):(t.o.H(8),t.o.H(8),this.a=t.o.B(),t.o.H(8)),t.o.H(4)}.bind(this)).C("minf",fi).C("stbl",fi).ba("stsd",di).C("wvtt",function(){e=!0}).parse(t),!this.a)throw new h(2,2,2008);if(!e)throw new h(2,2,2008)},xo.prototype.parseMedia=function(t,e){if(!this.a)throw new h(2,2,2008);var i=0,n=[],r=[],a=[],s=!1,o=!1,u=!1,c=null;if((new li).C("moof",fi).C("traf",fi).ba("tfdt",function(t){s=!0,i=t.version?t.o.Na():t.o.B()}).ba("tfhd",function(t){var e=t.lc;t=t.o,t.H(4),1&e&&t.H(8),2&e&&t.H(4),c=8&e?t.B():null}).ba("trun",function(t){o=!0;var e=t.version,i=t.lc;t=t.o;var r=t.B();1&i&&t.H(4),4&i&&t.H(4);for(var a=[],s=0;s<r;s++){var u={duration:null,bc:null};256&i&&(u.duration=t.B()),512&i&&t.H(4),1024&i&&t.H(4),2048&i&&(u.bc=e?t.Hc():t.B()),a.push(u)}n=a}).C("vtte",function(){r.push(null)}).C("vttc",pi(function(t){r.push(t)})).C("mdat",function(t){u=!0,fi(t)}).parse(t),!u&&!s&&!o)throw new h(2,2,2008);for(var l=i,f=0;f<n.length;f++){var d=n[f],p=r[f],m=d.duration||c;m&&(d=d.bc?i+d.bc:l,l=d+m,p&&a.push(Ro(p,e.periodStart+d/this.a,e.periodStart+l/this.a)))}return a.filter(R)},Ko['application/mp4; codecs="wvtt"']=xo}).call(r,this),void 0!==t&&t.exports?t.exports=r.shaka:void 0!==(n=function(){return r.shaka}.call(e,i,e,t))&&(t.exports=n)}()}])}); //# sourceMappingURL=dash-shaka-playback.min.js.map
\ No newline at end of file |