forked from clappr/dash-shaka-playback
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdash-shaka-playback.js
5 lines (5 loc) · 132 KB
/
dash-shaka-playback.js
1
2
3
4
5
!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)}(this,function(t){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}([function(t,e,i){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(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 a=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}}(),o=function(t,e,i){for(var n=!0;n;){var r=t,s=e,a=i;n=!1,null===r&&(r=Function.prototype);var o=Object.getOwnPropertyDescriptor(r,s);if(void 0!==o){if("value"in o)return o.value;var u=o.get;if(void 0===u)return;return u.call(a)}var h=Object.getPrototypeOf(r);if(null===h)return;t=h,e=s,i=a,n=!0,o=h=void 0}},u=i(2),h=i(1),c=n(h),f=3e4,l=-1,d="shaka:ready",p=function(t){function e(t){r(this,e),o(Object.getPrototypeOf(e.prototype),"constructor",this).call(this,t),this._levels=[],t.autoPlay&&this.play()}return s(e,t),a(e,[{key:"name",get:function(){return"dash_shaka_playback"}},{key:"shakaVersion",get:function(){return c["default"].player.Player.version}},{key:"levels",get:function(){return this._levels}},{key:"currentLevel",set:function(t){var e=this;this._currentLevelId=t;var i=this._currentLevelId===l;this._player.configure({abr:{enable:!i}}),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_START),i||this.selectTrack(this.videoTracks.filter(function(t){return t.id===e._currentLevelId})[0]),this.trigger(u.Events.PLAYBACK_LEVEL_SWITCH_END)},get:function(){return this._currentLevelId||l}}]),a(e,[{key:"play",value:function(){return!this._player&&this._setup(),this.isReady?(this._src=this.el.src,void o(Object.getPrototypeOf(e.prototype),"play",this).call(this)):void this.once(d,this.play)}},{key:"setupSrc",value:function(){}},{key:"_ready",value:function(){}},{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!!this.highDefinition}},{key:"stop",value:function(){var t=this;clearInterval(this.sendStatsId),this._sendStats(),this._player.unload().then(function(){o(Object.getPrototypeOf(e.prototype),"stop",t).call(t),t._player=null,t._isShakaReadyState=!1})["catch"](function(){u.Log.error("shaka could not be unloaded")})}},{key:"getPlaybackType",value:function(){return(this._player&&this._player.isLive()?"live":"vod")||""}},{key:"selectTrack",value:function(t){this._player.selectTrack(t),this._onAdaptation()}},{key:"destroy",value:function(){var t=this;clearInterval(this.sendStatsId),this._player?this._destroy():this._player.destroy().then(function(){return t._destroy()})["catch"](function(){t._destroy(),u.Log.error("shaka could not be destroyed")})}},{key:"_setup",value:function(){var t=this;this._isShakaReadyState=!1,this._player=this._createPlayer(),this._options.shakaConfiguration&&this._player.configure(this._options.shakaConfiguration);var e=this._player.load(this._options.src);e.then(function(){return t._loaded()})["catch"](function(e){return t._setupError(e)})}},{key:"_createPlayer",value:function(){var t=this,e=new c["default"].Player(this.el);return e.addEventListener("error",function(e,i){return t._error(e,i)}),e.addEventListener("adaptation",function(){return t._onAdaptation()}),e.addEventListener("buffering",function(e){return t._onBuffering(e)}),e}},{key:"_onBuffering",value:function(t){var e=t.buffering?u.Events.PLAYBACK_BUFFERING:u.Events.PLAYBACK_BUFFERFULL;this.trigger(e)}},{key:"_loaded",value:function(){this._isShakaReadyState=!0,this.trigger(d),this._shakaReady(),this._startToSendStats(),this._fillLevels()}},{key:"_fillLevels",value:function(){0===this._levels.length&&(this._levels=this.videoTracks.map(function(t){return{id:t.id,label:t.height+"p"}}).reverse(),this.trigger(u.Events.PLAYBACK_LEVELS_AVAILABLE,this.levels))}},{key:"_startToSendStats",value:function(){var t=this;this.sendStatsId=setInterval(function(){return t._sendStats()},f)}},{key:"_sendStats",value:function(){this.trigger(u.Events.PLAYBACK_STATS_ADD,this._player.getStats())}},{key:"_setupError",value:function(t){this._error("error",{detail:t.detail})}},{key:"_error",value:function(t,i){u.Log.error("an error was raised support=",e.support),u.Log.error("an error was raised by shaka player",i.detail),this.trigger(u.Events.PLAYBACK_ERROR,i.detail,this.name)}},{key:"_onAdaptation",value:function(){var t=this.videoTracks.filter(function(t){return t.active===!0})[0];this._fillLevels(),u.Log.debug("an adaptation has happened:",t),this.highDefinition=t.height>=720,this.trigger(u.Events.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(u.Events.PLAYBACK_BITRATE,{bandwidth:t.bandwidth,width:t.width,height:t.height,level:t.id})}},{key:"_destroy",value:function(){o(Object.getPrototypeOf(e.prototype),"destroy",this).call(this),this._isShakaReadyState=!1,u.Log.debug("shaka was destroyed")}},{key:"_shakaReady",value:function(){o(Object.getPrototypeOf(e.prototype),"_ready",this).call(this)}},{key:"isReady",get:function(){return this._isShakaReadyState}},{key:"textTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"text"===t.type})}},{key:"audioTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"audio"===t.type})}},{key:"videoTracks",get:function(){return this._player&&this._player.getTracks().filter(function(t){return"video"===t.type})}}]),e}(u.HTML5Video);e["default"]=p,p.canPlay=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)},t.exports=e["default"]},function(t,e,i){var n;!function(){var r={};(function(t){function e(t,e){var i=t.split("."),n=Fr;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=Ie;e.prototype=i.prototype,t.kd=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.dd=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);t.a=i*(1-n)+n*t.a,t.b+=e}function s(t){return t.a/(1-Math.pow(t.c,t.b))}function a(){this.c=new n(2),this.f=new n(5),this.a=0,this.b=5e5}function o(t){return 128e3>t.a?t.b:Math.min(s(t.c),s(t.f))}function u(){}function h(){}function c(){this.h=null,this.f=!1,this.b=new a,this.g={},this.a={},this.i=!1,this.c=null}function f(t){return(t=t.g.audio)?(t=d(t),t[Math.floor(t.length/2)]):null}function l(t){var e=t.g.video;if(!e)return null;var e=d(e),i=t.a.audio,i=i&&i.bandwidth||0;t=o(t.b);for(var n=e[0],r=0;r<e.length;++r){var s=e[r],a=r+1<e.length?e[r+1]:{bandwidth:1/0};s.bandwidth&&(a=(a.bandwidth+i)/.85,t>=(s.bandwidth+i)/.95&&t<=a&&(n=s))}return n}function d(t){return t.streams.slice(0).filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function p(t){var e;t instanceof p?(m(this,t.R),this.ka=t.ka,this.T=t.T,b(this,t.wa),this.O=t.O,y(this,T(t.a)),this.ca=t.ca):t&&(e=String(t).match(Kr))?(m(this,e[1]||"",!0),this.ka=g(e[2]||""),this.T=g(e[3]||"",!0),b(this,e[4]),this.O=g(e[5]||"",!0),y(this,e[6]||"",!0),this.ca=g(e[7]||"")):this.a=new S(null)}function m(t,e,i){t.R=i?g(e,!0):e,t.R&&(t.R=t.R.replace(/:$/,""))}function b(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.wa=e}else t.wa=null}function y(t,e,i){e instanceof S?t.a=e:(i||(e=v(e,Gr)),t.a=new S(e))}function g(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function v(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,w),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function w(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function S(t){this.b=t||null}function T(t){var e=new S;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 E(t,e,i){this.category=t,this.code=e,this.data=Array.prototype.slice.call(arguments,2)}function k(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 A(){}function _(t){return null!=t}function I(t){return function(e){return e!=t}}function R(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function N(t){this.f=!1,this.a=[],this.b=[],this.c=[],this.h=t||null}function C(){return{maxAttempts:2,baseDelay:1e3,backoffFactor:2,fuzzFactor:.5,timeout:0}}function M(t,e){return{uris:t,method:"GET",body:null,headers:{},allowCrossSiteCredentials:!1,retryParameters:e}}function x(t,e,i){for(var n=0;n<t.length;++n)if(i(t[n],e))return n;return-1}function D(){this.a={}}function O(){this.a=new D}function j(t,e,i,n){e=new U(e,i,n),t.a.push(i,e)}function L(t){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].ja();t.a.a={}}function U(t,e,i){this.target=t,this.type=e,this.a=i,this.target.addEventListener(e,i,!1)}function B(t){return!t||!Object.keys(t).length}function F(t){return Object.keys(t).map(function(e){return t[e]})}function K(t,e){return Object.keys(t).reduce(function(i,n){return i[n]=e(t[n],n),i},{})}function V(t,e){return Object.keys(t).every(function(i){return e(i,t[i])})}function q(t){if(!t)return"";t=new Uint8Array(t),239==t[0]&&187==t[1]&&191==t[2]&&(t=t.subarray(3)),t=escape($(t));try{return decodeURIComponent(t)}catch(e){throw new E(2,2004)}}function H(t,e){if(!t)return"";if(t.byteLength%2)throw new E(2,2004);var i;if(t instanceof ArrayBuffer)i=t;else{var n=new Uint8Array(t.byteLength);n.set(new Uint8Array(t)),i=n.buffer}var n=t.byteLength/2,r=new Uint16Array(n);i=new DataView(i);for(var s=0;s<n;s++)r[s]=i.getUint16(2*s,e);return $(r)}function G(t){var e=new Uint8Array(t);if(239==e[0]&&187==e[1]&&191==e[2])return q(e);if(254==e[0]&&255==e[1])return H(e.subarray(2),!1);if(255==e[0]&&254==e[1])return H(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 H(t,!1);if(!e[1]&&!e[3])return H(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return q(t);throw new E(2,2003)}function z(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 $(t){for(var e="",i=0;i<t.length;i+=16e3)e+=String.fromCharCode.apply(null,t.subarray(i,i+16e3));return e}function Y(t){this.a=null,this.b=function(){this.a=null,t()}.bind(this)}function W(t){null!=t.a&&(clearTimeout(t.a),t.a=null)}function X(t){W(t),t.a=setTimeout(t.b,100)}function J(e){return t.btoa(String.fromCharCode.apply(null,e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=*$/,"")}function Z(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 Q(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 tt(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 et(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 it(t,e,i){this.l=this.h=this.m=null,this.A=!1,this.b=null,this.f=new O,this.a=[],this.s=[],this.j=new R,this.G=t,this.i=null,this.g=function(t){this.j.reject(t),e(t)}.bind(this),this.w={},this.J=i,this.v=new Y(this.vc.bind(this)),this.C=this.c=!1,this.j["catch"](function(){})}function nt(t,e){if(!t.h)return j(t.f,e,"encrypted",function(){this.f.ja(e,"encrypted"),this.g(new E(6,6010))}.bind(t)),Promise.resolve();t.l=e;var i=t.l.setMediaKeys(t.h),i=i["catch"](function(t){return Promise.reject(new E(6,6003,t.message))}),n=null;return t.b.serverCertificate&&(n=t.h.setServerCertificate(t.b.serverCertificate),n=n["catch"](function(t){return Promise.reject(new E(6,6004,t.message))})),Promise.all([i,n]).then(function(){return this.c?Promise.reject():(st(this),void(this.b.initData.length||this.s.length||j(this.f,this.l,"encrypted",this.bc.bind(this))))}.bind(t))["catch"](function(t){return this.c?Promise.resolve():Promise.reject(t)}.bind(t))}function rt(t,e){return Promise.all(e.map(function(t){return dt(this,t).then(function(t){if(t)return t.remove()})}.bind(t)))}function st(t){var e=t.b?t.b.initData:[];return e.forEach(function(t){pt(this,t.initDataType,t.initData)}.bind(t)),t.s.forEach(function(t){dt(this,t)}.bind(t)),e.length||t.s.length||t.j.resolve(),t.j}function at(t){return t.a.map(function(t){return t.ya.sessionId})}function ot(t,e,i,n,r){var s=ct(t),a=0<=navigator.userAgent.indexOf("Edge/");e.periods.forEach(function(t){t.streamSets.forEach(function(t){"text"!=t.type&&(s&&(t.drmInfos=[s]),t.drmInfos.forEach(function(e){ht(this,e);var s=n[e.keySystem];s||(s={audioCapabilities:[],videoCapabilities:[],distinctiveIdentifier:"optional",persistentState:i?"required":"optional",sessionTypes:[i?"persistent-license":"temporary"],label:e.keySystem,drmInfos:[]},n[e.keySystem]=s,r.push(e.keySystem)),s.drmInfos.push(e),e.distinctiveIdentifierRequired&&(s.distinctiveIdentifier="required"),e.persistentStateRequired&&(s.persistentState="required");var o="video"==t.type?s.videoCapabilities:s.audioCapabilities,u=("video"==t.type?e.videoRobustness:e.audioRobustness)||"";t.streams.forEach(function(t){var i=t.mimeType;t.codecs&&(i+='; codecs="'+t.codecs+'"'),t.keyId&&e.keyIds.push(t.keyId),a&&"com.microsoft.playready"==e.keySystem&&o.length||o.push({robustness:u,contentType:i})}.bind(this))}.bind(this)))}.bind(this))}.bind(t))}function ut(t,e,i){if(1==i.length&&""==i[0])return Promise.reject(new E(6,6e3));var n=new R,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 E(6,6001))}),r=r.then(function(t){if(this.c)return Promise.reject();var i=t.getConfiguration();return this.m=(i.audioCapabilities||[]).concat(i.videoCapabilities||[]).map(function(t){return t.contentType}),this.m.length||(this.m=null),i=e[t.keySystem],ft(this,t.keySystem,i,i.drmInfos),this.b.licenseServerUri?t.createMediaKeys():Promise.reject(new E(6,6012))}.bind(t)).then(function(t){return this.c?Promise.reject():(this.h=t,void(this.A=!0))}.bind(t))["catch"](function(t){return this.c?Promise.resolve():(this.m=this.b=null,t instanceof E?Promise.reject(t):Promise.reject(new E(6,6002,t.message)))}.bind(t)),n.reject(),r}function ht(t,e){var i=e.keySystem;if(i){if(!e.licenseServerUri){var n=t.i.servers[i];n&&(e.licenseServerUri=n)}e.keyIds||(e.keyIds=[]),(i=t.i.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 ct(e){if(B(e.i.clearKeys))return null;var i,n=[],r=[];for(i in e.i.clearKeys){var s=e.i.clearKeys[i],a=Q(i),s=Q(s),a={kty:"oct",kid:J(a),k:J(s)};n.push(a),r.push(a.kid)}return e=JSON.stringify({keys:n}),r=JSON.stringify({kids:r}),r=[{initData:new Uint8Array(z(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 ft(t,e,i,n){var r=[],s=[],a=[],o=[];lt(n,r,s,a,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:s[0],initData:a,keyIds:o}}function lt(t,e,i,n,r){function s(t,e){return t.initDataType==e.initDataType&&et(t.initData,e.initData)}t.forEach(function(t){if(-1==e.indexOf(t.licenseServerUri)&&e.push(t.licenseServerUri),t.serverCertificate&&-1==x(i,t.serverCertificate,et)&&i.push(t.serverCertificate),t.initData&&t.initData.forEach(function(t){-1==x(n,t,s)&&n.push(t)}),t.keyIds)for(var a=0;a<t.keyIds.length;++a)-1==r.indexOf(t.keyIds[a])&&r.push(t.keyIds[a])})}function dt(t,e){var i;try{i=t.h.createSession("persistent-license")}catch(n){var r=new E(6,6005,n.message);return t.g(r),Promise.reject(r)}j(t.f,i,"message",t.sb.bind(t)),j(t.f,i,"keystatuseschange",t.nb.bind(t));var s={initData:null,ya:i,loaded:!1};return t.a.push(s),i.load(e).then(function(t){if(!this.c){if(t)return s.loaded=!0,this.a.every(function(t){return t.loaded})&&this.j.resolve(),i;this.a.splice(this.a.indexOf(s),1),this.g(new E(6,6013))}}.bind(t),function(t){this.c||(this.a.splice(this.a.indexOf(s),1),this.g(new E(6,6005,t.message)))}.bind(t))}function pt(t,e,i){var n;try{n=t.C?t.h.createSession("persistent-license"):t.h.createSession()}catch(r){return void t.g(new E(6,6005,r.message))}j(t.f,n,"message",t.sb.bind(t)),j(t.f,n,"keystatuseschange",t.nb.bind(t)),t.a.push({initData:i,ya:n,loaded:!1}),n.generateRequest(e,i.buffer)["catch"](function(t){if(!this.c){for(var e=0;e<this.a.length;++e)if(this.a[e].ya==n){this.a.splice(e,1);break}this.g(new E(6,6006,t.message))}}.bind(t))}function mt(t){for(var e=H(t.body,!0),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=Z(e.querySelector("Challenge").textContent).buffer}function bt(){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){return t.createMediaKeys()}).then(function(t){var i=!1;try{t.createSession("persistent-license"),i=!0}catch(r){}n[e]={persistentState:i}},function(){n[e]=null});t.push(r)}),Promise.all(t).then(function(){return n})}function yt(){var t,e={};for(t in Yr)e[t]=!0;for(t in Wr)e[t]=!0;return["application/dash+xml","application/x-mpegurl","application/vnd.apple.mpegurl","application/vnd.ms-sstr+xml"].forEach(function(t){e[t]=!!Yr[t]}),["mpd","m3u8","ism"].forEach(function(t){e[t]=!!Wr[t]}),e}function gt(t,e,i,n){var r=n;return r||(n=new p(t).O.split("/").pop().split("."),1<n.length&&(n=n.pop().toLowerCase(),r=Wr[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=Yr[e])?r:Promise.reject(new E(4,4e3,t))},function(t){return Promise.reject(t)}))}function vt(t,e,i){this.g=Xr[e],this.c=t,this.h=0,this.f=1/0,this.a=this.b=null,this.i=i}function wt(t,e,i){return t>=e?null:new Jr(t,e,i)}function St(t,e,i,n){var r=t.h;return Promise.resolve().then(function(){if(this.c){var t=this.g(e,r,i,n,this.i);if(null!=i&&null!=n){for(var s=0;s<t.length&&!(t[s].startTime>=this.f);++s)this.c.addCue(t[s]);null==this.b&&(this.b=i),this.a=Math.min(n,this.f)}}}.bind(t))}function Tt(t,e){return null==t.a||t.a<e||e<t.b?0:t.a-e}function Et(t,e){for(var i=t.c.cues,n=[],r=0;r<i.length;++r)e(i[r])&&n.push(i[r]);for(r=0;r<n.length;++r)t.c.removeCue(n[r])}function kt(t){return!t||1==t.length&&1e-6>t.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function Pt(t,e){var i=0;if(!t||1==t.length&&1e-6>t.end(0)-t.start(0))return i;for(var n=!1,r=0;r<t.length;++r)if(e+1e-4>=t.start(r)&&e<t.end(r))i+=t.end(r)-e,n=!0;else if(n&&.04>=t.start(r)-t.end(r-1))i+=t.end(r)-t.start(r),i+=t.start(r)-t.end(r-1);else if(0<r&&e+1e-4<t.start(r)&&e+1e-4>=t.end(r-1)){if(!(.04>=t.start(r)-e))break;i+=t.end(r)-e,n=!0}else n=!1;return i}function At(t,e,i){this.g=t,this.f=e,this.j=i,this.c={},this.b=null,this.a={},this.h=new O,this.i=!1}function _t(){var t={};return'video/mp4; codecs="avc1.42E01E",audio/mp4; codecs="mp4a.40.2",video/webm; codecs="vp8",video/webm; codecs="vp9",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",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]=!!Xr[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function It(t,e){var i;return"text"==e?i=t.b.b:(i=Nt(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),i}function Rt(t,e,i){return"text"==e?(e=Tt(t.b,i),e||(e=Tt(t.b,i+.1))&&(e+=.1)):(t=Nt(t,e),e=Pt(t,i),e||(e=Pt(t,i+.1))&&(e+=.1)),e}function Nt(t,e){try{return t.c[e].buffered}catch(i){return null}}function Ct(t,e,i,n,r){return"text"==e?St(t.b,i,n,r):Ot(t,e,t.Rc.bind(t,e,i))}function Mt(t,e){return"text"==e?t.b.remove(0,1/0):Promise.all([Ot(t,e,t.xb.bind(t,e,0,t.f.duration)),Ot(t,e,t.Rb.bind(t,e))])}function xt(t,e,i){return"text"==e?(t.b.h=i,Promise.resolve()):Ot(t,e,t.Hc.bind(t,e,i))}function Dt(t,e,i){return"text"==e?(t.b.f=i,Promise.resolve()):Promise.all([Ot(t,e,t.Ib.bind(t,e)),Ot(t,e,t.Fc.bind(t,e,i))])}function Ot(t,e,i){if(t.i)return Promise.reject();if(i={start:i,p:new R},t.a[e].push(i),1==t.a[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new E(3,3017,e)):i.p.reject(new E(3,3015,n)),Lt(t,e)}return i.p}function jt(t,e){if(t.i)return Promise.reject();var i,n=[];for(i in t.c){var r=new R,s={start:function(t){t.resolve()}.bind(null,r),p:r};t.a[i].push(s),n.push(r),1==t.a[i].length&&s.start()}return Promise.all(n).then(function(){var t,i;try{e()}catch(n){i=Promise.reject(new E(3,3015,n))}for(t in this.c)Lt(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function Lt(t,e){t.a[e].shift();var i=t.a[e][0];if(i)try{i.start()}catch(n){i.p.reject(new E(3,3015,n)),Lt(t,e)}}function Ut(t,e,i){this.a=t,this.L=e,this.D=i}function Bt(t,e,i,n,r,s){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.L=r,this.D=s}function Ft(t,e){this.j=t,this.i=e,this.c=this.a=1/0,this.b=1,this.h=this.f=0,this.g=!0}function Kt(t,e,i,n,r,s){this.a=t,this.c=e,this.j=i,this.s=n,this.l=r,this.m=s,this.b=new O,this.g=!1,this.h=1,this.i=this.f=null,0<t.readyState?this.ob():j(this.b,t,"loadedmetadata",this.ob.bind(this)),j(this.b,t,"ratechange",this.ic.bind(this)),Gt(this)}function Vt(t){return 0<t.a.readyState?Xt(t,t.a.currentTime):qt(t)}function qt(t){return t.s?Xt(t,t.s):1/0>t.c.da()?t.c.ra():Math.max(t.c.Ra(),t.c.ra())}function Ht(t,e){e!=t.g&&(t.g=e,$t(t,t.h),t.l(e))}function Gt(e){zt(e),e.i=t.setTimeout(e.mc.bind(e),250)}function zt(e){e.i&&(t.clearTimeout(e.i),e.i=null)}function $t(e,i){null!=e.f&&(t.clearInterval(e.f),e.f=null),e.h=i,e.a.playbackRate=e.g||0>i?0:i,!e.g&&0>i&&(e.f=t.setInterval(function(){this.a.currentTime+=i/4}.bind(e),250))}function Yt(t,e){var i=t.c,n=i.ra(),r=i.ea();return i.U()&&1/0!=i.c?(i=n+1,n=i+t.j,e>=n&&e<=r||Pt(t.a.buffered,e)&&e>=i&&e<=r?e:e>r?r:r<n&&e>=i&&e<=r?e:Math.min(n+2,r)):e<n?n:e>r?r:e}function Wt(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 Xt(t,e){var i=t.c.ra();return e<i?i:(i=t.c.ea(),e>i?i:e)}function Jt(t,e,i,n,r,s,a,o,u){this.m=t,this.f=e,this.S=i,this.a=n,this.G=r,this.v=s,this.j=a,this.w=o||null,this.A=u||null,this.g=null,this.i=1,this.C=Promise.resolve(),this.h=[],this.l={},this.b={},this.c=this.s=this.J=!1}function Zt(t){return t.a.periods[ye(t,Vt(t.m))]}function Qt(t){return K(t.b,function(t){return t.stream})}function te(t,e){var i={};return i.text=e,ie(t,i)}function ee(t,e,i,n){var r=t.b[e];!r&&"text"==e&&t.g.ignoreTextStreamFailures?te(t,i):r&&(e=t.h[ge(t,i)])&&e.xa&&(e=t.l[i.id])&&e.xa&&r.stream!=i&&(r.stream=i,r.Ja=!0,n&&!r.ba&&(r.ga?r.la=!0:(Te(r),we(t,r))))}function ie(t,e){var i=ye(t,Vt(t.m)),n=K(e,function(t){return t.mimeType+(t.codecs?'; codecs="'+t.codecs+'"':"")});return t.f.init(n,t.g.useRelativeCueTimestamps),se(t),n=F(e),re(t,n).then(function(){if(!this.c)for(var t in e){var n=e[t];this.b[t]||(this.b[t]={stream:n,type:t,ta:null,V:null,Ja:!0,Ka:i,endOfStream:!1,ga:!1,aa:null,la:!1,ba:!1,Za:!1},Se(this,this.b[t],0))}}.bind(t))}function ne(t,e){var i=t.h[e];if(i)return i.I;i={I:new R,xa:!1},t.h[e]=i;var n=t.a.periods[e].streamSets.map(function(t){return t.streams}).reduce(P,[]);return t.C=t.C.then(function(){if(!this.c)return re(this,n)}.bind(t)).then(function(){this.c||(this.h[e].I.resolve(),this.h[e].xa=!0)}.bind(t))["catch"](function(t){this.c||(this.h[e].I.reject(),delete this.h[e],this.j(t))}.bind(t)),i.I}function re(t,e){for(var i=[],n=0;n<e.length;++n){var r=e[n],s=t.l[r.id];s?i.push(s.I):(t.l[r.id]={I:new R,xa:!1},i.push(r.createSegmentIndex()))}return Promise.all(i).then(function(){if(!this.c)for(var t=0;t<e.length;++t){var i=this.l[e[t].id];i.xa||(i.I.resolve(),i.xa=!0)}}.bind(t))["catch"](function(t){if(!this.c)return this.l[r.id].I.reject(),delete this.l[r.id],Promise.reject(t)}.bind(t))}function se(t){var e=t.a.presentationTimeline.da();1/0>e?t.f.za(e):t.f.za(Math.pow(2,32))}function ae(t,e){var i,n,r=Vt(t.m);n=t.f;var s=e.type;n="text"==s?n.b.a:kt(Nt(n,s));var s=e.ta&&e.V?t.a.periods[ge(t,e.ta)].startTime+e.V.endTime:r,a=ge(t,e.stream),o=ye(t,s),u=t.a.periods[o];return i=a!=o?null:oe(t,e,r,n,o),(i?u.startTime+i.startTime-r:Rt(t.f,e.type,r))>=Math.max(t.i*Math.max(t.a.minBufferTime||0,t.g.rebufferingGoal),t.i*t.g.bufferingGoal)?.5:s>=t.a.presentationTimeline.da()?(e.endOfStream=!0,null):(e.endOfStream=!1,o!=a?(e.Ka=o,null):(i=oe(t,e,r,n,a))?(he(t,e,r,a,i),null):1)}function oe(t,e,i,n,r){if(e.V&&e.stream==e.ta)return i=e.V.position+1,ue(t,e,r,i);if(i=e.V?e.stream.findSegmentPosition(Math.max(0,t.a.periods[ge(t,e.ta)].startTime+e.V.endTime-t.a.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(n||i)-t.a.periods[r].startTime)),null==i)return null;var s=null;return null==n&&(s=ue(t,e,r,Math.max(0,i-1))),s||ue(t,e,r,i)}function ue(t,e,i,n){return i=t.a.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.a.presentationTimeline,n=t.ea(),i.startTime+e.endTime<t.sa()||i.startTime+e.startTime>n?null:e):null}function he(t,e,i,n,r){var s=t.a.periods[n],a=e.stream,o=t.a.periods[n+1],u=null,u=o?o.startTime:t.a.presentationTimeline.da();n=fe(t,e,n,u),e.ga=!0,e.Ja=!1,o=ve(t,r),Promise.all([n,o]).then(function(t){if(!this.c&&!this.s)return le(this,e,i,s,a,r,t[1])}.bind(t)).then(function(){this.c||this.s||(e.ga=!1,e.Za=!1,Se(this,e,0),pe(this,a))}.bind(t))["catch"](function(t){this.c||this.s||(e.ga=!1,1001==t.code||1002==t.code||1003==t.code?"text"==e.type&&this.g.ignoreTextStreamFailures&&1001==t.code?delete this.b.text:(this.j(t),Se(this,e,4)):3017==t.code?ce(this,e,t):this.j(t))}.bind(t))}function ce(t,e,i){if(!F(t.b).some(function(t){return t!=e&&t.Za})){var n=Math.round(100*t.i);if(20<n)t.i-=.2;else{if(!(4<n))return t.s=!0,void t.j(i);t.i-=.04}e.Za=!0}Se(t,e,4)}function fe(t,e,i,n){return e.Ja?(i=xt(t.f,e.type,t.a.periods[i].startTime-e.stream.presentationTimeOffset),n=null!=n?Dt(t.f,e.type,n):Promise.resolve(),e.stream.initSegmentReference?(t=ve(t,e.stream.initSegmentReference).then(function(t){if(!this.c)return Ct(this.f,e.type,t,null,null)}.bind(t))["catch"](function(t){return e.Ja=!0,Promise.reject(t)}),Promise.all([i,n,t])):Promise.all([i,n])):Promise.resolve()}function le(t,e,i,n,r,s,a){return de(t,e,i).then(function(){if(!this.c)return Ct(this.f,e.type,a,s.startTime+n.startTime,s.endTime+n.startTime)}.bind(t)).then(function(){if(!this.c)return e.ta=r,e.V=s,Promise.resolve()}.bind(t))}function de(t,e,i){var n=It(t.f,e.type);return null==n?Promise.resolve():(i=i-n-t.g.bufferBehind,0>=i?Promise.resolve():t.f.remove(e.type,n,n+i).then(function(){}.bind(t)))}function pe(t,e){if(!t.J&&(t.J=F(t.b).every(function(t){return!t.la&&!t.ba&&t.V}),t.J)){var i=ge(t,e);for(t.h[i]||ne(t,i).then(function(){this.v()}.bind(t))["catch"](A),i=0;i<t.a.periods.length;++i)ne(t,i)["catch"](A);t.A&&t.A()}}function me(t,e){if(e.Ka!=ge(t,e.stream)){var i=e.Ka,n=F(t.b);n.every(function(t){return t.Ka==i})&&n.every(be)&&ne(t,i).then(function(){if(!this.c){var t,e=this.G(this.a.periods[i]);for(t in this.b)if(!e[t])return void this.j(new E(5,5005));for(t in e)if(!(this.b[t]||"text"==t&&this.g.ignoreTextStreamFailures))return void this.j(new E(5,5005));for(t in this.b){ee(this,t,e[t],!1);var n=this.b[t];be(n)&&Se(this,n,0)}this.v()}}.bind(t))["catch"](A)}}function be(t){return!t.ga&&null==t.aa&&!t.la&&!t.ba}function ye(t,e){for(var i=t.a.periods.length-1;0<i;--i)if(e>=t.a.periods[i].startTime)return i;return 0}function ge(t,e){for(var i=0;i<t.a.periods.length;++i)for(var n=t.a.periods[i],r=0;r<n.streamSets.length;++r)if(0<=n.streamSets[r].streams.indexOf(e))return i;return-1}function ve(t,e){var i=M(e.a(),t.g.retryParameters);if(e.L||null!=e.D){var n="bytes="+e.L+"-";null!=e.D&&(n+=e.D),i.headers.Range=n}return t.S.request(1,i).then(function(t){return t.data})}function we(t,e){e.la=!1,e.ba=!0,Mt(t.f,e.type).then(function(){this.c||(e.ta=null,e.V=null,e.ba=!1,Se(this,e,0))}.bind(t))}function Se(e,i,n){i.aa=t.setTimeout(e.X.bind(e,i),1e3*n)}function Te(e){null!=e.aa&&(t.clearTimeout(e.aa),e.aa=null)}function Ee(){this.a=Promise.resolve(),this.c=this.b=this.f=!1,this.g=new Promise(function(t){this.h=t}.bind(this))}function ke(t){return t.f||(t.a=t.a.then(function(t){return this.b=!0,Promise.resolve(t)}.bind(t),function(t){return this.b=!0,Promise.reject(t)}.bind(t))),t.f=!0,t.a}function Pe(t,e){return t.b?Promise.resolve():(t.c=!0,t.i=e,t.g)}function Ae(t,e,i,n,r){var s,a=r in n;for(s in e){var o=r+"."+s,u=a?n[r]:i[s],h=!!{".abr.manager":!0}[o];(a||s in t)&&(void 0===e[s]?void 0===u||a?delete t[s]:t[s]=u:h?t[s]=e[s]:"object"==typeof t[s]&&"object"==typeof e[s]?Ae(t[s],e[s],u,n,o):typeof e[s]==typeof u&&(t[s]=e[s]))}}function _e(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():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function Ie(){this.Aa=new D,this.S=this}function Re(t,e,i){return i==e||t>=Zr&&i==e.split("-")[0]||t>=Qr&&i.split("-")[0]==e.split("-")[0]}function Ne(t){t=t.toLowerCase().split("-");var e=ts[t[0]];return e&&(t[0]=e),t.join("-")}function Ce(t,e,i){var n=!1;return t.streamSets.forEach(function(t){t.streams.forEach(function(r){var s=r.allowedByApplication;r.allowedByApplication=!0,"video"==t.type?(r.width<e.minWidth||r.width>e.maxWidth||r.width>i.width||r.height<e.minHeight||r.height>e.maxHeight||r.height>i.height||r.width*r.height<e.minPixels||r.width*r.height>e.maxPixels||r.bandwidth<e.minVideoBandwidth||r.bandwidth>e.maxVideoBandwidth)&&(r.allowedByApplication=!1):"audio"==t.type&&(r.bandwidth<e.minAudioBandwidth||r.bandwidth>e.maxAudioBandwidth)&&(r.allowedByApplication=!1),
s!=r.allowedByApplication&&(n=!0)})}),n}function Me(t,e,i){var n="",r=null;for(t&&t.A&&(n=t.keySystem(),r=t.m),t=0;t<i.streamSets.length;++t){var s=i.streamSets[t];if(n&&s.drmInfos.length&&!s.drmInfos.some(function(t){return t.keySystem==n}))i.streamSets.splice(t,1),--t;else{for(var a=e[s.type],o=0;o<s.streams.length;++o){var u=s.streams[o],h=u.mimeType;u.codecs&&(h+='; codecs="'+u.codecs+'"'),Xr[h]||MediaSource.isTypeSupported(h)?r&&u.encrypted&&0>r.indexOf(h)?(s.streams.splice(o,1),--o):!a||u.mimeType==a.mimeType&&u.codecs.split(".")[0]==a.codecs.split(".")[0]||(s.streams.splice(o,1),--o):(s.streams.splice(o,1),--o)}s.streams.length||(i.streamSets.splice(t,1),--t)}}}function xe(t,e){return t.streamSets.map(function(t){var i=e?e[t.type]:null;return t.streams.filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).map(function(e){return{id:e.id,active:i==e,type:t.type,bandwidth:e.bandwidth,language:t.language,kind:e.kind||null,width:e.width||null,height:e.height||null,frameRate:e.frameRate||void 0,codecs:e.codecs||null}})}).reduce(P,[])}function De(t,e){for(var i=0;i<t.streamSets.length;i++)for(var n=t.streamSets[i],r=0;r<n.streams.length;r++){var s=n.streams[r];if(s.id==e.id)return{stream:s,Uc:n}}return null}function Oe(t){return t.streams.some(function(t){return t.allowedByApplication&&t.allowedByKeySystem})}function je(t,e,i){var n={};t.streamSets.forEach(function(t){!Oe(t)||t.type in n||(n[t.type]=t)});var r=0;return t.streamSets.forEach(function(t){if(Oe(t)&&"video"==t.type){var e=Ue(t);e>r?(r=e,n.video=t):e==r&&Le(t)<Le(n.video)&&(n.video=t)}}),t.streamSets.forEach(function(t){Oe(t)&&t.primary&&(n[t.type].primary?Le(t)<Le(n[t.type])&&(n[t.type]=t):n[t.type]=t)}),[Qr,Zr,0].forEach(function(r){t.streamSets.forEach(function(t){if(Oe(t)){var s;if("audio"==t.type?s=e.preferredAudioLanguage:"text"==t.type&&(s=e.preferredTextLanguage),s){s=Ne(s);var a=Ne(t.language);Re(r,s,a)&&(t.language==n[t.type].language?Le(t)<Le(n[t.type])&&(n[t.type]=t):n[t.type]=t,i&&(i[t.type]=!0))}}})}),n}function Le(t){var e=0;return!t||1>t.streams.length?e:(t.streams.forEach(function(t){e+=t.bandwidth}),e/t.streams.length)}function Ue(t){var e=0;return t?(t.streams.forEach(function(t){t.height>e&&(e=t.height)}),e):e}function Be(t,e){Ie.call(this),this.w=!1,this.f=t,this.m=null,this.v=new O,this.fb=new c,this.na=this.c=this.l=this.b=this.i=this.oa=this.G=this.A=this.g=this.h=null,this.Hb=1e9,this.ma=[],this.Na=!1,this.qa=!0,this.j=null,this.s={},this.a=He(this),this.Ba={width:1/0,height:1/0},this.C=[],this.X=this.J=this.pa=0,e&&e(this),this.h=new N(this.Mc.bind(this)),this.oa=Fe(this);for(var i=0;i<this.f.textTracks.length;++i){var n=this.f.textTracks[i];n.mode="disabled","Shaka Player TextTrack"==n.label&&(this.m=n)}this.m||(this.m=this.f.addTextTrack("subtitles","Shaka Player TextTrack")),this.m.mode="hidden",j(this.v,this.f,"error",this.lc.bind(this))}function Fe(e){e.A=new MediaSource;var i=new R;return j(e.v,e.A,"sourceopen",i.resolve),e.f.src=t.URL.createObjectURL(e.A),i}function Ke(t){t.l&&t.l.configure(t.a.manifest),t.g&&t.g.configure(t.a.drm),t.b&&(t.b.configure(t.a.streaming),t.c.periods.forEach(t.La.bind(t)),Ye(t,Zt(t.b))),t.a.abr.enabled&&!t.qa?t.a.abr.manager.enable():t.a.abr.manager.disable(),t.a.abr.manager.setDefaultEstimate(t.a.abr.defaultBandwidthEstimate)}function Ve(t){t.v&&t.v.ja(t.A,"sourceopen"),t.f&&(t.f.removeAttribute("src"),t.f.load());var e=Promise.all([t.a?t.a.abr.manager.stop():null,t.g?t.g.o():null,t.G?t.G.o():null,t.i?t.i.o():null,t.b?t.b.o():null,t.l?t.l.stop():null]);return t.g=null,t.G=null,t.i=null,t.b=null,t.l=null,t.c=null,t.na=null,t.oa=null,t.A=null,t.s={},t.C=[],t.pa=0,t.J=0,e}function qe(){return{".drm.servers":"",".drm.clearKeys":"",".drm.advanced":{distinctiveIdentifierRequired:!1,persistentStateRequired:!1,videoRobustness:"",audioRobustness:"",serverCertificate:null}}}function He(t){return{drm:{retryParameters:C(),servers:{},clearKeys:{},advanced:{}},manifest:{retryParameters:C(),dash:{customScheme:function(t){if(t)return null},clockSyncUri:""}},streaming:{retryParameters:C(),rebufferingGoal:2,bufferingGoal:10,bufferBehind:30,ignoreTextStreamFailures:!1,useRelativeCueTimestamps:!1},abr:{manager:t.fb,enabled:!0,defaultBandwidthEstimate:5e5},preferredAudioLanguage:"",preferredTextLanguage:"",restrictions:{minWidth:0,maxWidth:1/0,minHeight:0,maxHeight:1/0,minPixels:0,maxPixels:1/0,minAudioBandwidth:0,maxAudioBandwidth:1/0,minVideoBandwidth:0,maxVideoBandwidth:1/0}}}function Ge(t,e,i){for(var n in e){var r=e[n],s=i||!1;"text"==n&&(s=!0),t.qa?t.s[n]={stream:r,Ob:s}:ee(t.b,n,r,s)}}function ze(t){if(t.c){var e=Date.now()/1e3;t.Na?t.J+=e-t.X:t.pa+=e-t.X,t.X=e}}function $e(t,e,i){if(!F(e).some(Oe))return t.$(new E(4,4012)),{};var n={};if(i)n=e;else{i=Qt(t.b);for(var r in i){var s=i[r];s.allowedByApplication&&s.allowedByKeySystem&&e[r].language==s.language||(n[r]=e[r])}}if(B(n))return{};h(Object.keys(n));var a=t.a.abr.manager.chooseStreams(n);return V(n,function(t){return!!a[t]})?a:(t.$(new E(4,4012)),{})}function Ye(t,e){var i,n={audio:!1,text:!1},r=je(e,t.a,n),s=$e(t,r);for(i in s)t.C.push({timestamp:Date.now()/1e3,id:s[i].id,type:i,fromAdaptation:!0});Ge(t,s,!0),We(t),r.text&&r.audio&&n.text&&r.text.language!=r.audio.language&&(t.m.mode="showing",Je(t))}function We(t){Promise.resolve().then(function(){this.w||this.dispatchEvent(new _e("adaptation"))}.bind(t))}function Xe(t){Promise.resolve().then(function(){this.w||this.dispatchEvent(new _e("trackschanged"))}.bind(t))}function Je(t){t.dispatchEvent(new _e("texttrackvisibility"))}function Ze(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof _e){var i,n={};for(i in e){var r=e[i];r&&"object"==typeof 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 Qe(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__?ti(e):e})}function ti(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ei(t,e,i,n,r){this.C=t,this.l=e,this.w=i,this.A=n,this.s=r,this.f=this.j=this.h=!1,this.v="",this.a=this.i=null,this.b={video:{},player:{}},this.m=0,this.c={},this.g=null}function ii(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new E(7,7e3))}}function ni(t,e){var i=Ze(e);t.a.sendMessage("urn:x-cast:com.google.shaka.v2",i,function(){},u)}function ri(t,e,i){Ie.call(this),this.c=t,this.b=e,this.h=this.f=this.g=this.i=this.j=null,this.a=new ei(i,this.Nc.bind(this),this.Oc.bind(this),this.Pc.bind(this),this.jb.bind(this)),si(this)}function si(t){t.a.init(),t.h=new O,is.forEach(function(t){j(this.h,this.c,t,this.ad.bind(this))}.bind(t)),as.forEach(function(t){j(this.h,this.b,t,this.uc.bind(this))}.bind(t)),t.j={};for(var e in t.c)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.$c.bind(t,e),set:t.bd.bind(t,e)});t.i={};for(e in t.b)Object.defineProperty(t.i,e,{configurable:!1,enumerable:!0,get:t.tc.bind(t,e)});t.g=new Ie,t.g.S=t.j,t.f=new Ie,t.f.S=t.i}function ai(t,e,i){Ie.call(this),this.b=t,this.a=e,this.i={video:t,player:e},this.j=i||function(){},this.h=!1,this.c=!0,this.f=this.g=null,oi(this)}function oi(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.rb.bind(e),i.onSenderDisconnected=e.rb.bind(e),i.onSystemVolumeChanged=e.Qb.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.g.onMessage=e.ec.bind(e),i.start(),is.forEach(function(t){this.b.addEventListener(t,this.ub.bind(this,"video"))}.bind(e)),as.forEach(function(t){this.a.addEventListener(t,this.ub.bind(this,"player"))}.bind(e)),e.a.Cb(1920,1080),e.a.addEventListener("loading",function(){this.c=!1,ui(this)}.bind(e)),e.b.addEventListener("playing",function(){this.c=!1,ui(this)}.bind(e)),e.a.addEventListener("unloading",function(){this.c=!0,ui(this)}.bind(e)),e.b.addEventListener("ended",function(){t.setTimeout(function(){this.b&&this.b.ended&&(this.c=!0,ui(this))}.bind(this),5e3)}.bind(e))}function ui(t){Promise.resolve().then(function(){this.dispatchEvent(new _e("caststatuschanged"))}.bind(t))}function hi(t,e,i){for(var n in e.player)t.a[n](e.player[n]);t.j(i),i=Promise.resolve();var r=t.b.autoplay;e.manifest&&(t.b.autoplay=!1,i=t.a.load(e.manifest,e.startTime),i["catch"](function(t){this.a.dispatchEvent(new _e("error",{detail:t}))}.bind(t))),i.then(function(){for(var t in e.video){var i=e.video[t];this.b[t]=i}for(t in e.playerAfterLoad)i=e.playerAfterLoad[t],this.a[t](i);this.b.autoplay=r,e.manifest&&this.b.play()}.bind(t))}function ci(t,e,i){t.h&&(e=Ze(e),i?t.g.getCastChannel(i).send(e):t.g.broadcast(e))}function fi(t,e){var i=li(t,e);return 1!=i.length?null:i[0]}function li(t,e){return Array.prototype.filter.call(t.childNodes,function(t){return t.tagName==e})}function di(t){return(t=t.firstChild)&&t.nodeType==Node.TEXT_NODE?t.nodeValue.trim():null}function pi(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 mi(t){return t?(t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function bi(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 yi(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 gi(t){return t=Number(t),t%1?null:t}function vi(t){return t=Number(t),!(t%1)&&0<t?t:null}function wi(t){return t=Number(t),!(t%1)&&0<=t?t:null}function Si(t){var e;return t=(e=t.match(/^(\d+)\/(\d+)$/))?Number(e[1]/e[2]):Number(t),isNaN(t)?null:t}function Ti(t,e){var i=Ai(t),n=null,r=i.filter(function(t){return"urn:mpeg:dash:mp4protection:2011"!=t.zb||(n=t.init||n,!1)}),s=i.map(function(t){return t.keyId}).filter(_),a=null;if(0<s.length&&(a=s[0],s.some(I(a))))throw new E(4,4010);return s=[],0<r.length?(s=Pi(n,e,r),s.length||(s=[ki("",n)])):0<i.length&&(s=F(ls).map(function(t){return ki(t,n)})),{hb:a,ed:n,drmInfos:s,ib:!0}}function Ei(t,e,i){var n=Ti(t,e);if(i.ib)t=1==i.drmInfos.length&&!i.drmInfos[0].keySystem,e=!n.drmInfos.length,(!i.drmInfos.length||t&&!e)&&(i.drmInfos=n.drmInfos),i.ib=!1;else if(0<n.drmInfos.length&&(i.drmInfos=i.drmInfos.filter(function(t){return n.drmInfos.some(function(e){return e.keySystem==t.keySystem})}),!i.drmInfos.length))throw new E(4,4008);return n.hb||i.hb}function ki(t,e){return{keySystem:t,licenseServerUri:"",distinctiveIdentifierRequired:!1,persistentStateRequired:!1,audioRobustness:"",videoRobustness:"",serverCertificate:null,initData:e||[],keyIds:[]}}function Pi(t,e,i){return i.map(function(i){var n=ls[i.zb];return n?[ki(n,i.init||t)]:e(i.node)||[]}).reduce(P,[])}function Ai(t){return t.map(function(t){var e=t.getAttribute("schemeIdUri"),i=t.getAttribute("cenc:default_KID"),n=li(t,"cenc:pssh").map(di);if(!e)return null;if(e=e.toLowerCase(),i&&(i=i.replace(/-/g,"").toLowerCase(),0<=i.indexOf(" ")))throw new E(4,4009);var r=[];try{r=n.map(function(t){return{initDataType:"cenc",initData:Z(t)}})}catch(s){throw new E(4,4007)}return{node:t,zb:e,keyId:i,init:0<r.length?r:null}}).filter(_)}function _i(e,i,n,r,s){null!==s&&(s=Math.round(s));var a={RepresentationID:i,Number:n,Bandwidth:r,Time:s};return e.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)d)?\$/g,function(e,i,n){if("$$"==e)return"$";var r=a[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 Ii(t,e,i){if(i.length){var n=i[0];n.startTime<=ds&&(i[0]=new Bt(n.position,0,n.endTime,n.a,n.L,n.D)),t||(t=i[i.length-1],t.startTime>e||(i[i.length-1]=new Bt(t.position,t.startTime,e,t.a,t.L,t.D)))}}function Ri(t,e){if(!e.length)return t;var i=e.map(function(t){return new p(t)});return t.map(function(t){return new p(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(P,[]).map(function(t){return t.toString()})}function Ni(t,e){var i=Ci(t,e,"timescale"),n=1;i&&(n=vi(i)||1),i=Ci(t,e,"duration"),(i=vi(i||""))&&(i/=n);var r=Ci(t,e,"startNumber"),s=Ci(t,e,"presentationTimeOffset"),a=wi(r||"");null!=r&&null!=a||(a=1);var o=Mi(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=Number(s),h=t.H.duration||1/0,o=li(o,"S"),c=[],f=0,l=0;l<o.length;++l){var d=o[l],p=pi(d,"t",wi),m=pi(d,"d",wi),d=pi(d,"r",gi);if(null!=p&&(p-=u),!m)break;if(p=null!=p?p:f,d=d||0,0>d)if(l+1<o.length){if(d=pi(o[l+1],"t",wi),null==d)break;if(p>=d)break;d=Math.ceil((d-p)/m)-1}else{if(1/0==h)break;if(p/r>=h)break;d=Math.ceil((h*r-p)/m)-1}0<c.length&&p!=f&&(c[c.length-1].end=p/r);for(var b=0;b<=d;++b)f=p+m,c.push({start:p/r,end:f/r}),p=f}r=c}return{Ha:n,F:i,ha:a,presentationTimeOffset:Number(s)/n||0,B:r}}function Ci(t,e,i){return[e(t.u),e(t.P),e(t.K)].filter(_).map(function(t){return t.getAttribute(i)}).reduce(function(t,e){return t||e})}function Mi(t,e,i){return[e(t.u),e(t.P),e(t.K)].filter(_).map(function(t){return fi(t,i)}).reduce(function(t,e){return t||e})}function xi(t){this.b=t,this.c=0==ps,this.a=0}function Di(t){return t.a<t.b.byteLength}function Oi(t){try{var e=t.b.getUint8(t.a)}catch(i){Vi()}return t.a+=1,e}function ji(t){try{var e=t.b.getUint16(t.a,t.c)}catch(i){Vi()}return t.a+=2,e}function Li(t){try{var e=t.b.getUint32(t.a,t.c)}catch(i){Vi()}return t.a+=4,e}function Ui(t){var e,i;try{t.c?(e=t.b.getUint32(t.a,!0),i=t.b.getUint32(t.a+4,!0)):(i=t.b.getUint32(t.a,!1),e=t.b.getUint32(t.a+4,!1))}catch(n){Vi()}if(2097151<i)throw new E(3,3001);return t.a+=8,i*Math.pow(2,32)+e}function Bi(t,e){t.a+e>t.b.byteLength&&Vi();var i=t.b.buffer.slice(t.a,t.a+e);return t.a+=e,new Uint8Array(i)}function Fi(t,e){t.a+e>t.b.byteLength&&Vi(),t.a+=e}function Ki(t){var e=t.a;try{for(;Di(t)&&t.b.getUint8(t.a);)t.a+=1}catch(i){Vi()}return e=t.b.buffer.slice(e,t.a),t.a+=1,q(e)}function Vi(){throw new E(3,3e3)}function qi(t,e){for(;Di(e);){var i=e.a,n=Li(e),r=Li(e);if(1==n?n=Ui(e):n||(n=e.b.byteLength-i),r==t)return n;Fi(e,n-(e.a-i))}return-1}function Hi(t,e){for(var i=new xi(new DataView(t)),n=[[1836019574,0],[1953653099,0],[1835297121,0],[1835626086,0],[1937007212,0],[1937011556,8],[e,0]],r=-1,s=0;s<n.length;s++){var a=n[s][1],r=qi(n[s][0],i);if(-1==r)return-1;Fi(i,a)}return r}function Gi(t,e,i,n){var r=[];t=new xi(new DataView(t));var s=qi(1936286840,t);if(-1==s)throw new E(3,3004);var a=Oi(t);Fi(t,3),Fi(t,4);var o=Li(t);if(!o)throw new E(3,3005);var u,h;for(a?(u=Ui(t),h=Ui(t)):(u=Li(t),h=Li(t)),Fi(t,2),a=ji(t),n=u-n,e=e+s+h,s=0;s<a;s++){u=Li(t),h=(2147483648&u)>>>31,u&=2147483647;var c=Li(t);if(Fi(t,4),1==h)throw new E(3,3006);r.push(new Bt(r.length,n/o,(n+c)/o,function(){return i},e,e+u-1)),n+=c,e+=u}return r}function zi(t){this.a=t}function $i(t){this.b=t,this.a=new xi(t),ms||(ms=[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 Yi(t){var e;if(e=Wi(t),7<e.length)throw new E(3,3002);for(var i=0,n=0;n<e.length;n++)i=256*i+e[n];e=i,i=Wi(t);t:{for(n=0;n<ms.length;n++)if(et(i,ms[n])){n=!0;break t}n=!1}if(n)i=t.b.byteLength-t.a.a;else{if(8==i.length&&224&i[1])throw new E(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.a+i<=t.b.byteLength?i:t.b.byteLength-t.a.a,n=new DataView(t.b.buffer,t.b.byteOffset+t.a.a,i),Fi(t.a,i),new Xi(e,n)}function Wi(t){var e,i=Oi(t.a);for(e=1;8>=e&&!(i&1<<8-e);e++);if(8<e)throw new E(3,3002);var n=new Uint8Array(e);for(n[0]=i,i=1;i<e;i++)n[i]=Oi(t.a);return n}function Xi(t,e){this.id=t,this.a=e}function Ji(t){if(8<t.a.byteLength)throw new E(3,3002);if(8==t.a.byteLength&&224&t.a.getUint8(0))throw new E(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 Zi(t,e,i,n,r,s){function a(){return r}var o=[];t=new $i(t.a);for(var u=-1,h=-1;Di(t.a);){var c=Yi(t);if(187==c.id){var f=Qi(c);f&&(c=i*(f.Zc-s),f=e+f.xc,0<=u&&o.push(new Bt(o.length,u,c,a,h,f-1)),u=c,h=f)}}return 0<=u&&o.push(new Bt(o.length,u,n,a,h,null)),o}function Qi(t){var e=new $i(t.a);if(t=Yi(e),179!=t.id)throw new E(3,3013);if(t=Ji(t),e=Yi(e),183!=e.id)throw new E(3,3012);for(var e=new $i(e.a),i=0;Di(e.a);){var n=Yi(e);if(241==n.id){i=Ji(n);break}}return{Zc:t,xc:i}}function tn(t,e){var i=Mi(t,e,"Initialization");if(!i)return null;var n=t.u.M,r=i.getAttribute("sourceURL");r&&(n=Ri(t.u.M,[r]));var r=0,s=null;return(i=pi(i,"range",yi))&&(r=i.start,s=i.end),new Ut(function(){return n},r,s)}function en(t,e){var i,n=Ci(t,rn,"presentationTimeOffset"),r=tn(t,rn);i=Number(n);var s=t.u.mimeType.split("/")[1];if("text"!=t.u.contentType&&"mp4"!=s&&"webm"!=s)throw new E(4,4006);if("webm"==s&&!r)throw new E(4,4005);var a=Mi(t,rn,"RepresentationIndex"),o=Ci(t,rn,"indexRange"),u=t.u.M,o=yi(o||"");if(a){var h=a.getAttribute("sourceURL");h&&(u=Ri(t.u.M,[h])),o=pi(a,"range",yi,o)}if(!o)throw new E(4,4002);return i=nn(t,e,r,u,o.start,o.end,s,i),{createSegmentIndex:i.createSegmentIndex,findSegmentPosition:i.findSegmentPosition,getSegmentReference:i.getSegmentReference,initSegmentReference:r,presentationTimeOffset:Number(n)||0}}function nn(t,e,i,n,r,s,a,o){var u=t.presentationTimeline,h=t.H.start,c=t.H.duration,f=e,l=null;return{createSegmentIndex:function(){var e=[f(n,r,s),"webm"==a?f(i.a(),i.L,i.D):null];return f=null,Promise.all(e).then(function(e){var i,s=e[0];if(e=e[1]||null,"mp4"==a)s=Gi(s,r,n,o);else{if(e=new $i(new DataView(e)),440786851!=Yi(e).id)throw new E(3,3008);var f=Yi(e);if(408125543!=f.id)throw new E(3,3009);for(e=f.a.byteOffset,f=new $i(f.a),i=null;Di(f.a);){var d=Yi(f);if(357149030==d.id){i=d;break}}if(!i)throw new E(3,3010);for(f=new $i(i.a),i=1e6,d=null;Di(f.a);){var p=Yi(f);if(2807729==p.id)i=Ji(p);else if(17545==p.id)if(d=p,4==d.a.byteLength)d=d.a.getFloat32(0);else{if(8!=d.a.byteLength)throw new E(3,3003);d=d.a.getFloat64(0)}}if(null==d)throw new E(3,3011);if(f=i/1e9,i=d*f,s=Yi(new $i(new DataView(s))),475249515!=s.id)throw new E(3,3007);s=Zi(s,e,f,i,n,o)}Ii(t.Oa,c,s),u.Ea(h,s),l=new zi(s)})},findSegmentPosition:function(t){return l.find(t)},getSegmentReference:function(t){return l.get(t)}}}function rn(t){return t.Fa}function sn(t,e){var i,n=tn(t,an);i=un(t);var r=Ni(t,an),s=r.ha;s||(s=1);var a=0;if(r.F?a=r.F*(s-1)-r.presentationTimeOffset:r.B&&0<r.B.length&&(a=r.B[0].start),i={F:r.F,startTime:a,ha:s,presentationTimeOffset:r.presentationTimeOffset,B:r.B,ua:i},!i.F&&!i.B&&1<i.ua.length)throw new E(4,4002);if(!i.F&&!t.H.duration&&!i.B&&1==i.ua.length)throw new E(4,4002);if(i.B&&!i.B.length)throw new E(4,4002);return s=r=null,t.K.id&&t.u.id&&(s=t.K.id+","+t.u.id,r=e[s]),a=on(t.H.duration,i.ha,t.u.M,i),Ii(t.Oa,t.H.duration,a),r?(r.Ua(a),r.Pa(t.presentationTimeline.sa()-t.H.start)):(t.presentationTimeline.Ea(t.H.start,a),r=new zi(a),s&&(e[s]=r)),{createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:n,presentationTimeOffset:i.presentationTimeOffset}}function an(t){return t.Z}function on(t,e,i,n){var r=n.ua.length;n.B&&n.B.length!=n.ua.length&&(r=Math.min(n.B.length,n.ua.length));for(var s=[],a=n.startTime,o=0;o<r;o++){var u,h=n.ua[o],c=Ri(i,[h.ac]);u=null!=n.F?a+n.F:n.B?n.B[o].end:a+t,s.push(new Bt(o+e,a,u,function(t){return t}.bind(null,c),h.start,h.end)),a=u}return s}function un(t){return[t.u.Z,t.P.Z,t.K.Z].filter(_).map(function(t){return li(t,"SegmentURL")}).reduce(function(t,e){return 0<t.length?t:e}).map(function(t){var e=t.getAttribute("media");return t=pi(t,"mediaRange",yi,{start:0,end:null}),{ac:e,start:t.start,end:t.end}})}function hn(t,e,i,n){var r,s=dn(t);r=Ni(t,cn);var a=Ci(t,cn,"media"),o=Ci(t,cn,"index");if(r={F:r.F,Ha:r.Ha,ha:r.ha,presentationTimeOffset:r.presentationTimeOffset,B:r.B,Ta:a,Da:o},a=0+(r.Da?1:0),a+=r.B?1:0,a+=r.F?1:0,!a)throw new E(4,4002);if(1!=a&&(r.Da&&(r.B=null),r.F=null),!r.Da&&!r.Ta)throw new E(4,4002);if(r.Da){if(i=t.u.mimeType.split("/")[1],"mp4"!=i&&"webm"!=i)throw new E(4,4006);if("webm"==i&&!s)throw new E(4,4005);n=_i(r.Da,t.u.id,null,t.bandwidth||null,null),n=Ri(t.u.M,[n]),t=nn(t,e,s,n,0,null,i,r.presentationTimeOffset)}else r.F?(n||t.presentationTimeline.Va(r.F),t=fn(t,r)):(n=e=null,t.K.id&&t.u.id&&(n=t.K.id+","+t.u.id,e=i[n]),a=ln(t,r),Ii(t.Oa,t.H.duration,a),e?(e.Ua(a),e.Pa(t.presentationTimeline.sa()-t.H.start)):(t.presentationTimeline.Ea(t.H.start,a),e=new zi(a),n&&(i[n]=e)),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:s,presentationTimeOffset:r.presentationTimeOffset}}function cn(t){return t.Ga}function fn(t,e){var i=t.H.duration,n=e.F,r=e.ha,s=e.Ha,a=e.Ta,o=t.bandwidth||null,u=t.u.id,h=t.u.M;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 new Bt(t,e,e+n,function(){var i=_i(a,u,t+r,o,e*s);return Ri(h,[i])},0,null)}}}function ln(t,e){for(var i=[],n=0;n<e.B.length;n++){var r=e.B[n].start,s=n+e.ha;i.push(new Bt(s,r,e.B[n].end,function(t,e,i,n,r,s){return t=_i(t,e,r,i,s),Ri(n,[t]).map(function(t){return t.toString()})}.bind(null,e.Ta,t.u.id,t.bandwidth||null,t.u.M,s,(r+e.presentationTimeOffset)*e.Ha),0,null))}return i}function dn(t){var e=Ci(t,cn,"initialization");if(!e)return null;var i=t.u.id,n=t.bandwidth||null,r=t.u.M;return new Ut(function(){var t=_i(e,i,null,n,null);return Ri(r,[t])},0,null)}function pn(){this.m=this.l=this.j=this.c=this.a=null,this.g=[],this.b=null,this.h=[],this.v=1,this.i={},this.s=0,this.f=null,this.Ia=this.Ia.bind(this)}function mn(t){return t.a.request(0,M(t.g,t.c.retryParameters)).then(function(t){if(this.a)return bn(this,t.data,t.uri)}.bind(t))}function bn(t,e,i){var n=q(e),r=new DOMParser,s=null;e=null;try{s=r.parseFromString(n,"text/xml")}catch(a){}if(s&&"MPD"==s.documentElement.tagName&&(e=s.documentElement),!e)throw new E(4,4001);i=[i],n=li(e,"Location").map(di).filter(_),0<n.length&&(i=t.g=n),n=li(e,"BaseURL").map(di),i=Ri(i,n);var o=pi(e,"minBufferTime",bi);t.s=pi(e,"minimumUpdatePeriod",bi,-1);var u,h=pi(e,"availabilityStartTime",mi),n=pi(e,"timeShiftBufferDepth",bi),c=pi(e,"suggestedPresentationDelay",bi),r=pi(e,"maxSegmentDuration",bi),s=e.getAttribute("type")||"static";if(t.b)u=t.b.presentationTimeline;else{var f=Math.max(10,1.5*o);u=new Ft(h,null!=c?c:f)}var h=yn(t,{Oa:"static"!=s,presentationTimeline:u,K:null,H:null,P:null,u:null,bandwidth:void 0},i,e),c=h.duration,l=h.periods;return u.Eb("static"==s),u.za(c||1/0),u.Db(null!=n?n:1/0),u.Va(r||1),t.b?Promise.resolve():(e=li(e,"UTCTiming"),n=u.U(),h.Y&&t.a.vb(t.Ia),En(t,i,e,n).then(function(t){this.a&&(u.Bb(t),this.b={presentationTimeline:u,periods:l,offlineSessionIds:[],minBufferTime:o||0})}.bind(t)))}function yn(t,e,i,n){var r=pi(n,"mediaPresentationDuration",bi),s=[],a=0;n=li(n,"Period");for(var o=0;o<n.length;o++){var u=n[o],a=pi(u,"start",bi,a),h=pi(u,"duration",bi);if(null==h)if(o+1!=n.length){var c=pi(n[o+1],"start",bi);null!=c&&(h=c-a)}else null!=r&&(h=r-a);var u={start:a,duration:h,node:u,Y:!1},f=t,l=e,c=u;if(l.K=vn(c.node,null,i),l.H=c,l.K.id||(l.K.id="__shaka_period_"+c.start),f=li(c.node,"AdaptationSet").map(f.rc.bind(f,l)).filter(_),!f.length)throw new E(4,4004);for(l=0;l<f.length;l++)f[l].Y&&(c.Y=!0);if(f=wn(f),c={startTime:c.start,streamSets:f},s.push(c),f=e.K.id,t.h.every(I(f))&&(t.j(c),t.h.push(f),t.b&&t.b.periods.push(c)),null==h){a=null;break}a+=h}return null!=r?{periods:s,duration:r,Y:u.Y}:{periods:s,duration:a,Y:u.Y}}function gn(e,i){0>e.s||(e.f=t.setTimeout(e.Qc.bind(e),1e3*Math.max(Math.max(3,e.s)-i,0)))}function vn(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",frameRate:void 0},i=i||e.M;var n=li(t,"BaseURL").map(di),r=t.getAttribute("contentType")||e.contentType,s=t.getAttribute("mimeType")||e.mimeType,a=pi(t,"frameRate",Si)||e.frameRate;return r||(r=s.split("/")[0]),{M:Ri(i,n),Fa:fi(t,"SegmentBase")||e.Fa,Z:fi(t,"SegmentList")||e.Z,Ga:fi(t,"SegmentTemplate")||e.Ga,width:pi(t,"width",wi)||e.width,height:pi(t,"height",wi)||e.height,contentType:r,mimeType:s,codecs:t.getAttribute("codecs")||e.codecs,frameRate:a,id:t.getAttribute("id")}}function wn(t){var e={};t.forEach(function(t){e[t.id]=[t]}),t.forEach(function(t){var i=e[t.id];t.Wc.forEach(function(t){(t=e[t])&&t!=i&&(i.push.apply(i,t),t.forEach(function(t){e[t.id]=i}))})});var i=[],n=[];return F(e).forEach(function(t){if(!(0<=n.indexOf(t))){n.push(t);var e=new D;t.forEach(function(t){e.push(t.contentType||"",t)}),e.keys().forEach(function(t){var n=new D;e.get(t).forEach(function(t){n.push(t.language,t)}),n.keys().forEach(function(e){var r=n.get(e);e={language:e,type:t,primary:r.some(function(t){return t.$b}),drmInfos:r.map(function(t){return t.drmInfos}).reduce(P,[]),streams:r.map(function(t){return t.streams}).reduce(P,[])},i.push(e)})})}}),i}function Sn(t){var e;return e=0+(t.Fa?1:0),e+=t.Z?1:0,(e+=t.Ga?1:0)?(1!=e&&(t.Fa&&(t.Z=null),t.Ga=null),!0):"text"==t.contentType||"application"==t.contentType}function Tn(t,e,i,n){return e=Ri(e,[i]),e=M(e,t.c.retryParameters),e.method=n,t.a.request(0,e).then(function(t){if("HEAD"==n){if(!t.headers||!t.headers.date)return 0;t=t.headers.date}else t=q(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function En(t,e,i,n){i=i.map(function(t){return{scheme:t.getAttribute("schemeIdUri"),value:t.getAttribute("value")}});var r=t.c.dash.clockSyncUri;return n&&!i.length&&r&&i.push({scheme:"urn:mpeg:dash:utc:http-head:2014",value:r}),k(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 Tn(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 Tn(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":return Promise.reject();default:return Promise.reject()}}.bind(t))["catch"](function(){return 0})}function kn(t,e){var i=q(t),n=[],r=new DOMParser,s=null;try{s=r.parseFromString(i,"text/xml")}catch(a){throw new E(2,2005)}if(s){var o,u;if(!(i=s.getElementsByTagName("tt")[0]))throw new E(2,2006);for(r=i.getAttribute("ttp:frameRate"),s=i.getAttribute("ttp:subFrameRate"),o=i.getAttribute("ttp:frameRateMultiplier"),u=i.getAttribute("ttp:tickRate"),r=new Pn(r,s,o,u),s=kn.b(i.getElementsByTagName("styling")[0]),o=kn.b(i.getElementsByTagName("layout")[0]),i=kn.b(i.getElementsByTagName("body")[0]),u=0;u<i.length;u++){var h=kn.c(i[u],e,r,s,o);h&&n.push(h)}}return n}function Pn(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 An(t,e){var i=new xi(new DataView(t)),n=qi(1835295092,i);if(-1!=n)return kn(Bi(i,n-8).buffer,e);if(-1!=Hi(t,An.J))return[];throw new E(2,2007)}function _n(t){this.b=t,this.a=0}function In(t,e){var i;return e.lastIndex=t.a,i=(i=e.exec(t.b))?{position:i.index,length:i[0].length,Cc:i}:null,t.a!=t.b.length&&i&&i.position==t.a?(t.a+=i.length,i.Cc):null}function Rn(t){return t.a==t.b.length?null:(t=In(t,/[^ \t\n]*/gm))?t[0]:null}function Nn(t,e,i,n,r){if(t=q(t),t=t.replace(/\r\n|\r(?=[^\n]|$)/gm,"\n"),t=t.split(/\n{2,}/m),!/^WEBVTT($|[ \t\n])/m.test(t[0]))throw new E(2,2e3);n=[];for(var s=1;s<t.length;s++){var a=Nn.c(t[s].split("\n"),e,i,r);a&&n.push(a)}return n}function Cn(t,e,i,n){var r=new xi(new DataView(t)),s=qi(1835295092,r);if(-1!=s)return Cn.qa(Bi(r,s-8).buffer,e,i,n);if(-1!=Hi(t,Cn.ma))return[];throw new E(2,2008)}function Mn(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){if(e=e.target,200<=e.status&&299>=e.status){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},{});e.Bc&&(t=e.Bc),i({uri:t,data:e.response,headers:r})}else{r=null;try{r=G(e.response)}catch(s){}n(new E(1,1001,t,e.status,r))}},r.onerror=function(){n(new E(1,1002,t))},r.ontimeout=function(){n(new E(1,1003,t))};for(var s in e.headers)r.setRequestHeader(s,e.headers[s]);r.send(e.body)})}function xn(){this.a=null,this.c=[],this.b={}}function Dn(t,e,i){return Ln(t,e,"readwrite",function(t){return t.put(i)})}function On(t,e){var i=[];return Ln(t,"segment","readwrite",function(t){return t.openCursor()},function(t){if(t){if(e(t.value)){var n=t["delete"](),r=new R;n.onsuccess=r.resolve,n.onerror=Un.bind(null,n,r),i.push(r)}t["continue"]()}}).then(function(){return Promise.all(i)}).then(function(){return i.length})}function jn(t,e){var i=0;return Ln(t,e,"readonly",function(t){return t.openCursor(null,"prev")},function(t){t&&(i=t.key+1)}).then(function(){return i})}function Ln(t,e,i,n,r){i=t.a.transaction([e],i);var s=n(i.objectStore(e)),a=new R;r&&(s.onsuccess=function(t){r(t.target.result)}),s.onerror=Un.bind(null,s,a);var o={transaction:i,I:a};t.c.push(o);var u=function(){this.c.splice(this.c.indexOf(o),1)}.bind(t);return i.oncomplete=function(){u(),a.resolve(s.result)},i.onerror=function(t){u(),Un(s,a,t)},a}function Un(t,e,i){"AbortError"==t.error.name?e.reject(new E(9,9002)):e.reject(new E(9,9001,t.error)),i.preventDefault()}function Bn(t){return{offlineUri:"offline:"+t.key,originalManifestUri:t.originalManifestUri,duration:t.duration,size:t.size,tracks:t.periods[0].streams.map(function(t){return{id:t.id,active:!1,type:t.contentType,bandwidth:0,language:t.language,kind:t.kind||null,width:t.width,height:t.height,frameRate:t.frameRate,codecs:t.codecs}}),appMetadata:t.appMetadata}}function Fn(){}function Kn(t){var e=new Ft(null,0);e.za(t.duration);var i=t.drmInfo?[t.drmInfo]:[];return{presentationTimeline:e,minBufferTime:10,offlineSessionIds:t.sessionIds,periods:t.periods.map(function(t){return{startTime:t.startTime,streamSets:t.streams.map(function(n){var r=n.segments.map(function(t,e){return new Bt(e,t.startTime,t.endTime,function(){return[t.uri]},0,null)});return e.Ea(t.startTime,r),r=new zi(r),{language:n.language,type:n.contentType,primary:n.primary,drmInfos:i,streams:[{id:n.id,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:r.find.bind(r),getSegmentReference:r.get.bind(r),initSegmentReference:n.initSegmentUri?new Ut(function(){return[n.initSegmentUri]},0,null):null,presentationTimeOffset:n.presentationTimeOffset,mimeType:n.mimeType,codecs:n.codecs,bandwidth:0,width:n.width||void 0,height:n.height||void 0,kind:n.kind,encrypted:n.encrypted,keyId:n.keyId,allowedByApplication:!0,allowedByKeySystem:!0}]}})}})}}function Vn(t,e,i){this.b={},this.i=i,this.m=t,this.l=e,this.j=this.a=null,this.f=this.g=this.h=this.c=0}function qn(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),L:i.L,D:i.D,gb:n,Ca:r})}function Hn(t,e){t.c=0,t.h=0,t.g=0,t.f=0,F(t.b).forEach(function(t){t.forEach(function(t){null!=t.D?this.c+=t.D-t.L+1:this.g+=t.gb}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=F(t.b).map(function(t){var e=0,i=function(){if(!this.i)return Promise.reject(new E(9,9002));if(e>=t.length)return Promise.resolve();var n=t[e++];return Gn(this,n).then(i)}.bind(this);return i()}.bind(t));return t.b={},t.j=Promise.all(i);
}function Gn(t,e){var i=M(e.uris,t.l);(e.L||null!=e.D)&&(i.headers.Range="bytes="+e.L+"-"+(null==e.D?"":e.D));var n;return t.m.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,e.Ca(t.data)):Promise.reject(new E(9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new E(9,9002));null==e.D?(this.a.size+=n,this.f+=e.gb):this.h+=n;var t=(this.h+this.f)/(this.c+this.g),i=Bn(this.a);this.i.progressCallback(i,t)}.bind(t))}function zn(t){this.a=new xn,this.c=t,this.j=Wn(this),this.g=null,this.v=!1,this.i=null,this.l=[],this.f=-1,this.m=0,this.b=null,this.h=new Vn(t.h,t.getConfiguration().streaming.retryParameters,this.j)}function $n(){return!!t.indexedDB}function Yn(t,e,i,n){function r(){}var s,a,o,u=t.c.h,h=t.c.getConfiguration();return gt(e,u,h.manifest.retryParameters,n).then(function(t){return tr(this),o=new t,o.configure(h.manifest),o.start(e,u,this.s.bind(this),i)}.bind(t)).then(function(t){return tr(this),s=t,a=new it(u,i,r),a.configure(h.drm),a.init(s,!0)}.bind(t)).then(function(){return tr(this),Zn(s)}.bind(t)).then(function(){return tr(this),st(a)}.bind(t)).then(function(){return tr(this),o.stop()}.bind(t)).then(function(){return tr(this),{manifest:s,Pb:a}}.bind(t))["catch"](function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Wn(t){return{trackSelectionCallback:t.A.bind(t),progressCallback:function(t,e){if(t||e)return null}}}function Xn(t){return t.a.a?Promise.resolve():t.a.init(bs)}function Jn(t){var e=t.g?t.g.o():Promise.resolve();return t.g=null,t.b=null,t.v=!1,t.i=null,t.l=[],t.f=-1,e}function Zn(t){return t=t.periods.map(function(t){return t.streamSets}).reduce(P,[]).map(function(t){return t.streams}).reduce(P,[]),Promise.all(t.map(function(t){return t.createSegmentIndex()}))}function Qn(t,e,i,n){for(var r=[],s=t.b.presentationTimeline.ra(),a=s,o=n.findSegmentPosition(s),u=null!=o?n.getSegmentReference(o):null;u;){var h=t.a.b.segment++;qn(t.h,i.type,u,(u.endTime-u.startTime)*n.bandwidth/8,function(t,e,i,n){return e={key:t,data:n,manifestKey:this.f,streamNumber:i,segmentNumber:e},this.l.push(t),Dn(this.a,"segment",e)}.bind(t,h,u.position,n.id)),r.push({startTime:u.startTime,endTime:u.endTime,uri:"offline:"+t.f+"/"+n.id+"/"+h}),a=u.endTime+e.startTime,u=n.getSegmentReference(++o)}return t.m=Math.max(t.m,a-s),e=null,n.initSegmentReference&&(h=t.a.b.segment++,e="offline:"+t.f+"/"+n.id+"/"+h,qn(t.h,i.type,n.initSegmentReference,0,function(t,e){var i={key:h,data:e,manifestKey:this.f,streamNumber:t,segmentNumber:-1};return this.l.push(h),Dn(this.a,"segment",i)}.bind(t,n.id))),{id:n.id,primary:i.primary,presentationTimeOffset:n.presentationTimeOffset||0,contentType:i.type,mimeType:n.mimeType,codecs:n.codecs,frameRate:n.frameRate,kind:n.kind,language:i.language,width:n.width||null,height:n.height||null,initSegmentUri:e,encrypted:n.encrypted,keyId:n.keyId,segments:r}}function tr(t){if(!t.c)throw new E(9,9002)}function er(t){ys.push(t)}function ir(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase(),e=new Event(e,t);t.target.dispatchEvent(e)}function nr(t){for(this.c=[],this.b=[],this.a=[],t=new xi(new DataView(t.buffer));Di(t);){var e=qi(1886614376,t);if(-1==e)break;var i=t.a-8,n=Oi(t);if(1<n)Fi(t,e-(t.a-i));else{Fi(t,3);var r=tt(Bi(t,16)),s=[];if(0<n)for(var n=Li(t),a=0;a<n;++a){var o=tt(Bi(t,16));s.push(o)}n=Li(t),Fi(t,n),this.b.push.apply(this.b,s),this.c.push(r),this.a.push({start:i,end:t.a-1}),t.a!=i+e&&Fi(t,e-(t.a-i))}}}function rr(t,e){try{var i=new sr(t,e);return Promise.resolve(i)}catch(n){return Promise.reject(n)}}function sr(t,e){this.keySystem=t;for(var i=!1,n=0;n<e.length;++n){var r=e[n],s={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:r.initDataTypes,sessionTypes:["temporary"],label:r.label},a=!1;if(r.audioCapabilities)for(var o=0;o<r.audioCapabilities.length;++o){var u=r.audioCapabilities[o];if(u.contentType){var a=!0,h=u.contentType.split(";")[0];MSMediaKeys.isTypeSupported(this.keySystem,h)&&(s.audioCapabilities.push(u),i=!0)}}if(r.videoCapabilities)for(o=0;o<r.videoCapabilities.length;++o)u=r.videoCapabilities[o],u.contentType&&(a=!0,h=u.contentType.split(";")[0],MSMediaKeys.isTypeSupported(this.keySystem,h)&&(s.videoCapabilities.push(u),i=!0));if(a||(i=MSMediaKeys.isTypeSupported(this.keySystem,"video/mp4")),"required"==r.persistentState&&(s.persistentState="required",s.sessionTypes=["persistent-license"]),i)return void(this.a=s)}throw i=Error("Unsupported keySystem"),i.name="NotSupportedError",i.code=DOMException.NOT_SUPPORTED_ERR,i}function ar(t){var e=this.mediaKeys;return e&&e!=t&&ur(e,null),delete this.mediaKeys,(this.mediaKeys=t)?ur(t,this):Promise.resolve()}function or(t){this.a=new MSMediaKeys(t),this.b=new O}function ur(t,e){function i(){e.msSetMediaKeys(n.a),e.removeEventListener("loadedmetadata",i)}if(L(t.b),!e)return Promise.resolve();j(t.b,e,"msneedkey",cr);var n=t;try{return 1<=e.readyState?e.msSetMediaKeys(t.a):e.addEventListener("loadedmetadata",i),Promise.resolve()}catch(r){return Promise.reject(r)}}function hr(t){Ie.call(this),this.c=null,this.g=t,this.b=this.a=null,this.f=new O,this.sessionId="",this.expiration=NaN,this.closed=new R,this.keyStatuses=new dr}function cr(t){var e=document.createEvent("CustomEvent");if(e.initCustomEvent("encrypted",!1,!1,null),e.initDataType="cenc",t=t.initData){var i=new nr(t);if(!(1>=i.a.length)){for(var n=[],r=0;r<i.a.length;r++)n.push(t.subarray(i.a[r].start,i.a[r].end+1));for(r=fr,t=[],i=0;i<n.length;++i){for(var s=!1,a=0;a<t.length&&!(s=r?r(n[i],t[a]):n[i]===t[a]);++a);s||t.push(n[i])}for(r=n=0;r<t.length;r++)n+=t[r].length;for(n=new Uint8Array(n),r=i=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;t=n}}e.initData=t,this.dispatchEvent(e)}function fr(t,e){return et(t,e)}function lr(t,e){t.keyStatuses.ab(e),t.dispatchEvent(new _e("keystatuseschange"))}function dr(){this.size=0,this.a=void 0}function pr(){return Promise.reject(Error("The key system specified is not supported."))}function mr(t){return t?Promise.reject(Error("MediaKeys not supported.")):Promise.resolve()}function br(){throw new TypeError("Illegal constructor.")}function yr(){throw new TypeError("Illegal constructor.")}function gr(t,e){try{var i=new wr(t,e);return Promise.resolve(i)}catch(n){return Promise.reject(n)}}function vr(t){var e=this.mediaKeys;return e&&e!=t&&Tr(e,null),delete this.mediaKeys,(this.mediaKeys=t)&&Tr(t,this),Promise.resolve()}function wr(t,e){this.a=this.keySystem=t;var i=!0;"org.w3.clearkey"==t&&(this.a="webkit-org.w3.clearkey",i=!1);var n,r=!1;n=document.getElementsByTagName("video"),n=n.length?n[0]:document.createElement("video");for(var s=0;s<e.length;++s){var a=e[s],o={audioCapabilities:[],videoCapabilities:[],persistentState:"optional",distinctiveIdentifier:"optional",initDataTypes:a.initDataTypes,sessionTypes:["temporary"],label:a.label},u=!1;if(a.audioCapabilities)for(var h=0;h<a.audioCapabilities.length;++h){var c=a.audioCapabilities[h];c.contentType&&(u=!0,n.canPlayType(c.contentType.split(";")[0],this.a)&&(o.audioCapabilities.push(c),r=!0))}if(a.videoCapabilities)for(h=0;h<a.videoCapabilities.length;++h)c=a.videoCapabilities[h],c.contentType&&(u=!0,n.canPlayType(c.contentType,this.a)&&(o.videoCapabilities.push(c),r=!0));if(u||(r=n.canPlayType("video/mp4",this.a)||n.canPlayType("video/webm",this.a)),"required"==a.persistentState&&(i?(o.persistentState="required",o.sessionTypes=["persistent-license"]):r=!1),r)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 Sr(t){this.g=t,this.b=null,this.a=new O,this.c=[],this.f={}}function Tr(t,e){t.b=e,L(t.a),e&&(j(t.a,e,"webkitneedkey",t.qc.bind(t)),j(t.a,e,"webkitkeymessage",t.pc.bind(t)),j(t.a,e,"webkitkeyadded",t.nc.bind(t)),j(t.a,e,"webkitkeyerror",t.oc.bind(t)))}function Er(t,e){var i=t.f[e];return i?i:(i=t.c.shift())?(i.sessionId=e,t.f[e]=i):null}function kr(t,e,i){Ie.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 R,this.keyStatuses=new _r}function Pr(t,e,i){if(t.h)return Promise.reject(Error("The session is already initialized."));t.h=!0;var n;try{if("persistent-license"==t.g)if(i)n=new Uint8Array(z("LOAD_SESSION|"+i));else{var r=z("PERSISTENT|"),s=new Uint8Array(r.byteLength+e.byteLength);s.set(new Uint8Array(r),0),s.set(new Uint8Array(e),r.byteLength),n=s}else n=new Uint8Array(e)}catch(a){return Promise.reject(a)}t.b=new R;try{t.f.webkitGenerateKeyRequest(t.c,n)}catch(a){if("InvalidStateError"!=a.name)return t.b=null,Promise.reject(a);setTimeout(function(){try{this.f.webkitGenerateKeyRequest(this.c,n)}catch(t){this.b.reject(t),this.b=null}}.bind(t),10)}return t.b}function Ar(t,e){t.keyStatuses.ab(e),t.dispatchEvent(new _e("keystatuseschange"))}function _r(){this.size=0,this.a=void 0}function Ir(t){if(this.c=[],this.b=[],this.ia=ws,t)try{t(this.W.bind(this),this.a.bind(this))}catch(e){this.a(e)}}function Rr(t){var e=new Ir;return e.W(t),e}function Nr(t){var e=new Ir;return e.a(t),e}function Cr(t){function e(t,e,i){t.ia==ws&&(r[e]=i,n++,n==r.length&&t.W(r))}var i=new Ir;if(!t.length)return i.W([]),i;for(var n=0,r=Array(t.length),s=i.a.bind(i),a=0;a<t.length;++a)t[a]&&t[a].then?t[a].then(e.bind(null,i,a),s):e(i,a,t[a]);return i}function Mr(t){for(var e=new Ir,i=e.W.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 xr(t,e,i){Ts.push(function(){if(i&&"function"==typeof i){try{var t=i(this.Ma)}catch(n){return void e.a(n)}var r;try{r=t&&t.then}catch(n){return void e.a(n)}t instanceof Ir?t==e?e.a(new TypeError("Chaining cycle detected")):t.then(e.W.bind(e),e.a.bind(e)):r?Dr(t,r,e):e.W(t)}else 1==this.ia?e.W(this.Ma):e.a(this.Ma)}.bind(t)),null==Ss&&(Ss=jr(Or))}function Dr(t,e,i){try{var n=!1;e.call(t,function(t){if(!n){n=!0;var e;try{e=t&&t.then}catch(r){return void i.a(r)}e?Dr(t,e,i):i.W(t)}},i.a.bind(i))}catch(r){i.a(r)}}function Or(){for(;Ts.length;){null!=Ss&&(Lr(Ss),Ss=null);var t=Ts;Ts=[];for(var e=0;e<t.length;++e)t[e]()}}function jr(){return 0}function Lr(){}function Ur(){return{droppedVideoFrames:this.webkitDroppedFrameCount,totalVideoFrames:this.webkitDecodedFrameCount,corruptedVideoFrames:0,creationTime:NaN,totalFrameDelay:0}}var Br,Fr=this;Fr.cd=!0,e("shaka.abr.SimpleAbrManager",c),Br=c.prototype,Br.stop=function(){this.h=null,this.f=!1,this.g={},this.a={},this.c=null},Br.init=function(t){this.h=t},Br.chooseStreams=function(t){for(var e in t)this.g[e]=t[e];if(e={},"audio"in t){var i=f(this);i?(e.audio=i,this.a.audio=i):delete this.a.audio}return"video"in t&&((i=l(this))?(e.video=i,this.a.video=i):delete this.a.video),"text"in t&&(e.text=t.text.streams[0]),this.c=Date.now(),e},Br.enable=function(){this.f=!0},Br.disable=function(){this.f=!1},Br.segmentDownloaded=function(t,e,i){var n=this.b;if(e-=t,16e3>i||(t=8e3*i/e,e/=1e3,n.a+=i,r(n.c,e,t),r(n.f,e,t)),null!=this.c&&this.f)t:{if(this.i){if(8e3>Date.now()-this.c)break t}else{if(!(128e3<=this.b.a))break t;this.i=!0}i={},(n=f(this))&&(i.audio=n,this.a.audio=n),(n=l(this))&&(i.video=n,this.a.video=n),this.c=Date.now(),this.h(i)}},Br.getBandwidthEstimate=function(){return o(this.b)},Br.setDefaultEstimate=function(t){this.b.b=t};var Kr=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;Br=p.prototype,Br.R="",Br.ka="",Br.T="",Br.wa=null,Br.O="",Br.ca="",Br.toString=function(){var t=[],e=this.R;if(e&&t.push(v(e,Vr,!0),":"),e=this.T){t.push("//");var i=this.ka;i&&t.push(v(i,Vr,!0),"@"),t.push(encodeURIComponent(e).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e=this.wa,null!=e&&t.push(":",String(e))}return(e=this.O)&&(this.T&&"/"!=e.charAt(0)&&t.push("/"),t.push(v(e,"/"==e.charAt(0)?Hr:qr,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ca)&&t.push("#",v(e,zr)),t.join("")},Br.resolve=function(t){var e=new p(this);"data"===e.R&&(e=new p);var i=!!t.R;i?m(e,t.R):i=!!t.ka,i?e.ka=t.ka:i=!!t.T,i?e.T=t.T:i=null!=t.wa;var n=t.O;if(i)b(e,t.wa);else if(i=!!t.O){if("/"!=n.charAt(0))if(this.T&&!this.O)n="/"+n;else{var r=e.O.lastIndexOf("/");-1!=r&&(n=e.O.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("/"),s=[],a=0;a<n.length;){var o=n[a++];"."==o?r&&a==n.length&&s.push(""):".."==o?((1<s.length||1==s.length&&""!=s[0])&&s.pop(),r&&a==n.length&&s.push("")):(s.push(o),r=!0)}n=s.join("/")}}return i?e.O=n:i=""!==t.a.toString(),i?y(e,T(t.a)):i=!!t.ca,i&&(e.ca=t.ca),e};var Vr=/[#\/\?@]/g,qr=/[\#\?:]/g,Hr=/[\#\?]/g,Gr=/[\#\?@]/g,zr=/#/g;S.prototype.a=null,S.prototype.c=null,S.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 s=i;""!==n[r]&&(s+="="+encodeURIComponent(n[r])),e.push(s)}return this.b=e.join("&")},e("shaka.util.Error",E),E.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},E.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},E.Code={UNSUPPORTED_SCHEME:1e3,BAD_HTTP_STATUS:1001,HTTP_ERROR:1002,TIMEOUT:1003,MALFORMED_DATA_URI:1004,UNKNOWN_DATA_URI_ENCODING:1005,INVALID_TEXT_HEADER:2e3,INVALID_TEXT_CUE:2001,UNABLE_TO_DETECT_ENCODING:2003,BAD_ENCODING:2004,INVALID_XML:2005,INVALID_TTML:2006,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,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,INDEXED_DB_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},e("shaka.net.NetworkingEngine.RequestType",{MANIFEST:0,SEGMENT:1,LICENSE:2});var $r={};e("shaka.net.NetworkingEngine.registerScheme",function(t,e){$r[t]=e}),e("shaka.net.NetworkingEngine.unregisterScheme",function(t){delete $r[t]}),N.prototype.wc=function(t){this.b.push(t)},N.prototype.registerRequestFilter=N.prototype.wc,N.prototype.Yc=function(t){var e=this.b;t=e.indexOf(t),0<=t&&e.splice(t,1)},N.prototype.unregisterRequestFilter=N.prototype.Yc,N.prototype.Mb=function(){this.b=[]},N.prototype.clearAllRequestFilters=N.prototype.Mb,N.prototype.vb=function(t){this.c.push(t)},N.prototype.registerResponseFilter=N.prototype.vb,N.prototype.Gb=function(t){var e=this.c;t=e.indexOf(t),0<=t&&e.splice(t,1)},N.prototype.unregisterResponseFilter=N.prototype.Gb,N.prototype.Nb=function(){this.c=[]},N.prototype.clearAllResponseFilters=N.prototype.Nb,N.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"](A));return Promise.all(t)},N.prototype.request=function(t,e){if(this.f)return Promise.reject();for(var i=Date.now(),n=this.b,r=0;r<n.length;r++)try{n[r](t,e)}catch(s){return Promise.reject(s)}for(var r=e.retryParameters||{},n=r.maxAttempts||1,a=r.backoffFactor||2,o=null==r.baseDelay?1e3:r.baseDelay,u=this.g(t,e,0),r=1;r<n;r++)u=u["catch"](this.i.bind(this,t,e,o,r%e.uris.length)),o*=a;return this.a.push(u),u.then(function(e){this.a.splice(this.a.indexOf(u),1);var n=Date.now();return this.h&&1==t&&this.h(i,n,e.data.byteLength),e}.bind(this))["catch"](function(t){return this.a.splice(this.a.indexOf(u),1),Promise.reject(t)}.bind(this))},N.prototype.request=N.prototype.request,N.prototype.g=function(t,e,i){if(this.f)return Promise.reject();var n=new p(e.uris[i]),r=n.R;return r||(r=location.protocol,r=r.slice(0,-1),m(n,r),e.uris[i]=n.toString()),(r=$r[r])?r(e.uris[i],e).then(function(e){for(var i=this.c,n=0;n<i.length;n++)i[n](t,e);return e}.bind(this)):Promise.reject(new E(1,1e3,n))},N.prototype.i=function(e,i,n,r){var s=new R,a=i.retryParameters||{};return t.setTimeout(s.resolve,n*(1+(2*Math.random()-1)*(null==a.fuzzFactor?.5:a.fuzzFactor))),s.then(this.g.bind(this,e,i,r))},Br=D.prototype,Br.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},Br.set=function(t,e){this.a[t]=e},Br.has=function(t){return this.a.hasOwnProperty(t)},Br.get=function(t){return(t=this.a[t])?t.slice():null},Br.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)},Br.keys=function(){var t,e=[];for(t in this.a)e.push(t);return e},O.prototype.o=function(){return L(this),this.a=null,Promise.resolve()},O.prototype.ja=function(t,e){for(var i=this.a.get(e)||[],n=0;n<i.length;++n){var r=i[n];r.target==t&&(r.ja(),this.a.remove(e,r))}},U.prototype.ja=function(){this.target&&(this.target.removeEventListener(this.type,this.a,!1),this.a=this.target=null)},Br=it.prototype,Br.o=function(){this.c=!0;var t=this.a.map(function(t){return t.ya.close()["catch"](A),t.ya.closed});return this.j.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null)["catch"](A)),this.v&&W(this.v),this.f=this.l=this.h=this.m=this.b=this.v=null,this.a=[],this.s=[],this.g=this.i=this.G=null,Promise.all(t)},Br.configure=function(t){this.i=t},Br.init=function(t,e){var i={},n=[];return this.C=e,this.s=t.offlineSessionIds,ot(this,t,e||0<t.offlineSessionIds.length,i,n),n.length?ut(this,i,n):(this.A=!0,Promise.resolve())},Br.keySystem=function(){return this.b?this.b.keySystem:""},Br.bc=function(t){for(var e=new Uint8Array(t.initData),i=0;i<this.a.length;++i)if(et(e,this.a[i].initData))return;pt(this,t.initDataType,e)},Br.sb=function(t){var e=t.target,i=M([this.b.licenseServerUri],this.i.retryParameters);i.body=t.message,i.method="POST","com.microsoft.playready"==this.b.keySystem&&mt(i),this.G.request(2,i).then(function(t){return this.c?Promise.reject():e.update(t.data)}.bind(this),function(t){return this.c?Promise.resolve():void this.g(new E(6,6007,t))}.bind(this))["catch"](function(t){return this.c?Promise.resolve():void this.g(new E(6,6008,t.message))}.bind(this))},Br.nb=function(t){t=t.target;var e;for(e=0;e<this.a.length&&this.a[e].ya!=t;++e);if(e!=this.a.length){var i=t.keyStatuses,n=!1;i.forEach||(i=[]),i.forEach(function(t,i){if("string"==typeof i){var r=i;i=t,t=r}if("com.microsoft.playready"==this.b.keySystem&&16==i.byteLength){var r=new DataView(i),s=r.getUint32(0,!0),a=r.getUint16(4,!0),o=r.getUint16(6,!0);r.setUint32(0,s,!1),r.setUint16(4,a,!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.j.resolve()),"expired"==t&&(n=!0),r=tt(new Uint8Array(i)),this.w[r]=t}.bind(this)),i=t.expiration-Date.now(),(0>i||n&&1e3>i)&&(this.a.splice(e,1),t.close()),X(this.v)}},Br.vc=function(){V(this.w,function(t,e){return"expired"==e})&&this.g(new E(6,6014)),this.J(this.w)};var Yr={},Wr={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){Wr[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){Yr[t]=e});var Xr={};e("shaka.media.TextEngine.registerParser",function(t,e){Xr[t]=e}),e("shaka.media.TextEngine.unregisterParser",function(t){delete Xr[t]}),e("shaka.media.TextEngine.makeCue",wt);var Jr=t.VTTCue||t.TextTrackCue;vt.prototype.o=function(){return this.c&&Et(this,function(){return!0}),this.c=this.g=null,Promise.resolve()},vt.prototype.remove=function(t,e){return Promise.resolve().then(function(){this.c&&(Et(this,function(i){return!(i.startTime>=e||i.endTime<=t)}),null==this.b||e<=this.b||t>=this.a||(t<=this.b&&e>=this.a?this.b=this.a=null:t<=this.b&&e<this.a?this.b=e:t>this.b&&e>=this.a&&(this.a=t)))}.bind(this))},Br=At.prototype,Br.o=function(){this.i=!0;var t,e=[];for(t in this.a){var i=this.a[t],n=i[0];for(this.a[t]=i.slice(0,1),n&&e.push(n.p["catch"](A)),n=1;n<i.length;++n)i[n].p["catch"](A),i[n].p.reject()}return this.b&&e.push(this.b.o()),Promise.all(e).then(function(){this.h.o(),this.b=this.j=this.f=this.g=this.h=null,this.c={},this.a={}}.bind(this))},Br.init=function(t,e){for(var i in t){var n=t[i];"text"==i?this.b=new vt(this.j,n,e):(n=this.f.addSourceBuffer(n),j(this.h,n,"error",this.Sc.bind(this,i)),j(this.h,n,"updateend",this.va.bind(this,i)),this.c[i]=n,this.a[i]=[])}},Br.remove=function(t,e,i){return"text"==t?this.b.remove(e,i):Ot(this,t,this.xb.bind(this,t,e,i))},Br.endOfStream=function(t){return jt(this,function(){t?this.f.endOfStream(t):this.f.endOfStream()}.bind(this))},Br.za=function(t){return jt(this,function(){this.f.duration=t}.bind(this))},Br.da=function(){return this.f.duration},Br.Rc=function(t,e){this.c[t].appendBuffer(e)},Br.xb=function(t,e,i){i<=e?this.va(t):this.c[t].remove(e,i)},Br.Ib=function(t){var e=this.c[t].appendWindowEnd;this.c[t].abort(),this.c[t].appendWindowEnd=e,this.va(t)},Br.Rb=function(t){this.g.currentTime-=.001,this.va(t)},Br.Hc=function(t,e){this.c[t].timestampOffset=e,this.va(t)},Br.Fc=function(t,e){this.c[t].appendWindowEnd=e+.04,this.va(t)},Br.Sc=function(t){this.a[t][0].p.reject(new E(3,3014,this.g.error?this.g.error.code:0))},Br.va=function(t){var e=this.a[t][0];e&&(e.p.resolve(),Lt(this,t))},e("shaka.media.InitSegmentReference",Ut),e("shaka.media.SegmentReference",Bt),e("shaka.media.PresentationTimeline",Ft),Ft.prototype.da=function(){return this.a},Ft.prototype.getDuration=Ft.prototype.da,Ft.prototype.za=function(t){this.a=t},Ft.prototype.setDuration=Ft.prototype.za,Ft.prototype.Bb=function(t){this.h=t},Ft.prototype.setClockOffset=Ft.prototype.Bb,Ft.prototype.Eb=function(t){this.g=t},Ft.prototype.setStatic=Ft.prototype.Eb,Ft.prototype.Ub=function(){return this.c},Ft.prototype.getSegmentAvailabilityDuration=Ft.prototype.Ub,Ft.prototype.Db=function(t){this.c=t},Ft.prototype.setSegmentAvailabilityDuration=Ft.prototype.Db,Ft.prototype.Ea=function(t,e){e.length&&(this.b=e.reduce(function(t,e){return Math.max(t,e.endTime-e.startTime)},this.b),t||(this.f=Math.max(this.f,e[0].startTime)))},Ft.prototype.notifySegments=Ft.prototype.Ea,Ft.prototype.Va=function(t){this.b=Math.max(this.b,t)},Ft.prototype.notifyMaxSegmentDuration=Ft.prototype.Va,Ft.prototype.U=function(){return 1/0==this.a&&!this.g},Ft.prototype.isLive=Ft.prototype.U,Ft.prototype.fa=function(){return 1/0!=this.a&&!this.g},Ft.prototype.isInProgress=Ft.prototype.fa,Ft.prototype.ra=function(){return Math.max(Math.min(this.f,this.ea()),this.sa())},Ft.prototype.getEarliestStart=Ft.prototype.ra,Ft.prototype.sa=function(){return 1/0==this.c?0:Math.max(0,this.ea()-this.c-this.i)},Ft.prototype.getSegmentAvailabilityStart=Ft.prototype.sa,Ft.prototype.ea=function(){return this.U()||this.fa()?Math.min(Math.max(0,(Date.now()+this.h)/1e3-this.b-this.j),this.a):this.a},Ft.prototype.getSegmentAvailabilityEnd=Ft.prototype.ea,Ft.prototype.Ra=function(){return Math.max(0,this.ea()-(this.U()||this.fa()?this.i:0))},Ft.prototype.getSeekRangeEnd=Ft.prototype.Ra,Br=Kt.prototype,Br.o=function(){var e=this.b.o();return this.b=null,zt(this),null!=this.f&&(t.clearInterval(this.f),this.f=null),this.m=this.l=this.c=this.a=null,e},Br.mc=function(){this.i=null,Gt(this);var t=Pt(this.a.buffered,this.a.currentTime),e=kt(this.a.buffered)>=this.a.duration-.05||this.a.ended;this.g?(e||t>this.j)&&Ht(this,!1):!e&&.5>t&&Ht(this,!0)},Br.Qa=function(){return this.h},Br.ic=function(){this.a.playbackRate!=(this.g||0>this.h?0:this.h)&&$t(this,this.a.playbackRate)},Br.ob=function(){this.b.ja(this.a,"loadedmetadata");var t=qt(this);.001>Math.abs(this.a.currentTime-t)?(j(this.b,this.a,"seeking",this.qb.bind(this)),j(this.b,this.a,"playing",this.pb.bind(this))):(j(this.b,this.a,"seeking",this.kc.bind(this)),this.a.currentTime=t)},Br.kc=function(){this.b.ja(this.a,"seeking"),j(this.b,this.a,"seeking",this.qb.bind(this)),j(this.b,this.a,"playing",this.pb.bind(this))},Br.qb=function(){var t=this.a.currentTime,e=Yt(this,t);.001<Math.abs(e-t)?Wt(this,t,e):this.m()},Br.pb=function(){var t=this.a.currentTime,e=Yt(this,t);.001<Math.abs(e-t)&&Wt(this,t,e)},Jt.prototype.o=function(){for(var t in this.b)Te(this.b[t]);return this.g=this.b=this.l=this.h=this.A=this.w=this.j=this.v=this.G=this.C=this.a=this.S=this.f=this.m=null,this.c=!0,Promise.resolve()},Jt.prototype.configure=function(t){this.g=t,this.m.j=this.i*Math.max(this.a.minBufferTime||0,this.g.rebufferingGoal)},Jt.prototype.init=function(){var t=this.G(this.a.periods[ye(this,Vt(this.m))]);return B(t)?Promise.reject(new E(5,5005)):ie(this,t).then(function(){this.w&&this.w()}.bind(this))},Jt.prototype.X=function(t){if(!this.c&&!t.ga&&null!=t.aa&&!t.ba)if(t.aa=null,t.la)we(this,t);else{try{var e=ae(this,t);null!=e&&Se(this,t,e)}catch(i){return void this.j(i)}e=F(this.b),me(this,t),e.every(function(t){return t.endOfStream})&&this.f.endOfStream()}},Ee.prototype.then=function(t){return this.a=this.a.then(t).then(function(t){return this.c?(this.h(),Promise.reject(this.i)):Promise.resolve(t)}.bind(this)),this},_e.prototype.preventDefault=function(){},_e.prototype.stopImmediatePropagation=function(){this.a=!0},_e.prototype.stopPropagation=function(){},Ie.prototype.addEventListener=function(t,e){this.Aa.push(t,e)},Ie.prototype.removeEventListener=function(t,e){this.Aa.remove(t,e)},Ie.prototype.dispatchEvent=function(t){for(var e=this.Aa.get(t.type)||[],i=0;i<e.length;++i){t.target=this.S,t.currentTarget=this.S;var n=e[i];try{n.handleEvent?n.handleEvent(t):n.call(this,t)}catch(r){}if(t.a)break}return t.defaultPrevented};var Zr=1,Qr=2,ts={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"};i(Be),e("shaka.Player",Be),Be.prototype.o=function(){this.w=!0;var t=Promise.resolve();return this.j&&(t=Pe(this.j,new E(7,7e3))),t.then(function(){var t=Promise.all([Ve(this),this.v?this.v.o():null,this.h?this.h.o():null]);return this.a=this.h=this.fb=this.v=this.m=this.f=null,t}.bind(this))},Be.prototype.destroy=Be.prototype.o,Be.version="v2.0.1";var es={};Be.registerSupportPlugin=function(t,e){es[t]=e},Be.isBrowserSupported=function(){return!!(t.Promise&&t.Uint8Array&&Array.prototype.forEach&&t.MediaSource&&t.MediaKeys&&t.navigator&&t.navigator.requestMediaKeySystemAccess&&t.MediaKeySystemAccess&&t.MediaKeySystemAccess.prototype.getConfiguration)},Be.probeSupport=function(){return bt().then(function(t){var e=yt(),i=_t();t={manifest:e,media:i,drm:t};for(var n in es)t[n]=es[n]();return t})},Be.prototype.load=function(t,e,i){var n=this.eb(),r=new Ee;return this.j=r,this.dispatchEvent(new _e("loading")),ke(r.then(function(){return n}).then(function(){return gt(t,this.h,this.a.manifest.retryParameters,i)}.bind(this)).then(function(e){return this.l=new e,this.l.configure(this.a.manifest),this.l.start(t,this.h,this.La.bind(this),this.$.bind(this),this.Jc.bind(this))}.bind(this)).then(function(e){return this.c=e,this.na=t,this.g=new it(this.h,this.$.bind(this),this.Kc.bind(this)),this.g.configure(this.a.drm),this.g.init(e,!1)}.bind(this)).then(function(){return this.c.periods.forEach(this.La.bind(this)),this.X=Date.now()/1e3,Promise.all([nt(this.g,this.f),this.oa])}.bind(this)).then(function(){return this.i=new Kt(this.f,this.c.presentationTimeline,1*Math.max(this.c.minBufferTime||0,this.a.streaming.rebufferingGoal),e||null,this.Fb.bind(this),this.Lc.bind(this)),this.G=new At(this.f,this.A,this.m),this.b=new Jt(this.i,this.G,this.h,this.c,this.Ic.bind(this),this.Kb.bind(this),this.$.bind(this)),this.b.configure(this.a.streaming),this.b.init()}.bind(this)).then(function(){this.c.periods.forEach(this.La.bind(this)),Xe(this),We(this),this.a.abr.manager.init(this.bb.bind(this)),this.j=null}.bind(this)))["catch"](function(t){return this.j==r&&(this.j=null,this.dispatchEvent(new _e("unloading"))),Promise.reject(t)}.bind(this))},Be.prototype.load=Be.prototype.load,Be.prototype.configure=function(t){t.abr&&t.abr.manager&&t.abr.manager!=this.a.abr.manager&&(this.a.abr.manager.stop(),t.abr.manager.init(this.bb.bind(this))),Ae(this.a,t,He(this),qe(),""),Ke(this)},Be.prototype.configure=Be.prototype.configure,Be.prototype.getConfiguration=function(){var t=He(this);return Ae(t,this.a,He(this),qe(),""),t},Be.prototype.getConfiguration=Be.prototype.getConfiguration,Be.prototype.Ac=function(){var t=He(this);t.abr&&t.abr.manager&&t.abr.manager!=this.a.abr.manager&&(this.a.abr.manager.stop(),t.abr.manager.init(this.bb.bind(this))),this.a=He(this),Ke(this)},Be.prototype.resetConfiguration=Be.prototype.Ac,Be.prototype.kb=function(){return this.h},Be.prototype.getNetworkingEngine=Be.prototype.kb,Be.prototype.Sb=function(){return this.na},Be.prototype.getManifestUri=Be.prototype.Sb,Be.prototype.U=function(){return!!this.c&&this.c.presentationTimeline.U()},Be.prototype.isLive=Be.prototype.U,Be.prototype.fa=function(){return!!this.c&&this.c.presentationTimeline.fa()},Be.prototype.isInProgress=Be.prototype.fa,Be.prototype.Dc=function(){var t=0,e=0;return this.c&&(e=this.c.presentationTimeline,t=e.sa(),e=e.Ra()),{start:t,end:e};
},Be.prototype.seekRange=Be.prototype.Dc,Be.prototype.keySystem=function(){return this.g?this.g.keySystem():""},Be.prototype.keySystem=Be.prototype.keySystem,Be.prototype.drmInfo=function(){return this.g?this.g.b:null},Be.prototype.drmInfo=Be.prototype.drmInfo,Be.prototype.Wb=function(){return this.Na},Be.prototype.isBuffering=Be.prototype.Wb,Be.prototype.eb=function(){if(this.w)return Promise.resolve();if(this.dispatchEvent(new _e("unloading")),this.j){var t=new E(7,7e3);return Pe(this.j,t).then(this.yb.bind(this))}return this.yb()},Be.prototype.unload=Be.prototype.eb,Be.prototype.Qa=function(){return this.i?this.i.Qa():0},Be.prototype.getPlaybackRate=Be.prototype.Qa,Be.prototype.Xc=function(t){this.i&&$t(this.i,t)},Be.prototype.trickPlay=Be.prototype.Xc,Be.prototype.Lb=function(){this.i&&$t(this.i,1)},Be.prototype.cancelTrickPlay=Be.prototype.Lb,Be.prototype.getTracks=function(){if(!this.b)return[];var t=Qt(this.b);return xe(Zt(this.b),t).filter(function(t){return 0>this.ma.indexOf(t.id)}.bind(this))},Be.prototype.getTracks=Be.prototype.getTracks,Be.prototype.Ec=function(t,e){if(this.b){var i=De(Zt(this.b),t);if(i){var n=i.stream;n.allowedByApplication&&n.allowedByKeySystem&&(this.C.push({timestamp:Date.now()/1e3,id:n.id,type:t.type,fromAdaptation:!1}),i={},i[t.type]=n,"text"!=t.type&&(n=Qt(this.b).text,this.configure({abr:{enabled:!1}}),i.text=n),Ge(this,i,e))}}},Be.prototype.selectTrack=Be.prototype.Ec,Be.prototype.Zb=function(){return"showing"==this.m.mode},Be.prototype.isTextTrackVisible=Be.prototype.Zb,Be.prototype.Gc=function(t){this.m.mode=t?"showing":"hidden",Je(this)},Be.prototype.setTextTrackVisibility=Be.prototype.Gc,Be.prototype.getStats=function(){ze(this);var t={},e={},i=this.f&&this.f.getVideoPlaybackQuality?this.f.getVideoPlaybackQuality():{};return this.b&&(e=Qt(this.b),t=e.video||{},e=e.audio||{}),{width:t.width||0,height:t.height||0,streamBandwidth:t.bandwidth+e.bandwidth||0,decodedFrames:Number(i.totalVideoFrames),droppedFrames:Number(i.droppedVideoFrames),estimatedBandwidth:this.a.abr.manager.getBandwidthEstimate(),playTime:this.pa,bufferingTime:this.J,switchHistory:this.C.slice(0)}},Be.prototype.getStats=Be.prototype.getStats,Be.prototype.addTextTrack=function(t,e,i,n,r){if(!this.b)return Promise.reject();for(var s,a=Zt(this.b),o=0;o<this.c.periods.length;o++)if(this.c.periods[o]==a){if(o==this.c.periods.length-1){if(s=this.c.presentationTimeline.da()-a.startTime,1/0==s)return Promise.reject()}else s=this.c.periods[o+1].startTime-a.startTime;break}var u={id:this.Hb++,createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(){return 1},getSegmentReference:function(e){return 1!=e?null:new Bt(1,0,s,function(){return[t]},0,null)},initSegmentReference:null,presentationTimeOffset:0,mimeType:n,codecs:r||"",bandwidth:0,kind:i,encrypted:!1,keyId:null,language:e,allowedByApplication:!0,allowedByKeySystem:!0};return n={language:e,type:"text",primary:!1,drmInfos:[],streams:[u]},this.ma.push(u.id),a.streamSets.push(n),te(this.b,u).then(function(){if(!this.w)return this.ma.splice(this.ma.indexOf(u.id),1),Ye(this,a),Xe(this),{id:u.id,active:!1,type:"text",bandwidth:0,language:e,kind:i,width:null,height:null}}.bind(this))},Be.prototype.addTextTrack=Be.prototype.addTextTrack,Be.prototype.Cb=function(t,e){this.Ba.width=t,this.Ba.height=e},Be.prototype.setMaxHardwareResolution=Be.prototype.Cb,Br=Be.prototype,Br.yb=function(){return this.l?Ve(this).then(function(){this.w||(this.Fb(!1),this.oa=Fe(this))}.bind(this)):Promise.resolve()},Br.La=function(t){var e=this.b?Qt(this.b):{};Me(this.g,e,t),e=t.streamSets.some(Oe),Ce(t,this.a.restrictions,this.Ba)&&!this.j&&Xe(this),t=!t.streamSets.some(Oe),e?t&&this.$(new E(4,4012)):this.$(new E(4,4011))},Br.Mc=function(t,e,i){this.a.abr.manager.segmentDownloaded(t,e,i)},Br.Fb=function(t){ze(this),this.Na=t,this.dispatchEvent(new _e("buffering",{buffering:t}))},Br.Lc=function(){if(this.b){var t,e=this.b;for(t in e.b){var i=e.b[t];i.ba||0<Rt(e.f,t,Vt(e.m))||i.la||(i.ga?i.la=!0:null==It(e.f,t)?null==i.aa&&Se(e,i,0):(Te(i),we(e,i)))}}},Br.Ic=function(t){this.qa=!0,this.a.abr.manager.disable(),t=je(t,this.a),t=$e(this,t,!0);for(var e in this.s)t[e]=this.s[e].stream;this.s={};for(e in t)this.C.push({timestamp:Date.now()/1e3,id:t[e].id,type:e,fromAdaptation:!0});return this.j||Xe(this),t},Br.Kb=function(){this.qa=!1,this.a.abr.enabled&&this.a.abr.manager.enable();for(var t in this.s){var e=this.s[t];ee(this.b,t,e.stream,e.Ob)}this.s={}},Br.bb=function(t,e){var i,n=Qt(this.b);for(i in t){var r=t[i];n[i]!=r?this.C.push({timestamp:Date.now()/1e3,id:r.id,type:i,fromAdaptation:!0}):delete t[i]}if(!B(t)&&this.b){for(i in t)ee(this.b,i,t[i],e||!1);We(this)}},Br.$=function(t){this.dispatchEvent(new _e("error",{detail:t}))},Br.Jc=function(t){this.dispatchEvent(t)},Br.lc=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.$(new E(3,3016,t,e))}}},Br.Kc=function(t){var e=["output-restricted","internal-error"],i=Zt(this.b),n=!1;i.streamSets.forEach(function(i){i.streams.forEach(function(i){var r=i.allowedByKeySystem;i.keyId&&i.keyId in t&&(i.allowedByKeySystem=0>e.indexOf(t[i.keyId])),r!=i.allowedByKeySystem&&(n=!0)})}),Ye(this,i),n&&Xe(this)};var is="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),ns="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),rs=["loop","playbackRate"],ss=["pause","play"],as=["adaptation","buffering","error","texttrackvisibility","trackschanged"],os="getConfiguration getManifestUri getPlaybackRate getTracks getStats isBuffering isLive isTextTrackVisible seekRange".split(" "),us=[["getConfiguration","configure"]],hs=[["isTextTrackVisible","setTextTrackVisibility"]],cs="configure resetConfiguration trickPlay cancelTrickPlay selectTrack setTextTrackVisibility addTextTrack".split(" "),fs=["load","unload"];Br=ei.prototype,Br.o=function(){return ii(this),this.a&&(this.a.stop(function(){},function(){}),this.a=null),this.A=this.w=this.l=null,this.f=this.j=this.h=!1,this.g=this.c=this.b=this.a=this.i=null,Promise.resolve()},Br.N=function(){return this.f},Br.Ya=function(){return this.v},Br.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.h=!0,this.l();var e=new chrome.cast.SessionRequest(this.C),e=new chrome.cast.ApiConfig(e,this.cc.bind(this),this.jc.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){})}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},Br.$a=function(t){this.i=t,this.f&&ni(this,{type:"appData",appData:this.i})},Br.cast=function(t){return this.h?this.j?this.f?Promise.reject(new E(8,8002)):(this.g=new R,chrome.cast.requestSession(this.Wa.bind(this,t),this.lb.bind(this)),this.g):Promise.reject(new E(8,8001)):Promise.reject(new E(8,8e3))},Br.get=function(t,e){if("video"==t){if(0<=ss.indexOf(e))return this.wb.bind(this,t,e)}else if("player"==t){if(0<=cs.indexOf(e))return this.wb.bind(this,t,e);if(0<=fs.indexOf(e))return this.yc.bind(this,t,e);if(0<=os.indexOf(e))return this.tb.bind(this,t,e)}return this.tb(t,e)},Br.set=function(t,e,i){this.b[t][e]=i,ni(this,{type:"set",targetName:t,property:e,value:i})},Br.Wa=function(t,e){this.a=e,this.a.addUpdateListener(this.mb.bind(this)),this.a.addMessageListener("urn:x-cast:com.google.shaka.v2",this.dc.bind(this)),this.mb(),ni(this,{type:"init",initState:t,appData:this.i}),this.g.resolve()},Br.lb=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.g.reject(new E(8,e,t))},Br.tb=function(t,e){return this.b[t][e]},Br.wb=function(t,e){ni(this,{type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},Br.yc=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new R,r=this.m.toString();return this.m++,this.c[r]=n,ni(this,{type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},Br.cc=function(t){var e=this.s();this.g=new R,this.Wa(e,t)},Br.jc=function(t){this.j="available"==t,this.l()},Br.mb=function(){var t=!!this.a&&"connected"==this.a.status;if(this.f&&!t){this.A();for(var e in this.b)this.b[e]={};ii(this)}this.v=(this.f=t)?this.a.receiver.friendlyName:"",this.l()},Br.dc=function(t,e){var i=Qe(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.w(n,new _e(r.type,r));break;case"update":r=i.update;for(n in r){var s,i=this.b[n]||{};for(s in r[n])i[s]=r[n][s]}break;case"asyncComplete":if(n=i.id,s=i.error,i=this.c[n],delete this.c[n],i)if(s){n=new E(s.category,s.code);for(r in s)n[r]=s[r];i.reject(n)}else i.resolve()}},i(ri),e("shaka.cast.CastProxy",ri),ri.prototype.o=function(){var t=[this.h?this.h.o():null,this.b?this.b.o():null,this.a?this.a.o():null];return this.a=this.h=this.i=this.j=this.b=this.c=null,Promise.all(t)},ri.prototype.destroy=ri.prototype.o,ri.prototype.Vb=function(){return this.j},ri.prototype.getVideo=ri.prototype.Vb,ri.prototype.Tb=function(){return this.i},ri.prototype.getPlayer=ri.prototype.Tb,ri.prototype.Jb=function(){return!!this.a&&(this.a.h&&this.a.j)},ri.prototype.canCast=ri.prototype.Jb,ri.prototype.N=function(){return!!this.a&&this.a.N()},ri.prototype.isCasting=ri.prototype.N,ri.prototype.Ya=function(){return this.a?this.a.Ya():""},ri.prototype.receiverName=ri.prototype.Ya,ri.prototype.cast=function(){var t=this.jb();return this.a.cast(t).then(function(){return this.b.eb()}.bind(this))},ri.prototype.cast=ri.prototype.cast,ri.prototype.$a=function(t){this.a.$a(t)},ri.prototype.setAppData=ri.prototype.$a,ri.prototype.Vc=function(){var t=this.a;if(t.f){var e=t.s();chrome.cast.requestSession(t.Wa.bind(t,e),t.lb.bind(t))}},ri.prototype.suggestDisconnect=ri.prototype.Vc,Br=ri.prototype,Br.jb=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.na,startTime:null};return this.c.pause(),rs.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),us.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),hs.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},Br.Nc=function(){this.dispatchEvent(new _e("caststatuschanged"))},Br.Pc=function(){us.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 _e("error",{detail:t}))}.bind(this)));var s={};rs.forEach(function(t){s[t]=this.a.get("video",t)}.bind(this)),i.then(function(){rs.forEach(function(t){this.c[t]=s[t]}.bind(this)),hs.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))},Br.$c=function(t){if("addEventListener"==t)return this.g.addEventListener.bind(this.g);if("removeEventListener"==t)return this.g.removeEventListener.bind(this.g);if(this.a.N()&&!Object.keys(this.a.b.video).length){var e=this.c[t];if("function"!=typeof e)return e}return this.a.N()?this.a.get("video",t):(e=this.c[t],"function"==typeof e&&(e=e.bind(this.c)),e)},Br.bd=function(t,e){this.a.N()?this.a.set("video",t,e):this.c[t]=e},Br.ad=function(t){this.a.N()||this.g.dispatchEvent(new _e(t.type,t))},Br.tc=function(t){return"addEventListener"==t?this.f.addEventListener.bind(this.f):"removeEventListener"==t?this.f.removeEventListener.bind(this.f):"getNetworkingEngine"==t?this.b.kb.bind(this.b):this.a.N()&&!Object.keys(this.a.b.video).length&&0<=os.indexOf(t)||!this.a.N()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},Br.uc=function(t){this.a.N()||this.f.dispatchEvent(t)},Br.Oc=function(t,e){this.a.N()&&("video"==t?this.g.dispatchEvent(e):"player"==t&&this.f.dispatchEvent(e))},i(ai),e("shaka.cast.CastReceiver",ai),ai.prototype.Xb=function(){return this.h},ai.prototype.isConnected=ai.prototype.Xb,ai.prototype.Yb=function(){return this.c},ai.prototype.isIdle=ai.prototype.Yb,ai.prototype.o=function(){var e=this.a?this.a.o():Promise.resolve();return null!=this.f&&t.clearTimeout(this.f),this.j=this.i=this.a=this.b=null,this.h=!1,this.c=!0,this.f=this.g=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},ai.prototype.destroy=ai.prototype.o,Br=ai.prototype,Br.rb=function(){this.h=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,ui(this)},Br.ub=function(t,e){this.Xa(),ci(this,{type:"event",targetName:t,event:e})},Br.Xa=function(){null!=this.f&&t.clearTimeout(this.f),this.f=t.setTimeout(this.Xa.bind(this),500);var e={video:{},player:{}};ns.forEach(function(t){e.video[t]=this.b[t]}.bind(this)),os.forEach(function(t){e.player[t]=this.a[t]()}.bind(this));var i=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();i&&(e.video.volume=i.level,e.video.muted=i.muted),ci(this,{type:"update",update:e})},Br.Qb=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&ci(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}}),ci(this,{type:"event",targetName:"video",event:{type:"volumechange"}})},Br.ec=function(t){var e=Qe(t.data);switch(e.type){case"init":hi(this,e.initState,e.appData),this.Xa();break;case"appData":this.j(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.i[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.i[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.i[i],i[n].apply(i,r).then(this.Ab.bind(this,t,e,null),this.Ab.bind(this,t,e))}},Br.Ab=function(t,e,i){ci(this,{type:"asyncComplete",id:e,error:i},t)};var ls={"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"},ds=1/15,ps=1;e("shaka.media.SegmentIndex",zi),zi.prototype.o=function(){return this.a=null,Promise.resolve()},zi.prototype.destroy=zi.prototype.o,zi.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 null},zi.prototype.find=zi.prototype.find,zi.prototype.get=function(t){return this.a.length?(t-=this.a[0].position,0>t||t>=this.a.length?null:this.a[t]):null},zi.prototype.get=zi.prototype.get,zi.prototype.Ua=function(t){for(var e=[],i=0,n=0;i<this.a.length&&n<t.length;){var r=this.a[i],s=t[n];r.startTime<s.startTime?(e.push(r),i++):(r.startTime>s.startTime||(.1<Math.abs(r.endTime-s.endTime)?e.push(s):e.push(r),i++),n++)}for(;i<this.a.length;)e.push(this.a[i++]);if(e.length)for(i=e[e.length-1].position+1;n<t.length;)s=t[n++],s=new Bt((i++),s.startTime,s.endTime,s.a,s.L,s.D),e.push(s);else e=t;this.a=e},zi.prototype.merge=zi.prototype.Ua,zi.prototype.Pa=function(t){for(var e=0;e<this.a.length&&!(this.a[e].endTime>t);++e);this.a.splice(0,e)},zi.prototype.evict=zi.prototype.Pa;var ms;Br=pn.prototype,Br.configure=function(t){this.c=t},Br.start=function(t,e,i,n,r){return this.g=[t],this.a=e,this.j=i,this.l=n,this.m=r,mn(this).then(function(){return this.a&&gn(this,0),this.b}.bind(this))},Br.stop=function(){return this.a&&this.a.Gb(this.Ia),this.c=this.m=this.l=this.j=this.a=null,this.g=[],this.b=null,this.h=[],this.i={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},Br.rc=function(t,e){t.P=vn(e,t.K,null);var i=!1,n=li(e,"Role"),r=void 0;"text"==t.P.contentType&&(r="subtitle");for(var s=0;s<n.length;s++){var a=n[s].getAttribute("schemeIdUri");if(null==a||"urn:mpeg:dash:role:2011"==a)switch(a=n[s].getAttribute("value")){case"main":i=!0;break;case"caption":case"subtitle":r=a}}var n=!!fi(e,"InbandEventStream"),o=[];li(e,"SupplementalProperty").forEach(function(t){var e=t.getAttribute("schemeIdUri");("urn:mpeg:dash:adaptation-set-switching:2016"==e||"http://dashif.org/guidelines/AdaptationSetSwitching"==e||"http://dashif.org/descriptor/AdaptationSetSwitching"==e)&&(t=t.getAttribute("value"))&&o.push.apply(o,t.split(","))});var u=null;if(li(e,"EssentialProperty").forEach(function(t){"http://dashif.org/guidelines/trickmode"==t.getAttribute("schemeIdUri")&&(u=t.getAttribute("value"))}),null!=u)return null;if(s=li(e,"ContentProtection"),s=Ti(s,this.c.dash.customScheme),a=Ne(e.getAttribute("lang")||"und"),r=li(e,"Representation").map(this.sc.bind(this,t,s,r,a)).filter(function(t){return!!t}),!r.length)throw new E(4,4003);if(!t.P.contentType){var h=r[0].mimeType,c=r[0].codecs,f=h;c&&(f+='; codecs="'+c+'"'),t.P.contentType=Xr[f]?"text":h.split("/")[0]}return{id:t.P.id||"__fake__"+this.v++,contentType:t.P.contentType,language:a,$b:i,streams:r,drmInfos:s.drmInfos,Wc:o,Y:n}},Br.sc=function(t,e,i,n,r){if(t.u=vn(r,t.P,null),!Sn(t.u))return null;t.bandwidth=pi(r,"bandwidth",vi)||void 0;var s;if(s=this.zc.bind(this),t.u.Fa)s=en(t,s);else if(t.u.Z)s=sn(t,this.i);else if(t.u.Ga)s=hn(t,s,this.i,!!this.b);else{var a=t.u.M,o=t.H.duration||0;s={createSegmentIndex:Promise.resolve.bind(Promise),findSegmentPosition:function(t){return 0<=t&&t<o?1:null},getSegmentReference:function(t){return 1!=t?null:new Bt(1,0,o,function(){return a},0,null)},initSegmentReference:null,presentationTimeOffset:0}}return r=li(r,"ContentProtection"),r=Ei(r,this.c.dash.customScheme,e),{id:this.v++,createSegmentIndex:s.createSegmentIndex,findSegmentPosition:s.findSegmentPosition,getSegmentReference:s.getSegmentReference,initSegmentReference:s.initSegmentReference,presentationTimeOffset:s.presentationTimeOffset,mimeType:t.u.mimeType,codecs:t.u.codecs,frameRate:t.u.frameRate,bandwidth:t.bandwidth,width:t.u.width,height:t.u.height,kind:i,encrypted:0<e.drmInfos.length,keyId:r,language:n,allowedByApplication:!0,allowedByKeySystem:!0}},Br.Qc=function(){this.f=null;var t=Date.now();mn(this).then(function(){this.a&&gn(this,(Date.now()-t)/1e3)}.bind(this))["catch"](function(t){this.l(t),this.a&&gn(this,0)}.bind(this))},Br.zc=function(t,e,i){return t=M(t,this.c.retryParameters),null!=e&&(t.headers.Range="bytes="+e+"-"+(null!=i?i:"")),this.a.request(1,t).then(function(t){return t.data})},Br.Ia=function(t,e){if(1==t){var i=new xi(new DataView(e.data)),n=qi(1701671783,i);if(-1!=n){var r=i.a-8+n;if(Fi(i,4),n=Ki(i),"urn:mpeg:dash:event:2012"==n)mn(this);else{var s=Ki(i),a=Li(i),o=Li(i),u=Li(i),h=Li(i),i=Bi(i,r-i.a);this.m(new _e("emsg",{detail:{jd:n,value:s,Ha:a,hd:o,fd:u,id:h,gd:i}}))}}}},Wr.mpd=pn,Yr["application/dash+xml"]=pn,kn.l=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,kn.s=/^(?:(\d{2,}):)?(\d{2}):(\d{2})$/,kn.m=/^(?:(\d{2,}):)?(\d{2}):(\d{2}\.\d{2,})$/,kn.v=/^(\d*\.?\d*)f$/,kn.A=/^(\d*\.?\d*)t$/,kn.w=/^(?:(\d*\.?\d*)h)?(?:(\d*\.?\d*)m)?(?:(\d*\.?\d*)s)?(?:(\d*\.?\d*)ms)?$/,kn.j=/^(\d{1,2}|100)% (\d{1,2}|100)%$/,kn.b=function(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=kn.b(i[n]),e=e.concat(r))}return e.length||e.push(t),e},kn.c=function(t,e,i,n,r){if(!t.hasAttribute("begin")&&!t.hasAttribute("end")&&""==t.textContent)return null;var s=kn.a(t.getAttribute("begin"),i),a=kn.a(t.getAttribute("end"),i);i=kn.a(t.getAttribute("dur"),i);var o=t.textContent;if(null==a&&null!=i&&(a=s+i),null==s||null==a)throw new E(2,2001);return(e=wt(s+e,a+e,o))?(r=kn.h(t,"region",r),kn.na(e,t,r,n),e):null},kn.na=function(t,e,i,n){var r,s=kn.f(e,i,n,"tts:textAlign");s&&(t.b=s),(s=kn.f(e,i,n,"tts:extent"))&&(r=kn.j.exec(s))&&(t.size=Number(r[1])),r=kn.f(e,i,n,"tts:writingMode"),s=!0,"tb"==r||"tblr"==r?t.c="lr":"tbrl"==r?t.c="rl":s=!1,(e=kn.f(e,i,n,"tts:origin"))&&(r=kn.j.exec(e))&&(s?(t.position=Number(r[2]),t.a=Number(r[1])):(t.position=Number(r[1]),t.a=Number(r[2])))},kn.f=function(t,e,i,n){for(var r=kn.b(e),s=0;s<r.length;s++){var a=r[s].getAttribute(n);if(a)return a}return r=kn.h,(t=r(e,"style",i)||r(t,"style",i))?t.getAttribute(n):null},kn.h=function(t,e,i){if(!t||1>i.length)return null;var n=null;if(t=kn.oa(t,e))for(e=0;e<i.length;e++)if(i[e].getAttribute("xml:id")==t){n=i[e];break}return n},kn.oa=function(t,e){for(var i=null;t&&!(i=t.getAttribute(e));){var n=t.parentNode;if(!(n instanceof Element))break;t=n}return i},kn.a=function(t,e){var i=null;return kn.l.test(t)?i=kn.pa(e,t):kn.s.test(t)?i=kn.g(kn.s,t):kn.m.test(t)?i=kn.g(kn.m,t):kn.v.test(t)?i=kn.Aa(e,t):kn.A.test(t)?i=kn.Ba(e,t):kn.w.test(t)&&(i=kn.g(kn.w,t)),i},kn.Aa=function(t,e){var i=kn.v.exec(e);return Number(i[1])/t.frameRate},kn.Ba=function(t,e){var i=kn.A.exec(e);return Number(i[1])/t.a},kn.pa=function(t,e){var i=kn.l.exec(e),n=Number(i[1]),r=Number(i[2]),s=Number(i[3]),a=Number(i[4]),a=a+(Number(i[5])||0)/t.b,s=s+a/t.frameRate;return s+60*r+3600*n},kn.g=function(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},Xr["application/ttml+xml"]=kn,An.J=1937010800,Xr['application/mp4; codecs="stpp"']=An,Nn.c=function(t,e,i,n){if(1==t.length&&!t[0]||/^NOTE($|[ \t])/.test(t[0]))return null;var r=null;0>t[0].indexOf("-->")&&(r=t[0],t.splice(0,1));var s=new _n(t[0]),a=Nn.a(s),o=In(s,/[ \t]+--\x3e[ \t]+/g),u=Nn.a(s);if(null==a||!o||null==u)throw new E(2,2001);if(a+=e,u+=e,n&&(a+=i,u+=i),t=wt(a,u,t.slice(1).join("\n").trim()),!t)return null;for(In(s,/[ \t]+/gm),e=Rn(s);e;)Nn.i(t,e),In(s,/[ \t]+/gm),e=Rn(s);return null!=r&&(t.id=r),t},Nn.i=function(t,e){var i;(i=/^align:(start|middle|end|left|right)$/.exec(e))?t.align=i[1]:(i=/^vertical:(lr|rl)$/.exec(e))?t.c=i[1]:(i=/^size:(\d{1,2}|100)%$/.exec(e))?t.size=Number(i[1]):(i=/^position:(\d{1,2}|100)%(?:,(line-left|line-right|center|start|end))?$/.exec(e))?(t.position=Number(i[1]),i[2]&&(t.g=i[2])):(i=/^line:(\d{1,2}|100)%(?:,(start|end|center))?$/.exec(e))?(t.f=!1,t.a=Number(i[1]),i[2]&&(t.b=i[2])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.f=!0,t.a=Number(i[1]),i[2]&&(t.b=i[2]))},Nn.a=function(t){if(t=In(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g),!t)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)},Xr["text/vtt"]=Nn,Xr['text/vtt; codecs="vtt"']=Nn,Cn.qa=function(t,e,i,n){for(t=new xi(new DataView(t)),i+=e,n+=e,e=[];Di(t);){var r=qi(Cn.X,t);if(-1==r)break;(r=Cn.c(Bi(t,r-8).buffer,i,n))&&e.push(r)}return e},Cn.c=function(t,e,i){t=new xi(new DataView(t));for(var n,r,s;Di(t);){var a=Li(t),o=Li(t),u=q(Bi(t,a-8).buffer);switch(1==a&&Ui(t),o){case Cn.G:n=u;break;case Cn.C:s=u;break;case Cn.S:r=u}}if(!n)throw new E(2,2008);if(e=wt(e,i,n),!e)return null;if(s&&(e.id=s),r)for(r=new _n(r),s=Rn(r);s;)Nn.i(e,s),In(r,/[ \t]+/gm),s=Rn(r);return e},Cn.ma=2004251764,Cn.X=1987343459,Cn.G=1885436268,Cn.C=1768187247,Cn.S=1937011815,Xr['application/mp4; codecs="wvtt"']=Cn,$r.data=function(e){return new Promise(function(i){var n=e.split(":");if(2>n.length||"data"!=n[0])throw new E(1,1004,e);if(n=n.slice(1).join(":").split(","),2>n.length)throw new E(1,1004,e);var r=n[0],n=t.decodeURIComponent(n.slice(1).join(",")),r=r.split(";"),s=null;if(1<r.length&&(s=r[1]),"base64"==s)n=Z(n).buffer;else{if(s)throw new E(1,1005,e);n=z(n)}i({uri:e,data:n,headers:{"content-type":r[0]}})})},$r.http=Mn,$r.https=Mn,Br=xn.prototype,Br.init=function(e){if(!t.indexedDB)return Promise.reject(new E(9,9e3));var i=t.indexedDB.open("shaka_offline_db",1),n=new R;return i.onupgradeneeded=function(t){t=t.target.result;for(var i in e)t.createObjectStore(i,{keyPath:e[i]})},i.onsuccess=function(t){this.a=t.target.result,n.resolve()}.bind(this),i.onerror=Un.bind(null,i,n),n.then(function(){var t=Object.keys(e);return Promise.all(t.map(function(t){return jn(this,t).then(function(e){this.b[t]=e}.bind(this))}.bind(this)))}.bind(this))},Br.o=function(){return Promise.all(this.c.map(function(t){try{t.transaction.abort()}catch(e){}return t.I["catch"](A)})).then(function(){this.a&&(this.a.close(),this.a=null)}.bind(this))},Br.get=function(t,e){return Ln(this,t,"readonly",function(t){return t.get(e)})},Br.forEach=function(t,e){return Ln(this,t,"readonly",function(t){return t.openCursor()},function(t){t&&(e(t.value),t["continue"]())})},Br.remove=function(t,e){return Ln(this,t,"readwrite",function(t){return t["delete"](e)})};var bs={manifest:"key",segment:"key"};Fn.prototype.configure=function(){},Fn.prototype.start=function(t){var e=/^offline:([0-9]+)$/.exec(t);if(!e)return Promise.reject(new E(1,9004,t));var i=Number(e[1]),n=new xn;return n.init(bs).then(function(){return n.get("manifest",i)}).then(function(t){if(!t)throw new E(9,9003,i);return Kn(t)}).then(function(t){return n.o().then(function(){return t})},function(t){return n.o().then(function(){throw t})})},Fn.prototype.stop=function(){return Promise.resolve()},Yr["application/x-offline-manifest"]=Fn,$r.offline=function(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=new xn;return n.init(bs).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new E(9,9003,i);return{uri:t,data:e.data,headers:{}}})})}return Promise.reject(new E(1,9004,t))},Vn.prototype.o=function(){var t=this.j||Promise.resolve();return this.b={},this.j=this.a=this.l=this.m=this.i=null,t},e("shaka.offline.Storage",zn),zn.support=$n,zn.prototype.o=function(){var t=this.l,e=this.a,i=this.h?this.h.o()["catch"](function(){}).then(function(){return Promise.all(t.map(function(t){return e.remove("segment",t)}))}).then(function(){return e.o()}):Promise.resolve();return this.j=this.c=this.h=this.a=null,i},zn.prototype.destroy=zn.prototype.o,zn.prototype.configure=function(t){Ae(this.j,t,Wn(this),{},"")},zn.prototype.configure=zn.prototype.configure,zn.prototype.Tc=function(t,e,i){function n(t){s=t}if(this.v)return Promise.reject(new E(9,9006));this.v=!0;var r,s=null;return Xn(this).then(function(){return tr(this),Yn(this,t,n,i)}.bind(this)).then(function(i){if(tr(this),this.b=i.manifest,this.g=i.Pb,this.b.presentationTimeline.U()||this.b.presentationTimeline.fa())throw new E(9,9005,t);this.b.periods.forEach(this.s.bind(this)),this.f=this.a.b.manifest++,this.m=0,i=this.b.periods.map(this.w.bind(this));var n=this.g.b,s=at(this.g);if(n){if(!s.length)throw new E(9,9007,t);n.initData=[]}return r={key:this.f,originalManifestUri:t,duration:this.m,size:0,periods:i,sessionIds:s,drmInfo:n,appMetadata:e},Hn(this.h,r)}.bind(this)).then(function(){if(tr(this),s)throw s;return Dn(this.a,"manifest",r)}.bind(this)).then(function(){return Jn(this)}.bind(this)).then(function(){return Bn(r)}.bind(this))["catch"](function(t){return Jn(this)["catch"](A).then(function(){throw t})}.bind(this))},zn.prototype.store=zn.prototype.Tc,zn.prototype.remove=function(t){function e(t){6013!=t.code&&(a=t)}var i=t.offlineUri,n=/^offline:([0-9]+)$/.exec(i);if(!n)return Promise.reject(new E(9,9004,i));var r,s,a=null,o=Number(n[1]);return Xn(this).then(function(){return tr(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(tr(this),!t)throw new E(9,9003,i);return r=t,t=Kn(r),s=new it(this.c.h,e,function(){}),s.configure(this.c.getConfiguration().drm),s.init(t,!0)}.bind(this)).then(function(){return rt(s,r.sessionIds)}.bind(this)).then(function(){return s.o()}.bind(this)).then(function(){if(tr(this),a)throw a;var e=r.periods.map(function(t){return t.streams.map(function(t){var e=t.segments.map(function(t){return Number(/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.uri)[1])});return t.initSegmentUri&&e.push(Number(/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.initSegmentUri)[1])),e}).reduce(P,[])}).reduce(P,[]),i=0,n=e.length,s=this.j.progressCallback;return On(this.a,function(r){return r=e.indexOf(r.key),0<=r&&(s(t,i/n),i++),0<=r}.bind(this))}.bind(this)).then(function(){return tr(this),this.j.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},zn.prototype.remove=zn.prototype.remove,zn.prototype.list=function(){var t=[];return Xn(this).then(function(){return tr(this),this.a.forEach("manifest",function(e){t.push(Bn(e))})}.bind(this)).then(function(){return t})},zn.prototype.list=zn.prototype.list,zn.prototype.A=function(t){var e=[],i=t.filter(function(t){return"video"==t.type&&480>=t.height});i.sort(function(t,e){return e.bandwidth-t.bandwidth}),i.length&&e.push(i[0]);for(var n=Ne(this.c.getConfiguration().preferredAudioLanguage),i=[0,Zr,Qr],r=t.filter(function(t){return"audio"==t.type}),i=i.map(function(t){return r.filter(function(e){return e=Ne(e.language),Re(t,n,e)})}),s=r,a=0;a<i.length;a++)i[a].length&&(s=i[a]);s.sort(function(t,e){return t.bandwidth-e.bandwidth}),s.length&&e.push(s[Math.floor(s.length/2)]);var i=Ne(this.c.getConfiguration().preferredTextLanguage),o=Re.bind(null,Qr,i);return e.push.apply(e,t.filter(function(t){var e=Ne(t.language);return"text"==t.type&&o(e)})),e},zn.prototype.s=function(t){function e(t,e,i){return e=e.filter(function(t){return t.type==i}),0==e.length?null:De(t,e[0]).stream}var i={};this.i&&(i={video:e(this.b.periods[0],this.i,"video"),audio:e(this.b.periods[0],this.i,"audio")}),Me(this.g,i,t),Ce(t,this.c.getConfiguration().restrictions,{width:1/0,height:1/0})},zn.prototype.w=function(t){var e=xe(t,null),e=this.j.trackSelectionCallback(e);this.i||(this.i=e,this.b.periods.forEach(this.s.bind(this)));for(var i=e.length-1;0<i;--i){for(var n=!1,r=i-1;0<=r;--r)if(e[i].type==e[r].type&&e[i].kind==e[r].kind&&e[i].language==e[r].language){n=!0;break}if(n)break}return e=e.map(function(e){return e=De(t,e),Qn(this,t,e.Uc,e.stream)}.bind(this)),{startTime:t.startTime,streams:e}},es.offline=$n,e("shaka.polyfill.installAll",function(){for(var t=0;t<ys.length;++t)ys[t]()});var ys=[];e("shaka.polyfill.register",er),er(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}}),document.addEventListener("webkitfullscreenchange",ir),document.addEventListener("webkitfullscreenerror",ir),document.addEventListener("mozfullscreenchange",ir),document.addEventListener("mozfullscreenerror",ir),document.addEventListener("MSFullscreenChange",ir),document.addEventListener("MSFullscreenError",ir)}}),sr.prototype.createMediaKeys=function(){var t=new or(this.keySystem);return Promise.resolve(t)},sr.prototype.getConfiguration=function(){return this.a},or.prototype.createSession=function(t){if("temporary"!=(t||"temporary"))throw new TypeError("Session type "+t+" is unsupported on this platform.");return new hr(this.a)},or.prototype.setServerCertificate=function(){return Promise.reject(Error("setServerCertificate not supported on this platform."))},i(hr),Br=hr.prototype,Br.generateRequest=function(t,e){this.a=new R;try{this.c=this.g.createSession("video/mp4",new Uint8Array(e),null),j(this.f,this.c,"mskeymessage",this.hc.bind(this)),j(this.f,this.c,"mskeyadded",this.fc.bind(this)),j(this.f,this.c,"mskeyerror",this.gc.bind(this)),lr(this,"status-pending")}catch(i){this.a.reject(i)}return this.a},Br.load=function(){return Promise.reject(Error("MediaKeySession.load not yet supported"))},Br.update=function(t){this.b=new R;try{this.c.update(new Uint8Array(t))}catch(e){this.b.reject(e)}return this.b},Br.close=function(){try{this.c.close(),this.closed.resolve(),L(this.f)}catch(t){this.closed.reject(t)}return this.closed;
},Br.remove=function(){return Promise.reject(Error("MediaKeySession.remove is only applicable for persistent licenses, which are not supported on this platform"))},Br.hc=function(t){this.a&&(this.a.resolve(),this.a=null),this.dispatchEvent(new _e("message",{messageType:void 0==this.keyStatuses.Sa()?"licenserequest":"licenserenewal",message:t.message.buffer}))},Br.fc=function(){this.a?(lr(this,"usable"),this.a.resolve(),this.a=null):this.b&&(lr(this,"usable"),this.b.resolve(),this.b=null)},Br.gc=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:lr(this,"output-not-allowed");default:lr(this,"internal-error")}};var gs;Br=dr.prototype,Br.ab=function(t){this.size=void 0==t?0:1,this.a=t},Br.Sa=function(){return this.a},Br.forEach=function(t){this.a&&t(this.a,gs)},Br.get=function(t){if(this.has(t))return this.a},Br.has=function(t){var e=gs;return!(!this.a||!et(new Uint8Array(t),new Uint8Array(e)))},Br.keys=function(){},br.prototype.createSession=function(){},br.prototype.setServerCertificate=function(){},yr.prototype.getConfiguration=function(){},yr.prototype.createMediaKeys=function(){},wr.prototype.createMediaKeys=function(){var t=new Sr(this.a);return Promise.resolve(t)},wr.prototype.getConfiguration=function(){return this.b},Br=Sr.prototype,Br.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 kr(t,this.g,e),this.c.push(e),e},Br.setServerCertificate=function(){return Promise.reject(Error("setServerCertificate not supported on this platform."))},Br.qc=function(t){this.b.dispatchEvent(new _e("encrypted",{initDataType:"webm",initData:t.initData}))},Br.pc=function(t){var e=Er(this,t.sessionId);e&&(t=new _e("message",{messageType:void 0==e.keyStatuses.Sa()?"licenserequest":"licenserenewal",message:t.message}),e.b&&(e.b.resolve(),e.b=null),e.dispatchEvent(t))},Br.nc=function(t){(t=Er(this,t.sessionId))&&(Ar(t,"usable"),t.a&&t.a.resolve(),t.a=null)},Br.oc=function(t){var e=Er(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?Ar(e,"output-restricted"):1==i?Ar(e,"expired"):Ar(e,"internal-error"))}},i(kr),Br=kr.prototype,Br.cb=function(t,e){if(this.a)this.a.then(this.cb.bind(this,t,e))["catch"](this.cb.bind(this,t,e));else{this.a=t;var i,n;"webkit-org.w3.clearkey"==this.c?(i=q(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=Z(n.keys[0].k),n=Z(n.keys[0].kid)):(i=new Uint8Array(e),n=null);try{this.f.webkitAddKey(this.c,i,n,this.sessionId)}catch(r){this.a.reject(r),this.a=null}}},Br.generateRequest=function(t,e){return Pr(this,e,null)},Br.load=function(t){return"persistent-license"==this.g?Pr(this,null,t):Promise.reject(Error("Not a persistent session."))},Br.update=function(t){var e=new R;return this.cb(e,t),e},Br.close=function(){if("persistent-license"!=this.g){if(!this.sessionId)return this.closed.reject(Error("The session is not callable.")),this.closed;try{this.f.webkitCancelKeyRequest(this.c,this.sessionId)}catch(t){}}return this.closed.resolve(),this.closed},Br.remove=function(){return"persistent-license"!=this.g?Promise.reject(Error("Not a persistent session.")):this.close()};var vs;Br=_r.prototype,Br.ab=function(t){this.size=void 0==t?0:1,this.a=t},Br.Sa=function(){return this.a},Br.forEach=function(t){this.a&&t(this.a,vs)},Br.get=function(t){if(this.has(t))return this.a},Br.has=function(t){var e=vs;return!(!this.a||!et(new Uint8Array(t),new Uint8Array(e)))},Br.keys=function(){},er(function(){!t.HTMLVideoElement||navigator.requestMediaKeySystemAccess&&MediaKeySystemAccess.prototype.getConfiguration||(HTMLMediaElement.prototype.webkitGenerateKeyRequest?(vs=new Uint8Array([0]).buffer,navigator.requestMediaKeySystemAccess=gr,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=vr,t.MediaKeys=Sr,t.MediaKeySystemAccess=wr):t.MSMediaKeys?(gs=new Uint8Array([0]).buffer,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=ar,t.MediaKeys=or,t.MediaKeySystemAccess=sr,navigator.requestMediaKeySystemAccess=rr):(navigator.requestMediaKeySystemAccess=pr,delete HTMLMediaElement.prototype.mediaKeys,HTMLMediaElement.prototype.mediaKeys=null,HTMLMediaElement.prototype.setMediaKeys=mr,t.MediaKeys=br,t.MediaKeySystemAccess=yr))}),er(function(){if(t.MediaSource){var e=navigator.vendor,i=navigator.appVersion;if(e&&i&&!(0>e.indexOf("Apple")))if(0<=i.indexOf("Version/8"))t.MediaSource=null;else{var n=MediaSource.prototype.addSourceBuffer;MediaSource.prototype.addSourceBuffer=function(){var t=n.apply(this,arguments);return t.abort=function(){},t}}}});var ws=0;Ir.prototype.then=function(t,e){var i=new Ir;switch(this.ia){case 1:xr(this,i,t);break;case 2:xr(this,i,e);break;case ws:this.c.push({I:i,Ca:t}),this.b.push({I:i,Ca:e})}return i},Ir.prototype["catch"]=function(t){return this.then(void 0,t)},Ir.prototype.W=function(t){if(this.ia==ws){for(this.Ma=t,this.ia=1,t=0;t<this.c.length;++t)xr(this,this.c[t].I,this.c[t].Ca);this.c=[],this.b=[]}},Ir.prototype.a=function(t){if(this.ia==ws){for(this.Ma=t,this.ia=2,t=0;t<this.b.length;++t)xr(this,this.b[t].I,this.b[t].Ca);this.c=[],this.b=[]}};var Ss=null,Ts=[];er(function(e){t.setImmediate?(jr=function(e){return t.setImmediate(e)},Lr=function(e){return t.clearImmediate(e)}):(jr=function(e){return t.setTimeout(e,0)},Lr=function(e){return t.clearTimeout(e)}),t.Promise&&!e||(t.Promise=Ir,t.Promise.resolve=Rr,t.Promise.reject=Nr,t.Promise.all=Cr,t.Promise.race=Mr,t.Promise.prototype.then=Ir.prototype.then,t.Promise.prototype["catch"]=Ir.prototype["catch"])}),er(function(){if(t.HTMLVideoElement){var e=HTMLVideoElement.prototype;!e.getVideoPlaybackQuality&&"webkitDroppedFrameCount"in e&&(e.getVideoPlaybackQuality=Ur)}})}).call(r,this),"undefined"!=typeof t&&t.exports?t.exports=r.shaka:(n=function(){return r.shaka}.call(e,i,e,t),!(void 0!==n&&(t.exports=n)))}()},function(e,i){e.exports=t}])});