!function(e,t){"object"===typeof exports&&"undefined"!==typeof module?t(exports):"function"===typeof define&&define.amd?define(["exports"],t):t((e=e||self)["media-player"]={})}(this,(function(e){"use strict";function t(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function i(e){for(var i=1;i=0;--r){var a=this.tryEntries[r],s=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var o=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(o&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),C(i),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var r=n.arg;C(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:I(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),h}},e}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t,i,n,r,a,s){try{var o=e[a](s),u=o.value}catch(e){return void i(e)}o.done?t(u):Promise.resolve(u).then(n,r)}function s(e){return function(){var t=this,i=arguments;return new Promise((function(n,r){var s=e.apply(t,i);function o(e){a(s,n,r,o,u,"next",e)}function u(e){a(s,n,r,o,u,"throw",e)}o(void 0)}))}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var i=0;ie.length)&&(t=e.length);for(var i=0,n=new Array(t);i=400&&n.statusCode<=599){var a=r;if(t)if(A.TextDecoder){var s=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce((function(e,t){var i=t.split("="),n=i[0],r=i[1];return"charset"===n.trim()?r.trim():e}),"utf-8")}(n.headers&&n.headers["content-type"]);try{a=new TextDecoder(s).decode(r)}catch(e){}}else a=String.fromCharCode.apply(null,new Uint8Array(r));e({cause:a})}else e(null,r)}};X.httpHandler=q; /** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */ var W=X,G=X;function z(e,t,i){var n=e;return V(t)?(i=t,"string"===typeof e&&(n={uri:e})):n=R({},t,{uri:e}),n.callback=i,n}function X(e,t,i){return K(t=z(e,t,i))}function K(e){if("undefined"===typeof e.callback)throw new Error("callback argument missing");var t=!1,i=function(i,n,r){t||(t=!0,e.callback(i,n,r))};function n(){var e=void 0;if(e=u.response?u.response:u.responseText||function(e){try{if("document"===e.responseType)return e.responseXML;var t=e.responseXML&&"parsererror"===e.responseXML.documentElement.nodeName;if(""===e.responseType&&!t)return e.responseXML}catch(e){}return null}(u),m)try{e=JSON.parse(e)}catch(e){}return e}function r(e){return clearTimeout(l),e instanceof Error||(e=new Error(""+(e||"Unknown XMLHttpRequest Error"))),e.statusCode=0,i(e,g)}function a(){if(!o){var t;clearTimeout(l),t=e.useXDR&&void 0===u.status?200:1223===u.status?204:u.status;var r=g,a=null;return 0!==t?(r={body:n(),statusCode:t,method:d,headers:{},url:c,rawRequest:u},u.getAllResponseHeaders&&(r.headers=function(e){var t={};return e?(e.trim().split("\n").forEach((function(e){var i=e.indexOf(":"),n=e.slice(0,i).trim().toLowerCase(),r=e.slice(i+1).trim();"undefined"===typeof t[n]?t[n]=r:Array.isArray(t[n])?t[n].push(r):t[n]=[t[n],r]})),t):t}(u.getAllResponseHeaders()))):a=new Error("Internal XMLHttpRequest Error"),i(a,r,r.body)}}var s,o,u=e.xhr||null;u||(u=e.cors||e.useXDR?new X.XDomainRequest:new X.XMLHttpRequest);var l,c=u.url=e.uri||e.url,d=u.method=e.method||"GET",h=e.body||e.data,p=u.headers=e.headers||{},f=!!e.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:d,url:c,rawRequest:u};if("json"in e&&!1!==e.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==d&&"HEAD"!==d&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),h=JSON.stringify(!0===e.json?h:e.json))),u.onreadystatechange=function(){4===u.readyState&&setTimeout(a,0)},u.onload=a,u.onerror=r,u.onprogress=function(){},u.onabort=function(){o=!0},u.ontimeout=r,u.open(d,c,!f,e.username,e.password),f||(u.withCredentials=!!e.withCredentials),!f&&e.timeout>0&&(l=setTimeout((function(){if(!o){o=!0,u.abort("timeout");var e=new Error("XMLHttpRequest timeout");e.code="ETIMEDOUT",r(e)}}),e.timeout)),u.setRequestHeader)for(s in p)p.hasOwnProperty(s)&&u.setRequestHeader(s,p[s]);else if(e.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}(e.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in e&&(u.responseType=e.responseType),"beforeSend"in e&&"function"===typeof e.beforeSend&&e.beforeSend(u),u.send(h||null),u}X.XMLHttpRequest=A.XMLHttpRequest||function(){},X.XDomainRequest="withCredentials"in new X.XMLHttpRequest?X.XMLHttpRequest:A.XDomainRequest,function(e,t){for(var i=0;i59?t(i[1],i[2],0,i[4]):t(0,i[1],i[2],i[4]):null}function J(){this.values=Y(null)}function Z(e,t,i,n){var r=n?e.split(n):[e];for(var a in r)if("string"===typeof r[a]){var s=r[a].split(i);if(2===s.length)t(s[0],s[1])}}function ee(e,t,i){var n=e;function r(){var t=$(e);if(null===t)throw new Q(Q.Errors.BadTimeStamp,"Malformed timestamp: "+n);return e=e.replace(/^[^\sa-zA-Z-]+/,""),t}function a(){e=e.replace(/^\s+/,"")}if(a(),t.startTime=r(),a(),"--\x3e"!==e.substr(0,3))throw new Q(Q.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);e=e.substr(3),a(),t.endTime=r(),a(),function(e,t){var n=new J;Z(e,(function(e,t){switch(e){case"region":for(var r=i.length-1;r>=0;r--)if(i[r].id===t){n.set(e,i[r].region);break}break;case"vertical":n.alt(e,t,["rl","lr"]);break;case"line":var a=t.split(","),s=a[0];n.integer(e,s),n.percent(e,s)&&n.set("snapToLines",!1),n.alt(e,s,["auto"]),2===a.length&&n.alt("lineAlign",a[1],["start","center","end"]);break;case"position":a=t.split(","),n.percent(e,a[0]),2===a.length&&n.alt("positionAlign",a[1],["start","center","end"]);break;case"size":n.percent(e,t);break;case"align":n.alt(e,t,["start","center","end","left","right"])}}),/:/,/\s/),t.region=n.get("region",null),t.vertical=n.get("vertical","");try{t.line=n.get("line","auto")}catch(e){}t.lineAlign=n.get("lineAlign","start"),t.snapToLines=n.get("snapToLines",!0),t.size=n.get("size",100);try{t.align=n.get("align","center")}catch(e){t.align=n.get("align","middle")}try{t.position=n.get("position","auto")}catch(e){t.position=n.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=n.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(e,t)}Q.prototype=Y(Error.prototype),Q.prototype.constructor=Q,Q.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},J.prototype={set:function(e,t){this.get(e)||""===t||(this.values[e]=t)},get:function(e,t,i){return i?this.has(e)?this.values[e]:t[i]:this.has(e)?this.values[e]:t},has:function(e){return e in this.values},alt:function(e,t,i){for(var n=0;n=0&&t<=100)&&(this.set(e,t),!0)}};var te=D.createElement&&D.createElement("textarea"),ie={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},ne={white:"rgba(255,255,255,1)",lime:"rgba(0,255,0,1)",cyan:"rgba(0,255,255,1)",red:"rgba(255,0,0,1)",yellow:"rgba(255,255,0,1)",magenta:"rgba(255,0,255,1)",blue:"rgba(0,0,255,1)",black:"rgba(0,0,0,1)"},re={v:"title",lang:"lang"},ae={rt:"ruby"};function se(e,t){function i(){if(!t)return null;var e,i=t.match(/^([^<]*)(<[^>]*>?)?/);return e=i[1]?i[1]:i[2],t=t.substr(e.length),e}function n(e,t){return!ae[t.localName]||ae[t.localName]===e.localName}function r(t,i){var n=ie[t];if(!n)return null;var r=e.document.createElement(n),a=re[t];return a&&i&&(r[a]=i.trim()),r}for(var a,s,o=e.document.createElement("div"),u=o,l=[];null!==(a=i());)if("<"!==a[0])u.appendChild(e.document.createTextNode((s=a,te.innerHTML=s,s=te.textContent,te.textContent="",s)));else{if("/"===a[1]){l.length&&l[l.length-1]===a.substr(2).replace(">","")&&(l.pop(),u=u.parentNode);continue}var c,d=$(a.substr(1,a.length-2));if(d){c=e.document.createProcessingInstruction("timestamp",d),u.appendChild(c);continue}var h=a.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!h)continue;if(!(c=r(h[1],h[3])))continue;if(!n(u,c))continue;if(h[2]){var p=h[2].split(".");p.forEach((function(e){var t=/^bg_/.test(e),i=t?e.slice(3):e;if(ne.hasOwnProperty(i)){var n=t?"background-color":"color",r=ne[i];c.style[n]=r}})),c.className=p.join(" ")}l.push(h[1]),u.appendChild(c),u=c}return o}var oe=[[1470,1470],[1472,1472],[1475,1475],[1478,1478],[1488,1514],[1520,1524],[1544,1544],[1547,1547],[1549,1549],[1563,1563],[1566,1610],[1645,1647],[1649,1749],[1765,1766],[1774,1775],[1786,1805],[1807,1808],[1810,1839],[1869,1957],[1969,1969],[1984,2026],[2036,2037],[2042,2042],[2048,2069],[2074,2074],[2084,2084],[2088,2088],[2096,2110],[2112,2136],[2142,2142],[2208,2208],[2210,2220],[8207,8207],[64285,64285],[64287,64296],[64298,64310],[64312,64316],[64318,64318],[64320,64321],[64323,64324],[64326,64449],[64467,64829],[64848,64911],[64914,64967],[65008,65020],[65136,65140],[65142,65276],[67584,67589],[67592,67592],[67594,67637],[67639,67640],[67644,67644],[67647,67669],[67671,67679],[67840,67867],[67872,67897],[67903,67903],[67968,68023],[68030,68031],[68096,68096],[68112,68115],[68117,68119],[68121,68147],[68160,68167],[68176,68184],[68192,68223],[68352,68405],[68416,68437],[68440,68466],[68472,68479],[68608,68680],[126464,126467],[126469,126495],[126497,126498],[126500,126500],[126503,126503],[126505,126514],[126516,126519],[126521,126521],[126523,126523],[126530,126530],[126535,126535],[126537,126537],[126539,126539],[126541,126543],[126545,126546],[126548,126548],[126551,126551],[126553,126553],[126555,126555],[126557,126557],[126559,126559],[126561,126562],[126564,126564],[126567,126570],[126572,126578],[126580,126583],[126585,126588],[126590,126590],[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[1114109,1114109]];function ue(e){for(var t=0;t=i[0]&&e<=i[1])return!0}return!1}function le(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function n(e,t){for(var i=t.childNodes.length-1;i>=0;i--)e.push(t.childNodes[i])}function r(e){if(!e||!e.length)return null;var t=e.pop(),i=t.textContent||t.innerText;if(i){var a=i.match(/^.*(\n|\r)/);return a?(e.length=0,a[0]):i}return"ruby"===t.tagName?r(e):t.childNodes?(n(e,t),r(e)):void 0}for(n(t,e);i=r(t);)for(var a=0;a=0&&e.line<=100))return e.line;if(!e.track||!e.track.textTrackList||!e.track.textTrackList.mediaElement)return-1;for(var t=e.track,i=t.textTrackList,n=0,r=0;rd&&(c=c<0?-1:1,c*=Math.ceil(d/l)*l),s<0&&(c+=""===a.vertical?i.height:i.width,o=o.reverse()),r.move(h,c)}else{var p=r.lineHeight/i.height*100;switch(a.lineAlign){case"center":s-=p/2;break;case"end":s-=p}switch(a.vertical){case"":t.applyStyles({top:t.formatStyle(s,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(s,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(s,"%")})}o=["+y","-x","+x","-y"],r=new he(t)}var f=function(e,t){for(var r,a=new he(e),s=1,o=0;ou&&(r=new he(e),s=u),e=new he(a)}return r||a}(r,o);t.move(f.toCSSCompatValues(i))}function fe(){}ce.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},ce.prototype.formatStyle=function(e,t){return 0===e?0:e+t},de.prototype=Y(ce.prototype),de.prototype.constructor=de,he.prototype.move=function(e,t){switch(t=void 0!==t?t:this.lineHeight,e){case"+x":this.left+=t,this.right+=t;break;case"-x":this.left-=t,this.right-=t;break;case"+y":this.top+=t,this.bottom+=t;break;case"-y":this.top-=t,this.bottom-=t}},he.prototype.overlaps=function(e){return this.lefte.left&&this.tope.top},he.prototype.overlapsAny=function(e){for(var t=0;t=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},he.prototype.overlapsOppositeAxis=function(e,t){switch(t){case"+x":return this.lefte.right;case"+y":return this.tope.bottom}},he.prototype.intersectPercentage=function(e){return Math.max(0,Math.min(this.right,e.right)-Math.max(this.left,e.left))*Math.max(0,Math.min(this.bottom,e.bottom)-Math.max(this.top,e.top))/(this.height*this.width)},he.prototype.toCSSCompatValues=function(e){return{top:this.top-e.top,bottom:e.bottom-this.bottom,left:this.left-e.left,right:e.right-this.right,height:this.height,width:this.width}},he.getSimpleBoxPosition=function(e){var t=e.div?e.div.offsetHeight:e.tagName?e.offsetHeight:0,i=e.div?e.div.offsetWidth:e.tagName?e.offsetWidth:0,n=e.div?e.div.offsetTop:e.tagName?e.offsetTop:0;return{left:(e=e.div?e.div.getBoundingClientRect():e.tagName?e.getBoundingClientRect():e).left,right:e.right,top:e.top||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},fe.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!==typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},fe.convertCueToDOMTree=function(e,t){return e&&t?se(e,t):null};fe.processCues=function(e,t,i){if(!e||!t||!i)return null;for(;i.firstChild;)i.removeChild(i.firstChild);var n=e.document.createElement("div");if(n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin="1.5%",i.appendChild(n),function(e){for(var t=0;t100)throw new Error("Position must be between 0 and 100.");p=e,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return f},set:function(e){var t=ye(e);t?(f=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||e>100)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){var t=ye(e);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=t,this.hasBeenReset=!0}}}),this.displayState=void 0}_e.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var be=_e,Te={"":!0,up:!0};function ke(e){return"number"===typeof e&&e>=0&&e<=100}var Se=function(){var e=100,t=3,i=0,n=100,r=0,a=100,s="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return e},set:function(t){if(!ke(t))throw new Error("Width must be between 0 and 100.");e=t}},lines:{enumerable:!0,get:function(){return t},set:function(e){if("number"!==typeof e)throw new TypeError("Lines must be set to a number.");t=e}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(e){if(!ke(e))throw new Error("RegionAnchorX must be between 0 and 100.");n=e}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(e){if(!ke(e))throw new Error("RegionAnchorY must be between 0 and 100.");i=e}},viewportAnchorY:{enumerable:!0,get:function(){return a},set:function(e){if(!ke(e))throw new Error("ViewportAnchorY must be between 0 and 100.");a=e}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(e){if(!ke(e))throw new Error("ViewportAnchorX must be between 0 and 100.");r=e}},scroll:{enumerable:!0,get:function(){return s},set:function(e){var t=function(e){return"string"===typeof e&&(!!Te[e.toLowerCase()]&&e.toLowerCase())}(e);!1===t?console.warn("Scroll: an invalid or illegal string was specified."):s=t}}})},Ee=I((function(e){var t=e.exports={WebVTT:me,VTTCue:be,VTTRegion:Se};A.vttjs=t,A.WebVTT=t.WebVTT;var i=t.VTTCue,n=t.VTTRegion,r=A.VTTCue,a=A.VTTRegion;t.shim=function(){A.VTTCue=i,A.VTTRegion=n},t.restore=function(){A.VTTCue=r,A.VTTRegion=a},A.VTTCue||t.shim()})),Ce=(Ee.WebVTT,Ee.VTTCue,Ee.VTTRegion,I((function(e){e.exports=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0})));w(Ce);var we=w(I((function(e){function t(i,n,r){return Ce()?(e.exports=t=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e,t,i){var n=[null];n.push.apply(n,t);var r=new(Function.bind.apply(e,n));return i&&B(r,i.prototype),r},e.exports.default=e.exports,e.exports.__esModule=!0),t.apply(null,arguments)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0}))),Ie=w(I((function(e){e.exports=function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&B(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0}))),Pe=I((function(e,t){var i,n,r,a,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#.*)?$/,n=/^([^\/?#]*)(.*)$/,r=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var r=s.parseURL(e);if(!r)throw new Error("Error trying to parse base URL.");return r.path=s.normalizePath(r.path),s.buildURLFromParts(r)}var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse relative URL.");if(a.scheme)return i.alwaysNormalize?(a.path=s.normalizePath(a.path),s.buildURLFromParts(a)):t;var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var u=n.exec(o.path);o.netLoc=u[1],o.path=u[2]}o.netLoc&&!o.path&&(o.path="/");var l={scheme:o.scheme,netLoc:a.netLoc,path:null,params:a.params,query:a.query,fragment:a.fragment};if(!a.netLoc&&(l.netLoc=o.netLoc,"/"!==a.path[0]))if(a.path){var c=o.path,d=c.substring(0,c.lastIndexOf("/")+1)+a.path;l.path=s.normalizePath(d)}else l.path=o.path,a.params||(l.params=o.params,a.query||(l.query=o.query));return null===l.path&&(l.path=i.alwaysNormalize?s.normalizePath(a.path):a.path),s.buildURLFromParts(l)},parseURL:function(e){var t=i.exec(e);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(e){for(e=e.split("").reverse().join("").replace(r,"");e.length!==(e=e.replace(a,"")).length;);return e.split("").reverse().join("")},buildURLFromParts:function(e){return e.scheme+e.netLoc+e.path+e.params+e.query+e.fragment}},e.exports=s})),xe=function(){function e(){this.listeners={}}var t=e.prototype;return t.on=function(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)},t.off=function(e,t){if(!this.listeners[e])return!1;var i=this.listeners[e].indexOf(t);return this.listeners[e]=this.listeners[e].slice(0),this.listeners[e].splice(i,1),i>-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(xe),Le=String.fromCharCode(9),De=function(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),i={};return t[1]&&(i.length=parseInt(t[1],10)),t[2]&&(i.offset=parseInt(t[2],10)),i},Re=function(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n},Me=function(e){function t(){var t;return(t=e.call(this)||this).customParsers=[],t.tagMappers=[],t}F(t,e);var i=t.prototype;return i.push=function(e){var t,i,n=this;0!==(e=e.trim()).length&&("#"===e[0]?this.tagMappers.reduce((function(t,i){var n=i(e);return n===e?t:t.concat([n])}),[e]).forEach((function(e){for(var r=0;r0&&(s.duration=e.duration),0===e.duration&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=a},key:function(){if(e.attributes)if("NONE"!==e.attributes.METHOD)if(e.attributes.URI){if("com.apple.streamingkeydelivery"===e.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:e.attributes});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===e.attributes.KEYFORMAT){return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(e.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===e.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==e.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):e.attributes.KEYID&&"0x"===e.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:e.attributes.KEYFORMAT,keyId:e.attributes.KEYID.substring(2)},pssh:Ae(e.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}))}e.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:e.attributes.METHOD||"AES-128",uri:e.attributes.URI},"undefined"!==typeof e.attributes.IV&&(n.iv=e.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else n=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(e.number)?this.manifest.mediaSequence=e.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+e.number})},"discontinuity-sequence":function(){isFinite(e.number)?(this.manifest.discontinuitySequence=e.number,c=e.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+e.number})},"playlist-type":function(){/VOD|EVENT/.test(e.playlistType)?this.manifest.playlistType=e.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+e.playlist})},map:function(){i={},e.uri&&(i.uri=e.uri),e.byterange&&(i.byterange=e.byterange),n&&(i.key=n)},"stream-inf":function(){this.manifest.playlists=a,this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes?(s.attributes||(s.attributes={}),M(s.attributes,e.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,e.attributes&&e.attributes.TYPE&&e.attributes["GROUP-ID"]&&e.attributes.NAME){var i=this.manifest.mediaGroups[e.attributes.TYPE];i[e.attributes["GROUP-ID"]]=i[e.attributes["GROUP-ID"]]||{},t=i[e.attributes["GROUP-ID"]],(p={default:/yes/i.test(e.attributes.DEFAULT)}).default?p.autoselect=!0:p.autoselect=/yes/i.test(e.attributes.AUTOSELECT),e.attributes.LANGUAGE&&(p.language=e.attributes.LANGUAGE),e.attributes.URI&&(p.uri=e.attributes.URI),e.attributes["INSTREAM-ID"]&&(p.instreamId=e.attributes["INSTREAM-ID"]),e.attributes.CHARACTERISTICS&&(p.characteristics=e.attributes.CHARACTERISTICS),e.attributes.FORCED&&(p.forced=/yes/i.test(e.attributes.FORCED)),t[e.attributes.NAME]=p}else this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(a.length)},"program-date-time":function(){"undefined"===typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=e.dateTimeString,this.manifest.dateTimeObject=e.dateTimeObject),s.dateTimeString=e.dateTimeString,s.dateTimeObject=e.dateTimeObject},targetduration:function(){!isFinite(e.duration)||e.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+e.duration}):(this.manifest.targetDuration=e.duration,Ue.call(this,this.manifest))},start:function(){e.attributes&&!isNaN(e.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:e.attributes["TIME-OFFSET"],precise:e.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){s.cueOut=e.data},"cue-out-cont":function(){s.cueOutCont=e.data},"cue-in":function(){s.cueIn=e.data},skip:function(){this.manifest.skip=Ne(e.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",e.attributes,["SKIPPED-SEGMENTS"])},part:function(){var t=this;o=!0;var i=this.manifest.segments.length,n=Ne(e.attributes);s.parts=s.parts||[],s.parts.push(n),n.byterange&&(n.byterange.hasOwnProperty("offset")||(n.byterange.offset=h),h=n.byterange.offset+n.byterange.length);var r=s.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+r+" for segment #"+i,e.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((function(e,i){e.hasOwnProperty("lastPart")||t.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+i+" lacks required attribute(s): LAST-PART"})}))},"server-control":function(){var t=this.manifest.serverControl=Ne(e.attributes);t.hasOwnProperty("canBlockReload")||(t.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ue.call(this,this.manifest),t.canSkipDateranges&&!t.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint":function(){var t=this.manifest.segments.length,i=Ne(e.attributes),n=i.type&&"PART"===i.type;s.preloadHints=s.preloadHints||[],s.preloadHints.push(i),i.byterange&&(i.byterange.hasOwnProperty("offset")||(i.byterange.offset=n?h:0,n&&(h=i.byterange.offset+i.byterange.length)));var r=s.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+r+" for segment #"+t,e.attributes,["TYPE","URI"]),i.type)for(var a=0;a=0))throw wt(Et,new Error(e.tagName+"@"+i));for(var r=t.length-1;n"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function Ut(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(Ut(e,t))return!0}while(e=e.nextSibling)}function Bt(){}function Ft(e,t,i,n){e&&e._inc++,i.namespaceURI===it.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function jt(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)n[a++]=r,r=r.nextSibling;n.length=a}}}function Vt(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,jt(e.ownerDocument,e),t}function Ht(e,t,i){var n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===_t){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;var s=i?i.previousSibling:e.lastChild;r.previousSibling=s,a.nextSibling=i,s?s.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;do{r.parentNode=e}while(r!==a&&(r=r.nextSibling));return jt(e.ownerDocument||e,e),t.nodeType==_t&&(t.firstChild=t.lastChild=null),t}function qt(){this._nsMap={}}function Wt(){}function Gt(){}function zt(){}function Xt(){}function Kt(){}function Yt(){}function Qt(){}function $t(){}function Jt(){}function Zt(){}function ei(){}function ti(){}function ii(e,t){var i=[],n=9==this.nodeType&&this.documentElement||this,r=n.prefix,a=n.namespaceURI;if(a&&null==r&&null==(r=n.lookupPrefix(a)))var s=[{namespace:a,prefix:null}];return ai(this,i,e,t,s),i.join("")}function ni(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(!r)return!1;if("xml"===n&&r===it.XML||r===it.XMLNS)return!1;for(var a=i.length;a--;){var s=i[a];if(s.prefix===n)return s.namespace!==r}return!0}function ri(e,t,i){e.push(" ",t,'="',i.replace(/[<&"]/g,Nt),'"')}function ai(e,t,i,n,r){if(r||(r=[]),n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case lt:var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName,l=u;if(!(i=it.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var c,d=0;d=0;h--){if(""===(p=r[h]).prefix&&p.namespace===e.namespaceURI){c=p.namespace;break}}if(c!==e.namespaceURI)for(h=r.length-1;h>=0;h--){var p;if((p=r[h]).namespace===e.namespaceURI){p.prefix&&(l=p.prefix+":"+u);break}}}t.push("<",l);for(var f=0;f"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):ai(o,t,i,n,r.slice()),o=o.nextSibling;else for(;o;)ai(o,t,i,n,r.slice()),o=o.nextSibling;t.push("")}else t.push("/>");return;case vt:case _t:for(o=e.firstChild;o;)ai(o,t,i,n,r.slice()),o=o.nextSibling;return;case ct:return ri(t,e.name,e.value);case dt:return t.push(e.data.replace(/[<&]/g,Nt).replace(/]]>/g,"]]>"));case ht:return t.push("");case gt:return t.push("\x3c!--",e.data,"--\x3e");case yt:var y=e.publicId,_=e.systemId;if(t.push("");else if(_&&"."!=_)t.push(" SYSTEM ",_,">");else{var b=e.internalSubset;b&&t.push(" [",b,"]"),t.push(">")}return;case mt:return t.push("");case pt:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function si(e,t,i){e[t]=i}wt.prototype=Error.prototype,st(Tt,wt),It.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n0},lookupPrefix:function(e){for(var t=this;t;){var i=t._nsMap;if(i)for(var n in i)if(i[n]==e)return n;t=t.nodeType==ct?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var i=t._nsMap;if(i&&e in i)return i[e];t=t.nodeType==ct?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},st(ut,Mt),st(ut,Mt.prototype),Bt.prototype={nodeName:"#document",nodeType:vt,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==_t){for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e}return null==this.documentElement&&e.nodeType==lt&&(this.documentElement=e),Ht(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Vt(this,e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case lt:(r=i.cloneNode(!1)).ownerDocument=t;case _t:break;case ct:n=!0}r||(r=i.cloneNode(!1));if(r.ownerDocument=t,r.parentNode=null,n)for(var a=i.firstChild;a;)r.appendChild(e(t,a,n)),a=a.nextSibling;return r}(this,e,t)},getElementById:function(e){var t=null;return Ut(this.documentElement,(function(i){if(i.nodeType==lt&&i.getAttribute("id")==e)return t=i,!0})),t},getElementsByClassName:function(e){var t=at(e);return new Pt(this,(function(i){var n=[];return t.length>0&&Ut(i.documentElement,(function(r){if(r!==i&&r.nodeType===lt){var a=r.getAttribute("class");if(a){var s=e===a;if(!s){var o=at(a);s=t.every((u=o,function(e){return u&&-1!==u.indexOf(e)}))}s&&n.push(r)}}var u})),n}))},createElement:function(e){var t=new qt;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new It,(t.attributes=new At)._ownerElement=t,t},createDocumentFragment:function(){var e=new Zt;return e.ownerDocument=this,e.childNodes=new It,e},createTextNode:function(e){var t=new zt;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new Xt;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Kt;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new ei;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Wt;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Jt;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new qt,n=t.split(":"),r=i.attributes=new At;return i.childNodes=new It,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i,i},createAttributeNS:function(e,t){var i=new Wt,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},ot(Bt,Mt),qt.prototype={nodeType:lt,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var i=this.ownerDocument.createAttribute(e);i.value=i.nodeValue=""+t,this.setAttributeNode(i)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===_t?this.insertBefore(e,null):function(e,t){var i=t.parentNode;if(i){var n=e.lastChild;i.removeChild(t);n=e.lastChild}return n=e.lastChild,t.parentNode=e,t.previousSibling=n,t.nextSibling=null,n?n.nextSibling=t:e.firstChild=t,e.lastChild=t,jt(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);i&&this.removeAttributeNode(i)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var i=this.getAttributeNodeNS(e,t);return i&&i.value||""},setAttributeNS:function(e,t,i){var n=this.ownerDocument.createAttributeNS(e,t);n.value=n.nodeValue=""+i,this.setAttributeNode(n)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new Pt(this,(function(t){var i=[];return Ut(t,(function(n){n===t||n.nodeType!=lt||"*"!==e&&n.tagName!=e||i.push(n)})),i}))},getElementsByTagNameNS:function(e,t){return new Pt(this,(function(i){var n=[];return Ut(i,(function(r){r===i||r.nodeType!==lt||"*"!==e&&r.namespaceURI!==e||"*"!==t&&r.localName!=t||n.push(r)})),n}))}},Bt.prototype.getElementsByTagName=qt.prototype.getElementsByTagName,Bt.prototype.getElementsByTagNameNS=qt.prototype.getElementsByTagNameNS,ot(qt,Mt),Wt.prototype.nodeType=ct,ot(Wt,Mt),Gt.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(kt[St])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){i=this.data.substring(0,e)+i+this.data.substring(e+t),this.nodeValue=this.data=i,this.length=i.length}},ot(Gt,Mt),zt.prototype={nodeName:"#text",nodeType:dt,splitText:function(e){var t=this.data,i=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var n=this.ownerDocument.createTextNode(i);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}},ot(zt,Gt),Xt.prototype={nodeName:"#comment",nodeType:gt},ot(Xt,Gt),Kt.prototype={nodeName:"#cdata-section",nodeType:ht},ot(Kt,Gt),Yt.prototype.nodeType=yt,ot(Yt,Mt),Qt.prototype.nodeType=bt,ot(Qt,Mt),$t.prototype.nodeType=ft,ot($t,Mt),Jt.prototype.nodeType=pt,ot(Jt,Mt),Zt.prototype.nodeName="#document-fragment",Zt.prototype.nodeType=_t,ot(Zt,Mt),ei.prototype.nodeType=mt,ot(ei,Mt),ti.prototype.serializeToString=function(e,t,i){return ii.call(e,t,i)},Mt.prototype.toString=ii;try{if(Object.defineProperty){Object.defineProperty(Pt.prototype,"length",{get:function(){return xt(this),this.$$length}}),Object.defineProperty(Mt.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case lt:case _t:var i=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&i.push(e(t)),t=t.nextSibling;return i.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case lt:case _t:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),si=function(e,t,i){e["$$"+t]=i}}}catch(e){}var oi={DocumentType:Yt,DOMException:wt,DOMImplementation:Rt,Element:qt,Node:Mt,NodeList:It,XMLSerializer:ti},ui=I((function(e,t){var i=tt.freeze;t.XML_ENTITIES=i({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=i({lt:"<",gt:">",amp:"&",quot:'"',apos:"'",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",times:"×",divide:"÷",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",euro:"€",trade:"™",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"}),t.entityMap=t.HTML_ENTITIES})),li=(ui.XML_ENTITIES,ui.HTML_ENTITIES,ui.entityMap,tt.NAMESPACE),ci=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,di=new RegExp("[\\-\\.0-9"+ci.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),hi=new RegExp("^"+ci.source+di.source+"*(?::"+ci.source+di.source+"*)?$");function pi(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,pi)}function fi(){}function mi(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function gi(e,t,i,n,r,a){function s(e,t,n){i.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),i.addValue(e,t,n)}for(var o,u=++t,l=0;;){var c=e.charAt(u);switch(c){case"=":if(1===l)o=e.slice(t,u),l=3;else{if(2!==l)throw new Error("attribute equal must after attrName");l=3}break;case"'":case'"':if(3===l||1===l){if(1===l&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!((u=e.indexOf(c,t))>0))throw new Error("attribute value no end '"+c+"' match");s(o,d=e.slice(t,u).replace(/&#?\w+;/g,r),t-1),l=5}else{if(4!=l)throw new Error('attribute value must after "="');s(o,d=e.slice(t,u).replace(/&#?\w+;/g,r),t),a.warning('attribute "'+o+'" missed start quot('+c+")!!"),t=u+1,l=5}break;case"/":switch(l){case 0:i.setTagName(e.slice(t,u));case 5:case 6:case 7:l=7,i.closed=!0;case 4:case 1:case 2:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),0==l&&i.setTagName(e.slice(t,u)),u;case">":switch(l){case 0:i.setTagName(e.slice(t,u));case 5:case 6:case 7:break;case 4:case 1:"/"===(d=e.slice(t,u)).slice(-1)&&(i.closed=!0,d=d.slice(0,-1));case 2:2===l&&(d=o),4==l?(a.warning('attribute "'+d+'" missed quot(")!'),s(o,d.replace(/&#?\w+;/g,r),t)):(li.isHTML(n[""])&&d.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+d+'" missed value!! "'+d+'" instead!!'),s(d,d,t));break;case 3:throw new Error("attribute value missed!!")}return u;case"€":c=" ";default:if(c<=" ")switch(l){case 0:i.setTagName(e.slice(t,u)),l=6;break;case 1:o=e.slice(t,u),l=2;break;case 4:var d=e.slice(t,u).replace(/&#?\w+;/g,r);a.warning('attribute "'+d+'" missed quot(")!!'),s(o,d,t);case 5:l=6}else switch(l){case 2:i.tagName;li.isHTML(n[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=1;break;case 5:a.warning('attribute space is required"'+o+'"!!');case 6:l=1,t=u;break;case 3:l=4,t=u;break;case 7:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}function vi(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value;if((h=o.indexOf(":"))>0)var l=s.prefix=o.slice(0,h),c=o.slice(h+1),d="xmlns"===l&&c;else c=o,l=null,d="xmlns"===o&&"";s.localName=c,!1!==d&&(null==r&&(r={},bi(i,i={})),i[d]=r[d]=u,s.uri=li.XMLNS,t.startPrefixMapping(d,u))}for(a=e.length;a--;){(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=li.XML),"xmlns"!==l&&(s.uri=i[l||""]))}var h;(h=n.indexOf(":"))>0?(l=e.prefix=n.slice(0,h),c=e.localName=n.slice(h+1)):(l=null,c=e.localName=n);var p=e.uri=i[l||""];if(t.startElement(p,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,!0;if(t.endElement(p,c,n),r)for(l in r)t.endPrefixMapping(l)}function yi(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("",t),s=e.substring(t+1,a);if(/[&<]/.test(s))return/^script$/i.test(i)?(r.characters(s,0,s.length),a):(s=s.replace(/&#?\w+;/g,n),r.characters(s,0,s.length),a)}return t+1}function _i(e,t,i,n){var r=n[i];return null==r&&((r=e.lastIndexOf(""))t?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),s=a.length;if(s>1&&/!doctype/i.test(a[0][0])){var o=a[1][0],u=!1,l=!1;s>3&&(/^public$/i.test(a[2][0])?(u=a[3][0],l=s>4&&a[4][0]):/^system$/i.test(a[2][0])&&(l=a[3][0]));var c=a[s-1];return i.startDTD(o,u,l),i.endDTD(),c.index+c[0].length}}return-1}function ki(e,t,i){var n=e.indexOf("?>",t);if(n){var r=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(r){r[0].length;return i.processingInstruction(r[1],r[2]),n+2}return-1}return-1}function Si(){this.attributeNames={}}pi.prototype=new Error,pi.prototype.name=pi.name,fi.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),bi(t,t={}),function(e,t,i,n,r){function a(e){var t=e.slice(1,-1);return t in i?i[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),i=56320+(1023&e);return String.fromCharCode(t,i)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function s(t){if(t>f){var i=e.substring(f,t).replace(/&#?\w+;/g,a);d&&o(f),n.characters(i,0,t-f),f=t}}function o(t,i){for(;t>=l&&(i=c.exec(e));)u=i.index,l=u+i[0].length,d.lineNumber++;d.columnNumber=t-u+1}var u=0,l=0,c=/.*(?:\r\n?|\n)|.*$/g,d=n.locator,h=[{currentNSMap:t}],p={},f=0;for(;;){try{var m=e.indexOf("<",f);if(m<0){if(!e.substr(f).match(/^\s*$/)){var g=n.doc,v=g.createTextNode(e.substr(f));g.appendChild(v),n.currentElement=v}return}switch(m>f&&s(m),e.charAt(m+1)){case"/":var y=e.indexOf(">",m+3),_=e.substring(m+2,y).replace(/[ \t\n\r]+$/g,""),b=h.pop();y<0?(_=e.substring(m+2).replace(/[\s<].*/,""),r.error("end tag name: "+_+" is not complete:"+b.tagName),y=m+1+_.length):_.match(/\sf?f=y:s(Math.max(m,f)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},Si.prototype={setTagName:function(e){if(!hi.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!hi.test(e))throw new Error("invalid attribute:"+e);this.attributeNames[e]=this.length,this[this.length++]={qName:e,value:t,offset:i}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}};var Ei={XMLReader:fi,ParseError:pi},Ci=oi.DOMImplementation,wi=tt.NAMESPACE,Ii=Ei.ParseError,Pi=Ei.XMLReader;function xi(e){this.options=e||{locator:{}}}function Ai(){this.cdata=!1}function Oi(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function Li(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Di(e,t,i){return"string"==typeof e?e.substr(t,i):e.length>=t+i||t?new java.lang.String(e,t,i)+"":e}function Ri(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}xi.prototype.parseFromString=function(e,t){var i=this.options,n=new Pi,r=i.domBuilder||new Ai,a=i.errorHandler,s=i.locator,o=i.xmlns||{},u=/\/x?html?$/.test(t),l=u?ui.HTML_ENTITIES:ui.XML_ENTITIES;return s&&r.setDocumentLocator(s),n.errorHandler=function(e,t,i){if(!e){if(t instanceof Ai)return t;e=t}var n={},r=e instanceof Function;function a(t){var a=e[t];!a&&r&&(a=2==e.length?function(i){e(t,i)}:e),n[t]=a&&function(e){a("[xmldom "+t+"]\t"+e+Li(i))}||function(){}}return i=i||{},a("warning"),a("error"),a("fatalError"),n}(a,r,s),n.domBuilder=i.domBuilder||r,u&&(o[""]=wi.HTML),o.xml=o.xml||wi.XML,e&&"string"===typeof e?n.parse(e,o,l):n.errorHandler.error("invalid doc source"),r.doc},Ai.prototype={startDocument:function(){this.doc=(new Ci).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;Ri(this,a),this.currentElement=a,this.locator&&Oi(this.locator,a);for(var o=0;ot.timeline?1:-1}));var t,i},nn=function(e){var t,i,n=[];return t=e,i=function(e,t,i,r){n=n.concat(e.playlists||[])},en.forEach((function(e){for(var n in t.mediaGroups[e])for(var r in t.mediaGroups[e][n]){var a=t.mediaGroups[e][n][r];i(a,e,n,r)}})),n},rn=function(e){var t=e.playlist,i=e.mediaSequence;t.mediaSequence=i,t.segments.forEach((function(e,i){e.number=t.mediaSequence+i}))},an=function(e){var t=e.oldManifest,i=e.newManifest,n=t.playlists.concat(nn(t)),r=i.playlists.concat(nn(i));return i.timelineStarts=tn([t.timelineStarts,i.timelineStarts]),function(e){var t=e.oldPlaylists,i=e.newPlaylists,n=e.timelineStarts;i.forEach((function(e){e.discontinuitySequence=Vi(n,(function(t){return t.timeline===e.timeline}));var i=function(e,t){for(var i=0;ii.timeline||i.segments.length&&e.timeline>i.segments[i.segments.length-1].timeline)&&e.discontinuitySequence--);i.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,e.discontinuityStarts.unshift(0),e.discontinuitySequence--),rn({playlist:e,mediaSequence:i.segments[a].number})}}))}({oldPlaylists:n,newPlaylists:r,timelineStarts:i.timelineStarts}),i},sn=function(e){return e&&e.uri+"-"+(t=e.byterange,i="bigint"===typeof t.offset||"bigint"===typeof t.length?A.BigInt(t.offset)+A.BigInt(t.length)-A.BigInt(1):t.offset+t.length-1,t.offset+"-"+i);var t,i},on=function(e){return Bi(e.reduce((function(e,t){var i=t.attributes.id+(t.attributes.lang||"");if(e[i]){var n;if(t.segments)t.segments[0]&&(t.segments[0].discontinuity=!0),(n=e[i].segments).push.apply(n,t.segments);t.attributes.contentProtection&&(e[i].attributes.contentProtection=t.attributes.contentProtection)}else e[i]=t,e[i].attributes.timelineStarts=[];return e[i].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e}),{})).map((function(e){var t,i;return e.discontinuityStarts=(t=e.segments||[],i="discontinuity",t.reduce((function(e,t,n){return t[i]&&e.push(n),e}),[])),e}))},un=function(e,t){var i=sn(e.sidx),n=i&&t[i]&&t[i].sidx;return n&&Zi(e,n,e.sidx.resolvedUri),e},ln=function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=un(e[i],t);return e},cn=function(e){var t,i=e.attributes,n=e.segments,r=e.sidx,a=e.discontinuityStarts,s={attributes:(t={NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth},t["PROGRAM-ID"]=1,t),uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:"",targetDuration:i.duration,discontinuityStarts:a,timelineStarts:i.timelineStarts,segments:n};return i.contentProtection&&(s.contentProtection=i.contentProtection),r&&(s.sidx=r),s},dn=function(e){var t=e.attributes;return"video/mp4"===t.mimeType||"video/webm"===t.mimeType||"video"===t.contentType},hn=function(e){var t=e.attributes;return"audio/mp4"===t.mimeType||"audio/webm"===t.mimeType||"audio"===t.contentType},pn=function(e){var t=e.attributes;return"text/vtt"===t.mimeType||"text"===t.contentType},fn=function(e){return e?Object.keys(e).reduce((function(t,i){var n=e[i];return t.concat(n.playlists)}),[]):[]},mn=function(e){var t,i=e.dashPlaylists,n=e.locations,r=e.sidxMapping,a=void 0===r?{}:r,s=e.previousManifest;if(!i.length)return{};var o=i[0].attributes,u=o.sourceDuration,l=o.type,c=o.suggestedPresentationDelay,d=o.minimumUpdatePeriod,h=on(i.filter(dn)).map(cn),p=on(i.filter(hn)),f=on(i.filter(pn)),m=i.map((function(e){return e.attributes.captionServices})).filter(Boolean),g={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(t={AUDIO:{},VIDEO:{}},t["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:u,playlists:ln(h,a)};d>=0&&(g.minimumUpdatePeriod=1e3*d),n&&(g.locations=n),"dynamic"===l&&(g.suggestedPresentationDelay=c);var v,y,_=0===g.playlists.length,b=p.length?function(e,t,i){var n;void 0===t&&(t={}),void 0===i&&(i=!1);var r=e.reduce((function(e,r){var a=r.attributes.role&&r.attributes.role.value||"",s=r.attributes.lang||"",o=r.attributes.label||"main";if(s&&!r.attributes.label){var u=a?" ("+a+")":"";o=""+r.attributes.lang+u}e[o]||(e[o]={language:s,autoselect:!0,default:"main"===a,playlists:[],uri:""});var l=un(function(e,t){var i,n=e.attributes,r=e.segments,a=e.sidx,s=e.mediaSequence,o=e.discontinuitySequence,u=e.discontinuityStarts,l={attributes:(i={NAME:n.id,BANDWIDTH:n.bandwidth,CODECS:n.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:"static"===n.type,timeline:n.periodStart,resolvedUri:"",targetDuration:n.duration,discontinuitySequence:o,discontinuityStarts:u,timelineStarts:n.timelineStarts,mediaSequence:s,segments:r};return n.contentProtection&&(l.contentProtection=n.contentProtection),a&&(l.sidx=a),t&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l}(r,i),t);return e[o].playlists.push(l),"undefined"===typeof n&&"main"===a&&((n=r).default=!0),e}),{});n||(r[Object.keys(r)[0]].default=!0);return r}(p,a,_):null,T=f.length?function(e,t){return void 0===t&&(t={}),e.reduce((function(e,i){var n=i.attributes.lang||"text";return e[n]||(e[n]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),e[n].playlists.push(un(function(e){var t,i=e.attributes,n=e.segments,r=e.mediaSequence,a=e.discontinuityStarts,s=e.discontinuitySequence;"undefined"===typeof n&&(n=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);var o=((t={NAME:i.id,BANDWIDTH:i.bandwidth})["PROGRAM-ID"]=1,t);return i.codecs&&(o.CODECS=i.codecs),{attributes:o,uri:"",endList:"static"===i.type,timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:a,discontinuitySequence:s,mediaSequence:r,segments:n}}(i),t)),e}),{})}(f,a):null,k=h.concat(fn(b),fn(T)),S=k.map((function(e){return e.timelineStarts}));return g.timelineStarts=tn(S),v=k,y=g.timelineStarts,v.forEach((function(e){e.mediaSequence=0,e.discontinuitySequence=Vi(y,(function(t){return t.timeline===e.timeline})),e.segments&&e.segments.forEach((function(e,t){e.number=t}))})),b&&(g.mediaGroups.AUDIO.audio=b),T&&(g.mediaGroups.SUBTITLES.subs=T),m.length&&(g.mediaGroups["CLOSED-CAPTIONS"].cc=m.reduce((function(e,t){return t?(t.forEach((function(t){var i=t.channel,n=t.language;e[n]={autoselect:!1,default:!1,instreamId:i,language:n},t.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=t.aspectRatio),t.hasOwnProperty("easyReader")&&(e[n].easyReader=t.easyReader),t.hasOwnProperty("3D")&&(e[n]["3D"]=t["3D"])})),e):e}),{})),s?an({oldManifest:s,newManifest:g}):g},gn=function(e,t,i){var n=e.NOW,r=e.clientOffset,a=e.availabilityStartTime,s=e.timescale,o=void 0===s?1:s,u=e.periodStart,l=void 0===u?0:u,c=e.minimumUpdatePeriod,d=(n+r)/1e3+(void 0===c?0:c)-(a+l);return Math.ceil((d*o-t)/i)},vn=function(e,t){for(var i=e.type,n=e.minimumUpdatePeriod,r=void 0===n?0:n,a=e.media,s=void 0===a?"":a,o=e.sourceDuration,u=e.timescale,l=void 0===u?1:u,c=e.startNumber,d=void 0===c?1:c,h=e.periodStart,p=[],f=-1,m=0;mf&&(f=_);var b=void 0;if(y<0){var T=m+1;b=T===t.length?"dynamic"===i&&r>0&&s.indexOf("$Number$")>0?gn(e,f,v):(o*l-f)/v:(t[T].t-f)/v}else b=y+1;for(var k=d+p.length+b,S=d+p.length;S=r?a:""+new Array(r-a.length+1).join("0")+a)}}(t))},bn=function(e,t){var i={RepresentationID:e.id,Bandwidth:e.bandwidth||0},n=e.initialization,r=void 0===n?{sourceURL:"",range:""}:n,a=Ki({baseUrl:e.baseUrl,source:_n(r.sourceURL,i),range:r.range});return function(e,t){return e.duration||t?e.duration?$i(e):vn(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]}(e,t).map((function(t){i.Number=t.number,i.Time=t.time;var n=_n(e.media||"",i),r=e.timescale||1,s=e.presentationTimeOffset||0,o=e.periodStart+(t.time-s)/r;return{uri:n,timeline:t.timeline,duration:t.duration,resolvedUri:$e(e.baseUrl||"",n),map:a,number:t.number,presentationTime:o}}))},Tn=function(e,t){var i=e.duration,n=e.segmentUrls,r=void 0===n?[]:n,a=e.periodStart;if(!i&&!t||i&&t)throw new Error(zi);var s,o=r.map((function(t){return function(e,t){var i=e.baseUrl,n=e.initialization,r=void 0===n?{}:n,a=Ki({baseUrl:i,source:r.sourceURL,range:r.range}),s=Ki({baseUrl:i,source:t.media,range:t.mediaRange});return s.map=a,s}(e,t)}));return i&&(s=$i(e)),t&&(s=vn(e,t)),s.map((function(t,i){if(o[i]){var n=o[i],r=e.timescale||1,s=e.presentationTimeOffset||0;return n.timeline=t.timeline,n.duration=t.duration,n.number=t.number,n.presentationTime=a+(t.time-s)/r,n}})).filter((function(e){return e}))},kn=function(e){var t,i,n=e.attributes,r=e.segmentInfo;r.template?(i=bn,t=Ui(n,r.template)):r.base?(i=Ji,t=Ui(n,r.base)):r.list&&(i=Tn,t=Ui(n,r.list));var a={attributes:n};if(!i)return a;var s=i(t,r.segmentTimeline);if(t.duration){var o=t,u=o.duration,l=o.timescale,c=void 0===l?1:l;t.duration=u/c}else s.length?t.duration=s.reduce((function(e,t){return Math.max(e,Math.ceil(t.duration))}),0):t.duration=0;return a.attributes=t,a.segments=s,r.base&&t.indexRange&&(a.sidx=s[0],a.segments=[]),a},Sn=function(e,t){return ji(e.childNodes).filter((function(e){return e.tagName===t}))},En=function(e){return e.textContent.trim()},Cn=function(e){var t=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e);if(!t)return 0;var i=t.slice(1),n=i[0],r=i[1],a=i[2],s=i[3],o=i[4],u=i[5];return 31536e3*parseFloat(n||0)+2592e3*parseFloat(r||0)+86400*parseFloat(a||0)+3600*parseFloat(s||0)+60*parseFloat(o||0)+parseFloat(u||0)},wn={mediaPresentationDuration:function(e){return Cn(e)},availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(t=e)&&(t+="Z"),Date.parse(t)/1e3;var t},minimumUpdatePeriod:function(e){return Cn(e)},suggestedPresentationDelay:function(e){return Cn(e)},type:function(e){return e},timeShiftBufferDepth:function(e){return Cn(e)},start:function(e){return Cn(e)},width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?Cn(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},In=function(e){return e&&e.attributes?ji(e.attributes).reduce((function(e,t){var i=wn[t.name]||wn.DEFAULT;return e[t.name]=i(t.value),e}),{}):{}},Pn={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime"},xn=function(e,t){return t.length?Fi(e.map((function(e){return t.map((function(t){return $e(e,En(t))}))}))):e},An=function(e){var t=Sn(e,"SegmentTemplate")[0],i=Sn(e,"SegmentList")[0],n=i&&Sn(i,"SegmentURL").map((function(e){return Ui({tag:"SegmentURL"},In(e))})),r=Sn(e,"SegmentBase")[0],a=i||t,s=a&&Sn(a,"SegmentTimeline")[0],o=i||r||t,u=o&&Sn(o,"Initialization")[0],l=t&&In(t);l&&u?l.initialization=u&&In(u):l&&l.initialization&&(l.initialization={sourceURL:l.initialization});var c={template:l,segmentTimeline:s&&Sn(s,"S").map((function(e){return In(e)})),list:i&&Ui(In(i),{segmentUrls:n,initialization:In(u)}),base:r&&Ui(In(r),{initialization:In(u)})};return Object.keys(c).forEach((function(e){c[e]||delete c[e]})),c},On=function(e,t,i){return function(n){var r,a=In(n),s=xn(t,Sn(n,"BaseURL")),o=Sn(n,"Role")[0],u={role:In(o)},l=Ui(e,a,u),c=Sn(n,"Accessibility")[0],d="urn:scte:dash:cc:cea-608:2015"===(r=In(c)).schemeIdUri?("string"!==typeof r.value?[]:r.value.split(";")).map((function(e){var t,i;if(i=e,/^CC\d=/.test(e)){var n=e.split("=");t=n[0],i=n[1]}else/^CC\d$/.test(e)&&(t=e);return{channel:t,language:i}})):"urn:scte:dash:cc:cea-708:2015"===r.schemeIdUri?("string"!==typeof r.value?[]:r.value.split(";")).map((function(e){var t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){var i=e.split("="),n=i[0],r=i[1],a=void 0===r?"":r;t.channel=n,t.language=e,a.split(",").forEach((function(e){var i=e.split(":"),n=i[0],r=i[1];"lang"===n?t.language=r:"er"===n?t.easyReader=Number(r):"war"===n?t.aspectRatio=Number(r):"3D"===n&&(t["3D"]=Number(r))}))}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})):void 0;d&&(l=Ui(l,{captionServices:d}));var h=Sn(n,"Label")[0];if(h&&h.childNodes.length){var p=h.childNodes[0].nodeValue.trim();l=Ui(l,{label:p})}var f=Sn(n,"ContentProtection").reduce((function(e,t){var i=In(t),n=Pn[i.schemeIdUri];if(n){e[n]={attributes:i};var r=Sn(t,"cenc:pssh")[0];if(r){var a=En(r),s=a&&Ae(a);e[n].pssh=s}}return e}),{});Object.keys(f).length&&(l=Ui(l,{contentProtection:f}));var m=An(n),g=Sn(n,"Representation"),v=Ui(i,m);return Fi(g.map(function(e,t,i){return function(n){var r=Sn(n,"BaseURL"),a=xn(t,r),s=Ui(e,In(n)),o=An(n);return a.map((function(e){return{segmentInfo:Ui(i,o),attributes:Ui(s,{baseUrl:e})}}))}}(l,s,v)))}},Ln=function(e,t){return function(i,n){var r=xn(t,Sn(i.node,"BaseURL")),a=Ui(e,{periodStart:i.attributes.start});"number"===typeof i.attributes.duration&&(a.periodDuration=i.attributes.duration);var s=Sn(i.node,"AdaptationSet"),o=An(i.node);return Fi(s.map(On(a,r,o)))}},Dn=function(e){if(""===e)throw new Error(qi);var t,i,n=new Mi;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Wi);return i},Rn=function(e,t){void 0===t&&(t={});var i=function(e,t){void 0===t&&(t={});var i=t,n=i.manifestUri,r=void 0===n?"":n,a=i.NOW,s=void 0===a?Date.now():a,o=i.clientOffset,u=void 0===o?0:o,l=Sn(e,"Period");if(!l.length)throw new Error(Hi);var c=Sn(e,"Location"),d=In(e),h=xn([r],Sn(e,"BaseURL"));d.type=d.type||"static",d.sourceDuration=d.mediaPresentationDuration||0,d.NOW=s,d.clientOffset=u,c.length&&(d.locations=c.map(En));var p=[];return l.forEach((function(e,t){var i=In(e),n=p[t-1];i.start=function(e){var t=e.attributes,i=e.priorPeriodAttributes,n=e.mpdType;return"number"===typeof t.start?t.start:i&&"number"===typeof i.start&&"number"===typeof i.duration?i.start+i.duration:i||"static"!==n?null:0}({attributes:i,priorPeriodAttributes:n?n.attributes:null,mpdType:d.type}),p.push({node:e,attributes:i})})),{locations:d.locations,representationInfo:Fi(p.map(Ln(d,h)))}}(Dn(e),t),n=i.representationInfo.map(kn);return mn({dashPlaylists:n,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest})},Mn=function(e){return function(e){var t=Sn(e,"UTCTiming")[0];if(!t)return null;var i=In(t);switch(i.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":i.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":i.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":i.method="DIRECT",i.value=Date.parse(i.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Xi)}return i}(Dn(e))},Nn=Math.pow(2,32),Un=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength);return i.getBigUint64?(t=i.getBigUint64(0))0;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i},Fn=function(e){return function(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer}(e)},jn=function(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Fn(e)||e instanceof ArrayBuffer||(e="number"!==typeof e||"number"===typeof e&&e!==e?0:[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Vn=A.BigInt||Number,Hn=[Vn("0x1"),Vn("0x100"),Vn("0x10000"),Vn("0x1000000"),Vn("0x100000000"),Vn("0x10000000000"),Vn("0x1000000000000"),Vn("0x100000000000000"),Vn("0x10000000000000000")],qn=function(e,t){var i=void 0===t?{}:t,n=i.signed,r=void 0!==n&&n,a=i.le,s=void 0!==a&&a;e=jn(e);var o=s?"reduce":"reduceRight",u=(e[o]?e[o]:Array.prototype[o]).call(e,(function(t,i,n){var r=s?n:Math.abs(n+1-e.length);return t+Vn(i)*Hn[r]}),Vn(0));if(r){var l=Hn[e.length]/Vn(2)-Vn(1);(u=Vn(u))>l&&(u-=l,u-=l,u-=Vn(2))}return Number(u)},Wn=function(e,t){var i=(void 0===t?{}:t).le,n=void 0!==i&&i;("bigint"!==typeof e&&"number"!==typeof e||"number"===typeof e&&e!==e)&&(e=0),e=Vn(e);for(var r,a=(r=e,Math.ceil(function(e){return e.toString(2).length}(r)/8)),s=new Uint8Array(new ArrayBuffer(a)),o=0;o=t.length&&u.call(t,(function(t,i){return t===(o[i]?o[i]&e[a+i]:e[a+i])}))},Xn=jn([73,68,51]),Kn=function e(t,i){return void 0===i&&(i=0),(t=jn(t)).length-i<10||!zn(t,Xn,{offset:i})?i:(i+=function(e,t){void 0===t&&(t=0);var i=(e=jn(e))[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?n+20:n+10}(t,i),e(t,i))},Yn=function(e){return"string"===typeof e?Gn(e):e},Qn=function e(t,i,n){void 0===n&&(n=!1),i=function(e){return Array.isArray(e)?e.map((function(e){return Yn(e)})):[Yn(e)]}(i),t=jn(t);var r=[];if(!i.length)return r;for(var a=0;a>>0,o=t.subarray(a+4,a+8);if(0===s)break;var u=a+s;if(u>t.length){if(n)break;u=t.length}var l=t.subarray(a+8,u);zn(o,i[0])&&(1===i.length?r.push(l):r.push.apply(r,e(l,i.slice(1),n))),a=u}return r},$n={EBML:jn([26,69,223,163]),DocType:jn([66,130]),Segment:jn([24,83,128,103]),SegmentInfo:jn([21,73,169,102]),Tracks:jn([22,84,174,107]),Track:jn([174]),TrackNumber:jn([215]),DefaultDuration:jn([35,227,131]),TrackEntry:jn([174]),TrackType:jn([131]),FlagDefault:jn([136]),CodecID:jn([134]),CodecPrivate:jn([99,162]),VideoTrack:jn([224]),AudioTrack:jn([225]),Cluster:jn([31,67,182,117]),Timestamp:jn([231]),TimestampScale:jn([42,215,177]),BlockGroup:jn([160]),BlockDuration:jn([155]),Block:jn([161]),SimpleBlock:jn([163])},Jn=[128,64,32,16,8,4,2,1],Zn=function(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i=i.length)return i.length;var r=Zn(i,n,!1);if(zn(t.bytes,r.bytes))return n;var a=Zn(i,n+r.length);return e(t,i,n+a.length+a.value+r.length)},ir=function e(t,i){i=function(e){return Array.isArray(e)?e.map((function(e){return er(e)})):[er(e)]}(i),t=jn(t);var n=[];if(!i.length)return n;for(var r=0;rt.length?t.length:o+s.value,l=t.subarray(o,u);zn(i[0],a.bytes)&&(1===i.length?n.push(l):n=n.concat(e(l,i.slice(1)))),r+=a.length+s.length+l.length}return n},nr=jn([0,0,0,1]),rr=jn([0,0,1]),ar=jn([0,0,3]),sr=function(e){for(var t=[],i=1;i>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)},ur={webm:jn([119,101,98,109]),matroska:jn([109,97,116,114,111,115,107,97]),flac:jn([102,76,97,67]),ogg:jn([79,103,103,83]),ac3:jn([11,119]),riff:jn([82,73,70,70]),avi:jn([65,86,73]),wav:jn([87,65,86,69]),"3gp":jn([102,116,121,112,51,103]),mp4:jn([102,116,121,112]),fmp4:jn([115,116,121,112]),mov:jn([102,116,121,112,113,116]),moov:jn([109,111,111,118]),moof:jn([109,111,111,102])},lr={aac:function(e){var t=Kn(e);return zn(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Kn(e);return zn(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=ir(e,[$n.EBML,$n.DocType])[0];return zn(t,ur.webm)},mkv:function(e){var t=ir(e,[$n.EBML,$n.DocType])[0];return zn(t,ur.matroska)},mp4:function(e){return!lr["3gp"](e)&&!lr.mov(e)&&(!(!zn(e,ur.mp4,{offset:4})&&!zn(e,ur.fmp4,{offset:4}))||(!(!zn(e,ur.moof,{offset:4})&&!zn(e,ur.moov,{offset:4}))||void 0))},mov:function(e){return zn(e,ur.mov,{offset:4})},"3gp":function(e){return zn(e,ur["3gp"],{offset:4})},ac3:function(e){var t=Kn(e);return zn(e,ur.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return 71===e[0];for(var t=0;t+1880?o:0)}if(A.console){var u=A.console[i];u||"debug"!==i||(u=A.console.info||A.console.log),u&&a&&s.test(i)&&u[Array.isArray(r)?"apply":"call"](A.console,r)}}}(t,r),r.createLogger=function(i){return e(t+": "+i)},r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},r.level=function(e){if("string"===typeof e){if(!r.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');n=e}return n},(r.history=function(){return Ir?[].concat(Ir):[]}).filter=function(e){return(Ir||[]).filter((function(t){return new RegExp(".*"+e+".*").test(t[0])}))},r.history.clear=function(){Ir&&(Ir.length=0)},r.history.disable=function(){null!==Ir&&(Ir.length=0,Ir=null)},r.history.enable=function(){null===Ir&&(Ir=[])},r.error=function(){for(var e=arguments.length,t=new Array(e),r=0;r1?t-1:0),n=1;n=0)throw new Error("class has illegal whitespace characters")}function oa(){return D===A.document}function ua(e){return Rr(e)&&1===e.nodeType}function la(){try{return A.parent!==A.self}catch(e){return!0}}function ca(e){return function(t,i){if(!aa(t))return D[e](null);aa(i)&&(i=D.querySelector(i));var n=ua(i)?i:D;return n[e]&&n[e](t)}}function da(e,t,i,n){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={});var r=D.createElement(e);return Object.getOwnPropertyNames(t).forEach((function(e){var i=t[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(Pr.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+i+"."),r.setAttribute(e,i)):"textContent"===e?ha(r,i):r[e]===i&&"tabIndex"!==e||(r[e]=i)})),Object.getOwnPropertyNames(i).forEach((function(e){r.setAttribute(e,i[e])})),n&&Oa(r,n),r}function ha(e,t){return"undefined"===typeof e.textContent?e.innerText=t:e.textContent=t,e}function pa(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function fa(e,t){return sa(t),e.classList?e.classList.contains(t):(i=t,new RegExp("(^|\\s)"+i+"($|\\s)")).test(e.className);var i}function ma(e,t){return e.classList?e.classList.add(t):fa(e,t)||(e.className=(e.className+" "+t).trim()),e}function ga(e,t){return e?(e.classList?e.classList.remove(t):(sa(t),e.className=e.className.split(/\s+/).filter((function(e){return e!==t})).join(" ")),e):(Pr.warn("removeClass was called with an element that doesn't exist"),null)}function va(e,t,i){var n=fa(e,t);if("function"===typeof i&&(i=i(e,t)),"boolean"!==typeof i&&(i=!n),i!==n)return i?ma(e,t):ga(e,t),e}function ya(e,t){Object.getOwnPropertyNames(t).forEach((function(i){var n=t[i];null===n||"undefined"===typeof n||!1===n?e.removeAttribute(i):e.setAttribute(i,!0===n?"":n)}))}function _a(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&e.attributes.length>0)for(var n=e.attributes,r=n.length-1;r>=0;r--){var a=n[r].name,s=n[r].value;"boolean"!==typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function ba(e,t){return e.getAttribute(t)}function Ta(e,t,i){e.setAttribute(t,i)}function ka(e,t){e.removeAttribute(t)}function Sa(){D.body.focus(),D.onselectstart=function(){return!1}}function Ea(){D.onselectstart=function(){return!0}}function Ca(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach((function(e){void 0!==t[e]&&(i[e]=t[e])})),i.height||(i.height=parseFloat(Nr(e,"height"))),i.width||(i.width=parseFloat(Nr(e,"width"))),i}}function wa(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==D[kr.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function Ia(e,t){var i={x:0,y:0};if(ia)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r=Nr(n,"transform");if(/^matrix/.test(r)){var a=r.slice(7,-1).split(/,\s/).map(Number);i.x+=a[4],i.y+=a[5]}else if(/^matrix3d/.test(r)){var s=r.slice(9,-1).split(/,\s/).map(Number);i.x+=s[12],i.y+=s[13]}n=n.parentNode}var o={},u=wa(t.target),l=wa(e),c=l.width,d=l.height,h=t.offsetY-(l.top-u.top),p=t.offsetX-(l.left-u.left);return t.changedTouches&&(p=t.changedTouches[0].pageX-l.left,h=t.changedTouches[0].pageY+l.top,ia&&(p-=i.x,h-=i.y)),o.y=1-Math.max(0,Math.min(1,h/d)),o.x=Math.max(0,Math.min(1,p/c)),o}function Pa(e){return Rr(e)&&3===e.nodeType}function xa(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function Aa(e){return"function"===typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map((function(e){return"function"===typeof e&&(e=e()),ua(e)||Pa(e)?e:"string"===typeof e&&/\S/.test(e)?D.createTextNode(e):void 0})).filter((function(e){return e}))}function Oa(e,t){return Aa(t).forEach((function(t){return e.appendChild(t)})),e}function La(e,t){return Oa(xa(e),t)}function Da(e){return void 0===e.button&&void 0===e.buttons||(0===e.button&&void 0===e.buttons||("mouseup"===e.type&&0===e.button&&0===e.buttons||0===e.button&&1===e.buttons))}var Ra,Ma=ca("querySelector"),Na=ca("querySelectorAll"),Ua=Object.freeze({__proto__:null,isReal:oa,isEl:ua,isInFrame:la,createEl:da,textContent:ha,prependTo:pa,hasClass:fa,addClass:ma,removeClass:ga,toggleClass:va,setAttributes:ya,getAttributes:_a,getAttribute:ba,setAttribute:Ta,removeAttribute:ka,blockTextSelection:Sa,unblockTextSelection:Ea,getBoundingClientRect:Ca,findPosition:wa,getPointerPosition:Ia,isTextNode:Pa,emptyEl:xa,normalizeContent:Aa,appendContent:Oa,insertContent:La,isSingleLeftClick:Da,$:Ma,$$:Na}),Ba=!1,Fa=function(){if(!1!==Ra.options.autoSetup){var e=Array.prototype.slice.call(D.getElementsByTagName("video")),t=Array.prototype.slice.call(D.getElementsByTagName("audio")),i=Array.prototype.slice.call(D.getElementsByTagName("video-js")),n=e.concat(t,i);if(n&&n.length>0)for(var r=0,a=n.length;r-1&&(r={passive:!0}),e.addEventListener(t,n.dispatcher,r)}else e.attachEvent&&e.attachEvent("on"+t,n.dispatcher)}function es(e,t,i){if(Ka.has(e)){var n=Ka.get(e);if(n.handlers){if(Array.isArray(t))return Qa(es,e,t,i);var r=function(e,t){n.handlers[t]=[],Ya(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s=t&&(e.apply(void 0,arguments),i=n)}},us=function(){};us.prototype.allowedEvents_={},us.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Za(this,e,t),this.addEventListener=i},us.prototype.addEventListener=us.prototype.on,us.prototype.off=function(e,t){es(this,e,t)},us.prototype.removeEventListener=us.prototype.off,us.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},is(this,e,t),this.addEventListener=i},us.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},ns(this,e,t),this.addEventListener=i},us.prototype.trigger=function(e){var t=e.type||e;"string"===typeof e&&(e={type:t}),e=$a(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ts(this,e)},us.prototype.dispatchEvent=us.prototype.trigger,us.prototype.queueTrigger=function(e){var t=this;rs||(rs=new Map);var i=e.type||e,n=rs.get(this);n||(n=new Map,rs.set(this,n));var r=n.get(i);n.delete(i),A.clearTimeout(r);var a=A.setTimeout((function(){0===n.size&&(n=null,rs.delete(t)),t.trigger(e)}),0);n.set(i,a)};var ls=function(e){return"function"===typeof e.name?e.name():"string"===typeof e.name?e.name:e.name_?e.name_:e.constructor&&e.constructor.name?e.constructor.name:typeof e},cs=function(e){return e instanceof us||!!e.eventBusEl_&&["on","one","off","trigger"].every((function(t){return"function"===typeof e[t]}))},ds=function(e){return"string"===typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length},hs=function(e,t,i){if(!e||!e.nodeName&&!cs(e))throw new Error("Invalid target for "+ls(t)+"#"+i+"; must be a DOM node or evented object.")},ps=function(e,t,i){if(!ds(e))throw new Error("Invalid event type for "+ls(t)+"#"+i+"; must be a non-empty string or array.")},fs=function(e,t,i){if("function"!==typeof e)throw new Error("Invalid listener for "+ls(t)+"#"+i+"; must be a function.")},ms=function(e,t,i){var n,r,a,s=t.length<3||t[0]===e||t[0]===e.eventBusEl_;return s?(n=e.eventBusEl_,t.length>=3&&t.shift(),r=t[0],a=t[1]):(n=t[0],r=t[1],a=t[2]),hs(n,e,i),ps(r,e,i),fs(a,e,i),{isTargetingSelf:s,target:n,type:r,listener:a=ss(e,a)}},gs=function(e,t,i,n){hs(e,e,t),e.nodeName?as[t](e,i,n):e[t](i,n)},vs={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n=0;e--)this.children_[e].dispose&&this.children_[e].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),this.el_=null),this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(e){return e?(this.options_=Ss(this.options_,e),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(e,t,i){return da(e,t,i)},t.localize=function(e,t,i){void 0===i&&(i=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],s=n&&n.split("-")[0],o=r&&r[s],u=i;return a&&a[e]?u=a[e]:o&&o[e]&&(u=o[e]),t&&(u=u.replace(/\{(\d+)\}/g,(function(e,i){var n=t[i-1],r=n;return"undefined"===typeof n&&(r=e),r}))),u},t.handleLanguagechange=function(){},t.contentEl=function(){return this.contentEl_||this.el_},t.id=function(){return this.id_},t.name=function(){return this.name_},t.children=function(){return this.children_},t.getChildById=function(e){return this.childIndex_[e]},t.getChild=function(e){if(e)return this.childNameIndex_[e]},t.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)if(this.children_[i]===e){t=!0,this.children_.splice(i,1);break}if(t){e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[ks(e.name())]=null,this.childNameIndex_[Ts(e.name())]=null;var n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}}},t.initChildren=function(){var t=this,i=this.options_.children;if(i){var n,r=this.options_,a=e.getComponent("Tech");(n=Array.isArray(i)?i:Object.keys(i)).concat(Object.keys(this.options_).filter((function(e){return!n.some((function(t){return"string"===typeof t?e===t:e===t.name}))}))).map((function(e){var n,r;return"string"===typeof e?r=i[n=e]||t.options_[n]||{}:(n=e.name,r=e),{name:n,opts:r}})).filter((function(t){var i=e.getComponent(t.opts.componentClass||ks(t.name));return i&&!a.isTech(i)})).forEach((function(e){var i=e.name,n=e.opts;if(void 0!==r[i]&&(n=r[i]),!1!==n){!0===n&&(n={}),n.playerOptions=t.options_.playerOptions;var a=t.addChild(i,n);a&&(t[i]=a)}}))}},t.buildCSSClass=function(){return""},t.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},t.triggerReady=function(){this.isReady_=!0,this.setTimeout((function(){var e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach((function(e){e.call(this)}),this),this.trigger("ready")}),1)},t.$=function(e,t){return Ma(e,t||this.contentEl())},t.$$=function(e,t){return Na(e,t||this.contentEl())},t.hasClass=function(e){return fa(this.el_,e)},t.addClass=function(e){ma(this.el_,e)},t.removeClass=function(e){ga(this.el_,e)},t.toggleClass=function(e,t){va(this.el_,e,t)},t.show=function(){this.removeClass("vjs-hidden")},t.hide=function(){this.addClass("vjs-hidden")},t.lockShowing=function(){this.addClass("vjs-lock-showing")},t.unlockShowing=function(){this.removeClass("vjs-lock-showing")},t.getAttribute=function(e){return ba(this.el_,e)},t.setAttribute=function(e,t){Ta(this.el_,e,t)},t.removeAttribute=function(e){ka(this.el_,e)},t.width=function(e,t){return this.dimension("width",e,t)},t.height=function(e,t){return this.dimension("height",e,t)},t.dimensions=function(e,t){this.width(e,!0),this.height(t)},t.dimension=function(e,t,i){if(void 0!==t)return null!==t&&t===t||(t=0),-1!==(""+t).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;var n=this.el_.style[e],r=n.indexOf("px");return-1!==r?parseInt(n.slice(0,r),10):parseInt(this.el_["offset"+ks(e)],10)},t.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");if(t=Nr(this.el_,e),0===(t=parseFloat(t))||isNaN(t)){var i="offset"+ks(e);t=this.el_[i]}return t},t.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},t.currentWidth=function(){return this.currentDimension("width")},t.currentHeight=function(){return this.currentDimension("height")},t.focus=function(){this.el_.focus()},t.blur=function(){this.el_.blur()},t.handleKeyDown=function(e){this.player_&&(N.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},t.handleKeyPress=function(e){this.handleKeyDown(e)},t.emitTapEvents=function(){var e,t=0,i=null;this.on("touchstart",(function(n){1===n.touches.length&&(i={pageX:n.touches[0].pageX,pageY:n.touches[0].pageY},t=A.performance.now(),e=!0)})),this.on("touchmove",(function(t){if(t.touches.length>1)e=!1;else if(i){var n=t.touches[0].pageX-i.pageX,r=t.touches[0].pageY-i.pageY;Math.sqrt(n*n+r*r)>10&&(e=!1)}}));var n=function(){e=!1};this.on("touchleave",n),this.on("touchcancel",n),this.on("touchend",(function(n){(i=null,!0===e)&&(A.performance.now()-t<200&&(n.preventDefault(),this.trigger("tap")))}))},t.enableTouchActivity=function(){if(this.player()&&this.player().reportUserActivity){var e,t=ss(this.player(),this.player().reportUserActivity);this.on("touchstart",(function(){t(),this.clearInterval(e),e=this.setInterval(t,250)}));var i=function(i){t(),this.clearInterval(e)};this.on("touchmove",t),this.on("touchend",i),this.on("touchcancel",i)}},t.setTimeout=function(e,t){var i,n=this;return e=ss(this,e),this.clearTimersOnDispose_(),i=A.setTimeout((function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()}),t),this.setTimeoutIds_.add(i),i},t.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),A.clearTimeout(e)),e},t.setInterval=function(e,t){e=ss(this,e),this.clearTimersOnDispose_();var i=A.setInterval(e,t);return this.setIntervalIds_.add(i),i},t.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),A.clearInterval(e)),e},t.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=ss(this,e),t=A.requestAnimationFrame((function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()})),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},t.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=ss(this,t);var n=this.requestAnimationFrame((function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)}));return this.namedRafs_.set(e,n),e}},t.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},t.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),A.cancelAnimationFrame(e)),e):this.clearTimeout(e)},t.clearTimersOnDispose_=function(){var e=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",(function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach((function(t){var i=t[0],n=t[1];e[i].forEach((function(t,i){return e[n](i)}))})),e.clearingTimersOnDispose_=!1})))},e.registerComponent=function(t,i){if("string"!==typeof t||!t)throw new Error('Illegal component name, "'+t+'"; must be a non-empty string.');var n,r=e.getComponent("Tech"),a=r&&r.isTech(i),s=e===i||e.prototype.isPrototypeOf(i.prototype);if(a||!s)throw n=a?"techs must be registered using Tech.registerTech()":"must be a Component subclass",new Error('Illegal component, "'+t+'"; '+n+".");t=ks(t),e.components_||(e.components_={});var o=e.getComponent("Player");if("Player"===t&&o&&o.players){var u=o.players,l=Object.keys(u);if(u&&l.length>0&&l.map((function(e){return u[e]})).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return e.components_[t]=i,e.components_[Ts(t)]=i,i},e.getComponent=function(t){if(t&&e.components_)return e.components_[t]},e}();function xs(e,t,i,n){return function(e,t,i){if("number"!==typeof t||t<0||t>i)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function As(e){var t;return t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:xs.bind(null,"start",0,e),end:xs.bind(null,"end",1,e)},A.Symbol&&A.Symbol.iterator&&(t[A.Symbol.iterator]=function(){return(e||[]).values()}),t}function Os(e,t){return Array.isArray(e)?As(e):void 0===e||void 0===t?As():As([[e,t]])}function Ls(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=Os(0,0));for(var a=0;at&&(n=t),r+=n-i;return r/t}function Ds(e){if(e instanceof Ds)return e;"number"===typeof e?this.code=e:"string"===typeof e?this.message=e:Rr(e)&&("number"===typeof e.code&&(this.code=e.code),Dr(this,e)),this.message||(this.message=Ds.defaultMessages[this.code]||"")}Ps.prototype.supportsRaf_="function"===typeof A.requestAnimationFrame&&"function"===typeof A.cancelAnimationFrame,Ps.registerComponent("Component",Ps),Ds.prototype.code=0,Ds.prototype.message="",Ds.prototype.status=null,Ds.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],Ds.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(var Rs=0;Rs=0;n--)if(t[n].enabled){qs(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,i}F(t,e);var i=t.prototype;return i.addTrack=function(t){var i=this;t.enabled&&qs(this,t),e.prototype.addTrack.call(this,t),t.addEventListener&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,qs(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){e.prototype.removeTrack.call(this,t),t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(Vs),Gs=function(e,t){for(var i=0;i=0;n--)if(t[n].selected){Gs(t,t[n]);break}return(i=e.call(this,t)||this).changing_=!1,Object.defineProperty(U(i),"selectedIndex",{get:function(){for(var e=0;e0&&(A.console&&A.console.groupCollapsed&&A.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach((function(e){return Pr.error(e)})),A.console&&A.console.groupEnd&&A.console.groupEnd()),i.flush()},oo=function(e,t){var i={uri:e},n=ro(e);n&&(i.cors=n);var r="use-credentials"===t.tech_.crossOrigin();r&&(i.withCredentials=r),W(i,ss(this,(function(e,i,n){if(e)return Pr.error(e,i);t.loaded_=!0,"function"!==typeof A.WebVTT?t.tech_&&t.tech_.any(["vttjsloaded","vttjserror"],(function(e){if("vttjserror"!==e.type)return so(n,t);Pr.error("vttjs failed to load, stopping trying to process "+t.src)})):so(n,t)})))},uo=function(e){function t(t){var i;if(void 0===t&&(t={}),!t.tech)throw new Error("A tech was not provided.");var n=Ss(t,{kind:Js[t.kind]||"subtitles",language:t.language||t.srclang||""}),r=Zs[n.mode]||"disabled",a=n.default;"metadata"!==n.kind&&"chapters"!==n.kind||(r="hidden"),(i=e.call(this,n)||this).tech_=n.tech,i.cues_=[],i.activeCues_=[],i.preload_=!1!==i.tech_.preloadTextTracks;var s=new Ys(i.cues_),o=new Ys(i.activeCues_),u=!1;i.timeupdateHandler=ss(U(i),(function(){this.tech_.isDisposed()||(this.tech_.isReady_?(this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)):this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}));return i.tech_.one("dispose",(function(){i.stopTracking()})),"disabled"!==r&&i.startTracking(),Object.defineProperties(U(i),{default:{get:function(){return a},set:function(){}},mode:{get:function(){return r},set:function(e){Zs[e]&&r!==e&&(r=e,this.preload_||"disabled"===r||0!==this.cues.length||oo(this.src,this),this.stopTracking(),"disabled"!==r&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?s:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return o;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(u=!1,t.length!==this.activeCues_.length)u=!0;else for(var a=0;a0)return void this.trigger("vttjsloaded");var t=D.createElement("script");t.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",t.onload=function(){e.trigger("vttjsloaded")},t.onerror=function(){e.trigger("vttjserror")},this.on("dispose",(function(){t.onload=null,t.onerror=null})),A.WebVTT=!0,this.el().parentNode.appendChild(t)}else this.ready(this.addWebVttScript_)},i.emulateTextTracks=function(){var e=this,t=this.textTracks(),i=this.remoteTextTracks(),n=function(e){return t.addTrack(e.track)},r=function(e){return t.removeTrack(e.track)};i.on("addtrack",n),i.on("removetrack",r),this.addWebVttScript_();var a=function(){return e.trigger("texttrackchange")},s=function(){a();for(var e=0;e=0;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,o,s),o}var ko={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},So={setCurrentTime:1,setMuted:1,setVolume:1},Eo={play:1,pause:1};function Co(e){return function(t,i){return t===_o?_o:i[e]?i[e](t):t}}var wo={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Io=function(e){void 0===e&&(e="");var t=no(e);return wo[t.toLowerCase()]||""};function Po(e){if(!e.type){var t=Io(e.src);t&&(e.type=t)}return e}var xo=function(e){function t(t,i,n){var r,a=Ss({createEl:!1},i);if(r=e.call(this,t,a,n)||this,i.playerOptions.sources&&0!==i.playerOptions.sources.length)t.src(i.playerOptions.sources);else for(var s=0,o=i.playerOptions.techOrder;s0;!this.player_.tech(!0)||(Qr||Xr)&&t||this.player_.tech(!0).focus(),this.player_.paused()?Ns(this.player_.play()):this.player_.pause()}},t}(Ao);Ps.registerComponent("PosterImage",Oo);var Lo={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Do(e,t){var i;if(4===e.length)i=e[1]+e[1]+e[2]+e[2]+e[3]+e[3];else{if(7!==e.length)throw new Error("Invalid color code provided, "+e+"; must be formatted as e.g. #f0e or #f604e2.");i=e.slice(1)}return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function Ro(e,t,i){try{e.style[t]=i}catch(e){return}}var Mo=function(e){function t(t,i,n){var r;r=e.call(this,t,i,n)||this;var a=function(e){return r.updateDisplay(e)};return t.on("loadstart",(function(e){return r.toggleDisplay(e)})),t.on("texttrackchange",a),t.on("loadedmetadata",(function(e){return r.preselectTrack(e)})),t.ready(ss(U(r),(function(){if(t.tech_&&t.tech_.featuresNativeTextTracks)this.hide();else{t.on("fullscreenchange",a),t.on("playerresize",a),A.addEventListener("orientationchange",a),t.on("dispose",(function(){return A.removeEventListener("orientationchange",a)}));for(var e=this.options_.playerOptions.tracks||[],i=0;i0;return Ns(t),void(!this.player_.tech(!0)||(Qr||Xr)&&i||this.player_.tech(!0).focus())}var n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(r){var a=function(){return r.focus()};Ms(t)?t.then(a,(function(){})):this.setTimeout(a,1)}else this.player_.tech(!0).focus()},i.handleKeyDown=function(t){this.mouseused_=!1,e.prototype.handleKeyDown.call(this,t)},i.handleMouseDown=function(e){this.mouseused_=!0},t}(Uo);Bo.prototype.controlText_="Play Video",Ps.registerComponent("BigPlayButton",Bo);var Fo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).controlText(i&&i.controlText||n.localize("Close")),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){N.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):e.prototype.handleKeyDown.call(this,t)},t}(Uo);Ps.registerComponent("CloseButton",Fo);var jo=function(e){function t(t,i){var n;return void 0===i&&(i={}),n=e.call(this,t,i)||this,i.replay=void 0===i.replay||i.replay,n.on(t,"play",(function(e){return n.handlePlay(e)})),n.on(t,"pause",(function(e){return n.handlePause(e)})),i.replay&&n.on(t,"ended",(function(e){return n.handleEnded(e)})),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-play-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){this.player_.paused()?Ns(this.player_.play()):this.player_.pause()},i.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},i.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},i.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},i.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",(function(e){return t.handleSeeked(e)}))},t}(Uo);jo.prototype.controlText_="Play",Ps.registerComponent("PlayToggle",jo);var Vo=function(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),s=Math.floor(t/3600);return(isNaN(e)||e===1/0)&&(r=n=i="-"),(r=r>0||s>0?r+":":"")+(n=((r||a>=10)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)},Ho=Vo;function qo(e,t){return void 0===t&&(t=e),Ho(e,t)}var Wo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["timeupdate","ended"],(function(e){return n.updateContent(e)})),n.updateTextNode_(),n}F(t,e);var i=t.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=e.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control"}),n=da("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return i.appendChild(n),this.contentEl_=da("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null,this.textNode_=null,e.prototype.dispose.call(this)},i.updateTextNode_=function(e){var t=this;void 0===e&&(e=0),e=qo(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",(function(){if(t.contentEl_){var e=t.textNode_;e&&t.contentEl_.firstChild!==e&&(e=null,Pr.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=D.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_))}})))},i.updateContent=function(e){},t}(Ps);Wo.prototype.labelText_="Time",Wo.prototype.controlText_="Time",Ps.registerComponent("TimeDisplay",Wo);var Go=function(e){function t(){return e.apply(this,arguments)||this}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t;t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)},t}(Wo);Go.prototype.labelText_="Current Time",Go.prototype.controlText_="Current Time",Ps.registerComponent("CurrentTimeDisplay",Go);var zo=function(e){function t(t,i){var n,r=function(e){return n.updateContent(e)};return(n=e.call(this,t,i)||this).on(t,"durationchange",r),n.on(t,"loadstart",r),n.on(t,"loadedmetadata",r),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},t}(Wo);zo.prototype.labelText_="Duration",zo.prototype.controlText_="Duration",Ps.registerComponent("DurationDisplay",zo);var Xo=function(e){function t(){return e.apply(this,arguments)||this}return F(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),i=e.prototype.createEl.call(this,"div"),n=e.prototype.createEl.call(this,"span",{textContent:"/"});return i.appendChild(n),t.appendChild(i),t},t}(Ps);Ps.registerComponent("TimeDivider",Xo);var Ko=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"durationchange",(function(e){return n.updateContent(e)})),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=e.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&t.insertBefore(da("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(e){var t;"number"===typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},t}(Wo);Ko.prototype.labelText_="Remaining Time",Ko.prototype.controlText_="Remaining Time",Ps.registerComponent("RemainingTimeDisplay",Ko);var Yo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateShowing(),n.on(n.player(),"durationchange",(function(e){return n.updateShowing(e)})),n}F(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=da("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(da("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(D.createTextNode(this.localize("LIVE"))),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null,e.prototype.dispose.call(this)},i.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},t}(Ps);Ps.registerComponent("LiveDisplay",Yo);var Qo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).updateLiveEdgeStatus(),n.player_.liveTracker&&(n.updateLiveEdgeStatusHandler_=function(e){return n.updateLiveEdgeStatus(e)},n.on(n.player_.liveTracker,"liveedgechange",n.updateLiveEdgeStatusHandler_)),n}F(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=da("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},i.updateLiveEdgeStatus=function(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))},i.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},i.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,e.prototype.dispose.call(this)},t}(Uo);Qo.prototype.controlText_="Seek to live, currently playing live",Ps.registerComponent("SeekToLive",Qo);var $o=function(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))},Jo=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseDown_=function(e){return n.handleMouseDown(e)},n.handleMouseUp_=function(e){return n.handleMouseUp(e)},n.handleKeyDown_=function(e){return n.handleKeyDown(e)},n.handleClick_=function(e){return n.handleClick(e)},n.handleMouseMove_=function(e){return n.handleMouseMove(e)},n.update_=function(e){return n.update(e)},n.bar=n.getChild(n.options_.barName),n.vertical(!!n.options_.vertical),n.enable(),n}F(t,e);var i=t.prototype;return i.enabled=function(){return this.enabled_},i.enable=function(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)},i.disable=function(){if(this.enabled()){var e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}},i.createEl=function(t,i,n){return void 0===i&&(i={}),void 0===n&&(n={}),i.className=i.className+" vjs-slider",i=Dr({tabIndex:0},i),n=Dr({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},n),e.prototype.createEl.call(this,t,i,n)},i.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||Kr||e.preventDefault(),Sa(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)},i.handleMouseMove=function(e){},i.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;Ea(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.update()},i.update=function(){var e=this;if(this.el_&&this.bar){var t=this.getProgress();return t===this.progress_||(this.progress_=t,this.requestNamedAnimationFrame("Slider#update",(function(){var i=e.vertical()?"height":"width";e.bar.el().style[i]=(100*t).toFixed(2)+"%"}))),t}},i.getProgress=function(){return Number($o(this.getPercent(),0,1).toFixed(4))},i.calculateDistance=function(e){var t=Ia(this.el_,e);return this.vertical()?t.y:t.x},i.handleKeyDown=function(t){N.isEventKey(t,"Left")||N.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):N.isEventKey(t,"Right")||N.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):e.prototype.handleKeyDown.call(this,t)},i.handleClick=function(e){e.stopPropagation(),e.preventDefault()},i.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},t}(Ps);Ps.registerComponent("Slider",Jo);var Zo=function(e,t){return $o(e/t*100,0,100).toFixed(2)+"%"},eu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).partEls_=[],n.on(t,"progress",(function(e){return n.update(e)})),n}F(t,e);var i=t.prototype;return i.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=da("span",{className:"vjs-control-text"}),n=da("span",{textContent:this.localize("Loaded")}),r=D.createTextNode(": ");return this.percentageEl_=da("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),t.appendChild(i),i.appendChild(n),i.appendChild(r),i.appendChild(this.percentageEl_),t},i.dispose=function(){this.partEls_=null,this.percentageEl_=null,e.prototype.dispose.call(this)},i.update=function(e){var t=this;this.requestNamedAnimationFrame("LoadProgressBar#update",(function(){var e=t.player_.liveTracker,i=t.player_.buffered(),n=e&&e.isLive()?e.seekableEnd():t.player_.duration(),r=t.player_.bufferedEnd(),a=t.partEls_,s=Zo(r,n);t.percent_!==s&&(t.el_.style.width=s,ha(t.percentageEl_,s),t.percent_=s);for(var o=0;oi.length;d--)t.el_.removeChild(a[d-1]);a.length=i.length}))},t}(Ps);Ps.registerComponent("LoadProgressBar",eu);var tu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=os(ss(U(n),n.update),30),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i){var n=wa(this.el_),r=Ca(this.player_.el()),a=e.width*t;if(r&&n){var s=e.left-r.left+a,o=e.width-a+(r.right-e.right),u=n.width/2;sn.width&&(u=n.width),u=Math.round(u),this.el_.style.right="-"+u+"px",this.write(i)}},i.write=function(e){ha(this.el_,e)},i.updateTime=function(e,t,i,n){var r=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",(function(){var a,s=r.player_.duration();if(r.player_.liveTracker&&r.player_.liveTracker.isLive()){var o=r.player_.liveTracker.liveWindow(),u=o-t*o;a=(u<1?"":"-")+qo(u,o)}else a=qo(i,s);r.update(e,t,a),n&&n()}))},t}(Ps);Ps.registerComponent("TimeTooltip",tu);var iu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=os(ss(U(n),n.update),30),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(e,t){var i=this.getChild("timeTooltip");if(i){var n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}},t}(Ps);iu.prototype.options_={children:[]},ia||qr||iu.prototype.options_.children.push("timeTooltip"),Ps.registerComponent("PlayProgressBar",iu);var nu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=os(ss(U(n),n.update),30),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,(function(){i.el_.style.left=e.width*t+"px"}))},t}(Ps);nu.prototype.options_={children:["timeTooltip"]},Ps.registerComponent("MouseTimeDisplay",nu);var ru=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).setEventHandlers_(),n}F(t,e);var i=t.prototype;return i.setEventHandlers_=function(){var e=this;this.update_=ss(this,this.update),this.update=os(this.update_,30),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=function(t){return e.enableInterval_(t)},this.disableIntervalHandler_=function(t){return e.disableInterval_(t)},this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in D&&"visibilityState"in D&&this.on(D,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(e){"hidden"===D.visibilityState?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(this.player_.ended()||this.player_.paused()||this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},i.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(t){var i=this;if("hidden"!==D.visibilityState){var n=e.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",(function(){var e=i.player_.ended()?i.player_.duration():i.getCurrentTime_(),t=i.player_.liveTracker,r=i.player_.duration();t&&t.isLive()&&(r=i.player_.liveTracker.liveCurrentTime()),i.percent_!==n&&(i.el_.setAttribute("aria-valuenow",(100*n).toFixed(2)),i.percent_=n),i.currentTime_===e&&i.duration_===r||(i.el_.setAttribute("aria-valuetext",i.localize("progress bar timing: currentTime={1} duration={2}",[qo(e,r),qo(r,r)],"{1} of {2}")),i.currentTime_=e,i.duration_=r),i.bar&&i.bar.update(Ca(i.el()),i.getProgress())})),n}},i.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},i.handleMouseDown=function(t){Da(t)&&(t.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),e.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),Da(e)){var i;t||this.player_.scrubbing()||this.player_.scrubbing(!0);var n=this.calculateDistance(e),r=this.player_.liveTracker;if(r&&r.isLive()){if(n>=.99)return void r.seekToLiveEdge();var a=r.seekableStart(),s=r.liveCurrentTime();if((i=a+n*r.liveWindow())>=s&&(i=s),i<=a&&(i=a+.1),i===1/0)return}else(i=n*this.player_.duration())===this.player_.duration()&&(i-=.1);this.userSeek_(i)}},i.enable=function(){e.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){e.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){e.prototype.handleMouseUp.call(this,t),t&&t.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Ns(this.player_.play()):this.update_()},i.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},i.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},i.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){var i=this.player_.liveTracker;if(N.isEventKey(t,"Space")||N.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(N.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.userSeek_(0);else if(N.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(N(t))){t.preventDefault(),t.stopPropagation();var n=10*(N.codes[N(t)]-N.codes[0])/100;i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else N.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):N.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):e.prototype.handleKeyDown.call(this,t)},i.dispose=function(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in D&&"visibilityState"in D&&this.off(D,"visibilitychange",this.toggleVisibility_),e.prototype.dispose.call(this)},t}(Jo);ru.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},ia||qr||ru.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),Ps.registerComponent("SeekBar",ru);var au=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).handleMouseMove=os(ss(U(n),n.handleMouseMove),30),n.throttledHandleMouseSeek=os(ss(U(n),n.handleMouseSeek),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.handleMouseDownHandler_=function(e){return n.handleMouseDown(e)},n.enable(),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},i.handleMouseMove=function(e){var t=this.getChild("seekBar");if(t){var i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(i||n){var r=t.el(),a=wa(r),s=Ia(r,e).x;s=$o(s,0,1),n&&n.update(a,s),i&&i.update(a,t.getProgress())}}},i.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},i.enabled=function(){return this.enabled_},i.disable=function(){if(this.children().forEach((function(e){return e.disable&&e.disable()})),this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){var e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Ns(this.player_.play())}},i.enable=function(){this.children().forEach((function(e){return e.enable&&e.enable()})),this.enabled()||(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)},i.removeListenersAddedOnMousedownAndTouchstart=function(){var e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)},i.handleMouseDown=function(e){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},t}(Ps);au.prototype.options_={children:["seekBar"]},Ps.registerComponent("ProgressControl",au);var su=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,["enterpictureinpicture","leavepictureinpicture"],(function(e){return n.handlePictureInPictureChange(e)})),n.on(t,["disablepictureinpicturechanged","loadedmetadata"],(function(e){return n.handlePictureInPictureEnabledChange(e)})),n.on(t,["loadedmetadata","audioonlymodechange","audiopostermodechange"],(function(){"audio"===t.currentType().substring(0,5)||t.audioPosterMode()||t.audioOnlyMode()?(t.isInPictureInPicture()&&t.exitPictureInPicture(),n.hide()):n.show()})),n.disable(),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-picture-in-picture-control "+e.prototype.buildCSSClass.call(this)},i.handlePictureInPictureEnabledChange=function(){D.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},i.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},i.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},t}(Uo);su.prototype.controlText_="Picture-in-Picture",Ps.registerComponent("PictureInPictureToggle",su);var ou=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"fullscreenchange",(function(e){return n.handleFullscreenChange(e)})),!1===D[t.fsApi_.fullscreenEnabled]&&n.disable(),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-fullscreen-control "+e.prototype.buildCSSClass.call(this)},i.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},i.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},t}(Uo);ou.prototype.controlText_="Fullscreen",Ps.registerComponent("FullscreenToggle",ou);var uu=function(e){function t(){return e.apply(this,arguments)||this}return F(t,e),t.prototype.createEl=function(){var t=e.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return t.appendChild(e.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),t},t}(Ps);Ps.registerComponent("VolumeLevel",uu);var lu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=os(ss(U(n),n.update),30),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},i.update=function(e,t,i,n){if(!i){var r=Ca(this.el_),a=Ca(this.player_.el()),s=e.width*t;if(!a||!r)return;var o=e.left-a.left+s,u=e.width-s+(a.right-e.right),l=r.width/2;or.width&&(l=r.width),this.el_.style.right="-"+l+"px"}this.write(n+"%")},i.write=function(e){ha(this.el_,e)},i.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",(function(){a.update(e,t,i,n.toFixed(0)),r&&r()}))},t}(Ps);Ps.registerComponent("VolumeLevelTooltip",lu);var cu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).update=os(ss(U(n),n.update),30),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,(function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"}))},t}(Ps);cu.prototype.options_={children:["volumeLevelTooltip"]},Ps.registerComponent("MouseVolumeLevelDisplay",cu);var du=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on("slideractive",(function(e){return n.updateLastVolume_(e)})),n.on(t,"volumechange",(function(e){return n.updateARIAAttributes(e)})),t.ready((function(){return n.updateARIAAttributes()})),n}F(t,e);var i=t.prototype;return i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},i.handleMouseDown=function(t){Da(t)&&e.prototype.handleMouseDown.call(this,t)},i.handleMouseMove=function(e){var t=this.getChild("mouseVolumeLevelDisplay");if(t){var i=this.el(),n=Ca(i),r=this.vertical(),a=Ia(i,e);a=r?a.y:a.x,a=$o(a,0,1),t.update(n,a,r)}Da(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},i.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},i.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},i.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},i.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},i.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},i.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},i.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",(function(){0===e.player_.volume()&&e.player_.lastVolume_(t)}))},t}(Jo);du.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},ia||qr||du.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),du.prototype.playerEvent="volumechange",Ps.registerComponent("VolumeBar",du);var hu=function(e){function t(t,i){var n;return void 0===i&&(i={}),i.vertical=i.vertical||!1,("undefined"===typeof i.volumeBar||Mr(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical),n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresVolumeControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresVolumeControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(U(n),t),n.throttledHandleMouseMove=os(ss(U(n),n.handleMouseMove),30),n.handleMouseUpHandler_=function(e){return n.handleMouseUp(e)},n.on("mousedown",(function(e){return n.handleMouseDown(e)})),n.on("touchstart",(function(e){return n.handleMouseDown(e)})),n.on("mousemove",(function(e){return n.handleMouseMove(e)})),n.on(n.volumeBar,["focus","slideractive"],(function(){n.volumeBar.addClass("vjs-slider-active"),n.addClass("vjs-slider-active"),n.trigger("slideractive")})),n.on(n.volumeBar,["blur","sliderinactive"],(function(){n.volumeBar.removeClass("vjs-slider-active"),n.removeClass("vjs-slider-active"),n.trigger("sliderinactive")})),n}F(t,e);var i=t.prototype;return i.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},i.handleMouseDown=function(e){var t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseUp=function(e){var t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)},i.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},t}(Ps);hu.prototype.options_={children:["volumeBar"]},Ps.registerComponent("VolumeControl",hu);var pu=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,function(e,t){t.tech_&&!t.tech_.featuresMuteControl&&e.addClass("vjs-hidden"),e.on(t,"loadstart",(function(){t.tech_.featuresMuteControl?e.removeClass("vjs-hidden"):e.addClass("vjs-hidden")}))}(U(n),t),n.on(t,["loadstart","volumechange"],(function(e){return n.update(e)})),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-mute-control "+e.prototype.buildCSSClass.call(this)},i.handleClick=function(e){var t=this.player_.volume(),i=this.player_.lastVolume_();if(0===t){var n=i<.1?.1:i;this.player_.volume(n),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())},i.update=function(e){this.updateIcon_(),this.updateControlText_()},i.updateIcon_=function(){var e=this.player_.volume(),t=3;ia&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),0===e||this.player_.muted()?t=0:e<.33?t=1:e<.67&&(t=2);for(var i=0;i<4;i++)ga(this.el_,"vjs-vol-"+i);ma(this.el_,"vjs-vol-"+t)},i.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},t}(Uo);pu.prototype.controlText_="Mute",Ps.registerComponent("MuteToggle",pu);var fu=function(e){function t(t,i){var n;return void 0===i&&(i={}),"undefined"!==typeof i.inline?i.inline=i.inline:i.inline=!0,("undefined"===typeof i.volumeControl||Mr(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline),(n=e.call(this,t,i)||this).handleKeyPressHandler_=function(e){return n.handleKeyPress(e)},n.on(t,["loadstart"],(function(e){return n.volumePanelState_(e)})),n.on(n.muteToggle,"keyup",(function(e){return n.handleKeyPress(e)})),n.on(n.volumeControl,"keyup",(function(e){return n.handleVolumeControlKeyUp(e)})),n.on("keydown",(function(e){return n.handleKeyPress(e)})),n.on("mouseover",(function(e){return n.handleMouseOver(e)})),n.on("mouseout",(function(e){return n.handleMouseOut(e)})),n.on(n.volumeControl,["slideractive"],n.sliderActive_),n.on(n.volumeControl,["sliderinactive"],n.sliderInactive_),n}F(t,e);var i=t.prototype;return i.sliderActive_=function(){this.addClass("vjs-slider-active")},i.sliderInactive_=function(){this.removeClass("vjs-slider-active")},i.volumePanelState_=function(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")},i.createEl=function(){var t="vjs-volume-panel-horizontal";return this.options_.inline||(t="vjs-volume-panel-vertical"),e.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut(),e.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(e){N.isEventKey(e,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(e){this.addClass("vjs-hover"),Za(D,"keyup",this.handleKeyPressHandler_)},i.handleMouseOut=function(e){this.removeClass("vjs-hover"),es(D,"keyup",this.handleKeyPressHandler_)},i.handleKeyPress=function(e){N.isEventKey(e,"Esc")&&this.handleMouseOut()},t}(Ps);fu.prototype.options_={children:["muteToggle","volumeControl"]},Ps.registerComponent("VolumePanel",fu);var mu=function(e){function t(t,i){var n;return n=e.call(this,t,i)||this,i&&(n.menuButton_=i.menuButton),n.focusedChild_=-1,n.on("keydown",(function(e){return n.handleKeyDown(e)})),n.boundHandleBlur_=function(e){return n.handleBlur(e)},n.boundHandleTapClick_=function(e){return n.handleTapClick(e)},n}F(t,e);var i=t.prototype;return i.addEventListenerForItem=function(e){e instanceof Ps&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},i.removeEventListenerForItem=function(e){e instanceof Ps&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){"string"===typeof t&&(t=this.getChild(t)),this.removeEventListenerForItem(t),e.prototype.removeChild.call(this,t)},i.addItem=function(e){var t=this.addChild(e);t&&this.addEventListenerForItem(t)},i.createEl=function(){var t=this.options_.contentElType||"ul";this.contentEl_=da(t,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");var i=e.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return i.appendChild(this.contentEl_),Za(i,"click",(function(e){e.preventDefault(),e.stopImmediatePropagation()})),i},i.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,e.prototype.dispose.call(this)},i.handleBlur=function(e){var t=e.relatedTarget||D.activeElement;if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}},i.handleTapClick=function(e){if(this.menuButton_){this.menuButton_.unpressButton();var t=this.children();if(!Array.isArray(t))return;var i=t.filter((function(t){return t.el()===e.target}))[0];if(!i)return;"CaptionSettingsMenuItem"!==i.name()&&this.menuButton_.focus()}},i.handleKeyDown=function(e){N.isEventKey(e,"Left")||N.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(N.isEventKey(e,"Right")||N.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},i.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},i.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},i.focus=function(e){void 0===e&&(e=0);var t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())},t}(Ps);Ps.registerComponent("Menu",mu);var gu=function(e){function t(t,i){var n;void 0===i&&(i={}),(n=e.call(this,t,i)||this).menuButton_=new Uo(t,i),n.menuButton_.controlText(n.controlText_),n.menuButton_.el_.setAttribute("aria-haspopup","true");var r=Uo.prototype.buildCSSClass();n.menuButton_.el_.className=n.buildCSSClass()+" "+r,n.menuButton_.removeClass("vjs-control"),n.addChild(n.menuButton_),n.update(),n.enabled_=!0;var a=function(e){return n.handleClick(e)};return n.handleMenuKeyUp_=function(e){return n.handleMenuKeyUp(e)},n.on(n.menuButton_,"tap",a),n.on(n.menuButton_,"click",a),n.on(n.menuButton_,"keydown",(function(e){return n.handleKeyDown(e)})),n.on(n.menuButton_,"mouseenter",(function(){n.addClass("vjs-hover"),n.menu.show(),Za(D,"keyup",n.handleMenuKeyUp_)})),n.on("mouseleave",(function(e){return n.handleMouseLeave(e)})),n.on("keydown",(function(e){return n.handleSubmenuKeyDown(e)})),n}F(t,e);var i=t.prototype;return i.update=function(){var e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?this.hide():this.show()},i.createMenu=function(){var e=new mu(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){var t=da("li",{className:"vjs-menu-title",textContent:ks(this.options_.title),tabIndex:-1}),i=new Ps(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(var n=0;n-1&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},i.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n-1&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(bu);Ps.registerComponent("OffTextTrackMenuItem",Tu);var ku=function(e){function t(t,i){return void 0===i&&(i={}),i.tracks=t.textTracks(),e.call(this,t,i)||this}return F(t,e),t.prototype.createItems=function(e,t){var i;void 0===e&&(e=[]),void 0===t&&(t=bu),this.label_&&(i=this.label_+" off"),e.push(new Tu(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r-1){var s=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});s.addClass("vjs-"+a.kind+"-menu-item"),e.push(s)}}return e},t}(vu);Ps.registerComponent("TextTrackButton",ku);var Su=function(e){function t(t,i){var n,r=i.track,a=i.cue,s=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=a.text,i.selected=a.startTime<=s&&s=0;t--){var i=e[t];if(i.kind===this.kind_)return i}},i.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(ks(this.kind_))},i.createMenu=function(){return this.options_.title=this.getMenuCaption(),e.prototype.createMenu.call(this)},i.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i-1&&(n.label_="captions"),n.menuButton_.controlText(ks(n.label_)),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+e.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new Iu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),t=e.prototype.createItems.call(this,t,xu)},t}(ku);Au.prototype.kinds_=["captions","subtitles"],Au.prototype.controlText_="Subtitles",Ps.registerComponent("SubsCapsButton",Au);var Ou=function(e){function t(t,i){var n,r=i.track,a=t.audioTracks();i.label=r.label||r.language||"Unknown",i.selected=r.enabled,(n=e.call(this,t,i)||this).track=r,n.addClass("vjs-"+r.kind+"-menu-item");var s=function(){for(var e=arguments.length,t=new Array(e),i=0;i=0;i--)t.push(new Du(this.player(),{rate:e[i]+"x"}));return t},i.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},i.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),n=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[n])},i.handlePlaybackRateschange=function(e){this.update()},i.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},i.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},i.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},i.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},t}(gu);Ru.prototype.controlText_="Playback Rate",Ps.registerComponent("PlaybackRateMenuButton",Ru);var Mu=function(e){function t(){return e.apply(this,arguments)||this}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(t,i,n){return void 0===t&&(t="div"),void 0===i&&(i={}),void 0===n&&(n={}),i.className||(i.className=this.buildCSSClass()),e.prototype.createEl.call(this,t,i,n)},t}(Ps);Ps.registerComponent("Spacer",Mu);var Nu=function(e){function t(){return e.apply(this,arguments)||this}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(Mu);Ps.registerComponent("CustomControlSpacer",Nu);var Uu=function(e){function t(){return e.apply(this,arguments)||this}return F(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(Ps);Uu.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in D&&Uu.prototype.options_.children.splice(Uu.prototype.options_.children.length-1,0,"pictureInPictureToggle"),Ps.registerComponent("ControlBar",Uu);var Bu=function(e){function t(t,i){var n;return(n=e.call(this,t,i)||this).on(t,"error",(function(e){return n.open(e)})),n}F(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+e.prototype.buildCSSClass.call(this)},i.content=function(){var e=this.player().error();return e?this.localize(e.message):""},t}(js);Bu.prototype.options_=M({},js.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),Ps.registerComponent("ErrorDisplay",Bu);var Fu=["#000","Black"],ju=["#00F","Blue"],Vu=["#0FF","Cyan"],Hu=["#0F0","Green"],qu=["#F0F","Magenta"],Wu=["#F00","Red"],Gu=["#FFF","White"],zu=["#FF0","Yellow"],Xu=["1","Opaque"],Ku=["0.5","Semi-Transparent"],Yu=["0","Transparent"],Qu={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Fu,Gu,Wu,Hu,ju,zu,qu,Vu]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[Xu,Ku,Yu]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Gu,Fu,Wu,Hu,ju,zu,qu,Vu]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[Xu,Ku]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[Yu,Ku,Xu]}};function $u(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}Qu.windowColor.options=Qu.backgroundColor.options;var Ju=function(e){function t(t,i){var n;return i.temporary=!1,(n=e.call(this,t,i)||this).updateDisplay=n.updateDisplay.bind(U(n)),n.fill(),n.hasBeenOpened_=n.hasBeenFilled_=!0,n.endDialog=da("p",{className:"vjs-control-text",textContent:n.localize("End of dialog window.")}),n.el().appendChild(n.endDialog),n.setDefaults(),void 0===i.persistTextTrackSettings&&(n.options_.persistTextTrackSettings=n.options_.playerOptions.persistTextTrackSettings),n.on(n.$(".vjs-done-button"),"click",(function(){n.saveSettings(),n.close()})),n.on(n.$(".vjs-default-button"),"click",(function(){n.setDefaults(),n.updateDisplay()})),Lr(Qu,(function(e){n.on(n.$(e.selector),"change",n.updateDisplay)})),n.options_.persistTextTrackSettings&&n.restoreSettings(),n}F(t,e);var i=t.prototype;return i.dispose=function(){this.endDialog=null,e.prototype.dispose.call(this)},i.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var r=Qu[e],a=r.id.replace("%s",this.id_),s=[t,a].join(" ").trim();return["<"+i+' id="'+a+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(r.label),"",'").join("")},i.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['
','',this.localize("Text"),"",this.createElSelect_("color",e),'',this.createElSelect_("textOpacity",e),"","
"].join("")},i.createElBgColor_=function(){var e="captions-background-"+this.id_;return['
','',this.localize("Background"),"",this.createElSelect_("backgroundColor",e),'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")},i.createElWinColor_=function(){var e="captions-window-"+this.id_;return['
','',this.localize("Window"),"",this.createElSelect_("windowColor",e),'',this.createElSelect_("windowOpacity",e),"","
"].join("")},i.createElColors_=function(){return da("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return da("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})},i.createElControls_=function(){var e=this.localize("restore all settings to the default values");return da("div",{className:"vjs-track-settings-controls",innerHTML:['",'"].join("")})},i.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},i.label=function(){return this.localize("Caption Settings Dialog")},i.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},i.buildCSSClass=function(){return e.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var e,t,i,n=this;return t=function(e,t,i){var r,a,s=(r=n.$(t.selector),a=t.parser,$u(r.options[r.options.selectedIndex].value,a));return void 0!==s&&(e[i]=s),e},void 0===(i={})&&(i=0),Or(e=Qu).reduce((function(i,n){return t(i,e[n],n)}),i)},i.setValues=function(e){var t=this;Lr(Qu,(function(i,n){!function(e,t,i){if(t)for(var n=0;nthis.options_.liveTolerance;this.timeupdateSeen_&&n!==1/0||(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}},i.handleDurationchange=function(){this.toggleTracking()},i.toggleTracking=function(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())},i.startTracking=function(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,30),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))},i.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},i.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},i.reset_=function(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)},i.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},i.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},i.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},i.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},i.isLive=function(){return this.isTracking()},i.atLiveEdge=function(){return!this.behindLiveEdge()},i.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},i.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return"number"===typeof this.trackingInterval_},i.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},i.dispose=function(){this.off(D,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),e.prototype.dispose.call(this)},t}(Ps);Ps.registerComponent("LiveTracker",tl);var il,nl=function(e){var t=e.el();if(t.hasAttribute("src"))return e.triggerSourceset(t.src),!0;var i=e.$$("source"),n=[],r="";if(!i.length)return!1;for(var a=0;a=2&&r.push("loadeddata"),e.readyState>=3&&r.push("canplay"),e.readyState>=4&&r.push("canplaythrough"),this.ready((function(){r.forEach((function(e){this.trigger(e)}),this)}))}},i.setScrubbing=function(e){this.isScrubbing_=e},i.scrubbing=function(){return this.isScrubbing_},i.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&na?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){Pr(e,"Video is not ready. (Video.js)")}},i.duration=function(){var e=this;if(this.el_.duration===1/0&&qr&&Kr&&0===this.el_.currentTime){return this.on("timeupdate",(function t(){e.el_.currentTime>0&&(e.el_.duration===1/0&&e.trigger("durationchange"),e.off("timeupdate",t))})),NaN}return this.el_.duration||NaN},i.width=function(){return this.el_.offsetWidth},i.height=function(){return this.el_.offsetHeight},i.proxyWebkitFullscreen_=function(){var e=this;if("webkitDisplayingFullscreen"in this.el_){var t=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},i=function(){"webkitPresentationMode"in this.el_&&"picture-in-picture"!==this.el_.webkitPresentationMode&&(this.one("webkitendfullscreen",t),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",i),this.on("dispose",(function(){e.off("webkitbeginfullscreen",i),e.off("webkitendfullscreen",t)}))}},i.supportsFullScreen=function(){if("function"===typeof this.el_.webkitEnterFullScreen){var e=A.navigator&&A.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},i.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Ns(this.el_.play()),this.setTimeout((function(){e.pause();try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}}),0);else try{e.webkitEnterFullScreen()}catch(e){this.trigger("fullscreenerror",e)}},i.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},i.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},i.requestVideoFrameCallback=function(t){return this.featuresVideoFrameCallback?this.el_.requestVideoFrameCallback(t):e.prototype.requestVideoFrameCallback.call(this,t)},i.cancelVideoFrameCallback=function(t){this.featuresVideoFrameCallback?this.el_.cancelVideoFrameCallback(t):e.prototype.cancelVideoFrameCallback.call(this,t)},i.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},i.reset=function(){t.resetMediaElement(this.el_)},i.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},i.setControls=function(e){this.el_.controls=!!e},i.addTextTrack=function(t,i,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(t,i,n):e.prototype.addTextTrack.call(this,t,i,n)},i.createRemoteTextTrack=function(t){if(!this.featuresNativeTextTracks)return e.prototype.createRemoteTextTrack.call(this,t);var i=D.createElement("track");return t.kind&&(i.kind=t.kind),t.label&&(i.label=t.label),(t.language||t.srclang)&&(i.srclang=t.language||t.srclang),t.default&&(i.default=t.default),t.id&&(i.id=t.id),t.src&&(i.src=t.src),i},i.addRemoteTextTrack=function(t,i){var n=e.prototype.addRemoteTextTrack.call(this,t,i);return this.featuresNativeTextTracks&&this.el().appendChild(n),n},i.removeRemoteTextTrack=function(t){if(e.prototype.removeRemoteTextTrack.call(this,t),this.featuresNativeTextTracks)for(var i=this.$$("track"),n=i.length;n--;)t!==i[n]&&t!==i[n].track||this.el().removeChild(i[n])},i.getVideoPlaybackQuality=function(){if("function"===typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return"undefined"!==typeof this.el().webkitDroppedFrameCount&&"undefined"!==typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),A.performance&&"function"===typeof A.performance.now?e.creationTime=A.performance.now():A.performance&&A.performance.timing&&"number"===typeof A.performance.timing.navigationStart&&(e.creationTime=A.Date.now()-A.performance.timing.navigationStart),e},t}(go);ll(cl,"TEST_VID",(function(){if(oa()){var e=D.createElement("video"),t=D.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}})),cl.isSupported=function(){try{cl.TEST_VID.volume=.5}catch(e){return!1}return!(!cl.TEST_VID||!cl.TEST_VID.canPlayType)},cl.canPlayType=function(e){return cl.TEST_VID.canPlayType(e)},cl.canPlaySource=function(e,t){return cl.canPlayType(e.type)},cl.canControlVolume=function(){try{var e=cl.TEST_VID.volume;cl.TEST_VID.volume=e/2+.1;var t=e!==cl.TEST_VID.volume;return t&&ia?(A.setTimeout((function(){cl&&cl.prototype&&(cl.prototype.featuresVolumeControl=e!==cl.TEST_VID.volume)})),!1):t}catch(e){return!1}},cl.canMuteVolume=function(){try{var e=cl.TEST_VID.muted;return cl.TEST_VID.muted=!e,cl.TEST_VID.muted?Ta(cl.TEST_VID,"muted","muted"):ka(cl.TEST_VID,"muted"),e!==cl.TEST_VID.muted}catch(e){return!1}},cl.canControlPlaybackRate=function(){if(qr&&Kr&&Yr<58)return!1;try{var e=cl.TEST_VID.playbackRate;return cl.TEST_VID.playbackRate=e/2+.1,e!==cl.TEST_VID.playbackRate}catch(e){return!1}},cl.canOverrideAttributes=function(){try{var e=function(){};Object.defineProperty(D.createElement("video"),"src",{get:e,set:e}),Object.defineProperty(D.createElement("audio"),"src",{get:e,set:e}),Object.defineProperty(D.createElement("video"),"innerHTML",{get:e,set:e}),Object.defineProperty(D.createElement("audio"),"innerHTML",{get:e,set:e})}catch(e){return!1}return!0},cl.supportsNativeTextTracks=function(){return na||ia&&Kr},cl.supportsNativeVideoTracks=function(){return!(!cl.TEST_VID||!cl.TEST_VID.videoTracks)},cl.supportsNativeAudioTracks=function(){return!(!cl.TEST_VID||!cl.TEST_VID.audioTracks)},cl.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"],[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach((function(e){var t=e[0],i=e[1];ll(cl.prototype,t,(function(){return cl[i]()}),!0)})),cl.prototype.featuresVolumeControl=cl.canControlVolume(),cl.prototype.movingMediaElementInDOM=!ia,cl.prototype.featuresFullscreenResize=!0,cl.prototype.featuresProgressEvents=!0,cl.prototype.featuresTimeupdateEvents=!0,cl.prototype.featuresVideoFrameCallback=!(!cl.TEST_VID||!cl.TEST_VID.requestVideoFrameCallback),cl.patchCanPlayType=function(){Wr>=4&&!zr&&!Kr&&(il=cl.TEST_VID&&cl.TEST_VID.constructor.prototype.canPlayType,cl.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":il.call(this,e)})},cl.unpatchCanPlayType=function(){var e=cl.TEST_VID.constructor.prototype.canPlayType;return il&&(cl.TEST_VID.constructor.prototype.canPlayType=il),e},cl.patchCanPlayType(),cl.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"===typeof e.load&&function(){try{e.load()}catch(e){}}()}},cl.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"===typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach((function(e){cl.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}})),["muted","defaultMuted","autoplay","loop","playsinline"].forEach((function(e){cl.prototype["set"+ks(e)]=function(t){this.el_[e]=t,t?this.el_.setAttribute(e,e):this.el_.removeAttribute(e)}})),["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach((function(e){cl.prototype[e]=function(){return this.el_[e]}})),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach((function(e){cl.prototype["set"+ks(e)]=function(t){this.el_[e]=t}})),["pause","load","play"].forEach((function(e){cl.prototype[e]=function(){return this.el_[e]()}})),go.withSourceHandlers(cl),cl.nativeSourceHandler={},cl.nativeSourceHandler.canPlayType=function(e){try{return cl.TEST_VID.canPlayType(e)}catch(e){return""}},cl.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return cl.nativeSourceHandler.canPlayType(e.type);if(e.src){var i=no(e.src);return cl.nativeSourceHandler.canPlayType("video/"+i)}return""},cl.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},cl.nativeSourceHandler.dispose=function(){},cl.registerSourceHandler(cl.nativeSourceHandler),go.registerTech("Html5",cl);var dl=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],hl={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},pl=["tiny","xsmall","small","medium","large","xlarge","huge"],fl={};pl.forEach((function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;fl[e]="vjs-layout-"+t}));var ml={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},gl=function(e){function t(i,n,r){var a;if(i.id=i.id||n.id||"vjs_video_"+za(),(n=Dr(t.getTagSettings(i),n)).initChildren=!1,n.createEl=!1,n.evented=!1,n.reportTouchActivity=!1,!n.language)if("function"===typeof i.closest){var s=i.closest("[lang]");s&&s.getAttribute&&(n.language=s.getAttribute("lang"))}else for(var o=i;o&&1===o.nodeType;){if(_a(o).hasOwnProperty("lang")){n.language=o.getAttribute("lang");break}o=o.parentNode}if((a=e.call(this,null,n,r)||this).boundDocumentFullscreenChange_=function(e){return a.documentFullscreenChange_(e)},a.boundFullWindowOnEscKey_=function(e){return a.fullWindowOnEscKey(e)},a.boundUpdateStyleEl_=function(e){return a.updateStyleEl_(e)},a.boundApplyInitTime_=function(e){return a.applyInitTime_(e)},a.boundUpdateCurrentBreakpoint_=function(e){return a.updateCurrentBreakpoint_(e)},a.boundHandleTechClick_=function(e){return a.handleTechClick_(e)},a.boundHandleTechDoubleClick_=function(e){return a.handleTechDoubleClick_(e)},a.boundHandleTechTouchStart_=function(e){return a.handleTechTouchStart_(e)},a.boundHandleTechTouchMove_=function(e){return a.handleTechTouchMove_(e)},a.boundHandleTechTouchEnd_=function(e){return a.handleTechTouchEnd_(e)},a.boundHandleTechTap_=function(e){return a.handleTechTap_(e)},a.isFullscreen_=!1,a.log=xr(a.id_),a.fsApi_=kr,a.isPosterFromTech_=!1,a.queuedCallbacks_=[],a.isReady_=!1,a.hasStarted_=!1,a.userActive_=!1,a.debugEnabled_=!1,a.audioOnlyMode_=!1,a.audioPosterMode_=!1,a.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!a.options_||!a.options_.techOrder||!a.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(a.tag=i,a.tagAttributes=i&&_a(i),a.language(a.options_.language),n.languages){var u={};Object.getOwnPropertyNames(n.languages).forEach((function(e){u[e.toLowerCase()]=n.languages[e]})),a.languages_=u}else a.languages_=t.prototype.options_.languages;a.resetCache_(),a.poster_=n.poster||"",a.controls_=!!n.controls,i.controls=!1,i.removeAttribute("controls"),a.changingSrc_=!1,a.playCallbacks_=[],a.playTerminatedQueue_=[],i.hasAttribute("autoplay")?a.autoplay(!0):a.autoplay(a.options_.autoplay),n.plugins&&Object.keys(n.plugins).forEach((function(e){if("function"!==typeof a[e])throw new Error('plugin "'+e+'" does not exist')})),a.scrubbing_=!1,a.el_=a.createEl(),ys(U(a),{eventBusKey:"el_"}),a.fsApi_.requestFullscreen&&(Za(D,a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_),a.on(a.fsApi_.fullscreenchange,a.boundDocumentFullscreenChange_)),a.fluid_&&a.on(["playerreset","resize"],a.boundUpdateStyleEl_);var l=Ss(a.options_);n.plugins&&Object.keys(n.plugins).forEach((function(e){a[e](n.plugins[e])})),n.debug&&a.debug(!0),a.options_.playerOptions=l,a.middleware_=[],a.playbackRates(n.playbackRates),a.initChildren(),a.isAudio("audio"===i.nodeName.toLowerCase()),a.controls()?a.addClass("vjs-controls-enabled"):a.addClass("vjs-controls-disabled"),a.el_.setAttribute("role","region"),a.isAudio()?a.el_.setAttribute("aria-label",a.localize("Audio Player")):a.el_.setAttribute("aria-label",a.localize("Video Player")),a.isAudio()&&a.addClass("vjs-audio"),a.flexNotSupported_()&&a.addClass("vjs-no-flex"),Zr&&a.addClass("vjs-touch-enabled"),ia||a.addClass("vjs-workinghover"),t.players[a.id_]=U(a);var c="7.19.0".split(".")[0];return a.addClass("vjs-v"+c),a.userActive(!0),a.reportUserActivity(),a.one("play",(function(e){return a.listenForUserActivity_(e)})),a.on("stageclick",(function(e){return a.handleStageClick_(e)})),a.on("keydown",(function(e){return a.handleKeyDown(e)})),a.on("languagechange",(function(e){return a.handleLanguagechange(e)})),a.breakpoints(a.options_.breakpoints),a.responsive(a.options_.responsive),a.on("ready",(function(){a.audioPosterMode(a.options_.audioPosterMode),a.audioOnlyMode(a.options_.audioOnlyMode)})),a}F(t,e);var i=t.prototype;return i.dispose=function(){var i=this;this.trigger("dispose"),this.off("dispose"),es(D,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),es(D,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),t.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),yo[this.id()]=null,mo.names.forEach((function(e){var t=mo[e],n=i[t.getterName]();n&&n.off&&n.off()})),e.prototype.dispose.call(this)},i.createEl=function(){var t,i=this.tag,n=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),r="video-js"===this.tag.tagName.toLowerCase();n?t=this.el_=i.parentNode:r||(t=this.el_=e.prototype.createEl.call(this,"div"));var a=_a(i);if(r){for(t=this.el_=i,i=this.tag=D.createElement("video");t.children.length;)i.appendChild(t.firstChild);fa(t,"video-js")||ma(t,"video-js"),t.appendChild(i),n=this.playerElIngest_=t,Object.keys(t).forEach((function(e){try{i[e]=t[e]}catch(e){}}))}if(i.setAttribute("tabindex","-1"),a.tabindex="-1",(Qr||Kr&&Jr)&&(i.setAttribute("role","application"),a.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in a&&delete a.width,"height"in a&&delete a.height,Object.getOwnPropertyNames(a).forEach((function(e){r&&"class"===e||t.setAttribute(e,a[e]),r&&i.setAttribute(e,a[e])})),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",i.player=t.player=this,this.addClass("vjs-paused"),!0!==A.VIDEOJS_NO_DYNAMIC_STYLE){this.styleEl_=qa("vjs-styles-dimensions");var s=Ma(".vjs-styles-defaults"),o=Ma("head");o.insertBefore(this.styleEl_,s?s.nextSibling:o.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);for(var u=i.getElementsByTagName("a"),l=0;l0?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"),r=n[1]/n[0];e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/r:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*r,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Wa(this.styleEl_,"\n ."+i+" {\n width: "+e+"px;\n height: "+t+"px;\n }\n\n ."+i+".vjs-fluid {\n padding-top: "+100*r+"%;\n }\n ")}else{var a="number"===typeof this.width_?this.width_:this.options_.width,s="number"===typeof this.height_?this.height_:this.options_.height,o=this.tech_&&this.tech_.el();o&&(a>=0&&(o.width=a),s>=0&&(o.height=s))}},i.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=ks(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(go.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay();("string"===typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay)&&(a=!1);var s={source:t,autoplay:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset,Promise:this.options_.Promise};mo.names.forEach((function(e){var t=mo[e];s[t.getterName]=i[t.privateName]})),Dr(s,this.options_[n]),Dr(s,this.options_[r]),Dr(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(s.startTime=this.cache_.currentTime);var o=go.getTech(e);if(!o)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new o(s),this.tech_.ready(ss(this,this.handleTechReady_),!0),Fs(this.textTracksJson_||[],this.tech_),dl.forEach((function(e){i.on(i.tech_,e,(function(t){return i["handleTech"+ks(e)+"_"](t)}))})),Object.keys(hl).forEach((function(e){i.on(i.tech_,e,(function(t){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+hl[e]+"_"].bind(i),event:t}):i["handleTech"+hl[e]+"_"](t)}))})),this.on(this.tech_,"loadstart",(function(e){return i.handleTechLoadStart_(e)})),this.on(this.tech_,"sourceset",(function(e){return i.handleTechSourceset_(e)})),this.on(this.tech_,"waiting",(function(e){return i.handleTechWaiting_(e)})),this.on(this.tech_,"ended",(function(e){return i.handleTechEnded_(e)})),this.on(this.tech_,"seeking",(function(e){return i.handleTechSeeking_(e)})),this.on(this.tech_,"play",(function(e){return i.handleTechPlay_(e)})),this.on(this.tech_,"firstplay",(function(e){return i.handleTechFirstPlay_(e)})),this.on(this.tech_,"pause",(function(e){return i.handleTechPause_(e)})),this.on(this.tech_,"durationchange",(function(e){return i.handleTechDurationChange_(e)})),this.on(this.tech_,"fullscreenchange",(function(e,t){return i.handleTechFullscreenChange_(e,t)})),this.on(this.tech_,"fullscreenerror",(function(e,t){return i.handleTechFullscreenError_(e,t)})),this.on(this.tech_,"enterpictureinpicture",(function(e){return i.handleTechEnterPictureInPicture_(e)})),this.on(this.tech_,"leavepictureinpicture",(function(e){return i.handleTechLeavePictureInPicture_(e)})),this.on(this.tech_,"error",(function(e){return i.handleTechError_(e)})),this.on(this.tech_,"posterchange",(function(e){return i.handleTechPosterChange_(e)})),this.on(this.tech_,"textdata",(function(e){return i.handleTechTextData_(e)})),this.on(this.tech_,"ratechange",(function(e){return i.handleTechRateChange_(e)})),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode===this.el()||"Html5"===n&&this.tag||pa(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},i.unloadTech_=function(){var e=this;mo.names.forEach((function(t){var i=mo[t];e[i.privateName]=e[i.getterName]()})),this.textTracksJson_=Bs(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},i.tech=function(e){return void 0===e&&Pr.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n"),this.tech_},i.addTechControlsListeners_=function(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)},i.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)},i.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},i.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},i.manualAutoplay_=function(e){var t=this;if(this.tech_&&"string"===typeof e){var i,n=function(){var e=t.muted();t.muted(!0);var i=function(){t.muted(e)};t.playTerminatedQueue_.push(i);var n=t.play();if(Ms(n))return n.catch((function(e){throw i(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))}))};if("any"!==e||this.muted()?i="muted"!==e||this.muted()?this.play():n():Ms(i=this.play())&&(i=i.catch(n)),Ms(i))return i.then((function(){t.trigger({type:"autoplay-success",autoplay:e})})).catch((function(){t.trigger({type:"autoplay-failure",autoplay:e})}))}},i.updateSourceCaches_=function(e){void 0===e&&(e="");var t=e,i="";"string"!==typeof t&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=function(e,t){if(!t)return"";if(e.cache_.source.src===t&&e.cache_.source.type)return e.cache_.source.type;var i=e.cache_.sources.filter((function(e){return e.src===t}));if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r0&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach((function(e){return e.callback(e.event)})),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},i.handleTechWaiting_=function(){var e=this;this.addClass("vjs-waiting"),this.trigger("waiting");var t=this.currentTime();this.on("timeupdate",(function i(){t!==e.currentTime()&&(e.removeClass("vjs-waiting"),e.off("timeupdate",i))}))},i.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},i.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},i.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},i.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},i.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},i.handleTechFirstPlay_=function(){this.options_.starttime&&(Pr.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},i.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},i.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},i.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},i.handleTechClick_=function(e){this.controls_&&(void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.click&&!1===this.options_.userActions.click||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"===typeof this.options_.userActions.click?this.options_.userActions.click.call(this,e):this.paused()?Ns(this.play()):this.pause()))},i.handleTechDoubleClick_=function(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),(function(t){return t.contains(e.target)}))||void 0!==this.options_&&void 0!==this.options_.userActions&&void 0!==this.options_.userActions.doubleClick&&!1===this.options_.userActions.doubleClick||(void 0!==this.options_&&void 0!==this.options_.userActions&&"function"===typeof this.options_.userActions.doubleClick?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen()))},i.handleTechTap_=function(){this.userActive(!this.userActive())},i.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},i.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},i.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},i.handleStageClick_=function(){this.reportUserActivity()},i.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},i.documentFullscreenChange_=function(e){var t=e.target.player;if(!t||t===this){var i=this.el(),n=D[this.fsApi_.fullscreenElement]===i;!n&&i.matches?n=i.matches(":"+this.fsApi_.fullscreen):!n&&i.msMatchesSelector&&(n=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}},i.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",(function(){i.removeClass("vjs-ios-native-fs")}))),this.isFullscreen(t.isFullscreen))},i.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},i.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},i.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},i.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},i.handleTechError_=function(){var e=this.tech_.error();this.error(e)},i.handleTechTextData_=function(){var e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)},i.getCache=function(){return this.cache_},i.resetCache_=function(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}},i.techCall_=function(e,t){this.ready((function(){if(e in So)return function(e,t,i,n){return t[i](e.reduce(Co(i),n))}(this.middleware_,this.tech_,e,t);if(e in Eo)return To(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(e){throw Pr(e),e}}),!0)},i.techGet_=function(e){if(this.tech_&&this.tech_.isReady_){if(e in ko)return function(e,t,i){return e.reduceRight(Co(i),t[i]())}(this.middleware_,this.tech_,e);if(e in Eo)return To(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){if(void 0===this.tech_[e])throw Pr("Video.js: "+e+" method not defined for "+this.techName_+" playback technology.",t),t;if("TypeError"===t.name)throw Pr("Video.js: "+e+" unavailable on "+this.techName_+" playback technology element.",t),this.tech_.isReady_=!1,t;throw Pr(t),t}}},i.play=function(){var e=this,t=this.options_.Promise||A.Promise;return t?new t((function(t){e.play_(t)})):this.play_()},i.play_=function(e){var t=this;void 0===e&&(e=Ns),this.playCallbacks_.push(e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc()));if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(i||!na&&!ia||this.load());var n=this.techGet_("play");null===n?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)},i.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach((function(e){e()}))},i.runPlayCallbacks_=function(e){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach((function(t){t(e)}))},i.pause=function(){this.techCall_("pause")},i.paused=function(){return!1!==this.techGet_("paused")},i.played=function(){return this.techGet_("played")||Os(0,0)},i.scrubbing=function(e){if("undefined"===typeof e)return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},i.currentTime=function(e){return"undefined"!==typeof e?(e<0&&(e=0),this.isReady_&&!this.changingSrc_&&this.tech_&&this.tech_.isReady_?(this.techCall_("setCurrentTime",e),void(this.cache_.initTime=0)):(this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),void this.one("canplay",this.boundApplyInitTime_))):(this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime)},i.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},i.duration=function(e){if(void 0===e)return void 0!==this.cache_.duration?this.cache_.duration:NaN;(e=parseFloat(e))<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))},i.remainingTime=function(){return this.duration()-this.currentTime()},i.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},i.buffered=function(){var e=this.techGet_("buffered");return e&&e.length||(e=Os(0,0)),e},i.bufferedPercent=function(){return Ls(this.buffered(),this.duration())},i.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),i=e.end(e.length-1);return i>t&&(i=t),i},i.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(t>0&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},i.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},i.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},i.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},i.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},i.isFullscreen=function(e){if(void 0!==e){var t=this.isFullscreen_;return this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),void this.toggleFullscreenClass_()}return this.isFullscreen_},i.requestFullscreen=function(e){var t=this.options_.Promise||A.Promise;if(t){var i=this;return new t((function(t,n){function r(){i.off("fullscreenerror",s),i.off("fullscreenchange",a)}function a(){r(),t()}function s(e,t){r(),n(t)}i.one("fullscreenchange",a),i.one("fullscreenerror",s);var o=i.requestFullscreenHelper_(e);o&&(o.then(r,r),o.then(t,n))}))}return this.requestFullscreenHelper_()},i.requestFullscreenHelper_=function(e){var t,i=this;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(t=e)),this.fsApi_.requestFullscreen){var n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then((function(){return i.isFullscreen(!0)}),(function(){return i.isFullscreen(!1)})),n}this.tech_.supportsFullScreen()&&!0===!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},i.exitFullscreen=function(){var e=this.options_.Promise||A.Promise;if(e){var t=this;return new e((function(e,i){function n(){t.off("fullscreenerror",a),t.off("fullscreenchange",r)}function r(){n(),e()}function a(e,t){n(),i(t)}t.one("fullscreenchange",r),t.one("fullscreenerror",a);var s=t.exitFullscreenHelper_();s&&(s.then(n,n),s.then(e,i))}))}return this.exitFullscreenHelper_()},i.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=D[this.fsApi_.exitFullscreen]();return t&&Ns(t.then((function(){return e.isFullscreen(!1)}))),t}this.tech_.supportsFullScreen()&&!0===!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},i.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=D.documentElement.style.overflow,Za(D,"keydown",this.boundFullWindowOnEscKey_),D.documentElement.style.overflow="hidden",ma(D.body,"vjs-full-window"),this.trigger("enterFullWindow")},i.fullWindowOnEscKey=function(e){N.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},i.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,es(D,"keydown",this.boundFullWindowOnEscKey_),D.documentElement.style.overflow=this.docOrigOverflow,ga(D.body,"vjs-full-window"),this.trigger("exitFullWindow")},i.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},i.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},i.requestPictureInPicture=function(){if("pictureInPictureEnabled"in D&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},i.exitPictureInPicture=function(){if("pictureInPictureEnabled"in D)return D.exitPictureInPicture()},i.handleKeyDown=function(e){var t=this.options_.userActions;if(t&&t.hotkeys){(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)})(this.el_.ownerDocument.activeElement)||("function"===typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e))}},i.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=void 0===i?function(e){return N.isEventKey(e,"f")}:i,r=t.muteKey,a=void 0===r?function(e){return N.isEventKey(e,"m")}:r,s=t.playPauseKey,o=void 0===s?function(e){return N.isEventKey(e,"k")||N.isEventKey(e,"Space")}:s;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();var u=Ps.getComponent("FullscreenToggle");!1!==D[this.fsApi_.fullscreenEnabled]&&u.prototype.handleClick.call(this,e)}else if(a.call(this,e)){e.preventDefault(),e.stopPropagation(),Ps.getComponent("MuteToggle").prototype.handleClick.call(this,e)}else if(o.call(this,e)){e.preventDefault(),e.stopPropagation(),Ps.getComponent("PlayToggle").prototype.handleClick.call(this,e)}},i.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i1?i.handleSrc_(n.slice(1)):(i.changingSrc_=!1,i.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0),void i.triggerReady());a=r,s=i.tech_,a.forEach((function(e){return e.setTech&&e.setTech(s)}))})),this.options_.retryOnError&&n.length>1){var r=function(){i.error(null),i.handleSrc_(n.slice(1),!0)},a=function(){i.off("error",r)};this.one("error",r),this.one("playing",a),this.resetRetryOnError_=function(){i.off("error",r),i.off("playing",a)}}}else this.setTimeout((function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})}),0)},i.src=function(e){return this.handleSrc_(e,!1)},i.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,ks(t)!==ks(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready((function(){n.changingSrc_=!1})),!1):(this.ready((function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1}),!0),!1))},i.load=function(){this.techCall_("load")},i.reset=function(){var e=this,t=this.options_.Promise||A.Promise;this.paused()||!t?this.doReset_():Ns(this.play().then((function(){return e.doReset_()})))},i.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),cs(this)&&this.trigger("playerreset")},i.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},i.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar,t=e.durationDisplay,i=e.remainingTimeDisplay;t&&t.updateContent(),i&&i.updateContent()},i.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},i.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},i.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},i.currentSource=function(){return this.cache_.source||{}},i.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},i.currentType=function(){return this.currentSource()&&this.currentSource().type||""},i.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},i.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var t;"string"===typeof e&&/(any|play|muted)/.test(e)||!0===e&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_("string"===typeof e?e:"play"),t=!1):this.options_.autoplay=!!e,t="undefined"===typeof t?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)},i.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},i.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},i.poster=function(e){if(void 0===e)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))},i.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},i.controls=function(e){if(void 0===e)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))},i.usingNativeControls=function(e){if(void 0===e)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},i.error=function(e){var t=this;if(void 0===e)return this.error_||null;if(br("beforeerror").forEach((function(i){var n=i(t,e);Rr(n)&&!Array.isArray(n)||"string"===typeof n||"number"===typeof n||null===n?e=n:t.log.error("please return a value that MediaError expects in beforeerror hooks")})),this.options_.suppressNotSupportedError&&e&&4===e.code){var i=function(){this.error(e)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],i),void this.one("loadstart",(function(){this.off(["click","touchstart"],i)}))}if(null===e)return this.error_=e,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new Ds(e),this.addClass("vjs-error"),Pr.error("(CODE:"+this.error_.code+" "+Ds.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),br("error").forEach((function(e){return e(t,t.error_)}))},i.reportUserActivity=function(e){this.userActivity_=!0},i.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void this.trigger("useractive");this.tech_&&this.tech_.one("mousemove",(function(e){e.stopPropagation(),e.preventDefault()})),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}},i.listenForUserActivity_=function(){var e,t,i,n=ss(this,this.reportUserActivity),r=function(t){n(),this.clearInterval(e)};this.on("mousedown",(function(){n(),this.clearInterval(e),e=this.setInterval(n,250)})),this.on("mousemove",(function(e){e.screenX===t&&e.screenY===i||(t=e.screenX,i=e.screenY,n())})),this.on("mouseup",r),this.on("mouseleave",r);var a,s=this.getChild("controlBar");!s||ia||qr||(s.on("mouseenter",(function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0})),s.on("mouseleave",(function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout}))),this.on("keydown",n),this.on("keyup",n),this.setInterval((function(){if(this.userActivity_){this.userActivity_=!1,this.userActive(!0),this.clearTimeout(a);var e=this.options_.inactivityTimeout;e<=0||(a=this.setTimeout((function(){this.userActivity_||this.userActive(!1)}),e))}}),250)},i.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},i.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},i.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},i.enableAudioOnlyUI_=function(){var e=this;this.addClass("vjs-audio-only-mode");var t=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();t.forEach((function(t){t!==i&&t.el_&&!t.hasClass("vjs-hidden")&&(t.hide(),e.audioOnlyCache_.hiddenChildren.push(t))})),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},i.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach((function(e){return e.show()})),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},i.audioOnlyMode=function(e){var t=this;if("boolean"!==typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||A.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then((function(){return t.enableAudioOnlyUI_()}))}return i.resolve().then((function(){return t.disableAudioOnlyUI_()}))}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},i.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},i.audioPosterMode=function(e){var t=this;if("boolean"!==typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||A.Promise;return i?e?this.audioOnlyMode()?this.audioOnlyMode(!1).then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.enablePosterModeUI_()})):i.resolve().then((function(){t.disablePosterModeUI_()})):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},i.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},i.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},i.removeRemoteTextTrack=function(e){void 0===e&&(e={});var t=e.track;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)},i.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},i.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},i.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},i.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),cs(this)&&this.trigger("languagechange"))},i.languages=function(){return Ss(t.prototype.options_.languages,this.languages_)},i.toJSON=function(){var e=Ss(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i"):function(){}},Ll=function(e,t){var i,n=[];if(e&&e.length)for(i=0;i=t}))},Rl=function(e,t){return Ll(e,(function(e){return e-1/30>=t}))},Ml=function(e){var t=[];if(!e||!e.length)return"";for(var i=0;i "+e.end(i));return t.join(", ")},Nl=function(e){for(var t=[],i=0;ia||(i+=t>r&&t<=a?a-t:a-r)}return i},Fl=wl.createTimeRange,jl=function(e,t){if(!t.preload)return t.duration;var i=0;return(t.parts||[]).forEach((function(e){i+=e.duration})),(t.preloadHints||[]).forEach((function(t){"PART"===t.type&&(i+=e.partTargetDuration)})),i},Vl=function(e){return(e.segments||[]).reduce((function(e,t,i){return t.parts?t.parts.forEach((function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})})):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e}),[])},Hl=function(e){var t=e.segments&&e.segments.length&&e.segments[e.segments.length-1];return t&&t.parts||[]},ql=function(e){var t=e.preloadSegment;if(t){var i=t.parts,n=(t.preloadHints||[]).reduce((function(e,t){return e+("PART"===t.type?1:0)}),0);return n+=i&&i.length?i.length:0}},Wl=function(e,t){if(t.endList)return 0;if(e&&e.suggestedPresentationDelay)return e.suggestedPresentationDelay;var i=Hl(t).length>0;return i&&t.serverControl&&t.serverControl.partHoldBack?t.serverControl.partHoldBack:i&&t.partTargetDuration?3*t.partTargetDuration:t.serverControl&&t.serverControl.holdBack?t.serverControl.holdBack:t.targetDuration?3*t.targetDuration:0},Gl=function(e,t,i){if("undefined"===typeof t&&(t=e.mediaSequence+e.segments.length),tr){var s=[r,n];n=s[0],r=s[1]}if(n<0){for(var o=n;oDate.now()},Ql=function(e){return e.excludeUntil&&e.excludeUntil===1/0},$l=function(e){var t=Yl(e);return!e.disabled&&!t},Jl=function(e,t){return t.attributes&&t.attributes[e]},Zl=function(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter((function(e){return!!$l(e)&&(e.attributes.BANDWIDTH||0)0)for(var h=l-1;h>=0;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+1/30<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-Xl({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m0)continue}else if(o-1/30>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+Xl({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:$l,isDisabled:function(e){return e.disabled},isBlacklisted:Yl,isIncompatible:Ql,playlistEnd:Kl,isAes:function(e){for(var t=0;t-1&&s!==a.length-1&&(i._HLS_part=s),(s>-1||a.length)&&r--}i._HLS_msn=r}if(t.serverControl&&t.serverControl.canSkipUntil&&(i._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(i).length){var o=new A.URL(e);["_HLS_skip","_HLS_msn","_HLS_part"].forEach((function(e){i.hasOwnProperty(e)&&o.searchParams.set(e,i[e])})),e=o.toString()}return e}(i,t)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:i,withCredentials:this.withCredentials},(function(t,i){if(e.request)return t?e.playlistRequestError(e.request,e.media(),"HAVE_METADATA"):void e.haveMetadata({playlistString:e.request.responseText,url:e.media().uri,id:e.media().id})}))}},i.playlistRequestError=function(e,t,i){var n=t.uri,r=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[r],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")},i.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,s=e.customTagMappers,o=void 0===s?[]:s,u=e.experimentalLLHLS,l=new Be;t&&l.on("warn",t),i&&l.on("info",i),a.forEach((function(e){return l.addParser(e)})),o.forEach((function(e){return l.addTagMapper(e)})),l.push(n),l.end();var c=l.manifest;if(u||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach((function(e){c.hasOwnProperty(e)&&delete c[e]})),c.segments&&c.segments.forEach((function(e){["parts","preloadHints"].forEach((function(t){e.hasOwnProperty(t)&&delete e[t]}))}))),!c.targetDuration){var d=10;c.segments&&c.segments.length&&(d=c.segments.reduce((function(e,t){return Math.max(e,t.duration)}),0)),t&&t("manifest has no targetDuration defaulting to "+d),c.targetDuration=d}var h=Hl(c);if(h.length&&!c.partTargetDuration){var p=h.reduce((function(e,t){return Math.max(e,t.duration)}),0);t&&(t("manifest has no partTargetDuration defaulting to "+p),rc.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),c.partTargetDuration=p}return c}({onwarn:function(e){var n=e.message;return t.logger_("m3u8-parser warn for "+i+": "+n)},oninfo:function(e){var n=e.message;return t.logger_("m3u8-parser info for "+i+": "+n)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},i.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,r=e.id;this.request=null,this.state="HAVE_METADATA";var a=i||this.parseManifest_({url:n,manifestString:t});a.lastRequest=Date.now(),oc({playlist:a,uri:n,id:r});var s=mc(this.master,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,s?(this.master=s,this.media_=this.master.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(gc(this.media(),!!s)),this.trigger("loadedplaylist")},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),A.clearTimeout(this.finalRenditionTimeout),this.off()},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e,t){var i=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);if("string"===typeof e){if(!this.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.master.playlists[e]}if(A.clearTimeout(this.finalRenditionTimeout),t){var n=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=A.setTimeout(this.media.bind(this,e,!1),n)}else{var r=this.state,a=!this.media_||e.id!==this.media_.id,s=this.master.playlists[e.id];if(s&&s.endList||e.endList&&e.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,void(a&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(gc(e,!0)),a){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(function(t,n){if(i.request){if(e.lastRequest=Date.now(),e.resolvedUri=Al(i.handleManifestRedirects,e.resolvedUri,n),t)return i.playlistRequestError(i.request,e,r);i.haveMetadata({playlistString:n.responseText,url:e.uri,id:e.id}),"HAVE_MASTER"===r?i.trigger("loadedmetadata"):i.trigger("mediachange")}}))}}},i.pause=function(){this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),"HAVE_NOTHING"===this.state&&(this.started=!1),"SWITCHING_MEDIA"===this.state?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},i.load=function(e){var t=this;this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();if(e){var n=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout((function(){t.mediaUpdateTimeout=null,t.load()}),n)}else this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},i.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=A.setTimeout((function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)}),e))},i.start=function(){var e=this;if(this.started=!0,"object"===typeof this.src)return this.src.uri||(this.src.uri=A.location.href),this.src.resolvedUri=this.src.uri,void setTimeout((function(){e.setupInitialPlaylist(e.src)}),0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(function(t,i){if(e.request){if(e.request=null,t)return e.error={status:i.status,message:"HLS playlist request error at URL: "+e.src+".",responseText:i.responseText,code:2},"HAVE_NOTHING"===e.state&&(e.started=!1),e.trigger("error");e.src=Al(e.handleManifestRedirects,e.src,i);var n=e.parseManifest_({manifestString:i.responseText,url:e.src});e.setupInitialPlaylist(n)}}))},i.srcUri=function(){return"string"===typeof this.src?this.src:this.src.uri},i.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,uc(this.master,this.srcUri()),e.playlists.forEach((function(e){e.segments=pc(e),e.segments.forEach((function(t){hc(t,e.resolvedUri)}))})),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t=this.srcUri()||A.location.href;this.master=function(e,t){var i=ac(0,t),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:A.location.href,resolvedUri:A.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]};return n.playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n}(0,t),this.haveMetadata({playlistObject:e,url:t,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},t}(cc),yc=wl.xhr,_c=wl.mergeOptions,bc=function(e,t,i,n){var r="arraybuffer"===e.responseType?e.response:e.responseText;!t&&r&&(e.responseTime=Date.now(),e.roundTripTime=e.responseTime-e.requestTime,e.bytesReceived=r.byteLength||r.length,e.bandwidth||(e.bandwidth=Math.floor(e.bytesReceived/e.roundTripTime*8*1e3))),i.headers&&(e.responseHeaders=i.headers),t&&"ETIMEDOUT"===t.code&&(e.timedout=!0),t||e.aborted||200===i.statusCode||206===i.statusCode||0===i.statusCode||(t=new Error("XHR Failed with a response of: "+(e&&(r||e.responseText)))),n(t,e)},Tc=function(){var e=function e(t,i){t=_c({timeout:45e3},t);var n=e.beforeRequest||wl.Vhs.xhr.beforeRequest;if(n&&"function"===typeof n){var r=n(t);r&&(t=r)}var a=(!0===wl.Vhs.xhr.original?yc:wl.Vhs.xhr)(t,(function(e,t){return bc(a,e,t,i)})),s=a.abort;return a.abort=function(){return a.aborted=!0,s.apply(a,arguments)},a.uri=t.uri,a.requestTime=Date.now(),a};return e.original=!0,e},kc=function(e){var t,i={};return e.byterange&&(i.Range="bytes="+(t=e.byterange).offset+"-"+("bigint"===typeof t.offset||"bigint"===typeof t.length?A.BigInt(t.offset)+A.BigInt(t.length)-A.BigInt(1):t.offset+t.length-1)),i},Sc=function(e,t){return e.start(t)+"-"+e.end(t)},Ec=function(e,t){var i=e.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},Cc=function(e){return e>=32&&e<126?String.fromCharCode(e):"."},wc=function(e){var t={};return Object.keys(e).forEach((function(i){var n=e[i];ArrayBuffer.isView(n)?t[i]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:t[i]=n})),t},Ic=function(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")},Pc=function(e){return e.resolvedUri},xc=function(e){for(var t=Array.prototype.slice.call(e),i="",n=0;nn){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t);if(!a)return r({message:"valid programTime was not found"});if("estimate"===a.type)return r({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:a.estimatedStart});var s={mediaSeconds:n},o=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,n=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*n)}(n,a.segment);return o&&(s.programDateTime=o.toISOString()),r(null,s)},Lc=function e(t){var i=t.programTime,n=t.playlist,r=t.retryCount,a=void 0===r?2:r,s=t.seekTo,o=t.pauseAfterSeek,u=void 0===o||o,l=t.tech,c=t.callback;if(!c)throw new Error("seekToProgramTime: callback must be provided");if("undefined"===typeof i||!n||!s)return c({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!n.endList&&!l.hasStarted_)return c({message:"player must be playing a live stream to start buffering"});if(!function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;tnew Date(o.getTime()+1e3*u)?null:(i>o&&(n=s),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:nc.duration(t,t.mediaSequence+t.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})}(i,n);if(!d)return c({message:i+" was not found in the stream"});var h=d.segment,p=function(e,t){var i,n;try{i=new Date(e),n=new Date(t)}catch(e){}var r=i.getTime();return(n.getTime()-r)/1e3}(h.dateTimeObject,i);if("estimate"===d.type)return 0===a?c({message:i+" is not buffered yet. Try again"}):(s(d.estimatedStart+p),void l.one("seeked",(function(){e({programTime:i,playlist:n,retryCount:a-1,seekTo:s,pauseAfterSeek:u,tech:l,callback:c})})));var f=h.start+p;l.one("seeked",(function(){return c(null,l.currentTime())})),u&&l.pause(),s(f)},Dc=function(e,t){if(4===e.readyState)return t()},Rc=function(e,t,i){var n,r=[],a=!1,s=function(e,t,n,r){return t.abort(),a=!0,i(e,t,n,r)},o=function(e,t){if(!a){if(e)return s(e,t,"",r);var i=t.responseText.substring(r&&r.byteLength||0,t.responseText.length);if(r=function(){for(var e=arguments.length,t=new Array(e),i=0;i=c+l)return s(t,{response:o.subarray(l,l+c),status:i.status,uri:i.uri});n.request=n.vhs_.xhr({uri:a,responseType:"arraybuffer",headers:kc({byterange:e.sidx.byterange})},s)}))}else this.mediaRequest_=A.setTimeout((function(){return i(!1)}),0)},i.dispose=function(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},A.clearTimeout(this.minimumUpdatePeriodTimeout_),A.clearTimeout(this.mediaRequest_),A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},i.hasPendingRequest=function(){return this.request||this.mediaRequest_},i.stopRequest=function(){if(this.request){var e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}},i.media=function(e){var t=this;if(!e)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var i=this.state;if("string"===typeof e){if(!this.masterPlaylistLoader_.master.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.masterPlaylistLoader_.master.playlists[e]}var n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList)return this.state="HAVE_METADATA",this.media_=e,void(n&&(this.trigger("mediachanging"),this.trigger("mediachange")));n&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,i,(function(n){t.haveMetadata({startingState:i,playlist:e})})))},i.haveMetadata=function(e){var t=e.startingState,i=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[i.id]=i,this.mediaRequest_=null,this.refreshMedia_(i.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},i.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(A.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},i.load=function(e){var t=this;A.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();if(e){var n=i?i.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=A.setTimeout((function(){return t.load()}),n)}else this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},i.start=function(){var e=this;this.started=!0,this.isMaster_?this.requestMaster_((function(t,i){e.haveMaster_(),e.hasPendingRequest()||e.media_||e.media(e.masterPlaylistLoader_.master.playlists[0])})):this.mediaRequest_=A.setTimeout((function(){return e.haveMaster_()}),0)},i.requestMaster_=function(e){var t=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(function(i,n){if(!t.requestErrored_(i,n)){var r=n.responseText!==t.masterPlaylistLoader_.masterXml_;return t.masterPlaylistLoader_.masterXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?t.masterLoaded_=Date.parse(n.responseHeaders.date):t.masterLoaded_=Date.now(),t.masterPlaylistLoader_.srcUrl=Al(t.handleManifestRedirects,t.masterPlaylistLoader_.srcUrl,n),r?(t.handleMaster_(),void t.syncClientServerClock_((function(){return e(n,r)}))):e(n,r)}"HAVE_NOTHING"===t.state&&(t.started=!1)}))},i.syncClientServerClock_=function(e){var t=this,i=Mn(this.masterPlaylistLoader_.masterXml_);return null===i?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),e()):"DIRECT"===i.method?(this.masterPlaylistLoader_.clientOffset_=i.value-Date.now(),e()):void(this.request=this.vhs_.xhr({uri:xl(this.masterPlaylistLoader_.srcUrl,i.value),method:i.method,withCredentials:this.withCredentials},(function(n,r){if(t.request){if(n)return t.masterPlaylistLoader_.clientOffset_=t.masterLoaded_-Date.now(),e();var a;a="HEAD"===i.method?r.responseHeaders&&r.responseHeaders.date?Date.parse(r.responseHeaders.date):t.masterLoaded_:Date.parse(r.responseText),t.masterPlaylistLoader_.clientOffset_=a-Date.now(),e()}})))},i.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},i.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n,r,a,s,o=this.masterPlaylistLoader_.master,u=(e={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:o},t=e.masterXml,i=e.srcUrl,n=e.clientOffset,r=e.sidxMapping,a=e.previousManifest,s=Rn(t,{manifestUri:i,clientOffset:n,sidxMapping:r,previousManifest:a}),uc(s,i),s);o&&(u=function(e,t,i){for(var n=!0,r=Nc(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),a=0;a-1)},this.trigger=function(t){var i,n,r,a;if(i=e[t])if(2===arguments.length)for(r=i.length,n=0;n>>1,e.samplingfrequencyindex<<7|e.channelcount<<3,6,1,2]))},m=function(e){return t(k.hdlr,P[e])},f=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,e.duration>>>24&255,e.duration>>>16&255,e.duration>>>8&255,255&e.duration,85,196,0,0]);return e.samplerate&&(i[12]=e.samplerate>>>24&255,i[13]=e.samplerate>>>16&255,i[14]=e.samplerate>>>8&255,i[15]=255&e.samplerate),t(k.mdhd,i)},p=function(e){return t(k.mdia,f(e),m(e.type),s(e))},a=function(e){return t(k.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},s=function(e){return t(k.minf,"video"===e.type?t(k.vmhd,x):t(k.smhd,A),i(),v(e))},o=function(e,i){for(var n=[],r=i.length;r--;)n[r]=_(i[r]);return t.apply(null,[k.moof,a(e)].concat(n))},u=function(e){for(var i=e.length,n=[];i--;)n[i]=d(e[i]);return t.apply(null,[k.moov,c(4294967295)].concat(n).concat(l(e)))},l=function(e){for(var i=e.length,n=[];i--;)n[i]=b(e[i]);return t.apply(null,[k.mvex].concat(n))},c=function(e){var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t(k.mvhd,i)},g=function(e){var i,n,r=e.samples||[],a=new Uint8Array(4+r.length);for(n=0;n>>8),s.push(255&r[i].byteLength),s=s.concat(Array.prototype.slice.call(r[i]));for(i=0;i>>8),o.push(255&a[i].byteLength),o=o.concat(Array.prototype.slice.call(a[i]));if(n=[k.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(65280&e.width)>>8,255&e.width,(65280&e.height)>>8,255&e.height,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),t(k.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([r.length],s,[a.length],o))),t(k.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],e.sarRatio){var u=e.sarRatio[0],l=e.sarRatio[1];n.push(t(k.pasp,new Uint8Array([(4278190080&u)>>24,(16711680&u)>>16,(65280&u)>>8,255&u,(4278190080&l)>>24,(16711680&l)>>16,(65280&l)>>8,255&l])))}return t.apply(null,n)},U=function(e){return t(k.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(65280&e.channelcount)>>8,255&e.channelcount,(65280&e.samplesize)>>8,255&e.samplesize,0,0,0,0,(65280&e.samplerate)>>8,255&e.samplerate,0,0]),n(e))},h=function(e){var i=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,0,(4278190080&e.duration)>>24,(16711680&e.duration)>>16,(65280&e.duration)>>8,255&e.duration,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(65280&e.width)>>8,255&e.width,0,0,(65280&e.height)>>8,255&e.height,0,0]);return t(k.tkhd,i)},_=function(e){var i,n,r,a,s,o;return i=t(k.tfhd,new Uint8Array([0,0,0,58,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),s=Math.floor(e.baseMediaDecodeTime/W),o=Math.floor(e.baseMediaDecodeTime%W),n=t(k.tfdt,new Uint8Array([1,0,0,0,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o>>>24&255,o>>>16&255,o>>>8&255,255&o])),92,"audio"===e.type?(r=T(e,92),t(k.traf,i,n,r)):(a=g(e),r=T(e,a.length+92),t(k.traf,i,n,r,a))},d=function(e){return e.duration=e.duration||4294967295,t(k.trak,h(e),p(e))},b=function(e){var i=new Uint8Array([0,0,0,0,(4278190080&e.id)>>24,(16711680&e.id)>>16,(65280&e.id)>>8,255&e.id,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return"video"!==e.type&&(i[i.length-1]=0),t(k.trex,i)},j=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,1,(4278190080&e.length)>>>24,(16711680&e.length)>>>16,(65280&e.length)>>>8,255&e.length,(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},F=function(e,i){var n,r,a,s,o,u;for(i+=20+16*(s=e.samples||[]).length,a=j(s,i),(r=new Uint8Array(a.length+16*s.length)).set(a),n=a.length,u=0;u>>24,r[n++]=(16711680&o.duration)>>>16,r[n++]=(65280&o.duration)>>>8,r[n++]=255&o.duration,r[n++]=(4278190080&o.size)>>>24,r[n++]=(16711680&o.size)>>>16,r[n++]=(65280&o.size)>>>8,r[n++]=255&o.size,r[n++]=o.flags.isLeading<<2|o.flags.dependsOn,r[n++]=o.flags.isDependedOn<<6|o.flags.hasRedundancy<<4|o.flags.paddingValue<<1|o.flags.isNonSyncSample,r[n++]=61440&o.flags.degradationPriority,r[n++]=15&o.flags.degradationPriority,r[n++]=(4278190080&o.compositionTimeOffset)>>>24,r[n++]=(16711680&o.compositionTimeOffset)>>>16,r[n++]=(65280&o.compositionTimeOffset)>>>8,r[n++]=255&o.compositionTimeOffset;return t(k.trun,r)},B=function(e,i){var n,r,a,s,o,u;for(i+=20+8*(s=e.samples||[]).length,a=j(s,i),(n=new Uint8Array(a.length+8*s.length)).set(a),r=a.length,u=0;u>>24,n[r++]=(16711680&o.duration)>>>16,n[r++]=(65280&o.duration)>>>8,n[r++]=255&o.duration,n[r++]=(4278190080&o.size)>>>24,n[r++]=(16711680&o.size)>>>16,n[r++]=(65280&o.size)>>>8,n[r++]=255&o.size;return t(k.trun,n)},T=function(e,t){return"audio"===e.type?B(e,t):F(e,t)};r=function(){return t(k.ftyp,S,E,S,C)};var G,z,X,K,Y,Q,$,J,Z=function(e){return t(k.mdat,e)},ee=o,te=function(e){var t,i=r(),n=u(e);return(t=new Uint8Array(i.byteLength+n.byteLength)).set(i),t.set(n,i.byteLength),t},ie=function(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};return i.dataOffset=t,i.compositionTimeOffset=e.pts-e.dts,i.duration=e.duration,i.size=4*e.length,i.size+=e.byteLength,e.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},ne=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,n.byteLength=0,t=0;t1&&(t=e.shift(),e.byteLength-=t.byteLength,e.nalCount-=t.nalCount,e[0][0].dts=t.dts,e[0][0].pts=t.pts,e[0][0].duration+=t.duration),e},se=function(e,t){var i,n,r,a,s,o=t||0,u=[];for(i=0;ihe/2))){for((s=de()[e.samplerate])||(s=t[0].data),o=0;o=i?e:(t.minSegmentDts=1/0,e.filter((function(e){return e.dts>=i&&(t.minSegmentDts=Math.min(t.minSegmentDts,e.dts),t.minSegmentPts=t.minSegmentDts,!0)})))},be=function(e){var t,i,n=[];for(t=0;t=this.virtualRowCount&&"function"===typeof this.beforeRowOverflow&&this.beforeRowOverflow(e),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Re.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Re.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Re.prototype.backspace=function(){if(!this.isEmpty()){var e=this.rows[this.rowIdx];this.rows[this.rowIdx]=e.substr(0,e.length-1)}};var Me=function(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Re(-1),this.windows=[],this.stream=i,"string"===typeof t&&this.createTextDecoder(t)};Me.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Re(i),"function"===typeof t&&(this.windows[i].beforeRowOverflow=t)},Me.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Me.prototype.createTextDecoder=function(e){if("undefined"===typeof TextDecoder)this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(e)}catch(t){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+e+" encoding. "+t})}};var Ne=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach((function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)})),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){3===e.type?(n.new708Packet(),n.add708Bytes(e)):(null===n.current708Packet&&n.new708Packet(),n.add708Bytes(e))}};Ne.prototype=new V,Ne.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ne.prototype.add708Bytes=function(e){var t=e.ccData,i=t>>>8,n=255&t;this.current708Packet.ptsVals.push(e.pts),this.current708Packet.data.push(i),this.current708Packet.data.push(n)},Ne.prototype.push708Packet=function(){var e=this.current708Packet,t=e.data,i=null,n=null,r=0,a=t[r++];for(e.seq=a>>6,e.sizeCode=63&a;r>5)&&n>0&&(i=a=t[r++]),this.pushServiceBlock(i,r,n),n>0&&(r+=n-1)},Ne.prototype.pushServiceBlock=function(e,t,i){var n,r=t,a=this.current708Packet.data,s=this.services[e];for(s||(s=this.initService(e,r));r>5,a.rowLock=(16&n)>>4,a.columnLock=(8&n)>>3,a.priority=7&n,n=i[++e],a.relativePositioning=(128&n)>>7,a.anchorVertical=127&n,n=i[++e],a.anchorHorizontal=n,n=i[++e],a.anchorPoint=(240&n)>>4,a.rowCount=15&n,n=i[++e],a.columnCount=63&n,n=i[++e],a.windowStyle=(56&n)>>3,a.penStyle=7&n,a.virtualRowCount=a.rowCount+1,e},Ne.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.winAttr;return n=i[++e],r.fillOpacity=(192&n)>>6,r.fillRed=(48&n)>>4,r.fillGreen=(12&n)>>2,r.fillBlue=3&n,n=i[++e],r.borderType=(192&n)>>6,r.borderRed=(48&n)>>4,r.borderGreen=(12&n)>>2,r.borderBlue=3&n,n=i[++e],r.borderType+=(128&n)>>5,r.wordWrap=(64&n)>>6,r.printDirection=(48&n)>>4,r.scrollDirection=(12&n)>>2,r.justify=3&n,n=i[++e],r.effectSpeed=(240&n)>>4,r.effectDirection=(12&n)>>2,r.displayEffect=3&n,e},Ne.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Ne.prototype.pushCaption=function(e){""!==e.text&&(this.trigger("data",{startPts:e.startPts,endPts:e.endPts,text:e.text,stream:"cc708_"+e.serviceNum}),e.text="",e.startPts=e.endPts)},Ne.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<>4,r.offset=(12&n)>>2,r.penSize=3&n,n=i[++e],r.italics=(128&n)>>7,r.underline=(64&n)>>6,r.edgeType=(56&n)>>3,r.fontStyle=7&n,e},Ne.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penColor;return n=i[++e],r.fgOpacity=(192&n)>>6,r.fgRed=(48&n)>>4,r.fgGreen=(12&n)>>2,r.fgBlue=3&n,n=i[++e],r.bgOpacity=(192&n)>>6,r.bgRed=(48&n)>>4,r.bgGreen=(12&n)>>2,r.bgBlue=3&n,n=i[++e],r.edgeRed=(48&n)>>4,r.edgeGreen=(12&n)>>2,r.edgeBlue=3&n,e},Ne.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Ne.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};var Ue={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,304:174,305:176,306:189,307:191,308:8482,309:162,310:163,311:9834,312:224,313:160,314:232,315:226,316:234,317:238,318:244,319:251,544:193,545:201,546:211,547:218,548:220,549:252,550:8216,551:161,552:42,553:39,554:8212,555:169,556:8480,557:8226,558:8220,559:8221,560:192,561:194,562:199,563:200,564:202,565:203,566:235,567:206,568:207,569:239,570:212,571:217,572:249,573:219,574:171,575:187,800:195,801:227,802:205,803:204,804:236,805:210,806:242,807:213,808:245,809:123,810:125,811:92,812:94,813:95,814:124,815:126,816:196,817:228,818:214,819:246,820:223,821:165,822:164,823:9474,824:197,825:229,826:216,827:248,828:9484,829:9488,830:9492,831:9496},Be=function(e){return null===e?"":(e=Ue[e]||e,String.fromCharCode(e))},Fe=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],je=function(){for(var e=[],t=15;t--;)e.push("");return e},Ve=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a;if((t=32639&e.ccData)!==this.lastControlCode_){if(4096===(61440&t)?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),n=t>>>8,r=255&t,t!==this.PADDING_)if(t===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(t===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(e.pts),this.flushDisplayed(e.pts),i=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=i,this.startPts_=e.pts;else if(t===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(e.pts);else if(t===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(e.pts);else if(t===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(e.pts);else if(t===this.CARRIAGE_RETURN_)this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts;else if(t===this.BACKSPACE_)"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1);else if(t===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(e.pts),this.displayed_=je();else if(t===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=je();else if(t===this.RESUME_DIRECT_CAPTIONING_)"paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=je()),this.mode_="paintOn",this.startPts_=e.pts;else if(this.isSpecialCharacter(n,r))a=Be((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isExtCharacter(n,r))"popOn"===this.mode_?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),a=Be((n=(3&n)<<8)|r),this[this.mode_](e.pts,a),this.column_++;else if(this.isMidRowCode(n,r))this.clearFormatting(e.pts),this[this.mode_](e.pts," "),this.column_++,14===(14&r)&&this.addFormatting(e.pts,["i"]),1===(1&r)&&this.addFormatting(e.pts,["u"]);else if(this.isOffsetControlCode(n,r))this.column_+=3&r;else if(this.isPAC(n,r)){var s=Fe.indexOf(7968&t);"rollUp"===this.mode_&&(s-this.rollUpRows_+1<0&&(s=this.rollUpRows_-1),this.setRollUp(e.pts,s)),s!==this.row_&&(this.clearFormatting(e.pts),this.row_=s),1&r&&-1===this.formatting_.indexOf("u")&&this.addFormatting(e.pts,["u"]),16===(16&t)&&(this.column_=4*((14&t)>>1)),this.isColorPAC(r)&&14===(14&r)&&this.addFormatting(e.pts,["i"])}else this.isNormalChar(n)&&(0===r&&(r=null),a=Be(n),a+=Be(r),this[this.mode_](e.pts,a),this.column_+=a.length)}else this.lastControlCode_=null}};Ve.prototype=new V,Ve.prototype.flushDisplayed=function(e){var t=this.displayed_.map((function(e,t){try{return e.trim()}catch(e){return this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+t+"."}),""}}),this).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:e,text:t,stream:this.name_})},Ve.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=je(),this.nonDisplayed_=je(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ve.prototype.setConstants=function(){0===this.dataChannel_?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):1===this.dataChannel_&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=32|this.CONTROL_,this.END_OF_CAPTION_=47|this.CONTROL_,this.ROLL_UP_2_ROWS_=37|this.CONTROL_,this.ROLL_UP_3_ROWS_=38|this.CONTROL_,this.ROLL_UP_4_ROWS_=39|this.CONTROL_,this.CARRIAGE_RETURN_=45|this.CONTROL_,this.RESUME_DIRECT_CAPTIONING_=41|this.CONTROL_,this.BACKSPACE_=33|this.CONTROL_,this.ERASE_DISPLAYED_MEMORY_=44|this.CONTROL_,this.ERASE_NON_DISPLAYED_MEMORY_=46|this.CONTROL_},Ve.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&t>=48&&t<=63},Ve.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&t>=32&&t<=63},Ve.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&t>=32&&t<=47},Ve.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&t>=33&&t<=35},Ve.prototype.isPAC=function(e,t){return e>=this.BASE_&&e=64&&t<=127},Ve.prototype.isColorPAC=function(e){return e>=64&&e<=79||e>=96&&e<=127},Ve.prototype.isNormalChar=function(e){return e>=32&&e<=127},Ve.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=je(),this.displayed_=je()),void 0!==t&&t!==this.row_)for(var i=0;i"}),"");this[this.mode_](e,i)},Ve.prototype.clearFormatting=function(e){if(this.formatting_.length){var t=this.formatting_.reverse().reduce((function(e,t){return e+""}),"");this.formatting_=[],this[this.mode_](e,t)}},Ve.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];i+=t,this.nonDisplayed_[this.row_]=i},Ve.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];i+=t,this.displayed_[this.row_]=i},Ve.prototype.shiftRowsUp_=function(){var e;for(e=0;et&&(i=-1);Math.abs(t-e)>4294967296;)e+=8589934592*i;return e},Ge=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=We(e.dts,n),e.pts=We(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){n=void 0,i=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};Ge.prototype=new V;var ze,Xe=Ge,Ke=We,Ye=function(e,t,i){var n,r="";for(n=t;n>>2;c*=4,c+=3&l[7],o.timeStamp=c,void 0===t.pts&&void 0===t.dts&&(t.pts=o.timeStamp,t.dts=o.timeStamp),this.trigger("timestamp",o)}t.frames.push(o),i+=10,i+=s}while(i>>4>1&&(n+=t[n]+1),0===i.pid)i.type="pat",e(t.subarray(n),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",e(t.subarray(n),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else void 0===this.programMapTable?this.packetsWaitingForPmt.push([t,n,i]):this.processPes_(t,n,i)},this.processPes_=function(e,t,i){i.pid===this.programMapTable.video?i.streamType=qe.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=qe.ADTS_STREAM_TYPE:i.streamType=this.programMapTable["timed-metadata"][i.pid],i.type="pes",i.data=e.subarray(t),this.trigger("data",i)}}).prototype=new V,et.STREAM_TYPES={h264:27,adts:15},(tt=function(){var e,t=this,i=!1,n={data:[],size:0},r={data:[],size:0},a={data:[],size:0},s=function(e,i,n){var r,a,s=new Uint8Array(e.size),o={type:i},u=0,l=0;if(e.data.length&&!(e.size<9)){for(o.trackId=e.data[0].pid,u=0;u>>3,d.pts*=4,d.pts+=(6&c[13])>>>1,d.dts=d.pts,64&h&&(d.dts=(14&c[14])<<27|(255&c[15])<<20|(254&c[16])<<12|(255&c[17])<<5|(254&c[18])>>>3,d.dts*=4,d.dts+=(6&c[18])>>>1)),d.data=c.subarray(9+c[8])),r="video"===i||o.packetLength<=e.size,(n||r)&&(e.size=0,e.data.length=0),r&&t.trigger("data",o)}};tt.prototype.init.call(this),this.push=function(o){({pat:function(){},pes:function(){var e,t;switch(o.streamType){case qe.H264_STREAM_TYPE:e=n,t="video";break;case qe.ADTS_STREAM_TYPE:e=r,t="audio";break;case qe.METADATA_STREAM_TYPE:e=a,t="timed-metadata";break;default:return}o.payloadUnitStartIndicator&&s(e,t,!0),e.data.push(o),e.size+=o.data.byteLength},pmt:function(){var n={type:"metadata",tracks:[]};null!==(e=o.programMapTable).video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),i=!0,t.trigger("data",n)}})[o.type]()},this.reset=function(){n.size=0,n.data.length=0,r.size=0,r.data.length=0,this.trigger("reset")},this.flushStreams_=function(){s(n,"video"),s(r,"audio"),s(a,"timed-metadata")},this.flush=function(){if(!i&&e){var n={type:"metadata",tracks:[]};null!==e.video&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.video,codec:"avc",type:"video"}),null!==e.audio&&n.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+e.audio,codec:"adts",type:"audio"}),t.trigger("data",n)}i=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new V;var rt={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ze,TransportParseStream:et,ElementaryStream:tt,TimestampRolloverStream:nt,CaptionStream:He.CaptionStream,Cea608Stream:He.Cea608Stream,Cea708Stream:He.Cea708Stream,MetadataStream:it};for(var at in qe)qe.hasOwnProperty(at)&&(rt[at]=qe[at]);var st,ot=rt,ut=he,lt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];(st=function(e){var t,i=0;st.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+i+" outside syncword"})},this.push=function(n){var r,a,s,o,u,l=0;if(e||(i=0),"audio"===n.type){var c;for(t&&t.length?(s=t,(t=new Uint8Array(s.byteLength+n.data.byteLength)).set(s),t.set(n.data,s.byteLength)):t=n.data;l+7>5,u=(o=1024*(1+(3&t[l+6])))*ut/lt[(60&t[l+2])>>>2],t.byteLength-l>>6&3),channelcount:(1&t[l+2])<<2|(192&t[l+3])>>>6,samplerate:lt[(60&t[l+2])>>>2],samplingfrequencyindex:(60&t[l+2])>>>2,samplesize:16,data:t.subarray(l+7+a,l+r)}),i++,l+=r}else"number"!==typeof c&&(c=l),l++;"number"===typeof c&&(this.skipWarn_(c,l),c=null),t=t.subarray(l)}},this.flush=function(){i=0,this.trigger("done")},this.reset=function(){t=void 0,this.trigger("reset")},this.endTimeline=function(){t=void 0,this.trigger("endedtimeline")}}).prototype=new V;var ct,dt,ht,pt=st,ft=function(e){var t=e.byteLength,i=0,n=0;this.length=function(){return 8*t},this.bitsAvailable=function(){return 8*t+n},this.loadWord=function(){var r=e.byteLength-t,a=new Uint8Array(4),s=Math.min(4,t);if(0===s)throw new Error("no bytes available");a.set(e.subarray(r,r+s)),i=new DataView(a.buffer).getUint32(0),n=8*s,t-=s},this.skipBits=function(e){var r;n>e?(i<<=e,n-=e):(e-=n,e-=8*(r=Math.floor(e/8)),t-=r,this.loadWord(),i<<=e,n-=e)},this.readBits=function(e){var r=Math.min(n,e),a=i>>>32-r;return(n-=r)>0?i<<=r:t>0&&this.loadWord(),(r=e-r)>0?a<>>e))return i<<=e,n-=e,e;return this.loadWord(),e+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var e=this.skipLeadingZeros();return this.readBits(e+1)-1},this.readExpGolomb=function(){var e=this.readUnsignedExpGolomb();return 1&e?1+e>>>1:-1*(e>>>1)},this.readBoolean=function(){return 1===this.readBits(1)},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};(dt=function(){var e,t,i=0;dt.prototype.init.call(this),this.push=function(n){var r;t?((r=new Uint8Array(t.byteLength+n.data.byteLength)).set(t),r.set(n.data,t.byteLength),t=r):t=n.data;for(var a=t.byteLength;i3&&this.trigger("data",t.subarray(i+3)),t=null,i=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}}).prototype=new V,ht={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},(ct=function(){var e,t,i,n,r,a,s,o=new dt;ct.prototype.init.call(this),e=this,this.push=function(e){"video"===e.type&&(t=e.trackId,i=e.pts,n=e.dts,o.push(e))},o.on("data",(function(s){var o={trackId:t,pts:i,dts:n,data:s,nalUnitTypeCode:31&s[0]};switch(o.nalUnitTypeCode){case 5:o.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:o.nalUnitType="sei_rbsp",o.escapedRBSP=r(s.subarray(1));break;case 7:o.nalUnitType="seq_parameter_set_rbsp",o.escapedRBSP=r(s.subarray(1)),o.config=a(o.escapedRBSP);break;case 8:o.nalUnitType="pic_parameter_set_rbsp";break;case 9:o.nalUnitType="access_unit_delimiter_rbsp"}e.trigger("data",o)})),o.on("done",(function(){e.trigger("done")})),o.on("partialdone",(function(){e.trigger("partialdone")})),o.on("reset",(function(){e.trigger("reset")})),o.on("endedtimeline",(function(){e.trigger("endedtimeline")})),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},s=function(e,t){var i,n=8,r=8;for(i=0;i=0?i:0,(16&e[t+5])>>4?i+20:i+10},_t=function(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]},bt={isLikelyAacData:function(e){var t=function e(t,i){return t.length-i<10||t[i]!=="I".charCodeAt(0)||t[i+1]!=="D".charCodeAt(0)||t[i+2]!=="3".charCodeAt(0)?i:e(t,i+=yt(t,i))}(e,0);return e.length>=t+2&&255===(255&e[t])&&240===(240&e[t+1])&&16===(22&e[t+1])},parseId3TagSize:yt,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|i},parseType:function(e,t){return e[t]==="I".charCodeAt(0)&&e[t+1]==="D".charCodeAt(0)&&e[t+2]==="3".charCodeAt(0)?"timed-metadata":!0&e[t]&&240===(240&e[t+1])?"audio":null},parseSampleRate:function(e){for(var t=0;t+5>>2];t++}return null},parseAacTimestamp:function(e){var t,i,n;t=10,64&e[5]&&(t+=4,t+=_t(e.subarray(10,14)));do{if((i=_t(e.subarray(t+4,t+8)))<1)return null;if("PRIV"===String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])){n=e.subarray(t+10,t+i+10);for(var r=0;r>>2;return s*=4,s+=3&a[7]}break}}t+=10,t+=i}while(t=3;)if(e[u]!=="I".charCodeAt(0)||e[u+1]!=="D".charCodeAt(0)||e[u+2]!=="3".charCodeAt(0))if(255!==(255&e[u])||240!==(240&e[u+1]))u++;else{if(e.length-u<7)break;if(u+(o=bt.parseAdtsSize(e,u))>e.length)break;a={type:"audio",data:e.subarray(u,u+o),pts:t,dts:t},this.trigger("data",a),u+=o}else{if(e.length-u<10)break;if(u+(o=bt.parseId3TagSize(e,u))>e.length)break;r={type:"timed-metadata",data:e.subarray(u,u+o)},this.trigger("data",r),u+=o}n=e.length-u,e=n>0?e.subarray(u):new Uint8Array},this.reset=function(){e=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){e=new Uint8Array,this.trigger("endedtimeline")}}).prototype=new V;var Tt,kt,St,Et,Ct=mt,wt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],It=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Pt=gt.H264Stream,xt=bt.isLikelyAacData,At=he,Ot=function(e,t){t.stream=e,this.trigger("log",t)},Lt=function(e,t){for(var i=Object.keys(t),n=0;n=-1e4&&i<=45e3&&(!n||o>i)&&(n=a,o=i));return n?n.gop:null},this.alignGopsAtStart_=function(e){var t,i,n,r,a,o,u,l;for(a=e.byteLength,o=e.nalCount,u=e.duration,t=i=0;tn.pts?t++:(i++,a-=r.byteLength,o-=r.nalCount,u-=r.duration);return 0===i?e:i===e.length?null:((l=e.slice(i)).byteLength=a,l.duration=u,l.nalCount=o,l.pts=l[0].pts,l.dts=l[0].dts,l)},this.alignGopsAtEnd_=function(e){var t,i,n,r,a,o,u;for(t=s.length-1,i=e.length-1,a=null,o=!1;t>=0&&i>=0;){if(n=s[t],r=e[i],n.pts===r.pts){o=!0;break}n.pts>r.pts?t--:(t===s.length-1&&(a=i),i--)}if(!o&&null===a)return null;if(0===(u=o?i:a))return e;var l=e.slice(u),c=l.reduce((function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e}),{byteLength:0,duration:0,nalCount:0});return l.byteLength=c.byteLength,l.duration=c.duration,l.nalCount=c.nalCount,l.pts=l[0].pts,l.dts=l[0].dts,l},this.alignGopsWith=function(e){s=e}}).prototype=new V,(Et=function(e,t){this.numberOfTracks=0,this.metadataStream=t,"undefined"!==typeof(e=e||{}).remux?this.remuxTracks=!!e.remux:this.remuxTracks=!0,"boolean"===typeof e.keepOriginalTimestamps?this.keepOriginalTimestamps=e.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Et.prototype.init.call(this),this.push=function(e){return e.text?this.pendingCaptions.push(e):e.frames?this.pendingMetadata.push(e):(this.pendingTracks.push(e.track),this.pendingBytes+=e.boxes.byteLength,"video"===e.track.type&&(this.videoTrack=e.track,this.pendingBoxes.push(e.boxes)),void("audio"===e.track.type&&(this.audioTrack=e.track,this.pendingBoxes.unshift(e.boxes))))}}).prototype=new V,Et.prototype.flush=function(e){var t,i,n,r,a=0,s={captions:[],captionStreams:{},metadata:[],info:{}},o=0;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0))}if(this.videoTrack?(o=this.videoTrack.timelineStartInfo.pts,It.forEach((function(e){s.info[e]=this.videoTrack[e]}),this)):this.audioTrack&&(o=this.audioTrack.timelineStartInfo.pts,wt.forEach((function(e){s.info[e]=this.audioTrack[e]}),this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?s.type=this.pendingTracks[0].type:s.type="combined",this.emittedTracks+=this.pendingTracks.length,n=te(this.pendingTracks),s.initSegment=new Uint8Array(n.byteLength),s.initSegment.set(n),s.data=new Uint8Array(this.pendingBytes),r=0;r=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Et.prototype.setRemux=function(e){this.remuxTracks=e},(St=function(e){var t,i,n=this,r=!0;St.prototype.init.call(this),e=e||{},this.baseMediaDecodeTime=e.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="aac",r.metadataStream=new ot.MetadataStream,r.aacStream=new Ct,r.audioTimestampRolloverStream=new ot.TimestampRolloverStream("audio"),r.timedMetadataTimestampRolloverStream=new ot.TimestampRolloverStream("timed-metadata"),r.adtsStream=new pt,r.coalesceStream=new Et(e,r.metadataStream),r.headOfPipeline=r.aacStream,r.aacStream.pipe(r.audioTimestampRolloverStream).pipe(r.adtsStream),r.aacStream.pipe(r.timedMetadataTimestampRolloverStream).pipe(r.metadataStream).pipe(r.coalesceStream),r.metadataStream.on("timestamp",(function(e){r.aacStream.setTimestamp(e.timeStamp)})),r.aacStream.on("data",(function(a){"timed-metadata"!==a.type&&"audio"!==a.type||r.audioSegmentStream||(i=i||{timelineStartInfo:{baseMediaDecodeTime:n.baseMediaDecodeTime},codec:"adts",type:"audio"},r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t}))})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Lt(this,r)},this.setupTsPipeline=function(){var r={};this.transmuxPipeline_=r,r.type="ts",r.metadataStream=new ot.MetadataStream,r.packetStream=new ot.TransportPacketStream,r.parseStream=new ot.TransportParseStream,r.elementaryStream=new ot.ElementaryStream,r.timestampRolloverStream=new ot.TimestampRolloverStream,r.adtsStream=new pt,r.h264Stream=new Pt,r.captionStream=new ot.CaptionStream(e),r.coalesceStream=new Et(e,r.metadataStream),r.headOfPipeline=r.packetStream,r.packetStream.pipe(r.parseStream).pipe(r.elementaryStream).pipe(r.timestampRolloverStream),r.timestampRolloverStream.pipe(r.h264Stream),r.timestampRolloverStream.pipe(r.adtsStream),r.timestampRolloverStream.pipe(r.metadataStream).pipe(r.coalesceStream),r.h264Stream.pipe(r.captionStream).pipe(r.coalesceStream),r.elementaryStream.on("data",(function(a){var s;if("metadata"===a.type){for(s=a.tracks.length;s--;)t||"video"!==a.tracks[s].type?i||"audio"!==a.tracks[s].type||((i=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime):(t=a.tracks[s]).timelineStartInfo.baseMediaDecodeTime=n.baseMediaDecodeTime;t&&!r.videoSegmentStream&&(r.coalesceStream.numberOfTracks++,r.videoSegmentStream=new Tt(t,e),r.videoSegmentStream.on("log",n.getLogTrigger_("videoSegmentStream")),r.videoSegmentStream.on("timelineStartInfo",(function(t){i&&!e.keepOriginalTimestamps&&(i.timelineStartInfo=t,r.audioSegmentStream.setEarliestDts(t.dts-n.baseMediaDecodeTime))})),r.videoSegmentStream.on("processedGopsInfo",n.trigger.bind(n,"gopInfo")),r.videoSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"videoSegmentTimingInfo")),r.videoSegmentStream.on("baseMediaDecodeTime",(function(e){i&&r.audioSegmentStream.setVideoBaseMediaDecodeTime(e)})),r.videoSegmentStream.on("timingInfo",n.trigger.bind(n,"videoTimingInfo")),r.h264Stream.pipe(r.videoSegmentStream).pipe(r.coalesceStream)),i&&!r.audioSegmentStream&&(r.coalesceStream.numberOfTracks++,r.audioSegmentStream=new kt(i,e),r.audioSegmentStream.on("log",n.getLogTrigger_("audioSegmentStream")),r.audioSegmentStream.on("timingInfo",n.trigger.bind(n,"audioTimingInfo")),r.audioSegmentStream.on("segmentTimingInfo",n.trigger.bind(n,"audioSegmentTimingInfo")),r.adtsStream.pipe(r.audioSegmentStream).pipe(r.coalesceStream)),n.trigger("trackinfo",{hasAudio:!!i,hasVideo:!!t})}})),r.coalesceStream.on("data",this.trigger.bind(this,"data")),r.coalesceStream.on("id3Frame",(function(e){e.dispatchType=r.metadataStream.dispatchType,n.trigger("id3Frame",e)})),r.coalesceStream.on("caption",this.trigger.bind(this,"caption")),r.coalesceStream.on("done",this.trigger.bind(this,"done")),Lt(this,r)},this.setBaseMediaDecodeTime=function(n){var r=this.transmuxPipeline_;e.keepOriginalTimestamps||(this.baseMediaDecodeTime=n),i&&(i.timelineStartInfo.dts=void 0,i.timelineStartInfo.pts=void 0,Se(i),r.audioTimestampRolloverStream&&r.audioTimestampRolloverStream.discontinuity()),t&&(r.videoSegmentStream&&(r.videoSegmentStream.gopCache_=[]),t.timelineStartInfo.dts=void 0,t.timelineStartInfo.pts=void 0,Se(t),r.captionStream.reset()),r.timestampRolloverStream&&r.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){i&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(t){var i=this.transmuxPipeline_;e.remux=t,i&&i.coalesceStream&&i.coalesceStream.setRemux(t)},this.alignGopsWith=function(e){t&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(e)},this.getLogTrigger_=function(e){var t=this;return function(i){i.stream=e,t.trigger("log",i)}},this.push=function(e){if(r){var t=xt(e);t&&"aac"!==this.transmuxPipeline_.type?this.setupAacPipeline():t||"ts"===this.transmuxPipeline_.type||this.setupTsPipeline(),r=!1}this.transmuxPipeline_.headOfPipeline.push(e)},this.flush=function(){r=!0,this.transmuxPipeline_.headOfPipeline.flush()},this.endTimeline=function(){this.transmuxPipeline_.headOfPipeline.endTimeline()},this.reset=function(){this.transmuxPipeline_.headOfPipeline&&this.transmuxPipeline_.headOfPipeline.reset()},this.resetCaptions=function(){this.transmuxPipeline_.captionStream&&this.transmuxPipeline_.captionStream.reset()}}).prototype=new V;var Mt,Nt,Ut,Bt={Transmuxer:St,VideoSegmentStream:Tt,AudioSegmentStream:kt,AUDIO_PROPERTIES:wt,VIDEO_PROPERTIES:It,generateSegmentTimingInfo:Rt},Ft=function(e){return e>>>0},jt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Vt=Ft,Ht=function e(t,i){var n,r,a,s,o,u=[];if(!i.length)return null;for(n=0;n1?n+r:t.byteLength,a===i[0]&&(1===i.length?u.push(t.subarray(n+8,s)):(o=e(t.subarray(n+8,s),i.slice(1))).length&&(u=u.concat(o))),n=s;return u},qt=Ft,Wt=q.getUint64,Gt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Wt(e.subarray(4)):t.baseMediaDecodeTime=qt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},zt=function(e){return{isLeading:(12&e[0])>>>2,dependsOn:3&e[0],isDependedOn:(192&e[1])>>>6,hasRedundancy:(48&e[1])>>>4,paddingValue:(14&e[1])>>>1,isNonSyncSample:1&e[1],degradationPriority:e[2]<<8|e[3]}},Xt=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],c=n.getUint32(4),d=8;for(r&&(i.dataOffset=n.getInt32(d),d+=4),a&&c&&(t={flags:zt(e.subarray(d,d+4))},d+=4,s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t),c--);c--;)t={},s&&(t.duration=n.getUint32(d),d+=4),o&&(t.size=n.getUint32(d),d+=4),u&&(t.flags=zt(e.subarray(d,d+4)),d+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(d):t.compositionTimeOffset=n.getUint32(d),d+=4),i.samples.push(t);return i},Kt=function(e){var t,i=new DataView(e.buffer,e.byteOffset,e.byteLength),n={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:i.getUint32(4)},r=1&n.flags[2],a=2&n.flags[2],s=8&n.flags[2],o=16&n.flags[2],u=32&n.flags[2],l=65536&n.flags[0],c=131072&n.flags[0];return t=8,r&&(t+=4,n.baseDataOffset=i.getUint32(12),t+=4),a&&(n.sampleDescriptionIndex=i.getUint32(t),t+=4),s&&(n.defaultSampleDuration=i.getUint32(t),t+=4),o&&(n.defaultSampleSize=i.getUint32(t),t+=4),u&&(n.defaultSampleFlags=i.getUint32(t)),l&&(n.durationIsEmpty=!0),!r&&c&&(n.baseDataOffsetIsMoof=!0),n},Yt="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},Qt="undefined"!==typeof window?window:"undefined"!==typeof Yt?Yt:"undefined"!==typeof self?self:{},$t=xe,Jt=He.CaptionStream,Zt=function(e,t){for(var i=e,n=0;n0?Gt(l[0]).baseMediaDecodeTime:0,d=Ht(a,["trun"]);t===u&&d.length>0&&(i=function(e,t,i){var n,r,a,s,o=new DataView(e.buffer,e.byteOffset,e.byteLength),u={logs:[],seiNals:[]};for(r=0;r+40;){var u=t.shift();this.parse(u,a,s)}return(o=function(e,t,i){if(null===t)return null;var n=ei(e,t)[t]||{};return{seiNals:n.seiNals,logs:n.logs,timescale:i}}(e,i,n))&&o.logs&&(r.logs=r.logs.concat(o.logs)),null!==o&&o.seiNals?(this.pushNals(o.seiNals),this.flushStream(),r):r.logs.length?{logs:r.logs,captions:[],captionStreams:[]}:null},this.pushNals=function(t){if(!this.isInitialized()||!t||0===t.length)return null;t.forEach((function(t){e.push(t)}))},this.flushStream=function(){if(!this.isInitialized())return null;a?e.partialFlush():e.flush()},this.clearParsedCaptions=function(){r.captions=[],r.captionStreams={},r.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;e.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){t=[],i=null,n=null,r?this.clearParsedCaptions():r={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},ii=Ft,ni=function(e){return("00"+e.toString(16)).slice(-2)},ri=q.getUint64;Mt=function(e,t){var i=Ht(t,["moof","traf"]).reduce((function(t,i){var n,r,a=Ht(i,["tfhd"])[0],s=ii(a[4]<<24|a[5]<<16|a[6]<<8|a[7]),o=e[s]||9e4,u=Ht(i,["tfdt"])[0],l=new DataView(u.buffer,u.byteOffset,u.byteLength);return"bigint"===typeof(n=1===u[0]?ri(u.subarray(4,12)):l.getUint32(4))?r=n/Qt.BigInt(o):"number"!==typeof n||isNaN(n)||(r=n/o),r11?(r.codec+=".",r.codec+=ni(c[9]),r.codec+=ni(c[10]),r.codec+=ni(c[11])):r.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(r.codec)?(c=d.subarray(28),"esds"===jt(c.subarray(4,8))&&c.length>20&&0!==c[19]?(r.codec+="."+ni(c[19]),r.codec+="."+ni(c[20]>>>2&63).replace(/^0/,"")):r.codec="mp4a.40.2"):r.codec=r.codec.toLowerCase())}var h=Ht(e,["mdia","mdhd"])[0];h&&(r.timescale=Ut(h)),i.push(r)})),i};var ai=Mt,si=Nt,oi=(Ut=function(e){var t=0===e[0]?12:20;return ii(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])},function(e){var t=31&e[1];return t<<=8,t|=e[2]}),ui=function(e){return!!(64&e[1])},li=function(e){var t=0;return(48&e[3])>>>4>1&&(t+=e[4]+1),t},ci=function(e){switch(e){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},di={parseType:function(e,t){var i=oi(e);return 0===i?"pat":i===t?"pmt":t?"pes":null},parsePat:function(e){var t=ui(e),i=4+li(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=ui(e),n=4+li(e);if(i&&(n+=e[n]+1),1&e[n+5]){var r;r=3+((15&e[n+1])<<8|e[n+2])-4;for(var a=12+((15&e[n+10])<<8|e[n+11]);a=e.byteLength)return null;var i,n=null;return 192&(i=e[t+7])&&((n={}).pts=(14&e[t+9])<<27|(255&e[t+10])<<20|(254&e[t+11])<<12|(255&e[t+12])<<5|(254&e[t+13])>>>3,n.pts*=4,n.pts+=(6&e[t+13])>>>1,n.dts=n.pts,64&i&&(n.dts=(14&e[t+14])<<27|(255&e[t+15])<<20|(254&e[t+16])<<12|(255&e[t+17])<<5|(254&e[t+18])>>>3,n.dts*=4,n.dts+=(6&e[t+18])>>>1)),n},videoPacketContainsKeyFrame:function(e){for(var t=4+li(e),i=e.subarray(t),n=0,r=0,a=!1;r3&&"slice_layer_without_partitioning_rbsp_idr"===ci(31&i[r+3])&&(a=!0),a}},hi=Ke,pi={};pi.ts=di,pi.aac=bt;var fi=he,mi=function(e,t,i){for(var n,r,a,s,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{switch(n=e.subarray(o,u),pi.ts.parseType(n,t.pid)){case"pes":r=pi.ts.parsePesType(n,t.table),a=pi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=pi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;o>=0;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{switch(n=e.subarray(o,u),pi.ts.parseType(n,t.pid)){case"pes":r=pi.ts.parsePesType(n,t.table),a=pi.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=pi.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)}if(l)break;o-=188,u-=188}},gi=function(e,t,i){for(var n,r,a,s,o,u,l,c=0,d=188,h=!1,p={data:[],size:0};d=0;)if(71!==e[c]||71!==e[d])c--,d--;else{switch(n=e.subarray(c,d),pi.ts.parseType(n,t.pid)){case"pes":r=pi.ts.parsePesType(n,t.table),a=pi.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=pi.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),h=!0)}if(h)break;c-=188,d-=188}},vi=function(e){var t={pid:null,table:null},i={};for(var n in function(e,t){for(var i,n=0,r=188;r=3;){switch(pi.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=pi.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=pi.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=pi.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=pi.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=fi/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}(e):vi(e))&&(i.audio||i.video)?(function(e,t){if(e.audio&&e.audio.length){var i=t;("undefined"===typeof i||isNaN(i))&&(i=e.audio[0].dts),e.audio.forEach((function(e){e.dts=hi(e.dts,i),e.pts=hi(e.pts,i),e.dtsTime=e.dts/fi,e.ptsTime=e.pts/fi}))}if(e.video&&e.video.length){var n=t;if(("undefined"===typeof n||isNaN(n))&&(n=e.video[0].dts),e.video.forEach((function(e){e.dts=hi(e.dts,n),e.pts=hi(e.pts,n),e.dtsTime=e.dts/fi,e.ptsTime=e.pts/fi})),e.firstKeyFrame){var r=e.firstKeyFrame;r.dts=hi(r.dts,n),r.pts=hi(r.pts,n),r.dtsTime=r.dts/fi,r.ptsTime=r.pts/fi}}}(i,t),i):null},_i=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Bt.Transmuxer(this.options),function(e,t){t.on("data",(function(t){var i=t.initSegment;t.initSegment={data:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength};var n=t.data;t.data=n.buffer,e.postMessage({action:"data",segment:t,byteOffset:n.byteOffset,byteLength:n.byteLength},[t.data])})),t.on("done",(function(t){e.postMessage({action:"done"})})),t.on("gopInfo",(function(t){e.postMessage({action:"gopInfo",gopInfo:t})})),t.on("videoSegmentTimingInfo",(function(t){var i={start:{decode:fe(t.start.dts),presentation:fe(t.start.pts)},end:{decode:fe(t.end.dts),presentation:fe(t.end.pts)},baseMediaDecodeTime:fe(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=fe(t.prependedContentDuration)),e.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:i})})),t.on("audioSegmentTimingInfo",(function(t){var i={start:{decode:fe(t.start.dts),presentation:fe(t.start.pts)},end:{decode:fe(t.end.dts),presentation:fe(t.end.pts)},baseMediaDecodeTime:fe(t.baseMediaDecodeTime)};t.prependedContentDuration&&(i.prependedContentDuration=fe(t.prependedContentDuration)),e.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:i})})),t.on("id3Frame",(function(t){e.postMessage({action:"id3Frame",id3Frame:t})})),t.on("caption",(function(t){e.postMessage({action:"caption",caption:t})})),t.on("trackinfo",(function(t){e.postMessage({action:"trackinfo",trackInfo:t})})),t.on("audioTimingInfo",(function(t){e.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:fe(t.start),end:fe(t.end)}})})),t.on("videoTimingInfo",(function(t){e.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:fe(t.start),end:fe(t.end)}})})),t.on("log",(function(t){e.postMessage({action:"log",log:t})}))}(this.self,this.transmuxer)},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new ti,this.captionParser.init());var t=new Uint8Array(e.data,e.byteOffset,e.byteLength),i=this.captionParser.parse(t,e.trackIds,e.timescales);this.self.postMessage({action:"mp4Captions",captions:i&&i.captions||[],logs:i&&i.logs||[],data:t.buffer},[t.buffer])},t.probeMp4StartTime=function(e){var t=e.timescales,i=e.data,n=ai(t,i);this.self.postMessage({action:"probeMp4StartTime",startTime:n,data:i},[i.buffer])},t.probeMp4Tracks=function(e){var t=e.data,i=si(t);this.self.postMessage({action:"probeMp4Tracks",tracks:i,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,n="number"!==typeof i||isNaN(i)?void 0:i*he,r=yi(t,n),a=null;r&&((a={hasVideo:r.video&&2===r.video.length||!1,hasAudio:r.audio&&2===r.audio.length||!1}).hasVideo&&(a.videoStart=r.video[0].ptsTime),a.hasAudio&&(a.audioStart=r.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:a,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){var t=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(t)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){var t=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(pe(t)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(pe(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new _i(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new _i(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}})))),zc=function(e){var t=e.transmuxer,i=e.bytes,n=e.audioAppendStart,r=e.gopsToAlignWith,a=e.remux,s=e.onData,o=e.onTrackInfo,u=e.onAudioTimingInfo,l=e.onVideoTimingInfo,c=e.onVideoSegmentTimingInfo,d=e.onAudioSegmentTimingInfo,h=e.onId3,p=e.onCaptions,f=e.onDone,m=e.onEndedTimeline,g=e.onTransmuxerLog,v=e.isEndOfTimeline,y={buffer:[]},_=v;if(t.onmessage=function(i){t.currentTransmux===e&&("data"===i.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,u=n.metadata,l=n.videoFrameDtsTime,c=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});var d=e.data.segment.boxes||{data:e.data.segment.data},h={type:r,data:new Uint8Array(d.data,d.data.byteOffset,d.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};"undefined"!==typeof l&&(h.videoFrameDtsTime=l),"undefined"!==typeof c&&(h.videoFramePtsTime=c),i(h)}(i,y,s),"trackinfo"===i.data.action&&o(i.data.trackInfo),"gopInfo"===i.data.action&&function(e,t){t.gopInfo=e.data.gopInfo}(i,y),"audioTimingInfo"===i.data.action&&u(i.data.audioTimingInfo),"videoTimingInfo"===i.data.action&&l(i.data.videoTimingInfo),"videoSegmentTimingInfo"===i.data.action&&c(i.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===i.data.action&&d(i.data.audioSegmentTimingInfo),"id3Frame"===i.data.action&&h([i.data.id3Frame],i.data.id3Frame.dispatchType),"caption"===i.data.action&&p(i.data.caption),"endedtimeline"===i.data.action&&(_=!1,m()),"log"===i.data.action&&g(i.data.log),"transmuxed"===i.data.type&&(_||(t.onmessage=null,function(e){var t=e.transmuxedData,i=e.callback;t.buffer=[],i(t)}({transmuxedData:y,callback:f}),Xc(t))))},n&&t.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&t.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!==typeof a&&t.postMessage({action:"setRemux",remux:a}),i.byteLength){var b=i instanceof ArrayBuffer?i:i.buffer,T=i instanceof ArrayBuffer?0:i.byteOffset;t.postMessage({action:"push",data:b,byteOffset:T,byteLength:i.byteLength},[b])}v&&t.postMessage({action:"endTimeline"}),t.postMessage({action:"flush"})},Xc=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"===typeof e.currentTransmux?e.currentTransmux():zc(e.currentTransmux))},Kc=function(e,t){e.postMessage({action:t}),Xc(e)},Yc=function(e,t){if(!t.currentTransmux)return t.currentTransmux=e,void Kc(t,e);t.transmuxQueue.push(Kc.bind(null,t,e))},Qc=function(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void zc(e);e.transmuxer.transmuxQueue.push(e)},$c=function(e){Yc("reset",e)},Jc=function(e){var t=new Gc;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},Zc=function(e){var t=e.transmuxer,i=e.endAction||e.action,n=e.callback,r=M({},e,{endAction:null,transmuxer:null,callback:null});if(t.addEventListener("message",(function r(a){a.data.action===i&&(t.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,e.byteOffset||0,e.byteLength||a.data.data.byteLength),e.data&&(e.data=a.data.data)),n(a.data))})),e.data){var a=e.data instanceof ArrayBuffer;r.byteOffset=a?0:e.data.byteOffset,r.byteLength=e.data.byteLength;var s=[a?e.data:e.data.buffer];t.postMessage(r,s)}else t.postMessage(r)},ed=2,td=-101,id=-102,nd=function(e){e.forEach((function(e){e.abort()}))},rd=function(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:td,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:id,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:ed,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:ed,xhr:t}:null},ad=function(e,t,i){return function(n,r){var a=r.response,s=rd(n,r);if(s)return i(s,e);if(16!==a.byteLength)return i({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:ed,xhr:r},e);for(var o=new DataView(a),u=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]),l=0;l0}(f)){t.isFmp4=!0;var m=t.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),n(t,g);var v=function(e){d(t,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&u(t,e),h(null,t,{})};Zc({action:"probeMp4StartTime",timescales:t.map.timescales,data:f,transmuxer:t.transmuxer,callback:function(e){var n=e.data,a=e.startTime;i=n.buffer,t.bytes=f=n,g.hasAudio&&!g.isMuxed&&r(t,"audio","start",a),g.hasVideo&&r(t,"video","start",a),m.video&&n.byteLength&&t.transmuxer?Zc({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:t.transmuxer,data:f,timescales:t.map.timescales,trackIds:[m.video.id],callback:function(e){i=e.data.buffer,t.bytes=f=e.data,e.logs.forEach((function(e){p(wl.mergeOptions(e,{stream:"mp4CaptionParser"}))})),v(e.captions)}}):v()}})}else if(t.transmuxer){if("undefined"===typeof t.container&&(t.container=gr(f)),"ts"!==t.container&&"aac"!==t.container)return n(t,{hasAudio:!1,hasVideo:!1}),void h(null,t,{});ud({segment:t,bytes:i,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})}else h(null,t,{})},cd=function(e,t){var i,n=e.id,r=e.key,a=e.encryptedBytes,s=e.decryptionWorker;s.addEventListener("message",(function e(i){if(i.data.source===n){s.removeEventListener("message",e);var r=i.data.decrypted;t(new Uint8Array(r.bytes,r.byteOffset,r.byteLength))}})),i=r.bytes.slice?r.bytes.slice():new Uint32Array(Array.prototype.slice.call(r.bytes)),s.postMessage(wc({source:n,encrypted:a,key:i,iv:r.iv}),[a.buffer,i.buffer])},dd=function(e){var t=e.activeXhrs,i=e.decryptionWorker,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=0,m=!1;return function(e,g){if(!m){if(e)return m=!0,nd(t),h(e,g);if((f+=1)===t.length){var v=function(){if(g.encryptedBytes)return function(e){var t=e.decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,c=e.endedTimelineFn,d=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog;cd({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},(function(e){i.bytes=e,ld({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})}))}({decryptionWorker:i,segment:g,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p});ld({segment:g,bytes:g.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:c,dataFn:d,doneFn:h,onTransmuxerLog:p})};if(g.endOfAllRequests=Date.now(),g.map&&g.map.encryptedBytes&&!g.map.bytes)return cd({decryptionWorker:i,id:g.requestId+"-init",encryptedBytes:g.map.encryptedBytes,key:g.map.key},(function(e){g.map.bytes=e,sd(g,(function(e){if(e)return nd(t),h(e,g);v()}))}));v()}}}},hd=function(e){var t=e.segment,i=e.progressFn;return e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn,function(e){if(!e.target.aborted)return t.stats=wl.mergeOptions(t.stats,function(e){var t=e.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-t.requestTime||0};return i.bytesReceived=e.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i}(e)),!t.stats.firstBytesReceivedAt&&t.stats.bytesReceived&&(t.stats.firstBytesReceivedAt=Date.now()),i(e,t)}},pd=function(e){var t=e.xhr,i=e.xhrOptions,n=e.decryptionWorker,r=e.segment,a=e.abortFn,s=e.progressFn,o=e.trackInfoFn,u=e.timingInfoFn,l=e.videoSegmentTimingInfoFn,c=e.audioSegmentTimingInfoFn,d=e.id3Fn,h=e.captionsFn,p=e.isEndOfTimeline,f=e.endedTimelineFn,m=e.dataFn,g=e.doneFn,v=e.onTransmuxerLog,y=[],_=dd({activeXhrs:y,decryptionWorker:n,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m,doneFn:g,onTransmuxerLog:v});if(r.key&&!r.key.bytes){var b=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&b.push(r.map.key);var T=t(wl.mergeOptions(i,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),ad(r,b,_));y.push(T)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){var k=t(wl.mergeOptions(i,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),ad(r,[r.map.key],_));y.push(k)}var S=t(wl.mergeOptions(i,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:kc(r.map)}),function(e){var t=e.segment,i=e.finishProcessingFn;return function(e,n){var r=rd(e,n);if(r)return i(r,t);var a=new Uint8Array(n.response);if(t.map.key)return t.map.encryptedBytes=a,i(null,t);t.map.bytes=a,sd(t,(function(e){if(e)return e.xhr=n,e.status=n.status,i(e,t);i(null,t)}))}}({segment:r,finishProcessingFn:_}));y.push(S)}var E=wl.mergeOptions(i,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:kc(r)}),C=t(E,od({segment:r,finishProcessingFn:_,responseType:E.responseType}));C.addEventListener("progress",hd({segment:r,progressFn:s,trackInfoFn:o,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:c,id3Fn:d,captionsFn:h,isEndOfTimeline:p,endedTimelineFn:f,dataFn:m})),y.push(C);var w={};return y.forEach((function(e){e.addEventListener("loadend",function(e){var t=e.loadendState,i=e.abortFn;return function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}}({loadendState:w,abortFn:a}))})),function(){return nd(y)}},fd=Ol("CodecUtils"),md=function(e,t){var i=t.attributes||{};return e&&e.mediaGroups&&e.mediaGroups.AUDIO&&i.AUDIO&&e.mediaGroups.AUDIO[i.AUDIO]},gd=function(e){var t={};return e.forEach((function(e){var i=e.mediaType,n=e.type,r=e.details;t[i]=t[i]||[],t[i].push(He(""+n+r))})),Object.keys(t).forEach((function(e){if(t[e].length>1)return fd("multiple "+e+" codecs found as attributes: "+t[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(t[e]=null);t[e]=t[e][0]})),t},vd=function(e){var t=0;return e.audio&&t++,e.video&&t++,t},yd=function(e,t){var i=t.attributes||{},n=gd(function(e){var t=e.attributes||{};if(t.CODECS)return qe(t.CODECS)}(t)||[]);if(md(e,t)&&!n.audio&&!function(e,t){if(!md(e,t))return!0;var i=t.attributes||{},n=e.mediaGroups.AUDIO[i.AUDIO];for(var r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1}(e,t)){var r=gd(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return qe(r.playlists[0].attributes.CODECS)}return null}(e,i.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},_d=Ol("PlaylistSelector"),bd=function(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}},Td=function(e,t){if(!e)return"";var i=A.getComputedStyle(e);return i?i[t]:""},kd=function(e,t){var i=e.slice();e.sort((function(e,n){var r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))},Sd=function(e,t){var i,n;return e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||A.Number.MAX_VALUE,t.attributes.BANDWIDTH&&(n=t.attributes.BANDWIDTH),i-(n=n||A.Number.MAX_VALUE)},Ed=function(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;nc.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map((function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return{bandwidth:e.attributes&&e.attributes.BANDWIDTH||A.Number.MAX_VALUE,width:t,height:i,playlist:e}}));kd(u,(function(e,t){return e.bandwidth-t.bandwidth}));var l=(u=u.filter((function(e){return!nc.isIncompatible(e.playlist)}))).filter((function(e){return nc.isEnabled(e.playlist)}));l.length||(l=u.filter((function(e){return!nc.isDisabled(e.playlist)})));var c=l.filter((function(e){return e.bandwidth*jc.BANDWIDTH_VARIANCEi||e.height>n}))).filter((function(e){return e.width===v[0].width&&e.height===v[0].height})),d=y[y.length-1],_=y.filter((function(e){return e.bandwidth===d.bandwidth}))[0]),a.experimentalLeastPixelDiffSelector){var k=m.map((function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}));kd(k,(function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff})),b=k[0]}var S=b||_||T||h||l[0]||u[0];if(S&&S.playlist){var E="sortedPlaylistReps";return b?E="leastPixelDiffRep":_?E="resolutionPlusOneRep":T?E="resolutionBestRep":h?E="bandwidthBestRep":l[0]&&(E="enabledPlaylistReps"),_d("choosing "+bd(S)+" using "+E+" with options",s),S.playlist}return _d("could not choose a playlist with options",s),null}},Cd=function(){var e=this.useDevicePixelRatio&&A.devicePixelRatio||1;return Ed(this.playlists.master,this.systemBandwidth,parseInt(Td(this.tech_.el(),"width"),10)*e,parseInt(Td(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},wd=function(e){var t=e.inbandTextTracks,i=e.metadataArray,n=e.timestampOffset,r=e.videoDuration;if(i){var a=A.WebKitDataCue||A.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach((function(e){var t=e.cueTime+n;!("number"!==typeof t||A.isNaN(t)||t<0)&&t<1/0&&e.frames.forEach((function(e){var i=new a(t,t,e.value||e.url||e.data||"");i.frame=e,i.value=e,function(e){Object.defineProperties(e.frame,{id:{get:function(){return wl.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),e.value.key}},value:{get:function(){return wl.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),e.value.data}},privateData:{get:function(){return wl.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),e.value.data}}})}(i),s.addCue(i)}))})),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l=e&&r.endTime<=t&&i.removeCue(r)},Pd=function(e){return"number"===typeof e&&isFinite(e)},xd=function(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=void 0===u?[]:u,c=e.mediaIndex,d=e.partIndex,h=e.timeline,p=l.length-1,f="mediaIndex/partIndex increment";e.getMediaInfoForTime?f="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(f="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(f+=" with independent "+e.independent);var m="number"===typeof d,g=e.segment.uri?"segment":"pre-segment",v=m?ql({preloadSegment:n})-1:0;return g+" ["+(s+c)+"/"+(s+p)+"]"+(m?" part ["+d+"/"+v+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(m?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+h+"] selected by ["+f+"] playlist ["+o+"]"},Ad=function(e){return e+"TimingInfo"},Od=function(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,a=e.audioDisabled;if(i===n)return!1;if("audio"===r){var s=t.lastTimelineChange({type:"main"});return!s||s.to!==n}if("main"===r&&a){var o=t.pendingTimelineChange({type:"audio"});return!o||o.to!==n}return!1},Ld=function(e){var t=e.segmentDuration,i=e.maxDuration;return!!t&&Math.round(t)>i+1/30},Dd=function(e,t){if("hls"!==t)return null;var i,n,r=(i={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},n=0,["video","audio"].forEach((function(e){var t=i[e+"TimingInfo"];if(t){var r,a=t.start,s=t.end;"bigint"===typeof a||"bigint"===typeof s?r=A.BigInt(s)-A.BigInt(a):"number"===typeof a&&"number"===typeof s&&(r=s-a),"undefined"!==typeof r&&r>n&&(n=r)}})),"bigint"===typeof n&&n=11,n.appendInitSegment_={audio:!0,video:!0},n.playlistOfLastInitSegment_={audio:null,video:null},n.callQueue_=[],n.loadQueue_=[],n.metadataQueue_={id3:[],caption:[]},n.waitingOnRemove_=!1,n.quotaExceededErrorRetryTimeout_=null,n.activeInitSegmentId_=null,n.initSegments_={},n.cacheEncryptionKeys_=t.cacheEncryptionKeys,n.keyCache_={},n.decrypter_=t.decrypter,n.syncController_=t.syncController,n.syncPoint_={segmentIndex:0,time:0},n.transmuxer_=n.createTransmuxer_(),n.triggerSyncInfoUpdate_=function(){return n.trigger("syncinfoupdate")},n.syncController_.on("syncinfoupdate",n.triggerSyncInfoUpdate_),n.mediaSource_.addEventListener("sourceopen",(function(){n.isEndOfStream_()||(n.ended_=!1)})),n.fetchAtBuffer_=!1,n.logger_=Ol("SegmentLoader["+n.loaderType_+"]"),Object.defineProperty(U(n),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),n.sourceUpdater_.on("ready",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"main"===n.loaderType_&&n.timelineChangeController_.on("pendingtimelinechange",(function(){n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),"audio"===n.loaderType_&&n.timelineChangeController_.on("timelinechange",(function(){n.hasEnoughInfoToLoad_()&&n.processLoadQueue_(),n.hasEnoughInfoToAppend_()&&n.processCallQueue_()})),n}F(t,e);var i=t.prototype;return i.createTransmuxer_=function(){return Jc({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},i.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},i.dispose=function(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()},i.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},i.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},i.abort_=function(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,A.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null},i.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},i.error=function(e){return"undefined"!==typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},i.endOfStream=function(){this.ended_=!0,this.transmuxer_&&$c(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},i.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return wl.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,n=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},i.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Ic(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},i.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Pc(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});var r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r},i.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},i.load=function(){if(this.monitorBuffer_(),this.playlist_)return"INIT"===this.state&&this.couldBeginLoading_()?this.init_():void(!this.couldBeginLoading_()||"READY"!==this.state&&"INIT"!==this.state||(this.state="READY"))},i.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},i.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");var a=e.mediaSequence-i.mediaSequence;if(this.logger_("live window shift ["+a+"]"),null!==this.mediaIndex)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{var s=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!s.parts||!s.parts.length||!s.parts[this.partIndex])){var o=this.mediaIndex;this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=o}}n&&(n.mediaIndex-=a,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(n.mediaIndex>=0&&(n.segment=e.segments[n.mediaIndex]),n.partIndex>=0&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},i.pause=function(){this.checkBufferTimeout_&&(A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},i.paused=function(){return null===this.checkBufferTimeout_},i.resetEverything=function(e){this.ended_=!1,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))},i.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},i.resyncLoader=function(){this.transmuxer_&&$c(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})},i.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),t===1/0&&(t=this.duration_()),t<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r=1,a=function(){0===--r&&i()};for(var s in!n&&this.audioDisabled_||(r++,this.sourceUpdater_.removeAudio(e,t,a)),(n||"main"===this.loaderType_)&&(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*yr),a=Math.ceil((i-n)*yr),s=e.slice(),o=e.length;o--&&!(e[o].pts<=a););if(-1===o)return s;for(var u=o+1;u--&&!(e[u].pts<=r););return u=Math.max(u,0),s.splice(u,o-u+1),s}(this.gopBuffer_,e,t,this.timeMapping_),r++,this.sourceUpdater_.removeVideo(e,t,a)),this.inbandTextTracks_)Id(e,t,this.inbandTextTracks_[s]);Id(e,t,this.segmentMetadataTrack_),a()}else this.logger_("skipping remove because no source updater or starting media info")},i.monitorBuffer_=function(){this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.setTimeout(this.monitorBufferTick_.bind(this),1)},i.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&A.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=A.setTimeout(this.monitorBufferTick_.bind(this),500)},i.fillBuffer_=function(){if(!this.sourceUpdater_.updating()){var e=this.chooseNextRequest_();e&&("number"===typeof e.timestampOffset&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}},i.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"===typeof e&&t.segments[e],r=e+1===t.segments.length,a=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&r&&a},i.chooseNextRequest_=function(){var e=this.buffered_(),t=Ul(e)||0,i=Bl(e,this.currentTime_()),n=!this.hasPlayed_()&&i>=1,r=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var s={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(s.isSyncRequest)s.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;ai))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,a,t);else if(null!==this.mediaIndex){var o=a[this.mediaIndex],u="number"===typeof this.partIndex?this.partIndex:-1;s.startOfSegment=o.end?o.end:t,o.parts&&o.parts[u+1]?(s.mediaIndex=this.mediaIndex,s.partIndex=u+1):s.mediaIndex=this.mediaIndex+1}else{var l=nc.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time}),c=l.segmentIndex,d=l.startTime,h=l.partIndex;s.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),s.mediaIndex=c,s.startOfSegment=d,s.partIndex=h}var p=a[s.mediaIndex],f=p&&"number"===typeof s.partIndex&&p.parts&&p.parts[s.partIndex];if(!p||"number"===typeof s.partIndex&&!f)return null;if("number"!==typeof s.partIndex&&p.parts&&(s.partIndex=0,f=p.parts[0]),!i&&f&&!f.independent)if(0===s.partIndex){var m=a[s.mediaIndex-1],g=m.parts&&m.parts.length&&m.parts[m.parts.length-1];g&&g.independent&&(s.mediaIndex-=1,s.partIndex=m.parts.length-1,s.independent="previous segment")}else p.parts[s.partIndex-1].independent&&(s.partIndex-=1,s.independent="previous part");var v=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return s.mediaIndex>=a.length-1&&v&&!this.seeking_()?null:this.generateSegmentInfo_(s)},i.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=i.segments[n],c="number"===typeof s&&l.parts[s],d={requestId:"segment-loader-"+Math.random(),uri:c&&c.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:c?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:c&&c.duration||l.duration,segment:l,part:c,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},h="undefined"!==typeof o?o:this.isPendingTimestampOffset_;d.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:h});var p=Ul(this.sourceUpdater_.audioBuffered());return"number"===typeof p&&(d.audioAppendStart=p-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(d.gopsToAlignWith=function(e,t,i){if("undefined"===typeof t||null===t||!e.length)return[];var n,r=Math.ceil((t-i+3)*yr);for(n=0;nr);n++);return e.slice(n)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),d},i.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,a=t.buffered,t.overrideCheck||i!==n?i "+s+" for "+e),function(e,t,i){if(!e[i]){t.trigger({type:"usage",name:"vhs-608"}),t.trigger({type:"usage",name:"hls-608"});var n=i;/^cc708_/.test(i)&&(n="SERVICE"+i.split("_")[1]);var r=t.textTracks().getTrackById(n);if(r)e[i]=r;else{var a=i,s=i,o=!1,u=(t.options_.vhs&&t.options_.vhs.captionServices||{})[n];u&&(a=u.label,s=u.language,o=u.default),e[i]=t.addRemoteTextTrack({kind:"captions",id:n,default:o,label:a,language:s},!1).track}}}(u,i.vhs_.tech_,e),Id(a,s,u[e]),function(e){var t=e.inbandTextTracks,i=e.captionArray,n=e.timestampOffset;if(i){var r=A.WebKitDataCue||A.VTTCue;i.forEach((function(e){var i=e.stream;t[i].addCue(new r(e.startTime+n,e.endTime+n,e.text))}))}}({captionArray:o,inbandTextTracks:u,timestampOffset:n})})),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}else this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));else this.logger_("SegmentLoader received no captions from a caption event")},i.handleId3_=function(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(this.pendingSegment_.hasAppendedData_){var n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();!function(e,t,i){e.metadataTrack_||(e.metadataTrack_=i.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,e.metadataTrack_.inBandMetadataTrackDispatchType=t)}(this.inbandTextTracks_,i,this.vhs_.tech_),wd({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})}else this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i))},i.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach((function(e){return e()})),this.metadataQueue_.caption.forEach((function(e){return e()})),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},i.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach((function(e){return e()}))},i.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach((function(e){return e()}))},i.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Od({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.getCurrentMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),e&&e.trackInfo||this.currentMediaInfo_},i.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},i.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo)&&!Od({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},i.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Ad(t.type)].start;else{var n,r=this.getCurrentMediaInfo_(),a="main"===this.loaderType_&&r&&r.hasVideo;a&&(n=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:a,firstVideoFrameTimeForData:n,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:"main"===this.loaderType_});var s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.partIndex!==i.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},i.updateAppendInitSegmentStatus=function(e,t){"main"!==this.loaderType_||"number"!==typeof e.timestampOffset||e.changedTimestampOffset||(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)},i.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){var a=Ic(n);if(this.activeInitSegmentId_===a)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=a}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},i.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();s.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Nl(s).join(", ")),o.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Nl(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,c=o.length?o.start(0):0,d=o.length?o.end(o.length-1):0;if(l-u<=1&&d-c<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+Nl(s).join(", ")+", video buffer: "+Nl(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));var h=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+h),this.remove(0,h,(function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=A.setTimeout((function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()}),1e3)}),!0)},i.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,r=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+r.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:r}))},i.appendToSourceBuffer_=function(e){var t,i,n,r=e.segmentInfo,a=e.type,s=e.initSegment,o=e.data,u=e.bytes;if(!u){var l=[o],c=o.byteLength;s&&(l.unshift(s),c+=s.byteLength),n=0,(t={bytes:c,segments:l}).bytes&&(i=new Uint8Array(t.bytes),t.segments.forEach((function(e){i.set(e,n),n+=e.byteLength}))),u=i}this.sourceUpdater_.appendBuffer({segmentInfo:r,type:a,bytes:u},this.handleAppendError_.bind(this,{segmentInfo:r,type:a,bytes:u}))},i.handleSegmentTimingInfo_=function(e,t,i){if(this.pendingSegment_&&t===this.pendingSegment_.requestId){var n=this.pendingSegment_.segment,r=e+"TimingInfo";n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}},i.appendData_=function(e,t){var i=t.type,n=t.data;if(n&&n.byteLength&&("audio"!==i||!this.audioDisabled_)){var r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}},i.loadSegment_=function(e){var t=this;this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),"number"===typeof e.timestampOffset&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.hasEnoughInfoToLoad_()?this.updateTransmuxerAndRequestSegment_(e):this.loadQueue_.push((function(){var i=M({},e,{forceTimestampOffset:!0});M(e,t.generateSegmentInfo_(i)),t.isPendingTimestampOffset_=!1,t.updateTransmuxerAndRequestSegment_(e)}))},i.updateTransmuxerAndRequestSegment_=function(e){var t=this;this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));var i=this.createSimplifiedSegmentObj_(e),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=null!==this.mediaIndex,a=e.timeline!==this.currentTimeline_&&e.timeline>0,s=n||r&&a;this.logger_("Requesting "+xd(e)),i.map&&!i.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=pd({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:i,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:s,endedTimelineFn:function(){t.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(i){var n=i.message,r=i.level,a=i.stream;t.logger_(xd(e)+" logged from transmuxer stream "+a+" as a "+r+": "+n)}})},i.trimBackBuffer_=function(e){var t=function(e,t,i){var n=t-jc.BACK_BUFFER_LENGTH;e.length&&(n=Math.max(n,e.start(0)));var r=t-i;return Math.min(r,n)}(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)},i.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},r=e.playlist.segments[e.mediaIndex-1];if(r&&r.timeline===t.timeline&&(r.videoTimingInfo?n.baseStartTime=r.videoTimingInfo.transmuxedDecodeEnd:r.audioTimingInfo&&(n.baseStartTime=r.audioTimingInfo.transmuxedDecodeEnd)),t.key){var a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);n.key=this.segmentKey(t.key),n.key.iv=a}return t.map&&(n.map=this.initSegmentForMap(t.map)),n},i.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},i.saveBandwidthRelatedStats_=function(e,t){this.pendingSegment_.byteLength=t.bytesReceived,e<1/60?this.logger_("Ignoring segment's bandwidth because its duration of "+e+" is less than the min to record "+1/60):(this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime)},i.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate")},i.segmentRequestFinished_=function(e,t,i){if(this.callQueue_.length)this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));else if(this.saveTransferStats_(t.stats),this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId){if(e){if(this.pendingSegment_=null,this.state="READY",e.code===id)return;return this.pause(),e.code===td?void this.handleTimeout_():(this.mediaRequestsErrored+=1,this.error(e),void this.trigger("error"))}var n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}},i.setTimeMapping_=function(e){var t=this.syncController_.mappingForTimeline(e);null!==t&&(this.timeMapping_=t)},i.updateMediaSecondsLoaded_=function(e){"number"===typeof e.start&&"number"===typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},i.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},i.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,u=e.audioTimingInfo;if("undefined"!==typeof t)return t;if(!s)return u.start;var l=i.segments[n-1];return 0!==n&&l&&"undefined"!==typeof l.start&&l.end===r+a?o.start:r},i.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,r=t.isMuxed,a="main"===this.loaderType_&&n,s=!this.audioDisabled_&&i&&!r;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!==typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);a&&e.waitingOnAppends++,s&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),s&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},i.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},i.checkForIllegalMediaSwitch=function(e){var t=function(e,t,i){return"main"===e&&t&&i?i.hasAudio||i.hasVideo?t.hasVideo&&!i.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!t.hasVideo&&i.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null:"Neither audio nor video found in segment.":null}(this.loaderType_,this.getCurrentMediaInfo_(),e);return!!t&&(this.error({message:t,blacklistDuration:1/0}),this.trigger("error"),!0)},i.updateSourceBufferTimestampOffset_=function(e){if(null!==e.timestampOffset&&"number"===typeof e.timingInfo.start&&!e.changedTimestampOffset&&"main"===this.loaderType_){var t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}},i.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo,n=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"===typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"===typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:n.start:n.start},i.updateTimingInfoEnd_=function(e){e.timingInfo=e.timingInfo||{};var t=this.getMediaInfo_(),i="main"===this.loaderType_&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;i&&(e.timingInfo.end="number"===typeof i.end?i.end:i.start+e.duration)},i.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=Dd(e,this.sourceType_);if(t&&("warn"===t.severity?wl.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",!e.isSyncRequest||(this.trigger("syncinfoupdate"),e.hasAppendedData_)){this.logger_("Appended "+xd(e)),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),"main"!==this.loaderType_||this.audioDisabled_||this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");var i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,a=n&&n.end&&this.currentTime_()-n.end>3*e.playlist.partTargetDuration;if(r||a)return this.logger_("bad "+(r?"segment":"part")+" "+xd(e)),void this.resetEverything();null!==this.mediaIndex&&this.trigger("bandwidthupdate"),this.trigger("progress"),this.mediaIndex=e.mediaIndex,this.partIndex=e.partIndex,this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex)&&this.endOfStream(),this.trigger("appended"),e.hasAppendedData_&&this.mediaAppends++,this.paused()||this.monitorBuffer_()}else this.logger_("Throwing away un-appended sync request "+xd(e))},i.recordThroughput_=function(e){if(e.duration<1/60)this.logger_("Ignoring segment's throughput because its duration of "+e.duration+" is less than the min to record "+1/60);else{var t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}},i.addSegmentMetadataCue_=function(e){if(this.segmentMetadataTrack_){var t=e.segment,i=t.start,n=t.end;if(Pd(i)&&Pd(n)){Id(i,n,this.segmentMetadataTrack_);var r=A.WebKitDataCue||A.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},s=new r(i,n,JSON.stringify(a));s.value=a,this.segmentMetadataTrack_.addCue(s)}}},t}(wl.EventTarget);function Md(){}var Nd,Ud=function(e){return"string"!==typeof e?e:e.replace(/./,(function(e){return e.toUpperCase()}))},Bd=["video","audio"],Fd=function(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]},jd=function e(t,i){if(0!==i.queue.length){var n=0,r=i.queue[n];if("mediaSource"!==r.type){if("mediaSource"!==t&&i.ready()&&"closed"!==i.mediaSource.readyState&&!Fd(t,i)){if(r.type!==t){if(null===(n=function(e,t){for(var i=0;i=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e},i.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},i.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===td&&this.handleTimeout_(),e.code===id?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!==typeof A.WebVTT&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){var s,o=function(){n.subtitlesTrack_.tech_.off("vttjsloaded",s),n.stopForError({message:"Error loading vtt.js"})};return s=function(){n.subtitlesTrack_.tech_.off("vttjserror",o),n.segmentRequestFinished_(e,t,i)},this.state="WAITING_ON_VTTJS",this.subtitlesTrack_.tech_.one("vttjsloaded",s),void this.subtitlesTrack_.tech_.one("vttjserror",o)}a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach((function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new A.VTTCue(e.startTime,e.endTime,e.text):e)})),function(e){var t=e.cues;if(t)for(var i=0;i1&&n.push(t[a]);n.length&&n.forEach((function(t){return e.removeCue(t)}))}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},i.handleData_=function(){},i.updateTimingInfoEnd_=function(){},i.parseVTTCues_=function(e){var t,i=!1;"function"===typeof A.TextDecoder?t=new A.TextDecoder("utf8"):(t=A.WebVTT.StringDecoder(),i=!0);var n=new A.WebVTT.Parser(A,A.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},n.oncue=e.cues.push.bind(e.cues),n.ontimestampmap=function(t){e.timestampmap=t},n.onparsingerror=function(e){wl.log.warn("Error encountered when parsing cues: "+e.message)},e.segment.map){var r=e.segment.map.bytes;i&&(r=ih(r)),n.parse(r)}var a=e.bytes;i&&(a=ih(a)),n.parse(a),n.flush()},i.updateTimeMapping_=function(e,t,i){var n=e.segment;if(t)if(e.cues.length){var r=e.timestampmap,a=r.MPEGTS/yr-r.LOCAL+t.mapping;if(e.cues.forEach((function(e){e.startTime+=a,e.endTime+=a})),!i.syncInfo){var s=e.cues[0].startTime,o=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(s,o-n.duration)}}}else n.empty=!0},t}(Rd),ah=function(e,t){for(var i=e.cues,n=0;n=r.adStartTime&&t<=r.adEndTime)return r}return null},sh=[{name:"VOD",run:function(e,t,i,n,r){if(i!==1/0){return{time:0,segmentIndex:0,partIndex:null}}return null}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=Vl(t);r=r||0;for(var u=0;u=h)&&(s=h,a={time:d,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o=d)&&(s=d,a={time:c.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],oh=function(e){function t(t){var i;return(i=e.call(this)||this).timelines=[],i.discontinuities=[],i.timelineToDatetimeMappings={},i.logger_=Ol("SyncController"),i}F(t,e);var i=t.prototype;return i.getSyncPoint=function(e,t,i,n){var r=this.runStrategies_(e,t,i,n);return r.length?this.selectSyncPoint_(r,{key:"time",value:n}):null},i.getExpiredTime=function(e,t){if(!e||!e.segments)return null;var i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;var n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+Xl({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))},i.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a86400)wl.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;n>=0;n--){var r=e.segments[n];if(r&&"undefined"!==typeof r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},i.setDateTimeMappingForStart=function(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){var t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}},i.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),r=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:r.start}));var a=r.dateTimeObject;r.discontinuity&&i&&a&&(this.timelineToDatetimeMappings[r.timeline]=-a.getTime()/1e3)},i.timestampOffsetForTimeline=function(e){return"undefined"===typeof this.timelines[e]?null:this.timelines[e].time},i.mappingForTimeline=function(e){return"undefined"===typeof this.timelines[e]?null:this.timelines[e].mapping},i.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"===typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||no){var u=void 0;u=s<0?i.start-Xl({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):i.end+Xl({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:u,accuracy:o}}}},i.dispose=function(){this.trigger("dispose"),this.off()},t}(wl.EventTarget),uh=function(e){function t(){var t;return(t=e.call(this)||this).pendingTimelineChanges_={},t.lastTimelineChanges_={},t}F(t,e);var i=t.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"===typeof i&&"number"===typeof n&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,n=e.to;return"number"===typeof i&&"number"===typeof n&&(this.lastTimelineChanges_[t]={type:t,from:i,to:n},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},t}(wl.EventTarget),lh=Hc(qc(Wc((function(){function e(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&i.path)}},i.exports),i.exports}var t=e((function(e){function t(e,t){for(var i=0;i-1},t.trigger=function(e){var t=this.listeners[e];if(t)if(2===arguments.length)for(var i=t.length,n=0;n>7))^e]=e;for(t=i=0;!d[t];t^=n||1,i=f[i]||1)for(a=(a=i^i<<1^i<<2^i<<3^i<<4)>>8^255&a^99,d[t]=a,h[a]=t,o=16843009*p[r=p[n=p[t]]]^65537*r^257*n^16843008*t,s=257*p[a]^16843008*a,e=0;e<4;e++)l[e][t]=s=s<<24^s>>>8,c[e][a]=o=o<<24^o>>>8;for(e=0;e<5;e++)l[e]=l[e].slice(0),c[e]=c[e].slice(0);return u}()),this._tables=[[a[0][0].slice(),a[0][1].slice(),a[0][2].slice(),a[0][3].slice(),a[0][4].slice()],[a[1][0].slice(),a[1][1].slice(),a[1][2].slice(),a[1][3].slice(),a[1][4].slice()]];var r=this._tables[0][4],s=this._tables[1],o=e.length,u=1;if(4!==o&&6!==o&&8!==o)throw new Error("Invalid aes key size");var l=e.slice(0),c=[];for(this._key=[l,c],t=o;t<4*o+28;t++)n=l[t-1],(t%o===0||8===o&&t%o===4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%o===0&&(n=n<<8^n>>>24^u<<24,u=u<<1^283*(u>>7))),l[t]=l[t-o]^n;for(i=0;t;i++,t--)n=l[3&i?t:t-4],c[i]=t<=4||i<4?n:s[0][r[n>>>24]]^s[1][r[n>>16&255]]^s[2][r[n>>8&255]]^s[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){var s,o,u,l,c=this._key[1],d=e^c[0],h=n^c[1],p=i^c[2],f=t^c[3],m=c.length/4-2,g=4,v=this._tables[1],y=v[0],_=v[1],b=v[2],T=v[3],k=v[4];for(l=0;l>>24]^_[h>>16&255]^b[p>>8&255]^T[255&f]^c[g],o=y[h>>>24]^_[p>>16&255]^b[f>>8&255]^T[255&d]^c[g+1],u=y[p>>>24]^_[f>>16&255]^b[d>>8&255]^T[255&h]^c[g+2],f=y[f>>>24]^_[d>>16&255]^b[h>>8&255]^T[255&p]^c[g+3],g+=4,d=s,h=o,p=u;for(l=0;l<4;l++)r[(3&-l)+a]=k[d>>>24]<<24^k[h>>16&255]<<16^k[p>>8&255]<<8^k[255&f]^c[g++],s=d,d=h,h=p,p=f,f=s},e}(),o=function(e){function t(){var t;return(t=e.call(this,r)||this).jobs=[],t.delay=1,t.timeout_=null,t}n(t,e);var i=t.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(r),u=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},l=function(){function e(t,i,n,r){var a=e.STEP,s=new Int32Array(t.buffer),l=new Uint8Array(t.byteLength),c=0;for(this.asyncStream_=new o,this.asyncStream_.push(this.decryptChunk_(s.subarray(c,c+a),i,n,l)),c=a;c>2),m=new s(Array.prototype.slice.call(t)),g=new Uint8Array(e.byteLength),v=new Int32Array(g.buffer);for(n=i[0],r=i[1],a=i[2],o=i[3],p=0;p=0&&(t="main-desc"),t},dh=function(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},hh=function(e,t){t.activePlaylistLoader=e,e.load()},ph={AUDIO:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e],r=t.blacklistCurrentPlaylist;dh(i,n);var a=n.activeTrack(),s=n.activeGroup(),o=(s.filter((function(e){return e.default}))[0]||s[0]).id,u=n.tracks[o];if(a!==u){for(var l in wl.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),n.tracks)n.tracks[l].enabled=n.tracks[l]===u;n.onTrackChanged()}else r({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(e,t){return function(){var i=t.segmentLoaders[e],n=t.mediaTypes[e];wl.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),dh(i,n);var r=n.activeTrack();r&&(r.mode="disabled"),n.onTrackChanged()}}},fh={AUDIO:function(e,t,i){if(t){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",ph[e](e,i))}},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",(function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()})),t.on("loadedplaylist",(function(){a.playlist(t.media(),r),n.paused()||a.load()})),t.on("error",ph[e](e,i))}},mh={AUDIO:function(e,t){var i=t.vhs,n=t.sourceType,r=t.segmentLoaders[e],a=t.requestOptions,s=t.master.mediaGroups,o=t.mediaTypes[e],u=o.groups,l=o.tracks,c=o.logger_,d=t.masterPlaylistLoader,h=ic(d.master);for(var p in s[e]&&0!==Object.keys(s[e]).length||(s[e]={main:{default:{default:!0}}},h&&(s[e].main.default.playlists=d.master.playlists)),s[e])for(var f in u[p]||(u[p]=[]),s[e][p]){var m=s[e][p][f],g=void 0;if(h?(c("AUDIO group '"+p+"' label '"+f+"' is a master playlist"),m.isMasterPlaylist=!0,g=null):g="vhs-json"===n&&m.playlists?new vc(m.playlists[0],i,a):m.resolvedUri?new vc(m.resolvedUri,i,a):m.playlists&&"dash"===n?new Fc(m.playlists[0],i,a,d):null,m=wl.mergeOptions({id:f,playlistLoader:g},m),fh[e](e,m.playlistLoader,t),u[p].push(m),"undefined"===typeof l[f]){var v=new wl.AudioTrack({id:f,kind:ch(m),enabled:!1,language:m.language,default:m.default,label:f});l[f]=v}}r.on("error",ph[e](e,t))},SUBTITLES:function(e,t){var i=t.tech,n=t.vhs,r=t.sourceType,a=t.segmentLoaders[e],s=t.requestOptions,o=t.master.mediaGroups,u=t.mediaTypes[e],l=u.groups,c=u.tracks,d=t.masterPlaylistLoader;for(var h in o[e])for(var p in l[h]||(l[h]=[]),o[e][h])if(!o[e][h][p].forced){var f=o[e][h][p],m=void 0;if("hls"===r)m=new vc(f.resolvedUri,n,s);else if("dash"===r){if(!f.playlists.filter((function(e){return e.excludeUntil!==1/0})).length)return;m=new Fc(f.playlists[0],n,s,d)}else"vhs-json"===r&&(m=new vc(f.playlists?f.playlists[0]:f.resolvedUri,n,s));if(f=wl.mergeOptions({id:p,playlistLoader:m},f),fh[e](e,f.playlistLoader,t),l[h].push(f),"undefined"===typeof c[p]){var g=i.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track;c[p]=g}}a.on("error",ph[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i=t.tech,n=t.master.mediaGroups,r=t.mediaTypes[e],a=r.groups,s=r.tracks;for(var o in n[e])for(var u in a[o]||(a[o]=[]),n[e][o]){var l=n[e][o][u];if(/^(?:CC|SERVICE)/.test(l.instreamId)){var c=i.options_.vhs&&i.options_.vhs.captionServices||{},d={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(c[d.instreamId]&&(d=wl.mergeOptions(d,c[d.instreamId])),void 0===d.default&&delete d.default,a[o].push(wl.mergeOptions({id:u},l)),"undefined"===typeof s[u]){var h=i.addRemoteTextTrack({id:d.instreamId,kind:"captions",default:d.default,language:d.language,label:d.label},!1).track;s[u]=h}}}}},gh=function e(t,i){for(var n=0;n1&&ic(t.master))for(var u=0;u "+a+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},i.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=A.setInterval((function(){return e.checkABR_()}),250)},i.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(A.clearInterval(this.abrTimer_),this.abrTimer_=null)},i.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a=n.main||r.length&&n[r[0]];for(var s in a)if(a[s].default){i={label:s};break}}if(!i)return t;var o=[];for(var u in n)if(n[u][i.label]){var l=n[u][i.label];if(l.playlists&&l.playlists.length)o.push.apply(o,l.playlists);else if(l.uri)o.push(l);else if(e.playlists.length)for(var c=0;c1&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},i.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log;if(!r)return wl.log.warn("We received no playlist to switch to. Please check your stream."),!1;var c="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return l(c+" as current playlist is not set"),!0;if(r.id===t.id)return!1;var d=Boolean(Dl(i,n).length);if(!t.endList)return d||"number"!==typeof t.partTargetDuration?(l(c+" as current playlist is live"),!0):(l("not "+c+" as current playlist is live llhls, but currentTime isn't in buffered."),!1);var h=Bl(i,n),p=u?jc.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:jc.MAX_BUFFER_LOW_WATER_LINE;if(om)&&h>=a){var v=c+" as forwardBuffer >= bufferLowWaterLine ("+h+" >= "+a+")";return u&&(v+=" and next bandwidth > current bandwidth ("+f+" > "+m+")"),l(v),!0}return l("not "+c+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},i.setupSegmentLoaderListeners_=function(){var e=this;this.experimentalBufferBasedABR||(this.mainSegmentLoader_.on("bandwidthupdate",(function(){var t=e.selectPlaylist();e.shouldSwitchToMedia_(t)&&e.switchMedia_(t,"bandwidthupdate"),e.tech_.trigger("bandwidthupdate")})),this.mainSegmentLoader_.on("progress",(function(){e.trigger("progress")}))),this.mainSegmentLoader_.on("error",(function(){e.blacklistCurrentPlaylist(e.mainSegmentLoader_.error())})),this.mainSegmentLoader_.on("appenderror",(function(){e.error=e.mainSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.mainSegmentLoader_.on("timestampoffset",(function(){e.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),e.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})})),this.audioSegmentLoader_.on("syncinfoupdate",(function(){e.onSyncInfoUpdate_()})),this.audioSegmentLoader_.on("appenderror",(function(){e.error=e.audioSegmentLoader_.error_,e.trigger("error")})),this.mainSegmentLoader_.on("ended",(function(){e.logger_("main segment loader ended"),e.onEndOfStream()})),this.mainSegmentLoader_.on("earlyabort",(function(t){e.experimentalBufferBasedABR||(e.delegateLoaders_("all",["abort"]),e.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))}));var t=function(){if(!e.sourceUpdater_.hasCreatedSourceBuffers())return e.tryToCreateSourceBuffers_();var t=e.getCodecsOrExclude_();t&&e.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",t),this.audioSegmentLoader_.on("trackinfo",t),this.mainSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("fmp4",(function(){e.triggeredFmp4Usage||(e.tech_.trigger({type:"usage",name:"vhs-fmp4"}),e.tech_.trigger({type:"usage",name:"hls-fmp4"}),e.triggeredFmp4Usage=!0)})),this.audioSegmentLoader_.on("ended",(function(){e.logger_("audioSegmentLoader ended"),e.onEndOfStream()}))},i.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},i.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},i.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},i.fastQualityChange_=function(e){var t=this;void 0===e&&(e=this.selectPlaylist()),e!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything((function(){wl.browser.IE_VERSION||wl.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())}))):this.logger_("skipping fastQualityChange because new media is same as old")},i.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=n,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});var u=this.selectPlaylist();if(!u)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");var l=e.internal?this.logger_:wl.log.warn,c=e.message?" "+e.message:"";l((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+c+" Switching to playlist "+u.id+"."),u.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);var d=u.targetDuration/2*1e3||5e3,h="number"===typeof u.lastRequest&&Date.now()-u.lastRequest<=d;return this.switchMedia_(u,"exclude",s||h)},i.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},i.delegateLoaders_=function(e,t){var i=this,n=[],r="all"===e;(r||"main"===e)&&n.push(this.masterPlaylistLoader_);var a=[];(r||"audio"===e)&&a.push("AUDIO"),(r||"subtitle"===e)&&(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach((function(e){var t=i.mediaTypes_[e]&&i.mediaTypes_[e].activePlaylistLoader;t&&n.push(t)})),["main","audio","subtitle"].forEach((function(t){var r=i[t+"SegmentLoader_"];!r||e!==t&&"all"!==e||n.push(r)})),n.forEach((function(e){return t.forEach((function(t){"function"===typeof e[t]&&e[t]()}))}))},i.setCurrentTime=function(e){var t=Dl(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.media().segments?t&&t.length?e:(this.mainSegmentLoader_.resetEverything(),this.mainSegmentLoader_.abort(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.resetEverything(),this.audioSegmentLoader_.abort()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.resetEverything(),this.subtitleSegmentLoader_.abort()),void this.load()):0},i.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:Nd.Playlist.duration(e):1/0:0},i.seekable=function(){return this.seekable_},i.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n=this.masterPlaylistLoader_.master,r=Nd.Playlist.seekable(t,i,Nd.Playlist.liveEdgeDelay(n,t));if(0!==r.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=Nd.Playlist.seekable(t,i,Nd.Playlist.liveEdgeDelay(n,t))).length)return}var a,s;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),s=this.seekable_.start(0)),e?e.start(0)>r.end(0)||r.start(0)>e.end(0)?this.seekable_=r:this.seekable_=wl.createTimeRanges([[e.start(0)>r.start(0)?e.start(0):r.start(0),e.end(0)0&&(n=Math.max(n,i.end(i.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}},i.dispose=function(){var e=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach((function(t){var i=e.mediaTypes_[t].groups;for(var n in i)i[n].forEach((function(e){e.playlistLoader&&e.playlistLoader.dispose()}))})),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()},i.master=function(){return this.masterPlaylistLoader_.master},i.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},i.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return!(!t||!i)},i.getCodecsOrExclude_=function(){var e=this,t={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}};t.video=t.main;var i=yd(this.master(),this.media()),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(t.main.hasVideo&&(n.video=i.video||t.main.videoCodec||"avc1.4d400d"),t.main.isMuxed&&(n.video+=","+(i.audio||t.main.audioCodec||"mp4a.40.2")),(t.main.hasAudio&&!t.main.isMuxed||t.audio.hasAudio||r)&&(n.audio=i.audio||t.main.audioCodec||t.audio.audioCodec||"mp4a.40.2",t.audio.isFmp4=t.main.hasAudio&&!t.main.isMuxed?t.main.isFmp4:t.audio.isFmp4),n.audio||n.video){var a,s={};if(["video","audio"].forEach((function(e){if(n.hasOwnProperty(e)&&(r=t[e].isFmp4,o=n[e],!(r?ze(o):Xe(o)))){var i=t[e].isFmp4?"browser":"muxer";s[i]=s[i]||[],s[i].push(n[e]),"audio"===e&&(a=i)}var r,o})),r&&a&&this.media().attributes.AUDIO){var o=this.media().attributes.AUDIO;this.master().playlists.forEach((function(t){(t.attributes&&t.attributes.AUDIO)===o&&t!==e.media()&&(t.excludeUntil=1/0)})),this.logger_("excluding audio group "+o+" as "+a+' does not support codec(s): "'+n.audio+'"')}if(!Object.keys(s).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var u=[];if(["video","audio"].forEach((function(t){var i=(qe(e.sourceUpdater_.codecs[t]||"")[0]||{}).type,r=(qe(n[t]||"")[0]||{}).type;i&&r&&i.toLowerCase()!==r.toLowerCase()&&u.push('"'+e.sourceUpdater_.codecs[t]+'" -> "'+n[t]+'"')})),u.length)return void this.blacklistCurrentPlaylist({playlist:this.media(),message:"Codec switching not supported: "+u.join(", ")+".",blacklistDuration:1/0,internal:!0})}return n}var l=Object.keys(s).reduce((function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+s[t].join(",")+'"'}),"")+".";this.blacklistCurrentPlaylist({playlist:this.media(),internal:!0,message:l,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:this.media(),message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},i.tryToCreateSourceBuffers_=function(){if("open"===this.mediaSource.readyState&&!this.sourceUpdater_.hasCreatedSourceBuffers()&&this.areMediaTypesKnown_()){var e=this.getCodecsOrExclude_();if(e){this.sourceUpdater_.createSourceBuffers(e);var t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}}},i.excludeUnsupportedVariants_=function(){var e=this,t=this.master().playlists,i=[];Object.keys(t).forEach((function(n){var r=t[n];if(-1===i.indexOf(r.id)){i.push(r.id);var a=yd(e.master,r),s=[];!a.audio||Xe(a.audio)||ze(a.audio)||s.push("audio codec "+a.audio),!a.video||Xe(a.video)||ze(a.video)||s.push("video codec "+a.video),a.text&&"stpp.ttml.im1t"===a.text&&s.push("text codec "+a.text),s.length&&(r.excludeUntil=1/0,e.logger_("excluding "+r.id+" for unsupported: "+s.join(", ")))}}))},i.excludeIncompatibleVariants_=function(e){var t=this,i=[],n=this.master().playlists,r=gd(qe(e)),a=vd(r),s=r.video&&qe(r.video)[0]||null,o=r.audio&&qe(r.audio)[0]||null;Object.keys(n).forEach((function(e){var r=n[e];if(-1===i.indexOf(r.id)&&r.excludeUntil!==1/0){i.push(r.id);var u=[],l=yd(t.masterPlaylistLoader_.master,r),c=vd(l);if(l.audio||l.video){if(c!==a&&u.push('codec count "'+c+'" !== "'+a+'"'),!t.sourceUpdater_.canChangeType()){var d=l.video&&qe(l.video)[0]||null,h=l.audio&&qe(l.audio)[0]||null;d&&s&&d.type.toLowerCase()!==s.type.toLowerCase()&&u.push('video codec "'+d.type+'" !== "'+s.type+'"'),h&&o&&h.type.toLowerCase()!==o.type.toLowerCase()&&u.push('audio codec "'+h.type+'" !== "'+o.type+'"')}u.length&&(r.excludeUntil=1/0,t.logger_("blacklisting "+r.id+": "+u.join(" && ")))}}}))},i.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n,r=i,a=0;a0&&this.logger_("resetting possible stalled download count for "+e+" loader"),this[e+"StalledDownloads_"]=0,this[e+"Buffered_"]=t.buffered_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1));if(this.beforeSeekableWindow_(t,i)){var n=t.start(0);e=n+(n===t.end(0)?0:.1)}if("undefined"!==typeof e)return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+Ml(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var r=this.masterPlaylistController_.sourceUpdater_,a=this.tech_.buffered(),s=r.audioBuffer?r.audioBuffered():null,o=r.videoBuffer?r.videoBuffered():null,u=this.media(),l=u.partTargetDuration?u.partTargetDuration:2*(u.targetDuration-1/30),c=[s,o],d=0;d "+i.end(0)+"]. Attempting to resume playback by seeking to the current time."),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"}),void this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})):void 0}},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}var n=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;var a=Rl(r,t);if(a.length>0){var s=a.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+s+", seeking to "+a.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*s,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+.1;return!i.endList&&n&&(r=e.end(e.length-1)+3*i.targetDuration),t>r},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:r,end:a}}return null},e}(),Ch={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},wh={PlaylistLoader:vc,Playlist:nc,utils:Ac,STANDARD_PLAYLIST_SELECTOR:Cd,INITIAL_PLAYLIST_SELECTOR:function(){var e=this,t=this.playlists.master.playlists.filter(nc.isEnabled);return kd(t,(function(e,t){return Sd(e,t)})),t.filter((function(t){return!!yd(e.playlists.master,t).video}))[0]||null},lastBandwidthSelector:Cd,movingAverageBandwidthSelector:function(e){var t=-1,i=-1;if(e<0||e>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){var n=this.useDevicePixelRatio&&A.devicePixelRatio||1;return t<0&&(t=this.systemBandwidth,i=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==i&&(t=e*this.systemBandwidth+(1-e)*t,i=this.systemBandwidth),Ed(this.playlists.master,t,parseInt(Td(this.tech_.el(),"width"),10)*n,parseInt(Td(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:Sd,comparePlaylistResolution:function(e,t){var i,n;return e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||A.Number.MAX_VALUE,t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(n=t.attributes.RESOLUTION.width),i===(n=n||A.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Tc()};Object.keys(jc).forEach((function(e){Object.defineProperty(wh,e,{get:function(){return wl.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),jc[e]},set:function(t){wl.log.warn("using Vhs."+e+" is UNSAFE be sure you know what you are doing"),"number"!==typeof t||t<0?wl.log.warn("value of Vhs."+e+" must be greater than or equal to 0"):jc[e]=t}})}));var Ih=function(e,t){for(var i=t.media(),n=-1,r=0;r=1e7&&e>=1e7?Math.max(e,i):i}return e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e,t=1/(this.bandwidth||1);return e=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+e))},set:function(){wl.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:function(){return i.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return i.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return i.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return i.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return i.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return i.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return i.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return i.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return i.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return i.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return i.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return i.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return Nl(i.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return i.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return i.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return i.tech_.name_},enumerable:!0},duration:{get:function(){return i.tech_.duration()},enumerable:!0},master:{get:function(){return i.playlists.master},enumerable:!0},playerDimensions:{get:function(){return i.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return Nl(i.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return i.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",(function(){i.options_.useBandwidthFromLocalStorage&&function(e){if(!A.localStorage)return!1;var t=Ah();t=t?wl.mergeOptions(t,e):e;try{A.localStorage.setItem("videojs-vhs",JSON.stringify(t))}catch(e){return!1}}({bandwidth:i.bandwidth,throughput:Math.round(i.throughput)})})),this.masterPlaylistController_.on("selectedinitialmedia",(function(){var e;(e=i).representations=function(){var t=e.masterPlaylistController_.master(),i=ic(t)?e.masterPlaylistController_.getAudioTrackPlaylists_():t.playlists;return i?i.filter((function(e){return!Ql(e)})).map((function(t,i){return new kh(e,t,t.id)})):[]}})),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",(function(){i.setupEme_()})),this.on(this.masterPlaylistController_,"progress",(function(){this.tech_.trigger("progress")})),this.on(this.masterPlaylistController_,"firstplay",(function(){this.ignoreNextSeekingEvent_=!0})),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=A.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}},i.createKeySessions_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Ph({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:t&&t.media(),mainPlaylists:this.playlists.master.playlists}).then((function(){e.logger_("created EME key session"),e.masterPlaylistController_.sourceUpdater_.initializedEme()})).catch((function(t){e.logger_("error while creating EME key session",t),e.player_.error({message:"Failed to initialize media keys for EME",code:3})}))},i.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},i.setupEme_=function(){var e=this,t=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,i=xh({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:t&&t.media()});this.player_.tech_.on("keystatuschange",(function(t){"output-restricted"===t.status&&e.masterPlaylistController_.blacklistCurrentPlaylist({playlist:e.masterPlaylistController_.media(),message:"DRM keystatus changed to "+t.status+". Playlist will fail to play. Check for HDCP content.",blacklistDuration:1/0})})),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==wl.browser.IE_VERSION&&i?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},i.setupQualityLevels_=function(){var e=this,t=wl.players[this.tech_.options_.playerId];t&&t.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=t.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",(function(){!function(e,t){t.representations().forEach((function(t){e.addQualityLevel(t)})),Ih(e,t.playlists)}(e.qualityLevels_,e)})),this.playlists.on("mediachange",(function(){Ih(e.qualityLevels_,e.playlists)})))},t.version=function(){return{"@videojs/http-streaming":"2.14.0","mux.js":"6.0.1","mpd-parser":"0.21.0","m3u8-parser":"4.7.0","aes-decrypter":"3.1.2"}},i.version=function(){return this.constructor.version()},i.canChangeType=function(){return th.canChangeType()},i.play=function(){this.masterPlaylistController_.play()},i.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},i.duration=function(){return this.masterPlaylistController_.duration()},i.seekable=function(){return this.masterPlaylistController_.seekable()},i.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&A.URL.revokeObjectURL&&(A.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),e.prototype.dispose.call(this)},i.convertToProgramTime=function(e,t){return Oc({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},i.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Lc({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},t}(wl.getComponent("Component")),Lh={name:"videojs-http-streaming",VERSION:"2.14.0",canHandleSource:function(e,t){void 0===t&&(t={});var i=wl.mergeOptions(wl.options,t);return Lh.canPlayType(e.type,i)},handleSource:function(e,t,i){void 0===i&&(i={});var n=wl.mergeOptions(wl.options,i);return t.vhs=new Oh(e,t,n),wl.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return wl.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Tc(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){void 0===t&&(t={});var i=wl.mergeOptions(wl.options,t),n=i.vhs,r=(n=void 0===n?{}:n).overrideNative,a=void 0===r?!wl.browser.IS_ANY_SAFARI:r,s=i.hls,o=(s=void 0===s?{}:s).overrideNative,u=void 0!==o&&o,l=Qe(e);return l&&(!wh.supportsTypeNatively(l)||u||a)?"maybe":""}};(ze("avc1.4d400d,mp4a.40.2")&&wl.getTech("Html5").registerSourceHandler(Lh,0),wl.VhsHandler=Oh,Object.defineProperty(wl,"HlsHandler",{get:function(){return wl.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),Oh},configurable:!0}),wl.VhsSourceHandler=Lh,Object.defineProperty(wl,"HlsSourceHandler",{get:function(){return wl.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Lh},configurable:!0}),wl.Vhs=wh,Object.defineProperty(wl,"Hls",{get:function(){return wl.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),wh},configurable:!0}),wl.use||(wl.registerComponent("Hls",wh),wl.registerComponent("Vhs",wh)),wl.options.vhs=wl.options.vhs||{},wl.options.hls=wl.options.hls||{},wl.getPlugin&&wl.getPlugin("reloadSourceOnError"))||(wl.registerPlugin||wl.plugin)("reloadSourceOnError",(function(e){!function e(t,i){var n=0,r=0,a=wl.mergeOptions(Ch,i);t.ready((function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}));var s=function(){r&&t.currentTime(r)},o=function(e){null!==e&&void 0!==e&&(r=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",s),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())},u=function(){return Date.now()-n<1e3*a.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):a.getSource&&"function"===typeof a.getSource?(n=Date.now(),a.getSource.call(t,o)):void wl.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")},l=function e(){t.off("loadedmetadata",s),t.off("error",u),t.off("dispose",e)};t.on("error",u),t.on("dispose",l),t.reloadSourceOnError=function(i){l(),e(t,i)}}(this,e)})) /*! @name videojs-contrib-quality-levels @version 2.1.0 @license Apache-2.0 */;function Dh(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Rh=function e(t){var i=this;if(wl.browser.IS_IE8)for(var n in i=D.createElement("custom"),e.prototype)"constructor"!==n&&(i[n]=e.prototype[n]);return i.id=t.id,i.label=i.id,i.width=t.width,i.height=t.height,i.bitrate=t.bandwidth,i.enabled_=t.enabled,Object.defineProperty(i,"enabled",{get:function(){return i.enabled_()},set:function(e){i.enabled_(e)}}),i},Mh=function(e){var t,i;function n(){var t,i=Dh(Dh(t=e.call(this)||this));if(wl.browser.IS_IE8)for(var r in i=D.createElement("custom"),n.prototype)"constructor"!==r&&(i[r]=n.prototype[r]);return i.levels_=[],i.selectedIndex_=-1,Object.defineProperty(i,"selectedIndex",{get:function(){return i.selectedIndex_}}),Object.defineProperty(i,"length",{get:function(){return i.levels_.length}}),i||Dh(t)}i=e,(t=n).prototype=Object.create(i.prototype),t.prototype.constructor=t,t.__proto__=i;var r=n.prototype;return r.addQualityLevel=function(e){var t=this.getQualityLevelById(e.id);if(t)return t;var i=this.levels_.length;return t=new Rh(e),""+i in this||Object.defineProperty(this,i,{get:function(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t},r.removeQualityLevel=function(e){for(var t=null,i=0,n=this.length;ii&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t},r.getQualityLevelById=function(e){for(var t=0,i=this.length;t1&&void 0!==arguments[1]?arguments[1]:{},a=r.checked,s=void 0!==a&&a,u=r.readonly,l=void 0!==u&&u;return o(this,i),(n=t.apply(this,arguments))._player=e,n._isReadonly=l,n._isReadonly||n.on(["tap","click"],n._onClick),s&&n.check(),n}return l(i,[{key:"createEl",value:function(){var e=jh.createEl("div",{className:"vjs-toggle"});return this._toggleSwitch=jh.createEl("div",{className:"vjs-toggle-input vjs-toggle-switch"}),e.appendChild(this._toggleSwitch),e}},{key:"check",value:function(){this._toggleSwitch.setAttribute("data-toggled",!0),this._toggleSwitch.classList.add("vjs-toggle-switch--toggled"),this._isChecked=!0,this.trigger("check")}},{key:"uncheck",value:function(){this._toggleSwitch.removeAttribute("data-toggled"),this._toggleSwitch.classList.remove("vjs-toggle-switch--toggled"),this._isChecked=!1,this.trigger("uncheck")}},{key:"_onClick",value:function(){this._isChecked?this.uncheck():this.check()}}]),i}(Fh);function Hh(e,t){if(!t)throw new Error("Assertion Failed: ".concat(e))}function qh(e,t){t||console.warn(e)}function Wh(e){return(e instanceof window.HTMLAnchorElement||e instanceof window.HTMLAreaElement)&&e.hasAttribute("href")||(e instanceof window.HTMLInputElement||e instanceof window.HTMLSelectElement||e instanceof window.HTMLTextAreaElement||e instanceof window.HTMLButtonElement)&&!e.hasAttribute("disabled")||e instanceof window.HTMLIFrameElement||e instanceof window.HTMLObjectElement||e instanceof window.HTMLEmbedElement||e.hasAttribute("tabindex")&&-1!==e.getAttribute("tabindex")||e.hasAttribute("contenteditable")}wl.registerComponent("Toggle",Vh),wl.getComponent("Menu").prototype.handleBlur=function(e){var t=e.relatedTarget||document.activeElement;if(t===this.contentEl()&&e.target)e.target.focus();else if(!this.children().some((function(e){return e.el()===t}))){var i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}};var Gh=wl.getComponent("Player");function zh(e){var t=e.split(":");return"vjs-".concat(t[0],"-").concat(t[1])}var Xh=["auto","16:9","4:3","1:1","4:5"],Kh=function(e){d(i,e);var t=g(i);function i(e,n){var r;return o(this,i),(r=t.call(this,e,n))._focusableControls=r._getFocusableControls(),r._focusableControls.forEach((function(e){r.on(e,"keydown",r._handleKeydown)})),r}return l(i,[{key:"_handleKeydown",value:function(e){!this.isFullscreen()||"Tab"!==e.key&&9!==e.keyCode||this._trapFullscreenTap(e)}},{key:"_trapFullscreenTap",value:function(e){if(E){var t,i=this._focusableControls.indexOf(e.target);e.shiftKey?0===i&&(t=this._focusableControls.length-1):i===this._focusableControls.length-1&&(t=0),"undefined"!==typeof t&&(this._focusableControls[t].focus(),e.preventDefault())}}},{key:"_getFocusableControls",value:function(){var e=this.controlBar.children(),t=[];return e.forEach((function(e){var i=e.el();if(Wh(i))t.push(i);else if(i.children){var n=Array.from(i.children).find((function(e){return Wh(e)}));n&&t.push(n)}})),t}},{key:"aspectRatio",value:function(e){return void 0===e?this.aspectRatio_:(Hh("media-player: Aspect ratio ".concat(e," is not supported"),Xh.indexOf(e)>-1),this.aspectRatio_&&"auto"!==this.aspectRatio_&&this.removeClass(zh(this.aspectRatio_)),"auto"!==e&&this.addClass(zh(e)),this.aspectRatio_=e,e)}},{key:"resetPlaybackRate_",value:function(){var e=this.playbackRate();this.playbackRate(e)}},{key:"reset",value:function(){var e=this;this._isResetting=!0;var t=this.volume(),n=this.muted(),r=this.playbackRate();this.one("playerreset",(function(){e.volume(t),e.muted(n),e.defaultPlaybackRate(r),e._isResetting=!1})),y(h(i.prototype),"reset",this).call(this)}},{key:"isResetting",value:function(){return this._isResetting||!1}}]),i}(Gh);wl.registerComponent("Player",Kh);var Yh=wl.getComponent("Component"),Qh=wl.dom,$h=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._isShowing=!0,n.addClass("vjs-custom-captions-display"),n.hide(),n._hasPlayed=!1,n._showOnPlayed=!1,n.on(e,"playerreset",n._onPlayerReset),n.on(e,"playing",n._onPlaying),n}return l(i,[{key:"contentEl",value:function(){return this._cue}},{key:"hide",value:function(){this._isShowing&&(y(h(i.prototype),"hide",this).call(this),this._showOnPlayed=!1,this._isShowing=!1,this.trigger("hide"))}},{key:"show",value:function(){this._hasPlayed?y(h(i.prototype),"show",this).call(this):this._showOnPlayed=!0,this._isShowing||(this._isShowing=!0,this.trigger("show"))}},{key:"createEl",value:function(){return this._display=Qh.createEl("div",void 0,{class:"vjs-custom-captions-display"}),this._cue=Qh.createEl("div",void 0,{class:"vjs-custom-captions-cue",id:this.id()}),Qh.appendContent(this._display,this._cue)}},{key:"setText",value:function(e){Qh.textContent(this.contentEl(),e)}},{key:"_onPlaying",value:function(){this._hasPlayed=!0,this._showOnPlayed&&this.show()}},{key:"_onPlayerReset",value:function(){var e=this._isShowing;this.hide(),this._hasPlayed=!1,this._showOnPlayed=e}}]),i}(Yh);wl.registerComponent("CustomCaptionsDisplay",$h);var Jh=wl.mergeOptions,Zh=wl.getComponent("Button"),ep={useCustomCaptions:!1,selected:!1},tp=function(e){d(i,e);var t=g(i);function i(e,n){var r;if(o(this,i),(r=t.call(this,e,Jh({},ep,n)))._player=e,r._isActive=!1,r.options_.useCustomCaptions||r.hide(),r.controlText("Show Captions"),r.addClass("vjs-captions-toggle"),r._player.usingPlugin("userPreferences")&&(r._userPrefs=r._player.userPreferences(),r.one(r._player,"play",r._handlePlay),r.on(r._player,"playerreset",(function(){r.off(r._player,"off",r._handlePlay),r.one(r._player,"play",r._handlePlay)}))),r.options_.useCustomCaptions)r._player.ready((function(){var e=r._player.getChild("customCaptionsDisplay");r.on(e,"show",r.activate),r.on(e,"hide",r.deactivate)}));else{var a=r._player.textTracks();a&&(r.on(a,"addtrack",r._handleAddTrack),r.on(a,"removetrack",r._handleRemoveTrack))}return r}return l(i,[{key:"handleClick",value:function(){this._isActive?this.deactivate():this.activate(),this._userPrefs&&this._userPrefs.set("captions",this._isActive)}},{key:"activate",value:function(){this.options_.useCustomCaptions?this._player.getChild("customCaptionsDisplay").show():this._textTrack&&(this._textTrack.mode="showing"),this._player.usingPlugin("tracking")&&this._player.tracking().setIsCcVisible(!0),this.addClass("vjs-captions-active"),this.controlText("Hide Captions"),this._isActive=!0,this.trigger("activate")}},{key:"deactivate",value:function(){this._isActive&&(this.options_.useCustomCaptions?this._player.getChild("customCaptionsDisplay").hide():this._textTrack&&(this._textTrack.mode="hidden"),this._player.usingPlugin("tracking")&&this._player.tracking().setIsCcVisible(!1),this.removeClass("vjs-captions-active"),this.controlText("Show Captions"),this._isActive=!1,this.trigger("deactivate"))}},{key:"_handleAddTrack",value:function(e){e.track&&"captions"===e.track.kind&&(this._textTrack=e.track,this.show(),"showing"===this._textTrack.mode&&this.activate())}},{key:"_handleRemoveTrack",value:function(e){e.track&&"captions"===e.track.kind&&(this._textTrack=null,this.deactivate(),this.hide())}},{key:"_handlePlay",value:function(){this._userPrefs&&this._userPrefs.get("captions")&&this.activate()}}]),i}(Zh);function ip(e,t,i){var n,r,a,s,o;function u(){var l=Date.now()-s;l=0?n=setTimeout(u,t-l):(n=null,i||(o=e.apply(a,r),a=r=null))}null==t&&(t=100);var l=function(){a=this,r=arguments,s=Date.now();var l=i&&!n;return n||(n=setTimeout(u,t)),l&&(o=e.apply(a,r),a=r=null),o};return l.clear=function(){n&&(clearTimeout(n),n=null)},l.flush=function(){n&&(o=e.apply(a,r),a=r=null,clearTimeout(n),n=null)},l}wl.registerComponent("CaptionsToggle",tp),ip.debounce=ip;var np=ip,rp=wl.getComponent("TextTrackMenuItem"),ap=wl.dom,sp=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,[{key:"createEl",value:function(e,t,n){var r=y(h(i.prototype),"createEl",this).call(this,e,t,n);if("subtitles"===this.options_.track.kind){this.options_.label="English (auto-generated)",r.removeChild(r.querySelector(".vjs-menu-item-text"));var a=ap.createEl("span",void 0,{class:"vjs-menu-item-text"});ap.textContent(a,this.localize(this.options_.label)),r.appendChild(a)}return r}}]),i}(rp);wl.registerComponent("CaptionsMenuItem",sp);var op=wl.getComponent("TextTrackButton"),up=wl.getComponent("OffTextTrackMenuItem"),lp="vjs-captions-active",cp=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,i),(n=t.call(this,e,r))._player=e,n.controlText("Open Captions Menu"),n._isMenuOpen=!1,n._hasManuallyDisabled=!1,n.addClass("vjs-captions-menu-toggle"),r.id&&n.setAttribute("id",r.id);var a=e.textTracks();return n.sort=r.sort,n.selectedLanguage=r.selectedLanguage,n.reEnableCaptions=np(n._reEnableCaptions,300,!0),n.on("captionMenuItemSelected",(function(e,t){var i=t.track;n.trigger("captionChange",i)})),n._player.usingPlugin("userPreferences")&&(n._userPrefs=n._player.userPreferences(),n.on(n._player,"playerreset",(function(){n.removeClass(lp)}))),a&&n.on(a,"change",n._handleChangeTrack),n.on("dispose",n._onDispose),n.on(n._player,"loadedmetadata",n._handleLoadedMetaData),n}return l(i,[{key:"createItems",value:function(){var e=this,t=[];this.removeClass(lp),(t=y(h(i.prototype),"createItems",this).call(this,t,sp)).shift(),"function"===typeof this.sort?t.sort(this.sort):!1!==this.sort&&t.sort((function(e,t){var i=e.track.label.toLowerCase(),n=t.track.label.toLowerCase();return ithis._player.duration()&&(e=this._player.duration()),this._player.currentTime(e),this.trigger("skipAhead")}}]),i}(Qp);wl.registerComponent("SkipAheadButton",Jp);var Zp=wl.getComponent("Button"),ef=10,tf=function(e){d(i,e);var t=g(i);function i(e,n){var r,a=n.duration,s=void 0===a?ef:a;return o(this,i),(r=t.apply(this,arguments))._player=e,r._duration=s,e.playerInteraction().registerControl(r.el(),Xp),r.controlText("Skip back"),r.addClass("vjs-skip-back-button"),r}return l(i,[{key:"handleClick",value:function(){var e=this._player.currentTime()-this._duration,t=e<0?0:e;this._player.currentTime(t),this.trigger("skipBack")}}]),i}(Zp);wl.registerComponent("SkipBackButton",tf);var nf=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._player=e,n.controlText("Back to start"),n.addClass("vjs-back-to-start-button"),n}return l(i,[{key:"handleClick",value:function(){this._player.currentTime(0),this.trigger("backToStart")}}]),i}(wl.getComponent("Button"));wl.registerComponent("BackToStartButton",nf);var rf=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._player=e,n._player.playerInteraction().registerControl(n.el(),Kp),n.controlText("Theater mode"),n.addClass("vjs-theater-mode-button"),n.isTheaterModeEnabled=!1,n}return l(i,[{key:"handleClick",value:function(){this.isTheaterModeEnabled=!this.isTheaterModeEnabled,this.isTheaterModeEnabled?(this.addClass("vjs-theater-mode-button--enabled"),this.controlText("Theater mode default view"),this.trigger("activate")):(this.removeClass("vjs-theater-mode-button--enabled"),this.controlText("Theater mode"),this.trigger("deactivate"))}}]),i}(wl.getComponent("Button"));wl.registerComponent("TheaterModeButton",rf);var af=wl.getComponent("PlaybackRateMenuButton"),sf=wl.getComponent("PlaybackRateMenuItem"),of=wl.dom,uf=function(e){d(i,e);var t=g(i);function i(){var e;return o(this,i),(e=t.apply(this,arguments)).player().playerInteraction().registerControl(e.getChild("PlaybackRateMenuButton").el(),Yp),e}return l(i,[{key:"createEl",value:function(){var e=y(h(i.prototype),"createEl",this).call(this);return this.labelEl_.setAttribute("aria-hidden",!0),e}},{key:"createItems",value:function(){var e=this,t=this.playbackRates(),i=[];return t&&t.forEach((function(t){var n=new sf(e.player(),{rate:"".concat(t,"x")}),r=of.createEl("span",{className:"vjs-icon-placeholder"});of.prependTo(r,n.el()),n.addClass("vjs-menu-item-checkable"),i.push(n)})),i}},{key:"handleClick",value:function(){this.buttonPressed_?this.unpressButton():this.pressButton()}}]),i}(af);wl.registerComponent("PlaybackRateMenuButton",uf);var lf=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments)).addClass("vjs-poster-background"),n.setBackground(),n.on(e,"playerreset",n._playerReset),n.on(e,"posterchange",n.setBackground),n}return l(i,[{key:"setBackground",value:function(){var e=this.player().poster();this.el().style.backgroundImage=e?"url(".concat(e,")"):"none"}},{key:"_playerReset",value:function(){this.el().style.backgroundImage="none"}}]),i}(wl.getComponent("Component"));wl.registerComponent("PosterBackground",lf);var cf=wl.getComponent("Component"),df=wl.dom,hf="LEFT",pf="RIGHT",ff={LEFT:"vjs-tooltip-left",RIGHT:"vjs-tooltip-right"},mf=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.control,s=r.text;return o(this,i),Hh("tooltip: must be pased a control",a),(n=t.apply(this,arguments)).player=e,n._control=a,n.setText(s),n.on(a,"focus",n._onFocus),n.on(a,"focusout",n._onFocusout),n.on(a,"keydown",n._onKeydown),n.on(a,"mouseenter",n._onMouseenter),n.on(a,"mouseleave",n._onMouseleave),n.on(n.player,"fullscreenchange",n._exitFullscreen),n.on(n._tooltipContainer,"click",(function(e){e.target.classList.contains("vjs-tooltip-container")&&(e.preventDefault(),e.stopPropagation())})),n}return l(i,[{key:"createEl",value:function(){var e=ff[this.options_.side]||"";return this._tooltip=y(h(i.prototype),"createEl",this).call(this,"div",{className:"vjs-tooltip"},{"aria-hidden":"true",role:"tooltip"}),this._tooltipContainer=y(h(i.prototype),"createEl",this).call(this,"div",{className:"vjs-tooltip-container ".concat(e)}),this._tooltipContainer.appendChild(this._tooltip),this._tooltipContainer}},{key:"show",value:function(){this._isShowing||(this.addClass("vjs-tooltip-active"),this._isShowing=!0)}},{key:"hide",value:function(){this._isShowing&&(this.removeClass("vjs-tooltip-active"),this._isShowing=!1)}},{key:"setText",value:function(e){var t=this.player.localize(e);df.textContent(this._tooltip,t)}},{key:"_onKeydown",value:function(e){"Escape"!==e.key&&"Esc"!==e.key||!this._isShowing||this.hide()}},{key:"_exitFullscreen",value:function(){this._isShowing&&this.hide()}},{key:"_onFocus",value:function(){this.show()}},{key:"_onFocusout",value:function(){this.hide()}},{key:"_onMouseenter",value:function(){this.show()}},{key:"_onMouseleave",value:function(){this.hide()}}]),i}(cf);mf.prototype.options_={name:"ControlTooltip"},wl.registerComponent("ControlTooltip",mf);var gf=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,[{key:"handleClick",value:function(){var e=this;y(h(i.prototype),"handleClick",this).apply(this,arguments),this.player().one("fullscreenchange",(function(){e.el().focus()}))}}]),i}(wl.getComponent("FullscreenToggle"));wl.registerComponent("FullscreenToggle",gf);var vf=function(e){d(i,e);var t=g(i);function i(e,n){var r;return o(this,i),r=t.call(this,e,n),e.ready((function(){n.inline?e.controlBar.addClass("vjs-control-bar--inline"):e.controlBar.addClass("vjs-control-bar--tier")})),r}return l(i)}(wl.getComponent("ProgressControl"));wl.registerComponent("ProgressControl",vf);var yf=wl.getComponent("Menu"),_f=wl.dom,bf=function(e){d(i,e);var t=g(i);function i(){var e;return o(this,i),(e=t.apply(this,arguments))._selectedSubMenuItem=null,e.on("focusout",e._onFocusout),e}return l(i,[{key:"createEl",value:function(){var e=y(h(i.prototype),"createEl",this).apply(this,arguments);return _f.addClass(e,"vjs-settings-menu"),this._subMenus=_f.createEl("div",{className:"vjs-settings-menu-sub-menus"}),e.appendChild(this._subMenus),e}},{key:"addItem",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.index;this.addChild(e,void 0,n);var r=e.getMenu();r&&(this._subMenus.appendChild(r.el()),this.on(e,"select",(function(){return t._onSelectSubMenu(e)})),this.on(e,"deselect",(function(){return t._onDeselectSubMenu(e)})))}},{key:"_onFocusout",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.relatedTarget;this.menuButton_&&!this.el().contains(t)&&(this._selectedSubMenuItem&&this._selectedSubMenuItem.selected(!1),this.menuButton_.el().contains(t)||this.menuButton_.unpressButton())}},{key:"_onSelectSubMenu",value:function(e){var t=e.getMenu();t&&(t.focus(),this.addClass("vjs-settings-menu-sub-menu-active"),this._selectedSubMenuItem=e)}},{key:"_onDeselectSubMenu",value:function(e){e.getMenu()&&(this.removeClass("vjs-settings-menu-sub-menu-active"),this.hasClass("vjs-lock-showing")&&e.focus(),this._selectedSubMenuItem=null)}}]),i}(yf);wl.registerComponent("SettingsMenu",bf);var Tf=wl.getComponent("MenuItem"),kf=wl.dom,Sf=wl.mergeOptions,Ef={selectable:!0,valueText:void 0},Cf=function(e){d(i,e);var t=g(i);function i(e,n){return o(this,i),t.call(this,e,Sf({},Ef,n))}return l(i,[{key:"createMenu",value:function(){}},{key:"getMenu",value:function(){return this._menu}},{key:"createEl",value:function(){var e=this,t=y(h(i.prototype),"createEl",this).apply(this,arguments),n=this.options_,r=n.valueText,a=n.icon;if(kf.addClass(t,"vjs-settings-menu-item"),this._menu=this.createMenu(),this._value=kf.createEl("div",{className:"vjs-settings-menu-item-value"}),r&&this.setValueText(r),t.appendChild(this._value),a&&kf.prependTo(kf.createEl("span",{className:"vjs-icon-placeholder"}),t),this._menu){var s=new i(this.player(),{label:this.options_.label,icon:!0,selectable:!1});s.addClass("vjs-settings-menu-item-header"),s.on(["tap","click"],(function(){e.selected(!1)})),this._menu.addChild(s,void 0,0),kf.addClass(t,"vjs-settings-menu-item-expandable"),t.appendChild(kf.createEl("span",{className:"vjs-icon-placeholder"})),t.setAttribute("aria-haspopup","true"),t.setAttribute("aria-expanded","false")}return t}},{key:"setValueText",value:function(e){e&&kf.textContent(this._value,this.localize(e))}},{key:"selected",value:function(e){y(h(i.prototype),"selected",this).apply(this,arguments),this.selectable&&(e?this._select():this._deselect())}},{key:"handleClick",value:function(){y(h(i.prototype),"handleClick",this).apply(this,arguments),this.trigger("clicked")}},{key:"_select",value:function(){this._menu&&(this._menu.addClass("vjs-settings-menu-item-active"),this.el().setAttribute("aria-expanded","true")),this.trigger("select")}},{key:"_deselect",value:function(){this._menu&&(this._menu.removeClass("vjs-settings-menu-item-active"),this.el().setAttribute("aria-expanded","false")),this.trigger("deselect")}}]),i}(Tf);function wf(e){return!!e||!1===e||0===e}wl.registerComponent("SettingsMenuItem",Cf);var If=wl.mergeOptions,Pf=wl.getComponent("SettingsMenuItem"),xf=wl.getComponent("Toggle"),Af={multiselectable:!0,selected:!0},Of=function(e){d(i,e);var t=g(i);function i(e,n){var r;o(this,i);var a=(r=t.call(this,e,If({},Af,n))).options_,s=a.userPrefsKey,u=a.enableUserPrefs,l=a.className;return r.addClass("vjs-settings-toggle-menu-item"),l&&r.addClass(l),u&&e.usingPlugin("userPreferences")&&(r._userPrefs=e.userPreferences(),r._userPrefsKey=s,e.ready((function(){var e=r._userPrefs.get(s);wf(e)&&r.selected(e)}))),r}return l(i,[{key:"createEl",value:function(){var e=y(h(i.prototype),"createEl",this).apply(this,arguments);return this._toggle=this._createToggle(),e.appendChild(this._toggle.el()),e}},{key:"handleClick",value:function(){this.selected(!this.isSelected_),this._userPrefs&&this._userPrefs.set(this._userPrefsKey,this.isSelected_)}},{key:"selected",value:function(e){return wf(e)&&e!==this._lastSelected&&(y(h(i.prototype),"selected",this).apply(this,arguments),e?(this.setValueText("On"),this._toggle.check()):(this.setValueText("Off"),this._toggle.uncheck()),this._lastSelected=e),this.isSelected_}},{key:"_createToggle",value:function(){return new xf(this.player(),{readonly:!0})}}]),i}(Pf);wl.registerComponent("SettingsToggleMenuItem",Of);var Lf=wl.getComponent("SettingsMenu"),Df=function(e){d(i,e);var t=g(i);function i(){var e;return o(this,i),(e=t.apply(this,arguments)).addClass("vjs-settings-menu-button"),e}return l(i,[{key:"createMenu",value:function(){var e=new Lf(this.player(),{menuButton:this});return this.hideThreshold_=0,this.items||(this.items=this.createItems()),this.items.forEach((function(t){e.addItem(t)})),e}},{key:"createItems",value:function(){var e,t=this,i=this.options_&&this.options_.items||[];return Array.isArray(i)?(e=i,i={}):e=Object.keys(i),e.map((function(e){var n=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e.charAt(0).toUpperCase()+e.slice(1)}(e),r=wl.getComponent(n);Hh("settings-menu: Component ".concat(n," must exist"),r);var a=new r(t.player(),i[e]||{});return a.addClass("vjs-settings-menu-button-item"),a}))}}]),i}(wl.getComponent("MenuButton"));Df.prototype.controlText_="Settings",wl.registerComponent("SettingsMenuButton",Df);var Rf=wl.mergeOptions,Mf=wl.getComponent("SettingsToggleMenuItem"),Nf=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i)}(Mf);Nf.prototype.options_=Rf(Mf.prototype.options_,{label:"Autoplay",name:"AutoplaySetting",enableUserPrefs:!0,userPrefsKey:"autoplay",className:"vjs-autoplay-setting"}),wl.registerComponent("AutoplaySetting",Nf);var Uf=wl.mergeOptions,Bf=wl.getComponent("SettingsToggleMenuItem"),Ff=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i)}(Bf);Ff.prototype.options_=Uf(Bf.prototype.options_,{label:"Auto-advance",name:"AutoAdvanceSetting",enableUserPrefs:!0,userPrefsKey:"auto-advance",className:"vjs-auto-advance-setting"}),wl.registerComponent("AutoAdvanceSetting",Ff);var jf=wl.mergeOptions,Vf=wl.getComponent("SettingsMenu"),Hf=wl.getComponent("SettingsMenuItem"),qf={multiselectable:!1,selected:!1},Wf="quality-adapt",Gf="quality-prog";function zf(e){return"auto"===e?"Auto":"".concat(e,"p")}var Xf=function(e){d(i,e);var t=g(i);function i(e,n){var r;return o(this,i),r=t.call(this,e,jf({},qf,n)),Hh("quality-setting: The qualityLevels plugin is required",e.hasPlugin("qualityLevels")),r.addClass("vjs-quality-setting"),r._qualityLevels=e.qualityLevels(),r._items=[],r._qualities=[],r._selectedHeight=null,e.usingPlugin("userPreferences")&&(r._userPrefs=e.userPreferences(),r._userPrefsKey=r.options_.userPrefsKey),r.on(r._qualityLevels,"addqualitylevel",r._onAddQualityLevel),r.on(r._qualityLevels,"removequalitylevel",r._onRemoveQualityLevel),r.on(r.player_,"sourceset",r._onSourceSet),r.on(r.player_,"loadedmetadata",r._onLoadedMetadata),r.on(r.player_,"playerreset",r._onPlayerReset),r}return l(i,[{key:"createMenu",value:function(){var e=new Vf(this.player_);return e.addClass("vjs-quality-setting-sub-menu"),e}},{key:"_onSourceSet",value:function(){this._isAdaptive()&&this._onAddQualityLevel({qualityLevel:{height:"auto"}})}},{key:"_onLoadedMetadata",value:function(){this._qualityLevels.length?this.enable():this.disable();var e=this._userPrefs&&this._userPrefs.get(this._getUserPrefKey()),t=this._items[e]&&e;if(!t)if(this._isAdaptive())t="auto";else{var i=this._qualityLevels,n=i[i.selectedIndex];t=n&&n.height}var r=this._items[t];r&&r.selected(!0)}},{key:"_onPlayerReset",value:function(){var e=this;this._qualities.forEach((function(t){e._removeQualityLevelMenuItem({height:t})})),this._qualities=[],this._selectedHeight=null}},{key:"_onAddQualityLevel",value:function(e){var t=e.qualityLevel,i=t.height;i&&-1===this._qualities.indexOf(i)&&(this._qualities.push(i),this._qualities.sort((function(e,t){return e-t})),this._addQualityLevelMenuItem(t))}},{key:"_onRemoveQualityLevel",value:function(e){var t=e.qualityLevel,i=t.height,n=i?this._qualities.indexOf(i):null;i&&n>-1&&(this._qualities.splice(n,1),this._removeQualityLevelMenuItem(t))}},{key:"_addQualityLevelMenuItem",value:function(e){var t=this,i=e.height,n=new Hf(this.player_,{icon:!0,label:zf(i),selected:!1});this.on(n,"select",(function(){t.trigger("change",e),t._onSelectQuality(e)})),this.on(n,"clicked",(function(){t._userPrefs&&t._selectedHeight&&t._userPrefs.set(t._getUserPrefKey(),t._selectedHeight)})),n.addClass("vjs-quality-setting-level"),n.addClass("vjs-menu-item-checkable"),this._items[i]=n;var r=this._qualities.indexOf(i);this._menu.addItem(n,{index:r>-1?r+1:void 0})}},{key:"_removeQualityLevelMenuItem",value:function(e){var t=e.height,i=this._items[t];this._menu.removeChild(i),i.dispose(),delete this._items[t]}},{key:"_onSelectQuality",value:function(e){var t=e.height;if(this._selectedHeight!==t){var i=this._qualityLevels,n=this._items[this._selectedHeight];if(n&&n.selected(!1),this._isAdaptive())for(var r=0;r1&&void 0!==arguments[1]?arguments[1]:{},a=r.id,s=r.hideOnInactivity,u=void 0===s||s,l=r.hideBeforeStart,c=void 0===l||l;return o(this,i),(n=t.apply(this,arguments)).addClass("vjs-player-banner"),u&&n.addClass("vjs-hide-on-inactivity"),c&&n.addClass("vjs-hide-before-start"),a&&n.contentEl().setAttribute("id",a),n}return l(i,[{key:"fillWith",value:function(e){Qf.insertContent(this.contentEl(),e)}}]),i}(Yf);wl.registerComponent("PlayerBanner",$f);var Jf=wl.getComponent("Component"),Zf=wl.dom,em=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,[{key:"createEl",value:function(){return this._display=Zf.createEl("div",void 0,{class:"media-player-audio-animated-background"}),this._animationSandbox=Zf.createEl("iframe",{sandbox:"allow-same-origin"},{class:"media-player-animation-container"}),this._display.appendChild(this._animationSandbox),this._display}},{key:"setAnimation",value:function(e){if(e){this._animationSvg=e;var t=this._animationSandbox.contentWindow.document.body;t.style.margin=0,t.appendChild(this._animationSvg)}}},{key:"pauseAnimation",value:function(){var e;null===(e=this._animationSvg)||void 0===e||e.pauseAnimations()}},{key:"unpauseAnimation",value:function(){var e;null===(e=this._animationSvg)||void 0===e||e.unpauseAnimations()}}]),i}(Jf);function tm(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];e&&"function"===typeof e[t]&&e[t].apply(e,b(i))}function im(e,t){Hh("throttle requires a wait time",t&&!Number.isNaN(t));var i=window.performance.now();return function(){var n=window.performance.now();n-i>=t&&(e.apply(void 0,arguments),i=n)}}wl.registerComponent("AudioAnimatedBackground",em);var nm="MediaInitializationStartEvent",rm="MediaInitializationEndEvent",am="MediaBufferingStartEvent",sm="MediaBufferingEndEvent",om="MediaPlaybackErrorV2Event",um="MediaBitrateChangedEvent",lm="MediaRenderedEvent",cm="CAPTION",dm="CUSTOM",hm="ABORTED",pm="NETWORK",fm="DECODING",mm="SOURCE_FILE",gm="ENCRYPTION",vm="INIT",ym="SEEK",_m={EDGECAST:"ecst",AKAMAI:"akam"},bm="STREAMING",Tm="PROGRESSIVE",km="HLS",Sm="VIDEO",Em="HTML5",Cm={FREE:"FREE",PAID:"PAID",ENTERPRISE:"ENTERPRISE",GUEST:"GUEST"},wm=Object.keys(_m).map((function(e){return _m[e]})),Im=["ads","assessments","career_video","learning","linkedin","live_video","messaging","slideshare","stories","ugc.aws","ugc.inhouse","ugc"],Pm={IS_LIVE:"IS_LIVE",WAS_LIVE:"WAS_LIVE",PRE_RECORDED:"PRE_RECORDED"},xm=Object.assign||function(e,t){return Object.keys(t).forEach((function(i){e[i]=t[i]})),e};function Am(){return window.performance&&window.performance.timing&&"function"===typeof window.performance.now?Math.round(window.performance.now())+(window.performance.timing.navigationStart||1):(new Date).getTime()}function Om(e,t){return fetch(t,{method:"HEAD"}).then((function(t){var i=t.headers;e.cdnProvider=i.get("x-cdn")}))}function Lm(e){var t,n=e.staticMediaHeader,r=e.player,a=e.primaryMediaTrackingId,s=r.tech({IWillNotUseThisInPlugins:!0}).vhs;return i(i({},n),{},{primaryMediaTrackingId:a,userBandwidth:navigator.connection&&1e3*navigator.connection.downlink*1e3,playerEstimatedBandwidth:null===s||void 0===s||null===(t=s.stats)||void 0===t?void 0:t.bandwidth})}function Dm(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.cdnProvider,n=t.accountAccessType,r=t.mediaSource,a=t.contextTrackingId,s=t.fetchCDN,o=void 0!==s&&s;i&&Hh("media-player: rum: cdnProvider must be a valid param",wm.includes(i)),n&&Hh("media-player: rum: accountAccessType must be a valid param",Cm[n]),r&&qh("media-player: rum: mediaSource must be a valid param",Im.includes(r));var u=!!e.tech({IWillNotUseThisInPlugins:!0}).vhs,l={deliveryMode:u?bm:Tm,playerType:Em,mediaType:Sm,cdnProvider:i};return o&&Om(l,e.currentSource().src),n&&(l.accountAccessType=n),r&&(l.mediaSource=r),a&&(l.contextTrackingId=a),u&&(l.streamProtocol=km),l}function Rm(e,t){return"live_video"!==e?Pm.PRE_RECORDED:t.duration()===1/0?Pm.IS_LIVE:Pm.WAS_LIVE}var Mm=function(){function e(t){o(this,e),this._bufferingRanges={},this.staticMediaHeader={},this.mediaLiveState=null,this.mediaTrackingObject={objectUrn:""},this.player=t}return l(e,[{key:"setPrimaryMediaTrackingId",value:function(e){this._primaryMediaTrackingId=e}},{key:"_getMediaHeader",value:function(){return Lm({staticMediaHeader:this.staticMediaHeader,player:this.player,primaryMediaTrackingId:this._primaryMediaTrackingId})}},{key:"_buildInitializationBeacon",value:function(e){var t={mobileHeader:null,mediaHeader:this._getMediaHeader(),mediaTrackingObject:this.mediaTrackingObject,initializationStartTime:this._initializationStartTs};return e||(t.duration=this._initializationEndTs-this._initializationStartTs,t.mediaLiveState=this.mediaLiveState),{eventName:e?nm:rm,eventBody:t}}},{key:"_buildBufferingEventBeacon",value:function(e,t){var i=this._bufferingRanges[e],n={mobileHeader:null,mediaHeader:this._getMediaHeader(),mediaTrackingObject:this.mediaTrackingObject,mediaLiveState:this.mediaLiveState,bufferingType:i.type,initializationStartTime:this._initializationStartTs,bufferingStartTime:i.start};return t||(n.duration=i.end-i.start,delete this._bufferingRanges[e]),{eventName:t?am:sm,eventBody:n}}},{key:"_buildMediaPlaybackErrorEventBeacon",value:function(e,t,i){var n={mobileHeader:null,mediaHeader:this._getMediaHeader(),mediaTrackingObject:this.mediaTrackingObject,mediaLiveState:this.mediaLiveState,errorType:e};return"string"===typeof t&&(n.errorMessage=t),"string"===typeof i&&""!==i&&(n.url=i),{eventName:om,eventBody:n}}},{key:"_buildMediaBitrateChangedEventBeacon",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{eventName:um,eventBody:xm({mobileHeader:null,mediaHeader:this._getMediaHeader(),mediaTrackingObject:this.mediaTrackingObject,mediaLiveState:this.mediaLiveState},e)}}},{key:"_buildMediaRenderedEvent",value:function(e){return this._ensureInitCalled(),{eventName:lm,eventBody:{mobileHeader:null,mediaHeader:this._getMediaHeader(),mediaLiveState:this.mediaLiveState,mediaTrackingObject:this.mediaTrackingObject,perceivedTimeToFirstFrameDuration:e}}}},{key:"_ensureInitCalled",value:function(){if("number"!==typeof this._initializationStartTs)throw new Error("initializationStart not called")}},{key:"_throwErrorIfBufferingEventInvalid",value:function(e,t){if(this._ensureInitCalled(),"number"!==typeof e)throw new TypeError("bufferingId not a number");if(t){if("object"===r(this._bufferingRanges[e]))throw new Error("duplicate bufferingId")}else if("object"!==r(this._bufferingRanges[e])||"undefined"!==typeof this._bufferingRanges[e].end)throw new Error("incorrect bufferingId or wrong buffering type")}},{key:"setTrackingId",value:function(e){this.mediaTrackingObject.trackingId=e}},{key:"setObjectUrn",value:function(e){this.mediaTrackingObject.objectUrn=e}},{key:"setStaticMediaHeader",value:function(e){this.staticMediaHeader=e}},{key:"setMediaLiveState",value:function(e){Hh("rum-video-tracking: Must provide a valid mediaLiveState",Pm[e]),this.mediaLiveState=e}},{key:"initializationStart",value:function(){return this._initializationStartTs=Am(),this._buildInitializationBeacon(!0)}},{key:"initializationEnd",value:function(){return this._ensureInitCalled(),this._initializationEndTs=Am(),this._buildInitializationBeacon(!1)}},{key:"mediaRenderStart",value:function(){this._renderStart=Am()}},{key:"mediaRenderEnd",value:function(){if(!this._renderStart)throw new Error("mediaRenderStart not called before mediaRenderEnd");return this._buildMediaRenderedEvent(Am()-this._renderStart)}},{key:"bufferingStart",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.type,n=void 0===i?null:i,r=!0;return this._throwErrorIfBufferingEventInvalid(e,r),this._bufferingRanges[e]={start:Am(),type:n},this._buildBufferingEventBeacon(e,r)}},{key:"bufferingEnd",value:function(e){return this._throwErrorIfBufferingEventInvalid(e,!1),this._bufferingRanges[e].end=Am(),this._buildBufferingEventBeacon(e,!1)}},{key:"mediaPlaybackError",value:function(e,t,i){var n=i;if("string"===typeof n&&""!==n){var r=n.match("^[^?]+");n=_(r,1)[0]}return this._buildMediaPlaybackErrorEventBeacon(e,t,n)}},{key:"bitrateChangedEvent",value:function(e){return this._buildMediaBitrateChangedEventBeacon(e)}}]),e}(),Nm={0:dm,1:hm,2:pm,3:fm,4:mm,5:gm},Um=function(e){d(i,e);var t=g(i);function i(e,n){var r,a=n.mediaUrn,s=n.trackingId,u=n.mediaHeader,l=n.onTrack,c=n.resetMediaRenderStartOnPause,d=void 0!==c&&c,h=n.primaryMediaTrackingId;o(this,i),(r=t.apply(this,arguments))._bufferId=0,r._resetMediaRenderStartOnPause=d,r.setState({mediaUrn:a,trackingId:s,mediaHeader:u,onTrack:l,primaryMediaTrackingId:h}),r.on(e,"sourceset",r._onSourceset),r.on(e,"loadstart",r._onLoadStart),r.on(e,"loadedmetadata",r._onLoadedMetadata),r.on(e,"loadeddata",r._onLoadedData),r.on(e,"play",r._onPlay),r.on(e,"playing",r._onPlaying),r.on(e,"pause",r._onPause),r.on(e,"waiting",r._onWaiting),r.on(e,"error",r._onError),r.on(e,"dispose",r._onDispose),r.on(e,"playerreset",r._onPlayerReset),r.on(e,"autoplay-failure",r._onAutoplayFailure);var p=r.player.textTracks();return p&&r.on(p,"addtrack",r._onAddTrack),e.ready((function(){r.player.usingPlugin("playlist")&&r.on(e.playlist(),"itemchange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.plugins,n=void 0===i?{}:i;Hh("rum must be updated on playlist item change",n.rum)}))})),r}return l(i,[{key:"createNewSession",value:function(e){var t=e.mediaUrn,i=e.trackingId,n=e.primaryMediaTrackingId;this.setState({mediaUrn:t,trackingId:i,primaryMediaTrackingId:n}),this.tracker.setPrimaryMediaTrackingId(n)}},{key:"handleStateChanged",value:function(e){var t=e.changes;if(t.mediaUrn||t.trackingId){var i=this.state.mediaUrn,n=t.trackingId;Hh("rum: mediaUrn is required when updating trackingId",i),n&&n.from!==n.to&&this.player.generateTrackingId().setTrackingId(n.to),this.tracker=new Mm(this.player),this.tracker.setObjectUrn(i),this.tracker.setTrackingId(this.player.generateTrackingId().getTrackingId())}t.primaryMediaTrackingId&&this.tracker.setPrimaryMediaTrackingId(t.primaryMediaTrackingId.to)}},{key:"getEventHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e}},{key:"_setInitializationStart",value:function(){this._isInitializationStarted||(this.tracker.setStaticMediaHeader(Dm(this.player,this.state.mediaHeader)),this._trigger(this.tracker.initializationStart()),this._isInitializationStarted=!0)}},{key:"_setInitializationEnd",value:function(){this._isInitializationEnded||(this._trigger(this.tracker.initializationEnd()),this._isInitializationEnded=!0)}},{key:"_setMediaRenderStart",value:function(){this._isMediaRenderStarted||(this.tracker.mediaRenderStart(),this._isMediaRenderStarted=!0)}},{key:"_setMediaRenderEnd",value:function(){this._isMediaRenderEnded||(this._trigger(this.tracker.mediaRenderEnd()),this._isMediaRenderEnded=!0)}},{key:"_setBufferingStart",value:function(){if(!this._isBuffering){this._isBuffering=!0,this._bufferId++;var e=null;this.player.seeking()?e=ym:this._hasPlayed||(e=vm),this._trigger(this.tracker.bufferingStart(this._bufferId,{type:e}))}}},{key:"_setBufferingEnd",value:function(){this._isBuffering&&(this._trigger(this.tracker.bufferingEnd(this._bufferId)),this._isBuffering=!1)}},{key:"_onSourceset",value:function(){this._reset()}},{key:"_onLoadStart",value:function(){"none"!==this.player.preload()&&this._setInitializationStart()}},{key:"_onLoadedMetadata",value:function(){var e=this.state.mediaHeader,t=(e=void 0===e?{}:e).mediaSource;this.tracker.setMediaLiveState(Rm(t,this.player)),this._metadataTrack=this.player.textTracks().tracks_.find((function(e){return"segment-metadata"===e.label})),this._metadataTrack&&this.on(this._metadataTrack,"cuechange",this._onBitrateChange)}},{key:"_onLoadedData",value:function(){this._setInitializationStart(),this._setInitializationEnd()}},{key:"_onPlay",value:function(){this._setInitializationStart(),this._setMediaRenderStart()}},{key:"_onPause",value:function(){this._setBufferingEnd(),this._resetMediaRenderStartOnPause&&this._isMediaRenderStarted&&!this._isMediaRenderEnded&&(this._isMediaRenderStarted=!1)}},{key:"_onAutoplayFailure",value:function(){this._setBufferingEnd()}},{key:"_onPlaying",value:function(){this._hasPlayed=!0,this._setBufferingEnd(),this._setMediaRenderEnd()}},{key:"_onWaiting",value:function(){this._setBufferingStart()}},{key:"_onBitrateChange",value:function(){var e=this._metadataTrack.activeCues[0],t=e&&e.value;if(t&&t.playlist!==this._lastCuePlaylist){var i=Math.floor(1e3*(t.end-t.start)),n=_(t.codecs?t.codecs.split(",").map((function(e){return e.trim()})):[],2),r=n[0],a=n[1];this._trigger(this.tracker.bitrateChangedEvent({newBitrate:t.bandwidth,viewingDisplaySize:{width:this.player.currentWidth(),height:this.player.currentHeight()},encodedDisplaySize:t.resolution,audioCodec:a,videoCodec:r,newSegmentDuration:i,targetSegmentDuration:6e3,frameRate:60})),this._lastCuePlaylist=t.playlist}}},{key:"_onError",value:function(){this._setBufferingEnd();var e=this.player.error(),t=this.player.currentSrc(),i=this.tracker.mediaPlaybackError(Nm[e.code],e.message,t);this._trigger(i)}},{key:"_onAddTrack",value:function(e){var t=e.track;t&&"captions"===t.kind&&!this.player.options().html5.nativeTextTracks&&this.one(t,"loadeddata",this._onCaptionsLoad)}},{key:"_onCaptionsLoad",value:function(){var e=this.player.log.history().find((function(e){var t=_(e,3)[2];return t&&"ParsingError"===t.name}));if(e){var t=[].find.call(this.player.textTracks(),(function(e){return"captions"===e.kind})),i=this.tracker.mediaPlaybackError(cm,e[2].message,t.src);this._trigger(i)}}},{key:"_onPlayerReset",value:function(){this._reset()}},{key:"_onDispose",value:function(){this._reset()}},{key:"_trigger",value:function(e){var t=e.eventBody,i=e.eventName;this.trigger(i,t),this.trigger("track",{eventName:i,eventData:t}),tm(this.state,"onTrack",[i,t])}},{key:"_reset",value:function(){this._setBufferingEnd(),this._isInitializationStarted=!1,this._isInitializationEnded=!1,this._isBuffering=!1,this._isMediaRenderStarted=!1,this._isMediaRenderEnded=!1,this._hasPlayed=!1,this._metadataTrack&&(this.off(this._metadataTrack,"cuechange",this._onBitrateChange),this._metadataTrack=null)}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("rum",Um);var Bm=wl.getPlugin("plugin"),Fm={viewQuartile:.25,viewMidpoint:.5,viewThirdQuartile:.75,viewCompletion:.97},jm=Object.keys(Fm),Vm=function(e){d(i,e);var t=g(i);function i(e,n){var r,a=n.pageContext,s=n.onTrack;return o(this,i),r=t.apply(this,arguments),Hh("moat: pageContext is required field which must be a value referring to SponsoredVideoViewEvent.pageContext",a),r.setState({pageContext:a,onTrack:s}),r._setInitialState(),r.on(e,"ended",r._onEnded),r.on(e,"playing",r._onPlaying),r.on(e,"pause",r._onPause),r.on(e,"loadedmetadata",r._onLoadedMetadata),r.on(e,"timeupdate",r._onTimeUpdate),r.on(e,"playerreset",r._onPlayerreset),r.on(e.playerInteraction(),"interact",r._onInteract),r}return l(i,[{key:"getEventHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e}},{key:"_setInitialState",value:function(){xm(this,{_elapsedPlaybackTime:0,_currentTime:0,_previousTime:0,_hasFiredViewVideo:!1,_hasFiredViewPlayStart:!1})}},{key:"_onInteract",value:function(e,t){var i,n,r=t.controlId,a=t.meta;switch(r){case Mp:i=this.player.paused()?"pauseVideo":"playVideo",n="video_play_pause";break;case Rp:case Gp:i="playVideo",n="video_thumbnail_play";break;case xp:i="playVideo",n="video_toolbar_play_pause";break;case Ap:i="pauseVideo",n="video_toolbar_play_pause";break;case Np:i="fullscreenVideo",n="video_toolbar_fullscreen_toggle";break;case Up:i="unfullscreenVideo",n="video_toolbar_fullscreen_toggle";break;case Hp:i="seekVideo",n="video_toolbar_scrubber";break;case Op:i="replayVideo",n="video_toolbar_replay"}i&&n&&this.fireVideoActionEvent(i,n,a)}},{key:"_didSeekOccur",value:function(){return Math.abs(this._currentTime-this._previousTime)>2}},{key:"_maybeFireViewVideoEvent",value:function(){var e=this;this._hasFiredViewVideo||this._elapsedPlaybackTime>2&&this.fireVideoViewEvent("viewVideo",(function(){e._hasFiredViewVideo=!0,e._elapsedPlaybackTime=0}))}},{key:"_trigger",value:function(e,t,i){this.trigger(e,xm(t,i)),this.trigger("track",{eventName:e,eventData:t,meta:i}),tm(this.state,"onTrack",[e,t,i])}},{key:"_onEnded",value:function(){this.fireVideoViewEvent("viewFullCompletion")}},{key:"_onPause",value:function(){this.resetElapsedPlaybackTime()}},{key:"_onPlaying",value:function(){var e=this;this._hasFiredViewPlayStart||this.fireVideoViewEvent("viewPlayStart",(function(){e._hasFiredViewPlayStart=!0}))}},{key:"_onLoadedMetadata",value:function(){this.computeThresholds()}},{key:"_onTimeUpdate",value:function(){this.updateCurrentPlayerPosition()}},{key:"_onPlayerreset",value:function(){this._setInitialState()}},{key:"computeThresholds",value:function(){var e=1e3*this.player.duration();this._thresholds=jm.reduce((function(t,i){var n=Fm[i];return t[i]=Math.floor(n*e),t}),{})}},{key:"fireElapsedThresholdEvents",value:function(){var e=this;if(this._thresholds){var t=Math.floor(1e3*this._previousTime),i=Math.floor(1e3*this._currentTime);jm.forEach((function(n){var r=e._thresholds[n];t=r&&e.fireVideoViewEvent(n)}))}}},{key:"fireVideoViewEvent",value:function(e,t){var i=!this.player.muted()&&this.player.volume()>0,n=this.player.duration();if(n){var r={videoDuration:1e3*n,isVideoAudible:i,videoUIContext:this.state.pageContext,timestamp:Date.now()};this._trigger("viewEvent",{eventName:e,trackingParams:r}),"function"===typeof t&&t()}}},{key:"fireVideoActionEvent",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this._trigger("actionEvent",{actionName:e,controlName:t,timestamp:Date.now()},i)}},{key:"updateCurrentPlayerPosition",value:function(){this._previousTime=this._currentTime||0,this._currentTime=this.player.currentTime()||0,this._didSeekOccur()?this.resetElapsedPlaybackTime():(this._elapsedPlaybackTime+=this._currentTime-this._previousTime,this._maybeFireViewVideoEvent(),this.fireElapsedThresholdEvents())}},{key:"resetElapsedPlaybackTime",value:function(){this._elapsedPlaybackTime=0}}]),i}(Bm);wl.registerPlugin("moat",Vm);var Hm={PLAYER_ASK_TO_PLAY_EVENT:"PlayerAskToPlayEvent",PLAYER_BEACON_EVENT:"PlayerBeaconEvent",PLAYER_PLAY_PAUSE_EVENT:"PlayerPlayPauseEvent",PLAYER_PLAYBACK_EXIT_EVENT:"PlayerPlaybackExitEvent",PLAYER_PLAYBACK_STALL_EVENT:"PlayerPlaybackStallEvent",PLAYER_SEEK_EVENT:"PlayerSeekEvent",PLAYER_VOLUME_CHANGED_EVENT:"PlayerVolumeChangedEvent",MULTIVARIANT_PLAYLIST_FETCHED_EVENT:"MultivariantPlaylistFetchedEvent",MEDIA_PLAYLIST_FETCHED_EVENT:"MediaPlaylistFetchedEvent",SEGMENT_FETCHED_EVENT:"SegmentFetchedEvent"},qm={AUTOPLAY_ON_LOAD:"AUTOPLAY_ON_LOAD",DISALLOW_BACKGROUND_PLAYBACK:"DISALLOW_BACKGROUND_PLAYBACK",ENTERED_VIEWPORT:"ENTERED_VIEWPORT",EXITED_VIEWPORT:"EXITED_VIEWPORT",USER_TRIGGERED:"USER_TRIGGERED",VIDEO_PRIORITY_CHANGED:"VIDEO_PRIORITY_CHANGED",VIDEO_AUTOLOOPED:"VIDEO_AUTOLOOPED"},Wm={ENTERED_VIEWPORT:"ENTERED_VIEWPORT",USER_TRIGGERED:"USER_TRIGGERED",AUTO_TRIGGERED:"AUTO_TRIGGERED",UNKNOWN:"UNKNOWN"},Gm="ERROR",zm="END",Xm="PLAYING",Km="STALLING",Ym="UNKNOWN",Qm="ENDED",$m="STARTED",Jm="ON",Zm="OFF",eg="NOT_MEASURED",tg={CAPTIONS_ON_CONTROL:!0,CAPTIONS_OFF_CONTROL:!0,MENU_CAPTIONS_ON_CONTROL:!0,MENU_CAPTIONS_OFF_CONTROL:!0},ig="BROWSER_CACHE",ng="CDN_CACHE_HIT",rg="CDN_CACHE_MISS",ag="UNKNOWN",sg="timing-allow-origin",og="x-cache",ug="x-cdn",lg=wl.getPlugin("plugin"),cg=[3e3,7e3,2e4,3e4],dg=function(e){d(n,e);var t=g(n);function n(e,i){var r,a=i.mediaUrn,s=i.trackingId,u=i.mediaHeader,l=i.onTrack,c=i.primaryMediaTrackingId;o(this,n),r=t.apply(this,arguments),Hh("tracking: playerInteraction plugin is required",e.hasPlugin("playerInteraction")),r._qualityLevels=e.qualityLevels(),r._hasRenderedFirstFrame=!1,r._isPlaying=!1,r._isStalled=!1,r._isCcVisible=Zm,r._volume=r._getVolume(),r._fullscreenState=r._getFullScreenState(),r._isVisible=null,r._pauseReason=null,r._playReason=null,r._staticMediaHeader=null,r._currentPlaylist=null,r._currentTime=0,r._currentBeaconInterval=null,r._multivariantPlaylistDetails={},r._mediaPlaylistDetails={},r._firstSegmentDetails={},r.setState({mediaUrn:a,trackingId:s,mediaHeader:u,onTrack:l,primaryMediaTrackingId:c});var d=r._onUnload.bind(f(r)),h=np(r._onSeeked,300),p=np(r._onVolumeChange,300);r.on(e.playerInteraction(),"interact",r._onPlayerInteraction),r.on(e,"fullscreenchange",r._onFullscreenChange),r.on(e,"pause",r._onPause),r.on(e,"play",r._onPlay),r.on(e,"error",r._onError),r.on(e,"playing",r._onPlaying),r.on(e,"timeupdate",r._onTimeupdate),r.on(e,"ratechange",r._onRateChange),r.on(e,"seeked",h),r.on(e,"seeking",r._onSeeking),r.on(e,"volumechange",p),r.on(e,"waiting",r._onWaiting),r.on(e,"sourceset",r._onSourceSet),r.on(e,"playerreset",r._onPlayerReset),r.on(e,"loadstart",r._onLoadStart),r.one(e,"loadedmetadata",r._onLoadedMetadata),r.one(e,"play",r._onFirstPlayOfSource),r._isFetchRequestFiringEnabled=e.xhrHooks().enabled,r._isFetchRequestFiringEnabled&&r.on(e.xhrHooks(),"response",r._onXhrResponse);var m="onpagehide"in window?"pagehide":"beforeunload";return window.addEventListener(m,d),r.on("dispose",(function(){window.removeEventListener(m,d),h.clear(),p.clear()})),e.ready((function(){var t=e.playerVisibility();t.ready((function(){r._isVisible=t.isVisible(),r.on(t,"visibilityChange",r._onVisibilityChange)})),e.usingPlugin("playlist")&&r.on(e.playlist(),"itemchange",(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.plugins,n=void 0===i?{}:i;Hh("tracking must be updated on playlist item change",n.tracking)}))})),r}return l(n,[{key:"getEventHash",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e}},{key:"_getPlaybackExitState",value:function(){if(this.player.ended())return zm;if(this._isStalled)return Km;var e=this._pauseReason;return e?[qm.DISALLOW_BACKGROUND_PLAYBACK,qm.USER_TRIGGERED,qm.EXITED_VIEWPORT,qm.VIDEO_PRIORITY_CHANGED].includes(e)?Xm:Ym:Xm}},{key:"setPauseReason",value:function(e){Hh("tracking: A valid reason must be supplied to setPauseReason",qm[e]),this._pauseReason=e}},{key:"setPlayReason",value:function(e){Hh("tracking: A valid reason must be supplied to setPlayReason",qm[e]),this._playReason=e}},{key:"createNewSession",value:function(e){var t=e.mediaUrn,i=e.trackingId,n=e.primaryMediaTrackingId;this.setState({mediaUrn:t,trackingId:i,primaryMediaTrackingId:n})}},{key:"handleStateChanged",value:function(e){var t=e.changes;if(t.mediaUrn||t.trackingId){var i=this.state.mediaUrn,n=t.trackingId;Hh("tracking: mediaUrn is required when updating trackingId",i),this.stopBeaconPolling(),n&&n.from!==n.to&&this.player.generateTrackingId().setTrackingId(n.to),this._mediaTrackingObject={objectUrn:i,trackingId:this.player.generateTrackingId().getTrackingId()},this._userInteracted=!1,this._previousTimeElapsed=0,this._playbackRate=null}t.primaryMediaTrackingId&&(this._primaryMediaTrackingId=t.primaryMediaTrackingId.to)}},{key:"getPlayerState",value:function(){var e=this._qualityLevels[this._qualityLevels.selectedIndex],t=e?e.bitrate:this.player.currentSource().bitRate;this._playbackRate||(this._playbackRate=this.player.playbackRate());var i={bitrate:t||null,casting:eg,ccVisible:this._isCcVisible,downloaded:eg,fullScreen:this._fullscreenState,isAudioOnly:!1,isPlaying:this._isPlaying,isVisible:this._isVisible,length:this._getDuration(),speed:this._playbackRate,timeElapsed:this._currentTime,volume:this._volume,mediaUrl:this._currentPlaylist||this.player.currentSrc()},n=this.state.mediaHeader,r=(n=void 0===n?{}:n).mediaSource;return i.mediaLiveState=Rm(r,this.player),i}},{key:"startBeaconPolling",value:function(){this._isPolling=!0,this._currentTime=this.player.currentTime(),this._currentBeaconInterval=cg[0],this._fireBeaconEvent()}},{key:"restartBeaconPolling",value:function(){this._isPolling&&this.startBeaconPolling()}},{key:"stopBeaconPolling",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];this._isPolling&&(this._isPolling=!1,this._currentBeaconInterval=null,e&&this._fireBeaconEvent(),this._lastBeaconTime=null)}},{key:"checkBeaconProgress",value:function(){this._currentTime=this.player.currentTime(),(this._currentTime-(this._lastBeaconTime||0))/this._playbackRate*1e3>=this._currentBeaconInterval&&(this._fireBeaconEvent(),this._currentBeaconInterval=cg[cg.indexOf(this._currentBeaconInterval)+1]||cg[cg.length-1])}},{key:"dispose",value:function(){this.stopBeaconPolling(),this._isStalled&&this._endStall(),y(h(n.prototype),"dispose",this).call(this)}},{key:"setIsCcVisible",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._isCcVisible=e?Jm:Zm}},{key:"_resetFirstAskToPlay",value:function(){this._firstAskToPlayTime=null,this.off(this.player,"play",this._onFirstPlayOfSource),this.one(this.player,"play",this._onFirstPlayOfSource)}},{key:"_resetHlsStateProperties",value:function(){this._multivariantPlaylistDetails={},this._mediaPlaylistDetails={},this._firstSegmentDetails={}}},{key:"_onPlayerReset",value:function(){this._playReason=null,this._pauseReason=null,this._staticMediaHeader=null,this._currentTime=0,this._isStalled&&this._endStall(),this._hasRenderedFirstFrame=!1,this._resetFirstAskToPlay(),this._resetHlsStateProperties()}},{key:"_onSegmentMetadataChange",value:function(){this._setSegmentMetadata()}},{key:"_setSegmentMetadata",value:function(){var e=this._metadataTrack&&this._metadataTrack.activeCues[0];if(e&&e.value){var t=this.player.tech().vhs.representations().find((function(t){return t.id===e.value.playlist}));this._currentPlaylist=t&&t.playlist&&t.playlist.resolvedUri}}},{key:"_onLoadedMetadata",value:function(){this._metadataTrack=this.player.textTracks().tracks_.find((function(e){return"segment-metadata"===e.label})),this._metadataTrack&&(this._setSegmentMetadata(),this.on(this._metadataTrack,"cuechange",this._onSegmentMetadataChange))}},{key:"_onLoadStart",value:function(){this._getMediaHeader()}},{key:"_onFirstPlayOfSource",value:function(){this._firstAskToPlayTime=Am(),this._triggerFetchedEventsIfNecessary()}},{key:"_onPlay",value:function(){var e;this._isPlaying=!0,this._volume=this._getVolume(),this._trigger(Hm.PLAYER_PLAY_PAUSE_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),reason:this._playReason||qm.USER_TRIGGERED,state:this.getPlayerState(),createdTime:Date.now()}),this._trigger(Hm.PLAYER_ASK_TO_PLAY_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),reason:(e=this._playReason,Wm[e]||Wm.AUTO_TRIGGERED),createdTime:Date.now()}),this._playReason=null}},{key:"_onPlaying",value:function(){this._isPlaying=!0,this._playbackRate=this.player.playbackRate(),this._hasRenderedFirstFrame=!0,this._isStalled&&this._endStall(),this._isPolling||this.startBeaconPolling()}},{key:"_onError",value:function(){this._firePlaybackExitEvent(Gm),this._isStalled&&this._endStall()}},{key:"_onPause",value:function(){this._isPlaying=!1,this._trigger(Hm.PLAYER_PLAY_PAUSE_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),reason:this._pauseReason||qm.USER_TRIGGERED,state:this.getPlayerState(),createdTime:Date.now()}),this._firePlaybackExitEvent(this._getPlaybackExitState()),this._isStalled&&this._endStall(),this._pauseReason=null,this.stopBeaconPolling()}},{key:"_endStall",value:function(){this._isStalled=!1,this._firePlaybackStallEvent(Qm)}},{key:"_firePlaybackExitEvent",value:function(e){this._trigger(Hm.PLAYER_PLAYBACK_EXIT_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),state:e||Ym,createdTime:Date.now()})}},{key:"_firePlaybackStallEvent",value:function(e){this._trigger(Hm.PLAYER_PLAYBACK_STALL_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),playerState:this.getPlayerState(),stallState:e,createdTime:Date.now()})}},{key:"_onWaiting",value:function(){this._isPlaying=!1,this._isStalled||!this._hasRenderedFirstFrame||this._isSeeking||(this._isStalled=!0,this._firePlaybackStallEvent($m)),this.stopBeaconPolling()}},{key:"_onSourceSet",value:function(){this._isPlaying=!1,this.stopBeaconPolling(),this._hasRenderedFirstFrame=!1,this._resetFirstAskToPlay(),this._resetHlsStateProperties(),this._isStalled&&this._endStall()}},{key:"_onVolumeChange",value:function(){var e=this._volume;this.restartBeaconPolling(),this._volume=this._getVolume(),this._trigger(Hm.PLAYER_VOLUME_CHANGED_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),state:this.getPlayerState(),createdTime:Date.now(),previousVolume:e})}},{key:"_onFullscreenChange",value:function(){this.restartBeaconPolling(),this._fullscreenState=this._getFullScreenState()}},{key:"_onRateChange",value:function(){this.restartBeaconPolling(),this._playbackRate=this.player.playbackRate()}},{key:"_onSeeking",value:function(){this._isSeeking=!0,this._isStalled&&this._endStall()}},{key:"_onTimeupdate",value:function(){this._isSeeking||this.player.seeking()||(this._previousTimeElapsed=this.player.currentTime()),this.player.seeking()||this.player.paused()||!this._isPolling||this.checkBeaconProgress()}},{key:"_onSeeked",value:function(){this._trigger(Hm.PLAYER_SEEK_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),previousTimeElapsed:this._previousTimeElapsed,state:this.getPlayerState(),createdTime:Date.now()}),this._isSeeking=!1}},{key:"_onPlayerInteraction",value:function(e,t){var i=t.controlId;this._userInteracted=!0,tg[i]&&this.restartBeaconPolling()}},{key:"_onUnload",value:function(){this.stopBeaconPolling()}},{key:"_onVisibilityChange",value:function(e,t){var i=t.isVisible;this.restartBeaconPolling(),this._isVisible=i}},{key:"_persistXhrResponseDetails",value:function(e){var t=e.vhsPlaylistLoader,n=e.xhr,r=e.performanceStartTime,a=e.performanceEndTime,s=e.responseSource,o=new URL(n.uri,window.location).href,u={fileSize:n.bytesReceived,performanceStartTime:r,performanceEndTime:a,responseSource:s},l=t.master;l&&[{details:this._multivariantPlaylistDetails,doesXhrMatch:function(){return l.uri===o}},{details:this._mediaPlaylistDetails,doesXhrMatch:function(){var e;return(null===(e=t.media())||void 0===e?void 0:e.resolvedUri)===o}},{details:this._firstSegmentDetails,doesXhrMatch:function(){var e;return null===(e=t.media())||void 0===e?void 0:e.segments.find((function(e){return e.resolvedUri===o}))}}].forEach((function(e){var t=e.details,a=e.doesXhrMatch;!t.performanceEndTime&&a()&&(n.aborted||n.status<200||n.status>299?t.performanceStartTime=t.performanceStartTime||r:Object.assign(t,i(i({},u),{},{performanceStartTime:t.performanceStartTime||r})))}))}},{key:"_triggerFetchedEventsIfNecessary",value:function(){var e=this;this._isFetchRequestFiringEnabled&&this._firstAskToPlayTime&&[{details:this._multivariantPlaylistDetails,eventName:Hm.MULTIVARIANT_PLAYLIST_FETCHED_EVENT},{details:this._mediaPlaylistDetails,eventName:Hm.MEDIA_PLAYLIST_FETCHED_EVENT},{details:this._firstSegmentDetails,eventName:Hm.SEGMENT_FETCHED_EVENT}].forEach((function(t){var n=t.details,r=t.eventName;if(n.performanceEndTime&&!n.hasTriggeredFetchedEvent){var a,s,o,u,l,c,d,h,p=(a=i(i({},n),{},{firstAskToPlayTime:e._firstAskToPlayTime}),s=a.fileSize,o=a.performanceStartTime,u=a.performanceEndTime,l=a.responseSource,c=a.firstAskToPlayTime,h=(d=u<=c||l===ig)||l===ag?null:l===ng,{fileSize:s,fetchDuration:u-o,perceivedFetchDuration:function(e){var t,i,n,r,a=e.firstAskToPlayTime,s=e.performanceStartTime,o=e.performanceEndTime;return o<=a?0:(i=(t={time:a,startTime:s,endTime:o}).time,n=t.startTime,r=t.endTime,i&&i>n&&i0)this.stopBeaconPolling(!1);else{this._beaconTimeElapsed=i;var n=cg[cg.indexOf(e)+1]||cg[cg.length-1];this._fireBeaconEvent(),this._beaconPoll=this.player.setTimeout((function(){return t._runBeaconInterval(n)}),n)}}},{key:"_cancelBeaconInterval",value:function(){this._beaconPoll&&(this.player.clearTimeout(this._beaconPoll),this._beaconPoll=null)}},{key:"_fireBeaconEvent",value:function(){var e,t=wf(this._lastBeaconTime)?this._lastBeaconTime:this._currentTime;e=Math.round((this._currentTime-t)/this._playbackRate*1e3),this._lastBeaconTime=this._currentTime,this._trigger(Hm.PLAYER_BEACON_EVENT,{mediaTrackingObject:this._mediaTrackingObject,mediaHeader:this._getMediaHeader(),isAutoplaying:this._isAutoplaying(),timeSinceLastBeacon:e,state:this.getPlayerState(),createdTime:Date.now()})}},{key:"_isAutoplaying",value:function(){return!this._userInteracted&&!!this.player.autoplay()}},{key:"_getFullScreenState",value:function(){return this.player.isFullscreen()?Jm:Zm}},{key:"_getDuration",value:function(){var e=this.player.duration();return e&&isFinite(e)?e:0}},{key:"_getVolume",value:function(){return this.player.muted()?0:Math.round(100*this.player.volume())}},{key:"_getMediaHeader",value:function(){return this._staticMediaHeader=this._staticMediaHeader||Dm(this.player,this.state.mediaHeader),Lm({staticMediaHeader:this._staticMediaHeader,player:this.player,primaryMediaTrackingId:this._primaryMediaTrackingId})}},{key:"_trigger",value:function(e,t,i){this.trigger(e,t),this.trigger("track",{eventName:e,eventData:t,meta:i}),tm(this.state,"onTrack",[e,t,i])}}]),n}(lg);wl.registerPlugin("tracking",dg);var hg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.allowUnmutedBackgroundPlayback,s=void 0!==a&&a,u=r.visibilityChangeDelay,l=void 0===u?1e3:u;return o(this,i),n=t.apply(this,arguments),Hh("playbackAudit: tracking plugin is required",e.hasPlugin("tracking")),n._isVisible=null,n._checkVisibilityTimer=null,n._allowUnmutedBackgroundPlayback=s,n._visibilityChangeDelay=l,n.on(e,"timeupdate",n._onTimeupdate),n.on(e,"pause",n._onPause),n.on(e,"playerreset",n._onPlayerreset),e.ready((function(){var t=e.playerVisibility();t.ready((function(){n._isVisible=t.isVisible(),n.on(t,"visibilityChange",n._onVisibilityChange)}))})),n}return l(i,[{key:"_isMuted",value:function(){return this.player.muted()||0===this.player.volume()}},{key:"_shouldPause",value:function(){return!this._isVisible&&!this.player.paused()&&!this.player.isFullscreen()&&(!this._allowUnmutedBackgroundPlayback||this._isMuted())}},{key:"_clearVisibilityTimer",value:function(){this.player.clearTimeout(this._checkVisibilityTimer),this._checkVisibilityTimer=null}},{key:"_onVisibilityChange",value:function(e,t){var i=t.isVisible;this._isVisible=i,i&&this._clearVisibilityTimer()}},{key:"_onPlayerreset",value:function(){this._clearVisibilityTimer()}},{key:"_onPause",value:function(){this._clearVisibilityTimer()}},{key:"_onTimeupdate",value:function(){var e=this;!this._checkVisibilityTimer&&this._shouldPause()&&(this._checkVisibilityTimer=this.player.setTimeout((function(){e._shouldPause()&&(e.player.tracking().setPauseReason(qm.DISALLOW_BACKGROUND_PLAYBACK),e.player.pause()),e._clearVisibilityTimer()}),this._visibilityChangeDelay))}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("playbackAudit",hg);var pg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.onInteract;return o(this,i),(n=t.apply(this,arguments))._registeredControls={},n.setState({onInteract:a}),e.ready((function(){n._attachControlEventListeners()})),n}return l(i,[{key:"registerControl",value:function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Hh("playerInteraction: A valid control el must be supplied to the `registerControl` method",e),Hh("playerInteraction: A controlId must be supplied to the `registerControl` method",t),this._registeredControls[t]||(this._registeredControls[t]=xm({el:e},i))}},{key:"unregisterControl",value:function(e){delete this._registeredControls[e]}},{key:"_attachControlEventListeners",value:function(){this.on(this.player,["click"],this._onInteraction);var e=this.player.getDescendant("controlBar","volumePanel","volumeControl"),t=this.player.getDescendant("controlBar","progressControl","seekBar"),i=this.player.getDescendant("controlBar","captionsMenuToggle");e&&this.on(e,["mouseup"],this._onInteraction),t&&this.on(t,["click"],this._onInteraction),i&&this.on(i,["captionMenuItemSelected"],this._onCaptionsMenuItemSelected)}},{key:"_onCaptionsMenuItemSelected",value:function(e,t){var i,n=t.el();n.matches(kp)||n.matches(Sp)?i=jp:n.matches(Ep)&&(i=Vp),this._triggerInteract(i)}},{key:"_onInteraction",value:function(e){var t=this._getControlId(e);t&&this._triggerInteract(t,{isUserInitiated:e.isTrusted})}},{key:"_getControlId",value:function(e){var t=this,i=e.target,n=e.currentTarget;return i.matches(yp)?this.player.muted()?Lp:Dp:i.matches(_p)?this.player.isFullscreen()?Up:Np:i.matches(pp)?xp:i.matches(fp)?Ap:i.matches(mp)?Op:i.matches(bp)?Bp:i.matches(Tp)?Fp:i.matches(vp)?Rp:i.matches(gp)?Mp:i.matches(Ip)?Wp:n.matches(Cp)?Hp:n.matches(wp)?qp:i.matches(Pp)?Gp:Object.keys(this._registeredControls).find((function(e){var n=t._registeredControls[e];return i===n.el}))}},{key:"_triggerInteract",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.trigger("interact",{controlId:e,meta:t}),tm(this.state,"onInteract",[e,t])}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("playerInteraction",pg);var fg=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._background=e.addChild("PosterBackground"),n.on(e,"sourceset",n._onSourceSet),n}return l(i,[{key:"_onSourceSet",value:function(){var e=this.player.tech().el();this.player.el().insertBefore(this._background.el(),e)}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("posterBackground",fg);var mg=wl.getComponent("ModalDialog"),gg=wl.mergeOptions,vg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.id,s=r.classNames;return o(this,i),(n=t.apply(this,arguments))._player=e,n.addClass("vjs-screen"),a&&n.contentEl().setAttribute("id",a),(s||[]).forEach((function(e){n.setAttribute("class",e)})),n.fill(),n.on("modalopen",n._onOpen),n.on("modalclose",n._onClose),n}return l(i,[{key:"_onOpen",value:function(){this._player.addClass("vjs-screen-active"),this.trigger("show")}},{key:"_onClose",value:function(){this._player.removeClass("vjs-screen-active"),this.trigger("hide")}}]),i}(mg);vg.prototype.options_=gg(mg.prototype.options_,{uncloseable:!0,pauseOnOpen:!0,temporary:!1}),wl.registerComponent("Screen",vg);var yg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(n=t.apply(this,arguments))._player=e,n._options=r,n.screen=n._createScreen(),n.on(n._player,"play",n._onPlay),n.on(n._player,"sourceset",n._onSourceset),n.on("dispose",n._onDispose),n._player.ready((function(){n.screen&&n.screen.open()})),n}return l(i,[{key:"_createScreen",value:function(){var e=this,t=new vg(this._player,this._options);return t.content(),t.addClass("vjs-start-screen"),t.on(["show","hide"],(function(t){e.trigger(t.type,{screen:e.screen})})),this._player.addChild(t),t}},{key:"_onPlay",value:function(){this.screen.close()}},{key:"_onSourceset",value:function(){this.screen.open()}},{key:"_onDispose",value:function(){this._player.removeChild(this.screen),this.screen=null}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("startScreen",yg);var _g=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(n=t.apply(this,arguments))._player=e,n.screen=n._createScreen(r),n.on(n._player,"ended",n._onEnded),n.on(n._player,"play",n._onPlay),n.on(n._player,"sourceset",n._onSourceset),n.on(n._player,"playerreset",n._onPlayerreset),n.on("dispose",n._onDispose),n.enable(),n}return l(i,[{key:"enable",value:function(){this._isEnabled=!0,this._isEnded&&this.screen.open()}},{key:"disable",value:function(){this._isEnabled=!1,this._isEnded&&this.screen.close()}},{key:"enabled",value:function(){return this._isEnabled}},{key:"_createScreen",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.id,n=t.classNames,r=t.closeable,a=void 0===r||r,s=new vg(this._player,{id:i,classNames:n,uncloseable:!a});return s.addClass("vjs-end-screen"),s.on(["show","hide"],(function(t){e.trigger(t.type,{screen:e.screen})})),this._player.addChild(s),s}},{key:"_onEnded",value:function(){this._isEnded=!0,!this._player.loop()&&this.enabled()&&this.screen.open()}},{key:"_onPlay",value:function(){this._isEnded=!1,this.screen.close()}},{key:"_onSourceset",value:function(){this._isEnded=!1,this.screen.close()}},{key:"_onPlayerreset",value:function(){this._isEnded=!1,this.screen.close()}},{key:"_onDispose",value:function(){this._player.removeChild(this.screen),this.screen=null}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("endScreen",_g);var bg=function(e){d(i,e);var t=g(i);function i(e,n){var r;return o(this,i),(r=t.apply(this,arguments))._player=e,r._options=n,r.screen=r._createScreen(),r._player.ready((function(){r._disableErrorDisplay()})),r.on(r._player,"error",r._onError),r.on(r._player,"play",r._onPlay),r.on(r._player,"sourceset",r._onSourceset),r.on(r._player,"playerreset",r._onPlayerreset),r.on("dispose",r._onDispose),r}return l(i,[{key:"_createScreen",value:function(){var e=this,t=new vg(this._player,this._options);return t.addClass("vjs-error-screen"),t.on(["show","hide"],(function(t){e.trigger(t.type,{screen:e.screen,error:e._player.error()})})),this._player.addChild(t),t}},{key:"_disableErrorDisplay",value:function(){var e=this._player.getChild("errorDisplay");e&&e.dispose()}},{key:"_onError",value:function(){this.screen.open()}},{key:"_onPlay",value:function(){this.screen.close()}},{key:"_onSourceset",value:function(){this.screen.close()}},{key:"_onPlayerreset",value:function(){this.screen.close()}},{key:"_onDispose",value:function(){this._player.removeChild(this.screen),this.screen=null}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("errorScreen",bg);var Tg=wl.getComponent("Component"),kg=function(e){d(i,e);var t=g(i);function i(e,n){var r;return o(this,i),(r=t.call(this,e,n))._player=e,r}return l(i,[{key:"createControl",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=new Tg(this._player);return e.id&&t.setAttribute("id",e.id),e.className&&t.setAttribute("class",e.className),t.addClass("vjs-control"),this._player.getChild("controlBar").addChild(t,{},e.index)}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("customControl",kg);var Sg="video_toolbar_mute_unmute",Eg="video_toolbar_fullscreen_toggle",Cg="video_toolbar_closed_caption_toggle",wg={PLAY_CONTROL:"video_toolbar_play_pause",PAUSE_CONTROL:"video_toolbar_play_pause",REPLAY_CONTROL:"video_toolbar_replay",MUTE_CONTROL:Sg,UNMUTE_CONTROL:Sg,FULLSCREEN_CONTROL:Eg,UNFULLSCREEN_CONTROL:Eg,PROGRESS_SCRUBBER_CONTROL:"video_toolbar_scrubber",VOLUME_SLIDER_CONTROL:"video_toolbar_volume_slider",BACK_TO_START_CONTROL:"video_toolbar_back_to_start",THEATER_MODE_CONTROL:"video_toolbar_theater_mode",PLAY_OVERLAY_CONTROL:"video_thumbnail_play",POSTER_CONTROL:"video_thumbnail_play",CAPTIONS_ON_CONTROL:Cg,CAPTIONS_OFF_CONTROL:Cg,MENU_CAPTIONS_ON_CONTROL:Cg,MENU_CAPTIONS_OFF_CONTROL:Cg,PLAYBACK_RATE_CONTROL:"video_settings_playback_speed",SKIP_BACK_CONTROL:"video_skip_back",SKIP_AHEAD_CONTROL:"video_skip_ahead"},Ig="SHORT_PRESS",Pg="DRAG",xg="SWIPE_RIGHT",Ag="SWIPE_LEFT",Og=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.onTrack;return o(this,i),(n=t.apply(this,arguments)).setState({onTrack:a}),Hh("control-interaction: playerInteraction plugin is required",e.hasPlugin("playerInteraction")),n.on(e.playerInteraction(),"interact",n._onPlayerInteraction),n.on(e,"volumechange",n._onVolumechange),n}return l(i,[{key:"_onPlayerInteraction",value:function(e,t){var i=t.controlId,n=wg[i];if(qh("media-player: control-interaction: controlId ".concat(i," was registered with the playerInteraction plugin but no associated control name was found."),n),n){var r,a={controlName:n};i===qp?r=this._previousVolume-1&&(this.player.defaultPlaybackRate(e),this.player.playbackRate(e))}}]),i}(Lg);if(E)try{Fg.prototype.localStorage=window.localStorage}catch(e){}wl.registerPlugin("userPreferences",Fg);var jg=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments)).on(e,"play",n._onPlay),n.on(e,"pause",n._onPause),n.on(e,"ended",n._onEnded),n}return l(i,[{key:"_onPlay",value:function(){this.setText("Pause tooltip")}},{key:"_onPause",value:function(){this.setText("Play tooltip")}},{key:"_onEnded",value:function(){this.setText("Replay tooltip")}}],[{key:"getDefaultText",value:function(){return"Play tooltip"}}]),i}(mf);wl.registerComponent("PlayToggleTooltip",jg);var Vg=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments)).on(e,"fullscreenchange",n._onFullscreenchange),n}return l(i,[{key:"_onFullscreenchange",value:function(){this.player.isFullscreen()?this.setText("Exit fullscreen tooltip"):this.setText("Fullscreen tooltip")}}],[{key:"getDefaultText",value:function(){return"Fullscreen tooltip"}}]),i}(mf);wl.registerComponent("FullscreenToggleTooltip",Vg);var Hg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.control;return o(this,i),(n=t.apply(this,arguments)).on(a,"activate",n._onActivate),n.on(a,"deactivate",n._onDeactivate),n}return l(i,[{key:"_onActivate",value:function(){this.setText("Hide captions tooltip")}},{key:"_onDeactivate",value:function(){this.setText("Show captions tooltip")}}],[{key:"getDefaultText",value:function(){return"Show captions tooltip"}}]),i}(mf);wl.registerComponent("CaptionsToggleTooltip",Hg);var qg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Captions Menu tooltip"}}]),i}(mf);wl.registerComponent("CaptionsMenuToggleTooltip",qg);var Wg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Skip back tooltip"}}]),i}(mf);wl.registerComponent("SkipBackTooltip",Wg);var Gg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Skip ahead tooltip"}}]),i}(mf);wl.registerComponent("SkipAheadTooltip",Gg);var zg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Back to start tooltip"}}]),i}(mf);wl.registerComponent("BackToStartTooltip",zg);var Xg=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.control;return o(this,i),(n=t.apply(this,arguments)).on(a,"activate",n._onActivate),n.on(a,"deactivate",n._onDeactivate),n}return l(i,[{key:"_onActivate",value:function(){this.setText("Deactivate theater mode tooltip")}},{key:"_onDeactivate",value:function(){this.setText("Activate theater mode tooltip")}}],[{key:"getDefaultText",value:function(){return"Activate theater mode tooltip"}}]),i}(mf);wl.registerComponent("TheaterModeTooltip",Xg);var Kg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Previous tooltip"}}]),i}(mf);wl.registerComponent("PreviousTooltip",Kg);var Yg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Next tooltip"}}]),i}(mf);wl.registerComponent("NextTooltip",Yg);var Qg=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Settings tooltip"}}]),i}(mf);wl.registerComponent("SettingsMenuTooltip",Qg);var $g=function(e){d(i,e);var t=g(i);function i(){return o(this,i),t.apply(this,arguments)}return l(i,null,[{key:"getDefaultText",value:function(){return"Playback speed tooltip"}}]),i}(mf);wl.registerComponent("PlaybackRateMenuTooltip",$g);var Jg=wl.getPlugin("plugin"),Zg=wl.getComponent("ControlTooltip"),ev={PlayToggle:jg,SkipBackButton:Wg,SkipAheadButton:Gg,BackToStartButton:zg,TheaterModeButton:Xg,PreviousButton:Kg,NextButton:Yg,CaptionsToggle:Hg,"CaptionsMenuToggle.CaptionsMenuToggle":qg,FullscreenToggle:Vg,"SettingsMenuButton.SettingsMenuButton":Qg,"PlaybackRateMenuButton.PlaybackRateMenuButton":$g},tv=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._player=e,e.ready((function(){n._controlBar=e.getChild("controlBar"),n._controls=n._controlBar.children(),n._middleIndex=n._getMiddleIndex(),Object.keys(ev).forEach((function(e){var t=ev[e];Hh("tooltip: The tooltip class must provide a getDefaultText method","function"===typeof t.getDefaultText);var i=n._controlBar.getDescendant(e.split("."));if(i){var r=i,a=e.split(".");a.length>1&&(r=n._controlBar.getChild(a[0])),n.addTooltip(i,{side:n._getSide(r),TooltipClass:t})}})),n._middleIndex=null})),n}return l(i,[{key:"addTooltip",value:function(e,t){var i=t.side,n=t.TooltipClass,r=void 0===n?Zg:n,a=new r(this._player,{control:e,side:i,text:r.getDefaultText()});e.addChild(a)}},{key:"_getSide",value:function(e){var t=this._middleIndex||this._getMiddleIndex();return t?this._controls.indexOf(e)>t?pf:hf:null}},{key:"_getMiddleIndex",value:function(){var e=this._controlBar.getChild("CustomControlSpacer"),t=e&&this._controls.indexOf(e);return t>-1?t:null}}]),i}(Jg);wl.registerPlugin("controlTooltips",tv);var iv=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.autoplay,s=void 0===a||a;return o(this,i),(n=t.apply(this,arguments))._autoplay=s,e.ready((function(){var t=e.getDescendant("controlBar","nextButton"),i=e.getDescendant("controlBar","previousButton");t&&n.on(t,"next",(function(){n.next({autoplay:s&&!e.paused()})})),i&&n.on(i,"previous",(function(){n.previous({autoplay:s&&!e.paused()})})),n.on(e,"ended",n._onEnded)})),n}return l(i,[{key:"previous",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.autoplay;this.player.options({autoplay:!!t&&"play"}),this.trigger("previous")}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.autoplay;this.player.options({autoplay:!!t&&"play"}),this.trigger("next")}},{key:"setCurrentItem",value:function(e){var t=this,i=e.source,n=e.autoplay,r=e.plugins,a=void 0===r?{}:r,s=e.poster,o=e.tracks;Hh("playlist setCurrentItem(): source is required",i),this.player.paused()||this.player.pause(),this.player.reset(),wf(n)&&this.player.options({autoplay:n}),Object.keys(a).forEach((function(e){t.player[e]().setState(a[e])})),this.player.poster(s),this.player.src(i),Array.isArray(o)&&o.forEach((function(e){var i=e.label,n=e.srclang,r=e.src;t.player.addRemoteTextTrack({kind:"captions",label:i,srclang:n,src:r})})),this.trigger("itemchange",e)}},{key:"_onEnded",value:function(){var e=this.player,t=e.getDescendant("controlBar","settingsMenuButton"),i=t&&t.menu.getChild("autoplaySetting"),n=!i||i.selected(),r=this._autoplay&&n&&!e.loop();this.trigger("ended",{autoplay:r,next:this.next.bind(this)})}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("playlist",iv),wl.registerPlugin("disableContextMenu",(function(){this.on("contextmenu",(function(e){e.preventDefault()}))}));var nv=wl.getPlugin("plugin"),rv=function(e){d(i,e);var t=g(i);function i(e,n){var r,a=n.topBufferSize,s=void 0===a?5:a;return o(this,i),(r=t.apply(this,arguments))._topBufferSize=s,r.on(e,"ready",r._onReady),r.on(e,"dispose",r._onDispose),r}return l(i,[{key:"_onReady",value:function(){var e=this;this._controlBar=this.player.getChild("controlBar"),this._controlBarResizeObserver=new ResizeObserver((function(){e._setMaxHeight()})),this._controlBarResizeObserver.observe(this._controlBar.el())}},{key:"_setMaxHeight",value:function(){if(this._controlBar&&this._controlBar.el()){var e=this.player.el().getBoundingClientRect().top,t=this._controlBar.children().find((function(e){return null!==e.el().offsetParent}));if(t){var i=t.el().getBoundingClientRect().top,n=Math.abs(e-i)-this._topBufferSize;this._controlBar.el().querySelectorAll(".vjs-slider-vertical").forEach((function(e){e.parentElement.style.maxHeight="".concat(n,"px")})),this.trigger("heightchange")}}}},{key:"_onDispose",value:function(){this._controlBarResizeObserver&&this._controlBarResizeObserver.unobserve(this._controlBar.el())}}]),i}(nv);wl.registerPlugin("verticalSliderMaxHeight",rv),wl.registerPlugin("throwErrors",(function(){var e=wl.log.error;wl.log.error=function(){for(var t=arguments.length,i=new Array(t),n=0;nthis.maxRate&&this.player.playbackRate(this.maxRate),e1&&void 0!==arguments[1]?arguments[1]:{},a=r.rootMargin,s=r.threshold,u=void 0===s?0:s;if(o(this,i),n=t.apply(this,arguments),!E)return m(n);n._threshold=u,n._isInViewport=null,n._isDocumentVisible=!document.hidden;var l=n._onDocumentVisibilityChange.bind(f(n));document.addEventListener("visibilitychange",l);var c=new window.IntersectionObserver(n._onInViewportChange.bind(f(n)),{rootMargin:a,threshold:u});return c.observe(e.el()),n.on(e,"dispose",(function(){document.removeEventListener("visibilitychange",l),c.disconnect(),c=void 0})),n}return l(i,[{key:"ready",value:function(e){this._isReady?e():this.on("ready",e)}},{key:"isVisible",value:function(){return Hh("player-visibility: isVisible should not be called before `ready`",this._isReady),this._isVisible}},{key:"isInViewport",value:function(){return Hh("player-visibility: isInViewport should not be called before `ready`",this._isReady),this._isInViewport}},{key:"isDocumentVisible",value:function(){return this._isDocumentVisible}},{key:"_onInViewportChange",value:function(e){var t=this;e.forEach((function(e){var i=e.isIntersecting,n=e.intersectionRatio;t._isInViewport=i&&n>=t._threshold})),this._setIsVisible(),this._isReady?this.trigger("inViewportChange",{isInViewport:this._isInViewport}):(this._isReady=!0,this.trigger("ready"))}},{key:"_onDocumentVisibilityChange",value:function(){this._isDocumentVisible=!document.hidden,this._setIsVisible(),this.trigger("documentVisibilityChange",{isDocumentVisible:this._isDocumentVisible})}},{key:"_setIsVisible",value:function(){var e=this._isVisible;this._isVisible=this._isDocumentVisible&&this._isInViewport,this._isReady&&this._isVisible!==e&&this.trigger("visibilityChange",{isVisible:this._isVisible,isDocumentVisible:this._isDocumentVisible,isInViewport:this._isInViewport})}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("playerVisibility",sv);var ov=wl.getPlugin("plugin"),uv=["ready","loadstart","loadeddata","loadedmetadata","canplay","autoplay-success","autoplay-failure"],lv=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments)).Promise=e.options().Promise||window.Promise,n._setupEventPromises(),n.on(e,"playerreset",n._onReset),n}return l(i,[{key:"waitForEvent",value:function(e){return Hh("lifecycle: Must be a supported event",uv.includes(e)),this._eventPromises[e]}},{key:"_setupEventPromises",value:function(){var e=this;this._eventPromises={},uv.forEach((function(t){e._eventPromises[t]=new e.Promise((function(i){e.one(e.player,t,i),e.one(e.player,"playerreset",(function(){e.off(e.player,t,i)}))}))}))}},{key:"_onReset",value:function(){this._setupEventPromises()}}]),i}(ov);wl.registerPlugin("lifecycle",lv);var cv=wl.getPlugin("plugin"),dv=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._poster=null,n.on(e,"play",n._onPlay),n.on(e,"pause",n._onPause),n.on(e,"playerreset",n._onReset),n.one(e,"loadstart",(function(){n.on(e,"posterchange",n._onPosterChange),n.on(e,"autoplay-failure",n._onAutoplayFailure)})),n}return l(i,[{key:"_onPlay",value:function(){this.player.addClass("vjs-is-playing")}},{key:"_onPause",value:function(){this.player.removeClass("vjs-is-playing")}},{key:"_onReset",value:function(){this._poster=null,this.player.autoplay()||this.player.removeClass("vjs-is-playing")}},{key:"_onPosterChange",value:function(){var e=this.player.poster();e&&this.player.autoplay()&&e!==this._poster&&(this._poster=e,this.player.poster(""))}},{key:"_onAutoplayFailure",value:function(){this._poster&&(this.player.poster(this._poster),this._poster=null)}}]),i}(cv);wl.registerPlugin("smoothMediaChange",dv);wl.registerPlugin("menuOverflow",(function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.offset,n=void 0===i?80:i,r=t.maxHeight;this.on(["ready","playerresize","loadedmetadata"],(function(){var t=e.el().querySelectorAll(".vjs-menu-button-popup .vjs-menu-content"),i=e.currentHeight();t.forEach((function(e){e.setAttribute("tabindex","-1");var t=Math.max(i-n,24);r&&(t=Math.min(t,r)),e.style.maxHeight="".concat(t,"px")}))}))}));var hv=wl.getPlugin("plugin"),pv=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),n=t.apply(this,arguments),e.options({liveTracker:{liveTolerance:2}}),n.on(e,"play",n._onPlay),n.on(e,"pause",n._onPause),n.on(e,"ended",n._onEnded),n}return l(i,[{key:"_onPlay",value:function(){this.player.liveTracker&&this.player.liveTracker.isLive()&&this._maintainLiveEdge()}},{key:"_onPause",value:function(){this.player.clearTimeout(this._maintainLiveEdgeTimeout)}},{key:"_onEnded",value:function(){this.player.clearTimeout(this._maintainLiveEdgeTimeout),this._startedPlaybackDuringLive=!1}},{key:"_maintainLiveEdge",value:function(){this.player.liveTracker.liveCurrentTime()-this.player.currentTime()>2&&this.player.liveTracker.seekToLiveEdge(),this._maintainLiveEdgeTimeout=this.player.setTimeout(this._maintainLiveEdge.bind(this),1e3)}},{key:"dispose",value:function(){this.player.clearTimeout(this._maintainLiveEdgeTimeout),y(h(i.prototype),"dispose",this).call(this)}}]),i}(hv);wl.registerPlugin("maintainLiveEdge",pv);var fv,mv=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=r.events,s=void 0===a?["tap","click","keydown"]:a;return o(this,i),(n=t.apply(this,arguments)).on(e,s,(function(e){e.isTrusted||(e.preventDefault(),e.stopPropagation())})),n}return l(i)}(wl.getPlugin("plugin"));wl.registerPlugin("disableScriptInteraction",mv),wl.registerPlugin("setAriaLiveToOff",(function(){var e=this;this.ready((function(){e.el().querySelectorAll(".vjs-control-text[aria-live=polite]").forEach((function(e){e.setAttribute("aria-live","off")}))}))}));var gv=new Uint8Array(16);function vv(){if(!fv&&!(fv="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fv(gv)}var yv=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function _v(e){return"string"===typeof e&&yv.test(e)}for(var bv=[],Tv=0;Tv<256;++Tv)bv.push((Tv+256).toString(16).substr(1));function kv(e,t,i){var n=(e=e||{}).random||(e.rng||vv)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){i=i||0;for(var r=0;r<16;++r)t[i+r]=n[r];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(bv[e[t+0]]+bv[e[t+1]]+bv[e[t+2]]+bv[e[t+3]]+"-"+bv[e[t+4]]+bv[e[t+5]]+"-"+bv[e[t+6]]+bv[e[t+7]]+"-"+bv[e[t+8]]+bv[e[t+9]]+"-"+bv[e[t+10]]+bv[e[t+11]]+bv[e[t+12]]+bv[e[t+13]]+bv[e[t+14]]+bv[e[t+15]]).toLowerCase();if(!_v(i))throw TypeError("Stringified UUID is invalid");return i}(n)}var Sv=function(e){d(i,e);var t=g(i);function i(e){var n;return o(this,i),(n=t.apply(this,arguments))._sourceSet=!1,n.generateNewTrackingId(),n.on(e,"sourceset",(function(t){if(n._sourceSet){var i=t.src||"";i.length&&n._isSrcInCurrentSources(i,e.currentSources())||n.generateNewTrackingId()}else n._sourceSet=!0})),n}return l(i,[{key:"generateNewTrackingId",value:function(){this.trackingId=kv()}},{key:"getTrackingId",value:function(){return this.clientTrackingId||this.trackingId}},{key:"setTrackingId",value:function(e){this.clientTrackingId=e}},{key:"_isSrcInCurrentSources",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return t.length>1&&t.find((function(t){return t.src.length&&e.indexOf(t.src)>-1}))}}]),i}(wl.getPlugin("plugin"));wl.registerPlugin("generateTrackingId",Sv);var Ev=function(e){d(r,e);var t,i=g(r);function r(e,t){var n;return o(this,r),(n=i.call(this,e,t))._player=e,n._animationUri=t.animationUri,n._animationSvg=null,n._fetchAnimationUri(),n.on(n._player,"play",n._onPlay),n.on(n._player,"pause",n._onPause),n}return l(r,[{key:"_onPlay",value:function(){this._background?this._background.unpauseAnimation():(this._background=this._player.addChild("AudioAnimatedBackground"),this._background.setAnimation(this._animationSvg),this._background.on(["tap","click"],this._handlePlayPauseToggle.bind(this)))}},{key:"_onPause",value:function(){var e;null===(e=this._background)||void 0===e||e.pauseAnimation()}},{key:"_handlePlayPauseToggle",value:function(){this._player.paused()?this._player.play():this._player.pause()}},{key:"_fetchAnimationUri",value:(t=s(n().mark((function e(){var t=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fetch(this._animationUri).then((function(e){return"image/svg+xml"===e.headers.get("content-type")?e.text():null})).then((function(e){var i=(new DOMParser).parseFromString(e,"image/svg+xml"),n=null===i||void 0===i?void 0:i.querySelector("svg");n&&(t._animationSvg=document.importNode(n,!0),t._background&&t._background.setAnimation(t._animationSvg))})).catch((function(){return null}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),r}(wl.getPlugin("plugin"));wl.registerPlugin("audioAnimatedBackground",Ev);var Cv=function(e,t){if(!e.responseHeaders)return null;var i=t.toLowerCase(),n=Object.entries(e.responseHeaders).find((function(e){return _(e,1)[0].toLowerCase()===i}));return n&&n[1]},wv=function(e){var t,i,n,r,a=(t=e.uri,null===(i=performance)||void 0===i||null===(n=i.getEntriesByName)||void 0===n||null===(r=n.call(i,t,"resource"))||void 0===r?void 0:r.pop());return 304===(null===a||void 0===a?void 0:a.responseStatus)||0===(null===a||void 0===a?void 0:a.transferSize)},Iv=function(e){return!!Cv(e,ug)},Pv=function(e){return function(e){return"*"===Cv(e,sg)}(e)?wv(e)?ig:function(e){return Iv(e)&&"HIT"===Cv(e,og)}(e)?ng:Iv(e)?rg:ag:ag},xv=wl.getPlugin("plugin"),Av=function(e,t){e.beforeRequest=function(e){return e.beforeSend=function(e){var i=Am();e.addEventListener("loadend",(function(){t.trigger("response",{xhr:e,performanceStartTime:i,performanceEndTime:Am(),responseSource:Pv(e)})}))},e}},Ov=function(e,t){return new window.Proxy(e,{set:function(e,i,n){var r;return"xhr"===i&&Av(n,t),(r=window.Reflect).set.apply(r,arguments)}})},Lv=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o(this,i),(n=t.apply(this,arguments)).enabled=r.enabled,!n.enabled)return m(n);var a=f(n);return e.ready((function(){var t=new window.Proxy(e.tech(!0),{set:function(e,t,i){var n;return"vhs"!==t?(n=window.Reflect).set.apply(n,arguments):(e[t]=Ov(i,a),!0)}});e.tech_=t})),n}return l(i)}(xv);wl.registerPlugin("xhrHooks",Lv);var Dv=wl.getPlugin("plugin"),Rv=function(e){var t,i=null===(t=e.tech(!0).vhs)||void 0===t?void 0:t.masterPlaylistController_;i&&[i.mainSegmentLoader_,i.audioSegmentLoader_,i.subtitleSegmentLoader_].forEach((function(e){e&&(e.abort(),e.pause())}))},Mv=function(e){var t,i=null===(t=e.tech(!0).vhs)||void 0===t?void 0:t.masterPlaylistController_;i&&i.load()},Nv=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(n=t.apply(this,arguments)).enabled=r.enabled,n.enabled?(e.ready((function(){e.on("pause",(function(){return Rv(e)})),e.on("play",(function(){return Mv(e)}))})),n):m(n)}return l(i)}(Dv);wl.registerPlugin("stopBufferingHlsOnPause",Nv);var Uv=function(e){var t=e.getBoundingClientRect(),i=t.top,n=t.bottom,r=window.innerHeight;return i>=0&&i=0&&l<0?-1:u<0&&l>=0?1:Math.abs(u)-Math.abs(l)},jv=function(e){var t=e.duration();if(t===1/0)return!1;if(!t)return!1;var i=e.buffered();if(0===i.length)return!1;var n=i.end(i.length-1);if(t-n<=.09)return!0;var r=e.tech(!0).vhs.masterPlaylistController_.goalBufferLength();return n-e.currentTime()>=r},Vv=function(e){if(0!==e.length){var t=wl.getAllPlayers().filter((function(e){return!e.paused()})),i=e.find((function(e){return!e.player.paused()}));return t.length>0&&!i&&!t.every(jv)?null:function(e){return e.sort(Fv).at(0)}(e)}},Hv=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.allowMultipleActiveEntries,n=void 0!==i&&i;o(this,e),this.entries=[],this.activeEntries=[],this.allowMultipleActiveEntries=n}return l(e,[{key:"push",value:function(e){this.entries.push(e),this.run()}},{key:"remove",value:function(e){var t=this.entries.indexOf(e);t<0||this.entries.splice(t,1)}},{key:"run",value:function(){var e=this,t=Vv(this.entries);if(t&&(!this.activeEntries.length||this.allowMultipleActiveEntries&&!t.player.paused())){this.activeEntries.push(t),this.remove(t);var i=t.origXhr,n=t.options,r=t.callback,a=t.eventListeners,s=t.returnedRequestObjectProxyHandler,o=i(n,(function(i,n){r(i,n),e.activeEntries.splice(e.activeEntries.indexOf(t),1),e.run()}));s.get=function(i,n){if("abort"===n)return function(){o.abort.apply(o),e.activeEntries.splice(e.activeEntries.indexOf(t),1),e.run()};var r=o[n];return"function"===typeof r?r.bind(o):r},a.forEach((function(e){var t=e.event,i=e.callback;o.addEventListener(t,i)}))}}}]),e}(),qv=wl.getPlugin("plugin"),Wv=function(e,t,i){return function(n,r){var a={origXhr:e,player:i,options:n,callback:r,eventListeners:[]},s={url:n.uri,uri:n.uri,abort:function(){t.remove(a)},addEventListener:function(e,t){a.eventListeners.push({event:e,callback:t})}},o={},u=new window.Proxy(s,o);return a.returnedRequestObjectProxyHandler=o,t.push(a),u}},Gv=function(e,t,i){return new window.Proxy(e,{set:function(e,n,r){var a;return"xhr"!==n?(a=window.Reflect).set.apply(a,arguments):(e[n]=Wv(r,t,i),!0)}})},zv=function(e){d(i,e);var t=g(i);function i(e){var n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(o(this,i),(r=t.apply(this,arguments)).enabled=a.enabled,!r.enabled)return m(r);null!==(n=wl.requestQueuePlugin)&&void 0!==n&&n.requestQueue||(wl.requestQueuePlugin={requestQueue:new Hv({allowMultipleActiveEntries:a.allowMultipleActiveEntries})});var s=wl.requestQueuePlugin.requestQueue;return e.on("play",(function(){return wl.requestQueuePlugin.requestQueue.run()})),e.on("pause",(function(){return wl.requestQueuePlugin.requestQueue.run()})),e.ready((function(){var t=new window.Proxy(e.tech(!0),{set:function(t,i,n){var r;return"vhs"!==i?(r=window.Reflect).set.apply(r,arguments):(t[i]=Gv(n,s,e),!0)}});e.tech_=t})),r}return l(i)}(qv);wl.registerPlugin("requestQueue",zv);var Xv=wl.getPlugin("plugin"),Kv=function(e){var t=e.player,i=e.mpc,n=e.viewportDistanceForLoading,r=void 0===n?0:n,a=i.goalBufferLength.bind(i);i.goalBufferLength=function(){return 0};var s=new window.IntersectionObserver((function(e){e.forEach((function(e){e.isIntersecting&&(i.goalBufferLength=a,s.disconnect())}))}),{rootMargin:"".concat(r,"px")});s.observe(t.el())},Yv=function(e){var t=e.origVhs,i=e.player,n=e.viewportDistanceForLoading;return new window.Proxy(t,{set:function(e,t,r){var a;return"masterPlaylistController_"===t&&Kv({player:i,mpc:r,viewportDistanceForLoading:n}),(a=window.Reflect).set.apply(a,arguments)}})},Qv=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(n=t.apply(this,arguments)).enabled=r.enabled,n.enabled?(e.ready((function(){var t=new window.Proxy(e.tech(!0),{set:function(t,i,n){var a;return"vhs"!==i?(a=window.Reflect).set.apply(a,arguments):(t[i]=Yv({origVhs:n,player:e,viewportDistanceForLoading:r.viewportDistanceForLoading}),!0)}});e.tech_=t})),n):m(n)}return l(i)}(Xv);wl.registerPlugin("delayedSegmentLoading",Qv);var $v=wl.getPlugin("plugin"),Jv={VIDEO_LOAD_START:"video-load-start-UGC",VIDEO_LOAD_SUCCESS:"video-load-success-UGC",VIDEO_LOAD_FAILURE:"video-load-failure-UGC"},Zv={VIDEO_LOAD_START:"video-load-start-Ads",VIDEO_LOAD_SUCCESS:"video-load-success-Ads",VIDEO_LOAD_FAILURE:"video-load-failure-Ads"},ey={VIDEO_LOAD_START:"video-load-start-Learning",VIDEO_LOAD_SUCCESS:"video-load-success-Learning",VIDEO_LOAD_FAILURE:"video-load-failure-Learning"},ty={VIDEO_LOAD_START:"video-load-start-Messaging",VIDEO_LOAD_SUCCESS:"video-load-success-Messaging",VIDEO_LOAD_FAILURE:"video-load-failure-Messaging"},iy={VIDEO_LOAD_START:"video-load-start-Live",VIDEO_LOAD_SUCCESS:"video-load-success-Live",VIDEO_LOAD_FAILURE:"video-load-failure-Live"},ny=function(e){if(!e||"string"!==typeof e)return null;switch(e.toLowerCase()){case"ugc":return Jv;case"ads":return Zv;case"learning":return ey;case"messaging":return ty;case"live_video":return iy;default:return null}},ry=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,i),n=t.apply(this,arguments);var a=r.clientSensor,s=r.mediaSource,u=r.useOldGroupName;if(!a)return m(n);var l=u?"media-infra":"media-player",c=ny(s);return c?(a.incrementMetricCounter({groupName:l,metricName:c.VIDEO_LOAD_START}),e.ready((function(){e.one("error",(function(){return a.incrementMetricCounter({groupName:l,metricName:c.VIDEO_LOAD_FAILURE})})),e.one("loadedmetadata",(function(){return a.incrementMetricCounter({groupName:l,metricName:c.VIDEO_LOAD_SUCCESS})}))})),n):m(n)}return l(i)}($v);function ay(e){return e>=200&&e<=299}wl.registerPlugin("sensors",ry);var sy=wl.getPlugin("plugin"),oy={},uy=function(e){return[e.uri,e.responseType,e.headers&&e.headers.Range].filter((function(e){return"undefined"!==typeof e})).join("|||||")},ly=function(e){d(i,e);var t=g(i);function i(e){var n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(n=t.apply(this,arguments))._enabled=r.enabled&&wl.Vhs,n._enabled?wl.Vhs.xhr._fromXhrCachePlugin?m(n):(n._overrideVhsXhr(),n):m(n)}return l(i,[{key:"enabled",get:function(){return this._enabled}},{key:"_overrideVhsXhr",value:function(){wl.Vhs.xhr=function(e,t){var i=oy[uy(e)];if(null!==i&&void 0!==i&&i.callbacks)return i.callbacks.push(t),i.request;if(null!==i&&void 0!==i&&i.error||null===i||void 0===i||!i.response||!ay(i.response.statusCode))return wl.xhr(e,t);var n=i.request,r=i.error,a=i.response;return wl.log.debug("[XHR-CACHE] Retrieved cache result for: ".concat(n.url)),setTimeout((function(){return t(r,a)})),n},wl.Vhs.xhr._fromXhrCachePlugin=!0}},{key:"requestAndCache",value:function(e,t){var i=uy(e),n=oy[i];if(!n){var r=wl.xhr(e,(function(e,t){var n=oy[i];wl.log.debug("[XHR-CACHE] Caching result for: ".concat(r.url)),oy[i]={request:r,error:e,response:t},null!==n&&void 0!==n&&n.callbacks&&(n.callbacks.forEach((function(i){return i(e,t)})),delete n.callbacks)}));return oy[i]={request:r,callbacks:[t]},r}n.callbacks.push(t)}},{key:"clearCache",value:function(){Object.keys(oy).forEach((function(e){return delete oy[e]}))}}]),i}(sy);wl.registerPlugin("xhrCache",ly);var cy=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,dy=/^application\/dash\+xml/i;const hy=function(e){const t={};return e.byterange&&(t.Range=function(e){let t;const i=e.offset;return t="bigint"===typeof e.offset||"bigint"===typeof e.length?A.BigInt(e.offset)+A.BigInt(e.length)-A.BigInt(1):e.offset+e.length-1,"bytes="+i+"-"+t}(e.byterange)),t};var py=1.2,fy={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/};const{createTimeRange:my}=wl,gy=function(e){return e.excludeUntil&&e.excludeUntil>Date.now()},vy=function(e){const t=gy(e);return!e.disabled&&!t},yy=(e,t)=>!(!e&&!t||!e&&t||e&&!t)&&(e===t||(!(!e.id||!t.id||e.id!==t.id)||(!(!e.resolvedUri||!t.resolvedUri||e.resolvedUri!==t.resolvedUri)||!(!e.uri||!t.uri||e.uri!==t.uri)))),_y=function(e,t){const i=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{};let n=!1;for(const e in i){for(const r in i[e])if(n=t(i[e][r]),n)break;if(n)break}return!!n};var by=vy,Ty=function(e){return e.disabled},ky=function(e){return e.excludeUntil&&e.excludeUntil===1/0},Sy=e=>{if(!e||!e.playlists||!e.playlists.length){return _y(e,e=>e.playlists&&e.playlists.length||e.uri)}for(let t=0;t{return void 0===(t=e)&&(t=""),fy.audio.test(t.trim().toLowerCase());var t}))continue;if(!_y(e,e=>yy(i,e)))return!1}return!0};const Ey=e=>wl.log.debug?wl.log.debug.bind(wl,"VHS:",e+" >"):function(){},Cy=(Ey("CodecUtils"),Ey("PlaylistSelector")),wy=function(e){if(!e||!e.playlist)return;const t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})},Iy=function(e,t){if(!e)return"";const i=A.getComputedStyle(e);return i?i[t]:""},Py=function(e,t){const i=e.slice();e.sort((function(e,n){const r=t(e,n);return 0===r?i.indexOf(e)-i.indexOf(n):r}))};const xy=function(){const e=this.useDevicePixelRatio&&A.devicePixelRatio||1;return function(e,t,i,n,r,a){if(!e)return;const s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r};let o=e.playlists;Sy(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);let u=o.map(e=>{let t;const i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,n=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height;return t=e.attributes&&e.attributes.BANDWIDTH,t=t||A.Number.MAX_VALUE,{bandwidth:t,width:i,height:n,playlist:e}});Py(u,(e,t)=>e.bandwidth-t.bandwidth),u=u.filter(e=>!ky(e.playlist));let l=u.filter(e=>by(e.playlist));l.length||(l=u.filter(e=>!Ty(e.playlist)));const c=l.filter(e=>e.bandwidth*pye.bandwidth===d.bandwidth)[0];if(!1===r){const e=h||l[0]||u[0];if(e&&e.playlist){let t="sortedPlaylistReps";return h&&(t="bandwidthBestRep"),l[0]&&(t="enabledPlaylistReps"),Cy(`choosing ${wy(e)} using ${t} with options`,s),e.playlist}return Cy("could not choose a playlist with options",s),null}const p=c.filter(e=>e.width&&e.height);Py(p,(e,t)=>e.width-t.width);const f=p.filter(e=>e.width===i&&e.height===n);d=f[f.length-1];const m=f.filter(e=>e.bandwidth===d.bandwidth)[0];let g,v,y,_;if(m||(g=p.filter(e=>e.width>i||e.height>n),v=g.filter(e=>e.width===g[0].width&&e.height===g[0].height),d=v[v.length-1],y=v.filter(e=>e.bandwidth===d.bandwidth)[0]),a.experimentalLeastPixelDiffSelector){const e=p.map(e=>(e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e));Py(e,(e,t)=>e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff),_=e[0]}const b=_||y||m||h||l[0]||u[0];if(b&&b.playlist){let e="sortedPlaylistReps";return _?e="leastPixelDiffRep":y?e="resolutionPlusOneRep":m?e="resolutionBestRep":h?e="bandwidthBestRep":l[0]&&(e="enabledPlaylistReps"),Cy(`choosing ${wy(b)} using ${e} with options`,s),b.playlist}return Cy("could not choose a playlist with options",s),null}(this.playlists.master,this.systemBandwidth,parseInt(Iy(this.tech_.el(),"width"),10)*e,parseInt(Iy(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)};var Ay=function(e){var t=new Be;return t.push(e),t.end(),t.manifest},Oy=function(e){var t=Ay(e.body);return t.resolvedUri=e.url,t.playlists.forEach((function(e){e.resolvedUri=$e(t.resolvedUri,e.uri)})),t},Ly=function(e){var t=Ay(e.body);return t.resolvedUri=e.url,t.segments.forEach((function(e){return function(e){var t=e.segment,i=e.playlistUri;t.resolvedUri=$e(i,t.uri),t.key&&(t.key.resolvedUri=$e(i,t.key.uri)),t.map&&(t.map.resolvedUri=$e(i,t.map.uri))}({segment:e,playlistUri:t.resolvedUri})})),t},Dy=function(e){var t=e.player,i=e.options;return new window.Promise((function(e){t.xhrCache().requestAndCache(i,(function(t,i){e(t?null:i)}))}))},Ry=function(){var e=s(n().mark((function e(t){var i,r,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.player,r=t.uri,e.next=3,Dy({player:i,options:{uri:r}});case 3:if((a=e.sent)&&ay(a.statusCode)&&a.body){e.next=6;break}throw new Error("Error prefetching multivariant playlist: ".concat(null===a||void 0===a?void 0:a.statusCode,", ").concat(null===a||void 0===a?void 0:a.body));case 6:return e.abrupt("return",Oy(a));case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),My=function(){var e=s(n().mark((function e(t){var r,a,s,o,u,l;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.player,a=t.prefetchedMain,s=r.tech(!0),o=s.vhs,e.t0=xy,e.t1=i,e.t2=i({},o),e.t3={},e.t4={master:a},e.t5={get systemBandwidth(){return o.systemBandwidth},playlists:e.t4},e.t6=(0,e.t1)(e.t2,e.t3,e.t5),!(u=e.t0.apply.call(e.t0,e.t6)).cached){e.next=12;break}return e.abrupt("return",u);case 12:return e.next=14,Dy({player:r,options:{uri:u.resolvedUri}});case 14:if((l=e.sent)&&ay(l.statusCode)&&l.body){e.next=17;break}throw new Error("Error variant playlist: ".concat(null===l||void 0===l?void 0:l.statusCode,", ").concat(null===l||void 0===l?void 0:l.body));case 17:return u.segments=Ly(l).segments,u.cached=!0,e.abrupt("return",u);case 20:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),Ny=function(){var e=s(n().mark((function e(t){var i,r,a,s;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.player,r=t.prefetchedVariant,!(a=r.segments[0]).cached){e.next=4;break}return e.abrupt("return",a);case 4:return e.next=6,Dy({player:i,options:(n=a,{uri:n.resolvedUri,headers:hy(n),responseType:"arraybuffer"})});case 6:if((s=e.sent)&&ay(s.statusCode)&&s.body){e.next=9;break}throw new Error("Error prefetching segment: ".concat(null===s||void 0===s?void 0:s.statusCode,", ").concat(null===s||void 0===s?void 0:s.body));case 9:return a.cached=!0,e.abrupt("return",a);case 11:case"end":return e.stop()}var n}),e)})));return function(t){return e.apply(this,arguments)}}(),Uy=function(e){d(r,e);var t,i=g(r);function r(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o(this,r),(t=i.apply(this,arguments))._options=n,t._player=e,t}return l(r,[{key:"enabled",get:function(){return this._options.enabled&&this._player.xhrCache()&&this._player.xhrCache().enabled}},{key:"prefetchToFirstSegment",value:(t=s(n().mark((function e(t){var i,r,a,o,u,l,c,d=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.enabled){e.next=2;break}return e.abrupt("return");case 2:if(i=this._player,r=i.currentSource(),a=null===r||void 0===r?void 0:r.type.toLowerCase(),["hls","dash"].includes((h=a,cy.test(h)?"hls":dy.test(h)?"dash":"application/vnd.videojs.vhs+json"===h?"vhs-json":null))){e.next=7;break}return e.abrupt("return");case 7:if(o=t.find((function(e){return e.type.toLowerCase()===(null===r||void 0===r?void 0:r.type.toLowerCase())}))){e.next=10;break}return e.abrupt("return");case 10:u=!1,c=function(){var e=s(n().mark((function e(){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!u&&jv(i)){e.next=2;break}return e.abrupt("return");case 2:if(u=!0,e.prev=3,l){e.next=8;break}return e.next=7,Ry({player:i,uri:o.src});case 7:l=e.sent;case 8:if(jv(i)){e.next=11;break}return u=!1,e.abrupt("return");case 11:return e.next=13,My({player:i,prefetchedMain:l});case 13:if(t=e.sent,jv(i)){e.next=17;break}return u=!1,e.abrupt("return");case 17:return e.next=19,Ny({player:i,prefetchedVariant:t});case 19:e.next=25;break;case 21:e.prev=21,e.t0=e.catch(3),wl.log.debug("[PREFETCH] Unable to prefetch, error:",e.t0),d._player.off("timeupdate",c);case 25:u=!1;case 26:case"end":return e.stop()}}),e,null,[[3,21]])})));return function(){return e.apply(this,arguments)}}(),this._player.on("timeupdate",c),this._player.one("sourceset",(function(){d._player.off("timeupdate",c)}));case 14:case"end":return e.stop()}var h}),e,this)}))),function(e){return t.apply(this,arguments)})}]),r}(wl.getPlugin("plugin"));wl.registerPlugin("prefetch",Uy);var By=wl.getPlugin("plugin"),Fy=function(e){var t=e.player,i=e.mediaUrn,n=e.trackingId,r=e.primaryMediaTrackingId;t&&(t.tracking&&t.tracking().createNewSession({mediaUrn:i,trackingId:n,primaryMediaTrackingId:r}),t.rum&&t.rum().createNewSession({mediaUrn:i,trackingId:n,primaryMediaTrackingId:r}))},jy=function(e){var t=e.player,i=e.tracks;if(null!==i&&void 0!==i&&i.length)for(var n=t.remoteTextTracks(),r=function(e){var r=n[e];i.find((function(e){return e.src===r.src}))&&t.removeRemoteTextTrack(r)},a=0;a1&&void 0!==arguments[1]?arguments[1]:{};return o(this,i),(r=t.apply(this,arguments))._updateOptions(a),0===r._interstitialItems.length?m(r):(r._player=e,r._interstitialItemIndex=0,r._watchForSourceChanges(),r._watchForTextTrackAdditions(),e.ready((function(){r._configureProgressControlForInterstitial(),setTimeout((function(){r._stopWatchingForTextTrackAdditions=!0}),0),r._player.one("play",s(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r._player.autoplay(!0),e.next=3,r._player.prefetch().prefetchToFirstSegment(r._primaryContent.sources);case 3:case"end":return e.stop()}}),e)})))),r._endedListener=r._onEnded.bind(f(r)),r._player.on("ended",r._endedListener)})),r)}return l(i,[{key:"_updateOptions",value:function(e){var t;this._interstitialItems=(null===e||void 0===e||null===(t=e.items)||void 0===t?void 0:t.filter((function(e){return 0===e.timestamp})))||[],this._primaryContent=null===e||void 0===e?void 0:e.primaryContent}},{key:"_handlePrimarySourceChange",value:function(e){if(this._primaryContent.sources){jy({player:this._player,tracks:this._currentItemTracks()}),jy({player:this._player,tracks:this._primaryContent.tracks});var t=Hy({options:this._player.options(),sources:e});this._player.options(t),this._updateOptions(t.plugins.interstitials),this._setSourceToFirstInterstitial()}else this._primaryContent.sources=e}},{key:"_watchForSourceChanges",value:function(){var e=this;this._origSource=this._player.src.bind(this._player),this._player.src=function(t){var i,n;if(!t||e._isDisposed||null===(i=e._player.options().plugins.interstitials)||void 0===i||null===(n=i.items)||void 0===n||!n.length||e._player.options().sources===t)return e._origSource(t);e._handlePrimarySourceChange(t)}}},{key:"_watchForTextTrackAdditions",value:function(){var e=this,t=this._player.addRemoteTextTrack;this._player.addRemoteTextTrack=function(){for(var i,n=arguments.length,r=new Array(n),a=0;a1&&void 0!==arguments[1]?arguments[1]:{},u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};u.exposeGlobalVideojsForDebugging&&!window.vjsForDebug&&(window.vjsForDebug=wl);var l={customCaptionsDisplay:!1,playerBanner:!1,children:{playerBanner:{},mediaLoader:{},posterImage:{},bigPlayButton:{},loadingSpinner:{},controlBar:{},errorDisplay:{},customCaptionsDisplay:{},textTrackDisplay:{},resizeManager:{},liveTracker:{}},controlBar:{skipBackButton:!1,skipAheadButton:!1,previousButton:!1,nextButton:!1,settingsMenuButton:!1,backToStartButton:!1,theaterModeButton:!1,fullscreenToggle:!1,captionsToggle:!1,captionsMenuToggle:!1,muteToggle:!1,remainingTimeDisplay:!1,children:i(i({},null!==(t=o.controlBar)&&void 0!==t&&null!==(n=t.progressControl)&&void 0!==n&&n.inline?{playToggle:{},progressControl:{}}:{progressControl:{},playToggle:{}}),{},{backToStartButton:{},skipBackButton:{},skipAheadButton:{},previousButton:{},nextButton:{},liveDisplay:{},timeDisplay:{},remainingTimeDisplay:{},customControlSpacer:{},playbackRateMenuButton:{},captionsToggle:{},captionsMenuToggle:{},settingsMenuButton:{},volumePanel:{inline:!1},muteToggle:{},theaterModeButton:{},fullscreenToggle:{}})},plugins:{disableContextMenu:!0,lifecycle:!0,qualityLevels:!0,verticalSliderMaxHeight:!0,menuOverflow:!0,setAriaLiveToOff:!0,generateTrackingId:!0,xhrHooks:{enabled:!1},stopBufferingHlsOnPause:{enabled:!1},requestQueue:{enabled:!1},delayedSegmentLoading:{enabled:!1}},controls:!0,fluid:!0,responsive:!0,aspectRatio:"auto",enableSourceset:!0,techOrder:["html5"],noUITitleAttributes:!(null===(r=o.plugins)||void 0===r||!r.controlTooltips),html5:{vhs:{withCredentials:!1,limitRenditionByPlayerDimensions:!1,experimentalBufferBasedABR:!0,useNetworkInformationApi:!0,cacheEncryptionKeys:!0},nativeTextTracks:wl.browser.IS_IPHONE}},c=wl.mergeOptions(l,o,{autoplay:!0===o.autoplay?"any":o.autoplay||!1}),d=c.plugins;delete c.plugins,c.plugins={},zy(d).forEach((function(e){c.plugins[e]=d[e]})),null!==(a=c.plugins.interstitials)&&void 0!==a&&null!==(s=a.items)&&void 0!==s&&s.length&&(c=Hy({options:c,sources:c.sources}));var h=wl(e,c);return h},e.videojs=wl,Object.defineProperty(e,"__esModule",{value:!0})})); //# sourceMappingURL=media-player.umd.min.map