diff --git a/dash-shaka-playback.js b/dash-shaka-playback.js index fc12904..43c504e 100644 --- a/dash-shaka-playback.js +++ b/dash-shaka-playback.js @@ -1,5 +1,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=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=Yr;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=je;e.prototype=i.prototype,t.md=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.fd=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function 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(){}function u(){}function h(){this.g=null,this.f=!1,this.b=new a,this.h={},this.a={},this.i=!1,this.c=null}function c(t){return(t=t.h.audio)?(t=f(t),t[Math.floor(t.length/2)]):null}function l(t){var e=t.h.video;if(!e)return null;var e=f(e),i=t.a.audio,i=i&&i.bandwidth||0;t=t.b.getBandwidthEstimate();for(var n=e[0],r=0;r=(s.bandwidth+i)/.95&&t<=a&&(n=s)}}return n}function f(t){return t.streams.slice(0).filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function d(t){var e;t instanceof d?(p(this,t.R),this.ka=t.ka,this.T=t.T,m(this,t.wa),this.O=t.O,y(this,E(t.a)),this.ca=t.ca):t&&(e=String(t).match(Wr))?(p(this,e[1]||"",!0),this.ka=b(e[2]||""),this.T=b(e[3]||"",!0),m(this,e[4]),this.O=b(e[5]||"",!0),y(this,e[6]||"",!0),this.ca=b(e[7]||"")):this.a=new w(null)}function p(t,e,i){t.R=i?b(e,!0):e,t.R&&(t.R=t.R.replace(/:$/,""))}function m(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 w?t.a=e:(i||(e=g(e,Qr)),t.a=new w(e))}function b(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function g(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,v),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function v(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function w(t){this.b=t||null}function E(t){var e=new w;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 S(t,e,i){this.category=t,this.code=e,this.data=Array.prototype.slice.call(arguments,2)}function T(t,e){return t.reduce(function(t,e,i){return e["catch"](t.bind(null,i))}.bind(null,e),Promise.reject())}function k(t,e){return t.concat(e)}function P(){}function A(t){return null!=t}function I(t){return function(e){return e!=t}}function _(){}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.g=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[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 S(2,2003)}function z(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;i=e?null:new ss(t,e,i)}function wt(t,e,i,n){var r=t.g;return Promise.resolve().then(function(){if(this.c){var t=this.h(e,r,i,n,this.i);if(null!=i&&null!=n){for(var s=0;s=this.f);++s)this.c.addCue(t[s]);null==this.b&&(this.b=i),this.a=Math.min(n,this.f)}}}.bind(t))}function Et(t,e){return null==t.a||t.at.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function kt(t,e){var i=0;if(!t||1==t.length&&1e-6>t.end(0)-t.start(0))return i;var n=!1,r=1e-4;e||(r=.25);for(var s=0;s=t.start(s)&&e=t.start(s)-t.end(s-1))i+=t.end(s)-t.start(s),i+=t.start(s)-t.end(s-1);else if(0=t.end(s-1)){if(!(.04>=t.start(s)-e))break;i+=t.end(s)-e,n=!0}else n=!1;return i}function Pt(t,e,i){this.f=t,this.h=e,this.j=i,this.c={},this.b=null,this.a={},this.g=new O,this.i=!1}function At(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hvc1.1.6.L93.90",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!rs[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=Rt(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 _t(t,e,i){return"text"==e?(e=Et(t.b,i),e||(e=Et(t.b,i+.1))&&(e+=.1)):(t=Rt(t,e),e=kt(t,i),e||(e=kt(t,i+.1))&&(e+=.1)),e}function Rt(t,e){try{return t.c[e].buffered}catch(i){return null}}function Nt(t,e,i,n,r){return"text"==e?wt(t.b,i,n,r):Dt(t,e,t.Tc.bind(t,e,i))}function Ct(t,e){return"text"==e?t.b.remove(0,1/0):Dt(t,e,t.Bb.bind(t,e,0,t.h.duration))}function Mt(t,e,i){return"text"==e?(t.b.g=i,Promise.resolve()):Dt(t,e,t.Jc.bind(t,e,i))}function xt(t,e,i){return"text"==e?(t.b.f=i,Promise.resolve()):Promise.all([Dt(t,e,t.Lb.bind(t,e)),Dt(t,e,t.Hc.bind(t,e,i))])}function Dt(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 S(3,3017,e)):i.p.reject(new S(3,3015,n)),Lt(t,e)}return i.p}function Ot(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 S(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 S(3,3015,n)),Lt(t,e)}}function jt(t,e,i){this.a=t,this.L=e,this.D=i}function Ut(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 Bt(t,e){this.j=t,this.i=e,this.c=this.a=1/0,this.b=1,this.g=this.f=0,this.h=!0}function Ft(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.h=!1,this.g=1,this.i=this.f=null,0t.c.da()?t.c.ra():Math.max(t.c.Ua(),t.c.ra())}function qt(t,e){e!=t.h&&(t.h=e,zt(t,t.g),t.l(e))}function Ht(e){Gt(e),e.i=t.setTimeout(e.pc.bind(e),250)}function Gt(e){e.i&&(t.clearTimeout(e.i),e.i=null)}function zt(e,i){null!=e.f&&(t.clearInterval(e.f),e.f=null),e.g=i,e.a.playbackRate=e.h||0>i?0:i,!e.h&&0>i&&(e.f=t.setInterval(function(){this.a.currentTime+=i/4}.bind(e),250))}function $t(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||kt(t.a.buffered,e)&&e>=i&&e<=r?e:e>r?r:r=i&&e<=r?e:Math.min(n+2,r)):er?r:e}function Yt(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 Wt(t,e){var i=t.c.ra();return ei?i:e)}function Xt(t,e,i){return i==e||t>=as&&i==e.split("-")[0]||t>=os&&i.split("-")[0]==e.split("-")[0]}function Jt(t){t=t.toLowerCase().split("-");var e=us[t[0]];return e&&(t[0]=e),t.join("-")}function Zt(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.widthe.maxWidth||r.width>i.width||r.heighte.maxHeight||r.height>i.height||r.width*r.heighte.maxPixels||r.bandwidthe.maxVideoBandwidth)&&(r.allowedByApplication=!1):"audio"==t.type&&(r.bandwidthe.maxAudioBandwidth)&&(r.allowedByApplication=!1),s!=r.allowedByApplication&&(n=!0)})}),n}function Qt(t,e,i){var n="",r=null;for(t&&t.A&&(n=t.keySystem(),r=t.m),t=0;tr.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 te(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(k,[])}function ee(t,e){for(var i=0;ir?(r=e,n.video=t):e==r&&re(t)t.streams.length?e:(t.streams.forEach(function(t){e+=t.bandwidth}),e/t.streams.length)}function se(t){var e=0;return t?(t.streams.forEach(function(t){t.height>e&&(e=t.height)}),e):e}function ae(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function oe(t,e,i,n,r,s,a,o,u){this.m=t,this.c=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.h=null,this.i=1,this.C=Promise.resolve(),this.g=[],this.l={},this.b={},this.f=this.s=this.J=!1}function ue(t){return t.a.periods[Ie(t,Kt(t.m))]}function he(t){return K(t.b,function(t){return t.stream})}function ce(t,e){var i={};return i.text=e,fe(t,i)}function le(t,e,i,n){var r=t.b[e];!r&&"text"==e&&t.h.ignoreTextStreamFailures?ce(t,i):r&&(e=t.g[_e(t,i)])&&e.xa&&(e=t.l[i.id])&&e.xa&&r.stream!=i&&(r.stream=i,r.La=!0,n&&(r.aa?r.Pa=!0:r.ga?(r.la=!0,r.Pa=!0):(Me(r),Ne(t,r,!0))))}function fe(t,e){var i=Ie(t,Kt(t.m)),n=K(e,function(t){return ae(t.mimeType,t.codecs)});return t.c.init(n,t.h.useRelativeCueTimestamps),me(t),n=F(e),pe(t,n).then(function(){if(!this.f)for(var t in e){var n=e[t];this.b[t]||(this.b[t]={stream:n,type:t,ta:null,V:null,La:!0,Ma:i,endOfStream:!1,ga:!1,$:null,la:!1,Pa:!1,aa:!1,bb:!1},Ce(this,this.b[t],0))}}.bind(t))}function de(t,e){var i=t.g[e];if(i)return i.I;i={I:new R,xa:!1},t.g[e]=i;var n=t.a.periods[e].streamSets.map(function(t){return t.streams}).reduce(k,[]);return t.C=t.C.then(function(){if(!this.f)return pe(this,n)}.bind(t)).then(function(){this.f||(this.g[e].I.resolve(),this.g[e].xa=!0)}.bind(t))["catch"](function(t){this.f||(this.g[e].I.reject(),delete this.g[e],this.j(t))}.bind(t)),i.I}function pe(t,e){for(var i=[],n=0;ne?t.c.za(e):t.c.za(Math.pow(2,32))}function ye(t,e){var i,n,r=Kt(t.m);n=t.c;var s=e.type;n="text"==s?n.b.a:Tt(Rt(n,s));var s=e.ta&&e.V?t.a.periods[_e(t,e.ta)].startTime+e.V.endTime:r,a=_e(t,e.stream),o=Ie(t,s),u=t.a.periods[o];return i=a!=o?null:be(t,e,r,n,o),(i?u.startTime+i.startTime-r:_t(t.c,e.type,r))>=Math.max(t.i*Math.max(t.a.minBufferTime||0,t.h.rebufferingGoal),t.i*t.h.bufferingGoal)?.5:s>=t.a.presentationTimeline.da()?(e.endOfStream=!0,null):(e.endOfStream=!1,o!=a?(e.Ma=o,null):(i=be(t,e,r,n,a))?(ve(t,e,r,a,i),null):1)}function be(t,e,i,n,r){if(e.V&&e.stream==e.ta)return i=e.V.position+1,ge(t,e,r,i);if(i=e.V?e.stream.findSegmentPosition(Math.max(0,t.a.periods[_e(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=ge(t,e,r,Math.max(0,i-1))),s||ge(t,e,r,i)}function ge(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.endTimen?null:e):null}function ve(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=Ee(t,e,n,u),e.ga=!0,e.La=!1,o=Re(t,r),Promise.all([n,o]).then(function(t){if(!this.f&&!this.s)return Se(this,e,i,s,a,r,t[1])}.bind(t)).then(function(){this.f||this.s||(e.ga=!1,e.bb=!1,Ce(this,e,0),ke(this,a))}.bind(t))["catch"](function(t){this.f||this.s||(e.ga=!1,1001==t.code||1002==t.code||1003==t.code?"text"==e.type&&this.h.ignoreTextStreamFailures&&1001==t.code?delete this.b.text:(this.j(t),Ce(this,e,4)):3017==t.code?we(this,e,t):this.j(t))}.bind(t))}function we(t,e,i){if(!F(t.b).some(function(t){return t!=e&&t.bb})){var n=Math.round(100*t.i);if(20=i?Promise.resolve():t.c.remove(e.type,n,n+i).then(function(){}.bind(t)))}function ke(t,e){if(!t.J&&(t.J=F(t.b).every(function(t){return!t.la&&!t.aa&&t.V}),t.J)){var i=_e(t,e);for(t.g[i]||de(t,i).then(function(){this.v()}.bind(t))["catch"](P),i=0;i=t.a.periods[i].startTime)return i;return 0}function _e(t,e){for(var i=0;ie?"-Infinity":"Infinity":e;return n}})}function Ze(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__?Qe(e):e})}function Qe(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function ti(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.g=!1,this.v="",this.a=this.i=null,this.b={video:{},player:{}},this.m=0,this.c={},this.h=null}function ei(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new S(7,7e3))}}function ii(t,e){var i=Je(e);t.a.sendMessage("urn:x-cast:com.google.shaka.v2",i,function(){},o)}function ni(t,e,i){je.call(this),this.c=t,this.b=e,this.i=this.f=this.g=this.j=this.l=null,this.a=new ti(i,this.Pc.bind(this),this.Qc.bind(this),this.Rc.bind(this),this.mb.bind(this)),ri(this)}function ri(t){t.a.init(),t.i=new O,cs.forEach(function(t){L(this.i,this.c,t,this.cd.bind(this))}.bind(t)),ps.forEach(function(t){L(this.i,this.b,t,this.xc.bind(this))}.bind(t)),t.l={};for(var e in t.c)Object.defineProperty(t.l,e,{configurable:!1,enumerable:!0,get:t.bd.bind(t,e),set:t.dd.bind(t,e)});t.j={};for(e in t.b)Object.defineProperty(t.j,e,{configurable:!1,enumerable:!0,get:t.wc.bind(t,e)});t.g=new je,t.g.S=t.l,t.f=new je,t.f.S=t.j}function si(t,e,i){je.call(this),this.b=t,this.a=e,this.j={video:t,player:e},this.l=i||function(){},this.i=!1,this.c=!0,this.f=this.g=null,ai(this)}function ai(e){var i=cast.receiver.CastReceiverManager.getInstance();i.onSenderConnected=e.vb.bind(e),i.onSenderDisconnected=e.vb.bind(e),i.onSystemVolumeChanged=e.Tb.bind(e),e.g=i.getCastMessageBus("urn:x-cast:com.google.shaka.v2"),e.g.onMessage=e.hc.bind(e),i.start(),cs.forEach(function(t){this.b.addEventListener(t,this.yb.bind(this,"video"))}.bind(e)),ps.forEach(function(t){this.a.addEventListener(t,this.yb.bind(this,"player"))}.bind(e)),e.a.Gb(1920,1080),e.a.addEventListener("loading",function(){this.c=!1,oi(this)}.bind(e)),e.b.addEventListener("playing",function(){this.c=!1,oi(this)}.bind(e)),e.a.addEventListener("unloading",function(){this.c=!0,oi(this)}.bind(e)),e.b.addEventListener("ended",function(){t.setTimeout(function(){this.b&&this.b.ended&&(this.c=!0,oi(this))}.bind(this),5e3)}.bind(e))}function oi(t){Promise.resolve().then(function(){this.dispatchEvent(new Le("caststatuschanged"))}.bind(t))}function ui(t,e,i){for(var n in e.player)t.a[n](e.player[n]);t.l(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 Le("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 hi(t,e,i){t.i&&(e=Je(e),i?t.g.getCastChannel(i).send(e):t.g.broadcast(e))}function ci(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 fi(t){var e=t.firstChild;return e&&e.nodeType==Node.TEXT_NODE?t.textContent.trim():null}function di(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 pi(t){return t?(t=Date.parse(t),isNaN(t)?null:Math.floor(t/1e3)):null}function mi(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 bi(t){return t=Number(t),t%1?null:t}function gi(t){return t=Number(t),!(t%1)&&0e||(i[i.length-1]=new Ut(t.position,t.startTime,e,t.a,t.L,t.D)))}}function _i(t,e){if(!e.length)return t;var i=e.map(function(t){return new d(t)});return t.map(function(t){return new d(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(k,[]).map(function(t){return t.toString()})}function Ri(t,e){var i=Ni(t,e,"timescale"),n=1;i&&(n=gi(i)||1),i=Ni(t,e,"duration"),(i=gi(i||""))&&(i/=n);var r=Ni(t,e,"startNumber"),s=Ni(t,e,"presentationTimeOffset"),a=vi(r||"");null!=r&&null!=a||(a=1);var o=Ci(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=[],l=0,f=0;fd)if(f+1=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}0t.b.byteLength&&Ki();var i=t.b.buffer.slice(t.a,t.a+e);return t.a+=e,new Uint8Array(i)}function Bi(t,e){t.a+e>t.b.byteLength&&Ki(),t.a+=e}function Fi(t){var e=t.a;try{for(;xi(t)&&t.b.getUint8(t.a);)t.a+=1}catch(i){Ki()}return e=t.b.buffer.slice(e,t.a),t.a+=1,q(e)}function Ki(){throw new S(3,3e3)}function Vi(t,e){for(;xi(e);){var i=e.a,n=Li(e),r=Li(e);if(1==n?n=ji(e):n||(n=e.b.byteLength-i),r==t)return n;Bi(e,n-(e.a-i))}return-1}function qi(t,e){for(var i=new Mi(new DataView(t)),n=[[1836019574,0],[1953653099,0],[1835297121,0],[1835626086,0],[1937007212,0],[1937011556,8],[e,0]],r=-1,s=0;s>>31,u&=2147483647;var c=Li(t);if(Bi(t,4),1==h)throw new S(3,3006);r.push(new Ut(r.length,n/o,(n+c)/o,function(){return i},e,e+u-1)),n+=c,e+=u}return r}function Gi(t){this.a=t}function zi(t){this.b=t,this.a=new Mi(t),Ts||(Ts=[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 $i(t){var e;if(e=Yi(t),7=e&&!(i&1<<8-e);e++);if(8t||i&&t>=i?null:Math.floor(t/n)},getSegmentReference:function(t){var e=t*n;return new Ut(t,e,e+n,function(){var i=Ai(a,u,t+r,o,e*s);return _i(h,[i])},0,null)}}}function ln(t,e){for(var i=[],n=0;ne.s||(e.f=t.setTimeout(e.Sc.bind(e),1e3*Math.max(Math.max(3,e.s)-i,0)))}function gn(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",frameRate:void 0},i=i||e.M;var n=li(t,"BaseURL").map(fi),r=t.getAttribute("contentType")||e.contentType,s=t.getAttribute("mimeType")||e.mimeType,a=t.getAttribute("codecs")||e.codecs,o=di(t,"frameRate",wi)||e.frameRate;return r||(r=Tn(s,a)),{M:_i(i,n),Ga:ci(t,"SegmentBase")||e.Ga,Y:ci(t,"SegmentList")||e.Y,Ha:ci(t,"SegmentTemplate")||e.Ha,width:di(t,"width",vi)||e.width,height:di(t,"height",vi)||e.height,contentType:r,mimeType:s,codecs:a,frameRate:o,id:t.getAttribute("id")}}function vn(t){var e={};t.forEach(function(t){e[t.id]=[t]}),t.forEach(function(t){var i=e[t.id];t.Yc.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.cc}),drmInfos:r.map(function(t){return t.drmInfos}).reduce(k,[]),streams:r.map(function(t){return t.streams}).reduce(k,[])},i.push(e)})})}}),i}function wn(t){var e;return e=0+(t.Ga?1:0),e+=t.Y?1:0,(e+=t.Ha?1:0)?(1!=e&&(t.Ga&&(t.Y=null),t.Ha=null),!0):"text"==t.contentType||"application"==t.contentType}function En(t,e,i,n){return e=_i(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 Sn(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}),T(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 En(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 En(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 Tn(t,e){return rs[ae(t,e)]?"text":t.split("/")[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 S(2,2005)}if(s){var o,u;if(!(i=s.getElementsByTagName("tt")[0]))throw new S(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;un.length||"data"!=n[0])throw new S(1,1004,e);if(n=n.slice(1).join(":").split(","),2>n.length)throw new S(1,1004,e);var r=n[0],n=t.decodeURIComponent(n.slice(1).join(",")),r=r.split(";"),s=null;if(1=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.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r})}else{r=null;try{r=G(e.response)}catch(s){}n(new S(1,1001,t,e.status,r))}},r.onerror=function(){n(new S(1,1002,t))},r.ontimeout=function(){n(new S(1,1003,t))};for(var s in e.headers)r.setRequestHeader(s,e.headers[s]);r.send(e.body)})}function Dn(){this.a=null,this.c=[],this.b={}}function On(t,e,i){return Un(t,e,"readwrite",function(t){return t.put(i)})}function Ln(t,e){var i=[];return Un(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=Bn.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 Un(t,e,"readonly",function(t){return t.openCursor(null,"prev")},function(t){t&&(i=t.key+1)}).then(function(){return i})}function Un(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=Bn.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(),Bn(s,a,t)},a}function Bn(t,e,i){"AbortError"==t.error.name?e.reject(new S(9,9002)):e.reject(new S(9,9001,t.error)),i.preventDefault()}function Fn(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 Kn(){}function Vn(t){var e=new Bt(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 Ut(e,t.startTime,t.endTime,function(){ -return[t.uri]},0,null)});return e.Fa(t.startTime,r),r=new Gi(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 jt(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 qn(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 Dn;return n.init(ks).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new S(9,9003,i);return{uri:t,data:e.data,headers:{}}})})}return Promise.reject(new S(1,9004,t))}function Hn(t,e,i){this.b={},this.i=i,this.m=t,this.l=e,this.j=this.a=null,this.f=this.h=this.g=this.c=0}function Gn(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),L:i.L,D:i.D,ib:n,Da:r})}function zn(t,e){t.c=0,t.g=0,t.h=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.h+=t.ib}.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 S(9,9002));if(e>=t.length)return Promise.resolve();var n=t[e++];return $n(this,n).then(i)}.bind(this);return i()}.bind(t));return t.b={},t.j=Promise.all(i)}function $n(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.Da(t.data)):Promise.reject(new S(9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new S(9,9002));null==e.D?(this.a.size+=n,this.f+=e.ib):this.g+=n;var t=(this.g+this.f)/(this.c+this.h),i=Fn(this.a);this.i.progressCallback(i,t)}.bind(t))}function Yn(t){this.a=new Dn,this.c=t,this.j=Jn(this),this.h=null,this.v=!1,this.i=null,this.l=[],this.f=-1,this.m=0,this.b=null,this.g=new Hn(t.i,t.getConfiguration().streaming.retryParameters,this.j)}function Wn(){return!!t.indexedDB}function Xn(t,e,i,n){function r(){}var s,a,o,u=t.c.i,h=t.c.getConfiguration();return bt(e,u,h.manifest.retryParameters,n).then(function(t){return ir(this),o=new t,o.configure(h.manifest),o.start(e,u,this.s.bind(this),i)}.bind(t)).then(function(t){return ir(this),s=t,a=new et(u,i,r),a.configure(h.drm),a.init(s,!0)}.bind(t)).then(function(){return ir(this),tr(s)}.bind(t)).then(function(){return ir(this),rt(a)}.bind(t)).then(function(){return ir(this),o.stop()}.bind(t)).then(function(){return ir(this),{manifest:s,Sb:a}}.bind(t))["catch"](function(t){if(o)return o.stop().then(function(){throw t});throw t})}function Jn(t){return{trackSelectionCallback:t.A.bind(t),progressCallback:function(t,e){if(t||e)return null}}}function Zn(t){return t.a.a?Promise.resolve():t.a.init(ks)}function Qn(t){var e=t.h?t.h.o():Promise.resolve();return t.h=null,t.b=null,t.v=!1,t.i=null,t.l=[],t.f=-1,e}function tr(t){return t=t.periods.map(function(t){return t.streamSets}).reduce(k,[]).map(function(t){return t.streams}).reduce(k,[]),Promise.all(t.map(function(t){return t.createSegmentIndex()}))}function er(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++;Gn(t.g,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),On(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,Gn(t.g,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),On(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 ir(t){if(!t.c)throw new S(9,9002)}function nr(t){Ps.push(t)}function rr(t){var e=t.type.replace(/^(webkit|moz|MS)/,"").toLowerCase(),e=new Event(e,t);t.target.dispatchEvent(e)}function sr(t){for(this.c=[],this.b=[],this.a=[],t=new Mi(new DataView(t.buffer));xi(t);){var e=Vi(1886614376,t);if(-1==e)break;var i=t.a-8,n=Di(t);if(1=i.a.length)){for(var n=[],r=0;rthis.a?this.b:Math.min(s(this.c),s(this.f))},e("shaka.abr.SimpleAbrManager",h),h.prototype.stop=function(){this.g=null,this.f=!1,this.h={},this.a={},this.c=null},h.prototype.stop=h.prototype.stop,h.prototype.init=function(t){this.g=t},h.prototype.init=h.prototype.init,h.prototype.chooseStreams=function(t){for(var e in t)this.h[e]=t[e];if(e={},"audio"in t){var i=c(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},h.prototype.chooseStreams=h.prototype.chooseStreams,h.prototype.enable=function(){this.f=!0},h.prototype.enable=h.prototype.enable,h.prototype.disable=function(){this.f=!1},h.prototype.disable=h.prototype.disable,h.prototype.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=c(this))&&(i.audio=n,this.a.audio=n),(n=l(this))&&(i.video=n,this.a.video=n),this.c=Date.now(),this.b.getBandwidthEstimate(),this.g(i)}},h.prototype.segmentDownloaded=h.prototype.segmentDownloaded,h.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate()},h.prototype.getBandwidthEstimate=h.prototype.getBandwidthEstimate,h.prototype.setDefaultEstimate=function(t){this.b.setDefaultEstimate(t)},h.prototype.setDefaultEstimate=h.prototype.setDefaultEstimate;var Wr=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#(.*))?$/;$r=d.prototype,$r.R="",$r.ka="",$r.T="",$r.wa=null,$r.O="",$r.ca="",$r.toString=function(){var t=[],e=this.R;if(e&&t.push(g(e,Xr,!0),":"),e=this.T){t.push("//");var i=this.ka;i&&t.push(g(i,Xr,!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(g(e,"/"==e.charAt(0)?Zr:Jr,!0))),(e=this.a.toString())&&t.push("?",e),(e=this.ca)&&t.push("#",g(e,ts)),t.join("")},$r.resolve=function(t){var e=new d(this);"data"===e.R&&(e=new d);var i=!!t.R;i?p(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)m(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;ai||n&&1e3>i)&&(this.a.splice(e,1),t.close()),W(this.v)}},$r.yc=function(){V(this.w,function(t,e){return"expired"==e})&&this.h(new S(6,6014)),this.J(this.w)};var is={},ns={};e("shaka.media.ManifestParser.registerParserByExtension",function(t,e){ns[t]=e}),e("shaka.media.ManifestParser.registerParserByMime",function(t,e){is[t]=e});var rs={};e("shaka.media.TextEngine.registerParser",function(t,e){rs[t]=e}),e("shaka.media.TextEngine.unregisterParser",function(t){delete rs[t]}),e("shaka.media.TextEngine.makeCue",vt);var ss=t.VTTCue||t.TextTrackCue;gt.prototype.o=function(){return this.c&&St(this,function(){return!0}),this.c=this.h=null,Promise.resolve()},gt.prototype.remove=function(t,e){return Promise.resolve().then(function(){this.c&&(St(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&&ethis.b&&e>=this.a&&(this.a=t)))}.bind(this))},$r=Pt.prototype,$r.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"](P)),n=1;n=this.a.duration-.05||this.a.ended;this.h?(e||t>=this.j)&&qt(this,!1):!e&&.5>t&&qt(this,!0)},$r.Ta=function(){return this.g},$r.lc=function(){this.a.playbackRate!=(this.h||0>this.g?0:this.g)&&zt(this,this.a.playbackRate)},$r.sb=function(){this.b.ja(this.a,"loadedmetadata");var t=Vt(this);.001>Math.abs(this.a.currentTime-t)?(L(this.b,this.a,"seeking",this.ub.bind(this)),L(this.b,this.a,"playing",this.tb.bind(this))):(L(this.b,this.a,"seeking",this.nc.bind(this)),this.a.currentTime=t)},$r.nc=function(){this.b.ja(this.a,"seeking"),L(this.b,this.a,"seeking",this.ub.bind(this)),L(this.b,this.a,"playing",this.tb.bind(this))},$r.ub=function(){var t=this.a.currentTime,e=$t(this,t);.001this.ma.indexOf(t.id)}.bind(this))},Ue.prototype.getTracks=Ue.prototype.getTracks,Ue.prototype.Gc=function(t,e){if(this.b){var i=ee(ue(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=he(this.b).text,this.configure({abr:{enabled:!1}}),i.text=n),He(this,i,e))}}},Ue.prototype.selectTrack=Ue.prototype.Gc,Ue.prototype.bc=function(){return"showing"==this.s.mode},Ue.prototype.isTextTrackVisible=Ue.prototype.bc,Ue.prototype.Ic=function(t){this.s.mode=t?"showing":"hidden",Xe(this)},Ue.prototype.setTextTrackVisibility=Ue.prototype.Ic,Ue.prototype.getStats=function(){Ge(this);var t={},e={},i=this.f&&this.f.getVideoPlaybackQuality?this.f.getVideoPlaybackQuality():{};return this.b&&(e=he(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)}},Ue.prototype.getStats=Ue.prototype.getStats,Ue.prototype.addTextTrack=function(t,e,i,n,r){if(!this.b)return Promise.reject();for(var s,a=ue(this.b),o=0;oe&&(e+=Math.pow(2,32)),e=e.toString(16)),this.Z(new S(3,3016,t,e))}}},$r.Mc=function(t){var e=["output-restricted","internal-error"],i=ue(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)})}),$e(this,i),n&&We(this)};var cs="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),ls="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),fs=["loop","playbackRate"],ds=["pause","play"],ps=["adaptation","buffering","error","texttrackvisibility","trackschanged"],ms="getConfiguration getManifestUri getPlaybackRate getTracks getStats isBuffering isLive isTextTrackVisible seekRange".split(" "),ys=[["getConfiguration","configure"]],bs=[["isTextTrackVisible","setTextTrackVisibility"]],gs="configure resetConfiguration trickPlay cancelTrickPlay selectTrack setTextTrackVisibility addTextTrack".split(" "),vs=["load","unload"];$r=ti.prototype,$r.o=function(){return ei(this),this.a&&(this.a.stop(function(){},function(){}),this.a=null),this.A=this.w=this.l=null,this.f=this.j=this.g=!1,this.h=this.c=this.b=this.a=this.i=null,Promise.resolve()},$r.N=function(){return this.f},$r.ab=function(){return this.v},$r.init=function(){if(t.chrome&&chrome.cast&&chrome.cast.isAvailable){delete t.__onGCastApiAvailable,this.g=!0,this.l();var e=new chrome.cast.SessionRequest(this.C),e=new chrome.cast.ApiConfig(e,this.fc.bind(this),this.mc.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){})}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},$r.cb=function(t){this.i=t,this.f&&ii(this,{type:"appData",appData:this.i})},$r.cast=function(t){return this.g?this.j?this.f?Promise.reject(new S(8,8002)):(this.h=new R,chrome.cast.requestSession(this.Za.bind(this,t),this.pb.bind(this)),this.h):Promise.reject(new S(8,8001)):Promise.reject(new S(8,8e3))},$r.get=function(t,e){if("video"==t){if(0<=ds.indexOf(e))return this.Ab.bind(this,t,e)}else if("player"==t){if(0<=gs.indexOf(e))return this.Ab.bind(this,t,e);if(0<=vs.indexOf(e))return this.Bc.bind(this,t,e);if(0<=ms.indexOf(e))return this.xb.bind(this,t,e)}return this.xb(t,e)},$r.set=function(t,e,i){this.b[t][e]=i,ii(this,{type:"set",targetName:t,property:e,value:i})},$r.Za=function(t,e){this.a=e,this.a.addUpdateListener(this.qb.bind(this)),this.a.addMessageListener("urn:x-cast:com.google.shaka.v2",this.gc.bind(this)),this.qb(),ii(this,{type:"init",initState:t,appData:this.i}),this.h.resolve()},$r.pb=function(t){var e=8003;switch(t.code){case"cancel":e=8004;break;case"timeout":e=8005;break;case"receiver_unavailable":e=8006}this.h.reject(new S(8,e,t))},$r.xb=function(t,e){return this.b[t][e]},$r.Ab=function(t,e){ii(this,{type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},$r.Bc=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,ii(this,{type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},$r.fc=function(t){var e=this.s();this.h=new R,this.Za(e,t)},$r.mc=function(t){this.j="available"==t,this.l()},$r.qb=function(){var t=!!this.a&&"connected"==this.a.status;if(this.f&&!t){this.A();for(var e in this.b)this.b[e]={};ei(this)}this.v=(this.f=t)?this.a.receiver.friendlyName:"",this.l()},$r.gc=function(t,e){var i=Ze(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.w(n,new Le(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 S(s.category,s.code);for(r in s)n[r]=s[r];i.reject(n)}else i.resolve()}},i(ni),e("shaka.cast.CastProxy",ni),ni.prototype.o=function(){var t=[this.i?this.i.o():null,this.b?this.b.o():null,this.a?this.a.o():null];return this.a=this.i=this.j=this.l=this.b=this.c=null,Promise.all(t)},ni.prototype.destroy=ni.prototype.o,ni.prototype.Yb=function(){return this.l},ni.prototype.getVideo=ni.prototype.Yb,ni.prototype.Wb=function(){return this.j},ni.prototype.getPlayer=ni.prototype.Wb,ni.prototype.Mb=function(){return!!this.a&&(this.a.g&&this.a.j)},ni.prototype.canCast=ni.prototype.Mb,ni.prototype.N=function(){return!!this.a&&this.a.N()},ni.prototype.isCasting=ni.prototype.N,ni.prototype.ab=function(){return this.a?this.a.ab():""},ni.prototype.receiverName=ni.prototype.ab,ni.prototype.cast=function(){var t=this.mb();return this.a.cast(t).then(function(){return this.b.hb()}.bind(this))},ni.prototype.cast=ni.prototype.cast,ni.prototype.cb=function(t){this.a.cb(t)},ni.prototype.setAppData=ni.prototype.cb,ni.prototype.Xc=function(){var t=this.a;if(t.f){var e=t.s();chrome.cast.requestSession(t.Za.bind(t,e),t.pb.bind(t))}},ni.prototype.suggestDisconnect=ni.prototype.Xc,$r=ni.prototype,$r.mb=function(){var t={video:{},player:{},playerAfterLoad:{},manifest:this.b.na,startTime:null};return this.c.pause(),fs.forEach(function(e){t.video[e]=this.c[e]}.bind(this)),this.c.ended||(t.startTime=this.c.currentTime),ys.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.player[i]=e}.bind(this)),bs.forEach(function(e){var i=e[1];e=this.b[e[0]](),t.playerAfterLoad[i]=e}.bind(this)),t},$r.Pc=function(){this.dispatchEvent(new Le("caststatuschanged"))},$r.Rc=function(){ys.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 Le("error",{detail:t}))}.bind(this)));var s={};fs.forEach(function(t){s[t]=this.a.get("video",t)}.bind(this)),i.then(function(){fs.forEach(function(t){this.c[t]=s[t]}.bind(this)),bs.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))},$r.bd=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)},$r.dd=function(t,e){this.a.N()?this.a.set("video",t,e):this.c[t]=e},$r.cd=function(t){this.a.N()||this.g.dispatchEvent(new Le(t.type,t))},$r.wc=function(t){return"addEventListener"==t?this.f.addEventListener.bind(this.f):"removeEventListener"==t?this.f.removeEventListener.bind(this.f):"getNetworkingEngine"==t?this.b.nb.bind(this.b):this.a.N()&&!Object.keys(this.a.b.video).length&&0<=ms.indexOf(t)||!this.a.N()?(t=this.b[t],t.bind(this.b)):this.a.get("player",t)},$r.xc=function(t){this.a.N()||this.f.dispatchEvent(t)},$r.Qc=function(t,e){this.a.N()&&("video"==t?this.g.dispatchEvent(e):"player"==t&&this.f.dispatchEvent(e))},i(si),e("shaka.cast.CastReceiver",si),si.prototype.$b=function(){return this.i},si.prototype.isConnected=si.prototype.$b,si.prototype.ac=function(){return this.c},si.prototype.isIdle=si.prototype.ac,si.prototype.o=function(){var e=this.a?this.a.o():Promise.resolve();return null!=this.f&&t.clearTimeout(this.f),this.l=this.j=this.a=this.b=null,this.i=!1,this.c=!0,this.f=this.g=null,e.then(function(){cast.receiver.CastReceiverManager.getInstance().stop()})},si.prototype.destroy=si.prototype.o,$r=si.prototype,$r.vb=function(){this.i=!!cast.receiver.CastReceiverManager.getInstance().getSenders().length,oi(this)},$r.yb=function(t,e){this.$a(),hi(this,{type:"event",targetName:t,event:e})},$r.$a=function(){null!=this.f&&t.clearTimeout(this.f),this.f=t.setTimeout(this.$a.bind(this),500);var e={video:{},player:{}};ls.forEach(function(t){e.video[t]=this.b[t]}.bind(this)),ms.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),hi(this,{type:"update",update:e})},$r.Tb=function(){var t=cast.receiver.CastReceiverManager.getInstance().getSystemVolume();t&&hi(this,{type:"update",update:{video:{volume:t.level,muted:t.muted}}}),hi(this,{type:"event",targetName:"video",event:{type:"volumechange"}})},$r.hc=function(t){var e=Ze(t.data);switch(e.type){case"init":ui(this,e.initState,e.appData),this.$a();break;case"appData":this.l(e.appData);break;case"set":var i=e.targetName,n=e.property,r=e.value;if("video"==i){if(e=cast.receiver.CastReceiverManager.getInstance(),"volume"==n){e.setSystemVolumeLevel(r);break}if("muted"==n){e.setSystemVolumeMuted(r);break}}this.j[i][n]=r;break;case"call":i=e.targetName,n=e.methodName,r=e.args,i=this.j[i],i[n].apply(i,r);break;case"asyncCall":i=e.targetName,n=e.methodName,r=e.args,e=e.id,t=t.senderId,i=this.j[i],i[n].apply(i,r).then(this.Eb.bind(this,t,e,null),this.Eb.bind(this,t,e))}},$r.Eb=function(t,e,i){hi(this,{type:"asyncComplete",id:e,error:i},t)};var ws={"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"},Es=1/15,Ss=1;e("shaka.media.SegmentIndex",Gi),Gi.prototype.o=function(){return this.a=null,Promise.resolve()},Gi.prototype.destroy=Gi.prototype.o,Gi.prototype.find=function(t){for(var e=this.a.length-1;0<=e;--e){var i=this.a[e];if(t>=i.startTime&&tt||t>=this.a.length?null:this.a[t]):null},Gi.prototype.get=Gi.prototype.get,Gi.prototype.Xa=function(t){for(var e=[],i=0,n=0;is.startTime||(.1t);++e);this.a.splice(0,e)},Gi.prototype.evict=Gi.prototype.Sa;var Ts;e("shaka.dash.DashParser",dn),$r=dn.prototype,$r.configure=function(t){this.c=t},$r.start=function(t,e,i,n,r){return this.h=[t],this.a=e,this.j=i,this.l=n,this.m=r,pn(this).then(function(){return this.a&&bn(this,0),this.b}.bind(this))},$r.stop=function(){return this.a&&this.a.Kb(this.Ka),this.c=this.m=this.l=this.j=this.a=null,this.h=[],this.b=null,this.g=[],this.i={},null!=this.f&&(t.clearTimeout(this.f),this.f=null),Promise.resolve()},$r.uc=function(t,e){t.P=gn(e,t.K,null);var i=!1,n=li(e,"Role"),r=void 0;"text"==t.P.contentType&&(r="subtitle");for(var s=0;si.length)return null;var n=null;if(t=kn.pa(t,e))for(e=0;et[0].indexOf("-->")&&(r=t[0],t.splice(0,1));var s=new In(t[0]),a=Nn.a(s),o=_n(s,/[ \t]+--\x3e[ \t]+/g),u=Nn.a(s);if(null==a||!o||null==u)throw new S(2,2001);if(a+=e,u+=e,n&&(a+=i,u+=i),t=vt(a,u,t.slice(1).join("\n").trim()),!t)return null;for(_n(s,/[ \t]+/gm),e=Rn(s);e;)Nn.j(t,e),_n(s,/[ \t]+/gm),e=Rn(s);return null!=r&&(t.id=r),t},Nn.j=function(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(t.align=i[1],"center"==i[1]&&"center"!=t.align&&(t.position="auto",t.align="middle")):(i=/^vertical:(lr|rl)$/.exec(e))?t.vertical=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.positionAlign=i[2])):(i=/^line:(\d{1,2}|100)%(?:,(start|end|center))?$/.exec(e))?(t.snapToLines=!1,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.snapToLines=!0,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2]))},Nn.a=function(t){if(t=_n(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g),!t)return null;var e=Number(t[2]),i=Number(t[3]);return 59=t.height});i.sort(function(t,e){return e.bandwidth-t.bandwidth}),i.length&&e.push(i[0]);for(var n=Jt(this.c.getConfiguration().preferredAudioLanguage),i=[0,as,os],r=t.filter(function(t){return"audio"==t.type}),i=i.map(function(t){return r.filter(function(e){return e=Jt(e.language),Xt(t,n,e)})}),s=r,a=0;ae.indexOf("Apple")||(0<=i.indexOf("Version/8")?t.MediaSource=null:0<=i.indexOf("Version/9")?Mr():0<=i.indexOf("Version/10")&&(Mr(),xr()))}});var Rs=0;Lr.prototype.then=function(t,e){var i=new Lr;switch(this.ia){case 1:Kr(this,i,t);break;case 2:Kr(this,i,e);break;case Rs:this.c.push({I:i,Da:t}),this.b.push({I:i,Da:e})}return i},Lr.prototype["catch"]=function(t){return this.then(void 0,t)},Lr.prototype.W=function(t){if(this.ia==Rs){for(this.Oa=t,this.ia=1,t=0;t=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=ts;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=_;e.prototype=i.prototype,t.qd=i.prototype,t.prototype=new e,t.prototype.constructor=t,t.nd=function(t,e,n){return i.prototype[e].apply(t,Array.prototype.slice.call(arguments,2))}}function n(t){this.c=Math.exp(Math.log(.5)/t),this.b=this.a=0}function r(t,e,i){var n=Math.pow(t.c,e);i=i*(1-n)+n*t.a,isNaN(i)||(t.a=i,t.b+=e)}function 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(){}function u(){}function h(){this.h=null,this.f=!1,this.b=new a,this.g={},this.a={},this.i=!1,this.c=null}function c(t){return(t=t.g.audio)?(t=f(t),t[Math.floor(t.length/2)]):null}function l(t){var e=t.g.video;if(!e)return null;var e=f(e),i=t.a.audio,i=i&&i.bandwidth||0;t=t.b.getBandwidthEstimate();for(var n=e[0],r=0;r=(s.bandwidth+i)/.95&&t<=a&&(n=s)}}return n}function f(t){return t.streams.slice(0).filter(function(t){return t.allowedByApplication&&t.allowedByKeySystem}).sort(function(t,e){return t.bandwidth-e.bandwidth})}function d(e,i){var n,r=i||{};for(n in r)this[n]=r[n];this.defaultPrevented=this.cancelable=this.bubbles=!1,this.timeStamp=t.performance&&t.performance.now?t.performance.now():Date.now(),this.type=e,this.isTrusted=!1,this.target=this.currentTarget=null,this.a=!1}function p(t){return JSON.stringify(t,function(t,e){if("manager"!=t&&"function"!=typeof e){if(e instanceof Event||e instanceof d){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;ie?"-Infinity":"Infinity":e;return n}})}function m(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__?b(e):e})}function b(t){return{length:t.length,start:function(e){return t.start[e]},end:function(e){return t.end[e]}}}function y(t,e,i){this.category=t,this.code=e,this.data=Array.prototype.slice.call(arguments,2)}function g(){var t,e,i=new Promise(function(i,n){t=i,e=n});return i.resolve=t,i.reject=e,i}function v(t,e,i,n,r){this.C=t,this.l=e,this.A=i,this.B=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 w(t){for(var e in t.c){var i=t.c[e];delete t.c[e],i.reject(new y(7,7e3))}}function E(t,e){var i=p(e);t.a.sendMessage("urn:x-cast:com.google.shaka.v2",i,function(){},o)}function T(){this.a={}}function S(){this.a=new T}function k(t,e,i,n){e=new A(e,i,n),t.a.push(i,e)}function P(t){var e,i=t.a,n=[];for(e in i.a)n.push.apply(n,i.a[e]);for(i=0;ie)throw Error("Bad port number "+e);t.ya=e}else t.ya=null}function mt(t,e,i){e instanceof vt?t.a=e:(i||(e=yt(e,bs)),t.a=new vt(e))}function bt(t,e){return t?e?decodeURI(t):decodeURIComponent(t):""}function yt(t,e,i){return"string"==typeof t?(t=encodeURI(t).replace(e,gt),i&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function gt(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function vt(t){this.b=t||null}function wt(t){var e=new vt;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 Et(t,e,i){this.a=t,this.M=e,this.D=i}function Tt(t,e,i,n,r,s){this.position=t,this.startTime=e,this.endTime=i,this.a=n,this.M=r,this.D=s}function St(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 kt(t,e,i){if(i.length){var n=i[0];n.startTime<=gs&&(i[0]=new Tt(n.position,0,n.endTime,n.a,n.M,n.D)),t||(t=i[i.length-1],t.startTime>e||(i[i.length-1]=new Tt(t.position,t.startTime,e,t.a,t.M,t.D)))}}function Pt(t,e){if(!e.length)return t;var i=e.map(function(t){return new ft(t)});return t.map(function(t){return new ft(t)}).map(function(t){return i.map(t.resolve.bind(t))}).reduce(L,[]).map(function(t){return t.toString()})}function At(t,e){var i=_t(t,e,"timescale"),n=1;i&&(n=rt(i)||1),i=_t(t,e,"duration"),(i=rt(i||""))&&(i/=n);var r=_t(t,e,"startNumber"),s=_t(t,e,"presentationTimeOffset"),a=st(r||"");null!=r&&null!=a||(a=1);var o=It(t,e,"SegmentTimeline"),r=null;if(o){for(var r=n,u=Number(s),h=t.I.duration||1/0,o=X(o,"S"),c=[],l=0,f=0;fd)if(f+1=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=t[e]}.bind(null,e);if(!e[0]&&!e[2])return Nt(t,!1);if(!e[1]&&!e[3])return Nt(t,!0);if(i(0)&&i(1)&&i(2)&&i(3))return Rt(t);throw new y(2,2003)}function Ct(t){t=unescape(encodeURIComponent(t));for(var e=new Uint8Array(t.length),i=0;it.b.byteLength&&qt();var i=t.b.buffer.slice(t.a,t.a+e);return t.a+=e,new Uint8Array(i)}function Kt(t,e){t.a+e>t.b.byteLength&&qt(),t.a+=e}function Vt(t){var e=t.a;try{for(;Ot(t)&&t.b.getUint8(t.a);)t.a+=1}catch(i){qt()}return e=t.b.buffer.slice(e,t.a),t.a+=1,Rt(e)}function qt(){throw new y(3,3e3)}function Ht(t,e){for(;Ot(e);){var i=e.a,n=Ut(e),r=Ut(e);if(1==n?n=Bt(e):n||(n=e.b.byteLength-i),r==t)return n;Kt(e,n-(e.a-i))}return-1}function Gt(t,e){for(var i=new Dt(new DataView(t)),n=[[1836019574,0],[1953653099,0],[1835297121,0],[1835626086,0],[1937007212,0],[1937011556,8],[e,0]],r=-1,s=0;s>>31,u&=2147483647;var c=Ut(t);if(Kt(t,4),1==h)throw new y(3,3006);r.push(new Tt(r.length,n/o,(n+c)/o,function(){return i},e,e+u-1)),n+=c,e+=u}return r}function $t(t){this.a=t}function Yt(t){this.b=t,this.a=new Dt(t),ws||(ws=[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 Wt(t){var e;if(e=Jt(t),7=e&&!(i&1<<8-e);e++);if(8t||i&&t>=i?null:Math.floor(t/n)},getSegmentReference:function(t){var e=t*n;return 0>e||i&&e>=i?null:new Tt(t,e,e+n,function(){var i=St(a,u,t+r,o,e*s);return Pt(h,[i])},0,null)}}}function fe(t,e){for(var i=[],n=0;n=e?null:new VTTCue(t,e,i)}function Te(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=this.f);++s)this.c.addCue(t[s]);null==this.b&&(this.b=i),this.a=Math.min(n,this.f)}}}.bind(t))}function Se(t,e){return null==t.a||t.a=Ps&&i==e.split("-")[0]||t>=As&&i.split("-")[0]==e.split("-")[0]}function Ae(t){t=t.toLowerCase().split("-");var e=_s[t[0]];return e&&(t[0]=e),t.join("-")}function _e(t,e,i){for(var n=0;nt.end(0)-t.start(0)?null:t.length?t.end(t.length-1):null}function ze(t,e){var i=0;if(!t||1==t.length&&1e-6>t.end(0)-t.start(0))return i;var n=!1,r=1e-4;e||(r=.25);for(var s=0;s=t.start(s)&&e=t.start(s)-t.end(s-1))i+=t.end(s)-t.start(s),i+=t.start(s)-t.end(s-1);else if(0=t.end(s-1)){if(!(.04>=t.start(s)-e))break;i+=t.end(s)-e,n=!0}else n=!1;return i}function $e(t,e,i){var n=ze(t,e);return n||(n=ze(t,e+i))&&(n+=i),n}function Ye(t,e,i){this.f=t,this.F=e,this.i=i,this.c={},this.b=null,this.a={},this.g=new S,this.h=!1}function We(){var t={};return'video/mp4; codecs="avc1.42E01E",video/mp4; codecs="avc3.42E01E",video/mp4; codecs="hvc1.1.6.L93.90",audio/mp4; codecs="mp4a.40.2",audio/mp4; codecs="ac-3",audio/mp4; codecs="ec-3",video/webm; codecs="vp8",video/webm; codecs="vp9",video/webm; codecs="av1",audio/webm; codecs="vorbis",audio/webm; codecs="opus",video/mp2t; codecs="avc1.42E01E",video/mp2t; codecs="avc3.42E01E",video/mp2t; codecs="hvc1.1.6.L93.90",video/mp2t; codecs="mp4a.40.2",video/mp2t; codecs="ac-3",video/mp2t; codecs="ec-3",video/mp2t; codecs="mp4a.40.2",text/vtt,application/mp4; codecs="wvtt",application/ttml+xml,application/mp4; codecs="stpp"'.split(",").forEach(function(e){t[e]=!!ks[e]||MediaSource.isTypeSupported(e);var i=e.split(";")[0];t[i]=t[i]||t[e]}),t}function Je(t,e){var i;return"text"==e?i=t.b.b:(i=Qe(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 Xe(t,e,i,n){return"text"==e?(e=Se(t.b,i),!e&&n&&(e=Se(t.b,i+n))&&(e+=n)):(t=Qe(t,e),e=$e(t,i,n||0)),e}function Qe(t,e){try{return t.c[e].buffered}catch(i){return null}}function Ze(t,e,i,n,r){return"text"==e?Te(t.b,i,n,r):ni(t,e,t.Zc.bind(t,e,i))}function ti(t,e){return"text"==e?t.b.remove(0,1/0):ni(t,e,t.Gb.bind(t,e,0,t.F.duration))}function ei(t,e,i){return"text"==e?(t.b.h=i,Promise.resolve()):ni(t,e,t.Pc.bind(t,e,i))}function ii(t,e,i){return"text"==e?(t.b.f=i,Promise.resolve()):Promise.all([ni(t,e,t.Pb.bind(t,e)),ni(t,e,t.Nc.bind(t,e,i))])}function ni(t,e,i){if(t.h)return Promise.reject();if(i={start:i,p:new g},t.a[e].push(i),1==t.a[e].length)try{i.start()}catch(n){"QuotaExceededError"==n.name?i.p.reject(new y(3,3017,e)):i.p.reject(new y(3,3015,n)),si(t,e)}return i.p}function ri(t,e){if(t.h)return Promise.reject();var i,n=[];for(i in t.c){var r=new g,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 y(3,3015,n))}for(t in this.c)si(this,t);return i}.bind(t),function(){return Promise.reject()}.bind(t))}function si(t,e){t.a[e].shift();var i=t.a[e][0];if(i)try{i.start()}catch(n){i.p.reject(new y(3,3015,n)),si(t,e)}}function ai(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.widthe.maxWidth||r.width>i.width||r.heighte.maxHeight||r.height>i.height||r.width*r.heighte.maxPixels||r.bandwidthe.maxVideoBandwidth)&&(r.allowedByApplication=!1):"audio"==t.type&&(r.bandwidthe.maxAudioBandwidth)&&(r.allowedByApplication=!1),s!=r.allowedByApplication&&(n=!0)})}),n}function oi(t,e,i){var n="",r=null;for(t&&t.B&&(n=t.keySystem(),r=t.s),t=0;tr.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 ui(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(L,[])}function hi(t,e){for(var i=0;ir?(r=e,n.video=t):e==r&&fi(t)t.streams.length?e:(t.streams.forEach(function(t){e+=t.bandwidth}),e/t.streams.length)}function di(t){var e=0;return t?(t.streams.forEach(function(t){t.height>e&&(e=t.height)}),e):e}function pi(t,e){var i=t;return e&&(i+='; codecs="'+e+'"'),i}function mi(){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.La=this.La.bind(this)}function bi(t){return t.a.request(0,be(t.g,t.c.retryParameters)).then(function(t){if(this.a)return yi(this,t.data,t.uri)}.bind(t))}function yi(t,e,i){var n=Rt(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 y(4,4001);i=[i],n=X(e,"Location").map(Q).filter(U),0e.s||(e.f=t.setTimeout(e.Yc.bind(e),1e3*Math.max(Math.max(3,e.s)-i,0)))}function Ti(t,e,i){e=e||{contentType:"",mimeType:"",codecs:"",frameRate:void 0},i=i||e.N;var n=X(t,"BaseURL").map(Q),r=t.getAttribute("contentType")||e.contentType,s=t.getAttribute("mimeType")||e.mimeType,a=t.getAttribute("codecs")||e.codecs,o=Z(t,"frameRate",at)||e.frameRate;return r||(r=_i(s,a)),{N:Pt(i,n),Ia:J(t,"SegmentBase")||e.Ia,$:J(t,"SegmentList")||e.$,Ja:J(t,"SegmentTemplate")||e.Ja,width:Z(t,"width",st)||e.width,height:Z(t,"height",st)||e.height,contentType:r,mimeType:s,codecs:a,frameRate:o,id:t.getAttribute("id")}}function Si(t){var e={};t.forEach(function(t){e[t.id]=[t]}),t.forEach(function(t){var i=e[t.id];t.dd.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 V(e).forEach(function(t){if(!(0<=n.indexOf(t))){n.push(t);var e=new T;t.forEach(function(t){e.push(t.contentType||"",t)}),e.keys().forEach(function(t){var n=new T;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.hc}),drmInfos:r.map(function(t){return t.drmInfos}).reduce(L,[]),streams:r.map(function(t){return t.streams}).reduce(L,[])},i.push(e)})})}}),i}function ki(t){var e;return e=0+(t.Ia?1:0),e+=t.$?1:0,(e+=t.Ja?1:0)?(1!=e&&(t.Ia&&(t.$=null),t.Ja=null),!0):"text"==t.contentType||"application"==t.contentType}function Pi(t,e,i,n){return e=Pt(e,[i]),e=be(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=Rt(t.data);return t=Date.parse(t),isNaN(t)?0:t-Date.now()})}function Ai(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}),O(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 Pi(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 Pi(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 _i(t,e){return ks[pi(t,e)]?"text":t.split("/")[0]}function Ii(t,e){var i=Rt(t),n=[],r=new DOMParser,s=null;try{s=r.parseFromString(i,"text/xml")}catch(a){throw new y(2,2005)}if(s){var o,u,h;if(!(r=s.getElementsByTagName("tt")[0]))throw new y(2,2006);if(s=r.getAttribute("ttp:frameRate"),o=r.getAttribute("ttp:subFrameRate"),u=r.getAttribute("ttp:frameRateMultiplier"),h=r.getAttribute("ttp:tickRate"),i=r.getAttribute("xml:space")||"default","default"!=i&&"preserve"!=i)throw new y(2,2005);for(i="default"==i,s=new Ri(s,o,u,h),o=Ii.b(r.getElementsByTagName("styling")[0]),u=Ii.b(r.getElementsByTagName("layout")[0]),r=Ii.b(r.getElementsByTagName("body")[0]),h=0;ht.c.ea()?t.c.ta():Math.max(t.c.Va(),t.c.ta())}function Bi(t,e){e!=t.g&&(t.g=e,Vi(t,t.h),t.l(e))}function Fi(e){Ki(e),e.i=t.setTimeout(e.uc.bind(e),250)}function Ki(e){e.i&&(t.clearTimeout(e.i),e.i=null)}function Vi(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 qi(t,e){var i=t.c,n=i.ta(),r=i.Z();return i.S()&&1/0!=i.c?(i=n+1,n=i+t.j,e>=n&&e<=r||ze(t.a.buffered,e)&&e>=i&&e<=r?e:e>r?r:r=i&&e<=r?e:Math.min(n+2,r)):er?r:e}function Hi(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 Gi(t,e){var i=t.c.ta();return ei?i:e)}function zi(t,e,i,n,r,s,a,o,u){this.m=t,this.f=e,this.U=i,this.a=n,this.H=r,this.v=s,this.j=a,this.A=o||null,this.B=u||null,this.g=null,this.i=1,this.C=Promise.resolve(),this.h=[],this.l={},this.b={},this.c=this.s=this.K=!1}function $i(t){return t.a.periods[dn(t,ji(t.m))]}function Yi(t){return q(t.b,function(t){return t.stream})}function Wi(t,e){var i={};return i.text=e,Qi(t,i)}function Ji(t,e,i,n){var r=t.b[e];!r&&"text"==e&&t.g.ignoreTextStreamFailures?Wi(t,i):r&&(e=t.h[pn(t,i)])&&e.za&&(e=t.l[i.id])&&e.za&&r.stream!=i&&(r.stream=i,r.Ma=!0,n&&(r.ba?r.Qa=!0:r.ga?(r.na=!0,r.Qa=!0):(gn(r),bn(t,r,!0))))}function Xi(t){var e=ji(t.m);if(!Object.keys(t.b).every(function(t){return 0e?t.f.Aa(e):t.f.Aa(Math.pow(2,32))}function nn(t,e){var i,n=ji(t.m),r=t.f;i=e.type,i="text"==i?r.b.a:Ge(Qe(r,i));var s=e.va&&e.W?t.a.periods[pn(t,e.va)].startTime+e.W.endTime:Math.max(n,e.Hb);e.Hb=0;var r=pn(t,e.stream),a=dn(t,s),o=Xe(t.f,e.type,n,.1),u=Math.max(t.i*Math.max(t.a.minBufferTime||0,t.g.rebufferingGoal),t.i*t.g.bufferingGoal);return s>=t.a.presentationTimeline.ea()?(e.endOfStream=!0,null):(e.endOfStream=!1,e.Ga=a,a!=r?null:o>=u?.5:(e.W&&e.stream==e.va?(s=e.W.position+1,i=rn(t,e,r,s)):(s=e.W?e.stream.findSegmentPosition(Math.max(0,t.a.periods[pn(t,e.va)].startTime+e.W.endTime-t.a.periods[r].startTime)):e.stream.findSegmentPosition(Math.max(0,(i||n)-t.a.periods[r].startTime)),null==s?i=null:(a=null,null==i&&(a=rn(t,e,r,Math.max(0,s-1))),i=a||rn(t,e,r,s))),i?(sn(t,e,n,r,i),null):1))}function rn(t,e,i,n){return i=t.a.periods[i],(e=e.stream.getSegmentReference(n))?(t=t.a.presentationTimeline,n=t.Z(),i.startTime+e.endTimen?null:e):null}function sn(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.ea();n=on(t,e,n,u),e.ga=!0,e.Ma=!1,o=mn(t,r),Promise.all([n,o]).then(function(t){if(!this.c&&!this.s)return un(this,e,i,s,a,r,t[1])}.bind(t)).then(function(){this.c||this.s||(e.ga=!1,e.eb=!1,yn(this,e,0),cn(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),yn(this,e,4)):3017==t.code?an(this,e,t):"text"==e.type&&this.g.ignoreTextStreamFailures?delete this.b.text:(e.Xa=!0,this.j(t)))}.bind(t))}function an(t,e,i){if(!V(t.b).some(function(t){return t!=e&&t.eb})){var n=Math.round(100*t.i);if(20=i?Promise.resolve():t.f.remove(e.type,n,n+i).then(function(){}.bind(t)))}function cn(t,e){if(!t.K&&(t.K=V(t.b).every(function(t){return"text"==t.type||!t.na&&!t.ba&&t.W}),t.K)){var i=pn(t,e);for(t.h[i]||Zi(t,i).then(function(){this.v()}.bind(t))["catch"](j),i=0;i=t.a.periods[i].startTime)return i;return 0}function pn(t,e){for(var i=0;in.length||"data"!=n[0])throw new y(1,1004,e);if(n=n.slice(1).join(":").split(","),2>n.length)throw new y(1,1004,e);var r=n[0],n=t.decodeURIComponent(n.slice(1).join(",")),r=r.split(";"),s=null;if(1=e.status&&202!=e.status)e.responseURL&&(t=e.responseURL),i({uri:t,data:e.response,headers:r,pd:!!r["x-shaka-from-cache"]});else{var s=null;try{s=xt(e.response)}catch(a){}n(new y(1,1001,t,e.status,s,r))}},r.onerror=function(){n(new y(1,1002,t))},r.ontimeout=function(){n(new y(1,1003,t))};for(var s in e.headers)r.setRequestHeader(s,e.headers[s]);r.send(e.body)})}function En(){this.a=null,this.c=[],this.b={}}function Tn(t,e,i){return Pn(t,e,"readwrite",function(t){return t.put(i)})}function Sn(t,e){var i=[];return Pn(t,"segment","readwrite",function(t){return t.openCursor()},function(t){if(t){if(e(t.value)){var n=t["delete"](),r=new g;n.onsuccess=r.resolve,n.onerror=An.bind(null,n,r),i.push(r)}t["continue"]()}}).then(function(){return Promise.all(i)}).then(function(){return i.length})}function kn(t,e){var i=0;return Pn(t,e,"readonly",function(t){return t.openCursor(null,"prev")},function(t){t&&(i=t.key+1)}).then(function(){return i})}function Pn(t,e,i,n,r){i=t.a.transaction([e],i);var s=n(i.objectStore(e)),a=new g;r&&(s.onsuccess=function(t){r(t.target.result)}),s.onerror=An.bind(null,s,a);var o={transaction:i,J: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(),An(s,a,t)},a}function An(t,e,i){"AbortError"==t.error.name?e.reject(new y(9,9002)):e.reject(new y(9,9001,t.error)),i.preventDefault()}function _n(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 In(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 Rn(t,e,i,n,r){t.b[e]=t.b[e]||[],t.b[e].push({uris:i.a(),M:i.M,D:i.D,mb:n,Ea:r})}function Nn(t,e){t.c=0,t.h=0,t.g=0,t.f=0,V(t.b).forEach(function(t){t.forEach(function(t){null!=t.D?this.c+=t.D-t.M+1:this.g+=t.mb}.bind(this))}.bind(t)),t.a=e,t.a.size=t.c;var i=V(t.b).map(function(t){var e=0,i=function(){if(!this.i)return Promise.reject(new y(9,9002));if(e>=t.length)return Promise.resolve();var n=t[e++];return xn(this,n).then(i)}.bind(this);return i()}.bind(t));return t.b={},t.j=Promise.all(i)}function xn(t,e){var i=be(e.uris,t.l);(e.M||null!=e.D)&&(i.headers.Range="bytes="+e.M+"-"+(null==e.D?"":e.D));var n;return t.m.request(1,i).then(function(t){return this.a?(n=t.data.byteLength,e.Ea(t.data)):Promise.reject(new y(9,9002))}.bind(t)).then(function(){if(!this.a)return Promise.reject(new y(9,9002));null==e.D?(this.a.size+=n,this.f+=e.mb):this.h+=n;var t=(this.h+this.f)/(this.c+this.g),i=_n(this.a);this.i.progressCallback(i,t)}.bind(t))}function Cn(){}function Mn(t){var e=new ve(null,0);e.Aa(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 Tt(e,t.startTime,t.endTime,function(){return[t.uri]},0,null)});return e.Ha(t.startTime,r),r=new $t(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 Et(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 Dn(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 En;return n.init(Is).then(function(){return n.get("segment",i)}).then(function(e){return n.o().then(function(){if(!e)throw new y(9,9003,i);return{uri:t,data:e.data,headers:{}}})})}return Promise.reject(new y(1,9004,t))}function On(){this.a=Promise.resolve(),this.c=this.b=this.f=!1,this.g=new Promise(function(t){this.h=t}.bind(this))}function Ln(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 jn(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]?jn(t[s],e[s],u,n,o):typeof e[s]==typeof u&&(t[s]=e[s]))}}function Un(t,e){_.call(this),this.A=!1,this.f=t,this.m=null, +this.v=new S,this.Ka=new h,this.pa=this.c=this.l=this.b=this.i=this.qa=this.C=this.F=this.g=this.h=null,this.Ra=1e9,this.oa=[],this.Da=!1,this.sa=!0,this.H=this.j=null,this.s={},this.a=Hn(this),this.Ca={width:1/0,height:1/0},this.B=[],this.Y=this.K=this.ra=0,e&&e(this),this.h=new pe(this.Uc.bind(this)),this.qa=Bn(this);for(var i=0;i=i.a.length)){for(var n=[],r=0;rthis.a?this.b:Math.min(s(this.c),s(this.f))},e("shaka.abr.SimpleAbrManager",h),h.prototype.stop=function(){this.h=null,this.f=!1,this.g={},this.a={},this.c=null},h.prototype.stop=h.prototype.stop,h.prototype.init=function(t){this.h=t},h.prototype.init=h.prototype.init,h.prototype.chooseStreams=function(t){for(var e in t)this.g[e]=t[e];if(e={},"audio"in t){var i=c(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},h.prototype.chooseStreams=h.prototype.chooseStreams,h.prototype.enable=function(){this.f=!0},h.prototype.enable=h.prototype.enable,h.prototype.disable=function(){this.f=!1},h.prototype.disable=h.prototype.disable,h.prototype.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=c(this))&&(i.audio=n,this.a.audio=n),(n=l(this))&&(i.video=n,this.a.video=n),this.c=Date.now(),this.b.getBandwidthEstimate(),this.h(i)}},h.prototype.segmentDownloaded=h.prototype.segmentDownloaded,h.prototype.getBandwidthEstimate=function(){return this.b.getBandwidthEstimate()},h.prototype.getBandwidthEstimate=h.prototype.getBandwidthEstimate,h.prototype.setDefaultEstimate=function(t){this.b.setDefaultEstimate(t)},h.prototype.setDefaultEstimate=h.prototype.setDefaultEstimate,d.prototype.preventDefault=function(){},d.prototype.stopImmediatePropagation=function(){this.a=!0},d.prototype.stopPropagation=function(){};var es="ended play playing pause pausing ratechange seeked seeking timeupdate volumechange".split(" "),is="buffered currentTime duration ended loop muted paused playbackRate seeking videoHeight videoWidth volume".split(" "),ns=["loop","playbackRate"],rs=["pause","play"],ss="adaptation buffering emsg error loading unloading texttrackvisibility trackschanged".split(" "),as="drmInfo getConfiguration getManifestUri getPlaybackRate getTracks getStats isBuffering isInProgress isLive isTextTrackVisible keySystem seekRange".split(" "),os=[["getConfiguration","configure"]],us=[["isTextTrackVisible","setTextTrackVisibility"]],hs="addTextTrack cancelTrickPlay configure resetConfiguration selectTrack setTextTrackVisibility trickPlay".split(" "),cs=["load","unload"];e("shaka.util.Error",y),y.prototype.toString=function(){return"shaka.util.Error "+JSON.stringify(this,null," ")},y.Category={NETWORK:1,TEXT:2,MEDIA:3,MANIFEST:4,STREAMING:5,DRM:6,PLAYER:7,CAST:8,STORAGE:9},y.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,NO_PERIODS:4014,DASH_DUPLICATE_REPRESENTATION_ID:4018,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},Zr=v.prototype,Zr.o=function(){return w(this),this.a&&(this.a.stop(function(){},function(){}),this.a=null),this.B=this.A=this.l=null,this.f=this.j=this.h=!1,this.g=this.c=this.b=this.a=this.i=null,Promise.resolve()},Zr.O=function(){return this.f},Zr.cb=function(){return this.v},Zr.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.kc.bind(this),this.rc.bind(this),"origin_scoped");chrome.cast.initialize(e,function(){},function(){})}else t.__onGCastApiAvailable=function(t){t&&this.init()}.bind(this)},Zr.fb=function(t){this.i=t,this.f&&E(this,{type:"appData",appData:this.i})},Zr.cast=function(t){return this.h?this.j?this.f?Promise.reject(new y(8,8002)):(this.g=new g,chrome.cast.requestSession(this.ab.bind(this,t),this.ub.bind(this)),this.g):Promise.reject(new y(8,8001)):Promise.reject(new y(8,8e3))},Zr.get=function(t,e){if("video"==t){if(0<=rs.indexOf(e))return this.Fb.bind(this,t,e)}else if("player"==t){if(0<=hs.indexOf(e))return this.Fb.bind(this,t,e);if(0<=cs.indexOf(e))return this.Gc.bind(this,t,e);if(0<=as.indexOf(e))return this.Cb.bind(this,t,e)}return this.Cb(t,e)},Zr.set=function(t,e,i){this.b[t][e]=i,E(this,{type:"set",targetName:t,property:e,value:i})},Zr.ab=function(t,e){this.a=e,this.a.addUpdateListener(this.vb.bind(this)),this.a.addMessageListener("urn:x-cast:com.google.shaka.v2",this.lc.bind(this)),this.vb(),E(this,{type:"init",initState:t,appData:this.i}),this.g.resolve()},Zr.ub=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 y(8,e,t))},Zr.Cb=function(t,e){return this.b[t][e]},Zr.Fb=function(t,e){E(this,{type:"call",targetName:t,methodName:e,args:Array.prototype.slice.call(arguments,2)})},Zr.Gc=function(t,e){var i=Array.prototype.slice.call(arguments,2),n=new g,r=this.m.toString();return this.m++,this.c[r]=n,E(this,{type:"asyncCall",targetName:t,methodName:e,args:i,id:r}),n},Zr.kc=function(t){var e=this.s();this.g=new g,this.ab(e,t)},Zr.rc=function(t){this.j="available"==t,this.l()},Zr.vb=function(){var t=!!this.a&&"connected"==this.a.status;if(this.f&&!t){this.B();for(var e in this.b)this.b[e]={};w(this)}this.v=(this.f=t)?this.a.receiver.friendlyName:"",this.l()},Zr.lc=function(t,e){var i=m(e);switch(i.type){case"event":var n=i.targetName,r=i.event;this.A(n,new d(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 y(s.category,s.code);for(r in s)n[r]=s[r];i.reject(n)}else i.resolve()}},Zr=T.prototype,Zr.push=function(t,e){this.a.hasOwnProperty(t)?this.a[t].push(e):this.a[t]=[e]},Zr.set=function(t,e){this.a[t]=e},Zr.has=function(t){return this.a.hasOwnProperty(t)},Zr.get=function(t){return(t=this.a[t])?t.slice():null},Zr.remove=function(t,e){var i=this.a[t];if(i)for(var n=0;n=i.startTime&&tt||t>=this.a.length?null:this.a[t]):null},$t.prototype.get=$t.prototype.get,$t.prototype.Za=function(t){for(var e=[],i=0,n=0;is.startTime||(.1t);++e); +this.a.splice(0,e)},$t.prototype.evict=$t.prototype.Ta;var ws;e("shaka.net.NetworkingEngine",pe),pe.RequestType={MANIFEST:0,SEGMENT:1,LICENSE:2};var Es={};pe.registerScheme=function(t,e){Es[t]=e},pe.unregisterScheme=function(t){delete Es[t]},pe.prototype.Ec=function(t){this.b.push(t)},pe.prototype.registerRequestFilter=pe.prototype.Ec,pe.prototype.fd=function(t){var e=this.b;t=e.indexOf(t),0<=t&&e.splice(t,1)},pe.prototype.unregisterRequestFilter=pe.prototype.fd,pe.prototype.Tb=function(){this.b=[]},pe.prototype.clearAllRequestFilters=pe.prototype.Tb,pe.prototype.Eb=function(t){this.c.push(t)},pe.prototype.registerResponseFilter=pe.prototype.Eb,pe.prototype.Ob=function(t){var e=this.c;t=e.indexOf(t),0<=t&&e.splice(t,1)},pe.prototype.unregisterResponseFilter=pe.prototype.Ob,pe.prototype.Ub=function(){this.c=[]},pe.prototype.clearAllResponseFilters=pe.prototype.Ub,pe.prototype.o=function(){this.f=!0,this.b=[],this.c=[];for(var t=[],e=0;e=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&&ethis.b&&e>=this.a&&(this.a=t)))}.bind(this))};var Ps=1,As=2,_s={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"};Ie.prototype.cancel=function(){null!=this.a&&(clearTimeout(this.a),this.a=null)},Zr=Ne.prototype,Zr.o=function(){this.c=!0;var t=this.a.map(function(t){return(t.ha.close()||Promise.resolve())["catch"](j)});return this.j.reject(),this.f&&t.push(this.f.o()),this.l&&t.push(this.l.setMediaKeys(null)["catch"](j)),this.v&&this.v.cancel(),this.f=this.l=this.h=this.s=this.b=this.v=null,this.a=[],this.m=[],this.g=this.i=this.H=null,Promise.all(t)},Zr.configure=function(t){this.i=t},Zr.init=function(t,e){var i={},n=[];return this.C=e,this.m=t.offlineSessionIds,Oe(this,t,e||0n||i&&1e3>n)&&!this.a[e].Oa&&(this.a.splice(e,1),t.close()),Re(this.v)}},Zr.Dc=function(){H(this.A,function(t,e){return"expired"==e})&&this.g(new y(6,6014)),this.K(this.A)},Zr=Ye.prototype,Zr.o=function(){this.h=!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"](j)),n=1;ni.length)return null;var n=null;if(t=Ii.ra(t,e))for(e=0;et[0].indexOf("-->")&&(r=t[0],t.splice(0,1));var s=new xi(t[0]),a=Di.a(s),o=Ci(s,/[ \t]+--\x3e[ \t]+/g),u=Di.a(s);if(null==a||!o||null==u)throw new y(2,2001);if(n?(a+=i,u+=i):(a+=e,u+=e),t=Ee(a,u,t.slice(1).join("\n").trim()),!t)return null;for(Ci(s,/[ \t]+/gm),e=Mi(s);e;)Di.j(t,e),Ci(s,/[ \t]+/gm),e=Mi(s);return null!=r&&(t.id=r),t},Di.j=function(t,e){var i;(i=/^align:(start|middle|center|end|left|right)$/.exec(e))?(t.align=i[1],"center"==i[1]&&"center"!=t.align&&(t.position="auto",t.align="middle")):(i=/^vertical:(lr|rl)$/.exec(e))?t.vertical=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.positionAlign=i[2])):(i=/^line:(\d{1,2}|100)%(?:,(start|end|center))?$/.exec(e))?(t.snapToLines=!1,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2])):(i=/^line:(-?\d+)(?:,(start|end|center))?$/.exec(e))&&(t.snapToLines=!0,t.line=Number(i[1]),i[2]&&(t.lineAlign=i[2]))},Di.a=function(t){if(t=Ci(t,/(?:(\d{1,}):)?(\d{2}):(\d{2})\.(\d{3})/g),!t)return null;var e=Number(t[2]),i=Number(t[3]);return 59=(this.c.S()?this.c.Z()-.1:this.a.duration-.1)||this.a.ended;this.g?(e||t>=this.j)&&Bi(this,!1):!e&&.5>t&&Bi(this,!0)},Zr.Ua=function(){return this.h},Zr.qc=function(){this.a.playbackRate!=(this.g||0>this.h?0:this.h)&&Vi(this,this.a.playbackRate)},Zr.xb=function(){this.b.la(this.a,"loadedmetadata");var t=Ui(this);.001>Math.abs(this.a.currentTime-t)?(k(this.b,this.a,"seeking",this.zb.bind(this)),k(this.b,this.a,"playing",this.yb.bind(this))):(k(this.b,this.a,"seeking",this.sc.bind(this)),this.a.currentTime=t)},Zr.sc=function(){this.b.la(this.a,"seeking"),k(this.b,this.a,"seeking",this.zb.bind(this)),k(this.b,this.a,"playing",this.yb.bind(this))},Zr.zb=function(){var t=this.a.currentTime,e=qi(this,t);.001this.oa.indexOf(t.id)}.bind(this))},Un.prototype.getTracks=Un.prototype.getTracks,Un.prototype.Mc=function(t,e){if(this.b){var i=hi($i(this.b),t);if(i){var n=i.stream;n.allowedByApplication&&n.allowedByKeySystem&&(this.B.push({timestamp:Date.now()/1e3,id:n.id,type:t.type,fromAdaptation:!1}),i={},i[t.type]=n,"text"!=t.type&&(n=Yi(this.b).text,this.configure({abr:{enabled:!1}}),n&&(i.text=n)),Gn(this,i,e))}}},Un.prototype.selectTrack=Un.prototype.Mc,Un.prototype.gc=function(){return"showing"==this.m.mode},Un.prototype.isTextTrackVisible=Un.prototype.gc,Un.prototype.Oc=function(t){this.m.mode=t?"showing":"hidden",Xn(this)},Un.prototype.setTextTrackVisibility=Un.prototype.Oc,Un.prototype.getStats=function(){zn(this);var t={},e={},i=this.f&&this.f.getVideoPlaybackQuality?this.f.getVideoPlaybackQuality():{};return this.b&&(e=Yi(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.ra,bufferingTime:this.K,switchHistory:this.B.slice(0)}},Un.prototype.getStats=Un.prototype.getStats,Un.prototype.addTextTrack=function(t,e,i,n,r){if(!this.b)return Promise.reject();for(var s,a=$i(this.b),o=0;oe&&(e+=Math.pow(2,32)),e=e.toString(16)),this.ia(new y(3,3016,t,e))}}},Zr.Sc=function(t){var e=["output-restricted","internal-error"],i=$i(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)})}),Yn(this,i),n&&Jn(this)},e("shaka.offline.Storage",Qn),Qn.support=Zn,Qn.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},Qn.prototype.destroy=Qn.prototype.o,Qn.prototype.configure=function(t){jn(this.j,t,er(this),{},"")},Qn.prototype.configure=Qn.prototype.configure,Qn.prototype.ad=function(t,e,i){ +function n(t){s=t}if(this.v)return Promise.reject(new y(9,9006));this.v=!0;var r,s=null;return ir(this).then(function(){return ar(this),tr(this,t,n,i)}.bind(this)).then(function(i){if(ar(this),this.b=i.manifest,this.g=i.Wb,this.b.presentationTimeline.S()||this.b.presentationTimeline.fa())throw new y(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.A.bind(this));var n=this.g.b,s=De(this.g);if(n){if(!s.length)throw new y(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},Nn(this.h,r)}.bind(this)).then(function(){if(ar(this),s)throw s;return Tn(this.a,"manifest",r)}.bind(this)).then(function(){return nr(this)}.bind(this)).then(function(){return _n(r)}.bind(this))["catch"](function(t){return nr(this)["catch"](j).then(function(){throw t})}.bind(this))},Qn.prototype.store=Qn.prototype.ad,Qn.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 y(9,9004,i));var r,s,a=null,o=Number(n[1]);return ir(this).then(function(){return ar(this),this.a.get("manifest",o)}.bind(this)).then(function(t){if(ar(this),!t)throw new y(9,9003,i);return r=t,t=Mn(r),s=new Ne(this.c.h,e,function(){}),s.configure(this.c.getConfiguration().drm),s.init(t,!0)}.bind(this)).then(function(){return Ce(s,r.sessionIds)}.bind(this)).then(function(){return s.o()}.bind(this)).then(function(){if(ar(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 t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.uri),Number(t[1])});return t.initSegmentUri&&(t=/^offline:[0-9]+\/[0-9]+\/([0-9]+)$/.exec(t.initSegmentUri),e.push(Number(t[1]))),e}).reduce(L,[])}).reduce(L,[]),i=0,n=e.length,s=this.j.progressCallback;return Sn(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 ar(this),this.j.progressCallback(t,1),this.a.remove("manifest",o)}.bind(this))},Qn.prototype.remove=Qn.prototype.remove,Qn.prototype.list=function(){var t=[];return ir(this).then(function(){return ar(this),this.a.forEach("manifest",function(e){t.push(_n(e))})}.bind(this)).then(function(){return t})},Qn.prototype.list=Qn.prototype.list,Qn.prototype.B=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=Ae(this.c.getConfiguration().preferredAudioLanguage),i=[0,Ps,As],r=t.filter(function(t){return"audio"==t.type}),i=i.map(function(t){return r.filter(function(e){return e=Ae(e.language),Pe(t,n,e)})}),s=r,a=0;ae.indexOf("Apple")||(0<=i.indexOf("Version/8")?t.MediaSource=null:0<=i.indexOf("Version/9")?Lr():0<=i.indexOf("Version/10")&&(Lr(),jr()))}});var Ds=0;Fr.prototype.then=function(t,e){var i=new Fr;switch(this.ka){case 1:Gr(this,i,t);break;case 2:Gr(this,i,e);break;case Ds:this.c.push({J:i,Ea:t}),this.b.push({J:i,Ea:e})}return i},Fr.prototype["catch"]=function(t){return this.then(void 0,t)},Fr.prototype.X=function(t){if(this.ka==Ds){for(this.Pa=t,this.ka=1,t=0;t