text: function X2JS(e,t,n){function r(e){var t=e.localName;return null==t&&(t=e.baseName),(null==t||""==t)&&(t=e.nodeName),t}function i(e){return e.prefix}function o(e){return"string"==typeof e?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\//g,"&#x2F;"):e}function a(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'").replace(/&#x2F;/g,"/")}function s(o){if(o.nodeType==b.DOCUMENT_NODE){var u,l,d,c=o.firstChild;for(l=0,d=o.childNodes.length;d>l;l+=1)if(o.childNodes[l].nodeType!==b.COMMENT_NODE){c=o.childNodes[l];break}if(n)u=s(c);else{u={};var f=r(c);u[f]=s(c)}return u}if(o.nodeType==b.ELEMENT_NODE){var u=new Object;u.__cnt=0;for(var g=o.childNodes,h=0;h<g.length;h++){var c=g.item(h),f=r(c);if(u.__cnt++,null==u[f])u[f]=s(c),u[f+"_asArray"]=new Array(1),u[f+"_asArray"][0]=u[f];else{if(null!=u[f]&&!(u[f]instanceof Array)){var p=u[f];u[f]=new Array,u[f][0]=p,u[f+"_asArray"]=u[f]}for(var m=0;null!=u[f][m];)m++;u[f][m]=s(c)}}for(var y=0;y<o.attributes.length;y++){var v=o.attributes.item(y);u.__cnt++;for(var E=v.value,S=0,w=e.length;w>S;S++){var P=e[S];P.test.call(this,v.value)&&(E=P.converter.call(this,v.value))}u[t+v.name]=E}var T=i(o);return null!=T&&""!=T&&(u.__cnt++,u.__prefix=T),1==u.__cnt&&null!=u["#text"]&&(u=u["#text"]),null!=u["#text"]&&(u.__text=u["#text"],M&&(u.__text=a(u.__text)),delete u["#text"],delete u["#text_asArray"]),null!=u["#cdata-section"]&&(u.__cdata=u["#cdata-section"],delete u["#cdata-section"],delete u["#cdata-section_asArray"]),(null!=u.__text||null!=u.__cdata)&&(u.toString=function(){return(null!=this.__text?this.__text:"")+(null!=this.__cdata?this.__cdata:"")}),u}return o.nodeType==b.TEXT_NODE||o.nodeType==b.CDATA_SECTION_NODE?o.nodeValue:o.nodeType==b.COMMENT_NODE?null:void 0}function u(e,t,n,r){var i="<"+(null!=e&&null!=e.__prefix?e.__prefix+":":"")+t;if(null!=n)for(var o=0;o<n.length;o++){var a=n[o],s=e[a];i+=" "+a.substr(1)+"='"+s+"'"}return i+=r?"/>":">"}function l(e,t){return"</"+(null!=e.__prefix?e.__prefix+":":"")+t+">"}function d(e,t){return-1!==e.indexOf(t,e.length-t.length)}function c(e,t){return d(t.toString(),"_asArray")||0==t.toString().indexOf("_")||e[t]instanceof Function?!0:!1}function f(e){var t=0;if(e instanceof Object)for(var n in e)c(e,n)||t++;return t}function g(e){var t=[];if(e instanceof Object)for(var n in e)-1==n.toString().indexOf("__")&&0==n.toString().indexOf("_")&&t.push(n);return t}function h(e){var t="";return null!=e.__cdata&&(t+="<![CDATA["+e.__cdata+"]]>"),null!=e.__text&&(t+=M?o(e.__text):e.__text),t}function p(e){var t="";return e instanceof Object?t+=h(e):null!=e&&(t+=M?o(e):e),t}function m(e,t,n){var r="";if(0==e.length)r+=u(e,t,n,!0);else for(var i=0;i<e.length;i++)r+=u(e[i],t,g(e[i]),!1),r+=y(e[i]),r+=l(e[i],t);return r}function y(e){var t="",n=f(e);if(n>0)for(var r in e)if(!c(e,r)){var i=e[r],o=g(i);if(null==i||void 0==i)t+=u(i,r,o,!0);else if(i instanceof Object)if(i instanceof Array)t+=m(i,r,o);else{var a=f(i);a>0||null!=i.__text||null!=i.__cdata?(t+=u(i,r,o,!1),t+=y(i),t+=l(i,r)):t+=u(i,r,o,!0)}else t+=u(i,r,o,!1),t+=p(i),t+=l(i,r)}return t+=p(e)}(null===t||void 0===t)&&(t="_"),(null===n||void 0===n)&&(n=!1);var v="1.0.11",M=!1,b={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};this.parseXmlString=function(e){var t;if(window.DOMParser){var n=new window.DOMParser;t=n.parseFromString(e,"text/xml")}else 0==e.indexOf("<?")&&(e=e.substr(e.indexOf("?>")+2)),t=new ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e);return t},this.xml2json=function(e){return s(e)},this.xml_str2json=function(e){var t=this.parseXmlString(e);return this.xml2json(t)},this.json2xml_str=function(e){return y(e)},this.json2xml=function(e){var t=this.json2xml_str(e);return this.parseXmlString(t)},this.getVersion=function(){return v},this.escapeMode=function(e){M=e}}function ObjectIron(e){var t;for(t=[],i=0,len=e.length;len>i;i+=1)e[i].isRoot?t.push("root"):t.push(e[i].name);var n=function(e,t){var n;if(null!==e&&null!==t)for(n in e)e.hasOwnProperty(n)&&(t.hasOwnProperty(n)||(t[n]=e[n]))},r=function(e,t,r){var i,o,a,s,u;if(null!==e&&0!==e.length)for(i=0,o=e.length;o>i;i+=1)a=e[i],t.hasOwnProperty(a.name)&&(r.hasOwnProperty(a.name)?a.merge&&(s=t[a.name],u=r[a.name],"object"==typeof s&&"object"==typeof u?n(s,u):r[a.name]=null!=a.mergeFunction?a.mergeFunction(s,u):s+u):r[a.name]=t[a.name])},o=function(e,t){var n,i,a,s,u,l,d,c=e;if(null!==c.children&&0!==c.children.length)for(n=0,i=c.children.length;i>n;n+=1)if(l=c.children[n],t.hasOwnProperty(l.name))if(l.isArray)for(u=t[l.name+"_asArray"],a=0,s=u.length;s>a;a+=1)d=u[a],r(c.properties,t,d),o(l,d);else d=t[l.name],r(c.properties,t,d),o(l,d)},a=function(n){var r,i,s,u,l,d,c;if(null===n)return n;if("object"!=typeof n)return n;for(r=0,i=t.length;i>r;r+=1)"root"===t[r]&&(l=e[r],d=n,o(l,d));for(u in n)if(n.hasOwnProperty(u)){if(s=t.indexOf(u),-1!==s)if(l=e[s],l.isArray)for(c=n[u+"_asArray"],r=0,i=c.length;i>r;r+=1)d=c[r],o(l,d);else d=n[u],o(l,d);a(n[u])}return n};return{run:a}}if(function(e){e(void 0,Q={})}(function(e,t){function n(e,t){t.stack&&"object"==typeof e&&null!==e&&e.stack&&-1===e.stack.indexOf(F)&&(e.stack=r(e.stack)+"\n"+F+"\n"+r(t.stack))}function r(e){for(var e=e.split("\n"),t=[],n=0;n<e.length;++n){var r,i=e[n];if(r=/at .+ \((.*):(\d+):\d+\)/.exec(i)){var o=r[2];r=r[1]===S&&o>=w&&K>=o}else r=!1;!r&&!(-1!==i.indexOf("(module.js:")||-1!==i.indexOf("(node.js:"))&&t.push(i)}return t.join("\n")}function i(){if(Error.captureStackTrace){var e,t,n=Error.prepareStackTrace;return Error.prepareStackTrace=function(n,r){e=r[1].getFileName(),t=r[1].getLineNumber()},Error().stack,Error.prepareStackTrace=n,S=e,t}}function o(e,t,n){return function(){return"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t+" is deprecated, use "+n+" instead.",Error("").stack),e.apply(e,arguments)}}function a(){function e(e){n&&(t=g(e),A(n,function(e,n){R(function(){t.promiseDispatch.apply(t,n)})},void 0),r=n=void 0)}var t,n=[],r=[],i=I(a.prototype),o=I(s.prototype);return o.promiseDispatch=function(e,i,o){var a=C(arguments);n?(n.push(a),"when"===i&&o[1]&&r.push(o[1])):R(function(){t.promiseDispatch.apply(t,a)})},o.valueOf=function(){return n?o:t.valueOf()},Error.captureStackTrace&&(Error.captureStackTrace(o,a),o.stack=o.stack.substring(o.stack.indexOf("\n")+1)),T(o),i.promise=o,i.resolve=e,i.reject=function(t){e(f(t))},i.notify=function(e){n&&A(r,function(t,n){R(function(){n(e)})},void 0)},i}function s(e,t,n,r){void 0===t&&(t=function(e){return f(Error("Promise does not support operation: "+e))});var i=I(s.prototype);return i.promiseDispatch=function(n,r,o){var a;try{a=e[r]?e[r].apply(i,o):t.call(i,r,o)}catch(s){a=f(s)}n&&n(a)},n&&(i.valueOf=n),r&&(i.exception=r),T(i),i}function u(e){return l(e)?e.valueOf():e}function l(e){return e&&"function"==typeof e.promiseDispatch}function d(e){return!l(u(e))}function c(e){return e=u(e),l(e)&&"exception"in e}function f(e){var e=e||Error(),t=s({when:function(t){if(t){var n=N(Q,this);-1!==n&&(j.splice(n,1),Q.splice(n,1))}return t?t(e):f(e)}},function(){return f(e)},function(){return this},e);return!U&&"undefined"!=typeof window&&!window.Touch&&window.console&&console.log("Should be empty:",j),U=!0,Q.push(t),j.push(e),t}function g(e){if(l(e))return e;if((e=u(e))&&"function"==typeof e.then){var t=a();return e.then(t.resolve,t.reject,t.notify),t.promise}return s({when:function(){return e},get:function(t){return e[t]},put:function(t,n){return e[t]=n,e},del:function(t){return delete e[t],e},post:function(t,n){return e[t].apply(e,n)},apply:function(t){return e.apply(void 0,t)},keys:function(){return q(e)}},void 0,function(){return e})}function h(e,t,r,i){function o(e){try{return t?t(e):e}catch(n){return f(n)}}function s(e){if(r){n(e,d);try{return r(e)}catch(t){return f(t)}}return f(e)}var u=a(),l=!1,d=g(e);return R(function(){d.promiseDispatch(function(e){l||(l=!0,u.resolve(o(e)))},"when",[function(e){l||(l=!0,u.resolve(s(e)))}])}),d.promiseDispatch(void 0,"when",[void 0,function(e){u.notify(i?i(e):e)}]),u.promise}function p(e,t,n){return h(e,function(e){return M(e).then(function(e){return t.apply(void 0,e)},n)},n)}function m(e,t,n){var r=a();return R(function(){g(e).promiseDispatch(r.resolve,t,n)}),r.promise}function y(e){return function(t){var n=C(arguments,1);return m(t,e,n)}}function v(e){var t=C(arguments,1);return V(e,t)}function M(e){return h(e,function(e){var t=e.length;if(0===t)return g(e);var n=a();return A(e,function(r,i,o){d(i)?(e[o]=u(i),0===--t&&n.resolve(e)):h(i,function(r){e[o]=r,0===--t&&n.resolve(e)}).fail(n.reject)},void 0),n.promise})}function b(e,t){return h(e,void 0,t)}function E(e,t){var n=C(arguments,2),r=a();return n.push(r.makeNodeResolver()),H(e,t,n).fail(r.reject),r.promise}var S,w=i(),P=function(){},T=Object.freeze||P;"undefined"!=typeof cajaVM&&(T=cajaVM.def);var R;if("undefined"!=typeof process)R=process.nextTick;else if("function"==typeof setImmediate)R=setImmediate;else if("undefined"!=typeof MessageChannel){var _=new MessageChannel,L={},x=L;_.port1.onmessage=function(){L=L.next;var e=L.task;delete L.task,e()},R=function(e){x=x.next={task:e},_.port2.postMessage(0)}}else R=function(e){setTimeout(e,0)};var O;Function.prototype.bind?(O=Function.prototype.bind,O=O.bind(O.call)):O=function(e){return function(){return e.call.apply(e,arguments)}};var D,C=O(Array.prototype.slice),A=O(Array.prototype.reduce||function(e,t){var n=0,r=this.length;if(1===arguments.length)for(;;){if(n in this){t=this[n++];break}if(++n>=r)throw new TypeError}for(;r>n;n++)n in this&&(t=e(t,this[n],n));return t}),N=O(Array.prototype.indexOf||function(e){for(var t=0;t<this.length;t++)if(this[t]===e)return t;return-1}),B=O(Array.prototype.map||function(e,t){var n=this,r=[];return A(n,function(i,o,a){r.push(e.call(t,o,a,n))},void 0),r}),I=Object.create||function(e){function t(){}return t.prototype=e,new t},q=Object.keys||function(e){var t,n=[];for(t in e)n.push(t);return n},k=Object.prototype.toString;D="undefined"!=typeof ReturnValue?ReturnValue:function(e){this.value=e};var F="From previous event:";t.nextTick=R,t.defer=a,a.prototype.makeNodeResolver=function(){var e=this;return function(t,n){t?e.reject(t):arguments.length>2?e.resolve(C(arguments,1)):e.resolve(n)}},t.promise=function(e){var t=a();return v(e,t.resolve,t.reject,t.notify).fail(t.reject),t.promise},t.makePromise=s,s.prototype.then=function(e,t,n){return h(this,e,t,n)},s.prototype.thenResolve=function(e){return h(this,function(){return e})},A("isResolved isFulfilled isRejected dispatch when spread get put del post send invoke keys fapply fcall fbind all allResolved timeout delay catch finally fail fin progress end done nfcall nfapply nfbind ncall napply nbind npost nsend ninvoke nend nodeify".split(" "),function(e,n){s.prototype[n]=function(){return t[n].apply(t,[this].concat(C(arguments)))}},void 0),s.prototype.toSource=function(){return this.toString()},s.prototype.toString=function(){return"[object Promise]"},T(s.prototype),t.nearer=u,t.isPromise=l,t.isResolved=function(e){return d(e)||c(e)},t.isFulfilled=d,t.isRejected=c;var U,Q=[],j=[];t.reject=f,t.resolve=g,t.master=function(e){return s({isDef:function(){}},function(t,n){return m(e,t,n)},function(){return u(e)})},t.when=h,t.spread=p,t.async=function(e){return function(){function t(e,t){var o;try{o=n[e](t)}catch(a){return"[object StopIteration]"===k(a)||a instanceof D?a.value:f(a)}return h(o,r,i)}var n=e.apply(this,arguments),r=t.bind(t,"send"),i=t.bind(t,"throw");return r()}},t["return"]=function(e){throw new D(e)},t.promised=function(e){return function(){return p([this,M(arguments)],function(t,n){return e.apply(t,n)})}},t.dispatch=m,t.dispatcher=y,t.get=y("get"),t.put=y("put"),t["delete"]=t.del=y("del");var H=t.post=y("post");t.send=function(e,t){var n=C(arguments,2);return H(e,t,n)},t.invoke=o(t.send,"invoke","send");var V=t.fapply=y("apply");t["try"]=v,t.fcall=v,t.fbind=function(e){var t=C(arguments,1);return function(){var n=t.concat(C(arguments));return V(e,n)}},t.keys=y("keys"),t.all=M,t.allResolved=function(e){return h(e,function(e){return h(M(B(e,function(e){return h(e,P,P)})),function(){return B(e,g)})})},t["catch"]=t.fail=b,t.progress=function(e,t){return h(e,void 0,void 0,t)},t["finally"]=t.fin=function(e,t){return h(e,function(e){return h(t(),function(){return e})},function(e){return h(t(),function(){return f(e)})})},t.done=function(e,r,i,o){r=r||i||o?h(e,r,i,o):e,b(r,function(r){R(function(){if(n(r,e),!t.onerror)throw r;t.onerror(r)})})},t.timeout=function(e,t){var n=a(),r=setTimeout(function(){n.reject(Error("Timed out after "+t+" ms"))},t);return h(e,function(e){clearTimeout(r),n.resolve(e)},function(e){clearTimeout(r),n.reject(e)}),n.promise},t.delay=function(e,t){void 0===t&&(t=e,e=void 0);var n=a();return setTimeout(function(){n.resolve(e)},t),n.promise},t.nfapply=function(e,t){var n=C(t),r=a();return n.push(r.makeNodeResolver()),V(e,n).fail(r.reject),r.promise},t.nfcall=function(e){var t=C(arguments,1),n=a();return t.push(n.makeNodeResolver()),V(e,t).fail(n.reject),n.promise},t.nfbind=function(e){var t=C(arguments,1);return function(){var n=t.concat(C(arguments)),r=a();return n.push(r.makeNodeResolver()),V(e,n).fail(r.reject),r.promise}},t.npost=function(e,t,n){var n=C(n),r=a();return n.push(r.makeNodeResolver()),H(e,t,n).fail(r.reject),r.promise},t.nsend=E,t.ninvoke=o(E,"ninvoke","nsend"),t.nodeify=function(e,t){return t?void e.then(function(e){R(function(){t(null,e)})},function(e){R(function(){t(e)})}):e};var K=i()}),function(e){"use strict";var t={VERSION:"0.5.3"};t.System=function(){this._mappings={},this._outlets={},this._handlers={},this.strictInjections=!0,this.autoMapOutlets=!1,this.postInjectionHook="setup"},t.System.prototype={_createAndSetupInstance:function(e,t){var n=new t;return this.injectInto(n,e),n},_retrieveFromCacheOrCreate:function(e,t){"undefined"==typeof t&&(t=!1);var n;if(!this._mappings.hasOwnProperty(e))throw new Error(1e3);var r=this._mappings[e];return!t&&r.isSingleton?(null==r.object&&(r.object=this._createAndSetupInstance(e,r.clazz)),n=r.object):n=r.clazz?this._createAndSetupInstance(e,r.clazz):r.object,n},mapOutlet:function(e,t,n){if("undefined"==typeof e)throw new Error(1010);return t=t||"global",n=n||e,this._outlets.hasOwnProperty(t)||(this._outlets[t]={}),this._outlets[t][n]=e,this},getObject:function(e){if("undefined"==typeof e)throw new Error(1020);return this._retrieveFromCacheOrCreate(e)},mapValue:function(e,t){if("undefined"==typeof e)throw new Error(1030);return this._mappings[e]={clazz:null,object:t,isSingleton:!0},this.autoMapOutlets&&this.mapOutlet(e),this.hasMapping(e)&&this.injectInto(t,e),this},hasMapping:function(e){if("undefined"==typeof e)throw new Error(1040);return this._mappings.hasOwnProperty(e)},mapClass:function(e,t){if("undefined"==typeof e)throw new Error(1050);if("undefined"==typeof t)throw new Error(1051);return this._mappings[e]={clazz:t,object:null,isSingleton:!1},this.autoMapOutlets&&this.mapOutlet(e),this},mapSingleton:function(e,t){if("undefined"==typeof e)throw new Error(1060);if("undefined"==typeof t)throw new Error(1061);return this._mappings[e]={clazz:t,object:null,isSingleton:!0},this.autoMapOutlets&&this.mapOutlet(e),this},instantiate:function(e){if("undefined"==typeof e)throw new Error(1070);return this._retrieveFromCacheOrCreate(e,!0)},injectInto:function(e,t){if("undefined"==typeof e)throw new Error(1080);if("object"==typeof e){var n=[];this._outlets.hasOwnProperty("global")&&n.push(this._outlets.global),"undefined"!=typeof t&&this._outlets.hasOwnProperty(t)&&n.push(this._outlets[t]);for(var r in n){var i=n[r];for(var o in i){var a=i[o];(!this.strictInjections||o in e)&&(e[o]=this.getObject(a))}}"setup"in e&&e.setup.call(e)}return this},unmap:function(e){if("undefined"==typeof e)throw new Error(1090);return delete this._mappings[e],this},unmapOutlet:function(e,t){if("undefined"==typeof e)throw new Error(1100);if("undefined"==typeof t)throw new Error(1101);return delete this._outlets[e][t],this},mapHandler:function(e,t,n,r,i){if("undefined"==typeof e)throw new Error(1110);return t=t||"global",n=n||e,"undefined"==typeof r&&(r=!1),"undefined"==typeof i&&(i=!1),this._handlers.hasOwnProperty(e)||(this._handlers[e]={}),this._handlers[e].hasOwnProperty(t)||(this._handlers[e][t]=[]),this._handlers[e][t].push({handler:n,oneShot:r,passEvent:i}),this},unmapHandler:function(e,t,n){if("undefined"==typeof e)throw new Error(1120);if(t=t||"global",n=n||e,this._handlers.hasOwnProperty(e)&&this._handlers[e].hasOwnProperty(t)){var r=this._handlers[e][t];for(var i in r){var o=r[i];if(o.handler===n){r.splice(i,1);break}}}return this},notify:function(e){if("undefined"==typeof e)throw new Error(1130);var t=Array.prototype.slice.call(arguments),n=t.slice(1);if(this._handlers.hasOwnProperty(e)){var r=this._handlers[e];for(var i in r){var o,a=r[i];"global"!==i&&(o=this.getObject(i));var s,u,l=[];for(s=0,u=a.length;u>s;s++){var d,c=a[s];d=o&&"string"==typeof c.handler?o[c.handler]:c.handler,c.oneShot&&l.unshift(s),c.passEvent?d.apply(o,t):d.apply(o,n)}for(s=0,u=l.length;u>s;s++)a.splice(l[s],1)}}return this}},e.dijon=t}(this),"undefined"==typeof utils)var utils={};"undefined"==typeof utils.Math&&(utils.Math={}),utils.Math.to64BitNumber=function(e,t){var n,r,i;return n=new goog.math.Long(0,t),r=new goog.math.Long(e,0),i=n.add(r),i.toNumber()},goog={},goog.math={},goog.math.Long=function(e,t){this.low_=0|e,this.high_=0|t},goog.math.Long.IntCache_={},goog.math.Long.fromInt=function(e){if(e>=-128&&128>e){var t=goog.math.Long.IntCache_[e];if(t)return t}var n=new goog.math.Long(0|e,0>e?-1:0);return e>=-128&&128>e&&(goog.math.Long.IntCache_[e]=n),n},goog.math.Long.fromNumber=function(e){return isNaN(e)||!isFinite(e)?goog.math.Long.ZERO:e<=-goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MIN_VALUE:e+1>=goog.math.Long.TWO_PWR_63_DBL_?goog.math.Long.MAX_VALUE:0>e?goog.math.Long.fromNumber(-e).negate():new goog.math.Long(0|e%goog.math.Long.TWO_PWR_32_DBL_,0|e/goog.math.Long.TWO_PWR_32_DBL_)},goog.math.Long.fromBits=function(e,t){return new goog.math.Long(e,t)},goog.math.Long.fromString=function(e,t){if(0==e.length)throw Error("number format error: empty string");var n=t||10;if(2>n||n>36)throw Error("radix out of range: "+n);if("-"==e.charAt(0))return goog.math.Long.fromString(e.substring(1),n).negate();if(e.indexOf("-")>=0)throw Error('number format error: interior "-" character: '+e);for(var r=goog.math.Long.fromNumber(Math.pow(n,8)),i=goog.math.Long.ZERO,o=0;o<e.length;o+=8){var a=Math.min(8,e.length-o),s=parseInt(e.substring(o,o+a),n);if(8>a){var u=goog.math.Long.fromNumber(Math.pow(n,a));i=i.multiply(u).add(goog.math.Long.fromNumber(s))}else i=i.multiply(r),i=i.add(goog.math.Long.fromNumber(s))}return i},goog.math.Long.TWO_PWR_16_DBL_=65536,goog.math.Long.TWO_PWR_24_DBL_=1<<24,goog.math.Long.TWO_PWR_32_DBL_=goog.math.Long.TWO_PWR_16_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_31_DBL_=goog.math.Long.TWO_PWR_32_DBL_/2,goog.math.Long.TWO_PWR_48_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_16_DBL_,goog.math.Long.TWO_PWR_64_DBL_=goog.math.Long.TWO_PWR_32_DBL_*goog.math.Long.TWO_PWR_32_DBL_,goog.math.Long.TWO_PWR_63_DBL_=goog.math.Long.TWO_PWR_64_DBL_/2,goog.math.Long.ZERO=goog.math.Long.fromInt(0),goog.math.Long.ONE=goog.math.Long.fromInt(1),goog.math.Long.NEG_ONE=goog.math.Long.fromInt(-1),goog.math.Long.MAX_VALUE=goog.math.Long.fromBits(-1,2147483647),goog.math.Long.MIN_VALUE=goog.math.Long.fromBits(0,-2147483648),goog.math.Long.TWO_PWR_24_=goog.math.Long.fromInt(1<<24),goog.math.Long.prototype.toInt=function(){return this.low_},goog.math.Long.prototype.toNumber=function(){return this.high_*goog.math.Long.TWO_PWR_32_DBL_+this.getLowBitsUnsigned()},goog.math.Long.prototype.toString=function(e){var t=e||10;if(2>t||t>36)throw Error("radix out of range: "+t);if(this.isZero())return"0";if(this.isNegative()){if(this.equals(goog.math.Long.MIN_VALUE)){var n=goog.math.Long.fromNumber(t),r=this.div(n),i=r.multiply(n).subtract(this);return r.toString(t)+i.toInt().toString(t)}return"-"+this.negate().toString(t)}for(var o=goog.math.Long.fromNumber(Math.pow(t,6)),i=this,a="";;){var s=i.div(o),u=i.subtract(s.multiply(o)).toInt(),l=u.toString(t);if(i=s,i.isZero())return l+a;for(;l.length<6;)l="0"+l;a=""+l+a}},goog.math.Long.prototype.getHighBits=function(){return this.high_},goog.math.Long.prototype.getLowBits=function(){return this.low_},goog.math.Long.prototype.getLowBitsUnsigned=function(){return this.low_>=0?this.low_:goog.math.Long.TWO_PWR_32_DBL_+this.low_},goog.math.Long.prototype.getNumBitsAbs=function(){if(this.isNegative())return this.equals(goog.math.Long.MIN_VALUE)?64:this.negate().getNumBitsAbs();for(var e=0!=this.high_?this.high_:this.low_,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high_?t+33:t+1},goog.math.Long.prototype.isZero=function(){return 0==this.high_&&0==this.low_},goog.math.Long.prototype.isNegative=function(){return this.high_<0},goog.math.Long.prototype.isOdd=function(){return 1==(1&this.low_)},goog.math.Long.prototype.equals=function(e){return this.high_==e.high_&&this.low_==e.low_},goog.math.Long.prototype.notEquals=function(e){return this.high_!=e.high_||this.low_!=e.low_},goog.math.Long.prototype.lessThan=function(e){return this.compare(e)<0},goog.math.Long.prototype.lessThanOrEqual=function(e){return this.compare(e)<=0},goog.math.Long.prototype.greaterThan=function(e){return this.compare(e)>0},goog.math.Long.prototype.greaterThanOrEqual=function(e){return this.compare(e)>=0},goog.math.Long.prototype.compare=function(e){if(this.equals(e))return 0;var t=this.isNegative(),n=e.isNegative();return t&&!n?-1:!t&&n?1:this.subtract(e).isNegative()?-1:1},goog.math.Long.prototype.negate=function(){return this.equals(goog.math.Long.MIN_VALUE)?goog.math.Long.MIN_VALUE:this.not().add(goog.math.Long.ONE)},goog.math.Long.prototype.add=function(e){var t=this.high_>>>16,n=65535&this.high_,r=this.low_>>>16,i=65535&this.low_,o=e.high_>>>16,a=65535&e.high_,s=e.low_>>>16,u=65535&e.low_,l=0,d=0,c=0,f=0;return f+=i+u,c+=f>>>16,f&=65535,c+=r+s,d+=c>>>16,c&=65535,d+=n+a,l+=d>>>16,d&=65535,l+=t+o,l&=65535,goog.math.Long.fromBits(c<<16|f,l<<16|d)},goog.math.Long.prototype.subtract=function(e){return this.add(e.negate())},goog.math.Long.prototype.multiply=function(e){if(this.isZero())return goog.math.Long.ZERO;if(e.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE))return e.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(e.equals(goog.math.Long.MIN_VALUE))return this.isOdd()?goog.math.Long.MIN_VALUE:goog.math.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().multiply(e.negate()):this.negate().multiply(e).negate();if(e.isNegative())return this.multiply(e.negate()).negate();if(this.lessThan(goog.math.Long.TWO_PWR_24_)&&e.lessThan(goog.math.Long.TWO_PWR_24_))return goog.math.Long.fromNumber(this.toNumber()*e.toNumber());var t=this.high_>>>16,n=65535&this.high_,r=this.low_>>>16,i=65535&this.low_,o=e.high_>>>16,a=65535&e.high_,s=e.low_>>>16,u=65535&e.low_,l=0,d=0,c=0,f=0;return f+=i*u,c+=f>>>16,f&=65535,c+=r*u,d+=c>>>16,c&=65535,c+=i*s,d+=c>>>16,c&=65535,d+=n*u,l+=d>>>16,d&=65535,d+=r*s,l+=d>>>16,d&=65535,d+=i*a,l+=d>>>16,d&=65535,l+=t*u+n*s+r*a+i*o,l&=65535,goog.math.Long.fromBits(c<<16|f,l<<16|d)},goog.math.Long.prototype.div=function(e){if(e.isZero())throw Error("division by zero");if(this.isZero())return goog.math.Long.ZERO;if(this.equals(goog.math.Long.MIN_VALUE)){if(e.equals(goog.math.Long.ONE)||e.equals(goog.math.Long.NEG_ONE))return goog.math.Long.MIN_VALUE;if(e.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ONE;var t=this.shiftRight(1),n=t.div(e).shiftLeft(1);if(n.equals(goog.math.Long.ZERO))return e.isNegative()?goog.math.Long.ONE:goog.math.Long.NEG_ONE;var r=this.subtract(e.multiply(n)),i=n.add(r.div(e));return i}if(e.equals(goog.math.Long.MIN_VALUE))return goog.math.Long.ZERO;if(this.isNegative())return e.isNegative()?this.negate().div(e.negate()):this.negate().div(e).negate();if(e.isNegative())return this.div(e.negate()).negate();for(var o=goog.math.Long.ZERO,r=this;r.greaterThanOrEqual(e);){for(var n=Math.max(1,Math.floor(r.toNumber()/e.toNumber())),a=Math.ceil(Math.log(n)/Math.LN2),s=48>=a?1:Math.pow(2,a-48),u=goog.math.Long.fromNumber(n),l=u.multiply(e);l.isNegative()||l.greaterThan(r);)n-=s,u=goog.math.Long.fromNumber(n),l=u.multiply(e);u.isZero()&&(u=goog.math.Long.ONE),o=o.add(u),r=r.subtract(l)}return o},goog.math.Long.prototype.modulo=function(e){return this.subtract(this.div(e).multiply(e))},goog.math.Long.prototype.not=function(){return goog.math.Long.fromBits(~this.low_,~this.high_)},goog.math.Long.prototype.and=function(e){return goog.math.Long.fromBits(this.low_&e.low_,this.high_&e.high_)},goog.math.Long.prototype.or=function(e){return goog.math.Long.fromBits(this.low_|e.low_,this.high_|e.high_)},goog.math.Long.prototype.xor=function(e){return goog.math.Long.fromBits(this.low_^e.low_,this.high_^e.high_)},goog.math.Long.prototype.shiftLeft=function(e){if(e&=63,0==e)return this;var t=this.low_;if(32>e){var n=this.high_;return goog.math.Long.fromBits(t<<e,n<<e|t>>>32-e)}return goog.math.Long.fromBits(0,t<<e-32)},goog.math.Long.prototype.shiftRight=function(e){if(e&=63,0==e)return this;var t=this.high_;if(32>e){var n=this.low_;return goog.math.Long.fromBits(n>>>e|t<<32-e,t>>e)}return goog.math.Long.fromBits(t>>e-32,t>=0?0:-1)},goog.math.Long.prototype.shiftRightUnsigned=function(e){if(e&=63,0==e)return this;var t=this.high_;if(32>e){var n=this.low_;return goog.math.Long.fromBits(n>>>e|t<<32-e,t>>>e)}return 32==e?goog.math.Long.fromBits(t,0):goog.math.Long.fromBits(t>>>e-32,0)};var UTF8={};UTF8.encode=function(e){for(var t=[],n=0;n<e.length;++n){var r=e.charCodeAt(n);128>r?t.push(r):2048>r?(t.push(192|r>>6),t.push(128|63&r)):65536>r?(t.push(224|r>>12),t.push(128|63&r>>6),t.push(128|63&r)):(t.push(240|r>>18),t.push(128|63&r>>12),t.push(128|63&r>>6),t.push(128|63&r))}return t},UTF8.decode=function(e){for(var t=[],n=0;n<e.length;){var r=e[n++];128>r||(224>r?(r=(31&r)<<6,r|=63&e[n++]):240>r?(r=(15&r)<<12,r|=(63&e[n++])<<6,r|=63&e[n++]):(r=(7&r)<<18,r|=(63&e[n++])<<12,r|=(63&e[n++])<<6,r|=63&e[n++])),t.push(String.fromCharCode(r))}return t.join("")};var BASE64={};if(function(e){var t=function(t){for(var n=0,r=[],i=0|t.length/3;0<i--;){var o=(t[n]<<16)+(t[n+1]<<8)+t[n+2];n+=3,r.push(e.charAt(63&o>>18)),r.push(e.charAt(63&o>>12)),r.push(e.charAt(63&o>>6)),r.push(e.charAt(63&o))}if(2==t.length-n){var o=(t[n]<<16)+(t[n+1]<<8);r.push(e.charAt(63&o>>18)),r.push(e.charAt(63&o>>12)),r.push(e.charAt(63&o>>6)),r.push("=")}else if(1==t.length-n){var o=t[n]<<16;r.push(e.charAt(63&o>>18)),r.push(e.charAt(63&o>>12)),r.push("==")}return r.join("")},n=function(){for(var t=[],n=0;n<e.length;++n)t[e.charCodeAt(n)]=n;return t["=".charCodeAt(0)]=0,t}(),r=function(e){for(var t=0,r=[],i=0|e.length/4;0<i--;){var o=(n[e.charCodeAt(t)]<<18)+(n[e.charCodeAt(t+1)]<<12)+(n[e.charCodeAt(t+2)]<<6)+n[e.charCodeAt(t+3)];r.push(255&o>>16),r.push(255&o>>8),r.push(255&o),t+=4}return r&&("="==e.charAt(t-2)?(r.pop(),r.pop()):"="==e.charAt(t-1)&&r.pop()),r},i={};i.encode=function(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t},i.decode=function(){for(var e=0;e<s.length;++e)a[e]=String.fromCharCode(a[e]);return a.join("")},BASE64.decodeArray=function(e){var t=r(e);return new Uint8Array(t)},BASE64.encodeASCII=function(e){var n=i.encode(e);return t(n)},BASE64.decodeASCII=function(e){var t=r(e);return i.decode(t)},BASE64.encode=function(e){var n=UTF8.encode(e);return t(n)},BASE64.decode=function(e){var t=r(e);return UTF8.decode(t)}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),void 0===btoa)var btoa=BASE64.encode;if(void 0===atob)var atob=BASE64.decode;MediaPlayer=function(e){"use strict";var t,n,r,i,o,a="1.0.0",s=e,u=!1,l=!1,d=!0,c=!1,f=MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_REQUIRED,g=function(){return!!n&&!!r},h=function(){if(!u)throw"MediaPlayer not initialized!";if(!this.capabilities.supportsMediaSource())return void this.errHandler.capabilityError("mediasource");if(!n||!r)throw"Missing view or source.";l=!0,this.debug.log("Playback initiated!"),i=t.getObject("streamController"),i.setVideoModel(o),i.setAutoPlay(d),i.load(r),t.mapValue("scheduleWhilePaused",c),t.mapOutlet("scheduleWhilePaused","stream"),t.mapValue("bufferMax",f),t.injectInto(this.bufferExt,"bufferMax")},p=function(){g()&&h.call(this)};return t=new dijon.System,t.mapValue("system",t),t.mapOutlet("system"),t.injectInto(s),{debug:void 0,eventBus:void 0,capabilities:void 0,abrController:void 0,metricsModel:void 0,metricsExt:void 0,bufferExt:void 0,addEventListener:function(e,t,n){this.eventBus.addEventListener(e,t,n)},removeEventListener:function(e,t,n){this.eventBus.removeEventListener(e,t,n)},getVersion:function(){return a},startup:function(){u||(t.injectInto(this),u=!0)},getDebug:function(){return this.debug},getVideoModel:function(){return o},setAutoPlay:function(e){d=e},getAutoPlay:function(){return d},setScheduleWhilePaused:function(e){c=e},getScheduleWhilePaused:function(){return c},setBufferMax:function(e){f=e},getBufferMax:function(){return f},getMetricsExt:function(){return this.metricsExt},getMetricsFor:function(e){var t=this.metricsModel.getReadOnlyMetricsFor(e);return t},getQualityFor:function(e){return this.abrController.getQualityFor(e)},setQualityFor:function(e,t){this.abrController.setPlaybackQuality(e,t)},getAutoSwitchQuality:function(){return this.abrController.getAutoSwitchBitrate()},setAutoSwitchQuality:function(e){this.abrController.setAutoSwitchBitrate(e)},attachView:function(e){if(!u)throw"MediaPlayer not initialized!";n=e,o=null,n&&(o=t.getObject("videoModel"),o.setElement(n)),l&&i&&(i.reset(),i=null,l=!1),g.call(this)&&p.call(this)},attachSource:function(e){if(!u)throw"MediaPlayer not initialized!";r=e,this.setQualityFor("video",0),this.setQualityFor("audio",0),l&&i&&(i.reset(),i=null,l=!1),g.call(this)&&p.call(this)},reset:function(){this.attachSource(null),this.attachView(null)},play:h,isReady:g}},MediaPlayer.prototype={constructor:MediaPlayer},MediaPlayer.dependencies={},MediaPlayer.utils={},MediaPlayer.models={},MediaPlayer.vo={},MediaPlayer.vo.metrics={},MediaPlayer.rules={},MediaPlayer.di={},MediaPlayer.di.Context=function(){"use strict";return{system:void 0,setup:function(){this.system.autoMapOutlets=!0,this.system.mapSingleton("debug",MediaPlayer.utils.Debug),this.system.mapSingleton("eventBus",MediaPlayer.utils.EventBus),this.system.mapSingleton("capabilities",MediaPlayer.utils.Capabilities),this.system.mapSingleton("textTrackExtensions",MediaPlayer.utils.TextTrackExtensions),this.system.mapSingleton("vttParser",MediaPlayer.utils.VTTParser),this.system.mapClass("videoModel",MediaPlayer.models.VideoModel),this.system.mapSingleton("manifestModel",MediaPlayer.models.ManifestModel),this.system.mapSingleton("metricsModel",MediaPlayer.models.MetricsModel),this.system.mapClass("protectionModel",MediaPlayer.models.ProtectionModel),this.system.mapSingleton("textVTTSourceBuffer",MediaPlayer.dependencies.TextVTTSourceBuffer),this.system.mapSingleton("mediaSourceExt",MediaPlayer.dependencies.MediaSourceExtensions),this.system.mapSingleton("sourceBufferExt",MediaPlayer.dependencies.SourceBufferExtensions),this.system.mapSingleton("bufferExt",MediaPlayer.dependencies.BufferExtensions),this.system.mapSingleton("abrController",MediaPlayer.dependencies.AbrController),this.system.mapSingleton("errHandler",MediaPlayer.dependencies.ErrorHandler),this.system.mapSingleton("protectionExt",MediaPlayer.dependencies.ProtectionExtensions),this.system.mapClass("protectionController",MediaPlayer.dependencies.ProtectionController),this.system.mapClass("metrics",MediaPlayer.models.MetricsList),this.system.mapClass("downloadRatioRule",MediaPlayer.rules.DownloadRatioRule),this.system.mapClass("insufficientBufferRule",MediaPlayer.rules.InsufficientBufferRule),
  this.system.mapClass("limitSwitchesRule",MediaPlayer.rules.LimitSwitchesRule),this.system.mapClass("abrRulesCollection",MediaPlayer.rules.BaseRulesCollection),this.system.mapClass("textController",MediaPlayer.dependencies.TextController),this.system.mapClass("bufferController",MediaPlayer.dependencies.BufferController),this.system.mapClass("manifestLoader",MediaPlayer.dependencies.ManifestLoader),this.system.mapClass("manifestUpdater",MediaPlayer.dependencies.ManifestUpdater),this.system.mapClass("fragmentController",MediaPlayer.dependencies.FragmentController),this.system.mapClass("fragmentLoader",MediaPlayer.dependencies.FragmentLoader),this.system.mapClass("fragmentModel",MediaPlayer.dependencies.FragmentModel),this.system.mapSingleton("streamController",MediaPlayer.dependencies.StreamController),this.system.mapClass("stream",MediaPlayer.dependencies.Stream),this.system.mapClass("requestScheduler",MediaPlayer.dependencies.RequestScheduler),this.system.mapSingleton("schedulerExt",MediaPlayer.dependencies.SchedulerExtensions),this.system.mapClass("schedulerModel",MediaPlayer.dependencies.SchedulerModel)}}},Dash=function(){"use strict";return{modules:{},dependencies:{},vo:{},di:{}}}(),Dash.di.DashContext=function(){"use strict";return{system:void 0,setup:function(){Dash.di.DashContext.prototype.setup.call(this),this.system.mapClass("parser",Dash.dependencies.DashParser),this.system.mapClass("indexHandler",Dash.dependencies.DashHandler),this.system.mapClass("baseURLExt",Dash.dependencies.BaseURLExtensions),this.system.mapClass("fragmentExt",Dash.dependencies.FragmentExtensions),this.system.mapSingleton("manifestExt",Dash.dependencies.DashManifestExtensions),this.system.mapSingleton("metricsExt",Dash.dependencies.DashMetricsExtensions)}}},Dash.di.DashContext.prototype=new MediaPlayer.di.Context,Dash.di.DashContext.prototype.constructor=Dash.di.DashContext,Dash.dependencies.BaseURLExtensions=function(){"use strict";var e=function(e,t){for(var n,r,i,o,a,s,u,l,d,c,f=new DataView(e),g={},h=0;"sidx"!==l&&h<f.byteLength;){for(d=f.getUint32(h),h+=4,l="",o=0;4>o;o+=1)c=f.getInt8(h),l+=String.fromCharCode(c),h+=1;"moof"!==l&&"traf"!==l&&"sidx"!==l?h+=d-8:"sidx"===l&&(h-=8)}if(i=f.getUint32(h,!1)+h,i>e.byteLength)throw"sidx terminates after array buffer";for(g.version=f.getUint8(h+8),h+=12,g.timescale=f.getUint32(h+4,!1),h+=8,0===g.version?(g.earliest_presentation_time=f.getUint32(h,!1),g.first_offset=f.getUint32(h+4,!1),h+=8):(g.earliest_presentation_time=utils.Math.to64BitNumber(f.getUint32(h+4,!1),f.getUint32(h,!1)),g.first_offset=(f.getUint32(h+8,!1)<<32)+f.getUint32(h+12,!1),h+=16),g.first_offset+=i+(t||0),g.reference_count=f.getUint16(h+2,!1),h+=4,g.references=[],n=g.first_offset,r=g.earliest_presentation_time,o=0;o<g.reference_count;o+=1)s=f.getUint32(h,!1),a=s>>>31,s=2147483647&s,u=f.getUint32(h+4,!1),h+=12,g.references.push({size:s,type:a,offset:n,duration:u,time:r,timescale:g.timescale}),n+=s,r+=u;if(h!==i)throw"Error: final pos "+h+" differs from SIDX end "+i;return g},t=function(t,n,r){var i,o,a,s,u,l,d,c;for(i=e.call(this,t,r),o=i.references,a=[],u=0,l=o.length;l>u;u+=1)s=new Dash.vo.Segment,s.duration=o[u].duration,s.media=n,s.startTime=o[u].time,s.timescale=o[u].timescale,d=o[u].offset,c=o[u].offset+o[u].size-1,s.mediaRange=d+"-"+c,a.push(s);return this.debug.log("Parsed SIDX box: "+a.length+" segments."),Q.when(a)},n=function(e,t){var r,i,o,a,s,u,l,d=Q.defer(),c=new DataView(e),f=0,g="",h=0,p=!1,m=this;for(m.debug.log("Searching for initialization.");"moov"!==g&&f<c.byteLength;){for(h=c.getUint32(f),f+=4,g="",a=0;4>a;a+=1)s=c.getInt8(f),g+=String.fromCharCode(s),f+=1;"moov"!==g&&(f+=h-8)}return o=c.byteLength-f,"moov"!==g?(m.debug.log("Loading more bytes to find initialization."),t.range.start=0,t.range.end=t.bytesLoaded+t.bytesToLoad,u=new XMLHttpRequest,u.onloadend=function(){p||d.reject("Error loading initialization.")},u.onload=function(){p=!0,t.bytesLoaded=t.range.end,n.call(m,u.response).then(function(e){d.resolve(e)})},u.onerror=function(){d.reject("Error loading initialization.")},u.open("GET",t.url),u.responseType="arraybuffer",u.setRequestHeader("Range","bytes="+t.range.start+"-"+t.range.end),u.send(null)):(r=f-8,i=r+h-1,l=r+"-"+i,m.debug.log("Found the initialization.  Range: "+l),d.resolve(l)),d.promise},r=function(e){var t=Q.defer(),r=new XMLHttpRequest,i=!0,o=this,a={url:e,range:{},searching:!1,bytesLoaded:0,bytesToLoad:1500,request:r};return o.debug.log("Start searching for initialization."),a.range.start=0,a.range.end=a.bytesToLoad,r.onload=function(){r.status<200||r.status>299||(i=!1,a.bytesLoaded=a.range.end,n.call(o,r.response,a).then(function(e){t.resolve(e)}))},r.onloadend=r.onerror=function(){i&&(i=!1,o.errHandler.downloadError("initialization",a.url,r),t.reject(r))},r.open("GET",a.url),r.responseType="arraybuffer",r.setRequestHeader("Range","bytes="+a.range.start+"-"+a.range.end),r.send(null),o.debug.log("Perform init search: "+a.url),t.promise},i=function(e,n){var r,o,a,s,u,l,d,c,f=Q.defer(),g=new DataView(e),h=new XMLHttpRequest,p=0,m="",y=0,v=!0,M=!1,b=this;for(b.debug.log("Searching for SIDX box."),b.debug.log(n.bytesLoaded+" bytes loaded.");"sidx"!==m&&p<g.byteLength;){for(y=g.getUint32(p),p+=4,m="",u=0;4>u;u+=1)l=g.getInt8(p),m+=String.fromCharCode(l),p+=1;"sidx"!==m&&(p+=y-8)}if(r=g.byteLength-p,"sidx"!==m)f.reject();else if(y-8>r)b.debug.log("Found SIDX but we don't have all of it."),n.range.start=0,n.range.end=n.bytesLoaded+(y-r),h.onload=function(){h.status<200||h.status>299||(v=!1,n.bytesLoaded=n.range.end,i.call(b,h.response,n).then(function(e){f.resolve(e)}))},h.onloadend=h.onerror=function(){v&&(v=!1,b.errHandler.downloadError("SIDX",n.url,h),f.reject(h))},h.open("GET",n.url),h.responseType="arraybuffer",h.setRequestHeader("Range","bytes="+n.range.start+"-"+n.range.end),h.send(null);else if(n.range.start=p-8,n.range.end=n.range.start+y,b.debug.log("Found the SIDX box.  Start: "+n.range.start+" | End: "+n.range.end),o=new ArrayBuffer(n.range.end-n.range.start),s=new Uint8Array(o),a=new Uint8Array(e,n.range.start,n.range.end-n.range.start),s.set(a),d=this.parseSIDX.call(this,o,n.range.start),c=d.references,null!==c&&void 0!==c&&c.length>0&&(M=1===c[0].type),M){b.debug.log("Initiate multiple SIDX load.");var E,S,w,P,T,R,_=[];for(E=0,S=c.length;S>E;E+=1)w=c[E].offset,P=c[E].offset+c[E].size-1,T=w+"-"+P,_.push(this.loadSegments.call(b,n.url,T));Q.all(_).then(function(e){for(R=[],E=0,S=e.length;S>E;E+=1)R=R.concat(e[E]);f.resolve(R)},function(e){f.reject(e)})}else b.debug.log("Parsing segments from SIDX."),t.call(b,o,n.url,n.range.start).then(function(e){f.resolve(e)});return f.promise},o=function(e,n){var r,o=Q.defer(),a=new XMLHttpRequest,s=!0,u=this,l={url:e,range:{},searching:!1,bytesLoaded:0,bytesToLoad:1500,request:a};return null===n?(u.debug.log("No known range for SIDX request."),l.searching=!0,l.range.start=0,l.range.end=l.bytesToLoad):(r=n.split("-"),l.range.start=parseFloat(r[0]),l.range.end=parseFloat(r[1])),a.onload=function(){a.status<200||a.status>299||(s=!1,l.searching?(l.bytesLoaded=l.range.end,i.call(u,a.response,l).then(function(e){o.resolve(e)})):t.call(u,a.response,l.url,l.range.start).then(function(e){o.resolve(e)}))},a.onloadend=a.onerror=function(){s&&(s=!1,u.errHandler.downloadError("SIDX",l.url,a),o.reject(a))},a.open("GET",l.url),a.responseType="arraybuffer",a.setRequestHeader("Range","bytes="+l.range.start+"-"+l.range.end),a.send(null),u.debug.log("Perform SIDX load: "+l.url),o.promise};return{debug:void 0,errHandler:void 0,loadSegments:o,loadInitialization:r,parseSegments:t,parseSIDX:e,findSIDX:i}},Dash.dependencies.BaseURLExtensions.prototype={constructor:Dash.dependencies.BaseURLExtensions},Dash.dependencies.DashHandler=function(){"use strict";var e,t,n,r=-1,i=function(e,t){var n=null;return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&(n=t.Representation_asArray[e]),n},o=function(e,t){var n=t.toString();return e.split("$Number$").join(n)},a=function(e,t){var n=t.toString();return e.split("$Time$").join(n)},s=function(e,t){var n=t.toString();return e.split("$Bandwidth$").join(n)},u=function(e,t){if(null===t||-1===e.indexOf("$RepresentationID$"))return e;var n=t.toString();return e.split("$RepresentationID$").join(n)},l=function(e,t){var n;return n=e===t?e:-1!==e.indexOf("http://")?e:t+e},d=function(e,t){var r=Q.defer(),o=i(e,t),a=null,d=null,c=null,f=null,g=this;return o?(g.debug.log("Getting the initialization request."),o.hasOwnProperty("SegmentTemplate")?o.SegmentTemplate.hasOwnProperty("initialization")&&(d=o.SegmentTemplate.initialization,d=s(d,o.bandwidth),d=u(d,o.id)):o.hasOwnProperty("SegmentList")&&o.SegmentList.hasOwnProperty("Initialization")&&o.SegmentList.Initialization.hasOwnProperty("range")?(d=o.SegmentList.Initialization.hasOwnProperty("sourceURL")?o.SegmentList.Initialization.sourceURL:o.BaseURL,f=o.SegmentList.Initialization.range):o.hasOwnProperty("SegmentList")&&o.SegmentList.hasOwnProperty("Initialization")&&o.SegmentList.Initialization.hasOwnProperty("sourceURL")?d=o.SegmentList.Initialization.sourceURL:o.hasOwnProperty("SegmentBase")&&o.SegmentBase.hasOwnProperty("Initialization")&&o.SegmentBase.Initialization.hasOwnProperty("range")?(d=o.BaseURL,f=o.SegmentBase.Initialization.range):o.hasOwnProperty("mimeType")&&g.manifestExt.getIsTextTrack(o.mimeType)?(d=o.BaseURL,f=0):(c=o.BaseURL,g.baseURLExt.loadInitialization(c).then(function(t){g.debug.log("Got an initialization."),a=new MediaPlayer.vo.SegmentRequest,a.streamType=n,a.type="Initialization Segment",a.url=l(c,o.BaseURL),a.range=t,a.quality=e,r.resolve(a)},function(e){r.reject(e)})),d&&d.length>0&&(g.debug.log("Got an initialization."),a=new MediaPlayer.vo.SegmentRequest,a.streamType=n,a.type="Initialization Segment",a.url=l(d,o.BaseURL),a.range=f,a.quality=e,r.resolve(a)),r.promise):Q.reject("no represenation")},c=function(n){var i,o,a,s,u,l,d=!1;return this.debug.log("Checking for stream end..."),e?(this.debug.log("Live never ends! (TODO)"),d=!1):n.hasOwnProperty("segments")&&null!==n.segments?(this.debug.log("Segments: "+r+" / "+n.segments.length),d=r>=n.segments.length):n.hasOwnProperty("SegmentTemplate")&&!n.SegmentTemplate.hasOwnProperty("SegmentTimeline")&&(o=1,u=1,s=t,n.SegmentTemplate.hasOwnProperty("duration")&&(i=n.SegmentTemplate.duration,n.SegmentTemplate.hasOwnProperty("timescale")&&(o=n.SegmentTemplate.timescale),n.SegmentTemplate.hasOwnProperty("startNumber")&&(u=n.SegmentTemplate.startNumber),a=i/o,l=r-u,this.debug.log("SegmentTemplate: "+a+" * "+l+" = "+a*l+" / "+s),d=a*l>=s)),Q.when(d)},f=function(e,n){var r,i,s,u,l,d,c,f,g=[],h=0,p=1,m=1;for(e.hasOwnProperty("startNumber")&&(p=e.startNumber),e.hasOwnProperty("timescale")&&(m=e.timescale),r=n.S_asArray,s=0,u=r.length;u>s;s+=1)for(i=r[s],d=0,i.hasOwnProperty("r")&&(d=i.r),0>d&&(d=(t-h/m)/(i.d/m)-1),l=0;d>=l;l+=1)c=new Dash.vo.Segment,c.timescale=m,0===l&&i.hasOwnProperty("t")?(c.startTime=i.t,h=i.t):c.startTime=h,c.duration=i.d,f=e.media,f=o(f,p),f=a(f,c.startTime),c.media=f,g.push(c),h+=c.duration,p+=1;return Q.when(g)},g=function(e){var t,n,r,i,o,a=[],s=1;for(e.hasOwnProperty("startNumber")&&(s=Math.max(e.startNumber,1)),o=(s-1)*e.duration,t=0,n=e.SegmentURL_asArray.length;n>t;t+=1)i=e.SegmentURL_asArray[t],r=new Dash.vo.Segment,r.media=i.media,r.mediaRange=i.mediaRange,r.index=i.index,r.indexRange=i.indexRange,r.timescale=e.timescale,r.duration=e.duration,r.startTime=o+t*e.duration,a.push(r);return Q.when(a)},h=function(e){var t=e.BaseURL,n=null;return e.hasOwnProperty("SegmentBase")&&e.SegmentBase.hasOwnProperty("indexRange")&&(n=e.SegmentBase.indexRange),this.baseURLExt.loadSegments(t,n)},p=function(e){var t;return t=e.hasOwnProperty("SegmentTemplate")&&!e.SegmentTemplate.hasOwnProperty("SegmentTimeline")?Q.when(null):e.hasOwnProperty("segments")&&null!==e.segments?Q.when(e.segments):e.hasOwnProperty("SegmentTemplate")&&e.SegmentTemplate.hasOwnProperty("SegmentTimeline")?f.call(this,e.SegmentTemplate,e.SegmentTemplate.SegmentTimeline):e.hasOwnProperty("SegmentList")?g.call(this,e.SegmentList):h.call(this,e)},m=function(e,t){var n,r,i,o,a=-1;if(t&&t.length>0)for(o=t.length-1;o>=0;o--){if(n=t[o],r=n.startTime/n.timescale,i=n.duration/n.timescale,e+Dash.dependencies.DashHandler.EPSILON>=r&&e-Dash.dependencies.DashHandler.EPSILON<=r+i){a=o;break}-1===a&&e-Dash.dependencies.DashHandler.EPSILON>r+i&&(a=o+1)}return-1===a&&(console.log("Couldn't figure out a time!"),console.log("Time: "+e),console.log(t)),Q.when(a)},y=function(e,t){var n,r,i=-1,o=1,a=1;if(!t.hasOwnProperty("duration"))throw"Expected 'duration' attribute on SegmentTemplate!";return n=t.duration,t.hasOwnProperty("timescale")&&(o=t.timescale),t.hasOwnProperty("startNumber")&&(a=t.startNumber),r=n/o,i=Math.floor(e/r),i+=a,Q.when(i)},v=function(e,t,r,i){var d,c,f=new MediaPlayer.vo.SegmentRequest,g=1,h=1;return t.hasOwnProperty("timescale")&&(g=t.timescale),t.hasOwnProperty("startNumber")&&(h=t.startNumber),c=t.duration*e/g,c=Math.floor(c),d=t.media,d=o(d,e),d=a(d,c),d=s(d,r.bandwidth),d=u(d,r.id),f.streamType=n,f.type="Media Segment",f.url=l(d,r.BaseURL),f.duration=t.duration/g,f.timescale=g,f.startTime=(e-h)*t.duration/g,f.quality=i,f.index=e,Q.when(f)},M=function(e,t,r,i){if(null===t||void 0===t)return Q.when(null);var d,c=new MediaPlayer.vo.SegmentRequest;return d=l(t.media,r.BaseURL),d=o(d,e),d=a(d,t.startTime),d=s(d,r.bandwidth),d=u(d,r.id),c.streamType=n,c.type="Media Segment",c.url=d,c.range=t.mediaRange,c.startTime=t.startTime/t.timescale,c.duration=t.duration/t.timescale,c.timescale=t.timescale,c.quality=i,c.index=e,Q.when(c)},b=function(e,t,n){var o,a,s,u=i(t,n),l=!1,d=this;return u?(d.debug.log("Getting the request for time: "+e),o=Q.defer(),p.call(d,u).then(function(t){var n;if(d.debug.log("Got segments."),d.debug.log(t),null===t){if(!u.hasOwnProperty("SegmentTemplate"))throw"Expected SegmentTemplate!";l=!0,d.debug.log("No segments found, so we must be using a SegmentTemplate."),n=y.call(d,e,u.SegmentTemplate)}else d.debug.log("Got a list of segments, so dig deeper."),u.segments=t,l=!1,n=m.call(d,e,t);return n},function(){o.reject()}).then(function(t){return d.debug.log("Index for time "+e+" is "+t),r=t,c.call(d,u)}).then(function(e){var n=null;return d.debug.log("Stream finished? "+e),e?(a=new MediaPlayer.vo.SegmentRequest,a.action=a.ACTION_COMPLETE,a.index=r,d.debug.log("Signal complete."),d.debug.log(a),o.resolve(a)):l?n=v.call(d,r,u.SegmentTemplate,u,t):(s=u.segments[r],n=M.call(d,r,s,u,t)),n}).then(function(e){d.debug.log("Got a request."),d.debug.log(e),o.resolve(e)}),o.promise):Q.reject("no represenation")},E=function(e,t){var n,o,a,s=i(e,t),u=this;if(!s)return Q.reject("no represenation");if(u.debug.log("Getting the next request."),-1===r)throw"You must call getSegmentRequestForTime first.";return r+=1,u.debug.log("New index: "+r),n=Q.defer(),c.call(u,s).then(function(t){u.debug.log("Stream finished? "+t),t?(o=new MediaPlayer.vo.SegmentRequest,o.action=o.ACTION_COMPLETE,o.index=r,u.debug.log("Signal complete."),u.debug.log(o),n.resolve(o)):p.call(u,s).then(function(t){var n;if(u.debug.log("Got segments."),u.debug.log(t),null===t){if(!s.hasOwnProperty("SegmentTemplate"))throw"Expected SegmentTemplate!";u.debug.log("No segments found, so we must be using a SegmentTemplate."),n=v.call(u,r,s.SegmentTemplate,s,e)}else s.segments=t,a=s.segments[r],n=M.call(u,r,a,s,e);return n},function(){n.reject()}).then(function(e){u.debug.log("Got a request."),u.debug.log(e),n.resolve(e)})}),n.promise},S=function(e,t,n,r){var o,a,s,u=this,l=i(e,t),d=Math.max(n-r,0),c=Q.defer(),f=0,g=1;return l?(p.call(u,l).then(function(e){if(null===e||void 0===e){if(!l.hasOwnProperty("SegmentTemplate"))throw"Expected SegmentTemplate!";l.SegmentTemplate.hasOwnProperty("timescale")&&(g=l.SegmentTemplate.timescale),s=l.SegmentTemplate.duration,o=s/g}else a=e[0],a.hasOwnProperty("timescale")&&(g=a.timescale),s=a.duration,o=s/g;f=Math.ceil(d/o),c.resolve(f)},function(){c.resolve(0)}),c.promise):Q.reject("no represenation")},w=function(t,n){var o,a,s,u,l=this,d=i(t,n),c=!1,f=1,g=1,h=Q.defer();return d?(a=r,0>a&&(c=e,a=0),p.call(l,d).then(function(e){if(null===e||void 0===e){if(!d.hasOwnProperty("SegmentTemplate"))throw"Expected SegmentTemplate!";u=d.SegmentTemplate.duration,d.SegmentTemplate.hasOwnProperty("timescale")&&(f=d.SegmentTemplate.timescale),d.SegmentTemplate.hasOwnProperty("startNumber")&&(g=d.SegmentTemplate.startNumber),o=u/f*Math.max(a-g,0)}else(c||a>=e.length)&&(a=e.length-1),s=e[a].startTime,u=e[a].duration,e[a].hasOwnProperty("timescale")&&(f=e[a].timescale),o=s/f;h.resolve(o)},function(){h.reject()}),h.promise):Q.reject("no represenation")};return{debug:void 0,baseURLExt:void 0,manifestModel:void 0,manifestExt:void 0,errHandler:void 0,getType:function(){return n},setType:function(e){n=e},getIsLive:function(){return e},setIsLive:function(t){e=t},getDuration:function(){return t},setDuration:function(e){t=e},getInitRequest:d,getSegmentRequestForTime:b,getNextSegmentRequest:E,getCurrentTime:w,getSegmentCountForDuration:S}},Dash.dependencies.DashHandler.EPSILON=.003,Dash.dependencies.DashHandler.prototype={constructor:Dash.dependencies.DashHandler},Dash.dependencies.DashManifestExtensions=function(){"use strict"},Dash.dependencies.DashManifestExtensions.prototype={constructor:Dash.dependencies.DashManifestExtensions,getIsAudio:function(e){"use strict";var t,n,r,i=e.ContentComponent_asArray,o=!1,a=!1;if(i)for(t=0,n=i.length;n>t;t+=1)"audio"===i[t].contentType&&(o=!0,a=!0);if(e.hasOwnProperty("mimeType")&&(o=-1!==e.mimeType.indexOf("audio"),a=!0),!a)for(t=0,n=e.Representation_asArray.length;!a&&n>t;)r=e.Representation_asArray[t],r.hasOwnProperty("mimeType")&&(o=-1!==r.mimeType.indexOf("audio"),a=!0),t+=1;return o&&(e.type="audio"),Q.when(o)},getIsVideo:function(e){"use strict";var t,n,r,i=e.ContentComponent_asArray,o=!1,a=!1;if(i)for(t=0,n=i.length;n>t;t+=1)"video"===i[t].contentType&&(o=!0,a=!0);if(e.hasOwnProperty("mimeType")&&(o=-1!==e.mimeType.indexOf("video"),a=!0),!a)for(t=0,n=e.Representation_asArray.length;!a&&n>t;)r=e.Representation_asArray[t],r.hasOwnProperty("mimeType")&&(o=-1!==r.mimeType.indexOf("video"),a=!0),t+=1;return o&&(e.type="video"),Q.when(o)},getIsText:function(e){"use strict";var t,n,r,i=e.ContentComponent_asArray,o=!1,a=!1;if(i)for(t=0,n=i.length;n>t;t+=1)"text"===i[t].contentType&&(o=!0,a=!0);if(e.hasOwnProperty("mimeType")&&(o=-1!==e.mimeType.indexOf("text"),a=!0),!a)for(t=0,n=e.Representation_asArray.length;!a&&n>t;)r=e.Representation_asArray[t],r.hasOwnProperty("mimeType")&&(o=-1!==r.mimeType.indexOf("text"),a=!0),t+=1;return Q.when(o)},getIsTextTrack:function(e){return"text/vtt"===e||"application/ttml+xml"===e},getIsMain:function(){"use strict";return Q.when(!1)},processAdaptation:function(e){"use strict";return void 0!==e.Representation_asArray&&null!==e.Representation_asArray&&e.Representation_asArray.sort(function(e,t){return e.bandwidth-t.bandwidth}),e},getDataForId:function(e,t,n){"use strict";var r,i,o=t.Period_asArray[n].AdaptationSet_asArray;for(r=0,i=o.length;i>r;r+=1)if(o[r].hasOwnProperty("id")&&o[r].id===e)return Q.when(o[r]);return Q.when(null)},getDataForIndex:function(e,t,n){"use strict";var r=t.Period_asArray[n].AdaptationSet_asArray;return Q.when(r[e])},getDataIndex:function(e,t,n){"use strict";var r,i,o=t.Period_asArray[n].AdaptationSet_asArray;for(r=0,i=o.length;i>r;r+=1)if(o[r]===e)return Q.when(r);return Q.when(-1)},getVideoData:function(e,t){"use strict";var n,r,i=this,o=e.Period_asArray[t].AdaptationSet_asArray,a=Q.defer(),s=[];for(n=0,r=o.length;r>n;n+=1)s.push(this.getIsVideo(o[n]));return Q.all(s).then(function(e){var t=!1;for(n=0,r=e.length;r>n;n+=1)e[n]===!0&&(t=!0,a.resolve(i.processAdaptation(o[n])));t||a.resolve(null)}),a.promise},getTextData:function(e,t){"use strict";var n,r,i=this,o=e.Period_asArray[t].AdaptationSet_asArray,a=Q.defer(),s=[];for(n=0,r=o.length;r>n;n+=1)s.push(this.getIsText(o[n]));return Q.all(s).then(function(e){var t=!1;for(n=0,r=e.length;r>n;n+=1)e[n]===!0&&(t=!0,a.resolve(i.processAdaptation(o[n])));t||a.resolve(null)}),a.promise},getAudioDatas:function(e,t){"use strict";var n,r,i=this,o=e.Period_asArray[t].AdaptationSet_asArray,a=Q.defer(),s=[];for(n=0,r=o.length;r>n;n+=1)s.push(this.getIsAudio(o[n]));return Q.all(s).then(function(e){var t=[];for(n=0,r=e.length;r>n;n+=1)e[n]===!0&&t.push(i.processAdaptation(o[n]));a.resolve(t)}),a.promise},getPrimaryAudioData:function(e,t){"use strict";var n,r,i=Q.defer(),o=[],a=this;return this.getAudioDatas(e,t).then(function(e){for(e&&0!==e.length||i.resolve(null),n=0,r=e.length;r>n;n+=1)o.push(a.getIsMain(e[n]));Q.all(o).then(function(t){var o=!1;for(n=0,r=t.length;r>n;n+=1)t[n]===!0&&(o=!0,i.resolve(a.processAdaptation(e[n])));o||i.resolve(e[0])})}),i.promise},getCodec:function(e){"use strict";var t=e.Representation_asArray[0],n=t.mimeType+';codecs="'+t.codecs+'"';return Q.when(n)},getMimeType:function(e){"use strict";return Q.when(e.Representation_asArray[0].mimeType)},getKID:function(e){"use strict";return e&&e.hasOwnProperty("cenc:default_KID")?e["cenc:default_KID"]:null},getContentProtectionData:function(e){"use strict";return e&&e.hasOwnProperty("ContentProtection_asArray")&&0!==e.ContentProtection_asArray.length?Q.when(e.ContentProtection_asArray):Q.when(null)},getSegmentInfoFor:function(e){return e.hasOwnProperty("SegmentBase")?e.SegmentBase:e.hasOwnProperty("SegmentList")?e.SegmentList:e.hasOwnProperty("SegmentTemplate")?e.SegmentTemplate:null},getLiveOffset:function(e){"use strict";var t=15;return e.hasOwnProperty("suggestedPresentationDelay")&&(t=e.suggestedPresentationDelay),Q.when(t)},getLiveStart:function(e,t){var n,r,i=0,o=1,a=1,s=null,u=null;return r=e.Period_asArray[t].AdaptationSet_asArray[1].Representation_asArray[0],r.hasOwnProperty("SegmentList")?(s=r.SegmentList,s.hasOwnProperty("startNumber")&&(o=Math.max(s.startNumber,1)),s.hasOwnProperty("timescale")&&(a=s.timescale),n=s.duration,i=(o-1)*n/a):r.hasOwnProperty("SegmentTemplate")&&(u=r.SegmentTemplate,u.hasOwnProperty("startNumber")&&(o=Math.max(u.startNumber,1)),u.hasOwnProperty("timescale")&&(a=u.timescale),n=u.duration,i=u.hasOwnProperty("SegmentTimeline")?u.SegmentTimeline.S_asArray[0].t/a:(o-1)*n/a),Q.when(i)},getLiveEdge:function(e,t){"use strict";var n,r=this,i=Q.defer(),o=0,a=new Date,s=e.availabilityStartTime;return r.getLiveOffset(e).then(function(u){e.hasOwnProperty("availabilityEndTime")?(n=e.availabilityEndTime,o=(n.getTime()-s.getTime())/1e3):o=(a.getTime()-s.getTime())/1e3,r.getLiveStart(e,t).then(function(e){o+=e,o-=u,i.resolve(o)})}),i.promise},getPresentationOffset:function(e,t){var n,r,i=this,o=Q.defer(),a=0,s=1;return i.getRepresentationFor(e,t).then(function(e){r=i.getSegmentInfoFor(e),null!==r&&void 0!==r&&r.hasOwnProperty("presentationTimeOffset")&&(n=r.presentationTimeOffset,r.hasOwnProperty("timescale")&&(s=r.timescale),a=n/s),o.resolve(a)}),o.promise},getIsLive:function(e){"use strict";var t=!1,n="dynamic";return e.hasOwnProperty("type")&&(t=e.type===n),t},getIsDVR:function(e,t){"use strict";var n,r;return n=!isNaN(e.timeShiftBufferDepth),r=t&&n,Q.when(r)},getIsOnDemand:function(e){"use strict";var t=!1;return e.profiles&&e.profiles.length>0&&(t=-1!==e.profiles.indexOf("urn:mpeg:dash:profile:isoff-on-demand:2011")),Q.when(t)},getDuration:function(e,t){"use strict";var n=NaN;return t?n=Number.POSITIVE_INFINITY:e.mediaPresentationDuration?n=e.mediaPresentationDuration:e.availabilityEndTime&&e.availabilityStartTime&&(n=e.availabilityEndTime.getTime()-e.availabilityStartTime.getTime()),Q.when(n)},getDurationForPeriod:function(e,t,n){"use strict";var r=NaN;return n?r=Number.POSITIVE_INFINITY:t.Period_asArray.length>1&&void 0!==t.Period_asArray[e].duration?r=t.Period_asArray[e].duration:t.mediaPresentationDuration?r=t.mediaPresentationDuration:t.availabilityEndTime&&t.availabilityStartTime&&(r=t.availabilityEndTime.getTime()-t.availabilityStartTime.getTime()),Q.when(r)},getBandwidth:function(e){"use strict";return Q.when(e.bandwidth)},getRefreshDelay:function(e){"use strict";var t=NaN;return e.hasOwnProperty("minimumUpdatePeriod")&&(t=parseFloat(e.minimumUpdatePeriod)),Q.when(t)},getRepresentationCount:function(e){"use strict";return Q.when(e.Representation_asArray.length)},getRepresentationFor:function(e,t){"use strict";return Q.when(t.Representation_asArray[e])},getPeriodCount:function(e){"use strict";return Q.when(e.Period_asArray.length)},getTimestampOffsetForPeriod:function(e,t,n,r){var i,o=this,a=Q.defer();return o.getPresentationOffset(n,r).then(function(n){o.getPeriodStart(t,e).then(function(e){i=e-n,a.resolve(i)})}),a.promise},getPeriodStart:function(e,t){var n,r,i=this,o=i.getIsLive(e),a=null,s=null,u=null;for(n=0;t>=n;n+=1)a=e.Period_asArray[n],a.hasOwnProperty("start")?r=a.start:null!==s&&null!==u?r=s+u:0!==n||o||(r=0),a.hasOwnProperty("duration")&&(u=a.duration),s=r;return Q.when(r)}},Dash.dependencies.DashMetricsExtensions=function(){"use strict";var e=function(e,t){var n,r,i,o,a,s,u,l;for(s=0;s<e.length;s+=1)for(n=e[s],i=n.AdaptationSet_asArray,u=0;u<i.length;u+=1)for(r=i[u],a=r.Representation_asArray,l=0;l<a.length;l+=1)if(o=a[l],t===o.id)return l;return-1},t=function(e,t){var n,r,i,o,a,s,u,l;for(s=0;s<e.length;s+=1)for(n=e[s],i=n.AdaptationSet_asArray,u=0;u<i.length;u+=1)for(r=i[u],a=r.Representation_asArray,l=0;l<a.length;l+=1)if(o=a[l],t===o.id)return o;return null},n=function(e,t){var n=!1;return"video"===t?(this.manifestExt.getIsVideo(e),"video"===e.type&&(n=!0)):"audio"===t?(this.manifestExt.getIsAudio(e),"audio"===e.type&&(n=!0)):n=!1,n},r=function(e,t){var r,i,o,a,s,u;for(s=0;s<e.length;s+=1)for(r=e[s],o=r.AdaptationSet_asArray,u=0;u<o.length;u+=1)if(i=o[u],a=i.Representation_asArray,n.call(this,i,t))return a.length;return-1},i=function(e){var n,r=this,i=r.manifestModel.getValue(),o=i.Period_asArray;return n=t.call(r,o,e),null===n?null:n.bandwidth},o=function(t){var n,r=this,i=r.manifestModel.getValue(),o=i.Period_asArray;return n=e.call(r,o,t)},a=function(e){var t,n=this,i=n.manifestModel.getValue(),o=i.Period_asArray;return t=r.call(this,o,e)},s=function(e){if(null===e)return null;var t,n,r,i=e.RepSwitchList;return null===i||i.length<=0?null:(t=i.length,n=t-1,r=i[n])},u=function(e){if(null===e)return null;var t,n,r,i=e.BufferLevel;return null===i||i.length<=0?null:(t=i.length,n=t-1,r=i[n])},l=function(e){if(null===e)return null;var t,n,r,i=e.HttpList;return null===i||i.length<=0?null:(t=i.length,n=t-1,r=i[n])},d=function(e){if(null===e)return null;var t,n,r,i=e.DroppedFrames;return null===i||i.length<=0?null:(t=i.length,n=t-1,r=i[n])};return{manifestModel:void 0,manifestExt:void 0,getBandwidthForRepresentation:i,getIndexForRepresentation:o,getMaxIndexForBufferType:a,getCurrentRepresentationSwitch:s,getCurrentBufferLevel:u,getCurrentHttpRequest:l,getCurrentDroppedFrames:d}},Dash.dependencies.DashMetricsExtensions.prototype={constructor:Dash.dependencies.DashMetricsExtensions},Dash.dependencies.DashParser=function(){"use strict";var e=31536e3,t=2592e3,n=86400,r=3600,i=60,o=/^P(([\d.]*)Y)?(([\d.]*)M)?(([\d.]*)D)?T(([\d.]*)H)?(([\d.]*)M)?(([\d.]*)S)?/,a=/^(\d{4}\-\d\d\-\d\d([tT][\d:\.]*)?)([zZ]|([+\-])(\d\d):(\d\d))?$/,s=/^[-+]?[0-9]+[.]?[0-9]*([eE][-+]?[0-9]+)?$/,u=[{type:"duration",test:function(e){return o.test(e)},converter:function(a){var s=o.exec(a);return parseFloat(s[2]||0)*e+parseFloat(s[4]||0)*t+parseFloat(s[6]||0)*n+parseFloat(s[8]||0)*r+parseFloat(s[10]||0)*i+parseFloat(s[12]||0)}},{type:"datetime",test:function(e){return a.test(e)},converter:function(e){return new Date(e)}},{type:"numeric",test:function(e){return s.test(e)},converter:function(e){return parseFloat(e)}}],l=function(){var e,t,n,r;return r=[{name:"profiles",merge:!1},{name:"width",merge:!1},{name:"height",merge:!1},{name:"sar",merge:!1},{name:"frameRate",merge:!1},{name:"audioSamplingRate",merge:!1},{name:"mimeType",merge:!1},{name:"segmentProfiles",merge:!1},{name:"codecs",merge:!1},{name:"maximumSAPPeriod",merge:!1},{name:"startsWithSap",merge:!1},{name:"maxPlayoutRate",merge:!1},{name:"codingDependency",merge:!1},{name:"scanType",merge:!1},{name:"FramePacking",merge:!0},{name:"AudioChannelConfiguration",merge:!0},{name:"ContentProtection",merge:!0}],e={},e.name="AdaptationSet",e.isRoot=!1,e.isArray=!0,e.parent=null,e.children=[],e.properties=r,t={},t.name="Representation",t.isRoot=!1,t.isArray=!0,t.parent=e,t.children=[],t.properties=r,e.children.push(t),n={},n.name="SubRepresentation",n.isRoot=!1,n.isArray=!0,n.parent=t,n.children=[],n.properties=r,t.children.push(n),e},d=function(){var e,t,n,r;return r=[{name:"SegmentBase",merge:!0},{name:"SegmentTemplate",merge:!0},{name:"SegmentList",merge:!0}],e={},e.name="Period",e.isRoot=!1,e.isArray=!0,e.parent=null,e.children=[],e.properties=r,t={},t.name="AdaptationSet",t.isRoot=!1,t.isArray=!0,t.parent=e,t.children=[],t.properties=r,e.children.push(t),n={},n.name="Representation",n.isRoot=!1,n.isArray=!0,n.parent=t,n.children=[],n.properties=r,t.children.push(n),e},c=function(){var e,t,n,r,i;return i=[{name:"BaseURL",merge:!0,mergeFunction:function(e,t){var n;return n=0===t.indexOf("http://")?t:e+t}}],e={},e.name="mpd",e.isRoot=!0,e.isArray=!0,e.parent=null,e.children=[],e.properties=i,t={},t.name="Period",t.isRoot=!1,t.isArray=!0,t.parent=null,t.children=[],t.properties=i,e.children.push(t),n={},n.name="AdaptationSet",n.isRoot=!1,n.isArray=!0,n.parent=t,n.children=[],n.properties=i,t.children.push(n),r={},r.name="Representation",r.isRoot=!1,r.isArray=!0,r.parent=n,r.children=[],r.properties=i,n.children.push(r),e},f=function(){var e=[];return e.push(l()),e.push(d()),e.push(c()),e},g=function(e,t){this.debug.log("Doing parse.");var n,r=new X2JS(u,"",!0),i=new ObjectIron(f());try{this.debug.log("Converting from XML."),n=r.xml_str2json(e),n.hasOwnProperty("BaseURL")?(n.BaseURL=n.BaseURL_asArray[0],0!==n.BaseURL.toString().indexOf("http")&&(n.BaseURL=t+n.BaseURL)):(this.debug.log("Setting baseURL: "+t),n.BaseURL=t),this.debug.log("Flatten manifest properties."),i.run(n),this.debug.log("Parsing complete.")}catch(o){return this.errHandler.manifestError("parsing the manifest failed","parse",e),Q.reject(o)}return Q.when(n)};return{debug:void 0,errHandler:void 0,parse:g}},Dash.dependencies.DashParser.prototype={constructor:Dash.dependencies.DashParser},Dash.dependencies.FragmentExtensions=function(){"use strict";var e=function(e){for(var t,n,r,i,o,a,s=Q.defer(),u=new DataView(e),l=0;"tfdt"!==i&&l<u.byteLength;){for(r=u.getUint32(l),l+=4,i="",o=0;4>o;o+=1)a=u.getInt8(l),i+=String.fromCharCode(a),l+=1;"moof"!==i&&"traf"!==i&&"tfdt"!==i&&(l+=r-8)}if(l===u.byteLength)throw"Error finding live offset.";return n=u.getUint8(l),this.debug.log("position: "+l),0===n?(l+=4,t=u.getUint32(l,!1)):(l+=r-16,t=utils.Math.to64BitNumber(u.getUint32(l+4,!1),u.getUint32(l,!1))),s.resolve({version:n,base_media_decode_time:t}),s.promise},t=function(e){for(var t,n,r,i,o,a,s,u=new DataView(e),l=0;"sidx"!==o&&l<u.byteLength;){for(a=u.getUint32(l),l+=4,o="",i=0;4>i;i+=1)s=u.getInt8(l),o+=String.fromCharCode(s),l+=1;"moof"!==o&&"traf"!==o&&"sidx"!==o?l+=a-8:"sidx"===o&&(l-=8)}return t=u.getUint8(l+8),l+=12,n=u.getUint32(l+4,!1),l+=8,r=0===t?u.getUint32(l,!1):utils.Math.to64BitNumber(u.getUint32(l+4,!1),u.getUint32(l,!1)),Q.when({earliestPresentationTime:r,timescale:n})},n=function(t){var n,r,i,o=Q.defer(),a=new XMLHttpRequest,s=!1;return n=t,a.onloadend=function(){s||(r="Error loading fragment: "+n,o.reject(r))},a.onload=function(){s=!0,i=e(a.response),o.resolve(i)},a.onerror=function(){r="Error loading fragment: "+n,o.reject(r)},a.responseType="arraybuffer",a.open("GET",n),a.send(null),o.promise};return{debug:void 0,loadFragment:n,parseTFDT:e,parseSIDX:t}},Dash.dependencies.FragmentExtensions.prototype={constructor:Dash.dependencies.FragmentExtensions},Dash.vo.Segment=function(){"use strict";this.indexRange=null,this.index=null,this.mediaRange=null,this.media=null,this.duration=NaN,this.startTime=NaN,this.timescale=NaN},Dash.vo.Segment.prototype={constructor:Dash.vo.Segment},MediaPlayer.dependencies.AbrController=function(){
  "use strict";var e=!0,t={},n={},r=function(e){var n;return t.hasOwnProperty(e)||(t[e]=0),n=t[e]},i=function(e,n){t[e]=n},o=function(e){var t;return n.hasOwnProperty(e)||(n[e]=0),t=n[e]},a=function(e,t){n[e]=t};return{debug:void 0,abrRulesCollection:void 0,manifestExt:void 0,metricsModel:void 0,getAutoSwitchBitrate:function(){return e},setAutoSwitchBitrate:function(t){e=t},getMetricsFor:function(e){var t=Q.defer(),n=this;return n.manifestExt.getIsVideo(e).then(function(r){r?t.resolve(n.metricsModel.getMetricsFor("video")):n.manifestExt.getIsAudio(e).then(function(e){e?t.resolve(n.metricsModel.getMetricsFor("audio")):t.resolve(n.metricsModel.getMetricsFor("stream"))})}),t.promise},getPlaybackQuality:function(t,n){var s,u,l,d,c,f,g=this,h=Q.defer(),p=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,m=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,y=[];return c=r(t),f=o(t),g.debug.log("ABR enabled? ("+e+")"),e?(g.debug.log("Check ABR rules."),g.getMetricsFor(n).then(function(e){g.abrRulesCollection.getRules().then(function(r){for(s=0,u=r.length;u>s;s+=1)y.push(r[s].checkIndex(c,e,n));Q.all(y).then(function(e){for(g.debug.log(e),d={},d[MediaPlayer.rules.SwitchRequest.prototype.STRONG]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,d[MediaPlayer.rules.SwitchRequest.prototype.WEAK]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,d[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]=MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,s=0,u=e.length;u>s;s+=1)l=e[s],l.quality!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(d[l.priority]=Math.min(d[l.priority],l.quality));d[MediaPlayer.rules.SwitchRequest.prototype.WEAK]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(m=MediaPlayer.rules.SwitchRequest.prototype.WEAK,p=d[MediaPlayer.rules.SwitchRequest.prototype.WEAK]),d[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(m=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT,p=d[MediaPlayer.rules.SwitchRequest.prototype.DEFAULT]),d[MediaPlayer.rules.SwitchRequest.prototype.STRONG]!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&(m=MediaPlayer.rules.SwitchRequest.prototype.STRONG,p=d[MediaPlayer.rules.SwitchRequest.prototype.STRONG]),p!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&void 0!==p&&(c=p),m!==MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE&&void 0!==m&&(f=m),g.manifestExt.getRepresentationCount(n).then(function(e){0>c&&(c=0),c>=e&&(c=e-1),f!=MediaPlayer.rules.SwitchRequest.prototype.STRONG&&f!=MediaPlayer.rules.SwitchRequest.prototype.WEAK&&(f=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT),i(t,c),g.debug.log("New quality of "+c),a(t,f),g.debug.log("New confidence of "+f),h.resolve({quality:c,confidence:f})})})})})):(g.debug.log("Unchanged quality of "+c),h.resolve({quality:c,confidence:f})),h.promise},setPlaybackQuality:function(e,t){var n=r(e);t!==n&&i(e,t)},getQualityFor:function(e){return r(e)}}},MediaPlayer.dependencies.AbrController.prototype={constructor:MediaPlayer.dependencies.AbrController},MediaPlayer.dependencies.BufferController=function(){"use strict";var e,t,n,r,i=.5,o=22,a="WAITING",s="READY",u="VALIDATING",l="LOADING",d=a,c=!1,f=!1,g=!1,h=!0,p=[],m=!1,y=-1,v=!0,M=-1,b=!1,E=!1,S=!1,w=!1,P=[],T=null,R=Q.defer(),_=null,L=null,x=-1,O=0,D=0,C=null,A=0,N=!1,B=null,I=0,q=!1,k=null,F=null,U=null,j=null,H=!0,V=function(e){var t=this;t.debug.log("BufferController "+n+" setState to:"+e),d=e,null!==C&&t.fragmentController.onBufferControllerStateChange()},K=function(e,t){var n=0,r=null;H===!1&&(r=j.start,n=e.getTime()-r.getTime(),j.duration=n,j.stopreason=t,H=!0)},W=function(){var e=this.manifestModel.getValue(),t=this.manifestExt.getIsLive(e);return S=!0,Q.when(t)},G=function(){if(c&&f){var e=this;W.call(this).then(function(t){E=t,e.debug.log("BufferController begin "+n+" validation"),V.call(e,s),e.requestScheduler.startScheduling(e,ye),C=e.fragmentController.attachBufferController(e)})}},z=function(){var e;this.requestScheduler.isScheduled(this)||(m===!1&&(e=new Date,K(e,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON),U=this.metricsModel.addPlayList(n,e,0,MediaPlayer.vo.metrics.PlayList.INITIAL_PLAY_START_REASON)),this.debug.log("BufferController "+n+" start."),f=!0,g=!0,G.call(this))},X=function(e){var t;this.debug.log("BufferController "+n+" seek: "+e),m=!0,y=e,t=new Date,K(t,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON),U=this.metricsModel.addPlayList(n,t,y,MediaPlayer.vo.metrics.PlayList.SEEK_START_REASON),z.call(this)},Z=function(){d!==a&&(this.debug.log("BufferController "+n+" stop."),V.call(this,a),this.requestScheduler.stopScheduling(this),this.fragmentController.cancelPendingRequestsForModel(C),f=!1,g=!1,K(new Date,MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON))},Y=function(e,t){var n=null;return t&&t.Representation_asArray&&t.Representation_asArray.length>0&&(n=t.Representation_asArray[e]),n},$=function(){var e=this;d===l&&(b&&(b=!1,this.videoModel.stallStream(n,b)),V.call(e,s))},J=function(e){if(this.fragmentController.isInitializationRequest(e))V.call(this,s);else{V.call(this,l);var t=this,n=t.fragmentController.getLoadingTime(t);setTimeout(function(){(k||F)&&(V.call(t,s),me.call(t))},n)}},ee=function(e,t){this.fragmentController.isInitializationRequest(e)?se.call(this,e,t):te.call(this,e,t)},te=function(e,t){var r=this;r.debug.log(n+" Bytes finished loading: "+e.url),I||isNaN(e.duration)||(I=e.duration),r.fragmentController.process(t.data).then(function(t){null!==t&&null!==T?Q.when(T.promise).then(function(){ne.call(r,t,e.quality).then(function(){R.promise.then(function(t){t.index-1!==e.index||w||(w=!0,b&&(b=!1,r.videoModel.stallStream(n,b)),V.call(r,s),r.system.notify("bufferingCompleted"))})})}):r.debug.log("No "+n+" bytes to push.")})},ne=function(e,t){var r=this,i=e==B,s=i?_:Q.defer(),u=i?P.length:P.push(s),l=Y(M,r.getData()),c=r.videoModel.getCurrentTime(),f=new Date;return r.debug.log("Push ("+n+") bytes: "+e.byteLength),H===!0&&d!==a&&-1!==M&&(H=!1,j=r.metricsModel.appendPlayListTrace(U,l.id,null,f,c,null,1,null)),Q.when(i||2>u||P[u-2].promise).then(function(){F&&oe.call(r).then(function(){return t!==M?(s.resolve(),void(i&&(_=null,B=null))):void Q.when(L?L.promise:!0).then(function(){r.sourceBufferExt.append(F,e,r.videoModel).then(function(){i&&(_=null,B=null),r.requestScheduler.isScheduled(r)||z.call(r),N=!1,re.call(r).then(function(){s.resolve()}),F&&r.sourceBufferExt.getAllRanges(F).then(function(e){if(e&&(r.debug.log("Append "+n+" complete: "+e.length),e.length>0)){var t,i;for(r.debug.log("Number of buffered "+n+" ranges: "+e.length),t=0,i=e.length;i>t;t+=1)r.debug.log("Buffered "+n+" Range: "+e.start(t)+" - "+e.end(t))}})},function(t){t.err.code===o&&(B=e,_=s,N=!0,D=0,Z.call(r))})})})}),s.promise},re=function(){if(!k&&!F)return Q.when(!1);var e=this,t=Q.defer(),r=he.call(e);return e.sourceBufferExt.getBufferLength(F,r).then(function(r){A=r,e.metricsModel.addBufferLevel(n,new Date,A),ie.call(e),t.resolve()}),t.promise},ie=function(){var e=this.bufferExt.getLeastBufferLevel(),t=2*I,n=A-e;n>t&&!L?(D=0,L=Q.defer()):t>n&&L&&(L.resolve(),L=null)},oe=function(){var e,t=this,n=Q.defer(),r=0;return N?(e=function(){ae.call(t).then(function(t){r+=t,r>=I?n.resolve():setTimeout(e,1e3*I)})},e.call(t),n.promise):Q.when(!0)},ae=function(){var e,n,r=this,i=Q.defer(),o=r.videoModel.getCurrentTime(),a=0;return n=r.fragmentController.getExecutedRequestForTime(C,o),e=n&&!isNaN(n.startTime)?n.startTime:Math.floor(o),I=n&&!isNaN(n.duration)?n.duration:1,r.sourceBufferExt.getBufferRange(F,o).then(function(n){null===n&&y===o&&F.buffered.length>0&&(e=F.buffered.end(F.buffered.length-1)),a=F.buffered.start(0),r.sourceBufferExt.remove(F,a,e,O,t).then(function(){r.fragmentController.removeExecutedRequestsBeforeTime(C,e),i.resolve(e-a)})}),i.promise},se=function(e,t){var r=this,i=t.data,o=e.quality;r.debug.log(n+" Initialization finished loading: "+e.url),r.fragmentController.process(i).then(function(t){null!==t?(p[o]=t,o===M&&ne.call(r,t,e.quality).then(function(){T.resolve()})):r.debug.log("No "+n+" bytes to push.")})},ue=function(){var e=this,t=e.manifestModel.getValue(),n=e.manifestExt.getIsLive(t);d===l&&V.call(e,s),n||e.system.notify("segmentLoadingFailed")},le=function(e){this.debug.log(n+" Stream is complete."),K(new Date,MediaPlayer.vo.metrics.PlayList.Trace.END_OF_CONTENT_STOP_REASON),Z.call(this),R.resolve(e)},de=function(e,t){var r,i=null,o=this.bufferExt.getTopQualityIndex(n),a=[];if(h&&(this.debug.log("Marking a special seek for initial "+n+" playback."),m||(m=!0,y=0),h=!1),v){for(T=Q.defer(),p=[],r=0;o>=r;r+=1)a.push(this.indexHandler.getInitRequest(r,k));M=t,i=Q.all(a)}else i=Q.when(null),e&&(T=Q.defer(),M=t,p[t]&&ne.call(this,p[t],t).then(function(){T.resolve()}));return i},ce=function(t){var r,i=this;if(v&&!m)i.debug.log("Data changed - loading the "+n+" fragment for time: "+e),r=i.indexHandler.getSegmentRequestForTime(e,t,k);else{var o=Q.defer(),a=i.videoModel.getCurrentTime();r=o.promise,i.sourceBufferExt.getBufferRange(F,a).then(function(e){m=!1,null!==e&&(a=e.end),i.debug.log("Loading the "+n+" fragment for time: "+a),i.indexHandler.getSegmentRequestForTime(a,t,k).then(function(e){o.resolve(e)},function(){o.reject()})},function(){o.reject()})}return v=!1,r},fe=function(e){var t=this;null!==e?t.fragmentController.isFragmentLoadedOrPending(t,e)?"complete"!==e.action?t.indexHandler.getNextSegmentRequest(M,k).then(fe.bind(t)):(Z.call(t),V.call(t,s)):(t.debug.log("Loading an "+n+" fragment: "+e.url),Q.when(L?L.promise:!0).then(function(){t.fragmentController.prepareFragmentForLoading(t,e,J,ee,ue,le).then(function(){V.call(t,s)})})):V.call(t,s)},ge=function(){g&&(r>A&&r<O-this.videoModel.getCurrentTime()?b||(this.debug.log("Waiting for more "+n+" buffer before starting playback."),b=!0,this.videoModel.stallStream(n,b)):(this.debug.log("Got enough "+n+" buffer to start."),g=!1,b=!1,this.videoModel.stallStream(n,b)))},he=function(){var e=-1;return e=this.videoModel.getCurrentTime()},pe=function(e){var t=this,n=t.videoModel.getPlaybackRate(),r=A/Math.max(n,1),i=Q.defer();return t.bufferExt.getRequiredBufferLength(g,t.requestScheduler.getExecuteInterval(t)/1e3,E,O).then(function(n){t.indexHandler.getSegmentCountForDuration(e,k,n,r).then(function(e){i.resolve(e)})}),i.promise},me=function(){var e=this,t=e.fragmentController.getPendingRequests(e),n=e.fragmentController.getLoadingRequests(e),r=(t?t.length:0)+(n?n.length:0);D-r>0?(D--,ce.call(e,M).then(fe.bind(e))):(d===u&&V.call(e,s),$.call(e))},ye=function(){var e,t=this,r=!1,o=null,a=new Date,c=t.videoModel.getCurrentTime(),f=he.call(t);if(t.debug.log("BufferController.validate() "+n+" | state: "+d),t.debug.log(n+" Playback rate: "+t.videoModel.getElement().playbackRate),t.debug.log(n+" Working time: "+f),t.debug.log(n+" Video time: "+c),t.debug.log("Current "+n+" buffer length: "+A),ge.call(t),d===l&&i>A)b||(t.debug.log("Stalling "+n+" Buffer: "+n),K(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON),b=!0,g=!0,t.videoModel.stallStream(n,b));else if(d===s){V.call(t,u);var h=t.manifestModel.getValue().minBufferTime;t.bufferExt.decideBufferLength(h,O,g).then(function(e){t.debug.log("Buffer time: "+e),t.setMinBufferTime(e),t.requestScheduler.adjustExecuteInterval()}),t.abrController.getPlaybackQuality(n,k).then(function(i){var s=i.quality;if(t.debug.log(n+" Playback quality: "+s),t.debug.log("Populate "+n+" buffers."),void 0!==s&&(e=s),r=s!==M,r===!0){if(t.fragmentController.abortRequestsForModel(C),o=Y(e,t.getData()),null===o||void 0===o)throw"Unexpected error!";t.manifestExt.getTimestampOffsetForPeriod(x,t.manifestModel.getValue(),s,k).then(function(e){F.timestampOffset!==e&&(F.timestampOffset=e)}),K(new Date,MediaPlayer.vo.metrics.PlayList.Trace.REPRESENTATION_SWITCH_STOP_REASON),t.metricsModel.addRepresentationSwitch(n,a,c,o.id)}return t.debug.log(r?n+" Quality changed to: "+s:"Quality didn't change."),pe.call(t,s)}).then(function(i){D=i,de.call(t,r,e).then(function(e){if(null!==e){var r,i,o=e.length;for(i=0;o>i;i+=1)r=e[i],t.debug.log("Loading "+n+" initialization: "+r.url),t.debug.log(r),t.fragmentController.prepareFragmentForLoading(t,r,J,ee,ue,le).then(function(){V.call(t,s)})}}),me.call(t)})}else d===u&&V.call(t,s)};return{videoModel:void 0,metricsModel:void 0,manifestExt:void 0,manifestModel:void 0,bufferExt:void 0,sourceBufferExt:void 0,abrController:void 0,fragmentExt:void 0,indexHandler:void 0,debug:void 0,system:void 0,errHandler:void 0,initialize:function(e,t,n,r,i,o,a,s){var u=this,l=u.manifestModel.getValue(),d=u.manifestExt.getIsLive(l);u.setMediaSource(s),u.setVideoModel(i),u.setType(e),u.setPeriodIndex(t),u.setData(n).then(function(){c=!0,G.call(u)}),u.setBuffer(r),u.setScheduler(o),u.setFragmentController(a),u.indexHandler.setIsLive(d),u.manifestExt.getDurationForPeriod(t,u.manifestModel.getValue()).then(function(e){O=e,u.indexHandler.setDuration(e),u.bufferExt.decideBufferLength(l.minBufferTime,O,g).then(function(e){u.setMinBufferTime(e)})})},getType:function(){return n},setType:function(e){n=e,void 0!==this.indexHandler&&this.indexHandler.setType(e)},getPeriodIndex:function(){return x},setPeriodIndex:function(e){x=e},getVideoModel:function(){return this.videoModel},setVideoModel:function(e){this.videoModel=e},getScheduler:function(){return this.requestScheduler},setScheduler:function(e){this.requestScheduler=e},getFragmentController:function(){return this.fragmentController},setFragmentController:function(e){this.fragmentController=e},getAutoSwitchBitrate:function(){var e=this;return e.abrController.getAutoSwitchBitrate()},setAutoSwitchBitrate:function(e){var t=this;t.abrController.setAutoSwitchBitrate(e)},getData:function(){return k},setData:function(t){var r=this,i=Q.defer(),o=k;return o||(o=t),r.abrController.getPlaybackQuality(n,o).then(function(a){r.indexHandler.getCurrentTime(a.quality,o).then(function(o){v=!0,e=o,k=t,r.seek(o),r.bufferExt.updateData(k,n),i.resolve()})}),i.promise},getBuffer:function(){return F},setBuffer:function(e){F=e},getMinBufferTime:function(){return r},setMinBufferTime:function(e){r=e},setMediaSource:function(e){t=e},isReady:function(){return d===s},isBufferingCompleted:function(){return w},clearMetrics:function(){var e=this;null!==n&&""!==n&&e.metricsModel.clearCurrentMetricsForType(n)},updateBufferState:function(){var e=this;N&&B&&!q?(q=!0,ne.call(e,B,M).then(function(){q=!1})):re.call(e)},reset:function(e){var n=this;Z.call(n),n.clearMetrics(),n.fragmentController.abortRequestsForModel(C),n.fragmentController.detachBufferController(C),C=null,P=[],T=null,p=[],R=Q.defer(),e||(n.sourceBufferExt.abort(t,F),n.sourceBufferExt.removeSourceBuffer(t,F)),k=null,F=null},start:z,seek:X,stop:Z}},MediaPlayer.dependencies.BufferController.prototype={constructor:MediaPlayer.dependencies.BufferController},MediaPlayer.dependencies.BufferExtensions=function(){"use strict";var e,t,n=0,r=0,i=null,o=null,a=function(e){var t=this.metricsExt.getCurrentHttpRequest(e);return null!==t?(t.tresponse.getTime()-t.trequest.getTime())/1e3:0},s=function(){var e,t=this,a=Q.defer();return Q.when(i?t.abrController.getPlaybackQuality("audio",i):n).then(function(i){Q.when(o?t.abrController.getPlaybackQuality("video",o):r).then(function(t){e=i.quality===n&&t.quality===r,e=e||i.confidence===MediaPlayer.rules.SwitchRequest.prototype.STRONG&&t.confidence===MediaPlayer.rules.SwitchRequest.prototype.STRONG,a.resolve(e)})}),a.promise};return{system:void 0,videoModel:void 0,manifestExt:void 0,metricsExt:void 0,metricsModel:void 0,abrController:void 0,bufferMax:void 0,updateData:function(e,t){var a=e.Representation_asArray.length-1;"audio"===t?(n=a,i=e):"video"===t&&(r=a,o=e)},getTopQualityIndex:function(e){var t=null;return"audio"===e?t=n:"video"===e&&(t=r),t},decideBufferLength:function(t,n){return e=MediaPlayer.dependencies.BufferExtensions.DEFAULT_MIN_BUFFER_TIME<n&&n>t?Math.max(MediaPlayer.dependencies.BufferExtensions.DEFAULT_MIN_BUFFER_TIME,t):t>=n?Math.min(n,MediaPlayer.dependencies.BufferExtensions.DEFAULT_MIN_BUFFER_TIME):Math.min(n,t),Q.when(e)},getLeastBufferLevel:function(){var e=this.metricsModel.getReadOnlyMetricsFor("video"),t=this.metricsExt.getCurrentBufferLevel(e),n=this.metricsModel.getReadOnlyMetricsFor("audio"),r=this.metricsExt.getCurrentBufferLevel(n),i=null;return i=null===t||null===r?null!==r?r.level:null!==t?t.level:null:Math.min(r.level,t.level)},getRequiredBufferLength:function(n,r,i,o){var u,l=this,d=l.metricsModel.getReadOnlyMetricsFor("video"),c=l.metricsModel.getReadOnlyMetricsFor("audio"),f=o>=MediaPlayer.dependencies.BufferExtensions.LONG_FORM_CONTENT_DURATION_THRESHOLD,g=Q.defer(),h=null;return l.bufferMax===MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_MIN?(u=e,g.resolve(u)):l.bufferMax===MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_INFINITY?(u=o,g.resolve(u)):l.bufferMax===MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_REQUIRED?(t=e,i||n||(h=s.call(l)),Q.when(h).then(function(e){e&&(t=f?MediaPlayer.dependencies.BufferExtensions.BUFFER_TIME_AT_TOP_QUALITY_LONG_FORM:MediaPlayer.dependencies.BufferExtensions.BUFFER_TIME_AT_TOP_QUALITY),u=t+r+Math.max(a.call(l,d),a.call(l,c)),g.resolve(u)})):g.reject("invalid bufferMax value: "+l.bufferMax),g.promise},getBufferTarget:function(){return void 0===t?e:t}}},MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_REQUIRED="required",MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_MIN="min",MediaPlayer.dependencies.BufferExtensions.BUFFER_SIZE_INFINITY="infinity",MediaPlayer.dependencies.BufferExtensions.BUFFER_TIME_AT_STARTUP=1,MediaPlayer.dependencies.BufferExtensions.DEFAULT_MIN_BUFFER_TIME=8,MediaPlayer.dependencies.BufferExtensions.BUFFER_TIME_AT_TOP_QUALITY=30,MediaPlayer.dependencies.BufferExtensions.BUFFER_TIME_AT_TOP_QUALITY_LONG_FORM=300,MediaPlayer.dependencies.BufferExtensions.LONG_FORM_CONTENT_DURATION_THRESHOLD=600,MediaPlayer.dependencies.BufferExtensions.prototype.constructor=MediaPlayer.dependencies.BufferExtensions,MediaPlayer.utils.Capabilities=function(){"use strict"},MediaPlayer.utils.Capabilities.prototype={constructor:MediaPlayer.utils.Capabilities,supportsMediaSource:function(){"use strict";var e="WebKitMediaSource"in window,t="MediaSource"in window;return e||t},supportsMediaKeys:function(){"use strict";var e="WebKitMediaKeys"in window,t="MSMediaKeys"in window,n="MediaKeys"in window;return e||t||n},supportsCodec:function(e,t){"use strict";if(!(e instanceof HTMLVideoElement))throw"element must be of type HTMLVideoElement.";var n=e.canPlayType(t);return"probably"===n}},MediaPlayer.utils.Debug=function(){"use strict";var e=!0;return{eventBus:void 0,setLogToBrowserConsole:function(t){e=t},getLogToBrowserConsole:function(){return e},log:function(t){e&&console.log(t),this.eventBus.dispatchEvent({type:"log",message:t})}}},MediaPlayer.dependencies.ErrorHandler=function(){"use strict";return{eventBus:void 0,capabilityError:function(e){this.eventBus.dispatchEvent({type:"error",error:"capability",event:e})},downloadError:function(e,t,n){this.eventBus.dispatchEvent({type:"error",error:"download",event:{id:e,url:t,request:n}})},manifestError:function(e,t,n){this.eventBus.dispatchEvent({type:"error",error:"manifestError",event:{message:e,id:t,manifest:n}})},mediaSourceError:function(e){this.eventBus.dispatchEvent({type:"error",error:"mediasource",event:e})},mediaKeySessionError:function(e){this.eventBus.dispatchEvent({type:"error",error:"key_session",event:e})},mediaKeyMessageError:function(e){this.eventBus.dispatchEvent({type:"error",error:"key_message",event:e})},mediaKeySystemSelectionError:function(e){this.eventBus.dispatchEvent({type:"error",error:"key_system_selection",event:e})}}},MediaPlayer.dependencies.ErrorHandler.prototype={constructor:MediaPlayer.dependencies.ErrorHandler},MediaPlayer.utils.EventBus=function(){"use strict";var e,t=function(t,n){var r=(n?"1":"0")+t;return r in e||(e[r]=[]),e[r]},n=function(){e={}};return n(),{addEventListener:function(e,n,r){var i=t(e,r),o=i.indexOf(n);-1===o&&i.push(n)},removeEventListener:function(e,n,r){var i=t(e,r),o=i.indexOf(n);-1!==o&&i.splice(o,1)},dispatchEvent:function(e){for(var n=t(e.type,!1).slice(),r=0;r<n.length;r++)n[r].call(this,e);return!e.defaultPrevented}}},MediaPlayer.dependencies.FragmentController=function(){"use strict";var e=[],t=function(t){for(var n=e.length,r=0;n>r;r++)if(e[r].getContext()==t)return e[r];return null},n=function(){for(var t=!0,n=e.length,r=0;n>r;r++)if(!e[r].isReady()){t=!1;break}return t},r=function(){for(var t=0;t<e.length;t++)e[t].executeCurrentRequest()};return{system:void 0,debug:void 0,process:function(e){var t=null;return null!==e&&void 0!==e&&e.byteLength>0&&(t=new Uint8Array(e)),Q.when(t)},attachBufferController:function(n){if(!n)return null;var r=t(n);return r||(r=this.system.getObject("fragmentModel"),r.setContext(n),e.push(r)),r},detachBufferController:function(t){var n=e.indexOf(t);n>-1&&e.splice(n,1)},onBufferControllerStateChange:function(){n()&&r.call(this)},isFragmentLoadedOrPending:function(e,n){var r,i=t(e);return i?r=i.isFragmentLoadedOrPending(n):!1},getPendingRequests:function(e){var n=t(e);return n?n.getPendingRequests():null},getLoadingRequests:function(e){var n=t(e);return n?n.getLoadingRequests():null},isInitializationRequest:function(e){return e&&e.type&&"initialization segment"===e.type.toLowerCase()},getLoadingTime:function(e){var n=t(e);return n?n.getLoadingTime():null},getExecutedRequestForTime:function(e,t){return e?e.getExecutedRequestForTime(t):null},removeExecutedRequest:function(e,t){e&&e.removeExecutedRequest(t)},removeExecutedRequestsBeforeTime:function(e,t){e&&e.removeExecutedRequestsBeforeTime(t)},cancelPendingRequestsForModel:function(e){e&&e.cancelPendingRequests()},abortRequestsForModel:function(e){e&&e.abortRequests()},prepareFragmentForLoading:function(e,n,r,i,o,a){var s=t(e);return s&&n&&!this.isFragmentLoadedOrPending(e,n)?(s.addRequest(n),s.setCallbacks(r,i,o,a),Q.when(!0)):Q.when(null)}}},MediaPlayer.dependencies.FragmentController.prototype={constructor:MediaPlayer.dependencies.FragmentController},MediaPlayer.dependencies.FragmentLoader=function(){"use strict";var e=3,t=500,n=[],r=function(e,i){var o=new XMLHttpRequest,a=null,s=!0,u=!0,l=this;n.push(o),e.requestStartDate=new Date,e.firstByteDate=e.requestStartDate,o.open("GET",e.url,!0),o.responseType="arraybuffer",e.range&&o.setRequestHeader("Range","bytes="+e.range),o.onprogress=function(t){s&&(s=!1,(!t.lengthComputable||t.lengthComputable&&t.total!=t.loaded)&&(e.firstByteDate=new Date))},o.onload=function(){if(!(o.status<200||o.status>299)){u=!1,e.requestEndDate=new Date;var t=e.requestEndDate,n=o.response,r=e.firstByteDate.getTime()-e.requestStartDate.getTime(),i=e.requestEndDate.getTime()-e.firstByteDate.getTime(),s=e.requestEndDate.getTime()-e.requestStartDate.getTime();l.debug.log("segment loaded: ("+o.status+", "+r+"ms, "+i+"ms, "+s+"ms) "+e.url),a=l.metricsModel.addHttpRequest(e.streamType,null,e.type,e.url,null,e.range,e.requestStartDate,e.firstByteDate,e.requestEndDate,o.status,null,e.duration),l.metricsModel.appendHttpTrace(a,t,(new Date).getTime()-t.getTime(),[n.byteLength]),e.deferred.resolve({data:n,request:e})}},o.onloadend=o.onerror=function(){if(-1!==n.indexOf(o)&&(n.splice(n.indexOf(o),1),u)){u=!1,e.requestEndDate=new Date;var s=e.firstByteDate.getTime()-e.requestStartDate.getTime(),d=e.requestEndDate.getTime()-e.firstByteDate.getTime(),c=e.requestEndDate.getTime()-e.requestStartDate.getTime();l.debug.log("segment loaded: ("+o.status+", "+s+"ms, "+d+"ms, "+c+"ms) "+e.url),a=l.metricsModel.addHttpRequest(e.streamType,null,e.type,e.url,null,e.range,e.requestStartDate,e.firstByteDate,e.requestEndDate,o.status,null,e.duration),i>0?(l.debug.log("Failed loading segment: "+e.url+", retry in "+t+"ms attempts: "+i),i--,setTimeout(function(){r.call(l,e,i)},t)):(l.debug.log("Failed loading segment: "+e.url+" no retry attempts left"),l.errHandler.downloadError("content",e.url,o),e.deferred.reject(o))}},o.send()};return{metricsModel:void 0,errHandler:void 0,debug:void 0,load:function(t){return t?(t.deferred=Q.defer(),r.call(this,t,e),t.deferred.promise):Q.when(null)},abort:function(){var e,t,r=n.length;for(e=0;r>e;e+=1)t=n[e],n[e]=null,t.abort(),t=null;n=[]}}},MediaPlayer.dependencies.FragmentLoader.prototype={constructor:MediaPlayer.dependencies.FragmentLoader},MediaPlayer.dependencies.FragmentModel=function(){"use strict";var e,t,n,r,i,o=[],a=[],s=[],u=5,l=function(i){var a,u=this;t.call(e,i),a=function(t,r){s.splice(s.indexOf(t),1),o.push(t),n.call(e,t,r),t.deferred=null},u.fragmentLoader.load(i).then(a.bind(e,i),r.bind(e,i))},d=function(e,t){var n=function(e,n){return e[t]<n[t]?-1:e[t]>n[t]?1:0};e.sort(n)},c=function(e,t){var n,r,i=e.length-1;for(r=i;r>=0;r-=1)if(n=e[r],n.url===t.url&&n.startTime===t.startTime)return!0;return!1},f=function(e){var t=o.indexOf(e);-1!==t&&o.splice(t,1)};return{system:void 0,debug:void 0,fragmentLoader:void 0,setContext:function(t){e=t},getContext:function(){return e},addRequest:function(e){e&&(a.push(e),d.call(this,a,"index"))},setCallbacks:function(e,o,a,s){t=e,i=s,r=a,n=o},isFragmentLoadedOrPending:function(e){for(var t,n=this,r=!1,i=o.length-1,u=i;u>=0;u-=1)if(t=o[u],e.startTime===t.startTime||"complete"===t.action&&e.action===t.action){if(n.debug.log(e.streamType+" Fragment already loaded for time: "+e.startTime),e.url===t.url){n.debug.log(e.streamType+" Fragment url already loaded: "+e.url),r=!0;break}f(e)}return r||(r=c.call(n,a,e)||c.call(n,s,e)),r},isReady:function(){return e.isReady()},getPendingRequests:function(){return a},getLoadingRequests:function(){return s},getLoadingTime:function(){var e,t,n=0;for(t=o.length-1;t>=0;t-=1)if(e=o[t],e.requestEndDate instanceof Date&&e.firstByteDate instanceof Date){n=e.requestEndDate.getTime()-e.firstByteDate.getTime();break}return n},getExecutedRequestForTime:function(e){var t,n=o.length-1,r=NaN,i=NaN,a=null;for(t=n;t>=0;t-=1)if(a=o[t],r=a.startTime,i=r+a.duration,!isNaN(r)&&!isNaN(i)&&e>r&&i>e)return a;return null},removeExecutedRequest:function(e){f.call(this,e)},removeExecutedRequestsBeforeTime:function(e){var t,n=o.length-1,r=NaN,i=null;for(t=n;t>=0;t-=1)i=o[t],r=i.startTime,!isNaN(r)&&e>r&&f.call(this,i)},cancelPendingRequests:function(){a=[]},abortRequests:function(){this.fragmentLoader.abort(),s=[]},executeCurrentRequest:function(){var t,n=this;if(0!==a.length&&!(s.length>=u))switch(t=a.shift(),t.action){case"complete":o.push(t),i.call(e,t);break;case"download":s.push(t),l.call(n,t);break;default:this.debug.log("Unknown request action.")}}}},MediaPlayer.dependencies.FragmentModel.prototype={constructor:MediaPlayer.dependencies.FragmentModel},MediaPlayer.dependencies.ManifestLoader=function(){"use strict";var e=3,t=500,n=null,r=function(e){var t=null;return-1!==e.indexOf("/")&&(t=e.substring(0,e.lastIndexOf("/")+1)),t},i=function(e,o){var a=r(e),s=new XMLHttpRequest,u=new Date,l=!0,d=this;this.debug.log("Start loading manifest: "+e),s.open("GET",e,!0),s.onload=function(){s.status<200||s.status>299||(l=!1,d.metricsModel.addHttpRequest("stream",null,"MPD",e,null,null,u,new Date,s.status,null,null),d.parser.parse(s.responseText,a).then(function(t){t.mpdUrl=e,n.resolve(t)},function(){n.reject(s)}))},s.onloadend=s.onerror=function(){l&&(l=!1,d.metricsModel.addHttpRequest("stream",null,"MPD",e,null,null,u,new Date,s.status,null,null),o>0?(d.debug.log("Failed loading manifest: "+e+", retry in "+t+"ms attempts: "+o),o--,setTimeout(function(){i.call(d,e,o)},t)):(d.debug.log("Failed loading manifest: "+e+" no retry attempts left"),d.errHandler.downloadError("manifest",e,s),n.reject(s)))},s.send()};return{debug:void 0,parser:void 0,errHandler:void 0,metricsModel:void 0,load:function(t){return n=Q.defer(),i.call(this,t,e),n.promise}}},MediaPlayer.dependencies.ManifestLoader.prototype={constructor:MediaPlayer.dependencies.ManifestLoader},MediaPlayer.models.ManifestModel=function(){"use strict";var e;return{getValue:function(){return e},setValue:function(t){e=t}}},MediaPlayer.models.ManifestModel.prototype={constructor:MediaPlayer.models.ManifestModel},MediaPlayer.dependencies.ManifestUpdater=function(){"use strict";var e=NaN,t=null,n=null,r=function(){null!==t&&(clearInterval(t),t=null)},i=function(){r.call(this),isNaN(e)||(this.debug.log("Refresh manifest in "+e+" seconds."),t=setInterval(n.bind(this),1e3*e,this))},o=function(){var t=this,n=t.manifestModel.getValue();void 0!==n&&null!==n&&t.manifestExt.getRefreshDelay(n).then(function(n){e=n,i.call(t)})};return n=function(){var e=this,t=e.manifestModel.getValue(),n=t.mpdUrl;t.hasOwnProperty("Location")&&(n=t.Location),e.debug.log("Refresh manifest @ "+n),e.manifestLoader.load(n).then(function(t){e.manifestModel.setValue(t),e.debug.log("Manifest has been refreshed."),e.debug.log(t),o.call(e),e.system.notify("manifestUpdated")})},{debug:void 0,system:void 0,manifestModel:void 0,manifestExt:void 0,manifestLoader:void 0,setup:function(){o.call(this)},init:function(){o.call(this)},stop:function(){r.call(this)}}},MediaPlayer.dependencies.ManifestUpdater.prototype={constructor:MediaPlayer.dependencies.ManifestUpdater},MediaPlayer.dependencies.MediaSourceExtensions=function(){"use strict"},MediaPlayer.dependencies.MediaSourceExtensions.prototype={constructor:MediaPlayer.dependencies.MediaSourceExtensions,createMediaSource:function(){"use strict";var e="WebKitMediaSource"in window,t="MediaSource"in window;return t?Q.when(new MediaSource):e?Q.when(new WebKitMediaSource):null},attachMediaSource:function(e,t){"use strict";return t.setSource(window.URL.createObjectURL(e)),Q.when(!0)},detachMediaSource:function(e){"use strict";return e.setSource(""),Q.when(!0)},setDuration:function(e,t){"use strict";return e.duration=t,Q.when(e.duration)},signalEndOfStream:function(e){"use strict";return e.endOfStream(),Q.when(!0)}},MediaPlayer.models.MetricsModel=function(){"use strict";return{system:void 0,streamMetrics:{},clearCurrentMetricsForType:function(e){delete this.streamMetrics[e]},clearAllCurrentMetrics:function(){this.streamMetrics={}},getReadOnlyMetricsFor:function(e){return this.streamMetrics.hasOwnProperty(e)?this.streamMetrics[e]:null},getMetricsFor:function(e){var t;return this.streamMetrics.hasOwnProperty(e)?t=this.streamMetrics[e]:(t=this.system.getObject("metrics"),this.streamMetrics[e]=t),t},addTcpConnection:function(e,t,n,r,i,o){var a=new MediaPlayer.vo.metrics.TCPConnection;return a.tcpid=t,a.dest=n,a.topen=r,a.tclose=i,a.tconnect=o,this.getMetricsFor(e).TcpList.push(a),a},addHttpRequest:function(e,t,n,r,i,o,a,s,u,l,d,c){var f=new MediaPlayer.vo.metrics.HTTPRequest;return f.tcpid=t,f.type=n,f.url=r,f.actualurl=i,f.range=o,f.trequest=a,f.tresponse=s,f.tfinish=u,f.responsecode=l,f.interval=d,f.mediaduration=c,this.getMetricsFor(e).HttpList.push(f),f},appendHttpTrace:function(e,t,n,r){var i=new MediaPlayer.vo.metrics.HTTPRequest.Trace;return i.s=t,i.d=n,i.b=r,e.trace.push(i),i},addRepresentationSwitch:function(e,t,n,r,i){var o=new MediaPlayer.vo.metrics.RepresentationSwitch;return o.t=t,o.mt=n,o.to=r,o.lto=i,this.getMetricsFor(e).RepSwitchList.push(o),o},addBufferLevel:function(e,t,n){var r=new MediaPlayer.vo.metrics.BufferLevel;return r.t=t,r.level=n,this.getMetricsFor(e).BufferLevel.push(r),r},addPlayList:function(e,t,n,r){var i=new MediaPlayer.vo.metrics.PlayList;return i.start=t,i.mstart=n,i.starttype=r,this.getMetricsFor(e).PlayList.push(i),i},appendPlayListTrace:function(e,t,n,r,i,o,a,s){var u=new MediaPlayer.vo.metrics.PlayList.Trace;return u.representationid=t,u.subreplevel=n,u.start=r,u.mstart=i,u.duration=o,u.playbackspeed=a,u.stopreason=s,e.trace.push(u),u}}},MediaPlayer.models.MetricsModel.prototype={constructor:MediaPlayer.models.MetricsModel},MediaPlayer.dependencies.ProtectionController=function(){"use strict";var e=null,t=null,n=function(e){var t=this;t.protectionModel.removeKeySystem(e)},r=function(e,n){for(var r=this,i=0;i<t.length;++i)for(var o=0;o<n.length;++o)if(t[i].isSupported(n[o])&&r.protectionExt.supportsCodec(t[i].keysTypeString,e)){
  var a=r.manifestExt.getKID(n[o]);return a||(a="unknown"),r.protectionModel.addKeySystem(a,n[o],t[i]),r.debug.log("DRM: Selected Key System: "+t[i].keysTypeString+" For KID: "+a),a}throw new Error("DRM: The protection system for this content is not supported.")},i=function(e,t,n){var r=this,i=null,o=null;r.protectionModel.needToAddKeySession(e)&&(o=r.protectionModel.getInitData(e),!o&&n?(o=n,r.debug.log("DRM: Using initdata from needskey event. length: "+o.length)):o&&r.debug.log("DRM: Using initdata from prheader in mpd. length: "+o.length),o?(i=r.protectionModel.addKeySession(e,t,o),r.debug.log("DRM: Added Key Session ["+i.sessionId+"] for KID: "+e+" type: "+t+" initData length: "+o.length)):r.debug.log("DRM: initdata is null."))},o=function(e,t,n,r){var i,o=this;return i=o.protectionModel.updateFromMessage(e,n,r),i.then(function(e){t.update(e)}),i};return{system:void 0,debug:void 0,manifestExt:void 0,capabilities:void 0,videoModel:void 0,protectionModel:void 0,protectionExt:void 0,setup:function(){t=this.protectionExt.getKeySystems()},init:function(t,n){this.videoModel=t,this.protectionModel=n,e=this.videoModel.getElement()},selectKeySystem:r,ensureKeySession:i,updateFromMessage:o,teardownKeySystem:n}},MediaPlayer.dependencies.ProtectionController.prototype={constructor:MediaPlayer.dependencies.ProtectionController},MediaPlayer.dependencies.ProtectionExtensions=function(){"use strict"},MediaPlayer.dependencies.ProtectionExtensions.prototype={constructor:MediaPlayer.dependencies.ProtectionExtensions,supportsCodec:function(e,t){"use strict";var n="WebKitMediaKeys"in window,r="MSMediaKeys"in window,i="MediaKeys"in window;return i?MediaKeys.isTypeSupported(e,t):n?WebKitMediaKeys.isTypeSupported(e,t):r?MSMediaKeys.isTypeSupported(e,t):!1},createMediaKeys:function(e){"use strict";var t="WebKitMediaKeys"in window,n="MSMediaKeys"in window,r="MediaKeys"in window;return r?new MediaKeys(e):t?new WebKitMediaKeys(e):n?new MSMediaKeys(e):null},setMediaKey:function(e,t){var n="WebKitSetMediaKeys"in e,r="msSetMediaKeys"in e,i="SetMediaKeys"in e;return i?e.SetMediaKeys(t):n?e.WebKitSetMediaKeys(t):r?e.msSetMediaKeys(t):void this.debug.log("no setmediakeys function in element")},createSession:function(e,t,n){return e.createSession(t,n)},getKeySystems:function(){var e=function(e,t){var n=Q.defer(),r=null,i=[],o=new DOMParser,a=o.parseFromString(e,"application/xml");if(!a.getElementsByTagName("Challenge")[0])return n.reject("DRM: playready update, can not find Challenge in keyMessage"),n.promise;var s=a.getElementsByTagName("Challenge")[0].childNodes[0].nodeValue;s&&(r=BASE64.decode(s));var u=a.getElementsByTagName("name"),l=a.getElementsByTagName("value");if(u.length!=l.length)return n.reject("DRM: playready update, invalid header name/value pair in keyMessage"),n.promise;for(var d=0;d<u.length;d++)i[d]={name:u[d].childNodes[0].nodeValue,value:l[d].childNodes[0].nodeValue};var c=new XMLHttpRequest;return c.onload=function(){200==c.status?n.resolve(new Uint8Array(c.response)):n.reject('DRM: playready update, XHR status is "'+c.statusText+'" ('+c.status+"), expected to be 200. readyState is "+c.readyState)},c.onabort=function(){n.reject('DRM: playready update, XHR aborted. status is "'+c.statusText+'" ('+c.status+"), readyState is "+c.readyState)},c.onerror=function(){n.reject('DRM: playready update, XHR error. status is "'+c.statusText+'" ('+c.status+"), readyState is "+c.readyState)},c.open("POST",t),c.responseType="arraybuffer",i&&i.forEach(function(e){c.setRequestHeader(e.name,e.value)}),c.send(r),n.promise},t=function(e,t){return null===e&&0===t.length},n=function(e){var t=0,n=0,r=0,i=new Uint8Array([112,115,115,104,0,0,0,0]),o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]),a=null,s=null,u=null,l=null;if("pro"in e)a=BASE64.decodeArray(e.pro.__text);else{if(!("prheader"in e))return null;a=BASE64.decodeArray(e.prheader.__text)}return n=a.length,r=4+i.length+o.length+4+n,s=new ArrayBuffer(r),u=new Uint8Array(s),l=new DataView(s),l.setUint32(t,r),t+=4,u.set(i,t),t+=i.length,u.set(o,t),t+=o.length,l.setUint32(t,n),t+=4,u.set(a,t),t+=n,u};return[{schemeIdUri:"urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95",keysTypeString:"com.microsoft.playready",isSupported:function(e){return this.schemeIdUri===e.schemeIdUri.toLowerCase()},needToAddKeySession:t,getInitData:n,getUpdate:e},{schemeIdUri:"urn:mpeg:dash:mp4protection:2011",keysTypeString:"com.microsoft.playready",isSupported:function(e){return this.schemeIdUri===e.schemeIdUri.toLowerCase()&&"cenc"===e.value.toLowerCase()},needToAddKeySession:t,getInitData:function(){return null},getUpdate:e},{schemeIdUri:"urn:uuid:00000000-0000-0000-0000-000000000000",keysTypeString:"webkit-org.w3.clearkey",isSupported:function(e){return this.schemeIdUri===e.schemeIdUri.toLowerCase()},needToAddKeySession:function(){return!0},getInitData:function(){return null},getUpdate:function(e){return Q.when(e)}}]},addKey:function(e,t,n,r,i){e.webkitAddKey(t,n,r,i)},generateKeyRequest:function(e,t,n){e.webkitGenerateKeyRequest(t,n)},listenToNeedKey:function(e,t){e.listen("webkitneedkey",t),e.listen("msneedkey",t),e.listen("needKey",t)},listenToKeyError:function(e,t){e.addEventListener("webkitkeyerror",t,!1),e.addEventListener("mskeyerror",t,!1),e.addEventListener("keyerror",t,!1)},listenToKeyMessage:function(e,t){e.addEventListener("webkitkeymessage",t,!1),e.addEventListener("mskeymessage",t,!1),e.addEventListener("keymessage",t,!1)},listenToKeyAdded:function(e,t){e.addEventListener("webkitkeyadded",t,!1),e.addEventListener("mskeyadded",t,!1),e.addEventListener("keyadded",t,!1)},unlistenToKeyError:function(e,t){e.removeEventListener("webkitkeyerror",t),e.removeEventListener("mskeyerror",t),e.removeEventListener("keyerror",t)},unlistenToKeyMessage:function(e,t){e.removeEventListener("webkitkeymessage",t),e.removeEventListener("mskeymessage",t),e.removeEventListener("keymessage",t)},unlistenToKeyAdded:function(e,t){e.removeEventListener("webkitkeyadded",t),e.removeEventListener("mskeyadded",t),e.removeEventListener("keyadded",t)}},MediaPlayer.models.ProtectionModel=function(){"use strict";var e=null,t=null,n=null,r=null,i=[];return{system:void 0,videoModel:void 0,protectionExt:void 0,setup:function(){e=this.videoModel.getElement()},init:function(t){this.videoModel=t,e=this.videoModel.getElement()},addKeySession:function(e,o,a){var s=null;return s=this.protectionExt.createSession(i[e].keys,o,a),this.protectionExt.listenToKeyAdded(s,t),this.protectionExt.listenToKeyError(s,n),this.protectionExt.listenToKeyMessage(s,r),i[e].initData=a,i[e].keySessions.push(s),s},addKeySystem:function(t,n,r){var o=null;o=this.protectionExt.createMediaKeys(r.keysTypeString),this.protectionExt.setMediaKey(e,o),i[t]={kID:t,contentProtection:n,keySystem:r,keys:o,initData:null,keySessions:[]}},removeKeySystem:function(e){if(null!==e&&void 0!==i[e]&&0!==i[e].keySessions.length){for(var o=i[e].keySessions,a=0;a<o.length;++a)this.protectionExt.unlistenToKeyError(o[a],n),this.protectionExt.unlistenToKeyAdded(o[a],t),this.protectionExt.unlistenToKeyMessage(o[a],r),o[a].close();i[e]=void 0}},needToAddKeySession:function(e){var t=null;return t=i[e],t.keySystem.needToAddKeySession(t.initData,t.keySessions)},getInitData:function(e){var t=null;return t=i[e],t.keySystem.getInitData(t.contentProtection)},updateFromMessage:function(e,t,n){return i[e].keySystem.getUpdate(t,n)},listenToNeedKey:function(e){this.protectionExt.listenToNeedKey(this.videoModel,e)},listenToKeyError:function(e){n=e;for(var t=0;t<i.length;++t)for(var r=i[t].keySessions,o=0;o<r.length;++o)this.protectionExt.listenToKeyError(r[o],e)},listenToKeyMessage:function(e){r=e;for(var t=0;t<i.length;++t)for(var n=i[t].keySessions,o=0;o<n.length;++o)this.protectionExt.listenToKeyMessage(n[o],e)},listenToKeyAdded:function(e){t=e;for(var n=0;n<i.length;++n)for(var r=i[n].keySessions,o=0;o<r.length;++o)this.protectionExt.listenToKeyAdded(r[o],e)}}},MediaPlayer.models.ProtectionModel.prototype={constructor:MediaPlayer.models.ProtectionModel},MediaPlayer.dependencies.RequestScheduler=function(){"use strict";var e=[],t=null,n=null,r=function(e,t){if(e&&t){var n=a(e);n||(n=i.call(this,e)),n.setIsScheduled(!0),n.setScheduledTask(t),l.call(this),t.call(e)}},i=function(t){if(!t)return null;var n=this.system.getObject("schedulerModel");return n.setContext(t),e.push(n),n},o=function(t){var n=e.indexOf(t);-1!==n&&e.splice(n,1)},a=function(t){for(var n=0;n<e.length;n++)if(e[n].getContext()===t)return e[n];return null},s=function(){u.call(this)},u=function(){for(var t,n=0;n<e.length;n++)t=e[n],t.getIsScheduled()&&t.executeScheduledTask()},l=function(){null===n&&(this.adjustExecuteInterval(),n=setInterval(s.bind(this),t))},d=function(t){var n=a(t);n&&(o(n),0===e.length&&c.call(this))},c=function(){clearInterval(n),n=null};return{system:void 0,debug:void 0,schedulerExt:void 0,isScheduled:function(e){var t=a(e);return!!t&&t.getIsScheduled()},getExecuteInterval:function(){return t},adjustExecuteInterval:function(){if(!(e.length<1)){var r=this.schedulerExt.getExecuteInterval(e[0].getContext());t!==r&&(t=r,null!==n&&(this.debug.log("Changing execute interval: "+t),clearInterval(n),n=setInterval(s.bind(this),t)))}},startScheduling:r,stopScheduling:d}},MediaPlayer.dependencies.RequestScheduler.prototype={constructor:MediaPlayer.dependencies.RequestScheduler},MediaPlayer.dependencies.SchedulerExtensions=function(){"use strict"},MediaPlayer.dependencies.SchedulerExtensions.prototype={constructor:MediaPlayer.dependencies.SchedulerExtensions,getExecuteInterval:function(e){var t=1e3;return"undefined"!=typeof e.getMinBufferTime&&(t=1e3*e.getMinBufferTime()/4,t=Math.max(t,1e3)),t}},MediaPlayer.dependencies.SchedulerModel=function(){"use strict";var e,t,n=!1;return{system:void 0,debug:void 0,schedulerExt:void 0,setContext:function(t){e=t},getContext:function(){return e},setScheduledTask:function(e){t=e},executeScheduledTask:function(){t.call(e)},setIsScheduled:function(e){n=e},getIsScheduled:function(){return n}}},MediaPlayer.dependencies.SchedulerModel.prototype={constructor:MediaPlayer.dependencies.SchedulerModel},MediaPlayer.dependencies.SourceBufferExtensions=function(){"use strict";this.system=void 0,this.manifestExt=void 0},MediaPlayer.dependencies.SourceBufferExtensions.prototype={constructor:MediaPlayer.dependencies.SourceBufferExtensions,createSourceBuffer:function(e,t){"use strict";var n=Q.defer(),r=this;try{n.resolve(e.addSourceBuffer(t))}catch(i){r.manifestExt.getIsTextTrack(t)?n.resolve(r.system.getObject("textVTTSourceBuffer")):n.reject(i.description)}return n.promise},removeSourceBuffer:function(e,t){"use strict";var n=Q.defer();try{n.resolve(e.removeSourceBuffer(t))}catch(r){n.reject(r.description)}return n.promise},getBufferRange:function(e,t,n){"use strict";var r,i,o=null,a=0,s=0,u=null,l=null,d=0,c=n||.15;try{o=e.buffered}catch(f){return Q.when(null)}if(null!==o){for(i=0,r=o.length;r>i;i+=1)if(a=o.start(i),s=o.end(i),null===u){if(d=Math.abs(a-t),t>=a&&s>t){u=a,l=s;continue}if(c>=d){u=a,l=s;continue}}else{if(d=a-l,!(c>=d))break;l=s}if(null!==u)return Q.when({start:u,end:l})}return Q.when(null)},getAllRanges:function(e){var t=null;try{return t=e.buffered,Q.when(t)}catch(n){return Q.when(null)}},getBufferLength:function(e,t,n){"use strict";var r=this,i=Q.defer();return r.getBufferRange(e,t,n).then(function(e){null===e?i.resolve(0):i.resolve(e.end-t)}),i.promise},waitForUpdateEnd:function(e){"use strict";var t,n=Q.defer(),r=50,i=function(){e.updating||(clearInterval(t),n.resolve(!0))},o=function(){e.removeEventListener("updateend",o,!1),n.resolve(!0)};if(e.hasOwnProperty("addEventListener"))try{e.addEventListener("updateend",o,!1)}catch(a){t=setInterval(i,r)}else t=setInterval(i,r);return n.promise},append:function(e,t){var n=Q.defer();try{"append"in e?e.append(t):"appendBuffer"in e&&e.appendBuffer(t),this.waitForUpdateEnd(e).then(function(){n.resolve()})}catch(r){n.reject({err:r,data:t})}return n.promise},remove:function(e,t,n,r,i){var o=Q.defer();try{t>=0&&r>t&&n>t&&"ended"!==i.readyState&&e.remove(t,n),this.waitForUpdateEnd(e).then(function(){o.resolve()})}catch(a){o.reject(a)}return o.promise},abort:function(e,t){"use strict";var n=Q.defer();try{"open"===e.readyState&&t.abort(),n.resolve()}catch(r){n.reject(r.description)}return n.promise}},MediaPlayer.dependencies.Stream=function(){"use strict";var e,t,n,r,i,o,a,s,u,l,d,c,f,g,h,p,m=null,y=null,v=null,M=null,b=-1,E=null,S=-1,w=null,P=-1,T=!0,R=!1,_=!1,L=null,x=[],O=-1,D=null,C=function(){this.debug.log("Attempting play..."),R&&(this.debug.log("Do play."),this.videoModel.play())},A=function(){this.debug.log("Do pause."),this.videoModel.pause()},N=function(e){this.debug.log("Attempting seek..."),R&&(this.debug.log("Do seek: "+e),this.system.notify("setCurrentTime"),this.videoModel.setCurrentTime(e),M&&M.seek(e),E&&E.seek(e))},B=function(e){var t,n=this;if(t="msneedkey"!==e.type?e.type:m,x.push({type:t,initData:e.initData}),this.debug.log("DRM: Key required for - "+t),v&&m&&!L)try{L=n.protectionController.selectKeySystem(m,v)}catch(r){A.call(n),n.debug.log(r),n.errHandler.mediaKeySystemSelectionError(r)}L&&n.protectionController.ensureKeySession(L,t,e.initData)},I=function(e){var t=this,n=null,r=null,i=null,o=null;this.debug.log("DRM: Got a key message..."),n=e.target,r=new Uint16Array(e.message.buffer),i=String.fromCharCode.apply(null,r),o=e.destinationURL,t.protectionController.updateFromMessage(L,n,i,o).fail(function(e){A.call(t),t.debug.log(e),t.errHandler.mediaKeyMessageError(e)})},q=function(){this.debug.log("DRM: Key added.")},k=function(){var e,t=event.target;switch(e="DRM: MediaKeyError - sessionId: "+t.sessionId+" errorCode: "+t.error.code+" systemErrorCode: "+t.error.systemCode+" [",t.error.code){case 1:e+="MEDIA_KEYERR_UNKNOWN - An unspecified error occurred. This value is used for errors that don't match any of the other codes.";break;case 2:e+="MEDIA_KEYERR_CLIENT - The Key System could not be installed or updated.";break;case 3:e+="MEDIA_KEYERR_SERVICE - The message passed into update indicated an error from the license service.";break;case 4:e+="MEDIA_KEYERR_OUTPUT - There is no available output device with the required characteristics for the content protection system.";break;case 5:e+="MEDIA_KEYERR_HARDWARECHANGE - A hardware configuration change caused a content protection error.";break;case 6:e+="MEDIA_KEYERR_DOMAIN - An error occurred in a multi-device domain licensing configuration. The most common error is a failure to join the domain."}e+="]",this.debug.log(e),this.errHandler.mediaKeySessionError(e)},F=function(e){var t=Q.defer(),n=this,r=function(i){n.debug.log("MediaSource is open!"),n.debug.log(i),e.removeEventListener("sourceopen",r),e.removeEventListener("webkitsourceopen",r),t.resolve(e)};return n.debug.log("MediaSource should be closed. The actual readyState is: "+e.readyState),e.addEventListener("sourceopen",r,!1),e.addEventListener("webkitsourceopen",r,!1),n.mediaSourceExt.attachMediaSource(e,n.videoModel),n.debug.log("MediaSource attached to video.  Waiting on open..."),t.promise},U=function(){var n=this;M&&M.reset(_),E&&E.reset(_),t&&n.mediaSourceExt.detachMediaSource(n.videoModel),R=!1,L=null,x=[],v=null,M=null,E=null,w=null,m=null,y=null,t=null,e=null},j=function(t,n,r,i){if(t&&n&&r)if(null===M&&null===E&&null===w){var o="No streams to play.";this.errHandler.manifestError(o,"nostreams",e),this.debug.log(o),i.reject()}else this.debug.log("MediaSource initialized!"),i.resolve(!0)},H=function(){this.debug.log("Getting MediaSource ready...");var e=Q.defer(),n=!1,r=!1,i=!1,o=this,a=o.manifestModel.getValue(),s=o.manifestExt.getIsLive(a);return o.debug.log("Gathering information for buffers. (1)"),o.manifestExt.getDuration(a,s).then(function(){o.manifestExt.getVideoData(a,O).then(function(s){return null!==s?(o.debug.log("Create video buffer."),o.manifestExt.getDataIndex(s,a,O).then(function(e){b=e,o.debug.log("Save video track: "+b)}),o.manifestExt.getCodec(s).then(function(e){return o.debug.log("Video codec: "+e),m=e,o.manifestExt.getContentProtectionData(s).then(function(n){if(o.debug.log("Video contentProtection"),n&&!o.capabilities.supportsMediaKeys())return o.errHandler.capabilityError("mediakeys"),Q.when(null);if(v=n,!o.capabilities.supportsCodec(o.videoModel.getElement(),e)){var r="Video Codec ("+e+") is not supported.";return o.errHandler.manifestError(r,"codec",a),o.debug.log(r),Q.when(null)}return o.sourceBufferExt.createSourceBuffer(t,e)})}).then(function(a){null===a?o.debug.log("No buffer was created, skipping video stream."):(M=o.system.getObject("bufferController"),M.initialize("video",O,s,a,o.videoModel,o.requestScheduler,o.fragmentController,t),o.debug.log("Video is ready!")),n=!0,j.call(o,n,r,i,e)},function(){o.errHandler.mediaSourceError("Error creating video source buffer."),n=!0,j.call(o,n,r,i,e)})):(o.debug.log("No video data."),n=!0,j.call(o,n,r,i,e)),o.manifestExt.getAudioDatas(a,O)}).then(function(s){return null!==s&&s.length>0?(o.debug.log("Have audio streams: "+s.length),o.manifestExt.getPrimaryAudioData(a,O).then(function(s){o.manifestExt.getDataIndex(s,a,O).then(function(e){S=e,o.debug.log("Save audio track: "+S)}),o.manifestExt.getCodec(s).then(function(e){return o.debug.log("Audio codec: "+e),y=e,o.manifestExt.getContentProtectionData(s).then(function(n){if(o.debug.log("Audio contentProtection"),n&&!o.capabilities.supportsMediaKeys())return o.errHandler.capabilityError("mediakeys"),Q.when(null);if(v=n,!o.capabilities.supportsCodec(o.videoModel.getElement(),e)){var r="Audio Codec ("+e+") is not supported.";return o.errHandler.manifestError(r,"codec",a),o.debug.log(r),Q.when(null)}return o.sourceBufferExt.createSourceBuffer(t,e)})}).then(function(a){null===a?o.debug.log("No buffer was created, skipping audio stream."):(E=o.system.getObject("bufferController"),E.initialize("audio",O,s,a,o.videoModel,o.requestScheduler,o.fragmentController,t),o.debug.log("Audio is ready!")),r=!0,j.call(o,n,r,i,e)},function(){o.errHandler.mediaSourceError("Error creating audio source buffer."),r=!0,j.call(o,n,r,i,e)})})):(o.debug.log("No audio streams."),r=!0,j.call(o,n,r,i,e)),o.manifestExt.getTextData(a,O)}).then(function(s){var u;null!==s?(o.manifestExt.getDataIndex(s,a,O).then(function(e){P=e,o.debug.log("Save text track: "+P)}),o.manifestExt.getMimeType(s).then(function(e){return u=e,o.sourceBufferExt.createSourceBuffer(t,u)}).then(function(t){null===t?o.debug.log("Source buffer was not created for text track"):(w=o.system.getObject("textController"),w.initialize(O,s,t,o.videoModel),t.hasOwnProperty("initialize")&&t.initialize(u,w),o.debug.log("Text is ready!"),i=!0,j.call(o,n,r,i,e))},function(t){o.debug.log("Error creating text source buffer:"),o.debug.log(t),o.errHandler.mediaSourceError("Error creating text source buffer."),i=!0,j.call(o,n,r,i,e)})):(o.debug.log("No text tracks."),i=!0,j.call(o,n,r,i,e))})}),e.promise},V=function(){var e=this,n=Q.defer(),r=e.manifestModel.getValue(),i=e.manifestExt.getIsLive(r);return e.debug.log("Getting ready for playback..."),e.manifestExt.getDurationForPeriod(O,e.manifestModel.getValue(),i).then(function(e){c=e}),e.manifestExt.getDuration(e.manifestModel.getValue(),i).then(function(n){return e.debug.log("Setting duration: "+n),e.mediaSourceExt.setDuration(t,n)}).then(function(){return e.debug.log("Duration successfully set."),e.manifestExt.getPeriodStart(e.manifestModel.getValue(),O)}).then(function(e){D=e,R=!0,n.resolve(!0)}),n.promise},K=function(){var e=this;e.debug.log("Got loadmetadata event."),n.resolve(null)},W=function(){this.debug.log("Got play event."),R&&(null!==D?(this.debug.log("Starting segment loading at offset: "+D),M&&M.seek(D),E&&E.seek(D),w&&w.seek(D)):(M&&M.start(),E&&E.start(),w&&w.start()))},G=function(){this.debug.log("Got pause event."),this.scheduleWhilePaused||ee.call(this)},z=function(e){var t=e.srcElement.error,n=t.code,r="";if(-1!==n){switch(n){case 1:r="MEDIA_ERR_ABORTED";break;case 2:r="MEDIA_ERR_NETWORK";break;case 3:r="MEDIA_ERR_DECODE";break;case 4:r="MEDIA_ERR_SRC_NOT_SUPPORTED";break;case 5:r="MEDIA_ERR_ENCRYPTED"}_=!0,this.debug.log("Video Element Error: "+r),this.debug.log(t),this.errHandler.mediaSourceError(r),this.reset()}},X=function(){this.debug.log("Got seeking event.");var e=this.videoModel.getCurrentTime();M&&M.seek(e),E&&E.seek(e)},Z=function(){this.debug.log("Seek complete."),this.videoModel.listen("seeking",s),this.videoModel.unlisten("seeked",u)},Y=function(){J.call(this)},$=function(){J.call(this)},J=function(){M&&M.updateBufferState(),E&&E.updateBufferState()},ee=function(){M&&M.stop(),E&&E.stop()},te=function(r){var i=this;return i.debug.log("Stream start loading."),e=r,i.mediaSourceExt.createMediaSource().then(function(e){return i.debug.log("MediaSource created."),F.call(i,e)}).then(function(e){return t=e,i.debug.log("MediaSource set up."),H.call(i)}).then(function(){return i.debug.log("Start initializing playback."),V.call(i)}).then(function(){return T?(i.debug.log("Playback initialized!"),n.promise):void 0}).then(function(){i.debug.log("element loaded!"),0===O&&C.call(i)})},ne=function(){this.debug.log("Current time has changed, block programmatic seek."),this.videoModel.unlisten("seeking",s),this.videoModel.listen("seeked",u)},re=function(){M&&!M.isBufferingCompleted()||E&&!E.isBufferingCompleted()||t&&this.mediaSourceExt.signalEndOfStream(t)},ie=function(){ee.call(this)},oe=function(){var e,t,n=this,r=n.manifestModel.getValue();n.debug.log("Manifest updated... set new data on buffers."),M&&(e=M.getData(),e&&e.hasOwnProperty("id")?n.manifestExt.getDataForId(e.id,r,O).then(function(e){M.setData(e)}):n.manifestExt.getDataForIndex(b,r,O).then(function(e){M.setData(e)})),E&&(t=E.getData(),t&&t.hasOwnProperty("id")?n.manifestExt.getDataForId(t.id,r,O).then(function(e){E.setData(e)}):n.manifestExt.getDataForIndex(S,r,O).then(function(e){E.setData(e)}))};return{system:void 0,videoModel:void 0,manifestLoader:void 0,manifestModel:void 0,mediaSourceExt:void 0,sourceBufferExt:void 0,bufferExt:void 0,manifestExt:void 0,fragmentController:void 0,abrController:void 0,fragmentExt:void 0,protectionModel:void 0,protectionController:void 0,protectionExt:void 0,capabilities:void 0,debug:void 0,metricsExt:void 0,errHandler:void 0,requestScheduler:void 0,scheduleWhilePaused:void 0,setup:function(){this.system.mapHandler("manifestUpdated",void 0,oe.bind(this)),this.system.mapHandler("setCurrentTime",void 0,ne.bind(this)),this.system.mapHandler("bufferingCompleted",void 0,re.bind(this)),this.system.mapHandler("segmentLoadingFailed",void 0,ie.bind(this)),n=Q.defer(),i=W.bind(this),o=G.bind(this),a=z.bind(this),s=X.bind(this),u=Z.bind(this),d=Y.bind(this),l=$.bind(this),r=K.bind(this)},load:function(e,t){O=t,te.call(this,e)},setVideoModel:function(e){this.videoModel=e,this.videoModel.listen("play",i),this.videoModel.listen("pause",o),this.videoModel.listen("error",a),this.videoModel.listen("seeking",s),this.videoModel.listen("timeupdate",l),this.videoModel.listen("progress",d),this.videoModel.listen("loadedmetadata",r)},initProtection:function(){f=B.bind(this),g=I.bind(this),h=q.bind(this),p=k.bind(this),this.protectionModel=this.system.getObject("protectionModel"),this.protectionModel.init(this.getVideoModel()),this.protectionController=this.system.getObject("protectionController"),this.protectionController.init(this.videoModel,this.protectionModel),this.protectionModel.listenToNeedKey(f),this.protectionModel.listenToKeyMessage(g),this.protectionModel.listenToKeyError(p),this.protectionModel.listenToKeyAdded(h)},getVideoModel:function(){return this.videoModel},getManifestExt:function(){var e=this;return e.manifestExt},setAutoPlay:function(e){T=e},getAutoPlay:function(){return T},reset:function(){A.call(this),this.videoModel.unlisten("play",i),this.videoModel.unlisten("pause",o),this.videoModel.unlisten("error",a),this.videoModel.unlisten("seeking",s),this.videoModel.unlisten("timeupdate",l),this.videoModel.unlisten("progress",d),this.videoModel.unlisten("loadedmetadata",r),U.call(this),this.protectionController&&this.protectionController.teardownKeySystem(L),this.protectionController=void 0,this.protectionModel=void 0,this.fragmentController=void 0,this.requestScheduler=void 0,n=Q.defer()},getDuration:function(){return c},setPeriodIndex:function(e){O=e},getPeriodIndex:function(){return O},getStartTime:function(){return D},play:C,seek:N,pause:A}},MediaPlayer.dependencies.Stream.prototype={constructor:MediaPlayer.dependencies.Stream},MediaPlayer.dependencies.StreamController=function(){"use strict";var e,t=[],n=4,r=3,i=!0,o=null,a=function(){e.play()},s=function(){e.pause()},u=function(t){e.seek(t)},l=function(e,t){var n=e.getElement(),r=t.getElement();return r.parentNode||n.parentNode.insertBefore(r,n),n.style.width="0px",r.style.width="100%",f(n,r),c(e),d(t),Q.when(!0)},d=function(e){e.listen("seeking",p),e.listen("progress",g),y()&&e.listen("timeupdate",h)},c=function(e){e.unlisten("seeking",p),e.unlisten("progress",g),e.unlisten("timeupdate",h)},f=function(e,t){["controls","loop","muted","playbackRate","volume"].forEach(function(n){t[n]=e[n]})},g=function(){var t=e.getVideoModel().getElement().buffered;if(t.length){var r=t.length-1,i=t.end(r),o=e.getStartTime()+e.getDuration()-i;n>o&&(e.getVideoModel().unlisten("progress",g),m())}},h=function(){if(!e.getVideoModel().getElement().seeking){var t=e.getStartTime()+e.getDuration(),n=e.getVideoModel().getCurrentTime();r>t-n&&E(e,y())}},p=function(){var t=e.getVideoModel().getCurrentTime(),n=v(t);n&&n!==e&&E(e,n,t)},m=function(){var e=y();e&&e.seek(e.getStartTime())},y=function(){var n=e.getPeriodIndex()+1;return n<t.length?t[n]:null},v=function(e){for(var n=0,r=null,i=0,o=t.length;o>i;i++)if(r=t[i],n+=r.getDuration(),n>e)return r},M=function(){var e=this.system.getObject("videoModel"),t=document.createElement("video");return e.setElement(t),e},b=function(e){e.parentNode&&e.parentNode.removeChild(e)},E=function(t,n,r){t&&n&&t!==n&&Q.when(o||!0).then(function(){t.pause(),e=n,o=l(t.getVideoModel(),n.getVideoModel()),u(r?t.getVideoModel().getCurrentTime():n.getStartTime()),a()})};return{system:void 0,videoModel:void 0,manifestLoader:void 0,manifestUpdater:void 0,manifestModel:void 0,mediaSourceExt:void 0,sourceBufferExt:void 0,bufferExt:void 0,manifestExt:void 0,fragmentController:void 0,abrController:void 0,fragmentExt:void 0,capabilities:void 0,debug:void 0,metricsExt:void 0,errHandler:void 0,getManifestExt:function(){return e.getManifestExt()},setAutoPlay:function(e){i=e},getAutoPlay:function(){return i},getVideoModel:function(){return this.videoModel},setVideoModel:function(e){this.videoModel=e},load:function(n){var r,o=this;o.manifestLoader.load(n).then(function(n){o.manifestModel.setValue(n),o.debug.log("Manifest has loaded."),o.debug.log(o.manifestModel.getValue()),o.manifestUpdater.init(),o.manifestExt.getPeriodCount(n).then(function(a){for(var s=0;a>s;s++)r=o.system.getObject("stream"),r.setVideoModel(0===s?o.videoModel:M.call(o)),r.initProtection(),r.setAutoPlay(i),r.load(n,s),t.push(r);e=t[0],d(e.getVideoModel())})},function(){o.reset()})},reset:function(){e&&c(e.getVideoModel());for(var n=0,r=t.length;r>n;n++){var i=t[n];i.reset(),i!==e&&b(i.getVideoModel().getElement())}t=[],this.manifestUpdater.stop(),this.manifestModel.setValue(null),o=null,e=null},play:a,seek:u,pause:s}},MediaPlayer.dependencies.StreamController.prototype={constructor:MediaPlayer.dependencies.StreamController},MediaPlayer.models.VideoModel=function(){"use strict";var e,t=[],n=function(){return t.length>0},r=function(n){null!==n&&t[n]!==!0&&(t.push(n),t[n]=!0,e.playbackRate=0)},i=function(r){if(null!==r){t[r]=!1;var i=t.indexOf(r);-1!==i&&t.splice(i,1),n()===!1&&(e.playbackRate=1)}},o=function(e,t){t?r(e):i(e)};return{system:void 0,setup:function(){},play:function(){e.play()},pause:function(){e.pause()},isPaused:function(){return e.paused},getPlaybackRate:function(){return e.playbackRate},setPlaybackRate:function(t){e.playbackRate=t},getCurrentTime:function(){return e.currentTime},setCurrentTime:function(t){e.currentTime!=t&&(e.currentTime=t)},listen:function(t,n){e.addEventListener(t,n,!1)},unlisten:function(t,n){e.removeEventListener(t,n,!1)},getElement:function(){return e},setElement:function(t){e=t},setSource:function(t){e.src=t},stallStream:o,isStalled:n}},MediaPlayer.models.VideoModel.prototype={constructor:MediaPlayer.models.VideoModel},MediaPlayer.dependencies.VideoModelExtensions=function(){"use strict";return{getDroppedFrames:function(e){var t=null!==e.webkitDroppedFrameCount,n=-1;return t&&(n=e.webkitDroppedFrameCount),n}}},MediaPlayer.dependencies.VideoModelExtensions.prototype={constructor:MediaPlayer.dependencies.VideoModelExtensions},MediaPlayer.dependencies.TextController=function(){var e,t,n="LOADING",r="READY",i=!1,o=-1,a=r,s=function(e){this.debug.log("TextController setState to:"+e),a=e},u=function(){if(i&&a===r){var t=this;s.call(t,n),t.indexHandler.getInitRequest(0,e).then(function(e){t.debug.log("Loading text track initialization: "+e.url),t.debug.log(e),t.fragmentLoader.load(e).then(d.bind(t,e),c.bind(t,e)),s.call(t,n)})}},l=function(){u.call(this)},d=function(e,n){var r=this;r.debug.log(" Text track Bytes finished loading: "+e.url),r.fragmentController.process(n.data).then(function(e){null!==e&&(r.debug.log("Push text track bytes: "+e.byteLength),r.sourceBufferExt.append(t,e,r.videoModel))})},c=function(){};return{videoModel:void 0,fragmentLoader:void 0,fragmentController:void 0,indexHandler:void 0,sourceBufferExt:void 0,debug:void 0,initialize:function(e,t,n,r){var o=this;o.setVideoModel(r),o.setPeriodIndex(e),o.setData(t),o.setBuffer(n),i=!0},getPeriodIndex:function(){return o},setPeriodIndex:function(e){o=e},getVideoModel:function(){return this.videoModel},setVideoModel:function(e){this.videoModel=e},getData:function(){return e},setData:function(t){e=t},getBuffer:function(){return t},setBuffer:function(e){t=e},reset:function(e,n){e||(this.sourceBufferExt.abort(n,t),this.sourceBufferExt.removeSourceBuffer(n,t))},start:l}},MediaPlayer.dependencies.TextController.prototype={constructor:MediaPlayer.dependencies.TextController},MediaPlayer.utils.TextTrackExtensions=function(){"use strict";return{addTextTrack:function(e,t,n,r,i){var o=e.addTextTrack("captions",n,r);o["default"]=i,o.mode="showing";for(var a in t){var s=t[a];o.addCue(new TextTrackCue(s.start,s.end,s.data))}return Q.when(o)},deleteCues:function(e){for(var t=e.textTracks[0],n=t.cues,r=n.length;r>=0;r--)t.removeCue(n[r]);t.mode="disabled"}}},MediaPlayer.dependencies.TextVTTSourceBuffer=function(){var e,t,n;return{system:void 0,eventBus:void 0,initialize:function(r,i){n=r,e=i.getVideoModel().getElement(),t=i.getData()},append:function(n){var r=this;r.getParser().parse(String.fromCharCode.apply(null,new Uint16Array(n))).then(function(n){var i=t.Representation_asArray[0].id,o=t.lang;r.getTextTrackExtensions().addTextTrack(e,n,i,o,!0).then(function(){r.eventBus.dispatchEvent({type:"updateend"})})})},abort:function(){this.getTextTrackExtensions().deleteCues(e)},getParser:function(){var e;return"text/vtt"===n&&(e=this.system.getObject("vttParser")),e},getTextTrackExtensions:function(){return this.system.getObject("textTrackExtensions")},addEventListener:function(e,t,n){this.eventBus.addEventListener(e,t,n)},removeEventListener:function(e,t,n){this.eventBus.removeEventListener(e,t,n)}}},MediaPlayer.dependencies.TextVTTSourceBuffer.prototype={constructor:MediaPlayer.dependencies.TextVTTSourceBuffer},MediaPlayer.utils.VTTParser=function(){"use strict";var e=function(e){var t=e.split(":"),n=t.length-1;return e=60*parseInt(t[n-1],10)+parseFloat(t[n],10),2===n&&(e+=3600*parseInt(t[0],10)),e};return{parse:function(t){var n,r=/(?:\r\n|\r|\n)/gm,i=/-->/,o=/(^[\s]+|[\s]+$)/g,a=[];t=t.split(r),n=t.length;for(var s=0;n>s;s++){var u=t[s];if(u.length>0&&"WEBVTT"!==u&&u.match(i)){var l=u.split(i),d=t[s+1];a.push({start:e(l[0].replace(o,"")),end:e(l[1].replace(o,"")),data:d})}}return Q.when(a)}}},
  MediaPlayer.rules.BaseRulesCollection=function(){"use strict";var e=[];return{downloadRatioRule:void 0,insufficientBufferRule:void 0,getRules:function(){return Q.when(e)},setup:function(){var e=this;e.getRules().then(function(t){t.push(e.downloadRatioRule),t.push(e.insufficientBufferRule)})}}},MediaPlayer.rules.BaseRulesCollection.prototype={constructor:MediaPlayer.rules.BaseRulesCollection},MediaPlayer.rules.DownloadRatioRule=function(){"use strict";var e=function(e,t,n){var r=this,i=Q.defer();return r.manifestExt.getRepresentationFor(e,n).then(function(e){r.manifestExt.getBandwidth(e).then(function(e){i.resolve(e/t)})}),i.promise};return{debug:void 0,manifestExt:void 0,checkIndex:function(t,n,r){var i,o,a,s,u,l,d,c,f,g,h=this,p=n.HttpList,m=.75;return h.debug.log("Checking download ratio rule..."),n?null===p||void 0===p||0===p.length?(h.debug.log("No requests made for this stream yet, bailing."),Q.when(new MediaPlayer.rules.SwitchRequest)):(i=p[p.length-1],a=(i.tfinish.getTime()-i.trequest.getTime())/1e3,o=(i.tfinish.getTime()-i.tresponse.getTime())/1e3,0>=a?(h.debug.log("Don't know how long the download of the last fragment took, bailing."),Q.when(new MediaPlayer.rules.SwitchRequest)):null===i.mediaduration||void 0===i.mediaduration||i.mediaduration<=0?(h.debug.log("Don't know the duration of the last media fragment, bailing."),Q.when(new MediaPlayer.rules.SwitchRequest)):(d=Q.defer(),u=i.mediaduration/a,s=i.mediaduration/o*m,isNaN(s)||isNaN(u)?(h.debug.log("Total time: "+a+"s"),h.debug.log("Download time: "+o+"s"),h.debug.log("The ratios are NaN, bailing."),Q.when(new MediaPlayer.rules.SwitchRequest)):(h.debug.log("Total ratio: "+u),h.debug.log("Download ratio: "+s),h.debug.log("Download ratio: "+s),isNaN(s)?(h.debug.log("Invalid ratio, bailing."),d.resolve(new MediaPlayer.rules.SwitchRequest)):1>s?(h.debug.log("Download ratio is poor."),t>0?(h.debug.log("We are not at the lowest bitrate, so switch down."),h.manifestExt.getRepresentationFor(t-1,r).then(function(e){h.manifestExt.getBandwidth(e).then(function(e){h.manifestExt.getRepresentationFor(t,r).then(function(n){h.manifestExt.getBandwidth(n).then(function(n){l=e/n,h.debug.log("Switch ratio: "+l),l>s?(h.debug.log("Things must be going pretty bad, switch all the way down."),d.resolve(new MediaPlayer.rules.SwitchRequest(0))):(h.debug.log("Things could be better, so just switch down one index."),d.resolve(new MediaPlayer.rules.SwitchRequest(t-1)))})})})})):(h.debug.log("We are at the lowest bitrate and cannot switch down, use current."),d.resolve(new MediaPlayer.rules.SwitchRequest(t)))):(h.debug.log("Download ratio is good."),h.manifestExt.getRepresentationCount(r).then(function(n){n-=1,n>t?(h.debug.log("We are not at the highest bitrate, so switch up."),h.manifestExt.getRepresentationFor(t+1,r).then(function(i){h.manifestExt.getBandwidth(i).then(function(i){h.manifestExt.getRepresentationFor(t,r).then(function(o){h.manifestExt.getBandwidth(o).then(function(o){if(l=i/o,h.debug.log("Switch ratio: "+l),s>=l)if(s>1e3)h.debug.log("Tons of bandwidth available, go all the way up."),d.resolve(new MediaPlayer.rules.SwitchRequest(n-1));else if(s>100)h.debug.log("Just enough bandwidth available, switch up one."),d.resolve(new MediaPlayer.rules.SwitchRequest(t+1));else{for(h.debug.log("Not exactly sure where to go, so do some math."),f=-1,c=[];(f+=1)<n;)c.push(e.call(h,f,o,r));Q.all(c).then(function(e){for(f=0,g=e.length;g>f&&!(s<e[f]);f+=1);h.debug.log("Calculated ideal new quality index is: "+f),d.resolve(new MediaPlayer.rules.SwitchRequest(f))})}else h.debug.log("Not enough bandwidth to switch up."),d.resolve(new MediaPlayer.rules.SwitchRequest)})})})})):(h.debug.log("We are at the highest bitrate and cannot switch up, use current."),d.resolve(new MediaPlayer.rules.SwitchRequest(n)))})),d.promise))):(h.debug.log("No metrics, bailing."),Q.when(new MediaPlayer.rules.SwitchRequest))}}},MediaPlayer.rules.DownloadRatioRule.prototype={constructor:MediaPlayer.rules.DownloadRatioRule},MediaPlayer.rules.InsufficientBufferRule=function(){"use strict";var e=0,t=3;return{debug:void 0,checkIndex:function(n,r){var i,o,a=this,s=!1,u=MediaPlayer.rules.SwitchRequest.prototype.DEFAULT;return a.debug.log("Checking insufficient buffer rule..."),null===r.PlayList||void 0===r.PlayList||0===r.PlayList.length?(a.debug.log("Not enough information for rule."),Q.when(new MediaPlayer.rules.SwitchRequest)):(i=r.PlayList[r.PlayList.length-1],null===i||void 0===i||0===i.trace.length?(a.debug.log("Not enough information for rule."),Q.when(new MediaPlayer.rules.SwitchRequest)):(o=i.trace[i.trace.length-2],null===o||void 0===o||null===o.stopreason||void 0===o.stopreason?(a.debug.log("Not enough information for rule."),Q.when(new MediaPlayer.rules.SwitchRequest)):(o.stopreason===MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON&&(s=!0,e+=1,a.debug.log("Number of times the buffer has run dry: "+e)),e>t&&(u=MediaPlayer.rules.SwitchRequest.prototype.STRONG,a.debug.log("Apply STRONG to buffer rule.")),s?(a.debug.log("The buffer ran dry recently, switch down."),Q.when(new MediaPlayer.rules.SwitchRequest(n-1,u))):e>t?(a.debug.log("Too many dry buffer hits, quit switching bitrates."),Q.when(new MediaPlayer.rules.SwitchRequest(n,u))):Q.when(new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,u)))))}}},MediaPlayer.rules.InsufficientBufferRule.prototype={constructor:MediaPlayer.rules.InsufficientBufferRule},MediaPlayer.rules.LimitSwitchesRule=function(){"use strict";var e=10,t=2e4,n=5,r=0;return{debug:void 0,checkIndex:function(i,o){if(r>0)return r-=1,Q.when(new MediaPlayer.rules.SwitchRequest(i,MediaPlayer.rules.SwitchRequest.prototype.STRONG));var a,s,u,l=this,d=!1,c=(new Date).getTime(),f=o.RepSwitchList.length;for(l.debug.log("Checking limit switches rule..."),u=f-1;u>=0;u-=1){if(a=o.RepSwitchList[u],s=c-a.t.getTime(),s>=t){l.debug.log("Reached time limit, bailing.");break}if(u>=e){l.debug.log("Found too many switches within validation time, force the stream to not change."),d=!0;break}}return d?(l.debug.log("Wait some time before allowing another switch."),r=n,Q.when(new MediaPlayer.rules.SwitchRequest(i,MediaPlayer.rules.SwitchRequest.prototype.STRONG))):Q.when(new MediaPlayer.rules.SwitchRequest(MediaPlayer.rules.SwitchRequest.prototype.NO_CHANGE,MediaPlayer.rules.SwitchRequest.prototype.STRONG))}}},MediaPlayer.rules.LimitSwitchesRule.prototype={constructor:MediaPlayer.rules.LimitSwitchesRule},MediaPlayer.rules.SwitchRequest=function(e,t){"use strict";this.quality=e,this.priority=t,void 0===this.quality&&(this.quality=999),void 0===this.priority&&(this.priority=.5)},MediaPlayer.rules.SwitchRequest.prototype={constructor:MediaPlayer.rules.SwitchRequest,NO_CHANGE:999,DEFAULT:.5,STRONG:1,WEAK:0},MediaPlayer.models.MetricsList=function(){"use strict";return{TcpList:[],HttpList:[],RepSwitchList:[],BufferLevel:[],PlayList:[],DroppedFrames:[]}},MediaPlayer.models.MetricsList.prototype={constructor:MediaPlayer.models.MetricsList},MediaPlayer.vo.SegmentRequest=function(){"use strict";this.action="download",this.startTime=NaN,this.streamType=null,this.type=null,this.duration=NaN,this.timescale=NaN,this.range=null,this.url=null,this.requestStartDate=null,this.firstByteDate=null,this.requestEndDate=null,this.deferred=null,this.quality=NaN,this.index=NaN},MediaPlayer.vo.SegmentRequest.prototype={constructor:MediaPlayer.vo.SegmentRequest,ACTION_DOWNLOAD:"download",ACTION_COMPLETE:"complete"},MediaPlayer.vo.metrics.BufferLevel=function(){"use strict";this.t=null,this.level=null},MediaPlayer.vo.metrics.BufferLevel.prototype={constructor:MediaPlayer.vo.metrics.BufferLevel},MediaPlayer.vo.metrics.DroppedFrames=function(){"use strict";this.time=null,this.droppedFrames=null},MediaPlayer.vo.metrics.DroppedFrames.prototype={constructor:MediaPlayer.vo.metrics.DroppedFrames},MediaPlayer.vo.metrics.HTTPRequest=function(){"use strict";this.tcpid=null,this.type=null,this.url=null,this.actualurl=null,this.range=null,this.trequest=null,this.tresponse=null,this.tfinish=null,this.responsecode=null,this.interval=null,this.mediaduration=null,this.trace=[]},MediaPlayer.vo.metrics.HTTPRequest.prototype={constructor:MediaPlayer.vo.metrics.HTTPRequest},MediaPlayer.vo.metrics.HTTPRequest.Trace=function(){"use strict";this.s=null,this.d=null,this.b=[]},MediaPlayer.vo.metrics.HTTPRequest.Trace.prototype={constructor:MediaPlayer.vo.metrics.HTTPRequest.Trace},MediaPlayer.vo.metrics.PlayList=function(){"use strict";this.start=null,this.mstart=null,this.starttype=null,this.trace=[]},MediaPlayer.vo.metrics.PlayList.Trace=function(){"use strict";this.representationid=null,this.subreplevel=null,this.start=null,this.mstart=null,this.duration=null,this.playbackspeed=null,this.stopreason=null},MediaPlayer.vo.metrics.PlayList.prototype={constructor:MediaPlayer.vo.metrics.PlayList},MediaPlayer.vo.metrics.PlayList.INITIAL_PLAY_START_REASON="initial_start",MediaPlayer.vo.metrics.PlayList.SEEK_START_REASON="seek",MediaPlayer.vo.metrics.PlayList.Trace.prototype={constructor:MediaPlayer.vo.metrics.PlayList.Trace()},MediaPlayer.vo.metrics.PlayList.Trace.USER_REQUEST_STOP_REASON="user_request",MediaPlayer.vo.metrics.PlayList.Trace.REPRESENTATION_SWITCH_STOP_REASON="representation_switch",MediaPlayer.vo.metrics.PlayList.Trace.END_OF_CONTENT_STOP_REASON="end_of_content",MediaPlayer.vo.metrics.PlayList.Trace.REBUFFERING_REASON="rebuffering",MediaPlayer.vo.metrics.RepresentationSwitch=function(){"use strict";this.t=null,this.mt=null,this.to=null,this.lto=null},MediaPlayer.vo.metrics.RepresentationSwitch.prototype={constructor:MediaPlayer.vo.metrics.RepresentationSwitch},MediaPlayer.vo.metrics.TCPConnection=function(){"use strict";this.tcpid=null,this.dest=null,this.topen=null,this.tclose=null,this.tconnect=null},MediaPlayer.vo.metrics.TCPConnection.prototype={constructor:MediaPlayer.vo.metrics.TCPConnection};
  