(function(n,t){typeof exports=="object"&&typeof module!="undefined"?module.exports=t(require("global/window"),require("global/document")):typeof define=="function"&&define.amd?define(["global/window","global/document"],t):(n=n||self,n.videojs=t(n.window,n.document))})(this,function(n,t){"use strict";function cy(n){var i="info",r,t=function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];r("log",i,u)};return r=fit(n,t),t.createLogger=function(t){return cy(n+": "+t)},t.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},t.level=function(n){if(typeof n=="string"){if(!t.levels.hasOwnProperty(n))throw new Error('"'+n+'" in not a valid log level');i=n}return i},t.history=function(){return ct?[].concat(ct):[]},t.history.filter=function(n){return(ct||[]).filter(function(t){return new RegExp(".*"+n+".*").test(t[0])})},t.history.clear=function(){ct&&(ct.length=0)},t.history.disable=function(){ct!==null&&(ct.length=0,ct=null)},t.history.enable=function(){ct===null&&(ct=[])},t.error=function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];return r("error",i,u)},t.warn=function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];return r("warn",i,u)},t.debug=function(){for(var t=arguments.length,u=new Array(t),n=0;n<t;n++)u[n]=arguments[n];return r("debug",i,u)},t}function dr(n,t){return t={exports:{}},n(t,t.exports),t.exports}function gr(n,t){ly(n).forEach(function(i){return t(n[i],i)})}function oit(n,t,i){return i===void 0&&(i=0),ly(n).reduce(function(i,r){return t(i,n[r],r)},i)}function y(n){for(var i=arguments.length,r=new Array(i>1?i-1:0),t=1;t<i;t++)r[t-1]=arguments[t];return Object.assign?ve.apply(void 0,[n].concat(r)):(r.forEach(function(t){t&&gr(t,function(t,i){n[i]=t})}),n)}function wi(n){return!!n&&typeof n=="object"}function ff(n){return wi(n)&&eit.call(n)==="[object Object]"&&n.constructor===Object}function ye(t,i){if(!t||!i)return"";if(typeof n.getComputedStyle=="function"){var r=n.getComputedStyle(t);return r?r.getPropertyValue(i)||r[i]:""}return""}function ay(n){return typeof n=="string"&&Boolean(n.trim())}function vy(n){if(n.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters");}function sit(n){return new RegExp("(^|\\s)"+n+"($|\\s)")}function nu(){return t===n.document}function ef(n){return wi(n)&&n.nodeType===1}function yy(){try{return n.parent!==n.self}catch(t){return!0}}function py(n){return function(i,r){if(!ay(i))return t[n](null);ay(r)&&(r=t.querySelector(r));var u=ef(r)?r:t;return u[n]&&u[n](i)}}function w(n,i,r,u){n===void 0&&(n="div");i===void 0&&(i={});r===void 0&&(r={});var f=t.createElement(n);return Object.getOwnPropertyNames(i).forEach(function(n){var t=i[n];n.indexOf("aria-")!==-1||n==="role"||n==="type"?(h.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\n"+("createEl(type, properties, attributes). Attempting to set "+n+" to "+t+".")),f.setAttribute(n,t)):n==="textContent"?tu(f,t):f[n]!==t&&(f[n]=t)}),Object.getOwnPropertyNames(r).forEach(function(n){f.setAttribute(n,r[n])}),u&&wh(f,u),f}function tu(n,t){return typeof n.textContent=="undefined"?n.innerText=t:n.textContent=t,n}function vh(n,t){t.firstChild?t.insertBefore(n,t.firstChild):t.appendChild(n)}function ir(n,t){return(vy(t),n.classList)?n.classList.contains(t):sit(t).test(n.className)}function si(n,t){return n.classList?n.classList.add(t):ir(n,t)||(n.className=(n.className+" "+t).trim()),n}function of(n,t){return n.classList?n.classList.remove(t):(vy(t),n.className=n.className.split(/\s+/).filter(function(n){return n!==t}).join(" ")),n}function wy(n,t,i){var r=ir(n,t);if(typeof i=="function"&&(i=i(n,t)),typeof i!="boolean"&&(i=!r),i!==r)return i?si(n,t):of(n,t),n}function by(n,t){Object.getOwnPropertyNames(t).forEach(function(i){var r=t[i];r===null||typeof r=="undefined"||r===!1?n.removeAttribute(i):n.setAttribute(i,r===!0?"":r)})}function hi(n){var f={},i,t,r,u;if(n&&n.attributes&&n.attributes.length>0)for(i=n.attributes,t=i.length-1;t>=0;t--)r=i[t].name,u=i[t].value,(typeof n[r]=="boolean"||",autoplay,controls,playsinline,loop,muted,default,defaultMuted,".indexOf(","+r+",")!==-1)&&(u=u!==null?!0:!1),f[r]=u;return f}function ky(n,t){return n.getAttribute(t)}function sf(n,t,i){n.setAttribute(t,i)}function pe(n,t){n.removeAttribute(t)}function dy(){t.body.focus();t.onselectstart=function(){return!1}}function gy(){t.onselectstart=function(){return!0}}function hf(n){if(n&&n.getBoundingClientRect&&n.parentNode){var i=n.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(function(n){i[n]!==undefined&&(t[n]=i[n])}),t.height||(t.height=parseFloat(ye(n,"height"))),t.width||(t.width=parseFloat(ye(n,"width"))),t}}function np(i){var r;if(i.getBoundingClientRect&&i.parentNode&&(r=i.getBoundingClientRect()),!r)return{left:0,top:0};var f=t.documentElement,u=t.body,e=f.clientLeft||u.clientLeft||0,o=n.pageXOffset||u.scrollLeft,s=r.left+o-e,h=f.clientTop||u.clientTop||0,c=n.pageYOffset||u.scrollTop,l=r.top+c-h;return{left:Math.round(s),top:Math.round(l)}}function yh(n,t){var i={},r=np(n),o=n.offsetWidth,u=n.offsetHeight,s=r.top,h=r.left,f=t.pageY,e=t.pageX;return t.changedTouches&&(e=t.changedTouches[0].pageX,f=t.changedTouches[0].pageY),i.y=Math.max(0,Math.min(1,(s-f+u)/u)),i.x=Math.max(0,Math.min(1,(e-h)/o)),i}function tp(n){return wi(n)&&n.nodeType===3}function ph(n){while(n.firstChild)n.removeChild(n.firstChild);return n}function ip(n){return typeof n=="function"&&(n=n()),(Array.isArray(n)?n:[n]).map(function(n){return(typeof n=="function"&&(n=n()),ef(n)||tp(n))?n:typeof n=="string"&&/\S/.test(n)?t.createTextNode(n):void 0}).filter(function(n){return n})}function wh(n,t){return ip(t).forEach(function(t){return n.appendChild(t)}),n}function rp(n,t){return wh(ph(n),t)}function iu(n){return n.button===undefined&&n.buttons===undefined?!0:n.button===0&&n.buttons===undefined?!0:n.type==="mouseup"&&n.button===0&&n.buttons===0?!0:n.button!==0||n.buttons!==1?!1:!0}function kh(t,i){i&&(bh=i);n.setTimeout(hit,t)}function dh(){ep=!0;n.removeEventListener("load",dh)}function ki(){return cit++}function cp(n,t){if(tt.has(n)){var i=tt.get(n);i.handlers[t].length===0&&(delete i.handlers[t],n.removeEventListener?n.removeEventListener(t,i.dispatcher,!1):n.detachEvent&&n.detachEvent("on"+t,i.dispatcher));Object.getOwnPropertyNames(i.handlers).length<=0&&(delete i.handlers,delete i.dispatcher,delete i.disabled);Object.getOwnPropertyNames(i).length===0&&tt["delete"](n)}}function gh(n,t,i,r){i.forEach(function(i){n(t,i,r)})}function we(i){function o(){return!0}function s(){return!1}var r,u,f,e;if(i.fixed_)return i;if(!i||!i.isPropagationStopped){r=i||n.event;i={};for(u in r)u!=="layerX"&&u!=="layerY"&&u!=="keyLocation"&&u!=="webkitMovementX"&&u!=="webkitMovementY"&&(u==="returnValue"&&r.preventDefault||(i[u]=r[u]));i.target||(i.target=i.srcElement||t);i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement);i.preventDefault=function(){r.preventDefault&&r.preventDefault();i.returnValue=!1;r.returnValue=!1;i.defaultPrevented=!0};i.defaultPrevented=!1;i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation();i.cancelBubble=!0;r.cancelBubble=!0;i.isPropagationStopped=o};i.isPropagationStopped=s;i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation();i.isImmediatePropagationStopped=o;i.stopPropagation()};i.isImmediatePropagationStopped=s;i.clientX!==null&&i.clientX!==undefined&&(f=t.documentElement,e=t.body,i.pageX=i.clientX+(f&&f.scrollLeft||e&&e.scrollLeft||0)-(f&&f.clientLeft||e&&e.clientLeft||0),i.pageY=i.clientY+(f&&f.scrollTop||e&&e.scrollTop||0)-(f&&f.clientTop||e&&e.clientTop||0));i.which=i.charCode||i.keyCode;i.button!==null&&i.button!==undefined&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}function yt(n,t,i){var r,u;if(Array.isArray(t))return gh(yt,n,t,i);tt.has(n)||tt.set(n,{});r=tt.get(n);r.handlers||(r.handlers={});r.handlers[t]||(r.handlers[t]=[]);i.guid||(i.guid=ki());r.handlers[t].push(i);r.dispatcher||(r.disabled=!1,r.dispatcher=function(t,i){var f,e,u,o;if(!r.disabled&&(t=we(t),f=r.handlers[t.type],f))for(e=f.slice(0),u=0,o=e.length;u<o;u++)if(t.isImmediatePropagationStopped())break;else try{e[u].call(n,t,i)}catch(s){h.error(s)}});r.handlers[t].length===1&&(n.addEventListener?(u=!1,lp()&&ap.indexOf(t)>-1&&(u={passive:!0}),n.addEventListener(t,r.dispatcher,u)):n.attachEvent&&n.attachEvent("on"+t,r.dispatcher))}function it(n,t,i){var r,e,o,u,f;if(tt.has(n)&&(r=tt.get(n),r.handlers)){if(Array.isArray(t))return gh(it,n,t,i);if(e=function(n,t){r.handlers[t]=[];cp(n,t)},t===undefined){for(o in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},o)&&e(n,o);return}if(u=r.handlers[t],u){if(!i){e(n,t);return}if(i.guid)for(f=0;f<u.length;f++)u[f].guid===i.guid&&u.splice(f--,1);cp(n,t)}}}function ru(n,t,i){var f=tt.has(n)?tt.get(n):{},r=n.parentNode||n.ownerDocument,u;return typeof t=="string"?t={type:t,target:n}:t.target||(t.target=n),t=we(t),f.dispatcher&&f.dispatcher.call(n,t,i),r&&!t.isPropagationStopped()&&t.bubbles===!0?ru.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(tt.has(t.target)||tt.set(t.target,{}),u=tt.get(t.target),t.target[t.type]&&(u.disabled=!0,typeof t.target[t.type]=="function"&&t.target[t.type](),u.disabled=!1)),!t.defaultPrevented}function ke(n,t,i){if(Array.isArray(t))return gh(ke,n,t,i);var r=function r(){it(n,t,r);i.apply(this,arguments)};r.guid=i.guid=i.guid||ki();yt(n,t,r)}function vp(n,t,i){var r=function r(){it(n,t,r);i.apply(this,arguments)};r.guid=i.guid=i.guid||ki();yt(n,t,r)}function ic(t,i){i===void 0&&(i={});var u=i,r=u.eventBusKey;if(r){if(!t[r].nodeName)throw new Error('The eventBusKey "'+r+'" does not refer to an element.');t.eventBusEl_=t[r]}else t.eventBusEl_=w("span",{className:"vjs-event-bus"});y(t,yit);t.eventedCallbacks&&t.eventedCallbacks.forEach(function(n){n()});t.on("dispose",function(){t.off();n.setTimeout(function(){t.eventBusEl_=null},0)});return t}function kp(n,t){if(y(n,bp),n.state=y({},n.state,t),typeof n.handleStateChanged=="function"&&ur(n))n.on("statechanged",n.handleStateChanged);return n}function v(){for(var n={},i=arguments.length,r=new Array(i),t=0;t<i;t++)r[t]=arguments[t];return r.forEach(function(t){t&&gr(t,function(t,i){if(!ff(t)){n[i]=t;return}ff(n[i])||(n[i]={});n[i]=v(n[i],t)})}),n}function wit(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function bit(n,t){n.prototype=Object.create(t.prototype);n.prototype.constructor=n;n.__proto__=t}function nrt(n,t,i){if(typeof t!="number"||t<0||t>i)throw new Error("Failed to execute '"+n+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").");}function uw(n,t,i,r){return nrt(n,r,i.length-1),i[r][t]}function sc(n){return n===undefined||n.length===0?{length:0,start:function(){throw new Error("This TimeRanges object is empty");},end:function(){throw new Error("This TimeRanges object is empty");}}:{length:n.length,start:uw.bind(null,"start",0,n),end:uw.bind(null,"end",1,n)}}function er(n,t){return Array.isArray(n)?sc(n):n===undefined||t===undefined?sc():sc([[n,t]])}function fw(n,t){var u=0,f,r,i;if(!t)return 0;for(n&&n.length||(n=er(0,0)),i=0;i<n.length;i++)f=n.start(i),r=n.end(i),r>t&&(r=t),u+=r-f;return u/t}function ut(n){if(n instanceof ut)return n;typeof n=="number"?this.code=n:typeof n=="string"?this.message=n:wi(n)&&(typeof n.code=="number"&&(this.code=n.code),y(this,n));this.message||(this.message=ut.defaultMessages[this.code]||"")}function trt(n,t){var i,r=null;try{i=JSON.parse(n,t)}catch(u){r=u}return[r,i]}function yf(n){return n!==undefined&&n!==null&&typeof n.then=="function"}function fu(n){yf(n)&&n.then(null,function(){})}function vrt(n){var t=art.call(n);return t==="[object Function]"||typeof n=="function"&&t!=="[object RegExp]"||typeof window!="undefined"&&(n===window.setTimeout||n===window.alert||n===window.confirm||n===window.prompt)}function wrt(n,t){for(var i=0;i<n.length;i++)t(n[i])}function brt(n){for(var t in n)if(n.hasOwnProperty(t))return!1;return!0}function yw(n,t,i){var r=n;return lrt(t)?(i=t,typeof n=="string"&&(r={uri:n})):r=ve({},t,{uri:n}),r.callback=i,r}function ai(n,t,i){return t=yw(n,t,i),pw(t)}function pw(n){function w(){t.readyState===4&&setTimeout(v,0)}function b(){var n=undefined;if(n=t.response?t.response:t.responseText||krt(t),y)try{n=JSON.parse(n)}catch(i){}return n}function s(n){return clearTimeout(a),n instanceof Error||(n=new Error(""+(n||"Unknown XMLHttpRequest Error"))),n.statusCode=0,o(n,p)}function v(){var u,i,e;if(!f)return clearTimeout(a),u=n.useXDR&&t.status===undefined?200:t.status===1223?204:t.status,i=p,e=null,u!==0?(i={body:b(),statusCode:u,method:r,headers:{},url:h,rawRequest:t},t.getAllResponseHeaders&&(i.headers=yrt(t.getAllResponseHeaders()))):e=new Error("Internal XMLHttpRequest Error"),o(e,i,i.body)}var e,o,t;if(typeof n.callback=="undefined")throw new Error("callback argument missing");e=!1;o=function(t,i,r){e||(e=!0,n.callback(t,i,r))};t=n.xhr||null;t||(t=n.cors||n.useXDR?new ai.XDomainRequest:new ai.XMLHttpRequest);var u,f,h=t.url=n.uri||n.url,r=t.method=n.method||"GET",c=n.body||n.data,i=t.headers=n.headers||{},l=!!n.sync,y=!1,a,p={body:undefined,headers:{},statusCode:0,method:r,url:h,rawRequest:t};if("json"in n&&n.json!==!1&&(y=!0,i.accept||i.Accept||(i.Accept="application/json"),r!=="GET"&&r!=="HEAD"&&(i["content-type"]||i["Content-Type"]||(i["Content-Type"]="application/json"),c=JSON.stringify(n.json===!0?c:n.json))),t.onreadystatechange=w,t.onload=v,t.onerror=s,t.onprogress=function(){},t.onabort=function(){f=!0},t.ontimeout=s,t.open(r,h,!l,n.username,n.password),l||(t.withCredentials=!!n.withCredentials),!l&&n.timeout>0&&(a=setTimeout(function(){if(!f){f=!0;t.abort("timeout");var n=new Error("XMLHttpRequest timeout");n.code="ETIMEDOUT";s(n)}},n.timeout)),t.setRequestHeader)for(u in i)i.hasOwnProperty(u)&&t.setRequestHeader(u,i[u]);else if(n.headers&&!brt(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(t.responseType=n.responseType),"beforeSend"in n&&typeof n.beforeSend=="function"&&n.beforeSend(t),t.send(c||null),t}function krt(n){try{if(n.responseType==="document")return n.responseXML;var t=n.responseXML&&n.responseXML.documentElement.nodeName==="parsererror";if(n.responseType===""&&!t)return n.responseXML}catch(i){}return null}function drt(){}function wt(n,t){this.name="ParsingError";this.code=n.code;this.message=t||n.message}function kc(n){function i(n,t,i,r){return(n|0)*3600+(t|0)*60+(i|0)+(r|0)/1e3}var t=n.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?i(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?i(t[1],t[2],0,t[4]):i(0,t[1],t[2],t[4]):null}function wf(){this.values=ro(null)}function bf(n,t,i,r){var f=r?n.split(r):[n],e,u,o,s;for(e in f)typeof f[e]=="string"&&(u=f[e].split(i),u.length===2)&&(o=u[0],s=u[1],t(o,s))}function grt(n,t,i){function f(){var t=kc(n);if(t===null)throw new wt(wt.Errors.BadTimeStamp,"Malformed timestamp: "+u);return n=n.replace(/^[^\sa-zA-Z-]+/,""),t}function e(n,t){var r=new wf;bf(n,function(n,t){var f,u,e;switch(n){case"region":for(f=i.length-1;f>=0;f--)if(i[f].id===t){r.set(n,i[f].region);break}break;case"vertical":r.alt(n,t,["rl","lr"]);break;case"line":u=t.split(",");e=u[0];r.integer(n,e);r.percent(n,e)?r.set("snapToLines",!1):null;r.alt(n,e,["auto"]);u.length===2&&r.alt("lineAlign",u[1],["start","center","end"]);break;case"position":u=t.split(",");r.percent(n,u[0]);u.length===2&&r.alt("positionAlign",u[1],["start","center","end"]);break;case"size":r.percent(n,t);break;case"align":r.alt(n,t,["start","center","end","left","right"])}},/:/,/\s/);t.region=r.get("region",null);t.vertical=r.get("vertical","");try{t.line=r.get("line","auto")}catch(u){}t.lineAlign=r.get("lineAlign","start");t.snapToLines=r.get("snapToLines",!0);t.size=r.get("size",100);try{t.align=r.get("align","center")}catch(u){t.align=r.get("align","middle")}try{t.position=r.get("position","auto")}catch(u){t.position=r.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=r.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}function r(){n=n.replace(/^\s+/,"")}var u=n;if(r(),t.startTime=f(),r(),n.substr(0,3)!=="-->")throw new wt(wt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+u);n=n.substr(3);r();t.endTime=f();r();e(n,t)}function rb(n,t){function c(){function i(n){return t=t.substr(n.length),n}if(!t)return null;var n=t.match(/^([^<]*)(<[^>]*>?)?/);return i(n[1]?n[1]:n[2])}function l(n){return dc.innerHTML=n,n=dc.textContent,dc.textContent="",n}function a(n,t){return!ib[t.localName]||ib[t.localName]===n.localName}function v(t,i){var f=nut[t],r,u;return f?(r=n.document.createElement(f),u=tut[t],u&&i&&(r[u]=i.trim()),r):null}for(var h=n.document.createElement("div"),u=h,r,e=[],o,i,f,s;(r=c())!==null;){if(r[0]==="<"){if(r[1]==="/"){e.length&&e[e.length-1]===r.substr(2).replace(">","")&&(e.pop(),u=u.parentNode);continue}if(o=kc(r.substr(1,r.length-2)),o){i=n.document.createProcessingInstruction("timestamp",o);u.appendChild(i);continue}if(f=r.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/),!f)continue;if(i=v(f[1],f[3]),!i)continue;if(!a(u,i))continue;f[2]&&(s=f[2].split("."),s.forEach(function(n){var t=/^bg_/.test(n),r=t?n.slice(3):n,u,f;tb.hasOwnProperty(r)&&(u=t?"background-color":"color",f=tb[r],i.style[u]=f)}),i.className=s.join(" "));e.push(f[1]);u.appendChild(i);u=i;continue}u.appendChild(n.document.createTextNode(l(r)))}return h}function iut(n){for(var i,t=0;t<gc.length;t++)if(i=gc[t],n>=i[0]&&n<=i[1])return!0;return!1}function rut(n){function e(n,t){for(var i=t.childNodes.length-1;i>=0;i--)n.push(t.childNodes[i])}function r(n){var t,i,u;return!n||!n.length?null:(t=n.pop(),i=t.textContent||t.innerText,i)?(u=i.match(/^.*(\n|\r)/),u)?(n.length=0,u[0]):i:t.tagName==="ruby"?r(n):t.childNodes?(e(n,t),r(n)):void 0}var u=[],i="",f,t;if(!n||!n.childNodes)return"ltr";for(e(u,n);i=r(u);)for(t=0;t<i.length;t++)if(f=i.charCodeAt(t),iut(f))return"rtl";return"ltr"}function uut(n){var t;if(typeof n.line=="number"&&(n.snapToLines||n.line>=0&&n.line<=100))return n.line;if(!n.track||!n.track.textTrackList||!n.track.textTrackList.mediaElement)return-1;var r=n.track,i=r.textTrackList,u=0;for(t=0;t<i.length&&i[t]!==r;t++)i[t].mode==="showing"&&u++;return++u*-1}function uo(){}function fo(n,t,i){var u,r;uo.call(this);this.cue=t;this.cueDiv=rb(n,t.text);u={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:t.vertical===""?"horizontal-tb":t.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(u,this.cueDiv);this.div=n.document.createElement("div");u={direction:rut(this.cueDiv),writingMode:t.vertical===""?"horizontal-tb":t.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:t.align==="middle"?"center":t.align,font:i.font,whiteSpace:"pre-line",position:"absolute"};this.applyStyles(u);this.div.appendChild(this.cueDiv);r=0;switch(t.positionAlign){case"start":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":r=t.position-t.size}t.vertical===""?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(t.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(t.size,"%")});this.move=function(n){this.applyStyles({top:this.formatStyle(n.top,"px"),bottom:this.formatStyle(n.bottom,"px"),left:this.formatStyle(n.left,"px"),right:this.formatStyle(n.right,"px"),height:this.formatStyle(n.height,"px"),width:this.formatStyle(n.width,"px")})}}function ft(n){var i,r,f,u,t;n.div&&(r=n.div.offsetHeight,f=n.div.offsetWidth,u=n.div.offsetTop,t=(t=n.div.childNodes)&&(t=t[0])&&t.getClientRects&&t.getClientRects(),n=n.div.getBoundingClientRect(),i=t?Math.max(t[0]&&t[0].height||0,n.height/t.length):0);this.left=n.left;this.right=n.right;this.top=n.top||u;this.height=n.height||r;this.bottom=n.bottom||u+(n.height||r);this.width=n.width||f;this.lineHeight=i!==undefined?i:n.lineHeight}function fut(n,t,i,r){function y(n,t){for(var f,e,o=new ft(n),s=1,u=0;u<t.length;u++){while(n.overlapsOppositeAxis(i,t[u])||n.within(i)&&n.overlapsAny(r))n.move(t[u]);if(n.within(i))return n;f=n.intersectPercentage(i);s>f&&(e=new ft(n),s=f);n=new ft(o)}return e||o}var o=new ft(t),e=t.cue,f=uut(e),u=[],h,l,v;if(e.snapToLines){switch(e.vertical){case"":u=["+y","-y"];h="height";break;case"rl":u=["+x","-x"];h="width";break;case"lr":u=["-x","+x"];h="width"}var c=o.lineHeight,s=c*Math.round(f),a=i[h]+c,p=u[0];Math.abs(s)>a&&(s=(s<0?-1:1)*Math.ceil(a/c)*c);f<0&&(s+=e.vertical===""?i.height:i.width,u=u.reverse());o.move(p,s)}else{l=o.lineHeight/i.height*100;switch(e.lineAlign){case"center":f-=l/2;break;case"end":f-=l}switch(e.vertical){case"":t.applyStyles({top:t.formatStyle(f,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(f,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(f,"%")})}u=["+y","-x","+x","-y"];o=new ft(t)}v=y(o,u);t.move(v.toCSSCompatValues(i))}function hu(){}function vut(n){if(typeof n!="string")return!1;var t=lut[n.toLowerCase()];return t?n.toLowerCase():!1}function nl(n){if(typeof n!="string")return!1;var t=aut[n.toLowerCase()];return t?n.toLowerCase():!1}function ub(n,t,i){this.hasBeenReset=!1;var r="",u=!1,f=n,e=t,o=i,s=null,h="",c=!0,l="auto",a="start",v="auto",y="auto",p=100,w="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(n){r=""+n}},pauseOnExit:{enumerable:!0,get:function(){return u},set:function(n){u=!!n}},startTime:{enumerable:!0,get:function(){return f},set:function(n){if(typeof n!="number")throw new TypeError("Start time must be set to a number.");f=n;this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return e},set:function(n){if(typeof n!="number")throw new TypeError("End time must be set to a number.");e=n;this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(n){o=""+n;this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return s},set:function(n){s=n;this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return h},set:function(n){var t=vut(n);if(t===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");h=t;this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(n){c=!!n;this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return l},set:function(n){if(typeof n!="number"&&n!==cut)throw new SyntaxError("Line: an invalid number or illegal string was specified.");l=n;this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return a},set:function(n){var t=nl(n);t?(a=t,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return v},set:function(n){if(n<0||n>100)throw new Error("Position must be between 0 and 100.");v=n;this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return y},set:function(n){var t=nl(n);t?(y=t,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return p},set:function(n){if(n<0||n>100)throw new Error("Size must be between 0 and 100.");p=n;this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return w},set:function(n){var t=nl(n);if(!t)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");w=t;this.hasBeenReset=!0}}});this.displayState=undefined}function yut(n){if(typeof n!="string")return!1;var t=eb[n.toLowerCase()];return t?n.toLowerCase():!1}function kf(n){return typeof n=="number"&&n>=0&&n<=100}function put(){var n=100,t=3,i=0,r=100,u=0,f=100,e="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return n},set:function(t){if(!kf(t))throw new Error("Width must be between 0 and 100.");n=t}},lines:{enumerable:!0,get:function(){return t},set:function(n){if(typeof n!="number")throw new TypeError("Lines must be set to a number.");t=n}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(n){if(!kf(n))throw new Error("RegionAnchorX must be between 0 and 100.");r=n}},regionAnchorX:{enumerable:!0,get:function(){return i},set:function(n){if(!kf(n))throw new Error("RegionAnchorY must be between 0 and 100.");i=n}},viewportAnchorY:{enumerable:!0,get:function(){return f},set:function(n){if(!kf(n))throw new Error("ViewportAnchorY must be between 0 and 100.");f=n}},viewportAnchorX:{enumerable:!0,get:function(){return u},set:function(n){if(!kf(n))throw new Error("ViewportAnchorX must be between 0 and 100.");u=n}},scroll:{enumerable:!0,get:function(){return e},set:function(n){var t=yut(n);t===!1?console.warn("Scroll: an invalid or illegal string was specified."):e=t}}})}function but(n,t,i,r,u){var e,f;return u===void 0&&(u={}),e=n.textTracks(),u.kind=t,i&&(u.label=i),r&&(u.language=r),u.tech=n,f=new rt.text.TrackClass(u),e.addTrack(f),f}function kut(n,t){hr[n]=hr[n]||[];hr[n].push(t)}function dut(n,t,i){n.setTimeout(function(){return cr(t,hr[t.type],i,n)},1)}function gut(n,t){n.forEach(function(n){return n.setTech&&n.setTech(t)})}function ob(n,t,i){return n.reduceRight(il(i),t[i]())}function nft(n,t,i,r){return t[i](n.reduce(il(i),r))}function sb(n,t,i,r){r===void 0&&(r=null);var o="call"+b(i),u=n.reduce(il(o),r),f=u===eo,e=f?null:t[i](u);return rft(n,i,e,f),e}function il(n){return function(t,i){return t===eo?eo:i[n]?i[n](t):t}}function rft(n,t,i,r){for(var f,u=n.length-1;u>=0;u--)f=n[u],f[t]&&f[t](r,i)}function uft(n){tl[n.id()]=null}function fft(n,t){var r=tl[n.id()],i=null,u;if(r===undefined||r===null)return i=t(n),tl[n.id()]=[[t,i]],i;for(u=0;u<r.length;u++){var f=r[u],e=f[0],o=f[1];e===t&&(i=o)}return i===null&&(i=t(n),r.push([t,i])),i}function cr(n,t,i,r,u,f){var o;n===void 0&&(n={});t===void 0&&(t=[]);u===void 0&&(u=[]);f===void 0&&(f=!1);var h=t,s=h[0],e=h.slice(1);if(typeof s=="string")cr(n,hr[s],i,r,u,f);else if(s){if(o=fft(r,s),!o.setSource)return u.push(o),cr(n,e,i,r,u,f);o.setSource(y({},n),function(t,s){if(t)return cr(n,e,i,r,u,f);u.push(o);cr(s,n.type===s.type?e:hr[s.type],i,r,u,f)})}else e.length?cr(n,e,i,r,u,f):f?i(n,u):cr(n,hr["*"],i,r,u,!0)}function lb(n){if(!n.type){var t=oo(n.src);t&&(n.type=t)}return n}function rl(n,t){var i;if(n.length===4)i=n[1]+n[1]+n[2]+n[2]+n[3]+n[3];else if(n.length===7)i=n.slice(1);else throw new Error("Invalid color code provided, "+n+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(i.slice(0,2),16)+","+parseInt(i.slice(2,4),16)+","+parseInt(i.slice(4,6),16)+","+t+")"}function ul(n,t,i){try{n.style[t]=i}catch(r){return}}function hft(n){so=n}function cft(){so=ol}function cu(n,t){return t===void 0&&(t=n),so(n,t)}function wk(n,t){return t&&(n=t(n)),n&&n!=="none"?n:void 0}function lft(n,t){var i=n.options[n.options.selectedIndex].value;return wk(i,t)}function aft(n,t,i){if(t)for(var r=0;r<n.options.length;r++)if(wk(n.options[r].value,i)===t){n.selectedIndex=r;break}}function gft(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,writable:!0,configurable:!0}});t&&ud(n,t)}function i(n,t,u){var e=i.getPlayer(n),f,o;if(e)return t&&h.warn('Player "'+n+'" is already initialised. Options will not be applied.'),u&&e.ready(u),e;if(f=typeof n=="string"?bi("#"+od(n)):n,!ef(f))throw new TypeError("The element or ID supplied is not valid. (videojs)");return f.ownerDocument.defaultView&&f.ownerDocument.body.contains(f)||h.warn("The element supplied is not included in the DOM"),t=t||{},i.hooks("beforesetup").forEach(function(n){var i=n(f,v(t));if(!wi(i)||Array.isArray(i)){h.error("please return an object in beforesetup hooks");return}t=v(t,i)}),o=r.getComponent("Player"),e=new o(f,t,u),i.hooks("setup").forEach(function(n){return n(e)}),e}function aa(){return aa=Object.assign||function(n){for(var i,r,t=1;t<arguments.length;t++){i=arguments[t];for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n},aa.apply(this,arguments)}function va(n,t){n.prototype=Object.create(t.prototype);n.prototype.constructor=n;n.__proto__=t}function iet(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function eet(t){for(var r=n.atob(t||""),u=new Uint8Array(r.length),i=0;i<r.length;i++)u[i]=r.charCodeAt(i);return u}function cet(n,t){return t={exports:{}},n(t,t.exports),t.exports}function lot(t){for(var r=n.atob(t),u=new Uint8Array(r.length),i=0;i<r.length;i++)u[i]=r.charCodeAt(i);return u}function fct(n){return n.subarray(0,n.byteLength-n[n.byteLength-1])}function gn(n,t){return function(i){var u=this,e,f,r;if(t){if(tf&&!i)return e=t.toString().replace(/^function.+?{/,"").slice(0,-1),f=ntt(e),this[yv]=new tf(f),hat(this[yv],f),this[yv];r={postMessage:function(n){u.onmessage&&setTimeout(function(){u.onmessage({data:n,target:r})})}};t.call(r);this.postMessage=function(n){setTimeout(function(){r.onmessage({data:n,target:u})})};this.isThisThread=!0}else return new tf(n)}}function ntt(n){try{return nf.createObjectURL(new Blob([n],{type:oat}))}catch(i){var t=new sat;return t.append(n),nf.createObjectURL(t.getBlob(type))}}function hat(n,t){if(n&&t){var i=n.terminate;n.objURL=t;n.terminate=function(){n.objURL&&nf.revokeObjectURL(n.objURL);i.call(n)}}}function uf(){}var h,ah,hp,tt,be,lp,ap,cf,bp,r,o,af,vf,or,ow,sr,hw,pt,su,rt,ro,gc,fb,eb,a,ab,gf,vb,pb,wb,dt,fl,bb,el,ol,so,lr,ho,co,kb,lo,db,sl,ao,vo,yo,gb,nk,po,hl,ll,al,vl,ik,rk,bo,yl,uk,pl,wl,ko,go,ns,fk,lu,au,bl,ar,kl,ts,is,rs,us,fs,dl,es,gl,na,os,ta,ia,ek,ne,ra,bk,kk,dk,gk,ss,rd,k,vu,te,ys,la,bs,at,hh,pv,wv,ty,ht;n=n&&n.hasOwnProperty("default")?n["default"]:n;t=t&&t.hasOwnProperty("default")?t["default"]:t;var hy="7.7.5",ct=[],fit=function(t,i){return function(r,u,f){var s=i.levels[u],h=new RegExp("^("+s+")$"),o,e;(r!=="log"&&f.unshift(r.toUpperCase()+":"),f.unshift(t+":"),ct&&(ct.push([].concat(f)),o=ct.length-1e3,ct.splice(0,o>0?o:0)),n.console)&&(e=n.console[r],e||r!=="debug"||(e=n.console.info||n.console.log),e&&s&&h.test(r))&&e[Array.isArray(f)?"apply":"call"](n.console,f)}};h=cy("VIDEOJS");ah=h.createLogger;var ve=dr(function(n){function t(){return n.exports=t=Object.assign||function(n){for(var i,r,t=1;t<arguments.length;t++){i=arguments[t];for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n},t.apply(this,arguments)}n.exports=t}),eit=Object.prototype.toString,ly=function(n){return wi(n)?Object.keys(n):[]};var bi=py("querySelector"),up=py("querySelectorAll"),fp=Object.freeze({isReal:nu,isEl:ef,isInFrame:yy,createEl:w,textContent:tu,prependTo:vh,hasClass:ir,addClass:si,removeClass:of,toggleClass:wy,setAttributes:by,getAttributes:hi,getAttribute:ky,setAttribute:sf,removeAttribute:pe,blockTextSelection:dy,unblockTextSelection:gy,getBoundingClientRect:hf,findPosition:np,getPointerPosition:yh,isTextNode:tp,emptyEl:ph,normalizeContent:ip,appendContent:wh,insertContent:rp,isSingleLeftClick:iu,$:bi,$$:up}),ep=!1,bh,hit=function(){var r,u,n,f;if(nu()&&bh.options.autoSetup!==!1){var e=Array.prototype.slice.call(t.getElementsByTagName("video")),o=Array.prototype.slice.call(t.getElementsByTagName("audio")),s=Array.prototype.slice.call(t.getElementsByTagName("video-js")),i=e.concat(o,s);if(i&&i.length>0)for(r=0,u=i.length;r<u;r++)if(n=i[r],n&&n.getAttribute)n.player===undefined&&(f=n.getAttribute("data-setup"),f!==null&&bh(n));else{kh(1);break}else ep||kh(1)}};nu()&&(t.readyState==="complete"?dh():n.addEventListener("load",dh));var op=function(n){var i=t.createElement("style");return i.className=n,i},sp=function(n,t){n.styleSheet?n.styleSheet.cssText=t:n.textContent=t},cit=3;n.WeakMap||(hp=function(){function i(){this.vdata="vdata"+Math.floor(n.performance&&n.performance.now()||Date.now());this.data={}}var t=i.prototype;return t.set=function(n,t){var i=n[this.vdata]||ki();return n[this.vdata]||(n[this.vdata]=i),this.data[i]=t,this},t.get=function(n){var t=n[this.vdata];return t?this.data[t]:(h("We have no data for this element",n),undefined)},t.has=function(n){var t=n[this.vdata];return t in this.data},t["delete"]=function(n){var t=n[this.vdata];t&&(delete this.data[t],delete n[this.vdata])},i}());tt=n.WeakMap?new WeakMap:new hp;lp=function(){if(typeof be!="boolean"){be=!1;try{var t=Object.defineProperty({},"passive",{get:function(){be=!0}});n.addEventListener("test",null,t);n.removeEventListener("test",null,t)}catch(r){}}return be};ap=["touchstart","touchmove"];var lit=Object.freeze({fixEvent:we,on:yt,off:it,trigger:ru,one:ke,any:vp}),ci=30,s=function(n,t,i){t.guid||(t.guid=ki());var r=t.bind(n);return r.guid=i?i+"_"+t.guid:t.guid,r},rr=function(t,i){var r=n.performance.now();return function(){var u=n.performance.now();u-r>=i&&(t.apply(void 0,arguments),r=u)}},ait=function(t,i,r,u){u===void 0&&(u=n);var f,o=function(){u.clearTimeout(f);f=null},e=function(){var n=this,e=arguments,o=function(){f=null;o=null;r||t.apply(n,e)};!f&&r&&t.apply(n,e);u.clearTimeout(f);f=u.setTimeout(o,i)};return e.cancel=o,e},d=function(){};d.prototype.allowedEvents_={};d.prototype.on=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};yt(this,n,t);this.addEventListener=i};d.prototype.addEventListener=d.prototype.on;d.prototype.off=function(n,t){it(this,n,t)};d.prototype.removeEventListener=d.prototype.off;d.prototype.one=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};ke(this,n,t);this.addEventListener=i};d.prototype.any=function(n,t){var i=this.addEventListener;this.addEventListener=function(){};vp(this,n,t);this.addEventListener=i};d.prototype.trigger=function(n){var t=n.type||n;typeof n=="string"&&(n={type:t});n=we(n);this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](n);ru(this,n)};d.prototype.dispatchEvent=d.prototype.trigger;d.prototype.queueTrigger=function(t){var u=this,r,i,f,e;cf||(cf=new Map);r=t.type||t;i=cf.get(this);i||(i=new Map,cf.set(this,i));f=i.get(r);i["delete"](r);n.clearTimeout(f);e=n.setTimeout(function(){i.size===0&&(i=null,cf["delete"](u));u.trigger(t)},0);i.set(r,e)};var ur=function(n){return n instanceof d||!!n.eventBusEl_&&["on","one","off","trigger"].every(function(t){return typeof n[t]=="function"})},vit=function(n,t){ur(n)?t():(n.eventedCallbacks||(n.eventedCallbacks=[]),n.eventedCallbacks.push(t))},yp=function(n){return typeof n=="string"&&/\S/.test(n)||Array.isArray(n)&&!!n.length},nc=function(n){if(!n.nodeName&&!ur(n))throw new Error("Invalid target; must be a DOM node or evented object.");},pp=function(n){if(!yp(n))throw new Error("Invalid event type; must be a non-empty string or array.");},wp=function(n){if(typeof n!="function")throw new Error("Invalid listener; must be a function.");},tc=function(n,t){var f=t.length<3||t[0]===n||t[0]===n.eventBusEl_,r,u,i;return f?(r=n.eventBusEl_,t.length>=3&&t.shift(),u=t[0],i=t[1]):(r=t[0],u=t[1],i=t[2]),nc(r),pp(u),wp(i),i=s(n,i),{isTargetingSelf:f,target:r,type:u,listener:i}},fr=function(n,t,i,r){nc(n);n.nodeName?lit[t](n,i,r):n[t](i,r)},yit={on:function(){for(var r,f,e=this,o=arguments.length,s=new Array(o),n=0;n<o;n++)s[n]=arguments[n];var t=tc(this,s),c=t.isTargetingSelf,u=t.target,h=t.type,i=t.listener;fr(u,"on",h,i);c||(r=function(){return e.off(u,h,i)},r.guid=i.guid,f=function(){return e.off("dispose",r)},f.guid=i.guid,fr(this,"on","dispose",r),fr(u,"on","dispose",f))},one:function(){for(var i,s=this,e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];var t=tc(this,o),h=t.isTargetingSelf,r=t.target,u=t.type,f=t.listener;h?fr(r,"one",u,f):(i=function i(){s.off(r,u,i);for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];f.apply(null,e)},i.guid=f.guid,fr(r,"one",u,i))},any:function(){for(var i,s=this,e=arguments.length,o=new Array(e),n=0;n<e;n++)o[n]=arguments[n];var t=tc(this,o),h=t.isTargetingSelf,r=t.target,u=t.type,f=t.listener;h?fr(r,"any",u,f):(i=function i(){s.off(r,u,i);for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];f.apply(null,e)},i.guid=f.guid,fr(r,"any",u,i))},off:function(n,t,i){if(!n||yp(n))it(this.eventBusEl_,n,t);else{var r=n,u=t;nc(r);pp(u);wp(i);i=s(this,i);this.off("dispose",i);r.nodeName?(it(r,u,i),it(r,"dispose",i)):ur(r)&&(r.off(u,i),r.off("dispose",i))}},trigger:function(n,t){return ru(this.eventBusEl_,n,t)}};bp={state:{},setState:function(n){var i=this,t;return typeof n=="function"&&(n=n()),gr(n,function(n,r){i.state[r]!==n&&(t=t||{},t[r]={from:i.state[r],to:n});i.state[r]=n}),t&&ur(this)&&this.trigger({changes:t,type:"statechanged"}),t}};var de=function(n){return typeof n!="string"?n:n.replace(/./,function(n){return n.toLowerCase()})},b=function(n){return typeof n!="string"?n:n.replace(/./,function(n){return n.toUpperCase()})},pit=function(n,t){return b(n)===b(t)};r=function(){function i(t,i,r){var f,u;this.player_=!t&&this.play?t=this:t;this.isDisposed_=!1;this.parentComponent_=null;this.options_=v({},this.options_);i=this.options_=v(this.options_,i);this.id_=i.id||i.el&&i.el.id;this.id_||(f=t&&t.id&&t.id()||"no_player",this.id_=f+"_component_"+ki());this.name_=i.name||null;i.el?this.el_=i.el:i.createEl!==!1&&(this.el_=this.createEl());i.evented!==!1&&ic(this,{eventBusKey:this.el_?"el_":null});kp(this,this.constructor.defaultState);this.children_=[];this.childIndex_={};this.childNameIndex_={};n.Set||(u=function(){function t(){this.set_={}}var n=t.prototype;return n.has=function(n){return n in this.set_},n["delete"]=function(n){var t=this.has(n);return delete this.set_[n],t},n.add=function(n){return this.set_[n]=1,this},n.forEach=function(n,t){for(var i in this.set_)n.call(t,i,i,this)},t}());this.setTimeoutIds_=n.Set?new Set:new u;this.setIntervalIds_=n.Set?new Set:new u;this.rafIds_=n.Set?new Set:new u;this.clearingTimersOnDispose_=!1;i.initChildren!==!1&&this.initChildren();this.ready(r);i.reportTouchActivity!==!1&&this.enableTouchActivity()}var t=i.prototype;return t.dispose=function(){if(!this.isDisposed_){if(this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var n=this.children_.length-1;n>=0;n--)this.children_[n].dispose&&this.children_[n].dispose();this.children_=null;this.childIndex_=null;this.childNameIndex_=null;this.parentComponent_=null;this.el_&&(this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),tt.has(this.el_)&&tt["delete"](this.el_),this.el_=null);this.player_=null}},t.isDisposed=function(){return Boolean(this.isDisposed_)},t.player=function(){return this.player_},t.options=function(n){return n?(this.options_=v(this.options_,n),this.options_):this.options_},t.el=function(){return this.el_},t.createEl=function(n,t,i){return w(n,t,i)},t.localize=function(n,t,i){i===void 0&&(i=n);var f=this.player_.language&&this.player_.language(),u=this.player_.languages&&this.player_.languages(),e=u&&u[f],s=f&&f.split("-")[0],o=u&&u[s],r=i;return e&&e[n]?r=e[n]:o&&o[n]&&(r=o[n]),t&&(r=r.replace(/\{(\d+)\}/g,function(n,i){var r=t[i-1],u=r;return typeof r=="undefined"&&(u=n),u})),r},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(n){return this.childIndex_[n]},t.getChild=function(n){if(n)return this.childNameIndex_[n]},t.addChild=function(n,t,r){var u,f,o,e,s;if(t===void 0&&(t={}),r===void 0&&(r=this.children_.length),typeof n=="string"){if(f=b(n),o=t.componentClass||f,t.name=f,e=i.getComponent(o),!e)throw new Error("Component "+o+" does not exist");if(typeof e!="function")return null;u=new e(this.player_||this,t)}else u=n;return u.parentComponent_&&u.parentComponent_.removeChild(u),this.children_.splice(r,0,u),u.parentComponent_=this,typeof u.id=="function"&&(this.childIndex_[u.id()]=u),f=f||u.name&&b(u.name()),f&&(this.childNameIndex_[f]=u,this.childNameIndex_[de(f)]=u),typeof u.el=="function"&&u.el()&&(s=null,this.children_[r+1]&&this.children_[r+1].el_&&(s=this.children_[r+1].el_),this.contentEl().insertBefore(u.el(),s)),u},t.removeChild=function(n){var i,t,r;if(typeof n=="string"&&(n=this.getChild(n)),n&&this.children_){for(i=!1,t=this.children_.length-1;t>=0;t--)if(this.children_[t]===n){i=!0;this.children_.splice(t,1);break}i&&(n.parentComponent_=null,this.childIndex_[n.id()]=null,this.childNameIndex_[b(n.name())]=null,this.childNameIndex_[de(n.name())]=null,r=n.el(),r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(n.el()))}},t.initChildren=function(){var t=this,n=this.options_.children;if(n){var u=this.options_,f=function(n){var r=n.name,i=n.opts,f;(u[r]!==undefined&&(i=u[r]),i!==!1)&&(i===!0&&(i={}),i.playerOptions=t.options_.playerOptions,f=t.addChild(r,i),f&&(t[r]=f))},r,e=i.getComponent("Tech");r=Array.isArray(n)?n:Object.keys(n);r.concat(Object.keys(this.options_).filter(function(n){return!r.some(function(t){return typeof t=="string"?n===t:n===t.name})})).map(function(i){var r,u;return typeof i=="string"?(r=i,u=n[r]||t.options_[r]||{}):(r=i.name,u=i),{name:r,opts:u}}).filter(function(n){var t=i.getComponent(n.opts.componentClass||b(n.name));return t&&!e.isTech(t)}).forEach(f)}},t.buildCSSClass=function(){return""},t.ready=function(n,t){if(t===void 0&&(t=!1),n){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[];this.readyQueue_.push(n);return}t?n.call(this):this.setTimeout(n,1)}},t.triggerReady=function(){this.isReady_=!0;this.setTimeout(function(){var n=this.readyQueue_;this.readyQueue_=[];n&&n.length>0&&n.forEach(function(n){n.call(this)},this);this.trigger("ready")},1)},t.$=function(n,t){return bi(n,t||this.contentEl())},t.$$=function(n,t){return up(n,t||this.contentEl())},t.hasClass=function(n){return ir(this.el_,n)},t.addClass=function(n){si(this.el_,n)},t.removeClass=function(n){of(this.el_,n)},t.toggleClass=function(n,t){wy(this.el_,n,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(n){return ky(this.el_,n)},t.setAttribute=function(n,t){sf(this.el_,n,t)},t.removeAttribute=function(n){pe(this.el_,n)},t.width=function(n,t){return this.dimension("width",n,t)},t.height=function(n,t){return this.dimension("height",n,t)},t.dimensions=function(n,t){this.width(n,!0);this.height(t)},t.dimension=function(n,t,i){if(t!==undefined){(t===null||t!==t)&&(t=0);this.el_.style[n]=(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?t:t==="auto"?"":t+"px";i||this.trigger("componentresize");return}if(!this.el_)return 0;var r=this.el_.style[n],u=r.indexOf("px");return u!==-1?parseInt(r.slice(0,u),10):parseInt(this.el_["offset"+b(n)],10)},t.currentDimension=function(n){var t=0,i;if(n!=="width"&&n!=="height")throw new Error("currentDimension only accepts width or height value");return t=ye(this.el_,n),t=parseFloat(t),(t===0||isNaN(t))&&(i="offset"+b(n),t=this.el_[i]),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(n){this.player_&&(n.stopPropagation(),this.player_.handleKeyDown(n))},t.handleKeyPress=function(n){this.handleKeyDown(n)},t.emitTapEvents=function(){var u=0,t=null,f=10,e=200,i,r;this.on("touchstart",function(r){r.touches.length===1&&(t={pageX:r.touches[0].pageX,pageY:r.touches[0].pageY},u=n.performance.now(),i=!0)});this.on("touchmove",function(n){if(n.touches.length>1)i=!1;else if(t){var r=n.touches[0].pageX-t.pageX,u=n.touches[0].pageY-t.pageY,e=Math.sqrt(r*r+u*u);e>f&&(i=!1)}});r=function(){i=!1};this.on("touchleave",r);this.on("touchcancel",r);this.on("touchend",function(r){if(t=null,i===!0){var f=n.performance.now()-u;f<e&&(r.preventDefault(),this.trigger("tap"))}})},t.enableTouchActivity=function(){var n,t,i;if(this.player()&&this.player().reportUserActivity){n=s(this.player(),this.player().reportUserActivity);this.on("touchstart",function(){n();this.clearInterval(t);t=this.setInterval(n,250)});i=function(){n();this.clearInterval(t)};this.on("touchmove",n);this.on("touchend",i);this.on("touchcancel",i)}},t.setTimeout=function(t,i){var u=this,r;return t=s(this,t),this.clearTimersOnDispose_(),r=n.setTimeout(function(){u.setTimeoutIds_.has(r)&&u.setTimeoutIds_["delete"](r);t()},i),this.setTimeoutIds_.add(r),r},t.clearTimeout=function(t){return this.setTimeoutIds_.has(t)&&(this.setTimeoutIds_["delete"](t),n.clearTimeout(t)),t},t.setInterval=function(t,i){t=s(this,t);this.clearTimersOnDispose_();var r=n.setInterval(t,i);return this.setIntervalIds_.add(r),r},t.clearInterval=function(t){return this.setIntervalIds_.has(t)&&(this.setIntervalIds_["delete"](t),n.clearInterval(t)),t},t.requestAnimationFrame=function(t){var r=this,i;return this.supportsRaf_?(this.clearTimersOnDispose_(),t=s(this,t),i=n.requestAnimationFrame(function(){r.rafIds_.has(i)&&r.rafIds_["delete"](i);t()}),this.rafIds_.add(i),i):this.setTimeout(t,1e3/60)},t.cancelAnimationFrame=function(t){return this.supportsRaf_?(this.rafIds_.has(t)&&(this.rafIds_["delete"](t),n.cancelAnimationFrame(t)),t):this.clearTimeout(t)},t.clearTimersOnDispose_=function(){var n=this;if(!this.clearingTimersOnDispose_){this.clearingTimersOnDispose_=!0;this.one("dispose",function(){[["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(t){var i=t[0],r=t[1];n[i].forEach(n[r],n)});n.clearingTimersOnDispose_=!1})}},i.registerComponent=function(n,t){var s,r,u,f;if(typeof n!="string"||!n)throw new Error('Illegal component name, "'+n+'"; must be a non-empty string.');var e=i.getComponent("Tech"),o=e&&e.isTech(t),h=i===t||i.prototype.isPrototypeOf(t.prototype);if(o||!h){s=o?"techs must be registered using Tech.registerTech()":"must be a Component subclass";throw new Error('Illegal component, "'+n+'"; '+s+".");}if(n=b(n),i.components_||(i.components_={}),r=i.getComponent("Player"),n==="Player"&&r&&r.players&&(u=r.players,f=Object.keys(u),u&&f.length>0&&f.map(function(n){return u[n]}).every(Boolean)))throw new Error("Can not register Player component after player has been created.");return i.components_[n]=t,i.components_[de(n)]=t,t},i.getComponent=function(n){if(n&&i.components_)return i.components_[n]},i}();r.prototype.supportsRaf_=typeof n.requestAnimationFrame=="function"&&typeof n.cancelAnimationFrame=="function";r.registerComponent("Component",r);o=wit;var u=bit,g=n.navigator&&n.navigator.userAgent||"",dp=/AppleWebKit\/([\d.]+)/i.exec(g),kit=dp?parseFloat(dp.pop()):null,gp=/iPod/i.test(g),dit=function(){var n=g.match(/OS (\d+)_/i);return n&&n[1]?n[1]:null}(),di=/Android/i.test(g),rc=function(){var n=g.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i),t,i;return n?(t=n[1]&&parseFloat(n[1]),i=n[2]&&parseFloat(n[2]),t&&i)?parseFloat(n[1]+"."+n[2]):t?t:null:null}(),nw=di&&rc<5&&kit<537,tw=/Firefox/i.test(g),ge=/Edge/i.test(g),li=!ge&&(/Chrome/i.test(g)||/CriOS/i.test(g)),iw=function(){var n=g.match(/(Chrome|CriOS)\/(\d+)/);return n&&n[2]?parseFloat(n[2]):null}(),no=function(){var t=/MSIE\s(\d+)\.\d/.exec(g),n=t&&parseFloat(t[1]);return!n&&/Trident\/7.0/i.test(g)&&/rv:11.0/.test(g)&&(n=11),n}(),uc=/Safari/i.test(g)&&!li&&!di&&!ge,rw=/Windows/i.test(g),uu=nu()&&("ontouchstart"in n||n.navigator.maxTouchPoints||n.DocumentTouch&&n.document instanceof n.DocumentTouch),fc=/iPad/i.test(g)||uc&&uu&&!/iPhone/i.test(g),ec=/iPhone/i.test(g)&&!fc,ri=ec||fc||gp,oc=(uc||ri)&&!li,git=Object.freeze({IS_IPOD:gp,IOS_VERSION:dit,IS_ANDROID:di,ANDROID_VERSION:rc,IS_NATIVE_ANDROID:nw,IS_FIREFOX:tw,IS_EDGE:ge,IS_CHROME:li,CHROME_VERSION:iw,IE_VERSION:no,IS_SAFARI:uc,IS_WINDOWS:rw,TOUCH_ENABLED:uu,IS_IPAD:fc,IS_IPHONE:ec,IS_IOS:ri,IS_ANY_SAFARI:oc});var hc={prefixed:!0},to=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror","-moz-full-screen"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError","-ms-fullscreen"]],ew=to[0],lf;for(af=0;af<to.length;af++)if(to[af][1]in t){lf=to[af];break}if(lf){for(vf=0;vf<lf.length;vf++)hc[ew[vf]]=lf[vf];hc.prefixed=lf[0]!==ew[0]}for(ut.prototype.code=0,ut.prototype.message="",ut.prototype.status=null,ut.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],ut.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."},or=0;or<ut.errorTypes.length;or++)ut[ut.errorTypes[or]]=or,ut.prototype[ut.errorTypes[or]]=or;ow=trt;var cc=function(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(t,i){return n[i]&&(t[i]=n[i]),t},{cues:n.cues&&Array.prototype.map.call(n.cues,function(n){return{startTime:n.startTime,endTime:n.endTime,text:n.text,id:n.id}})})},irt=function(n){var t=n.$$("track"),i=Array.prototype.map.call(t,function(n){return n.track}),r=Array.prototype.map.call(t,function(n){var t=cc(n.track);return n.src&&(t.src=n.src),t});return r.concat(Array.prototype.filter.call(n.textTracks(),function(n){return i.indexOf(n)===-1}).map(cc))},rrt=function(n,t){return n.forEach(function(n){var i=t.addRemoteTextTrack(n).track;!n.src&&n.cues&&n.cues.forEach(function(n){return i.addCue(n)})}),t.textTracks()},sw={textTracksToJson:irt,jsonToTextTracks:rrt,trackToJson_:cc},e=dr(function(n,t){function o(n){var e,i,t;return(n&&"object"==typeof n&&(e=n.which||n.keyCode||n.charCode,e&&(n=e)),"number"==typeof n)?f[n]:(i=String(n),t=r[i.toLowerCase()],t)?t:(t=u[i.toLowerCase()],t)?t:i.length===1?i.charCodeAt(0):undefined}var r,u,i,f,e;for(o.isEventKey=function(n,t){var i,f;if(n&&"object"==typeof n){if(i=n.which||n.keyCode||n.charCode,i===null||i===undefined)return!1;if(typeof t=="string"){if((f=r[t.toLowerCase()],f)||(f=u[t.toLowerCase()],f))return f===i}else if(typeof t=="number")return t===i;return!1}},t=n.exports=o,r=t.code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},u=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,"break":19,caps:20,"return":13,escape:27,spc:32,spacebar:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91},i=97;i<123;i++)r[String.fromCharCode(i)]=i-32;for(i=48;i<58;i++)r[i-48]=i;for(i=1;i<13;i++)r["f"+i]=i+111;for(i=0;i<10;i++)r["numpad "+i]=i+96;f=t.names=t.title={};for(i in r)f[r[i]]=i;for(e in u)r[e]=u[e]}),ypt=e.code,ppt=e.codes,wpt=e.aliases,bpt=e.names,kpt=e.title,lc="vjs-modal-dialog",eu=function(i){function f(n,t){var r;return r=i.call(this,n,t)||this,r.opened_=r.hasBeenOpened_=r.hasBeenFilled_=!1,r.closeable(!r.options_.uncloseable),r.content(r.options_.content),r.contentEl_=w("div",{className:lc+"-content"},{role:"document"}),r.descEl_=w("p",{className:lc+"-description vjs-control-text",id:r.el().getAttribute("aria-describedby")}),tu(r.descEl_,r.description()),r.el_.appendChild(r.descEl_),r.el_.appendChild(r.contentEl_),r}u(f,i);var r=f.prototype;return r.createEl=function(){return i.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},r.dispose=function(){this.contentEl_=null;this.descEl_=null;this.previouslyActiveEl_=null;i.prototype.dispose.call(this)},r.buildCSSClass=function(){return lc+" vjs-hidden "+i.prototype.buildCSSClass.call(this)},r.label=function(){return this.localize(this.options_.label||"Modal Window")},r.description=function(){var n=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(n+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),n},r.open=function(){if(!this.opened_){var n=this.player();this.trigger("beforemodalopen");this.opened_=!0;!this.options_.fillAlways&&(this.hasBeenOpened_||this.hasBeenFilled_)||this.fill();this.wasPlaying_=!n.paused();this.options_.pauseOnOpen&&this.wasPlaying_&&n.pause();this.on("keydown",this.handleKeyDown);this.hadControls_=n.controls();n.controls(!1);this.show();this.conditionalFocus_();this.el().setAttribute("aria-hidden","false");this.trigger("modalopen");this.hasBeenOpened_=!0}},r.opened=function(n){return typeof n=="boolean"&&this[n?"open":"close"](),this.opened_},r.close=function(){if(this.opened_){var n=this.player();this.trigger("beforemodalclose");this.opened_=!1;this.wasPlaying_&&this.options_.pauseOnOpen&&n.play();this.off("keydown",this.handleKeyDown);this.hadControls_&&n.controls(!0);this.hide();this.el().setAttribute("aria-hidden","true");this.trigger("modalclose");this.conditionalBlur_();this.options_.temporary&&this.dispose()}},r.closeable=function(n){var i,t,r;if(typeof n=="boolean"){if(i=this.closeable_=!!n,t=this.getChild("closeButton"),i&&!t){r=this.contentEl_;this.contentEl_=this.el_;t=this.addChild("closeButton",{controlText:"Close Modal Dialog"});this.contentEl_=r;this.on(t,"close",this.close)}!i&&t&&(this.off(t,"close",this.close),this.removeChild(t),t.dispose())}return this.closeable_},r.fill=function(){this.fillWith(this.content())},r.fillWith=function(n){var t=this.contentEl(),i=t.parentNode,u=t.nextSibling,r;this.trigger("beforemodalfill");this.hasBeenFilled_=!0;i.removeChild(t);this.empty();rp(t,n);this.trigger("modalfill");u?i.insertBefore(t,u):i.appendChild(t);r=this.getChild("closeButton");r&&i.appendChild(r.el_)},r.empty=function(){this.trigger("beforemodalempty");ph(this.contentEl());this.trigger("modalempty")},r.content=function(n){return typeof n!="undefined"&&(this.content_=n),this.content_},r.conditionalFocus_=function(){var n=t.activeElement,i=this.player_.el_;this.previouslyActiveEl_=null;(i.contains(n)||i===n)&&(this.previouslyActiveEl_=n,this.focus())},r.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},r.handleKeyDown=function(n){var i,f,u,r;if(n.stopPropagation(),e.isEventKey(n,"Escape")&&this.closeable()){n.preventDefault();this.close();return}if(e.isEventKey(n,"Tab")){for(i=this.focusableEls_(),f=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(f===i[r]){u=r;break}t.activeElement===this.el_&&(u=0);n.shiftKey&&u===0?(i[i.length-1].focus(),n.preventDefault()):n.shiftKey||u!==i.length-1||(i[0].focus(),n.preventDefault())}},r.focusableEls_=function(){var t=this.el_.querySelectorAll("*");return Array.prototype.filter.call(t,function(t){return(t instanceof n.HTMLAnchorElement||t instanceof n.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof n.HTMLInputElement||t instanceof n.HTMLSelectElement||t instanceof n.HTMLTextAreaElement||t instanceof n.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof n.HTMLIFrameElement||t instanceof n.HTMLObjectElement||t instanceof n.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable")})},f}(r);eu.prototype.options_={pauseOnOpen:!0,temporary:!0};r.registerComponent("ModalDialog",eu);sr=function(n){function t(t){var i,r;for(t===void 0&&(t=[]),i=n.call(this)||this,i.tracks_=[],Object.defineProperty(o(i),"length",{get:function(){return this.tracks_.length}}),r=0;r<t.length;r++)i.addTrack(t[r]);return i}u(t,n);var i=t.prototype;return i.addTrack=function(n){var t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.tracks_[t]}});this.tracks_.indexOf(n)===-1&&(this.tracks_.push(n),this.trigger({track:n,type:"addtrack",target:this}))},i.removeTrack=function(n){for(var t,i=0,r=this.length;i<r;i++)if(this[i]===n){t=this[i];t.off&&t.off();this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},i.getTrackById=function(n){for(var i,r=null,t=0,u=this.length;t<u;t++)if(i=this[t],i.id===n){r=i;break}return r},t}(d);sr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack"};for(hw in sr.prototype.allowedEvents_)sr.prototype["on"+hw]=null;var ac=function(n,t){for(var i=0;i<n.length;i++)Object.keys(n[i]).length&&t.id!==n[i].id&&(n[i].enabled=!1)},urt=function(n){function t(t){var r,i;for(t===void 0&&(t=[]),i=t.length-1;i>=0;i--)if(t[i].enabled){ac(t,t[i]);break}return r=n.call(this,t)||this,r.changing_=!1,r}u(t,n);var i=t.prototype;return i.addTrack=function(t){var i=this;(t.enabled&&ac(this,t),n.prototype.addTrack.call(this,t),t.addEventListener)&&(t.enabledChange_=function(){i.changing_||(i.changing_=!0,ac(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("enabledchange",t.enabledChange_))},i.removeTrack=function(t){n.prototype.removeTrack.call(this,t);t.removeEventListener&&t.enabledChange_&&(t.removeEventListener("enabledchange",t.enabledChange_),t.enabledChange_=null)},t}(sr),vc=function(n,t){for(var i=0;i<n.length;i++)Object.keys(n[i]).length&&t.id!==n[i].id&&(n[i].selected=!1)},frt=function(n){function t(t){var r,i;for(t===void 0&&(t=[]),i=t.length-1;i>=0;i--)if(t[i].selected){vc(t,t[i]);break}return r=n.call(this,t)||this,r.changing_=!1,Object.defineProperty(o(r),"selectedIndex",{get:function(){for(var n=0;n<this.length;n++)if(this[n].selected)return n;return-1},set:function(){}}),r}u(t,n);var i=t.prototype;return i.addTrack=function(t){var i=this;(t.selected&&vc(this,t),n.prototype.addTrack.call(this,t),t.addEventListener)&&(t.selectedChange_=function(){i.changing_||(i.changing_=!0,vc(i,t),i.changing_=!1,i.trigger("change"))},t.addEventListener("selectedchange",t.selectedChange_))},i.removeTrack=function(t){n.prototype.removeTrack.call(this,t);t.removeEventListener&&t.selectedChange_&&(t.removeEventListener("selectedchange",t.selectedChange_),t.selectedChange_=null)},t}(sr),cw=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.addTrack=function(t){var i=this,r;n.prototype.addTrack.call(this,t);this.queueChange_||(this.queueChange_=function(){return i.queueTrigger("change")});this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return i.trigger("selectedlanguagechange")});t.addEventListener("modechange",this.queueChange_);r=["metadata","chapters"];r.indexOf(t.kind)===-1&&t.addEventListener("modechange",this.triggerSelectedlanguagechange_)},i.removeTrack=function(t){n.prototype.removeTrack.call(this,t);t.removeEventListener&&(this.queueChange_&&t.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&t.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},t}(sr),ert=function(){function t(n){n===void 0&&(n=[]);this.trackElements_=[];Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=n.length;t<i;t++)this.addTrackElement_(n[t])}var n=t.prototype;return n.addTrackElement_=function(n){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}});this.trackElements_.indexOf(n)===-1&&this.trackElements_.push(n)},n.getTrackElementByTrack_=function(n){for(var i,t=0,r=this.trackElements_.length;t<r;t++)if(n===this.trackElements_[t].track){i=this.trackElements_[t];break}return i},n.removeTrackElement_=function(n){for(var t=0,i=this.trackElements_.length;t<i;t++)if(n===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off();typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off();this.trackElements_.splice(t,1);break}},t}(),lw=function(){function n(t){n.prototype.setCues_.call(this,t);Object.defineProperty(this,"length",{get:function(){return this.length_}})}var t=n.prototype;return t.setCues_=function(n){var i=this.length||0,t=0,r=n.length,u;if(this.cues_=n,this.length_=n.length,u=function(n){""+n in this||Object.defineProperty(this,""+n,{get:function(){return this.cues_[n]}})},i<r)for(t=i;t<r;t++)u.call(this,t)},t.getCueById=function(n){for(var i,r=null,t=0,u=this.length;t<u;t++)if(i=this[t],i.id===n){r=i;break}return r},n}(),ort={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},srt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},hrt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},aw={disabled:"disabled",hidden:"hidden",showing:"showing"},yc=function(n){function t(t){var i,r,u,f;t===void 0&&(t={});i=n.call(this)||this;r={id:t.id||"vjs_track_"+ki(),kind:t.kind||"",label:t.label||"",language:t.language||""};u=function(n){Object.defineProperty(o(i),n,{get:function(){return r[n]},set:function(){}})};for(f in r)u(f);return i}return u(t,n),t}(d),pc=function(i){var o=["protocol","hostname","port","pathname","search","hash","host"],f=t.createElement("a"),s,u,r,e;for(f.href=i,s=f.host===""&&f.protocol!=="file:",s&&(u=t.createElement("div"),u.innerHTML='<a href="'+i+'"><\/a>',f=u.firstChild,u.setAttribute("style","display:none; position:absolute;"),t.body.appendChild(u)),r={},e=0;e<o.length;e++)r[o[e]]=f[o[e]];return r.protocol==="http:"&&(r.host=r.host.replace(/:80$/,"")),r.protocol==="https:"&&(r.host=r.host.replace(/:443$/,"")),r.protocol||(r.protocol=n.location.protocol),s&&t.body.removeChild(u),r},vw=function(n){if(!n.match(/^https?:\/\//)){var i=t.createElement("div");i.innerHTML='<a href="'+n+'">x<\/a>';n=i.firstChild.href}return n},wc=function(n){if(typeof n=="string"){var t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(n);if(t)return t.pop().toLowerCase()}return""},io=function(t,i){i===void 0&&(i=n.location);var r=pc(t),u=r.protocol===":"?i.protocol:r.protocol;return u+r.host!==i.protocol+i.host},crt=Object.freeze({parseUrl:pc,getAbsoluteURL:vw,getFileExtension:wc,isCrossOrigin:io}),lrt=vrt,art=Object.prototype.toString;var yrt=function(n){var t={};return n?(n.trim().split("\n").forEach(function(n){var u=n.indexOf(":"),i=n.slice(0,u).trim().toLowerCase(),r=n.slice(u+1).trim();typeof t[i]=="undefined"?t[i]=r:Array.isArray(t[i])?t[i].push(r):t[i]=[t[i],r]}),t):t},bc=ai,prt=ai;ai.XMLHttpRequest=n.XMLHttpRequest||drt;ai.XDomainRequest="withCredentials"in new ai.XMLHttpRequest?ai.XMLHttpRequest:n.XDomainRequest;wrt(["get","put","post","patch","head","delete"],function(n){ai[n==="delete"?"del":n]=function(t,i,r){return i=yw(t,i,r),i.method=n.toUpperCase(),pw(i)}});bc["default"]=prt;var ww=function(t,i){var r=new n.WebVTT.Parser(n,n.vttjs,n.WebVTT.StringDecoder()),u=[];r.oncue=function(n){i.addCue(n)};r.onparsingerror=function(n){u.push(n)};r.onflush=function(){i.trigger({type:"loadeddata",target:i})};r.parse(t);u.length>0&&(n.console&&n.console.groupCollapsed&&n.console.groupCollapsed("Text Track parsing errors for "+i.src),u.forEach(function(n){return h.error(n)}),n.console&&n.console.groupEnd&&n.console.groupEnd());r.flush()},bw=function(t,i){var r={uri:t},u=io(t);u&&(r.cors=u);bc(r,s(this,function(t,r,u){if(t)return h.error(t,r);i.loaded_=!0;typeof n.WebVTT!="function"?i.tech_&&i.tech_.any(["vttjsloaded","vttjserror"],function(n){if(n.type==="vttjserror"){h.error("vttjs failed to load, stopping trying to process "+i.src);return}return ww(u,i)}):ww(u,i)}))},pf=function(t){function i(n){var i;if(n===void 0&&(n={}),!n.tech)throw new Error("A tech was not provided.");var r=v(n,{kind:hrt[n.kind]||"subtitles",language:n.language||n.srclang||""}),u=aw[r.mode]||"disabled",c=r["default"];(r.kind==="metadata"||r.kind==="chapters")&&(u="hidden");i=t.call(this,r)||this;i.tech_=r.tech;i.cues_=[];i.activeCues_=[];i.preload_=i.tech_.preloadTextTracks!==!1;var l=new lw(i.cues_),e=new lw(i.activeCues_),f=!1,h=s(o(i),function(){this.activeCues=this.activeCues;f&&(this.trigger("cuechange"),f=!1)});return u!=="disabled"&&i.tech_.ready(function(){i.tech_.on("timeupdate",h)},!0),Object.defineProperties(o(i),{"default":{get:function(){return c},set:function(){}},mode:{get:function(){return u},set:function(n){var t=this;aw[n]&&(u=n,this.preload_||u==="disabled"||this.cues.length!==0||bw(this.src,this),u!=="disabled"?this.tech_.ready(function(){t.tech_.on("timeupdate",h)},!0):this.tech_.off("timeupdate",h),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?l:null},set:function(){}},activeCues:{get:function(){var i,t,r,o,n,u;if(!this.loaded_)return null;if(this.cues.length===0)return e;for(i=this.tech_.currentTime(),t=[],r=0,o=this.cues.length;r<o;r++)n=this.cues[r],n.startTime<=i&&n.endTime>=i?t.push(n):n.startTime===n.endTime&&n.startTime<=i&&n.startTime+.5>=i&&t.push(n);if(f=!1,t.length!==this.activeCues_.length)f=!0;else for(u=0;u<t.length;u++)this.activeCues_.indexOf(t[u])===-1&&(f=!0);return this.activeCues_=t,e.setCues_(this.activeCues_),e},set:function(){}}}),r.src?(i.src=r.src,i.preload_||(i.loaded_=!0),(i.preload_||c||r.kind!=="subtitles"&&r.kind!=="captions")&&bw(i.src,o(i))):i.loaded_=!0,i}u(i,t);var r=i.prototype;return r.addCue=function(t){var i=t,u,f,r;if(n.vttjs&&!(t instanceof n.vttjs.VTTCue)){i=new n.vttjs.VTTCue(t.startTime,t.endTime,t.text);for(u in t)u in i||(i[u]=t[u]);i.id=t.id;i.originalCue_=t}for(f=this.tech_.textTracks(),r=0;r<f.length;r++)f[r]!==this&&f[r].removeCue(i);this.cues_.push(i);this.cues.setCues_(this.cues_)},r.removeCue=function(n){for(var i=this.cues_.length,t;i--;)if(t=this.cues_[i],t===n||t.originalCue_&&t.originalCue_===n){this.cues_.splice(i,1);this.cues.setCues_(this.cues_);break}},i}(yc);pf.prototype.allowedEvents_={cuechange:"cuechange"};var kw=function(n){function t(t){var i,r,u;return t===void 0&&(t={}),r=v(t,{kind:srt[t.kind]||""}),i=n.call(this,r)||this,u=!1,Object.defineProperty(o(i),"enabled",{get:function(){return u},set:function(n){typeof n=="boolean"&&n!==u&&(u=n,this.trigger("enabledchange"))}}),r.enabled&&(i.enabled=r.enabled),i.loaded_=!0,i}return u(t,n),t}(yc),dw=function(n){function t(t){var i,r,u;return t===void 0&&(t={}),r=v(t,{kind:ort[t.kind]||""}),i=n.call(this,r)||this,u=!1,Object.defineProperty(o(i),"selected",{get:function(){return u},set:function(n){typeof n=="boolean"&&n!==u&&(u=n,this.trigger("selectedchange"))}}),r.selected&&(i.selected=r.selected),i}return u(t,n),t}(yc),gw=0,nb=2,ou=function(n){function t(t){var i,u,r;return t===void 0&&(t={}),i=n.call(this)||this,r=new pf(t),i.kind=r.kind,i.src=r.src,i.srclang=r.language,i.label=r.label,i["default"]=r["default"],Object.defineProperties(o(i),{readyState:{get:function(){return u}},track:{get:function(){return r}}}),u=gw,r.addEventListener("loadeddata",function(){u=nb;i.trigger({type:"load",target:o(i)})}),i}return u(t,n),t}(d);ou.prototype.allowedEvents_={load:"load"};ou.NONE=gw;ou.LOADING=1;ou.LOADED=nb;ou.ERROR=3;pt={audio:{ListClass:urt,TrackClass:kw,capitalName:"Audio"},video:{ListClass:frt,TrackClass:dw,capitalName:"Video"},text:{ListClass:cw,TrackClass:pf,capitalName:"Text"}};Object.keys(pt).forEach(function(n){pt[n].getterName=n+"Tracks";pt[n].privateName=n+"Tracks_"});su={remoteText:{ListClass:cw,TrackClass:pf,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:ert,TrackClass:ou,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}};rt=ve({},pt,su);su.names=Object.keys(su);pt.names=Object.keys(pt);rt.names=[].concat(su.names).concat(pt.names);ro=Object.create||function(){function n(){}return function(t){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return n.prototype=t,new n}}();wt.prototype=ro(Error.prototype);wt.prototype.constructor=wt;wt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};wf.prototype={set:function(n,t){this.get(n)||t===""||(this.values[n]=t)},get:function(n,t,i){return i?this.has(n)?this.values[n]:t[i]:this.has(n)?this.values[n]:t},has:function(n){return n in this.values},alt:function(n,t,i){for(var r=0;r<i.length;++r)if(t===i[r]){this.set(n,t);break}},integer:function(n,t){/^-?\d+$/.test(t)&&this.set(n,parseInt(t,10))},percent:function(n,t){var i;return(i=t.match(/^([\d]{1,3})(\.[\d]*)?%$/))&&(t=parseFloat(t),t>=0&&t<=100)?(this.set(n,t),!0):!1}};var dc=t.createElement("textarea"),nut={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},tb={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)"},tut={v:"title",lang:"lang"},ib={rt:"ruby"};gc=[[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]];uo.prototype.applyStyles=function(n,t){t=t||this.div;for(var i in n)n.hasOwnProperty(i)&&(t.style[i]=n[i])};uo.prototype.formatStyle=function(n,t){return n===0?0:n+t};fo.prototype=ro(uo.prototype);fo.prototype.constructor=fo;ft.prototype.move=function(n,t){t=t!==undefined?t:this.lineHeight;switch(n){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}};ft.prototype.overlaps=function(n){return this.left<n.right&&this.right>n.left&&this.top<n.bottom&&this.bottom>n.top};ft.prototype.overlapsAny=function(n){for(var t=0;t<n.length;t++)if(this.overlaps(n[t]))return!0;return!1};ft.prototype.within=function(n){return this.top>=n.top&&this.bottom<=n.bottom&&this.left>=n.left&&this.right<=n.right};ft.prototype.overlapsOppositeAxis=function(n,t){switch(t){case"+x":return this.left<n.left;case"-x":return this.right>n.right;case"+y":return this.top<n.top;case"-y":return this.bottom>n.bottom}};ft.prototype.intersectPercentage=function(n){var t=Math.max(0,Math.min(this.right,n.right)-Math.max(this.left,n.left)),i=Math.max(0,Math.min(this.bottom,n.bottom)-Math.max(this.top,n.top)),r=t*i;return r/(this.height*this.width)};ft.prototype.toCSSCompatValues=function(n){return{top:this.top-n.top,bottom:n.bottom-this.bottom,left:this.left-n.left,right:n.right-this.right,height:this.height,width:this.width}};ft.getSimpleBoxPosition=function(n){var t=n.div?n.div.offsetHeight:n.tagName?n.offsetHeight:0,r=n.div?n.div.offsetWidth:n.tagName?n.offsetWidth:0,i=n.div?n.div.offsetTop:n.tagName?n.offsetTop:0;return n=n.div?n.div.getBoundingClientRect():n.tagName?n.getBoundingClientRect():n,{left:n.left,right:n.right,top:n.top||i,height:n.height||t,bottom:n.bottom||i+(n.height||t),width:n.width||r}};hu.StringDecoder=function(){return{decode:function(n){if(!n)return"";if(typeof n!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(n))}}};hu.convertCueToDOMTree=function(n,t){return!n||!t?null:rb(n,t)};var eut=.05,out="sans-serif",sut="1.5%";hu.processCues=function(n,t,i){function o(n){for(var t=0;t<n.length;t++)if(n[t].hasBeenReset||!n[t].displayState)return!0;return!1}var r,u;if(!n||!t||!i)return null;while(i.firstChild)i.removeChild(i.firstChild);if(r=n.document.createElement("div"),r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=sut,i.appendChild(r),!o(t)){for(u=0;u<t.length;u++)r.appendChild(t[u].displayState);return}var f=[],e=ft.getSimpleBoxPosition(r),s=Math.round(e.height*eut*100)/100,h={font:s+"px "+out};(function(){for(var i,u,o=0;o<t.length;o++)u=t[o],i=new fo(n,u,h),r.appendChild(i.div),fut(n,i,e,f),u.displayState=i.div,f.push(ft.getSimpleBoxPosition(i))})()};hu.Parser=function(n,t,i){i||(i=t,t={});t||(t={});this.window=n;this.vttjs=t;this.state="INITIAL";this.buffer="";this.decoder=i||new TextDecoder("utf8");this.regionList=[]};hu.Parser.prototype={reportOrThrowError:function(n){if(n instanceof wt)this.onparsingerror&&this.onparsingerror(n);else throw n;},parse:function(n){function f(){for(var i=t.buffer,n=0,r;n<i.length&&i[n]!=="\r"&&i[n]!=="\n";)++n;return r=i.substr(0,n),i[n]==="\r"&&++n,i[n]==="\n"&&++n,t.buffer=i.substr(n),r}function s(n){var i=new wf,r;bf(n,function(n,t){var u,r;switch(n){case"id":i.set(n,t);break;case"width":i.percent(n,t);break;case"lines":i.integer(n,t);break;case"regionanchor":case"viewportanchor":if(u=t.split(","),u.length!==2)break;if(r=new wf,r.percent("x",u[0]),r.percent("y",u[1]),!r.has("x")||!r.has("y"))break;i.set(n+"X",r.get("x"));i.set(n+"Y",r.get("y"));break;case"scroll":i.alt(n,t,["up"])}},/=/,/\s/);i.has("id")&&(r=new(t.vttjs.VTTRegion||t.window.VTTRegion),r.width=i.get("width",100),r.lines=i.get("lines",3),r.regionAnchorX=i.get("regionanchorX",0),r.regionAnchorY=i.get("regionanchorY",100),r.viewportAnchorX=i.get("viewportanchorX",0),r.viewportAnchorY=i.get("viewportanchorY",100),r.scroll=i.get("scroll",""),t.onregion&&t.onregion(r),t.regionList.push({id:i.get("id"),region:r}))}function h(n){var i=new wf;bf(n,function(n,t){switch(n){case"MPEGT":i.integer(n+"S",t);break;case"LOCA":i.set(n+"L",kc(t))}},/[^\d]:/,/,/);t.ontimestampmap&&t.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")})}function c(n){n.match(/X-TIMESTAMP-MAP/)?bf(n,function(n,t){switch(n){case"X-TIMESTAMP-MAP":h(t)}},/=/):bf(n,function(n,t){switch(n){case"Region":s(t)}},/:/)}var t=this,i,u,r,o;n&&(t.buffer+=t.decoder.decode(n,{stream:!0}));try{if(t.state==="INITIAL"){if(!/\r\n|\n/.test(t.buffer))return this;if(i=f(),u=i.match(/^WEBVTT([ \t].*)?$/),!u||!u[0])throw new wt(wt.Errors.BadSignature);t.state="HEADER"}for(r=!1;t.buffer;){if(!/\r\n|\n/.test(t.buffer))return this;r?r=!1:i=f();switch(t.state){case"HEADER":/:/.test(i)?c(i):i||(t.state="ID");continue;case"NOTE":i||(t.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){t.state="NOTE";break}if(!i)continue;t.cue=new(t.vttjs.VTTCue||t.window.VTTCue)(0,0,"");try{t.cue.align="center"}catch(e){t.cue.align="middle"}if(t.state="CUE",i.indexOf("-->")===-1){t.cue.id=i;continue}case"CUE":try{grt(i,t.cue,t.regionList)}catch(e){t.reportOrThrowError(e);t.cue=null;t.state="BADCUE";continue}t.state="CUETEXT";continue;case"CUETEXT":if(o=i.indexOf("-->")!==-1,!i||o&&(r=!0)){t.oncue&&t.oncue(t.cue);t.cue=null;t.state="ID";continue}t.cue.text&&(t.cue.text+="\n");t.cue.text+=i.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":i||(t.state="ID");continue}}}catch(e){if(t.reportOrThrowError(e),t.state==="CUETEXT"&&t.cue&&t.oncue)t.oncue(t.cue);t.cue=null;t.state=t.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var n=this;try{if(n.buffer+=n.decoder.decode(),(n.cue||n.state==="HEADER")&&(n.buffer+="\n\n",n.parse()),n.state==="INITIAL")throw new wt(wt.Errors.BadSignature);}catch(t){n.reportOrThrowError(t)}return n.onflush&&n.onflush(),this}};var hut=hu,cut="auto",lut={"":1,lr:1,rl:1},aut={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};ub.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};fb=ub;eb={"":!0,up:!0};var wut=put,df=dr(function(t){var i=t.exports={WebVTT:hut,VTTCue:fb,VTTRegion:wut};n.vttjs=i;n.WebVTT=i.WebVTT;var r=i.VTTCue,u=i.VTTRegion,f=n.VTTCue,e=n.VTTRegion;i.shim=function(){n.VTTCue=r;n.VTTRegion=u};i.restore=function(){n.VTTCue=f;n.VTTRegion=e};n.VTTCue||i.shim()}),uwt=df.WebVTT,fwt=df.VTTCue,ewt=df.VTTRegion;a=function(i){function f(n,t){var r;n===void 0&&(n={});t===void 0&&(t=function(){});n.reportTouchActivity=!1;r=i.call(this,null,n,t)||this;r.hasStarted_=!1;r.on("playing",function(){this.hasStarted_=!0});r.on("loadstart",function(){this.hasStarted_=!1});return rt.names.forEach(function(t){var i=rt[t];n&&n[i.getterName]&&(r[i.privateName]=n[i.getterName])}),r.featuresProgressEvents||r.manualProgressOn(),r.featuresTimeupdateEvents||r.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(t){n["native"+t+"Tracks"]===!1&&(r["featuresNative"+t+"Tracks"]=!1)}),n.nativeCaptions===!1||n.nativeTextTracks===!1?r.featuresNativeTextTracks=!1:(n.nativeCaptions===!0||n.nativeTextTracks===!0)&&(r.featuresNativeTextTracks=!0),r.featuresNativeTextTracks||r.emulateTextTracks(),r.preloadTextTracks=n.preloadTextTracks!==!1,r.autoRemoteTextTracks_=new rt.text.ListClass,r.initTrackListeners(),n.nativeControlsForTouch||r.emitTapEvents(),r.constructor&&(r.name_=r.constructor.name||"Unknown Tech"),r}u(f,i);var r=f.prototype;return r.triggerSourceset=function(n){var t=this;if(!this.isReady_)this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(n)},1)});this.trigger({src:n,type:"sourceset"})},r.manualProgressOn=function(){this.on("durationchange",this.onDurationChange);this.manualProgress=!0;this.one("ready",this.trackProgress)},r.manualProgressOff=function(){this.manualProgress=!1;this.stopTrackingProgress();this.off("durationchange",this.onDurationChange)},r.trackProgress=function(){this.stopTrackingProgress();this.progressInterval=this.setInterval(s(this,function(){var n=this.bufferedPercent();this.bufferedPercent_!==n&&this.trigger("progress");this.bufferedPercent_=n;n===1&&this.stopTrackingProgress()}),500)},r.onDurationChange=function(){this.duration_=this.duration()},r.buffered=function(){return er(0,0)},r.bufferedPercent=function(){return fw(this.buffered(),this.duration_)},r.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},r.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0;this.on("play",this.trackCurrentTime);this.on("pause",this.stopTrackingCurrentTime)},r.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1;this.stopTrackingCurrentTime();this.off("play",this.trackCurrentTime);this.off("pause",this.stopTrackingCurrentTime)},r.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime();this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},r.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval);this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},r.dispose=function(){this.clearTracks(pt.names);this.manualProgress&&this.manualProgressOff();this.manualTimeUpdates&&this.manualTimeUpdatesOff();i.prototype.dispose.call(this)},r.clearTracks=function(n){var t=this;n=[].concat(n);n.forEach(function(n){for(var i=t[n+"Tracks"]()||[],u=i.length,r;u--;)r=i[u],n==="text"&&t.removeRemoteTextTrack(r),i.removeTrack(r)})},r.cleanupAutoTextTracks=function(){for(var n=this.autoRemoteTextTracks_||[],t=n.length,i;t--;)i=n[t],this.removeRemoteTextTrack(i)},r.reset=function(){},r.error=function(n){return n!==undefined&&(this.error_=new ut(n),this.trigger("error")),this.error_},r.played=function(){return this.hasStarted_?er(0,0):er()},r.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},r.initTrackListeners=function(){var n=this;pt.names.forEach(function(t){var u=pt[t],i=function(){n.trigger(t+"trackchange")},r=n[u.getterName]();r.addEventListener("removetrack",i);r.addEventListener("addtrack",i);n.on("dispose",function(){r.removeEventListener("removetrack",i);r.removeEventListener("addtrack",i)})})},r.addWebVttScript_=function(){var r=this,i;if(!n.WebVTT)if(t.body.contains(this.el())){if(!this.options_["vtt.js"]&&ff(df)&&Object.keys(df).length>0){this.trigger("vttjsloaded");return}i=t.createElement("script");i.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";i.onload=function(){r.trigger("vttjsloaded")};i.onerror=function(){r.trigger("vttjserror")};this.on("dispose",function(){i.onload=null;i.onerror=null});n.WebVTT=!0;this.el().parentNode.appendChild(i)}else this.ready(this.addWebVttScript_)},r.emulateTextTracks=function(){var e=this,n=this.textTracks(),r=this.remoteTextTracks(),u=function(t){return n.addTrack(t.track)},f=function(t){return n.removeTrack(t.track)},i,t;r.on("addtrack",u);r.on("removetrack",f);this.addWebVttScript_();i=function(){return e.trigger("texttrackchange")};t=function(){var t,r;for(i(),t=0;t<n.length;t++)r=n[t],r.removeEventListener("cuechange",i),r.mode==="showing"&&r.addEventListener("cuechange",i)};t();n.addEventListener("change",t);n.addEventListener("addtrack",t);n.addEventListener("removetrack",t);this.on("dispose",function(){var e,o;for(r.off("addtrack",u),r.off("removetrack",f),n.removeEventListener("change",t),n.removeEventListener("addtrack",t),n.removeEventListener("removetrack",t),e=0;e<n.length;e++)o=n[e],o.removeEventListener("cuechange",i)})},r.addTextTrack=function(n,t,i){if(!n)throw new Error("TextTrack kind is required but was not provided");return but(this,n,t,i)},r.createRemoteTextTrack=function(n){var t=v(n,{tech:this});return new su.remoteTextEl.TrackClass(t)},r.addRemoteTextTrack=function(n,t){var r=this,i;return n===void 0&&(n={}),i=this.createRemoteTextTrack(n),t!==!0&&t!==!1&&(h.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t!==!0&&this.ready(function(){return r.autoRemoteTextTracks_.addTrack(i.track)}),i},r.removeRemoteTextTrack=function(n){var t=this.remoteTextTrackEls().getTrackElementByTrack_(n);this.remoteTextTrackEls().removeTrackElement_(t);this.remoteTextTracks().removeTrack(n);this.autoRemoteTextTracks_.removeTrack(n)},r.getVideoPlaybackQuality=function(){return{}},r.requestPictureInPicture=function(){var t=this.options_.Promise||n.Promise;if(t)return t.reject()},r.setPoster=function(){},r.playsinline=function(){},r.setPlaysinline=function(){},r.overrideNativeAudioTracks=function(){},r.overrideNativeVideoTracks=function(){},r.canPlayType=function(){return""},f.canPlayType=function(){return""},f.canPlaySource=function(n){return f.canPlayType(n.type)},f.isTech=function(n){return n.prototype instanceof f||n instanceof f||n===f},f.registerTech=function(n,t){if(f.techs_||(f.techs_={}),!f.isTech(t))throw new Error("Tech "+n+" must be a Tech");if(!f.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!f.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return n=b(n),f.techs_[n]=t,f.techs_[de(n)]=t,n!=="Tech"&&f.defaultTechOrder_.push(n),t},f.getTech=function(t){if(t)return f.techs_&&f.techs_[t]?f.techs_[t]:(t=b(t),n&&n.videojs&&n.videojs[t]?(h.warn("The "+t+" tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)"),n.videojs[t]):void 0)},f}(r);rt.names.forEach(function(n){var t=rt[n];a.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}});a.prototype.featuresVolumeControl=!0;a.prototype.featuresMuteControl=!0;a.prototype.featuresFullscreenResize=!1;a.prototype.featuresPlaybackRate=!1;a.prototype.featuresProgressEvents=!1;a.prototype.featuresSourceset=!1;a.prototype.featuresTimeupdateEvents=!1;a.prototype.featuresNativeTextTracks=!1;a.withSourceHandlers=function(n){n.registerSourceHandler=function(t,i){var r=n.sourceHandlers;r||(r=n.sourceHandlers=[]);i===undefined&&(i=r.length);r.splice(i,0,t)};n.canPlayType=function(t){for(var u=n.sourceHandlers||[],i,r=0;r<u.length;r++)if(i=u[r].canPlayType(t),i)return i;return""};n.selectSourceHandler=function(t,i){for(var u=n.sourceHandlers||[],f,r=0;r<u.length;r++)if(f=u[r].canHandleSource(t,i),f)return u[r];return null};n.canPlaySource=function(t,i){var r=n.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""};["seekable","seeking","duration"].forEach(function(n){var t=this[n];typeof t=="function"&&(this[n]=function(){return this.sourceHandler_&&this.sourceHandler_[n]?this.sourceHandler_[n].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},n.prototype);n.prototype.setSource=function(t){var i=n.selectSourceHandler(t,this.options_);i||(n.nativeSourceHandler?i=n.nativeSourceHandler:h.error("No source handler found for the current source."));this.disposeSourceHandler();this.off("dispose",this.disposeSourceHandler);i!==n.nativeSourceHandler&&(this.currentSource_=t);this.sourceHandler_=i.handleSource(t,this,this.options_);this.one("dispose",this.disposeSourceHandler)};n.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null);this.cleanupAutoTextTracks();this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};r.registerComponent("Tech",a);a.registerTech("Tech",a);a.defaultTechOrder_=[];var hr={},tl={},eo={};var tft={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1},ift={setCurrentTime:1,setMuted:1,setVolume:1},hb={play:1,pause:1};var eft={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",oga:"audio/ogg",m3u8:"application/x-mpegURL",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},oo=function(n){n===void 0&&(n="");var t=wc(n),i=eft[t.toLowerCase()];return i||""},oft=function(n,t){var u,f,r,i;if(!t)return"";if(n.cache_.source.src===t&&n.cache_.source.type)return n.cache_.source.type;if(u=n.cache_.sources.filter(function(n){return n.src===t}),u.length)return u[0].type;for(f=n.$$("source"),r=0;r<f.length;r++)if(i=f[r],i.type&&i.src&&i.src===t)return i.type;return oo(t)},cb=function cb(n){if(Array.isArray(n)){var t=[];n.forEach(function(n){n=cb(n);Array.isArray(n)?t=t.concat(n):wi(n)&&t.push(n)});n=t}else n=typeof n=="string"&&n.trim()?[lb({src:n})]:wi(n)&&typeof n.src=="string"&&n.src&&n.src.trim()?[lb(n)]:[];return n};ab=function(n){function t(t,i,u){var h,c=v({createEl:!1},i),e,s,f,o;if(h=n.call(this,t,c,u)||this,i.playerOptions.sources&&i.playerOptions.sources.length!==0)t.src(i.playerOptions.sources);else for(e=0,s=i.playerOptions.techOrder;e<s.length;e++)if(f=b(s[e]),o=a.getTech(f),f||(o=r.getComponent(f)),o&&o.isSupported()){t.loadTech_(f);break}return h}return u(t,n),t}(r);r.registerComponent("MediaLoader",ab);gf=function(n){function i(t,i){var r;return r=n.call(this,t,i)||this,r.emitTapEvents(),r.enable(),r}u(i,n);var t=i.prototype;return t.createEl=function(t,i,r){t===void 0&&(t="div");i===void 0&&(i={});r===void 0&&(r={});i=y({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"><\/span>',className:this.buildCSSClass(),tabIndex:0},i);t==="button"&&h.error("Creating a ClickableComponent with an HTML element of "+t+" is not supported; use a Button instead.");r=y({role:"button"},r);this.tabIndex_=i.tabIndex;var u=n.prototype.createEl.call(this,t,i,r);return this.createControlTextEl(u),u},t.dispose=function(){this.controlTextEl_=null;n.prototype.dispose.call(this)},t.createControlTextEl=function(n){return this.controlTextEl_=w("span",{className:"vjs-control-text"},{"aria-live":"polite"}),n&&n.appendChild(this.controlTextEl_),this.controlText(this.controlText_,n),this.controlTextEl_},t.controlText=function(n,t){if(t===void 0&&(t=this.el()),n===undefined)return this.controlText_||"Need Text";var i=this.localize(n);this.controlText_=n;tu(this.controlTextEl_,i);this.nonIconControl||t.setAttribute("title",i)},t.buildCSSClass=function(){return"vjs-control vjs-button "+n.prototype.buildCSSClass.call(this)},t.enable=function(){if(!this.enabled_){this.enabled_=!0;this.removeClass("vjs-disabled");this.el_.setAttribute("aria-disabled","false");typeof this.tabIndex_!="undefined"&&this.el_.setAttribute("tabIndex",this.tabIndex_);this.on(["tap","click"],this.handleClick);this.on("keydown",this.handleKeyDown)}},t.disable=function(){this.enabled_=!1;this.addClass("vjs-disabled");this.el_.setAttribute("aria-disabled","true");typeof this.tabIndex_!="undefined"&&this.el_.removeAttribute("tabIndex");this.off("mouseover",this.handleMouseOver);this.off("mouseout",this.handleMouseOut);this.off(["tap","click"],this.handleClick);this.off("keydown",this.handleKeyDown)},t.handleClick=function(){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},t.handleKeyDown=function(t){e.isEventKey(t,"Space")||e.isEventKey(t,"Enter")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n.prototype.handleKeyDown.call(this,t)},i}(r);r.registerComponent("ClickableComponent",gf);vb=function(n){function i(t,i){var r;r=n.call(this,t,i)||this;r.update();t.on("posterchange",s(o(r),r.update));return r}u(i,n);var t=i.prototype;return t.dispose=function(){this.player().off("posterchange",this.update);n.prototype.dispose.call(this)},t.createEl=function(){return w("div",{className:"vjs-poster",tabIndex:-1})},t.update=function(){var n=this.player().poster();this.setSrc(n);n?this.show():this.hide()},t.setSrc=function(n){var t="";n&&(t='url("'+n+'")');this.el_.style.backgroundImage=t},t.handleClick=function(){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?fu(this.player_.play()):this.player_.pause())},i}(gf);r.registerComponent("PosterImage",vb);var kt="#222",yb="#ccc",sft={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'};pb=function(t){function r(i,r,u){var f,e;f=t.call(this,i,r,u)||this;e=s(o(f),f.updateDisplay);i.on("loadstart",s(o(f),f.toggleDisplay));i.on("texttrackchange",e);i.on("loadedmetadata",s(o(f),f.preselectTrack));return i.ready(s(o(f),function(){var r,t;if(i.tech_&&i.tech_.featuresNativeTextTracks){this.hide();return}i.on("fullscreenchange",e);i.on("playerresize",e);n.addEventListener("orientationchange",e);i.on("dispose",function(){return n.removeEventListener("orientationchange",e)});for(r=this.options_.playerOptions.tracks||[],t=0;t<r.length;t++)this.player_.addRemoteTextTrack(r[t],!0);this.preselectTrack()})),f}u(r,t);var i=r.prototype;return i.preselectTrack=function(){for(var n,e={captions:1,subtitles:1},o=this.player_.textTracks(),t=this.player_.cache_.selectedLanguage,r,u,i,f=0;f<o.length;f++)n=o[f],t&&t.enabled&&t.language&&t.language===n.language&&n.kind in e?n.kind===t.kind?i=n:i||(i=n):t&&!t.enabled?(i=null,r=null,u=null):n["default"]&&(n.kind!=="descriptions"||r?n.kind in e&&!u&&(u=n):r=n);i?i.mode="showing":u?u.mode="showing":r&&(r.mode="showing")},i.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},i.createEl=function(){return t.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{"aria-live":"off","aria-atomic":"true"})},i.clearDisplay=function(){typeof n.WebVTT=="function"&&n.WebVTT.processCues(n,[],this.el_)},i.updateDisplay=function(){var t=this.player_.textTracks(),s=this.options_.allowMultipleShowingTracks,r,i,u,n;if(this.clearDisplay(),s){for(r=[],i=0;i<t.length;++i)(u=t[i],u.mode==="showing")&&r.push(u);this.updateForTrack(r);return}for(var f=null,e=null,o=t.length;o--;)n=t[o],n.mode==="showing"&&(n.kind==="descriptions"?f=n:e=n);e?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(e)):f&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(f))},i.updateDisplayState=function(t){for(var i=this.player_.textTrackSettings.getValues(),f=t.activeCues,e=f.length,u,r,o;e--;)(u=f[e],u)&&(r=u.displayState,i.color&&(r.firstChild.style.color=i.color),i.textOpacity&&ul(r.firstChild,"color",rl(i.color||"#fff",i.textOpacity)),i.backgroundColor&&(r.firstChild.style.backgroundColor=i.backgroundColor),i.backgroundOpacity&&ul(r.firstChild,"backgroundColor",rl(i.backgroundColor||"#000",i.backgroundOpacity)),i.windowColor&&(i.windowOpacity?ul(r,"backgroundColor",rl(i.windowColor,i.windowOpacity)):r.style.backgroundColor=i.windowColor),i.edgeStyle&&(i.edgeStyle==="dropshadow"?r.firstChild.style.textShadow="2px 2px 3px "+kt+", 2px 2px 4px "+kt+", 2px 2px 5px "+kt:i.edgeStyle==="raised"?r.firstChild.style.textShadow="1px 1px "+kt+", 2px 2px "+kt+", 3px 3px "+kt:i.edgeStyle==="depressed"?r.firstChild.style.textShadow="1px 1px "+yb+", 0 1px "+yb+", -1px -1px "+kt+", 0 -1px "+kt:i.edgeStyle==="uniform"&&(r.firstChild.style.textShadow="0 0 4px "+kt+", 0 0 4px "+kt+", 0 0 4px "+kt+", 0 0 4px "+kt)),i.fontPercent&&i.fontPercent!==1&&(o=n.parseFloat(r.style.fontSize),r.style.fontSize=o*i.fontPercent+"px",r.style.height="auto",r.style.top="auto",r.style.bottom="2px"),i.fontFamily&&i.fontFamily!=="default"&&(i.fontFamily==="small-caps"?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=sft[i.fontFamily]))},i.updateForTrack=function(t){var o,u,s,f,r,i,e,h;if(Array.isArray(t)||(t=[t]),typeof n.WebVTT=="function"&&!t.every(function(n){return!n.activeCues})){for(o=[],u=0;u<t.length;++u)for(s=t[u],f=0;f<s.activeCues.length;++f)o.push(s.activeCues[f]);for(n.WebVTT.processCues(n,o,this.el_),r=0;r<t.length;++r){for(i=t[r],e=0;e<i.activeCues.length;++e)h=i.activeCues[e].displayState,si(h,"vjs-text-track-cue"),si(h,"vjs-text-track-cue-"+(i.language?i.language:r));this.player_.textTrackSettings&&this.updateDisplayState(i)}}},r}(r);r.registerComponent("TextTrackDisplay",pb);wb=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.createEl=function(){var i=this.player_.isAudio(),r=this.localize(i?"Audio Player":"Video Player"),u=w("span",{className:"vjs-control-text",innerHTML:this.localize("{1} is loading.",[r])}),t=n.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return t.appendChild(u),t},t}(r);r.registerComponent("LoadingSpinner",wb);dt=function(n){function i(){return n.apply(this,arguments)||this}u(i,n);var t=i.prototype;return t.createEl=function(n,t,i){t===void 0&&(t={});i===void 0&&(i={});n="button";t=y({innerHTML:'<span aria-hidden="true" class="vjs-icon-placeholder"><\/span>',className:this.buildCSSClass()},t);i=y({type:"button"},i);var u=r.prototype.createEl.call(this,n,t,i);return this.createControlTextEl(u),u},t.addChild=function(n,t){t===void 0&&(t={});var i=this.constructor.name;return h.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),r.prototype.addChild.call(this,n,t)},t.enable=function(){n.prototype.enable.call(this);this.el_.removeAttribute("disabled")},t.disable=function(){n.prototype.disable.call(this);this.el_.setAttribute("disabled","disabled")},t.handleKeyDown=function(t){if(e.isEventKey(t,"Space")||e.isEventKey(t,"Enter")){t.stopPropagation();return}n.prototype.handleKeyDown.call(this,t)},i}(gf);r.registerComponent("Button",dt);fl=function(n){function i(t,i){var r;r=n.call(this,t,i)||this;r.mouseused_=!1;r.on("mousedown",r.handleMouseDown);return r}u(i,n);var t=i.prototype;return t.buildCSSClass=function(){return"vjs-big-play-button"},t.handleClick=function(n){var t=this.player_.play(),f,i,r,u;if(this.mouseused_&&n.clientX&&n.clientY){f=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&this.player_.eme.sessions.length>0;fu(t);!this.player_.tech(!0)||(no||ge)&&f||this.player_.tech(!0).focus();return}if(i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle"),!r){this.player_.tech(!0).focus();return}u=function(){return r.focus()};yf(t)?t.then(u,function(){}):this.setTimeout(u,1)},t.handleKeyDown=function(t){this.mouseused_=!1;n.prototype.handleKeyDown.call(this,t)},t.handleMouseDown=function(){this.mouseused_=!0},i}(dt);fl.prototype.controlText_="Play Video";r.registerComponent("BigPlayButton",fl);bb=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.controlText(i&&i.controlText||r.localize("Close")),r}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-close-button "+n.prototype.buildCSSClass.call(this)},i.handleClick=function(){this.trigger({type:"close",bubbles:!1})},i.handleKeyDown=function(t){e.isEventKey(t,"Esc")?(t.preventDefault(),t.stopPropagation(),this.trigger("click")):n.prototype.handleKeyDown.call(this,t)},t}(dt);r.registerComponent("CloseButton",bb);el=function(n){function i(t,i){var r;i===void 0&&(i={});r=n.call(this,t,i)||this;i.replay=i.replay===undefined||i.replay;r.on(t,"play",r.handlePlay);r.on(t,"pause",r.handlePause);if(i.replay)r.on(t,"ended",r.handleEnded);return r}u(i,n);var t=i.prototype;return t.buildCSSClass=function(){return"vjs-play-control "+n.prototype.buildCSSClass.call(this)},t.handleClick=function(){this.player_.paused()?this.player_.play():this.player_.pause()},t.handleSeeked=function(n){this.removeClass("vjs-ended");this.player_.paused()?this.handlePause(n):this.handlePlay(n)},t.handlePlay=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.controlText("Pause")},t.handlePause=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.controlText("Play")},t.handleEnded=function(){this.removeClass("vjs-playing");this.addClass("vjs-ended");this.controlText("Replay");this.one(this.player_,"seeked",this.handleSeeked)},i}(dt);el.prototype.controlText_="Play";r.registerComponent("PlayToggle",el);ol=function(n,t){n=n<0?0:n;var i=Math.floor(n%60),r=Math.floor(n/60%60),u=Math.floor(n/3600),f=Math.floor(t/60%60),e=Math.floor(t/3600);return(isNaN(n)||n===Infinity)&&(u=r=i="-"),u=u>0||e>0?u+":":"",r=((u||f>=10)&&r<10?"0"+r:r)+":",i=i<10?"0"+i:i,u+r+i};so=ol;lr=function(n){function r(t,i){var r=n.call(this,t,i)||this;r.on(t,["timeupdate","ended"],r.updateContent);return r.updateTextNode_(),r}u(r,n);var i=r.prototype;return i.createEl=function(){var t=this.buildCSSClass(),i=n.prototype.createEl.call(this,"div",{className:t+" vjs-time-control vjs-control",innerHTML:'<span class="vjs-control-text" role="presentation">'+this.localize(this.labelText_)+" <\/span>"});return this.contentEl_=w("span",{className:t+"-display"},{"aria-live":"off",role:"presentation"}),i.appendChild(this.contentEl_),i},i.dispose=function(){this.contentEl_=null;this.textNode_=null;n.prototype.dispose.call(this)},i.updateTextNode_=function(n){var i=this;(n===void 0&&(n=0),n=cu(n),this.formattedTime_!==n)&&(this.formattedTime_=n,this.requestAnimationFrame(function(){if(i.contentEl_){var n=i.textNode_;(i.textNode_=t.createTextNode(i.formattedTime_),i.textNode_)&&(n?i.contentEl_.replaceChild(i.textNode_,n):i.contentEl_.appendChild(i.textNode_))}}))},i.updateContent=function(){},r}(r);lr.prototype.labelText_="Time";lr.prototype.controlText_="Time";r.registerComponent("TimeDisplay",lr);ho=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(){var n;n=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(n)},t}(lr);ho.prototype.labelText_="Current Time";ho.prototype.controlText_="Current Time";r.registerComponent("CurrentTimeDisplay",ho);co=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"durationchange",r.updateContent);r.on(t,"loadstart",r.updateContent);r.on(t,"loadedmetadata",r.updateContent);return r}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-duration"},i.updateContent=function(){var n=this.player_.duration();this.updateTextNode_(n)},t}(lr);co.prototype.labelText_="Duration";co.prototype.controlText_="Duration";r.registerComponent("DurationDisplay",co);kb=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider",innerHTML:"<div><span>/<\/span><\/div>"},{"aria-hidden":!0})},t}(r);r.registerComponent("TimeDivider",kb);lo=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"durationchange",r.updateContent);return r}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-remaining-time"},i.createEl=function(){var t=n.prototype.createEl.call(this);return t.insertBefore(w("span",{},{"aria-hidden":!0},"-"),this.contentEl_),t},i.updateContent=function(){if(typeof this.player_.duration()=="number"){var n;n=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime();this.updateTextNode_(n)}},t}(lr);lo.prototype.labelText_="Remaining Time";lo.prototype.controlText_="Remaining Time";r.registerComponent("RemainingTimeDisplay",lo);db=function(n){function t(t,i){var r;r=n.call(this,t,i)||this;r.updateShowing();r.on(r.player(),"durationchange",r.updateShowing);return r}u(t,n);var i=t.prototype;return i.createEl=function(){var t=n.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=w("div",{className:"vjs-live-display",innerHTML:'<span class="vjs-control-text">'+this.localize("Stream Type")+" <\/span>"+this.localize("LIVE")},{"aria-live":"off"}),t.appendChild(this.contentEl_),t},i.dispose=function(){this.contentEl_=null;n.prototype.dispose.call(this)},i.updateShowing=function(){this.player().duration()===Infinity?this.show():this.hide()},t}(r);r.registerComponent("LiveDisplay",db);sl=function(n){function i(t,i){var r;if(r=n.call(this,t,i)||this,r.updateLiveEdgeStatus(),r.player_.liveTracker)r.on(r.player_.liveTracker,"liveedgechange",r.updateLiveEdgeStatus);return r}u(i,n);var t=i.prototype;return t.createEl=function(){var t=n.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=w("span",{className:"vjs-seek-to-live-text",innerHTML:this.localize("LIVE")},{"aria-hidden":"true"}),t.appendChild(this.textEl_),t},t.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"))},t.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},t.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatus);this.textEl_=null;n.prototype.dispose.call(this)},i}(dt);sl.prototype.controlText_="Seek to live, currently playing live";r.registerComponent("SeekToLive",sl);ao=function(n,t,i){return n=Number(n),Math.min(i,Math.max(t,isNaN(n)?t:n))};vo=function(n){function i(t,i){var r;return r=n.call(this,t,i)||this,r.bar=r.getChild(r.options_.barName),r.vertical(!!r.options_.vertical),r.enable(),r}u(i,n);var t=i.prototype;return t.enabled=function(){return this.enabled_},t.enable=function(){if(!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);if(this.playerEvent)this.on(this.player_,this.playerEvent,this.update);this.removeClass("disabled");this.setAttribute("tabindex",0);this.enabled_=!0}},t.disable=function(){if(this.enabled()){var n=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(n,"mousemove",this.handleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchmove",this.handleMouseMove);this.off(n,"touchend",this.handleMouseUp);this.removeAttribute("tabindex");this.addClass("disabled");this.playerEvent&&this.off(this.player_,this.playerEvent,this.update);this.enabled_=!1}},t.createEl=function(t,i,r){return i===void 0&&(i={}),r===void 0&&(r={}),i.className=i.className+" vjs-slider",i=y({tabIndex:0},i),r=y({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},r),n.prototype.createEl.call(this,t,i,r)},t.handleMouseDown=function(n){var t=this.bar.el_.ownerDocument;n.type==="mousedown"&&n.preventDefault();n.type!=="touchstart"||li||n.preventDefault();dy();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(n)},t.handleMouseMove=function(){},t.handleMouseUp=function(){var n=this.bar.el_.ownerDocument;gy();this.removeClass("vjs-sliding");this.trigger("sliderinactive");this.off(n,"mousemove",this.handleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchmove",this.handleMouseMove);this.off(n,"touchend",this.handleMouseUp);this.update()},t.update=function(){var t=this,n;if(this.el_&&this.bar)return(n=this.getProgress(),n===this.progress_)?n:(this.progress_=n,this.requestAnimationFrame(function(){var i=t.vertical()?"height":"width";t.bar.el().style[i]=(n*100).toFixed(2)+"%"}),n)},t.getProgress=function(){return Number(ao(this.getPercent(),0,1).toFixed(4))},t.calculateDistance=function(n){var t=yh(this.el_,n);return this.vertical()?t.y:t.x},t.handleKeyDown=function(t){e.isEventKey(t,"Left")||e.isEventKey(t,"Down")?(t.preventDefault(),t.stopPropagation(),this.stepBack()):e.isEventKey(t,"Right")||e.isEventKey(t,"Up")?(t.preventDefault(),t.stopPropagation(),this.stepForward()):n.prototype.handleKeyDown.call(this,t)},t.handleClick=function(n){n.stopPropagation();n.preventDefault()},t.vertical=function(n){if(n===undefined)return this.vertical_||!1;this.vertical_=!!n;this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},i}(r);r.registerComponent("Slider",vo);yo=function(n,t){return ao(n/t*100,0,100).toFixed(2)+"%"};gb=function(n){function i(t,i){var r;r=n.call(this,t,i)||this;r.partEls_=[];r.on(t,"progress",r.update);return r}u(i,n);var r=i.prototype;return r.createEl=function(){var r=n.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),i=w("span",{className:"vjs-control-text"}),u=w("span",{textContent:this.localize("Loaded")}),f=t.createTextNode(": ");return this.percentageEl_=w("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),r.appendChild(i),i.appendChild(u),i.appendChild(f),i.appendChild(this.percentageEl_),r},r.dispose=function(){this.partEls_=null;this.percentageEl_=null;n.prototype.dispose.call(this)},r.update=function(){var n=this;this.requestAnimationFrame(function(){var s=n.player_.liveTracker,r=n.player_.buffered(),l=s&&s.isLive()?s.seekableEnd():n.player_.duration(),h=n.player_.bufferedEnd(),u=n.partEls_,f=yo(h,l),i,o;for(n.percent_!==f&&(n.el_.style.width=f,tu(n.percentageEl_,f),n.percent_=f),i=0;i<r.length;i++){var e=r.start(i),c=r.end(i),t=u[i];(t||(t=n.el_.appendChild(w()),u[i]=t),t.dataset.start!==e||t.dataset.end!==c)&&(t.dataset.start=e,t.dataset.end=c,t.style.left=yo(e,h),t.style.width=yo(c-e,h))}for(o=u.length;o>r.length;o--)n.el_.removeChild(u[o-1]);u.length=r.length})},i}(r);r.registerComponent("LoadProgressBar",gb);nk=function(n){function i(t,i){var r;return r=n.call(this,t,i)||this,r.update=rr(s(o(r),r.update),ci),r}u(i,n);var t=i.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},t.update=function(n,t,i){var u=hf(this.el_),f=hf(this.player_.el()),e=n.width*t;if(f&&u){var o=n.left-f.left+e,s=n.width-e+(f.right-n.right),r=u.width/2;o<r?r+=r-o:s<r&&(r=s);r<0?r=0:r>u.width&&(r=u.width);this.el_.style.right="-"+r+"px";this.write(i)}},t.write=function(n){tu(this.el_,n)},t.updateTime=function(n,t,i,r){var u=this;this.rafId_&&this.cancelAnimationFrame(this.rafId_);this.rafId_=this.requestAnimationFrame(function(){var e,s=u.player_.duration(),f,o;u.player_.liveTracker&&u.player_.liveTracker.isLive()?(f=u.player_.liveTracker.liveWindow(),o=f-t*f,e=(o<1?"":"-")+cu(o,f)):e=cu(i,s);u.update(n,t,e);r&&r()})},i}(r);r.registerComponent("TimeTooltip",nk);po=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.update=rr(s(o(r),r.update),ci),r}u(t,n);var i=t.prototype;return i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},i.update=function(n,t){var i=this.getChild("timeTooltip"),r;i&&(r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),i.updateTime(n,t,r))},t}(r);po.prototype.options_={children:[]};ri||di||po.prototype.options_.children.push("timeTooltip");r.registerComponent("PlayProgressBar",po);hl=function(n){function t(t,i){var r;return r=n.call(this,t,i)||this,r.update=rr(s(o(r),r.update),ci),r}u(t,n);var i=t.prototype;return i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},i.update=function(n,t){var i=this,r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(n,t,r,function(){i.el_.style.left=n.width*t+"px"})},t}(r);hl.prototype.options_={children:["timeTooltip"]};r.registerComponent("MouseTimeDisplay",hl);var wo=5,tk=12,cl=function(n){function r(t,i){var r;return r=n.call(this,t,i)||this,r.setEventHandlers_(),r}u(r,n);var i=r.prototype;return i.setEventHandlers_=function(){this.update_=s(this,this.update);this.update=rr(this.update_,ci);this.on(this.player_,["ended","durationchange","timeupdate"],this.update);if(this.player_.liveTracker)this.on(this.player_.liveTracker,"liveedgechange",this.update);this.updateInterval=null;this.on(this.player_,["playing"],this.enableInterval_);this.on(this.player_,["ended","pause","waiting"],this.disableInterval_);if("hidden"in t&&"visibilityState"in t)this.on(t,"visibilitychange",this.toggleVisibility_)},i.toggleVisibility_=function(n){t.hidden?this.disableInterval_(n):(this.enableInterval_(),this.update())},i.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,ci))},i.disableInterval_=function(n){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&n.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},i.update=function(){var t=this,i=n.prototype.update.call(this);return this.requestAnimationFrame(function(){var r=t.player_.ended()?t.player_.duration():t.getCurrentTime_(),u=t.player_.liveTracker,n=t.player_.duration();u&&u.isLive()&&(n=t.player_.liveTracker.liveCurrentTime());t.percent_!==i&&(t.el_.setAttribute("aria-valuenow",(i*100).toFixed(2)),t.percent_=i);(t.currentTime_!==r||t.duration_!==n)&&(t.el_.setAttribute("aria-valuetext",t.localize("progress bar timing: currentTime={1} duration={2}",[cu(r,n),cu(n,n)],"{1} of {2}")),t.currentTime_=r,t.duration_=n);t.bar&&t.bar.update(hf(t.el()),t.getProgress())}),i},i.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},i.getPercent=function(){var i=this.getCurrentTime_(),t,n=this.player_.liveTracker;return n&&n.isLive()?(t=(i-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=i/this.player_.duration(),t},i.handleMouseDown=function(t){iu(t)&&(t.stopPropagation(),this.player_.scrubbing(!0),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),n.prototype.handleMouseDown.call(this,t))},i.handleMouseMove=function(n){var t,u,i,r,f;if(iu(n)){if(u=this.calculateDistance(n),i=this.player_.liveTracker,i&&i.isLive()){if(r=i.seekableStart(),f=i.liveCurrentTime(),t=r+u*i.liveWindow(),t>=f&&(t=f),t<=r&&(t=r+.1),t===Infinity)return}else t=u*this.player_.duration(),t===this.player_.duration()&&(t=t-.1);this.player_.currentTime(t)}},i.enable=function(){n.prototype.enable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.show()},i.disable=function(){n.prototype.disable.call(this);var t=this.getChild("mouseTimeDisplay");t&&t.hide()},i.handleMouseUp=function(t){n.prototype.handleMouseUp.call(this,t);t&&t.stopPropagation();this.player_.scrubbing(!1);this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0});this.videoWasPlaying?fu(this.player_.play()):this.update_()},i.stepForward=function(){this.player_.currentTime(this.player_.currentTime()+wo)},i.stepBack=function(){this.player_.currentTime(this.player_.currentTime()-wo)},i.handleAction=function(){this.player_.paused()?this.player_.play():this.player_.pause()},i.handleKeyDown=function(t){if(e.isEventKey(t,"Space")||e.isEventKey(t,"Enter"))t.preventDefault(),t.stopPropagation(),this.handleAction(t);else if(e.isEventKey(t,"Home"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(0);else if(e.isEventKey(t,"End"))t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.duration());else if(/^[0-9]$/.test(e(t))){t.preventDefault();t.stopPropagation();var i=(e.codes[e(t)]-e.codes["0"])/10;this.player_.currentTime(this.player_.duration()*i)}else e.isEventKey(t,"PgDn")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()-wo*tk)):e.isEventKey(t,"PgUp")?(t.preventDefault(),t.stopPropagation(),this.player_.currentTime(this.player_.currentTime()+wo*tk)):n.prototype.handleKeyDown.call(this,t)},r}(vo);cl.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};ri||di||cl.prototype.options_.children.splice(1,0,"mouseTimeDisplay");r.registerComponent("SeekBar",cl);ll=function(n){function i(t,i){var r;return r=n.call(this,t,i)||this,r.handleMouseMove=rr(s(o(r),r.handleMouseMove),ci),r.throttledHandleMouseSeek=rr(s(o(r),r.handleMouseSeek),ci),r.enable(),r}u(i,n);var t=i.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},t.handleMouseMove=function(n){var t=this.getChild("seekBar"),i,r;if(t&&(i=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay"),i||r)){var f=t.el(),e=hf(f),u=yh(f,n).x;u=ao(0,1,u);r&&r.update(e,u);i&&i.update(e,t.getProgress())}},t.handleMouseSeek=function(n){var t=this.getChild("seekBar");t&&t.handleMouseMove(n)},t.enabled=function(){return this.enabled_},t.disable=function(){(this.children().forEach(function(n){return n.disable&&n.disable()}),this.enabled())&&(this.off(["mousedown","touchstart"],this.handleMouseDown),this.off(this.el_,"mousemove",this.handleMouseMove),this.handleMouseUp(),this.addClass("disabled"),this.enabled_=!1)},t.enable=function(){if(this.children().forEach(function(n){return n.enable&&n.enable()}),!this.enabled()){this.on(["mousedown","touchstart"],this.handleMouseDown);this.on(this.el_,"mousemove",this.handleMouseMove);this.removeClass("disabled");this.enabled_=!0}},t.handleMouseDown=function(n){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(n);this.on(t,"mousemove",this.throttledHandleMouseSeek);this.on(t,"touchmove",this.throttledHandleMouseSeek);this.on(t,"mouseup",this.handleMouseUp);this.on(t,"touchend",this.handleMouseUp)},t.handleMouseUp=function(n){var t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseUp(n);this.off(t,"mousemove",this.throttledHandleMouseSeek);this.off(t,"touchmove",this.throttledHandleMouseSeek);this.off(t,"mouseup",this.handleMouseUp);this.off(t,"touchend",this.handleMouseUp)},i}(r);ll.prototype.options_={children:["seekBar"]};r.registerComponent("ProgressControl",ll);al=function(n){function i(i,r){var u=n.call(this,i,r)||this;u.on(i,["enterpictureinpicture","leavepictureinpicture"],u.handlePictureInPictureChange);return t.pictureInPictureEnabled||u.disable(),u}u(i,n);var r=i.prototype;return r.buildCSSClass=function(){return"vjs-picture-in-picture-control "+n.prototype.buildCSSClass.call(this)},r.handlePictureInPictureChange=function(){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture")},r.handleClick=function(){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},i}(dt);al.prototype.controlText_="Picture-in-Picture";r.registerComponent("PictureInPictureToggle",al);vl=function(n){function i(i,r){var u=n.call(this,i,r)||this;u.on(i,"fullscreenchange",u.handleFullscreenChange);return t[i.fsApi_.fullscreenEnabled]===!1&&u.disable(),u}u(i,n);var r=i.prototype;return r.buildCSSClass=function(){return"vjs-fullscreen-control "+n.prototype.buildCSSClass.call(this)},r.handleFullscreenChange=function(){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},r.handleClick=function(){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},i}(dt);vl.prototype.controlText_="Fullscreen";r.registerComponent("FullscreenToggle",vl);ik=function(n,t){t.tech_&&!t.tech_.featuresVolumeControl&&n.addClass("vjs-hidden");n.on(t,"loadstart",function(){t.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};rk=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-level",innerHTML:'<span class="vjs-control-text"><\/span>'})},t}(r);r.registerComponent("VolumeLevel",rk);bo=function(n){function i(t,i){var r=n.call(this,t,i)||this;r.on("slideractive",r.updateLastVolume_);r.on(t,"volumechange",r.updateARIAAttributes);return t.ready(function(){return r.updateARIAAttributes()}),r}u(i,n);var t=i.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},t.handleMouseDown=function(t){iu(t)&&n.prototype.handleMouseDown.call(this,t)},t.handleMouseMove=function(n){iu(n)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(n)))},t.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},t.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},t.stepForward=function(){this.checkMuted();this.player_.volume(this.player_.volume()+.1)},t.stepBack=function(){this.checkMuted();this.player_.volume(this.player_.volume()-.1)},t.updateARIAAttributes=function(){var n=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",n);this.el_.setAttribute("aria-valuetext",n+"%")},t.volumeAsPercentage_=function(){return Math.round(this.player_.volume()*100)},t.updateLastVolume_=function(){var n=this,t=this.player_.volume();this.one("sliderinactive",function(){n.player_.volume()===0&&n.player_.lastVolume_(t)})},i}(vo);bo.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};bo.prototype.playerEvent="volumechange";r.registerComponent("VolumeBar",bo);yl=function(n){function i(t,i){var r;i===void 0&&(i={});i.vertical=i.vertical||!1;(typeof i.volumeBar=="undefined"||ff(i.volumeBar))&&(i.volumeBar=i.volumeBar||{},i.volumeBar.vertical=i.vertical);r=n.call(this,t,i)||this;ik(o(r),t);r.throttledHandleMouseMove=rr(s(o(r),r.handleMouseMove),ci);r.on("mousedown",r.handleMouseDown);r.on("touchstart",r.handleMouseDown);r.on(r.volumeBar,["focus","slideractive"],function(){r.volumeBar.addClass("vjs-slider-active");r.addClass("vjs-slider-active");r.trigger("slideractive")});r.on(r.volumeBar,["blur","sliderinactive"],function(){r.volumeBar.removeClass("vjs-slider-active");r.removeClass("vjs-slider-active");r.trigger("sliderinactive")});return r}u(i,n);var t=i.prototype;return t.createEl=function(){var t="vjs-volume-horizontal";return this.options_.vertical&&(t="vjs-volume-vertical"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+t})},t.handleMouseDown=function(){var n=this.el_.ownerDocument;this.on(n,"mousemove",this.throttledHandleMouseMove);this.on(n,"touchmove",this.throttledHandleMouseMove);this.on(n,"mouseup",this.handleMouseUp);this.on(n,"touchend",this.handleMouseUp)},t.handleMouseUp=function(){var n=this.el_.ownerDocument;this.off(n,"mousemove",this.throttledHandleMouseMove);this.off(n,"touchmove",this.throttledHandleMouseMove);this.off(n,"mouseup",this.handleMouseUp);this.off(n,"touchend",this.handleMouseUp)},t.handleMouseMove=function(n){this.volumeBar.handleMouseMove(n)},i}(r);yl.prototype.options_={children:["volumeBar"]};r.registerComponent("VolumeControl",yl);uk=function(n,t){t.tech_&&!t.tech_.featuresMuteControl&&n.addClass("vjs-hidden");n.on(t,"loadstart",function(){t.tech_.featuresMuteControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")})};pl=function(n){function i(t,i){var r;r=n.call(this,t,i)||this;uk(o(r),t);r.on(t,["loadstart","volumechange"],r.update);return r}u(i,n);var t=i.prototype;return t.buildCSSClass=function(){return"vjs-mute-control "+n.prototype.buildCSSClass.call(this)},t.handleClick=function(){var i=this.player_.volume(),n=this.player_.lastVolume_(),t;i===0?(t=n<.1?.1:n,this.player_.volume(t),this.player_.muted(!1)):this.player_.muted(this.player_.muted()?!1:!0)},t.update=function(){this.updateIcon_();this.updateControlText_()},t.updateIcon_=function(){var i=this.player_.volume(),n=3,t;for(ri&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),i===0||this.player_.muted()?n=0:i<.33?n=1:i<.67&&(n=2),t=0;t<4;t++)of(this.el_,"vjs-vol-"+t);si(this.el_,"vjs-vol-"+n)},t.updateControlText_=function(){var t=this.player_.muted()||this.player_.volume()===0,n=t?"Unmute":"Mute";this.controlText()!==n&&this.controlText(n)},i}(dt);pl.prototype.controlText_="Mute";r.registerComponent("MuteToggle",pl);wl=function(n){function r(t,i){var r;i===void 0&&(i={});i.inline=typeof i.inline!="undefined"?i.inline:!0;(typeof i.volumeControl=="undefined"||ff(i.volumeControl))&&(i.volumeControl=i.volumeControl||{},i.volumeControl.vertical=!i.inline);r=n.call(this,t,i)||this;r.on(t,["loadstart"],r.volumePanelState_);r.on(r.muteToggle,"keyup",r.handleKeyPress);r.on(r.volumeControl,"keyup",r.handleVolumeControlKeyUp);r.on("keydown",r.handleKeyPress);r.on("mouseover",r.handleMouseOver);r.on("mouseout",r.handleMouseOut);r.on(r.volumeControl,["slideractive"],r.sliderActive_);r.on(r.volumeControl,["sliderinactive"],r.sliderInactive_);return r}u(r,n);var i=r.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"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+t})},i.dispose=function(){this.handleMouseOut();n.prototype.dispose.call(this)},i.handleVolumeControlKeyUp=function(n){e.isEventKey(n,"Esc")&&this.muteToggle.focus()},i.handleMouseOver=function(){this.addClass("vjs-hover");yt(t,"keyup",s(this,this.handleKeyPress))},i.handleMouseOut=function(){this.removeClass("vjs-hover");it(t,"keyup",s(this,this.handleKeyPress))},i.handleKeyPress=function(n){e.isEventKey(n,"Esc")&&this.handleMouseOut()},r}(r);wl.prototype.options_={children:["muteToggle","volumeControl"]};r.registerComponent("VolumePanel",wl);ko=function(n){function f(t,i){var r;r=n.call(this,t,i)||this;i&&(r.menuButton_=i.menuButton);r.focusedChild_=-1;r.on("keydown",r.handleKeyDown);return r.boundHandleBlur_=s(o(r),r.handleBlur),r.boundHandleTapClick_=s(o(r),r.handleTapClick),r}u(f,n);var i=f.prototype;return i.addEventListenerForItem=function(n){if(n instanceof r){this.on(n,"blur",this.boundHandleBlur_);this.on(n,["tap","click"],this.boundHandleTapClick_)}},i.removeEventListenerForItem=function(n){n instanceof r&&(this.off(n,"blur",this.boundHandleBlur_),this.off(n,["tap","click"],this.boundHandleTapClick_))},i.removeChild=function(t){typeof t=="string"&&(t=this.getChild(t));this.removeEventListenerForItem(t);n.prototype.removeChild.call(this,t)},i.addItem=function(n){var t=this.addChild(n);t&&this.addEventListenerForItem(t)},i.createEl=function(){var i=this.options_.contentElType||"ul",t;return this.contentEl_=w(i,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu"),t=n.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"}),t.appendChild(this.contentEl_),yt(t,"click",function(n){n.preventDefault();n.stopImmediatePropagation()}),t},i.dispose=function(){this.contentEl_=null;this.boundHandleBlur_=null;this.boundHandleTapClick_=null;n.prototype.dispose.call(this)},i.handleBlur=function(n){var r=n.relatedTarget||t.activeElement,i;this.children().some(function(n){return n.el()===r})||(i=this.menuButton_,i&&i.buttonPressed_&&r!==i.el().firstChild&&i.unpressButton())},i.handleTapClick=function(n){var t,i;if(this.menuButton_){if(this.menuButton_.unpressButton(),t=this.children(),!Array.isArray(t))return;if(i=t.filter(function(t){return t.el()===n.target})[0],!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}},i.handleKeyDown=function(n){e.isEventKey(n,"Left")||e.isEventKey(n,"Down")?(n.preventDefault(),n.stopPropagation(),this.stepForward()):(e.isEventKey(n,"Right")||e.isEventKey(n,"Up"))&&(n.preventDefault(),n.stopPropagation(),this.stepBack())},i.stepForward=function(){var n=0;this.focusedChild_!==undefined&&(n=this.focusedChild_+1);this.focus(n)},i.stepBack=function(){var n=0;this.focusedChild_!==undefined&&(n=this.focusedChild_-1);this.focus(n)},i.focus=function(n){n===void 0&&(n=0);var t=this.children().slice(),i=t.length&&t[0].className&&/vjs-menu-title/.test(t[0].className);i&&t.shift();t.length>0&&(n<0?n=0:n>=t.length&&(n=t.length-1),this.focusedChild_=n,t[n].el_.focus())},f}(r);r.registerComponent("Menu",ko);go=function(n){function f(i,r){var u,f;r===void 0&&(r={});u=n.call(this,i,r)||this;u.menuButton_=new dt(i,r);u.menuButton_.controlText(u.controlText_);u.menuButton_.el_.setAttribute("aria-haspopup","true");f=dt.prototype.buildCSSClass();u.menuButton_.el_.className=u.buildCSSClass()+" "+f;u.menuButton_.removeClass("vjs-control");u.addChild(u.menuButton_);u.update();u.enabled_=!0;u.on(u.menuButton_,"tap",u.handleClick);u.on(u.menuButton_,"click",u.handleClick);u.on(u.menuButton_,"keydown",u.handleKeyDown);u.on(u.menuButton_,"mouseenter",function(){u.addClass("vjs-hover");u.menu.show();yt(t,"keyup",s(o(u),u.handleMenuKeyUp))});u.on("mouseleave",u.handleMouseLeave);u.on("keydown",u.handleSubmenuKeyDown);return u}u(f,n);var i=f.prototype;return i.update=function(){var n=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu));this.menu=n;this.addChild(n);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 t=new ko(this.player_,{menuButton:this}),i,u,n;if(this.hideThreshold_=0,this.options_.title&&(i=w("li",{className:"vjs-menu-title",innerHTML:b(this.options_.title),tabIndex:-1}),this.hideThreshold_+=1,u=new r(this.player_,{el:i}),t.addItem(u)),this.items=this.createItems(),this.items)for(n=0;n<this.items.length;n++)t.addItem(this.items[n]);return t},i.createItems=function(){},i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},i.buildWrapperCSSClass=function(){var t="vjs-menu-button",i;return t+=this.options_.inline===!0?"-inline":"-popup",i=dt.prototype.buildCSSClass(),"vjs-menu-button "+t+" "+i+" "+n.prototype.buildCSSClass.call(this)},i.buildCSSClass=function(){var t="vjs-menu-button";return t+=this.options_.inline===!0?"-inline":"-popup","vjs-menu-button "+t+" "+n.prototype.buildCSSClass.call(this)},i.controlText=function(n,t){return t===void 0&&(t=this.menuButton_.el()),this.menuButton_.controlText(n,t)},i.dispose=function(){this.handleMouseLeave();n.prototype.dispose.call(this)},i.handleClick=function(){this.buttonPressed_?this.unpressButton():this.pressButton()},i.handleMouseLeave=function(){this.removeClass("vjs-hover");it(t,"keyup",s(this,this.handleMenuKeyUp))},i.focus=function(){this.menuButton_.focus()},i.blur=function(){this.menuButton_.blur()},i.handleKeyDown=function(n){e.isEventKey(n,"Esc")||e.isEventKey(n,"Tab")?(this.buttonPressed_&&this.unpressButton(),e.isEventKey(n,"Tab")||(n.preventDefault(),this.menuButton_.focus())):(e.isEventKey(n,"Up")||e.isEventKey(n,"Down"))&&(this.buttonPressed_||(n.preventDefault(),this.pressButton()))},i.handleMenuKeyUp=function(n){(e.isEventKey(n,"Esc")||e.isEventKey(n,"Tab"))&&this.removeClass("vjs-hover")},i.handleSubmenuKeyPress=function(n){this.handleSubmenuKeyDown(n)},i.handleSubmenuKeyDown=function(n){(e.isEventKey(n,"Esc")||e.isEventKey(n,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),e.isEventKey(n,"Tab")||(n.preventDefault(),this.menuButton_.focus()))},i.pressButton=function(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),ri&&yy())return;this.menu.focus()}},i.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},i.disable=function(){this.unpressButton();this.enabled_=!1;this.addClass("vjs-disabled");this.menuButton_.disable()},i.enable=function(){this.enabled_=!0;this.removeClass("vjs-disabled");this.menuButton_.enable()},f}(r);r.registerComponent("MenuButton",go);ns=function(n){function t(t,i){var r,f=i.tracks,u;if(r=n.call(this,t,i)||this,r.items.length<=1&&r.hide(),!f)return o(r);u=s(o(r),r.update);f.addEventListener("removetrack",u);f.addEventListener("addtrack",u);r.player_.on("ready",u);r.player_.on("dispose",function(){f.removeEventListener("removetrack",u);f.removeEventListener("addtrack",u)});return r}return u(t,n),t}(go);r.registerComponent("TrackButton",ns);fk=["Tab","Esc","Up","Down","Right","Left"];lu=function(n){function i(t,i){var r;return r=n.call(this,t,i)||this,r.selectable=i.selectable,r.isSelected_=i.selected||!1,r.multiSelectable=i.multiSelectable,r.selected(r.isSelected_),r.selectable?r.multiSelectable?r.el_.setAttribute("role","menuitemcheckbox"):r.el_.setAttribute("role","menuitemradio"):r.el_.setAttribute("role","menuitem"),r}u(i,n);var t=i.prototype;return t.createEl=function(t,i,r){return this.nonIconControl=!0,n.prototype.createEl.call(this,"li",y({className:"vjs-menu-item",innerHTML:'<span class="vjs-menu-item-text">'+this.localize(this.options_.label)+"<\/span>",tabIndex:-1},i),r)},t.handleKeyDown=function(t){fk.some(function(n){return e.isEventKey(t,n)})||n.prototype.handleKeyDown.call(this,t)},t.handleClick=function(){this.selected(!0)},t.selected=function(n){this.selectable&&(n?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))},i}(gf);r.registerComponent("MenuItem",lu);au=function(i){function f(r,u){var f,c=u.track,e=r.textTracks(),s,l,h;u.label=c.label||c.language||"Unknown";u.selected=c.mode==="showing";f=i.call(this,r,u)||this;f.track=c;f.kinds=(u.kinds||[u.kind||f.track.kind]).filter(Boolean);s=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];f.handleTracksChange.apply(o(f),i)};l=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];f.handleSelectedLanguageChange.apply(o(f),i)};r.on(["loadstart","texttrackchange"],s);e.addEventListener("change",s);e.addEventListener("selectedlanguagechange",l);f.on("dispose",function(){r.off(["loadstart","texttrackchange"],s);e.removeEventListener("change",s);e.removeEventListener("selectedlanguagechange",l)});if(e.onchange===undefined)f.on(["tap","click"],function(){if(typeof n.Event!="object")try{h=new n.Event("change")}catch(i){}h||(h=t.createEvent("Event"),h.initEvent("change",!0,!0));e.dispatchEvent(h)});return f.handleTracksChange(),f}u(f,i);var r=f.prototype;return r.handleClick=function(n){var f=this.track,u=this.player_.textTracks(),r,t;if(i.prototype.handleClick.call(this,n),u)for(r=0;r<u.length;r++)(t=u[r],this.kinds.indexOf(t.kind)!==-1)&&(t===f?t.mode!=="showing"&&(t.mode="showing"):t.mode!=="disabled"&&(t.mode="disabled"))},r.handleTracksChange=function(){var n=this.track.mode==="showing";n!==this.isSelected_&&this.selected(n)},r.handleSelectedLanguageChange=function(){if(this.track.mode==="showing"){var n=this.player_.cache_.selectedLanguage;if(n&&n.enabled&&n.language===this.track.language&&n.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}},r.dispose=function(){this.track=null;i.prototype.dispose.call(this)},f}(lu);r.registerComponent("TextTrackMenuItem",au);bl=function(n){function t(t,i){return i.track={player:t,kind:i.kind,kinds:i.kinds,"default":!1,mode:"disabled"},i.kinds||(i.kinds=[i.kind]),i.track.label=i.label?i.label:i.kinds.join(" and ")+" off",i.selectable=!0,i.multiSelectable=!1,n.call(this,t,i)||this}u(t,n);var i=t.prototype;return i.handleTracksChange=function(){for(var i,r=this.player().textTracks(),n=!0,t=0,u=r.length;t<u;t++)if(i=r[t],this.options_.kinds.indexOf(i.kind)>-1&&i.mode==="showing"){n=!1;break}n!==this.isSelected_&&this.selected(n)},i.handleSelectedLanguageChange=function(){for(var t,i=this.player().textTracks(),r=!0,n=0,u=i.length;n<u;n++)if(t=i[n],["captions","descriptions","subtitles"].indexOf(t.kind)>-1&&t.mode==="showing"){r=!1;break}r&&(this.player_.cache_.selectedLanguage={enabled:!1})},t}(au);r.registerComponent("OffTextTrackMenuItem",bl);ar=function(n){function t(t,i){return i===void 0&&(i={}),i.tracks=t.textTracks(),n.call(this,t,i)||this}u(t,n);var i=t.prototype;return i.createItems=function(n,t){var e,u,i,r,f;for(n===void 0&&(n=[]),t===void 0&&(t=au),this.label_&&(e=this.label_+" off"),n.push(new bl(this.player_,{kinds:this.kinds_,kind:this.kind_,label:e})),this.hideThreshold_+=1,u=this.player_.textTracks(),Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]),i=0;i<u.length;i++)r=u[i],this.kinds_.indexOf(r.kind)>-1&&(f=new t(this.player_,{track:r,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1}),f.addClass("vjs-"+r.kind+"-menu-item"),n.push(f));return n},t}(ns);r.registerComponent("TextTrackButton",ar);kl=function(n){function t(t,i){var r,f=i.track,u=i.cue,e=t.currentTime();return i.selectable=!0,i.multiSelectable=!1,i.label=u.text,i.selected=u.startTime<=e&&e<u.endTime,r=n.call(this,t,i)||this,r.track=f,r.cue=u,f.addEventListener("cuechange",s(o(r),r.update)),r}u(t,n);var i=t.prototype;return i.handleClick=function(){n.prototype.handleClick.call(this);this.player_.currentTime(this.cue.startTime);this.update(this.cue.startTime)},i.update=function(){var n=this.cue,t=this.player_.currentTime();this.selected(n.startTime<=t&&t<n.endTime)},t}(lu);r.registerComponent("ChaptersTrackMenuItem",kl);ts=function(n){function i(t,i,r){return n.call(this,t,i,r)||this}u(i,n);var t=i.prototype;return t.buildCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-chapters-button "+n.prototype.buildWrapperCSSClass.call(this)},t.update=function(t){(!this.track_||t&&(t.type==="addtrack"||t.type==="removetrack"))&&this.setTrack(this.findChaptersTrack());n.prototype.update.call(this)},t.setTrack=function(n){var t,i;this.track_!==n&&(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_&&(t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_),t&&t.removeEventListener("load",this.updateHandler_),this.track_=null),this.track_=n,this.track_&&(this.track_.mode="hidden",i=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_),i&&i.addEventListener("load",this.updateHandler_)))},t.findChaptersTrack=function(){for(var t,i=this.player_.textTracks()||[],n=i.length-1;n>=0;n--)if(t=i[n],t.kind===this.kind_)return t},t.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(b(this.kind_))},t.createMenu=function(){return this.options_.title=this.getMenuCaption(),n.prototype.createMenu.call(this)},t.createItems=function(){var i=[],n,t,r,u,f;if(!this.track_||(n=this.track_.cues,!n))return i;for(t=0,r=n.length;t<r;t++)u=n[t],f=new kl(this.player_,{track:this.track_,cue:u}),i.push(f);return i},i}(ar);ts.prototype.kind_="chapters";ts.prototype.controlText_="Chapters";r.registerComponent("ChaptersButton",ts);is=function(n){function t(t,i,r){var u,f,e;u=n.call(this,t,i,r)||this;f=t.textTracks();e=s(o(u),u.handleTracksChange);f.addEventListener("change",e);u.on("dispose",function(){f.removeEventListener("change",e)});return u}u(t,n);var i=t.prototype;return i.handleTracksChange=function(){for(var t,i=this.player().textTracks(),r=!1,n=0,u=i.length;n<u;n++)if(t=i[n],t.kind!==this.kind_&&t.mode==="showing"){r=!0;break}r?this.disable():this.enable()},i.buildCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(ar);is.prototype.kind_="descriptions";is.prototype.controlText_="Descriptions";r.registerComponent("DescriptionsButton",is);rs=function(n){function t(t,i,r){return n.call(this,t,i,r)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildWrapperCSSClass.call(this)},t}(ar);rs.prototype.kind_="subtitles";rs.prototype.controlText_="Subtitles";r.registerComponent("SubtitlesButton",rs);us=function(n){function t(t,i){var r;return i.track={player:t,kind:i.kind,label:i.kind+" settings",selectable:!1,"default":!1,mode:"disabled"},i.selectable=!1,i.name="CaptionSettingsMenuItem",r=n.call(this,t,i)||this,r.addClass("vjs-texttrack-settings"),r.controlText(", opens "+i.kind+" settings dialog"),r}u(t,n);var i=t.prototype;return i.handleClick=function(){this.player().getChild("textTrackSettings").open()},t}(au);r.registerComponent("CaptionSettingsMenuItem",us);fs=function(n){function t(t,i,r){return n.call(this,t,i,r)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-captions-button "+n.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-captions-button "+n.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new us(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t)},t}(ar);fs.prototype.kind_="captions";fs.prototype.controlText_="Captions";r.registerComponent("CaptionsButton",fs);dl=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.createEl=function(t,i,r){var u='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return this.options_.track.kind==="captions"&&(u+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"><\/span>\n        <span class="vjs-control-text"> '+this.localize("Captions")+"<\/span>\n      "),u+="<\/span>",n.prototype.createEl.call(this,t,y({innerHTML:u},i),r)},t}(au);r.registerComponent("SubsCapsMenuItem",dl);es=function(n){function t(t,i){var r;return i===void 0&&(i={}),r=n.call(this,t,i)||this,r.label_="subtitles",["en","en-us","en-ca","fr-ca"].indexOf(r.player_.language_)>-1&&(r.label_="captions"),r.menuButton_.controlText(b(r.label_)),r}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+n.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(){var t=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(t.push(new us(this.player_,{kind:this.label_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,t,dl)},t}(ar);es.prototype.kinds_=["captions","subtitles"];es.prototype.controlText_="Subtitles";r.registerComponent("SubsCapsButton",es);gl=function(n){function t(t,i){var r,u=i.track,e=t.audioTracks(),f;i.label=u.label||u.language||"Unknown";i.selected=u.enabled;r=n.call(this,t,i)||this;r.track=u;r.addClass("vjs-"+u.kind+"-menu-item");f=function(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];r.handleTracksChange.apply(o(r),i)};e.addEventListener("change",f);r.on("dispose",function(){e.removeEventListener("change",f)});return r}u(t,n);var i=t.prototype;return i.createEl=function(t,i,r){var u='<span class="vjs-menu-item-text">'+this.localize(this.options_.label);return this.options_.track.kind==="main-desc"&&(u+='\n        <span aria-hidden="true" class="vjs-icon-placeholder"><\/span>\n        <span class="vjs-control-text"> '+this.localize("Descriptions")+"<\/span>\n      "),u+="<\/span>",n.prototype.createEl.call(this,t,y({innerHTML:u},i),r)},i.handleClick=function(t){var u=this.player_.audioTracks(),i,r;for(n.prototype.handleClick.call(this,t),i=0;i<u.length;i++)r=u[i],r.enabled=r===this.track},i.handleTracksChange=function(){this.selected(this.track.enabled)},t}(lu);r.registerComponent("AudioTrackMenuItem",gl);na=function(n){function t(t,i){return i===void 0&&(i={}),i.tracks=t.audioTracks(),n.call(this,t,i)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-audio-button "+n.prototype.buildCSSClass.call(this)},i.buildWrapperCSSClass=function(){return"vjs-audio-button "+n.prototype.buildWrapperCSSClass.call(this)},i.createItems=function(n){var i,t,r;for(n===void 0&&(n=[]),this.hideThreshold_=1,i=this.player_.audioTracks(),t=0;t<i.length;t++)r=i[t],n.push(new gl(this.player_,{track:r,selectable:!0,multiSelectable:!1}));return n},t}(ns);na.prototype.controlText_="Audio Track";r.registerComponent("AudioTrackButton",na);os=function(n){function t(t,i){var r,u=i.rate,f=parseFloat(u,10);i.label=u;i.selected=f===1;i.selectable=!0;i.multiSelectable=!1;r=n.call(this,t,i)||this;r.label=u;r.rate=f;r.on(t,"ratechange",r.update);return r}u(t,n);var i=t.prototype;return i.handleClick=function(){n.prototype.handleClick.call(this);this.player().playbackRate(this.rate)},i.update=function(){this.selected(this.player().playbackRate()===this.rate)},t}(lu);os.prototype.contentElType="button";r.registerComponent("PlaybackRateMenuItem",os);ta=function(n){function i(t,i){var r;r=n.call(this,t,i)||this;r.updateVisibility();r.updateLabel();r.on(t,"loadstart",r.updateVisibility);r.on(t,"ratechange",r.updateLabel);return r}u(i,n);var t=i.prototype;return t.createEl=function(){var t=n.prototype.createEl.call(this);return this.labelEl_=w("div",{className:"vjs-playback-rate-value",innerHTML:"1x"}),t.appendChild(this.labelEl_),t},t.dispose=function(){this.labelEl_=null;n.prototype.dispose.call(this)},t.buildCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildWrapperCSSClass.call(this)},t.createMenu=function(){var i=new ko(this.player()),t=this.playbackRates(),n;if(t)for(n=t.length-1;n>=0;n--)i.addChild(new os(this.player(),{rate:t[n]+"x"}));return i},t.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},t.handleClick=function(){for(var r=this.player().playbackRate(),n=this.playbackRates(),i=n[0],t=0;t<n.length;t++)if(n[t]>r){i=n[t];break}this.player().playbackRate(i)},t.playbackRates=function(){return this.options_.playbackRates||this.options_.playerOptions&&this.options_.playerOptions.playbackRates},t.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0},t.updateVisibility=function(){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},t.updateLabel=function(){this.playbackRateSupported()&&(this.labelEl_.innerHTML=this.player().playbackRate()+"x")},i}(go);ta.prototype.controlText_="Playback Rate";r.registerComponent("PlaybackRateMenuButton",ta);ia=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-spacer "+n.prototype.buildCSSClass.call(this)},i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass()})},t}(r);r.registerComponent("Spacer",ia);ek=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+n.prototype.buildCSSClass.call(this)},i.createEl=function(){var t=n.prototype.createEl.call(this,{className:this.buildCSSClass()});return t.innerHTML=" ",t},t}(ia);r.registerComponent("CustomControlSpacer",ek);ne=function(n){function t(){return n.apply(this,arguments)||this}u(t,n);var i=t.prototype;return i.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(r);ne.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]};"exitPictureInPicture"in t&&ne.prototype.options_.children.splice(ne.prototype.options_.children.length-1,0,"pictureInPictureToggle");r.registerComponent("ControlBar",ne);ra=function(n){function t(t,i){var r=n.call(this,t,i)||this;r.on(t,"error",r.open);return r}u(t,n);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-error-display "+n.prototype.buildCSSClass.call(this)},i.content=function(){var n=this.player().error();return n?this.localize(n.message):""},t}(eu);ra.prototype.options_=ve({},eu.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});r.registerComponent("ErrorDisplay",ra);var ua="vjs-text-track-settings",ok=["#000","Black"],sk=["#00F","Blue"],hk=["#0FF","Cyan"],ck=["#0F0","Green"],lk=["#F0F","Magenta"],ak=["#F00","Red"],vk=["#FFF","White"],yk=["#FF0","Yellow"],fa=["1","Opaque"],ea=["0.5","Semi-Transparent"],pk=["0","Transparent"],vr={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ok,vk,ak,ck,sk,yk,lk,hk]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[fa,ea,pk]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[vk,ok,ak,ck,sk,yk,lk,hk]},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(n){return n==="1.00"?null:Number(n)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[fa,ea]},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:[pk,ea,fa]}};vr.windowColor.options=vr.backgroundColor.options;bk=function(t){function r(n,i){var r;i.temporary=!1;r=t.call(this,n,i)||this;r.updateDisplay=s(o(r),r.updateDisplay);r.fill();r.hasBeenOpened_=r.hasBeenFilled_=!0;r.endDialog=w("p",{className:"vjs-control-text",textContent:r.localize("End of dialog window.")});r.el().appendChild(r.endDialog);r.setDefaults();i.persistTextTrackSettings===undefined&&(r.options_.persistTextTrackSettings=r.options_.playerOptions.persistTextTrackSettings);r.on(r.$(".vjs-done-button"),"click",function(){r.saveSettings();r.close()});r.on(r.$(".vjs-default-button"),"click",function(){r.setDefaults();r.updateDisplay()});return gr(vr,function(n){r.on(r.$(n.selector),"change",r.updateDisplay)}),r.options_.persistTextTrackSettings&&r.restoreSettings(),r}u(r,t);var i=r.prototype;return i.dispose=function(){this.endDialog=null;t.prototype.dispose.call(this)},i.createElSelect_=function(n,t,i){var e=this;t===void 0&&(t="");i===void 0&&(i="label");var r=vr[n],u=r.id.replace("%s",this.id_),f=[t,u].join(" ").trim();return["<"+i+' id="'+u+'" class="'+(i==="label"?"vjs-label":"")+'">',this.localize(r.label),"<\/"+i+">",'<select aria-labelledby="'+f+'">'].concat(r.options.map(function(n){var t=u+"-"+n[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+n[0]+'" ','aria-labelledby="'+f+" "+t+'">',e.localize(n[1]),"<\/option>"].join("")})).concat("<\/select>").join("")},i.createElFgColor_=function(){var n="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Text"),"<\/legend>",this.createElSelect_("color",n),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.createElBgColor_=function(){var n="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Background"),"<\/legend>",this.createElSelect_("backgroundColor",n),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.createElWinColor_=function(){var n="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+n+'">',this.localize("Window"),"<\/legend>",this.createElSelect_("windowColor",n),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",n),"<\/span>","<\/fieldset>"].join("")},i.createElColors_=function(){return w("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},i.createElFont_=function(){return w("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"<\/fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"<\/fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"<\/fieldset>"].join("")})},i.createElControls_=function(){var n=this.localize("restore all settings to the default values");return w("div",{className:"vjs-track-settings-controls",innerHTML:['<button type="button" class="vjs-default-button" title="'+n+'">',this.localize("Reset"),'<span class="vjs-control-text"> '+n+"<\/span>","<\/button>",'<button type="button" class="vjs-done-button">'+this.localize("Done")+"<\/button>"].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 t.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},i.getValues=function(){var n=this;return oit(vr,function(t,i,r){var u=lft(n.$(i.selector),i.parser);return u!==undefined&&(t[r]=u),t},{})},i.setValues=function(n){var t=this;gr(vr,function(i,r){aft(t.$(i.selector),n[r],i.parser)})},i.setDefaults=function(){var n=this;gr(vr,function(t){var i=t.hasOwnProperty("default")?t["default"]:0;n.$(t.selector).selectedIndex=i})},i.restoreSettings=function(){var t;try{t=JSON.parse(n.localStorage.getItem(ua))}catch(i){h.warn(i)}t&&this.setValues(t)},i.saveSettings=function(){if(this.options_.persistTextTrackSettings){var t=this.getValues();try{Object.keys(t).length?n.localStorage.setItem(ua,JSON.stringify(t)):n.localStorage.removeItem(ua)}catch(i){h.warn(i)}}},i.updateDisplay=function(){var n=this.player_.getChild("textTrackDisplay");n&&n.updateDisplay()},i.conditionalBlur_=function(){this.previouslyActiveEl_=null;var n=this.player_.controlBar,t=n&&n.subsCapsButton,i=n&&n.captionsButton;t?t.focus():i&&i.focus()},r}(eu);r.registerComponent("TextTrackSettings",bk);kk=function(t){function i(i,r){var u,f=r.ResizeObserver||n.ResizeObserver,e;if(r.ResizeObserver===null&&(f=!1),e=v({createEl:!f,reportTouchActivity:!1},r),u=t.call(this,i,e)||this,u.ResizeObserver=r.ResizeObserver||n.ResizeObserver,u.loadListener_=null,u.resizeObserver_=null,u.debouncedHandler_=ait(function(){u.resizeHandler()},100,!1,o(u)),f)u.resizeObserver_=new u.ResizeObserver(u.debouncedHandler_),u.resizeObserver_.observe(i.el());else{u.loadListener_=function(){if(u.el_&&u.el_.contentWindow){var t=u.debouncedHandler_,n=u.unloadListener_=function(){it(this,"resize",t);it(this,"unload",n);n=null};yt(u.el_.contentWindow,"unload",n);yt(u.el_.contentWindow,"resize",t)}};u.one("load",u.loadListener_)}return u}u(i,t);var r=i.prototype;return r.createEl=function(){return t.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1},{"aria-hidden":"true"})},r.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},r.dispose=function(){this.debouncedHandler_&&this.debouncedHandler_.cancel();this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect());this.loadListener_&&this.off("load",this.loadListener_);this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow);this.ResizeObserver=null;this.resizeObserver=null;this.debouncedHandler_=null;this.loadListener_=null;t.prototype.dispose.call(this)},i}(r);r.registerComponent("ResizeManager",kk);dk=function(n){var t=Math.floor(n.length/2),i=[].concat(n).sort(function(n,t){return n-t});return n.length%2!=0?i[t]:(i[t-1]+i[t])/2};gk=function(n){function r(i,r){var u,f=v({createEl:!1},r);u=n.call(this,i,f)||this;u.reset_();u.on(u.player_,"durationchange",u.handleDurationchange);if(no&&"hidden"in t&&"visibilityState"in t)u.on(t,"visibilitychange",u.handleVisibilityChange);return u}u(r,n);var i=r.prototype;return i.handleVisibilityChange=function(){this.player_.duration()===Infinity&&(t.hidden?this.stopTracking():this.startTracking())},i.isBehind_=function(){if(!this.timeupdateSeen_)return!1;var n=this.liveCurrentTime(),t=this.player_.currentTime(),i=this.seekableIncrement_*2+.07;return n!==Infinity&&n-i>=t},i.trackLive_=function(){var t,n;(this.pastSeekEnd_=this.pastSeekEnd_,t=this.player_.seekable(),t&&t.length)&&(n=this.seekableEnd(),n!==this.lastSeekEnd_&&(this.lastSeekEnd_&&(this.seekableIncrementList_=this.seekableIncrementList_.slice(-11),this.seekableIncrementList_.push(Math.abs(n-this.lastSeekEnd_)),this.seekableIncrementList_.length>3&&(this.seekableIncrement_=dk(this.seekableIncrementList_))),this.pastSeekEnd_=0,this.lastSeekEnd_=n,this.trigger("seekableendchange")),this.pastSeekEnd_=this.pastSeekEnd()>this.seekableIncrement_*1.5?0:this.pastSeekEnd()+.03,this.isBehind_()!==this.behindLiveEdge()&&(this.behindLiveEdge_=this.isBehind_(),this.trigger("liveedgechange")))},i.handleDurationchange=function(){this.player_.duration()===Infinity?this.startTracking():this.stopTracking()},i.startTracking=function(){var n=this;if(!this.isTracking()){this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted());this.trackingInterval_=this.setInterval(this.trackLive_,ci);this.trackLive_();this.on(this.player_,"play",this.trackLive_);this.on(this.player_,"pause",this.trackLive_);if(!this.timeupdateSeen_){this.one(this.player_,"play",this.handlePlay);this.handleTimeupdate=function(){n.timeupdateSeen_=!0;n.handleTimeupdate=null};this.one(this.player_,"timeupdate",this.handleTimeupdate)}}},i.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge)},i.reset_=function(){this.pastSeekEnd_=0;this.lastSeekEnd_=null;this.behindLiveEdge_=null;this.timeupdateSeen_=!1;this.clearInterval(this.trackingInterval_);this.trackingInterval_=null;this.seekableIncrement_=12;this.seekableIncrementList_=[];this.off(this.player_,"play",this.trackLive_);this.off(this.player_,"pause",this.trackLive_);this.off(this.player_,"play",this.handlePlay);this.off(this.player_,"timeupdate",this.seekToLiveEdge);this.handleTimeupdate&&(this.off(this.player_,"timeupdate",this.handleTimeupdate),this.handleTimeupdate=null)},i.stopTracking=function(){this.isTracking()&&this.reset_()},i.seekableEnd=function(){for(var t=this.player_.seekable(),n=[],i=t?t.length:0;i--;)n.push(t.end(i));return n.length?n.sort()[n.length-1]:Infinity},i.seekableStart=function(){for(var n=this.player_.seekable(),t=[],i=n?n.length:0;i--;)t.push(n.start(i));return t.length?t.sort()[0]:0},i.liveWindow=function(){var n=this.liveCurrentTime();return n===Infinity?Infinity:n-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(){return this.pastSeekEnd_},i.behindLiveEdge=function(){return this.behindLiveEdge_},i.isTracking=function(){return typeof this.trackingInterval_=="number"},i.seekToLiveEdge=function(){this.atLiveEdge()||(this.player_.currentTime(this.liveCurrentTime()),this.player_.paused()&&this.player_.play())},i.dispose=function(){this.stopTracking();n.prototype.dispose.call(this)},r}(r);r.registerComponent("LiveTracker",gk);var oa=function(n){var f=n.el(),i,r;if(f.hasAttribute("src"))return n.triggerSourceset(f.src),!0;var u=n.$$("source"),t=[],e="";if(!u.length)return!1;for(i=0;i<u.length;i++)r=u[i].src,r&&t.indexOf(r)===-1&&t.push(r);return t.length?(t.length===1&&(e=t[0]),n.triggerSourceset(e),!0):!1},vft=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(i){var r=t.createElement(this.nodeName.toLowerCase()),u;for(r.innerHTML=i,u=t.createDocumentFragment();r.childNodes.length;)u.appendChild(r.childNodes[0]);return this.innerText="",n.Element.prototype.appendChild.call(this,u),this.innerHTML}}),nd=function(n,t){for(var i={},r=0;r<n.length;r++)if(i=Object.getOwnPropertyDescriptor(n[r],t),i&&i.set&&i.get)break;return i.enumerable=!0,i.configurable=!0,i},yft=function(t){return nd([t.el(),n.HTMLMediaElement.prototype,n.Element.prototype,vft],"innerHTML")},td=function(n){var t=n.el();if(!t.resetSourceWatch_){var i={},r=yft(n),u=function(i){return function(){for(var e,u=arguments.length,f=new Array(u),r=0;r<u;r++)f[r]=arguments[r];return e=i.apply(t,f),oa(n),e}};["append","appendChild","insertAdjacentHTML"].forEach(function(n){t[n]&&(i[n]=t[n],t[n]=u(i[n]))});Object.defineProperty(t,"innerHTML",v(r,{set:u(r.set)}));t.resetSourceWatch_=function(){t.resetSourceWatch_=null;Object.keys(i).forEach(function(n){t[n]=i[n]});Object.defineProperty(t,"innerHTML",r)};n.one("sourceset",t.resetSourceWatch_)}},pft=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?vw(n.Element.prototype.getAttribute.call(this,"src")):""},set:function(t){return n.Element.prototype.setAttribute.call(this,"src",t),t}}),wft=function(t){return nd([t.el(),n.HTMLMediaElement.prototype,pft],"src")},bft=function(n){var t;if(n.featuresSourceset&&(t=n.el(),!t.resetSourceset_)){var i=wft(n),r=t.setAttribute,u=t.load;Object.defineProperty(t,"src",v(i,{set:function(r){var u=i.set.call(t,r);return n.triggerSourceset(t.src),u}}));t.setAttribute=function(i,u){var f=r.call(t,i,u);return/src/i.test(i)&&n.triggerSourceset(t.src),f};t.load=function(){var i=u.call(t);return oa(n)||(n.triggerSourceset(""),td(n)),i};t.currentSrc?n.triggerSourceset(t.currentSrc):oa(n)||td(n);t.resetSourceset_=function(){t.resetSourceset_=null;t.load=u;t.setAttribute=r;Object.defineProperty(t,"src",i);t.resetSourceWatch_&&t.resetSourceWatch_()}}},sa=function(n,t,i,r){r===void 0&&(r=!0);var u=function(i){return Object.defineProperty(n,t,{value:i,enumerable:!0,writable:!0})},f={configurable:!0,enumerable:!0,get:function(){var n=i();return u(n),n}};return r&&(f.set=u),Object.defineProperty(n,t,f)},f=function(i){function f(n,t){var r,f,e,u,a,o;if(r=i.call(this,n,t)||this,f=n.source,e=!1,f&&(r.el_.currentSrc!==f.src||n.tag&&n.tag.initNetworkState_===3)?r.setSource(f):r.handleLateInit_(r.el_),n.enableSourceset&&r.setupSourcesetHandling_(),r.el_.hasChildNodes()){for(var c=r.el_.childNodes,l=c.length,s=[];l--;)u=c[l],a=u.nodeName.toLowerCase(),a==="track"&&(r.featuresNativeTextTracks?(r.remoteTextTrackEls().addTrackElement_(u),r.remoteTextTracks().addTrack(u.track),r.textTracks().addTrack(u.track),e||r.el_.hasAttribute("crossorigin")||!io(u.src)||(e=!0)):s.push(u));for(o=0;o<s.length;o++)r.el_.removeChild(s[o])}return r.proxyNativeTracks_(),r.featuresNativeTextTracks&&e&&h.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),r.restoreMetadataTracksInIOSNativePlayer_(),(uu||ec||nw)&&n.nativeControlsForTouch===!0&&r.setControls(!0),r.proxyWebkitFullscreen_(),r.triggerReady(),r}u(f,i);var r=f.prototype;return r.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_();f.disposeMediaElement(this.el_);this.options_=null;i.prototype.dispose.call(this)},r.setupSourcesetHandling_=function(){bft(this)},r.restoreMetadataTracksInIOSNativePlayer_=function(){var n=this.textTracks(),r,t=function(){var t,i;for(r=[],t=0;t<n.length;t++)i=n[t],i.kind==="metadata"&&r.push({track:i,storedMode:i.mode})},i;t();n.addEventListener("change",t);this.on("dispose",function(){return n.removeEventListener("change",t)});i=function i(){for(var t,u=0;u<r.length;u++)t=r[u],t.track.mode==="disabled"&&t.track.mode!==t.storedMode&&(t.track.mode=t.storedMode);n.removeEventListener("change",i)};this.on("webkitbeginfullscreen",function(){n.removeEventListener("change",t);n.removeEventListener("change",i);n.addEventListener("change",i)});this.on("webkitendfullscreen",function(){n.removeEventListener("change",t);n.addEventListener("change",t);n.removeEventListener("change",i)})},r.overrideNative_=function(n,t){var r=this,i;t===this["featuresNative"+n+"Tracks"]&&(i=n.toLowerCase(),this[i+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(function(n){var t=r.el()[i+"Tracks"];t.removeEventListener(n,r[i+"TracksListeners_"][n])}),this["featuresNative"+n+"Tracks"]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i))},r.overrideNativeAudioTracks=function(n){this.overrideNative_("Audio",n)},r.overrideNativeVideoTracks=function(n){this.overrideNative_("Video",n)},r.proxyNativeTracksForType_=function(n){var e=this,r=pt[n],i=this.el()[r.getterName],t=this[r.getterName](),u,f;if(this["featuresNative"+r.capitalName+"Tracks"]&&i&&i.addEventListener){u={change:function(){t.trigger({type:"change",target:t,currentTarget:t,srcElement:t})},addtrack:function(n){t.addTrack(n.track)},removetrack:function(n){t.removeTrack(n.track)}};f=function(){for(var f,r,u=[],n=0;n<t.length;n++){for(f=!1,r=0;r<i.length;r++)if(i[r]===t[n]){f=!0;break}f||u.push(t[n])}while(u.length)t.removeTrack(u.shift())};this[r.getterName+"Listeners_"]=u;Object.keys(u).forEach(function(n){var t=u[n];i.addEventListener(n,t);e.on("dispose",function(){return i.removeEventListener(n,t)})});this.on("loadstart",f);this.on("dispose",function(){return e.off("loadstart",f)})}},r.proxyNativeTracks_=function(){var n=this;pt.names.forEach(function(t){n.proxyNativeTracksForType_(t)})},r.createEl=function(){var n=this.options_.tag,e,h,o,s,r,i,u;for(n&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(n?(e=n.cloneNode(!0),n.parentNode&&n.parentNode.insertBefore(e,n),f.disposeMediaElement(n),n=e):(n=t.createElement("video"),h=this.options_.tag&&hi(this.options_.tag),o=v({},h),uu&&this.options_.nativeControlsForTouch===!0||delete o.controls,by(n,y(o,{id:this.options_.techId,"class":"vjs-tech"}))),n.playerId=this.options_.playerId),typeof this.options_.preload!="undefined"&&sf(n,"preload",this.options_.preload),s=["loop","muted","playsinline","autoplay"],r=0;r<s.length;r++)i=s[r],u=this.options_[i],typeof u!="undefined"&&(u?sf(n,i,i):pe(n,i),n[i]=u);return n},r.handleLateInit_=function(n){var i,r,u,t;if(n.networkState!==0&&n.networkState!==3){if(n.readyState===0){i=!1;r=function(){i=!0};this.on("loadstart",r);u=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",u);this.ready(function(){this.off("loadstart",r);this.off("loadedmetadata",u);i||this.trigger("loadstart")});return}t=["loadstart"];t.push("loadedmetadata");n.readyState>=2&&t.push("loadeddata");n.readyState>=3&&t.push("canplay");n.readyState>=4&&t.push("canplaythrough");this.ready(function(){t.forEach(function(n){this.trigger(n)},this)})}},r.setCurrentTime=function(n){try{this.el_.currentTime=n}catch(t){h(t,"Video is not ready. (Video.js)")}},r.duration=function(){var n=this,t;if(this.el_.duration===Infinity&&di&&li&&this.el_.currentTime===0){t=function t(){n.el_.currentTime>0&&(n.el_.duration===Infinity&&n.trigger("durationchange"),n.off("timeupdate",t))};this.on("timeupdate",t);return NaN}return this.el_.duration||NaN},r.width=function(){return this.el_.offsetWidth},r.height=function(){return this.el_.offsetHeight},r.proxyWebkitFullscreen_=function(){var i=this,n,t;if("webkitDisplayingFullscreen"in this.el_){n=function(){this.trigger("fullscreenchange",{isFullscreen:!1})};t=function(){if("webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"){this.one("webkitendfullscreen",n);this.trigger("fullscreenchange",{isFullscreen:!0})}};this.on("webkitbeginfullscreen",t);this.on("dispose",function(){i.off("webkitbeginfullscreen",t);i.off("webkitendfullscreen",n)})}},r.supportsFullScreen=function(){if(typeof this.el_.webkitEnterFullScreen=="function"){var t=n.navigator&&n.navigator.userAgent||"";if(/Android/.test(t)||!/Chrome|Mac OS X 10.5/.test(t))return!0}return!1},r.enterFullScreen=function(){var n=this.el_;n.paused&&n.networkState<=n.HAVE_METADATA?(this.el_.play(),this.setTimeout(function(){n.pause();n.webkitEnterFullScreen()},0)):n.webkitEnterFullScreen()},r.exitFullScreen=function(){this.el_.webkitExitFullScreen()},r.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},r.src=function(n){if(n===undefined)return this.el_.src;this.setSrc(n)},r.reset=function(){f.resetMediaElement(this.el_)},r.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},r.setControls=function(n){this.el_.controls=!!n},r.addTextTrack=function(n,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(n,t,r):i.prototype.addTextTrack.call(this,n,t,r)},r.createRemoteTextTrack=function(n){if(!this.featuresNativeTextTracks)return i.prototype.createRemoteTextTrack.call(this,n);var r=t.createElement("track");return n.kind&&(r.kind=n.kind),n.label&&(r.label=n.label),(n.language||n.srclang)&&(r.srclang=n.language||n.srclang),n["default"]&&(r["default"]=n["default"]),n.id&&(r.id=n.id),n.src&&(r.src=n.src),r},r.addRemoteTextTrack=function(n,t){var r=i.prototype.addRemoteTextTrack.call(this,n,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r},r.removeRemoteTextTrack=function(n){if(i.prototype.removeRemoteTextTrack.call(this,n),this.featuresNativeTextTracks)for(var t=this.$$("track"),r=t.length;r--;)(n===t[r]||n===t[r].track)&&this.el().removeChild(t[r])},r.getVideoPlaybackQuality=function(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();var t={};return typeof this.el().webkitDroppedFrameCount!="undefined"&&typeof this.el().webkitDecodedFrameCount!="undefined"&&(t.droppedVideoFrames=this.el().webkitDroppedFrameCount,t.totalVideoFrames=this.el().webkitDecodedFrameCount),n.performance&&typeof n.performance.now=="function"?t.creationTime=n.performance.now():n.performance&&n.performance.timing&&typeof n.performance.timing.navigationStart=="number"&&(t.creationTime=n.Date.now()-n.performance.timing.navigationStart),t},f}(a);sa(f,"TEST_VID",function(){if(nu()){var i=t.createElement("video"),n=t.createElement("track");return n.kind="captions",n.srclang="en",n.label="English",i.appendChild(n),i}});f.isSupported=function(){try{f.TEST_VID.volume=.5}catch(n){return!1}return!!(f.TEST_VID&&f.TEST_VID.canPlayType)};f.canPlayType=function(n){return f.TEST_VID.canPlayType(n)};f.canPlaySource=function(n){return f.canPlayType(n.type)};f.canControlVolume=function(){try{var n=f.TEST_VID.volume;return f.TEST_VID.volume=n/2+.1,n!==f.TEST_VID.volume}catch(t){return!1}};f.canMuteVolume=function(){try{var n=f.TEST_VID.muted;return f.TEST_VID.muted=!n,f.TEST_VID.muted?sf(f.TEST_VID,"muted","muted"):pe(f.TEST_VID,"muted","muted"),n!==f.TEST_VID.muted}catch(t){return!1}};f.canControlPlaybackRate=function(){if(di&&li&&iw<58)return!1;try{var n=f.TEST_VID.playbackRate;return f.TEST_VID.playbackRate=n/2+.1,n!==f.TEST_VID.playbackRate}catch(t){return!1}};f.canOverrideAttributes=function(){try{var n=function(){};Object.defineProperty(t.createElement("video"),"src",{get:n,set:n});Object.defineProperty(t.createElement("audio"),"src",{get:n,set:n});Object.defineProperty(t.createElement("video"),"innerHTML",{get:n,set:n});Object.defineProperty(t.createElement("audio"),"innerHTML",{get:n,set:n})}catch(i){return!1}return!0};f.supportsNativeTextTracks=function(){return oc||ri&&li};f.supportsNativeVideoTracks=function(){return!!(f.TEST_VID&&f.TEST_VID.videoTracks)};f.supportsNativeAudioTracks=function(){return!!(f.TEST_VID&&f.TEST_VID.audioTracks)};f.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresVolumeControl","canControlVolume"],["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function(n){var t=n[0],i=n[1];sa(f.prototype,t,function(){return f[i]()},!0)});f.prototype.movingMediaElementInDOM=!ri;f.prototype.featuresFullscreenResize=!0;f.prototype.featuresProgressEvents=!0;f.prototype.featuresTimeupdateEvents=!0;f.patchCanPlayType=function(){rc>=4&&!tw&&!li&&(ss=f.TEST_VID&&f.TEST_VID.constructor.prototype.canPlayType,f.TEST_VID.constructor.prototype.canPlayType=function(n){return n&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(n)?"maybe":ss.call(this,n)})};f.unpatchCanPlayType=function(){var n=f.TEST_VID.constructor.prototype.canPlayType;return ss&&(f.TEST_VID.constructor.prototype.canPlayType=ss),n};f.patchCanPlayType();f.disposeMediaElement=function(n){if(n){for(n.parentNode&&n.parentNode.removeChild(n);n.hasChildNodes();)n.removeChild(n.firstChild);n.removeAttribute("src");typeof n.load=="function"&&function(){try{n.load()}catch(t){}}()}};f.resetMediaElement=function(n){if(n){for(var t=n.querySelectorAll("source"),i=t.length;i--;)n.removeChild(t[i]);n.removeAttribute("src");typeof n.load=="function"&&function(){try{n.load()}catch(t){}}()}};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(n){f.prototype[n]=function(){return this.el_[n]||this.el_.hasAttribute(n)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(n){f.prototype["set"+b(n)]=function(t){this.el_[n]=t;t?this.el_.setAttribute(n,n):this.el_.removeAttribute(n)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","played","networkState","readyState","videoWidth","videoHeight"].forEach(function(n){f.prototype[n]=function(){return this.el_[n]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate"].forEach(function(n){f.prototype["set"+b(n)]=function(t){this.el_[n]=t}});["pause","load","play"].forEach(function(n){f.prototype[n]=function(){return this.el_[n]()}});a.withSourceHandlers(f);f.nativeSourceHandler={};f.nativeSourceHandler.canPlayType=function(n){try{return f.TEST_VID.canPlayType(n)}catch(t){return""}};f.nativeSourceHandler.canHandleSource=function(n){if(n.type)return f.nativeSourceHandler.canPlayType(n.type);if(n.src){var t=wc(n.src);return f.nativeSourceHandler.canPlayType("video/"+t)}return""};f.nativeSourceHandler.handleSource=function(n,t){t.setSrc(n.src)};f.nativeSourceHandler.dispose=function(){};f.registerSourceHandler(f.nativeSourceHandler);a.registerTech("Html5",f);var id=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],ha={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ca=["tiny","xsmall","small","medium","large","xlarge","huge"],hs={};ca.forEach(function(n){var t=n.charAt(0)==="x"?"x-"+n.substring(1):n;hs[n]="vjs-layout-"+t});rd={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:Infinity};k=function(i){function c(n,r,u){var f,h,e,l,a,p;if(n.id=n.id||r.id||"vjs_video_"+ki(),r=y(c.getTagSettings(n),r),r.initChildren=!1,r.createEl=!1,r.evented=!1,r.reportTouchActivity=!1,!r.language)if(typeof n.closest=="function")h=n.closest("[lang]"),h&&h.getAttribute&&(r.language=h.getAttribute("lang"));else for(e=n;e&&e.nodeType===1;){if(hi(e).hasOwnProperty("lang")){r.language=e.getAttribute("lang");break}e=e.parentNode}if(f=i.call(this,null,r,u)||this,f.boundDocumentFullscreenChange_=s(o(f),f.documentFullscreenChange_),f.boundFullWindowOnEscKey_=s(o(f),f.fullWindowOnEscKey),f.isFullscreen_=!1,f.log=ah(f.id_),f.fsApi_=hc,f.isPosterFromTech_=!1,f.queuedCallbacks_=[],f.isReady_=!1,f.hasStarted_=!1,f.userActive_=!1,!f.options_||!f.options_.techOrder||!f.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(f.tag=n,f.tagAttributes=n&&hi(n),f.language(f.options_.language),r.languages?(l={},Object.getOwnPropertyNames(r.languages).forEach(function(n){l[n.toLowerCase()]=r.languages[n]}),f.languages_=l):f.languages_=c.prototype.options_.languages,f.resetCache_(),f.poster_=r.poster||"",f.controls_=!!r.controls,n.controls=!1,n.removeAttribute("controls"),f.changingSrc_=!1,f.playCallbacks_=[],f.playTerminatedQueue_=[],n.hasAttribute("autoplay")?f.autoplay(!0):f.autoplay(f.options_.autoplay),r.plugins&&Object.keys(r.plugins).forEach(function(n){if(typeof f[n]!="function")throw new Error('plugin "'+n+'" does not exist');}),f.scrubbing_=!1,f.el_=f.createEl(),ic(o(f),{eventBusKey:"el_"}),f.fsApi_.requestFullscreen){yt(t,f.fsApi_.fullscreenchange,f.boundDocumentFullscreenChange_);f.on(f.fsApi_.fullscreenchange,f.boundDocumentFullscreenChange_)}if(f.fluid_)f.on("playerreset",f.updateStyleEl_);a=v(f.options_);r.plugins&&Object.keys(r.plugins).forEach(function(n){f[n](r.plugins[n])});f.options_.playerOptions=a;f.middleware_=[];f.initChildren();f.isAudio(n.nodeName.toLowerCase()==="audio");f.controls()?f.addClass("vjs-controls-enabled"):f.addClass("vjs-controls-disabled");f.el_.setAttribute("role","region");f.isAudio()?f.el_.setAttribute("aria-label",f.localize("Audio Player")):f.el_.setAttribute("aria-label",f.localize("Video Player"));f.isAudio()&&f.addClass("vjs-audio");f.flexNotSupported_()&&f.addClass("vjs-no-flex");uu&&f.addClass("vjs-touch-enabled");ri||f.addClass("vjs-workinghover");c.players[f.id_]=o(f);p=hy.split(".")[0];f.addClass("vjs-v"+p);f.userActive(!0);f.reportUserActivity();f.one("play",f.listenForUserActivity_);f.on("stageclick",f.handleStageClick_);f.on("keydown",f.handleKeyDown);return f.breakpoints(f.options_.breakpoints),f.responsive(f.options_.responsive),f}u(c,i);var f=c.prototype;return f.dispose=function(){var n=this;this.trigger("dispose");this.off("dispose");it(t,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_);it(t,"keydown",this.boundFullWindowOnEscKey_);this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null);c.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);uft(this);rt.names.forEach(function(t){var r=rt[t],i=n[r.getterName]();i&&i.off&&i.off()});i.prototype.dispose.call(this)},f.createEl=function(){var r=this.tag,u,s=this.playerElIngest_=r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player"),e=this.tag.tagName.toLowerCase()==="video-js",f,h,c,l,o,a;if(s?u=this.el_=r.parentNode:e||(u=this.el_=i.prototype.createEl.call(this,"div")),f=hi(r),e){for(u=this.el_=r,r=this.tag=t.createElement("video");u.children.length;)r.appendChild(u.firstChild);ir(u,"video-js")||si(u,"video-js");u.appendChild(r);s=this.playerElIngest_=u;Object.keys(u).forEach(function(n){try{r[n]=u[n]}catch(t){}})}for(r.setAttribute("tabindex","-1"),f.tabindex="-1",(no||li&&rw)&&(r.setAttribute("role","application"),f.role="application"),r.removeAttribute("width"),r.removeAttribute("height"),("width"in f)&&delete f.width,("height"in f)&&delete f.height,Object.getOwnPropertyNames(f).forEach(function(n){e&&n==="class"||u.setAttribute(n,f[n]);e&&r.setAttribute(n,f[n])}),r.playerId=r.id,r.id+="_html5_api",r.className="vjs-tech",r.player=u.player=this,this.addClass("vjs-paused"),n.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&(this.styleEl_=op("vjs-styles-dimensions"),h=bi(".vjs-styles-defaults"),c=bi("head"),c.insertBefore(this.styleEl_,h?h.nextSibling:c.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),l=r.getElementsByTagName("a"),o=0;o<l.length;o++)a=l.item(o),si(a,"vjs-hidden"),a.setAttribute("hidden","hidden");return r.initNetworkState_=r.networkState,r.parentNode&&!s&&r.parentNode.insertBefore(u,r),vh(r,u),this.children_.unshift(r),this.el_.setAttribute("lang",this.language_),this.el_=u,u},f.width=function(n){return this.dimension("width",n)},f.height=function(n){return this.dimension("height",n)},f.dimension=function(n,t){var i=n+"_",r;if(t===undefined)return this[i]||0;if(t===""||t==="auto"){this[i]=undefined;this.updateStyleEl_();return}if(r=parseFloat(t),isNaN(r)){h.error('Improper value "'+t+'" supplied for for '+n);return}this[i]=r;this.updateStyleEl_()},f.fluid=function(n){if(n===undefined)return!!this.fluid_;this.fluid_=!!n;ur(this)&&this.off("playerreset",this.updateStyleEl_);n?(this.addClass("vjs-fluid"),this.fill(!1),vit(function(){this.on("playerreset",this.updateStyleEl_)})):this.removeClass("vjs-fluid");this.updateStyleEl_()},f.fill=function(n){if(n===undefined)return!!this.fill_;this.fill_=!!n;n?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},f.aspectRatio=function(n){if(n===undefined)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(n))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=n;this.fluid(!0);this.updateStyleEl_()},f.updateStyleEl_=function(){var u,s,h,t,f,i;if(n.VIDEOJS_NO_DYNAMIC_STYLE===!0){var e=typeof this.width_=="number"?this.width_:this.options_.width,o=typeof this.height_=="number"?this.height_:this.options_.height,r=this.tech_&&this.tech_.el();r&&(e>=0&&(r.width=e),o>=0&&(r.height=o));return}h=this.aspectRatio_!==undefined&&this.aspectRatio_!=="auto"?this.aspectRatio_:this.videoWidth()>0?this.videoWidth()+":"+this.videoHeight():"16:9";f=h.split(":");i=f[1]/f[0];u=this.width_!==undefined?this.width_:this.height_!==undefined?this.height_/i:this.videoWidth()||300;s=this.height_!==undefined?this.height_:u*i;t=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions";this.addClass(t);sp(this.styleEl_,"\n      ."+t+" {\n        width: "+u+"px;\n        height: "+s+"px;\n      }\n\n      ."+t+".vjs-fluid {\n        padding-top: "+i*100+"%;\n      }\n    ")},f.loadTech_=function(n,t){var i=this,u,f,o,r,e;if(this.tech_&&this.unloadTech_(),u=b(n),f=n.charAt(0).toLowerCase()+n.slice(1),u!=="Html5"&&this.tag&&(a.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=u,this.isReady_=!1,o=typeof this.autoplay()=="string"?!1:this.autoplay(),r={source:t,autoplay:o,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+f+"_api",playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,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},rt.names.forEach(function(n){var t=rt[n];r[t.getterName]=i[t.privateName]}),y(r,this.options_[u]),y(r,this.options_[f]),y(r,this.options_[n.toLowerCase()]),this.tag&&(r.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(r.startTime=this.cache_.currentTime),e=a.getTech(n),!e)throw new Error("No Tech named '"+u+"' exists! '"+u+"' should be registered using videojs.registerTech()'");this.tech_=new e(r);this.tech_.ready(s(this,this.handleTechReady_),!0);sw.jsonToTextTracks(this.textTracksJson_||[],this.tech_);id.forEach(function(n){i.on(i.tech_,n,i["handleTech"+b(n)+"_"])});Object.keys(ha).forEach(function(n){i.on(i.tech_,n,function(t){if(i.tech_.playbackRate()===0&&i.tech_.seeking()){i.queuedCallbacks_.push({callback:i["handleTech"+ha[n]+"_"].bind(i),event:t});return}i["handleTech"+ha[n]+"_"](t)})});this.on(this.tech_,"loadstart",this.handleTechLoadStart_);this.on(this.tech_,"sourceset",this.handleTechSourceset_);this.on(this.tech_,"waiting",this.handleTechWaiting_);this.on(this.tech_,"ended",this.handleTechEnded_);this.on(this.tech_,"seeking",this.handleTechSeeking_);this.on(this.tech_,"play",this.handleTechPlay_);this.on(this.tech_,"firstplay",this.handleTechFirstPlay_);this.on(this.tech_,"pause",this.handleTechPause_);this.on(this.tech_,"durationchange",this.handleTechDurationChange_);this.on(this.tech_,"fullscreenchange",this.handleTechFullscreenChange_);this.on(this.tech_,"enterpictureinpicture",this.handleTechEnterPictureInPicture_);this.on(this.tech_,"leavepictureinpicture",this.handleTechLeavePictureInPicture_);this.on(this.tech_,"error",this.handleTechError_);this.on(this.tech_,"loadedmetadata",this.updateStyleEl_);this.on(this.tech_,"posterchange",this.handleTechPosterChange_);this.on(this.tech_,"textdata",this.handleTechTextData_);this.on(this.tech_,"ratechange",this.handleTechRateChange_);this.usingNativeControls(this.techGet_("controls"));this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_();this.tech_.el().parentNode===this.el()||u==="Html5"&&this.tag||vh(this.tech_.el(),this.el());this.tag&&(this.tag.player=null,this.tag=null)},f.unloadTech_=function(){var n=this;rt.names.forEach(function(t){var i=rt[t];n[i.privateName]=n[i.getterName]()});this.textTracksJson_=sw.textTracksToJson(this.tech_);this.isReady_=!1;this.tech_.dispose();this.tech_=!1;this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange"));this.isPosterFromTech_=!1},f.tech=function(n){return n===undefined&&h.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_},f.addTechControlsListeners_=function(){this.removeTechControlsListeners_();this.on(this.tech_,"mouseup",this.handleTechClick_);this.on(this.tech_,"dblclick",this.handleTechDoubleClick_);this.on(this.tech_,"touchstart",this.handleTechTouchStart_);this.on(this.tech_,"touchmove",this.handleTechTouchMove_);this.on(this.tech_,"touchend",this.handleTechTouchEnd_);this.on(this.tech_,"tap",this.handleTechTap_)},f.removeTechControlsListeners_=function(){this.off(this.tech_,"tap",this.handleTechTap_);this.off(this.tech_,"touchstart",this.handleTechTouchStart_);this.off(this.tech_,"touchmove",this.handleTechTouchMove_);this.off(this.tech_,"touchend",this.handleTechTouchEnd_);this.off(this.tech_,"mouseup",this.handleTechClick_);this.off(this.tech_,"dblclick",this.handleTechDoubleClick_)},f.handleTechReady_=function(){this.triggerReady();this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume);this.handleTechPosterChange_();this.handleTechDurationChange_()},f.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_(this.autoplay())},f.manualAutoplay_=function(n){var t=this,r,i;if(this.tech_&&typeof n=="string")return(r=function(){var r=t.muted(),n,i;if(t.muted(!0),n=function(){t.muted(r)},t.playTerminatedQueue_.push(n),i=t.play(),yf(i))return i["catch"](n)},n==="any"&&this.muted()!==!0?(i=this.play(),yf(i)&&(i=i["catch"](r))):i=n==="muted"&&this.muted()!==!0?r():this.play(),!yf(i))?void 0:i.then(function(){t.trigger({type:"autoplay-success",autoplay:n})})["catch"](function(){t.trigger({type:"autoplay-failure",autoplay:n})})},f.updateSourceCaches_=function(n){var t,i,u,r;n===void 0&&(n="");t=n;i="";typeof t!="string"&&(t=n.src,i=n.type);this.cache_.source=this.cache_.source||{};this.cache_.sources=this.cache_.sources||[];t&&!i&&(i=oft(this,t));this.cache_.source=v({},n,{src:t,type:i});var f=this.cache_.sources.filter(function(n){return n.src&&n.src===t}),e=[],o=this.$$("source"),s=[];for(u=0;u<o.length;u++)r=hi(o[u]),e.push(r),r.src&&r.src===t&&s.push(r.src);s.length&&!f.length?this.cache_.sources=e:f.length||(this.cache_.sources=[this.cache_.source]);this.cache_.src=t},f.handleTechSourceset_=function(n){var t=this;if(!this.changingSrc_){var u=function(n){return t.updateSourceCaches_(n)},i=this.currentSource().src,r=n.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(this.lastSource_&&(this.lastSource_.tech===r||this.lastSource_.player===i)||(u=function(){}));u(r);n.src||this.tech_.any(["sourceset","loadstart"],function(n){if(n.type!=="sourceset"){var i=t.techGet("currentSrc");t.lastSource_.tech=i;t.updateSourceCaches_(i)}})}this.lastSource_={player:this.currentSource().src,tech:n.src};this.trigger({src:n.src,type:"sourceset"})},f.hasStarted=function(n){if(n===undefined)return this.hasStarted_;n!==this.hasStarted_&&(this.hasStarted_=n,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},f.handleTechPlay_=function(){this.removeClass("vjs-ended");this.removeClass("vjs-paused");this.addClass("vjs-playing");this.hasStarted(!0);this.trigger("play")},f.handleTechRateChange_=function(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(function(n){return n.callback(n.event)}),this.queuedCallbacks_=[]);this.cache_.lastPlaybackRate=this.tech_.playbackRate();this.trigger("ratechange")},f.handleTechWaiting_=function(){var n=this,i,t;this.addClass("vjs-waiting");this.trigger("waiting");i=this.currentTime();t=function t(){i!==n.currentTime()&&(n.removeClass("vjs-waiting"),n.off("timeupdate",t))};this.on("timeupdate",t)},f.handleTechCanPlay_=function(){this.removeClass("vjs-waiting");this.trigger("canplay")},f.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting");this.trigger("canplaythrough")},f.handleTechPlaying_=function(){this.removeClass("vjs-waiting");this.trigger("playing")},f.handleTechSeeking_=function(){this.addClass("vjs-seeking");this.trigger("seeking")},f.handleTechSeeked_=function(){this.removeClass("vjs-seeking");this.removeClass("vjs-ended");this.trigger("seeked")},f.handleTechFirstPlay_=function(){this.options_.starttime&&(h.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")},f.handleTechPause_=function(){this.removeClass("vjs-playing");this.addClass("vjs-paused");this.trigger("pause")},f.handleTechEnded_=function(){this.addClass("vjs-ended");this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause();this.trigger("ended")},f.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},f.handleTechClick_=function(n){iu(n)&&this.controls_&&(this.paused()?fu(this.play()):this.pause())},f.handleTechDoubleClick_=function(n){if(this.controls_){var t=Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(t){return t.contains(n.target)});t||(this.options_===undefined||this.options_.userActions===undefined||this.options_.userActions.doubleClick===undefined||this.options_.userActions.doubleClick!==!1)&&(this.options_!==undefined&&this.options_.userActions!==undefined&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,n):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}},f.handleTechTap_=function(){this.userActive(!this.userActive())},f.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},f.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},f.handleTechTouchEnd_=function(n){n.preventDefault()},f.handleStageClick_=function(){this.reportUserActivity()},f.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},f.documentFullscreenChange_=function(n){var u=n.target.player,i,r;u&&u!==this||(i=this.el(),r=t[this.fsApi_.fullscreenElement]===i,!r&&i.matches?r=i.matches(":"+this.fsApi_.fullscreen):!r&&i.msMatchesSelector&&(r=i.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(r))},f.handleTechFullscreenChange_=function(n,t){t&&this.isFullscreen(t.isFullscreen)},f.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},f.handleTechEnterPictureInPicture_=function(){this.isInPictureInPicture(!0)},f.handleTechLeavePictureInPicture_=function(){this.isInPictureInPicture(!1)},f.handleTechError_=function(){var n=this.tech_.error();this.error(n)},f.handleTechTextData_=function(){var n=null;arguments.length>1&&(n=arguments[1]);this.trigger("textdata",n)},f.getCache=function(){return this.cache_},f.resetCache_=function(){this.cache_={currentTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],volume:1}},f.techCall_=function(n,t){this.ready(function(){if(n in ift)return nft(this.middleware_,this.tech_,n,t);if(n in hb)return sb(this.middleware_,this.tech_,n,t);try{this.tech_&&this.tech_[n](t)}catch(i){h(i);throw i;}},!0)},f.techGet_=function(n){if(this.tech_&&this.tech_.isReady_){if(n in tft)return ob(this.middleware_,this.tech_,n);if(n in hb)return sb(this.middleware_,this.tech_,n);try{return this.tech_[n]()}catch(t){if(this.tech_[n]===undefined){h("Video.js: "+n+" method not defined for "+this.techName_+" playback technology.",t);throw t;}if(t.name==="TypeError"){h("Video.js: "+n+" unavailable on "+this.techName_+" playback technology element.",t);this.tech_.isReady_=!1;throw t;}h(t);throw t;}}},f.play=function(){var i=this,t=this.options_.Promise||n.Promise;return t?new t(function(n){i.play_(n)}):this.play_()},f.play_=function(n){var r=this,t,i;if(n===void 0&&(n=fu),this.playCallbacks_.push(n),t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=function(){r.play_()};this.one(["ready","loadstart"],this.waitToPlay_);!t&&(oc||ri)&&this.load();return}i=this.techGet_("play");i===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(i)},f.runPlayTerminatedQueue_=function(){var n=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[];n.forEach(function(n){n()})},f.runPlayCallbacks_=function(n){var t=this.playCallbacks_.slice(0);this.playCallbacks_=[];this.playTerminatedQueue_=[];t.forEach(function(t){t(n)})},f.pause=function(){this.techCall_("pause")},f.paused=function(){return this.techGet_("paused")===!1?!1:!0},f.played=function(){return this.techGet_("played")||er(0,0)},f.scrubbing=function(n){if(typeof n=="undefined")return this.scrubbing_;this.scrubbing_=!!n;n?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")},f.currentTime=function(n){if(typeof n!="undefined"){n<0&&(n=0);this.techCall_("setCurrentTime",n);return}return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime},f.duration=function(n){if(n===undefined)return this.cache_.duration!==undefined?this.cache_.duration:NaN;n=parseFloat(n);n<0&&(n=Infinity);n!==this.cache_.duration&&(this.cache_.duration=n,n===Infinity?(this.addClass("vjs-live"),this.options_.liveui&&this.player_.liveTracker&&this.addClass("vjs-liveui")):(this.removeClass("vjs-live"),this.removeClass("vjs-liveui")),isNaN(n)||this.trigger("durationchange"))},f.remainingTime=function(){return this.duration()-this.currentTime()},f.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},f.buffered=function(){var n=this.techGet_("buffered");return n&&n.length||(n=er(0,0)),n},f.bufferedPercent=function(){return fw(this.buffered(),this.duration())},f.bufferedEnd=function(){var t=this.buffered(),i=this.duration(),n=t.end(t.length-1);return n>i&&(n=i),n},f.volume=function(n){var t;if(n!==undefined){t=Math.max(0,Math.min(1,parseFloat(n)));this.cache_.volume=t;this.techCall_("setVolume",t);t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t},f.muted=function(n){if(n!==undefined){this.techCall_("setMuted",n);return}return this.techGet_("muted")||!1},f.defaultMuted=function(n){return n!==undefined?this.techCall_("setDefaultMuted",n):this.techGet_("defaultMuted")||!1},f.lastVolume_=function(n){if(n!==undefined&&n!==0){this.cache_.lastVolume=n;return}return this.cache_.lastVolume},f.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},f.isFullscreen=function(n){if(n!==undefined){var t=this.isFullscreen_;this.isFullscreen_=Boolean(n);this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange");this.toggleFullscreenClass_();return}return this.isFullscreen_},f.requestFullscreen=function(n){var r=this,i,t;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},n!==undefined&&(i=n)),this.fsApi_.requestFullscreen)return t=this.el_[this.fsApi_.requestFullscreen](i),t&&t.then(function(){return r.isFullscreen(!0)},function(){return r.isFullscreen(!1)}),t;this.tech_.supportsFullScreen()?this.techCall_("enterFullScreen"):this.enterFullWindow()},f.exitFullscreen=function(){var i=this,n;if(this.fsApi_.requestFullscreen)return n=t[this.fsApi_.exitFullscreen](),n&&n.then(function(){return i.isFullscreen(!1)}),n;this.tech_.supportsFullScreen()?this.techCall_("exitFullScreen"):this.exitFullWindow()},f.enterFullWindow=function(){this.isFullscreen(!0);this.isFullWindow=!0;this.docOrigOverflow=t.documentElement.style.overflow;yt(t,"keydown",this.boundFullWindowOnEscKey_);t.documentElement.style.overflow="hidden";si(t.body,"vjs-full-window");this.trigger("enterFullWindow")},f.fullWindowOnEscKey=function(n){e.isEventKey(n,"Esc")&&(this.isFullscreen()===!0?this.exitFullscreen():this.exitFullWindow())},f.exitFullWindow=function(){this.isFullscreen(!1);this.isFullWindow=!1;it(t,"keydown",this.boundFullWindowOnEscKey_);t.documentElement.style.overflow=this.docOrigOverflow;of(t.body,"vjs-full-window");this.trigger("exitFullWindow")},f.isInPictureInPicture=function(n){if(n!==undefined){this.isInPictureInPicture_=!!n;this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_},f.requestPictureInPicture=function(){if("pictureInPictureEnabled"in t)return this.techGet_("requestPictureInPicture")},f.exitPictureInPicture=function(){if("pictureInPictureEnabled"in t)return t.exitPictureInPicture()},f.handleKeyDown=function(n){var t=this.options_.userActions,i;t&&t.hotkeys&&((i=function(n){var t=n.tagName.toLowerCase(),i,r;return n.isContentEditable?!0:(i=["button","checkbox","hidden","radio","reset","submit"],t==="input")?i.indexOf(n.type)===-1:(r=["textarea"],r.indexOf(t)!==-1)},i(this.el_.ownerDocument.activeElement))||(typeof t.hotkeys=="function"?t.hotkeys.call(this,n):this.handleHotkeys(n)))},f.handleHotkeys=function(n){var i=this.options_.userActions?this.options_.userActions.hotkeys:{},u=i.fullscreenKey,l=u===void 0?function(n){return e.isEventKey(n,"f")}:u,f=i.muteKey,a=f===void 0?function(n){return e.isEventKey(n,"m")}:f,o=i.playPauseKey,v=o===void 0?function(n){return e.isEventKey(n,"k")||e.isEventKey(n,"Space")}:o,s,h,c;l.call(this,n)?(n.preventDefault(),n.stopPropagation(),s=r.getComponent("FullscreenToggle"),t[this.fsApi_.fullscreenEnabled]!==!1&&s.prototype.handleClick.call(this,n)):a.call(this,n)?(n.preventDefault(),n.stopPropagation(),h=r.getComponent("MuteToggle"),h.prototype.handleClick.call(this,n)):v.call(this,n)&&(n.preventDefault(),n.stopPropagation(),c=r.getComponent("PlayToggle"),c.prototype.handleClick.call(this,n))},f.canPlayType=function(n){for(var i,t,u,f=0,e=this.options_.techOrder;f<e.length;f++){if(i=e[f],t=a.getTech(i),t||(t=r.getComponent(i)),!t){h.error('The "'+i+'" tech is undefined. Skipped browser support check for that tech.');continue}if(t.isSupported()&&(u=t.canPlayType(n),u))return u}return""},f.selectSource=function(n){var f=this,t=this.options_.techOrder.map(function(n){return[n,a.getTech(n)]}).filter(function(n){var i=n[0],t=n[1];return t?t.isSupported():(h.error('The "'+i+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),i=function(n,t,i){var r;return n.some(function(n){return t.some(function(t){return r=i(n,t),r?!0:void 0})}),r},r,e=function(n){return function(t,i){return n(i,t)}},u=function(n,t){var i=n[0],r=n[1];if(r.canPlaySource(t,f.options_[i.toLowerCase()]))return{source:t,tech:i}};return r=this.options_.sourceOrder?i(n,t,e(u)):i(t,n,u),r||!1},f.src=function(n){var t=this,i;if(typeof n=="undefined")return this.cache_.src||"";if(i=cb(n),!i.length){this.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);return}this.changingSrc_=!0;this.cache_.sources=i;this.updateSourceCaches_(i[0]);dut(this,i[0],function(n,r){t.middleware_=r;t.cache_.sources=i;t.updateSourceCaches_(n);var u=t.src_(n);if(u){if(i.length>1)return t.src(i.slice(1));t.changingSrc_=!1;t.setTimeout(function(){this.error({code:4,message:this.localize(this.options_.notSupportedMessage)})},0);t.triggerReady();return}gut(r,t.tech_)})},f.src_=function(n){var i=this,t=this.selectSource([n]);return t?pit(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",n):this.techCall_("src",n.src);this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(function(){i.changingSrc_=!1}),!1):!0},f.load=function(){this.techCall_("load")},f.reset=function(){var i=this,r=this.options_.Promise||n.Promise,t;this.paused()||!r?this.doReset_():(t=this.play(),fu(t.then(function(){return i.doReset_()})))},f.doReset_=function(){this.tech_&&this.tech_.clearTracks("text");this.resetCache_();this.poster("");this.loadTech_(this.options_.techOrder[0],null);this.techCall_("reset");this.resetControlBarUI_();ur(this)&&this.trigger("playerreset")},f.resetControlBarUI_=function(){this.resetProgressBar_();this.resetPlaybackRate_();this.resetVolumeBar_()},f.resetProgressBar_=function(){this.currentTime(0);var n=this.controlBar,t=n.durationDisplay,i=n.remainingTimeDisplay;t&&t.updateContent();i&&i.updateContent()},f.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate());this.handleTechRateChange_()},f.resetVolumeBar_=function(){this.volume(1);this.trigger("volumechange")},f.currentSources=function(){var n=this.currentSource(),t=[];return Object.keys(n).length!==0&&t.push(n),this.cache_.sources||t},f.currentSource=function(){return this.cache_.source||{}},f.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},f.currentType=function(){return this.currentSource()&&this.currentSource().type||""},f.preload=function(n){if(n!==undefined){this.techCall_("setPreload",n);this.options_.preload=n;return}return this.techGet_("preload")},f.autoplay=function(n){if(n===undefined)return this.options_.autoplay||!1;var t;typeof n=="string"&&/(any|play|muted)/.test(n)?(this.options_.autoplay=n,this.manualAutoplay_(n),t=!1):this.options_.autoplay=n?!0:!1;t=typeof t=="undefined"?this.options_.autoplay:t;this.tech_&&this.techCall_("setAutoplay",t)},f.playsinline=function(n){return n!==undefined?(this.techCall_("setPlaysinline",n),this.options_.playsinline=n,this):this.techGet_("playsinline")},f.loop=function(n){if(n!==undefined){this.techCall_("setLoop",n);this.options_.loop=n;return}return this.techGet_("loop")},f.poster=function(n){if(n===undefined)return this.poster_;(n||(n=""),n!==this.poster_)&&(this.poster_=n,this.techCall_("setPoster",n),this.isPosterFromTech_=!1,this.trigger("posterchange"))},f.handleTechPosterChange_=function(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){var n=this.tech_.poster()||"";n!==this.poster_&&(this.poster_=n,this.isPosterFromTech_=!0,this.trigger("posterchange"))}},f.controls=function(n){if(n===undefined)return!!this.controls_;(n=!!n,this.controls_!==n)&&(this.controls_=n,this.usingNativeControls()&&this.techCall_("setControls",n),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_()))},f.usingNativeControls=function(n){if(n===undefined)return!!this.usingNativeControls_;(n=!!n,this.usingNativeControls_!==n)&&(this.usingNativeControls_=n,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))},f.error=function(n){if(n===undefined)return this.error_||null;if(this.options_.suppressNotSupportedError&&n&&n.code===4){var t=function(){this.error(n)};this.options_.suppressNotSupportedError=!1;this.any(["click","touchstart"],t);this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(n===null){this.error_=n;this.removeClass("vjs-error");this.errorDisplay&&this.errorDisplay.close();return}this.error_=new ut(n);this.addClass("vjs-error");h.error("(CODE:"+this.error_.code+" "+ut.errorTypes[this.error_.code]+")",this.error_.message,this.error_);this.trigger("error");return},f.reportUserActivity=function(){this.userActivity_=!0},f.userActive=function(n){if(n===undefined)return this.userActive_;if(n=!!n,n!==this.userActive_){if(this.userActive_=n,this.userActive_){this.userActivity_=!0;this.removeClass("vjs-user-inactive");this.addClass("vjs-user-active");this.trigger("useractive");return}if(this.tech_)this.tech_.one("mousemove",function(n){n.stopPropagation();n.preventDefault()});this.userActivity_=!1;this.removeClass("vjs-user-active");this.addClass("vjs-user-inactive");this.trigger("userinactive")}},f.listenForUserActivity_=function(){var i,r,u,n=s(this,this.reportUserActivity),o=function(t){(t.screenX!==r||t.screenY!==u)&&(r=t.screenX,u=t.screenY,n())},h=function(){n();this.clearInterval(i);i=this.setInterval(n,250)},f=function(){n();this.clearInterval(i)},t,e;this.on("mousedown",h);this.on("mousemove",o);this.on("mouseup",f);this.on("mouseleave",f);if(t=this.getChild("controlBar"),t&&!ri&&!di){t.on("mouseenter",function(){this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout;this.player().options_.inactivityTimeout=0});t.on("mouseleave",function(){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(e);var n=this.options_.inactivityTimeout;n<=0||(e=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},n))}},250)},f.playbackRate=function(n){if(n!==undefined){this.techCall_("setPlaybackRate",n);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1},f.defaultPlaybackRate=function(n){return n!==undefined?this.techCall_("setDefaultPlaybackRate",n):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},f.isAudio=function(n){if(n!==undefined){this.isAudio_=!!n;return}return!!this.isAudio_},f.addTextTrack=function(n,t,i){if(this.tech_)return this.tech_.addTextTrack(n,t,i)},f.addRemoteTextTrack=function(n,t){if(this.tech_)return this.tech_.addRemoteTextTrack(n,t)},f.removeRemoteTextTrack=function(n){n===void 0&&(n={});var i=n,t=i.track;return t||(t=n),this.tech_?this.tech_.removeRemoteTextTrack(t):void 0},f.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},f.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},f.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},f.language=function(n){if(n===undefined)return this.language_;this.language_=String(n).toLowerCase()},f.languages=function(){return v(c.prototype.options_.languages,this.languages_)},f.toJSON=function(){var i=v(this.options_),r=i.tracks,n,t;for(i.tracks=[],n=0;n<r.length;n++)t=r[n],t=v(t),t.player=undefined,i.tracks[n]=t;return i},f.createModal=function(n,t){var r=this,i;t=t||{};t.content=n||"";i=new eu(this,t);this.addChild(i);i.on("dispose",function(){r.removeChild(i)});return i.open(),i},f.updateCurrentBreakpoint_=function(){var t,r,i,n,u;if(this.responsive())for(t=this.currentBreakpoint(),r=this.currentWidth(),i=0;i<ca.length;i++)if(n=ca[i],u=this.breakpoints_[n],r<=u){if(t===n)return;t&&this.removeClass(hs[t]);this.addClass(hs[n]);this.breakpoint_=n;break}},f.removeCurrentBreakpoint_=function(){var n=this.currentBreakpointClass();this.breakpoint_="";n&&this.removeClass(n)},f.breakpoints=function(n){return n===undefined?y(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=y({},rd,n),this.updateCurrentBreakpoint_(),y(this.breakpoints_))},f.responsive=function(n){if(n===undefined)return this.responsive_;n=Boolean(n);var t=this.responsive_;if(n!==t){if(this.responsive_=n,n){this.on("playerresize",this.updateCurrentBreakpoint_);this.updateCurrentBreakpoint_()}else this.off("playerresize",this.updateCurrentBreakpoint_),this.removeCurrentBreakpoint_();return n}},f.currentBreakpoint=function(){return this.breakpoint_},f.currentBreakpointClass=function(){return hs[this.breakpoint_]||""},f.loadMedia=function(n,t){var e=this;if(n&&typeof n=="object"){this.reset();this.cache_.media=v(n);var r=this.cache_.media,o=r.artwork,i=r.poster,u=r.src,f=r.textTracks;!o&&i&&(this.cache_.media.artwork=[{src:i,type:oo(i)}]);u&&this.src(u);i&&this.poster(i);Array.isArray(f)&&f.forEach(function(n){return e.addRemoteTextTrack(n,!1)});this.ready(t)}},f.getMedia=function(){if(!this.cache_.media){var t=this.poster(),i=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),function(n){return{kind:n.kind,label:n.label,language:n.language,src:n.src}}),n={src:i,textTracks:r};return t&&(n.poster=t,n.artwork=[{src:n.poster,type:oo(n.poster)}]),n}return v(this.cache_.media)},c.getTagSettings=function(n){var i={sources:[],tracks:[]},t=hi(n),o=t["data-setup"],f,r,l,u,e;if(ir(n,"vjs-fill")&&(t.fill=!0),ir(n,"vjs-fluid")&&(t.fluid=!0),o!==null){var s=ow(o||"{}"),c=s[0],a=s[1];c&&h.error(c);y(t,a)}if(y(i,t),n.hasChildNodes())for(f=n.childNodes,r=0,l=f.length;r<l;r++)u=f[r],e=u.nodeName.toLowerCase(),e==="source"?i.sources.push(hi(u)):e==="track"&&i.tracks.push(hi(u));return i},f.flexNotSupported_=function(){var n=t.createElement("i");return!("flexBasis"in n.style||"webkitFlexBasis"in n.style||"mozFlexBasis"in n.style||"msFlexBasis"in n.style||"msFlexOrder"in n.style)},c}(r);rt.names.forEach(function(n){var t=rt[n];k.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}});k.players={};vu=n.navigator;k.prototype.options_={techOrder:a.defaultTechOrder_,html5:{},flash:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:vu&&(vu.languages&&vu.languages[0]||vu.userLanguage||vu.language)||"en",languages:{},notSupportedMessage:"No compatible source was found for this media.",fullscreen:{options:{navigationUI:"hide"}},breakpoints:{},responsive:!1};["ended","seeking","seekable","networkState","readyState"].forEach(function(n){k.prototype[n]=function(){return this.techGet_(n)}});id.forEach(function(n){k.prototype["handleTech"+b(n)+"_"]=function(){return this.trigger(n)}});r.registerComponent("Player",k);var ud=dr(function(n){function t(i,r){return n.exports=t=Object.setPrototypeOf||function(n,t){return n.__proto__=t,n},t(i,r)}n.exports=t}),kft=dr(function(n){function i(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(n){return!1}}function t(){return n.exports=i()?t=Reflect.construct:t=function(n,t,i){var r=[null],f,u;return r.push.apply(r,t),f=Function.bind.apply(n,r),u=new f,i&&ud(u,i.prototype),u},t.apply(null,arguments)}n.exports=t}),cs="plugin",yu="activePlugins_",pu={},ls=function(n){return pu.hasOwnProperty(n)},as=function(n){return ls(n)?pu[n]:undefined},fd=function(n,t){n[yu]=n[yu]||{};n[yu][t]=!0},vs=function(n,t,i){var r=(i?"before":"")+"pluginsetup";n.trigger(r,t);n.trigger(r+":"+t.name,t)},dft=function(n,t){var i=function(){vs(this,{name:n,plugin:t,instance:null},!0);var i=t.apply(this,arguments);return fd(this,n),vs(this,{name:n,plugin:t,instance:i}),i};return Object.keys(t).forEach(function(n){i[n]=t[n]}),i},ed=function(n,t){return t.prototype.name=n,function(){var r;vs(this,{name:n,plugin:t,instance:null},!0);for(var u=arguments.length,f=new Array(u),i=0;i<u;i++)f[i]=arguments[i];return r=kft(t,[this].concat(f)),this[n]=function(){return r},vs(this,r.getEventHash()),r}},fi=function(){function n(t){if(this.constructor===n)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=t;ic(this);delete this.trigger;kp(this,this.constructor.defaultState);fd(t,this.name);this.dispose=s(this,this.dispose);t.on("dispose",this.dispose)}var t=n.prototype;return t.version=function(){return this.constructor.VERSION},t.getEventHash=function(n){return n===void 0&&(n={}),n.name=this.name,n.plugin=this.constructor,n.instance=this,n},t.trigger=function(n,t){return t===void 0&&(t={}),ru(this.eventBusEl_,n,this.getEventHash(t))},t.handleStateChanged=function(){},t.dispose=function(){var n=this.name,t=this.player;this.trigger("dispose");this.off();t.off("dispose",this.dispose);t[yu][n]=!1;this.player=this.state=null;t[n]=ed(n,pu[n])},n.isBasic=function(t){var i=typeof t=="string"?as(t):t;return typeof i=="function"&&!n.prototype.isPrototypeOf(i.prototype)},n.registerPlugin=function(t,i){if(typeof t!="string")throw new Error('Illegal plugin name, "'+t+'", must be a string, was '+typeof t+".");if(ls(t))h.warn('A plugin named "'+t+'" already exists. You may want to avoid re-registering plugins!');else if(k.prototype.hasOwnProperty(t))throw new Error('Illegal plugin name, "'+t+'", cannot share a name with an existing player method!');if(typeof i!="function")throw new Error('Illegal plugin for "'+t+'", must be a function, was '+typeof i+".");return pu[t]=i,t!==cs&&(k.prototype[t]=n.isBasic(i)?dft(t,i):ed(t,i)),i},n.deregisterPlugin=function(n){if(n===cs)throw new Error("Cannot de-register base plugin.");ls(n)&&(delete pu[n],delete k.prototype[n])},n.getPlugins=function(n){n===void 0&&(n=Object.keys(pu));var t;return n.forEach(function(n){var i=as(n);i&&(t=t||{},t[n]=i)}),t},n.getPluginVersion=function(n){var t=as(n);return t&&t.VERSION||""},n}();fi.getPlugin=as;fi.BASE_PLUGIN_NAME=cs;fi.registerPlugin(cs,fi);k.prototype.usingPlugin=function(n){return!!this[yu]&&this[yu][n]===!0};k.prototype.hasPlugin=function(n){return!!ls(n)};var net=gft,tet=function(n,t){var i,r,u;t===void 0&&(t={});i=function(){n.apply(this,arguments)};r={};typeof t=="object"?(t.constructor!==Object.prototype.constructor&&(i=t.constructor),r=t):typeof t=="function"&&(i=t);net(i,n);n&&(i.super_=n);for(u in r)r.hasOwnProperty(u)&&(i.prototype[u]=r[u]);return i},od=function(n){return n.indexOf("#")===0?n.slice(1):n};i.hooks_={};i.hooks=function(n,t){return i.hooks_[n]=i.hooks_[n]||[],t&&(i.hooks_[n]=i.hooks_[n].concat(t)),i.hooks_[n]};i.hook=function(n,t){i.hooks(n,t)};i.hookOnce=function(n,t){i.hooks(n,[].concat(t).map(function(t){var r=function r(){return i.removeHook(n,r),t.apply(void 0,arguments)};return r}))};i.removeHook=function(n,t){var r=i.hooks(n).indexOf(t);return r<=-1?!1:(i.hooks_[n]=i.hooks_[n].slice(),i.hooks_[n].splice(r,1),!0)};n.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&nu()&&(te=bi(".vjs-styles-defaults"),te||(te=op("vjs-styles-defaults"),ys=bi("head"),ys&&ys.insertBefore(te,ys.firstChild),sp(te,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid {\n        padding-top: 56.25%\n      }\n    ")));kh(1,i);i.VERSION=hy;i.options=k.prototype.options_;i.getPlayers=function(){return k.players};i.getPlayer=function(n){var i=k.players,t,r,u;if(typeof n=="string"){if(r=od(n),u=i[r],u)return u;t=bi("#"+r)}else t=n;if(ef(t)){var f=t,e=f.player,o=f.playerId;if(e||i[o])return e||i[o]}};i.getAllPlayers=function(){return Object.keys(k.players).map(function(n){return k.players[n]}).filter(Boolean)};i.players=k.players;i.getComponent=r.getComponent;i.registerComponent=function(n,t){a.isTech(t)&&h.warn("The "+n+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");r.registerComponent.call(r,n,t)};i.getTech=a.getTech;i.registerTech=a.registerTech;i.use=kut;Object.defineProperty(i,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(i.middleware,"TERMINATOR",{value:eo,writeable:!1,enumerable:!0});i.browser=git;i.TOUCH_ENABLED=uu;i.extend=tet;i.mergeOptions=v;i.bind=s;i.registerPlugin=fi.registerPlugin;i.deregisterPlugin=fi.deregisterPlugin;i.plugin=function(n,t){return h.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),fi.registerPlugin(n,t)};i.getPlugins=fi.getPlugins;i.getPlugin=fi.getPlugin;i.getPluginVersion=fi.getPluginVersion;i.addLanguage=function(n,t){var r;return n=(""+n).toLowerCase(),i.options.languages=v(i.options.languages,(r={},r[n]=t,r)),i.options.languages[n]};i.log=h;i.createLogger=ah;i.createTimeRange=i.createTimeRanges=er;i.formatTime=cu;i.setFormatTime=hft;i.resetFormatTime=cft;i.parseUrl=pc;i.isCrossOrigin=io;i.EventTarget=d;i.on=yt;i.one=ke;i.off=it;i.trigger=ru;i.xhr=bc;i.TextTrack=pf;i.AudioTrack=kw;i.VideoTrack=dw;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(n){i[n]=function(){return h.warn("videojs."+n+"() is deprecated; use videojs.dom."+n+"() instead"),fp[n].apply(null,arguments)}});i.computedStyle=ye;i.dom=fp;i.url=crt;i.defineLazyProperty=sa;la=dr(function(n){(function(){var i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,u=/(?:\/|^)\.(?=\/)/g,f=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,t={buildAbsoluteURL:function(n,i,u){var s,f,e,h,o,c,l;if(u=u||{},n=n.trim(),i=i.trim(),!i){if(!u.alwaysNormalize)return n;if(s=t.parseURL(n),!s)throw new Error("Error trying to parse base URL.");return s.path=t.normalizePath(s.path),t.buildURLFromParts(s)}if(f=t.parseURL(i),!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=t.normalizePath(f.path),t.buildURLFromParts(f)):i;if(e=t.parseURL(n),!e)throw new Error("Error trying to parse base URL.");return!e.netLoc&&e.path&&e.path[0]!=="/"&&(h=r.exec(e.path),e.netLoc=h[1],e.path=h[2]),e.netLoc&&!e.path&&(e.path="/"),o={scheme:e.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment},f.netLoc||(o.netLoc=e.netLoc,f.path[0]!=="/"&&(f.path?(c=e.path,l=c.substring(0,c.lastIndexOf("/")+1)+f.path,o.path=t.normalizePath(l)):(o.path=e.path,f.params||(o.params=e.params,f.query||(o.query=e.query))))),o.path===null&&(o.path=u.alwaysNormalize?t.normalizePath(f.path):f.path),t.buildURLFromParts(o)},parseURL:function(n){var t=i.exec(n);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(n){for(n=n.split("").reverse().join("").replace(u,"");n.length!==(n=n.replace(f,"")).length;);return n.split("").reverse().join("")},buildURLFromParts:function(n){return n.scheme+n.netLoc+n.path+n.params+n.query+n.fragment}};n.exports=t})()});var ya=function(){function t(){this.listeners={}}var n=t.prototype;return n.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),i>-1},n.trigger=function(n){var i=this.listeners[n],t,r,u;if(i)if(arguments.length===2)for(r=i.length,t=0;t<r;++t)i[t].call(this,arguments[1]);else for(u=Array.prototype.slice.call(arguments,1),r=i.length,t=0;t<r;++t)i[t].apply(this,u)},n.dispose=function(){this.listeners={}},n.pipe=function(n){this.on("data",function(t){n.push(t)})},t}(),ret=function(n){function t(){var t;return t=n.call(this)||this,t.buffer="",t}va(t,n);var i=t.prototype;return i.push=function(n){var t;for(this.buffer+=n,t=this.buffer.indexOf("\n");t>-1;t=this.buffer.indexOf("\n"))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)},t}(ya),uet=function(){return new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')},ie=function(n){for(var i=n.split(uet()),u={},r=i.length,t;r--;)i[r]!==""&&(t=/([^=]*)=(.*)/.exec(i[r]).slice(1),t[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),u[t[0]]=t[1]);return u},fet=function(n){function t(){var t;return t=n.call(this)||this,t.customParsers=[],t.tagMappers=[],t}va(t,n);var i=t.prototype;return i.push=function(n){var r=this,i,t,u;if(n=n.trim(),n.length!==0){if(n[0]!=="#"){this.trigger("data",{type:"uri",uri:n});return}u=this.tagMappers.reduce(function(t,i){var r=i(n);return r===n?t:t.concat([r])},[n]);u.forEach(function(n){for(var u,f,o,e=0;e<r.customParsers.length;e++)if(r.customParsers[e].call(r,n))return;if(n.indexOf("#EXT")!==0){r.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),i=/^#EXTM3U/.exec(n),i){r.trigger("data",{type:"tag",tagType:"m3u"});return}if(i=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(n),i){t={type:"tag",tagType:"inf"};i[1]&&(t.duration=parseFloat(i[1]));i[2]&&(t.title=i[2]);r.trigger("data",t);return}if(i=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"targetduration"};i[1]&&(t.duration=parseInt(i[1],10));r.trigger("data",t);return}if(i=/^#ZEN-TOTAL-DURATION:?([0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"totalduration"};i[1]&&(t.duration=parseInt(i[1],10));r.trigger("data",t);return}if(i=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"version"};i[1]&&(t.version=parseInt(i[1],10));r.trigger("data",t);return}if(i=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"media-sequence"};i[1]&&(t.number=parseInt(i[1],10));r.trigger("data",t);return}if(i=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"discontinuity-sequence"};i[1]&&(t.number=parseInt(i[1],10));r.trigger("data",t);return}if(i=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(n),i){t={type:"tag",tagType:"playlist-type"};i[1]&&(t.playlistType=i[1]);r.trigger("data",t);return}if(i=/^#EXT-X-BYTERANGE:?([0-9.]*)?@?([0-9.]*)?/.exec(n),i){t={type:"tag",tagType:"byterange"};i[1]&&(t.length=parseInt(i[1],10));i[2]&&(t.offset=parseInt(i[2],10));r.trigger("data",t);return}if(i=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(n),i){t={type:"tag",tagType:"allow-cache"};i[1]&&(t.allowed=!/NO/.test(i[1]));r.trigger("data",t);return}if(i=/^#EXT-X-MAP:?(.*)$/.exec(n),i){if(t={type:"tag",tagType:"map"},i[1]&&(u=ie(i[1]),u.URI&&(t.uri=u.URI),u.BYTERANGE)){var s=u.BYTERANGE.split("@"),h=s[0],c=s[1];t.byterange={};h&&(t.byterange.length=parseInt(h,10));c&&(t.byterange.offset=parseInt(c,10))}r.trigger("data",t);return}if(i=/^#EXT-X-STREAM-INF:?(.*)$/.exec(n),i){t={type:"tag",tagType:"stream-inf"};i[1]&&(t.attributes=ie(i[1]),t.attributes.RESOLUTION&&(f=t.attributes.RESOLUTION.split("x"),o={},f[0]&&(o.width=parseInt(f[0],10)),f[1]&&(o.height=parseInt(f[1],10)),t.attributes.RESOLUTION=o),t.attributes.BANDWIDTH&&(t.attributes.BANDWIDTH=parseInt(t.attributes.BANDWIDTH,10)),t.attributes["PROGRAM-ID"]&&(t.attributes["PROGRAM-ID"]=parseInt(t.attributes["PROGRAM-ID"],10)));r.trigger("data",t);return}if(i=/^#EXT-X-MEDIA:?(.*)$/.exec(n),i){t={type:"tag",tagType:"media"};i[1]&&(t.attributes=ie(i[1]));r.trigger("data",t);return}if(i=/^#EXT-X-ENDLIST/.exec(n),i){r.trigger("data",{type:"tag",tagType:"endlist"});return}if(i=/^#EXT-X-DISCONTINUITY/.exec(n),i){r.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(i=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(n),i){t={type:"tag",tagType:"program-date-time"};i[1]&&(t.dateTimeString=i[1],t.dateTimeObject=new Date(i[1]));r.trigger("data",t);return}if(i=/^#EXT-X-KEY:?(.*)$/.exec(n),i){t={type:"tag",tagType:"key"};i[1]&&(t.attributes=ie(i[1]),t.attributes.IV&&(t.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(t.attributes.IV=t.attributes.IV.substring(2)),t.attributes.IV=t.attributes.IV.match(/.{8}/g),t.attributes.IV[0]=parseInt(t.attributes.IV[0],16),t.attributes.IV[1]=parseInt(t.attributes.IV[1],16),t.attributes.IV[2]=parseInt(t.attributes.IV[2],16),t.attributes.IV[3]=parseInt(t.attributes.IV[3],16),t.attributes.IV=new Uint32Array(t.attributes.IV)));r.trigger("data",t);return}if(i=/^#EXT-X-START:?(.*)$/.exec(n),i){t={type:"tag",tagType:"start"};i[1]&&(t.attributes=ie(i[1]),t.attributes["TIME-OFFSET"]=parseFloat(t.attributes["TIME-OFFSET"]),t.attributes.PRECISE=/YES/.test(t.attributes.PRECISE));r.trigger("data",t);return}if(i=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(n),i){t={type:"tag",tagType:"cue-out-cont"};t.data=i[1]?i[1]:"";r.trigger("data",t);return}if(i=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(n),i){t={type:"tag",tagType:"cue-out"};t.data=i[1]?i[1]:"";r.trigger("data",t);return}if(i=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),i){t={type:"tag",tagType:"cue-in"};t.data=i[1]?i[1]:"";r.trigger("data",t);return}r.trigger("data",{type:"tag",data:n.slice(4)})})}},i.addParser=function(n){var i=this,r=n.expression,u=n.customType,t=n.dataParser,f=n.segment;typeof t!="function"&&(t=function(n){return n});this.customParsers.push(function(n){var e=r.exec(n);if(e)return i.trigger("data",{type:"custom",data:t(n),customType:u,segment:f}),!0})},i.addTagMapper=function(n){var t=n.expression,i=n.map,r=function(n){return t.test(n)?i(n):n};this.tagMappers.push(r)},t}(ya);var sd=function(n){function i(){var i;i=n.call(this)||this;i.lineStream=new ret;i.parseStream=new fet;i.lineStream.pipe(i.parseStream);var o=iet(i),f=[],t={},r,u,h=function(){},s={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed",e=0;i.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};i.parseStream.on("data",function(n){var l,i;({tag:function(){({"allow-cache":function(){this.manifest.allowCache=n.allowed;"allowed"in n||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var i={};"length"in n&&(t.byterange=i,i.length=n.length,"offset"in n||(this.trigger("info",{message:"defaulting offset to zero"}),n.offset=0));"offset"in n&&(t.byterange=i,i.offset=n.offset)},endlist:function(){this.manifest.endList=!0},inf:function(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"}));"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"}));n.duration>0&&(t.duration=n.duration);n.duration===0&&(t.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"}));this.manifest.segments=f},key:function(){if(!n.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(n.attributes.METHOD==="NONE"){u=null;return}if(!n.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(n.attributes.KEYFORMAT===c){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(n.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(n.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),n.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(n.attributes.KEYID&&n.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection={"com.widevine.alpha":{attributes:{schemeIdUri:n.attributes.KEYFORMAT,keyId:n.attributes.KEYID.substring(2)},pssh:eet(n.attributes.URI.split(",")[1])}};return}n.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"});u={method:n.attributes.METHOD||"AES-128",uri:n.attributes.URI};typeof n.attributes.IV!="undefined"&&(u.iv=n.attributes.IV)},"media-sequence":function(){if(!isFinite(n.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+n.number});return}this.manifest.mediaSequence=n.number},"discontinuity-sequence":function(){if(!isFinite(n.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+n.number});return}this.manifest.discontinuitySequence=n.number;e=n.number},"playlist-type":function(){if(!/VOD|EVENT/.test(n.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+n.playlist});return}this.manifest.playlistType=n.playlistType},map:function(){r={};n.uri&&(r.uri=n.uri);n.byterange&&(r.byterange=n.byterange)},"stream-inf":function(){if(this.manifest.playlists=f,this.manifest.mediaGroups=this.manifest.mediaGroups||s,!n.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}t.attributes||(t.attributes={});aa(t.attributes,n.attributes)},media:function(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||s,!(n.attributes&&n.attributes.TYPE&&n.attributes["GROUP-ID"]&&n.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}var t=this.manifest.mediaGroups[n.attributes.TYPE];t[n.attributes["GROUP-ID"]]=t[n.attributes["GROUP-ID"]]||{};l=t[n.attributes["GROUP-ID"]];i={"default":/yes/i.test(n.attributes.DEFAULT)};i.autoselect=i["default"]?!0:/yes/i.test(n.attributes.AUTOSELECT);n.attributes.LANGUAGE&&(i.language=n.attributes.LANGUAGE);n.attributes.URI&&(i.uri=n.attributes.URI);n.attributes["INSTREAM-ID"]&&(i.instreamId=n.attributes["INSTREAM-ID"]);n.attributes.CHARACTERISTICS&&(i.characteristics=n.attributes.CHARACTERISTICS);n.attributes.FORCED&&(i.forced=/yes/i.test(n.attributes.FORCED));l[n.attributes.NAME]=i},discontinuity:function(){e+=1;t.discontinuity=!0;this.manifest.discontinuityStarts.push(f.length)},"program-date-time":function(){typeof this.manifest.dateTimeString=="undefined"&&(this.manifest.dateTimeString=n.dateTimeString,this.manifest.dateTimeObject=n.dateTimeObject);t.dateTimeString=n.dateTimeString;t.dateTimeObject=n.dateTimeObject},targetduration:function(){if(!isFinite(n.duration)||n.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+n.duration});return}this.manifest.targetDuration=n.duration},totalduration:function(){if(!isFinite(n.duration)||n.duration<0){this.trigger("warn",{message:"ignoring invalid total duration: "+n.duration});return}this.manifest.totalDuration=n.duration},start:function(){if(!n.attributes||isNaN(n.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:n.attributes["TIME-OFFSET"],precise:n.attributes.PRECISE}},"cue-out":function(){t.cueOut=n.data},"cue-out-cont":function(){t.cueOutCont=n.data},"cue-in":function(){t.cueIn=n.data}}[n.tagType]||h).call(o)},uri:function(){t.uri=n.uri;f.push(t);!this.manifest.targetDuration||"duration"in t||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),t.duration=this.manifest.targetDuration);u&&(t.key=u);t.timeline=e;r&&(t.map=r);t={}},comment:function(){},custom:function(){n.segment?(t.custom=t.custom||{},t.custom[n.customType]=n.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[n.customType]=n.data)}})[n.type].call(o)});return i}va(i,n);var t=i.prototype;return t.push=function(n){this.lineStream.push(n)},t.end=function(){this.lineStream.push("\n")},t.addParser=function(n){this.parseStream.addParser(n)},t.addTagMapper=function(n){this.parseStream.addTagMapper(n)},i}(ya),hd=function(n){return!!n&&typeof n=="object"},lt=function lt(){for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];return i.reduce(function(n,t){return Object.keys(t).forEach(function(i){n[i]=Array.isArray(n[i])&&Array.isArray(t[i])?n[i].concat(t[i]):hd(n[i])&&hd(t[i])?lt(n[i],t[i]):t[i]}),n},{})},oet=function(n){return Object.keys(n).map(function(t){return n[t]})},set=function(n,t){for(var r=[],i=n;i<t;i++)r.push(i);return r},ps=function(n){return n.reduce(function(n,t){return n.concat(t)},[])},cd=function(n){var i,t;if(!n.length)return[];for(i=[],t=0;t<n.length;t++)i.push(n[t]);return i},het=function(n,t){return n.reduce(function(n,i,r){return i[t]&&n.push(r),n},[])},wu={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};var ld=cet(function(n){(function(){var i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/\?#]*\/)*.*?)??(;.*?)?(\?.*?)?(#.*?)?$/,r=/^([^\/?#]*)(.*)$/,u=/(?:\/|^)\.(?=\/)/g,f=/(?:\/|^)\.\.\/(?!\.\.\/).*?(?=\/)/g,t={buildAbsoluteURL:function(n,i,u){var s,f,e,h,o,c,l;if(u=u||{},n=n.trim(),i=i.trim(),!i){if(!u.alwaysNormalize)return n;if(s=t.parseURL(n),!s)throw new Error("Error trying to parse base URL.");return s.path=t.normalizePath(s.path),t.buildURLFromParts(s)}if(f=t.parseURL(i),!f)throw new Error("Error trying to parse relative URL.");if(f.scheme)return u.alwaysNormalize?(f.path=t.normalizePath(f.path),t.buildURLFromParts(f)):i;if(e=t.parseURL(n),!e)throw new Error("Error trying to parse base URL.");return!e.netLoc&&e.path&&e.path[0]!=="/"&&(h=r.exec(e.path),e.netLoc=h[1],e.path=h[2]),e.netLoc&&!e.path&&(e.path="/"),o={scheme:e.scheme,netLoc:f.netLoc,path:null,params:f.params,query:f.query,fragment:f.fragment},f.netLoc||(o.netLoc=e.netLoc,f.path[0]!=="/"&&(f.path?(c=e.path,l=c.substring(0,c.lastIndexOf("/")+1)+f.path,o.path=t.normalizePath(l)):(o.path=e.path,f.params||(o.params=e.params,f.query||(o.query=e.query))))),o.path===null&&(o.path=u.alwaysNormalize?t.normalizePath(f.path):f.path),t.buildURLFromParts(o)},parseURL:function(n){var t=i.exec(n);return t?{scheme:t[1]||"",netLoc:t[2]||"",path:t[3]||"",params:t[4]||"",query:t[5]||"",fragment:t[6]||""}:null},normalizePath:function(n){for(n=n.split("").reverse().join("").replace(u,"");n.length!==(n=n.replace(f,"")).length;);return n.split("").reverse().join("")},buildURLFromParts:function(n){return n.scheme+n.netLoc+n.path+n.params+n.query+n.fragment}};n.exports=t})()}),pa=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=ld.buildAbsoluteURL(n.location.href,t)),ld.buildAbsoluteURL(t,i))},re=function(n){var i=n.baseUrl,l=i===void 0?"":i,r=n.source,u=r===void 0?"":r,f=n.range,t=f===void 0?"":f,e=n.indexRange,o=e===void 0?"":e,s={uri:u,resolvedUri:pa(l||"",u)};if(t||o){var a=t?t:o,h=a.split("-"),c=parseInt(h[0],10),v=parseInt(h[1],10);s.byterange={length:v-c+1,offset:c}}return s},aet=function(n){var t=n.offset+n.length-1;return n.offset+"-"+t},vet={"static":function(n){var i=n.duration,t=n.timescale,r=t===void 0?1:t,u=n.sourceDuration;return{start:0,end:Math.ceil(u/(i/r))}},dynamic:function(n){var h=n.NOW,c=n.clientOffset,l=n.availabilityStartTime,f=n.timescale,t=f===void 0?1:f,i=n.duration,e=n.start,a=e===void 0?0:e,o=n.minimumUpdatePeriod,v=o===void 0?0:o,s=n.timeShiftBufferDepth,y=s===void 0?Infinity:s,r=(h+c)/1e3,u=l+a,p=r+v,w=p-u,b=Math.ceil(w*t/i),k=Math.floor((r-u-y)*t/i),d=Math.floor((r-u)*t/i);return{start:Math.max(0,k),end:Math.min(b,d)}}},yet=function(n){return function(t,i){var r=n.duration,u=n.timescale,e=u===void 0?1:u,o=n.periodIndex,f=n.startNumber,s=f===void 0?1:f;return{number:s+t,duration:r/e,timeline:o,time:i*r}}},wa=function(n){var r=n.type,u=r===void 0?"static":r,o=n.duration,f=n.timescale,s=f===void 0?1:f,h=n.sourceDuration,e=vet[u](n),c=e.start,l=e.end,t=set(c,l).map(yet(n)),i;return u==="static"&&(i=t.length-1,t[i].duration=h-o/s*i),t},ad=function(n){var i=n.baseUrl,u=n.initialization,f=u===void 0?{}:u,e=n.sourceDuration,o=n.timescale,c=o===void 0?1:o,s=n.indexRange,l=s===void 0?"":s,a=n.duration,h,t,r;if(!i)throw new Error(wu.NO_BASE_URL);return h=re({baseUrl:i,source:f.sourceURL,range:f.range}),t=re({baseUrl:i,source:i,indexRange:l}),t.map=h,a?(r=wa(n),r.length&&(t.duration=r[0].duration,t.timeline=r[0].timeline)):e&&(t.duration=e/c,t.timeline=0),t.number=0,[t]},pet=function(n,t,i){for(var f=n.sidx.map?n.sidx.map:null,a=n.sidx.duration,e=n.timeline||0,o=n.sidx.byterange,v=o.offset+o.length,y=t.timescale,p=t.references.filter(function(n){return n.referenceType!==1}),s=[],r=v+t.firstOffset,u=0;u<p.length;u++){var h=t.references[u],c=h.referencedSize,w=h.subsegmentDuration,b=r+c-1,k=r+"-"+b,d={baseUrl:i,timescale:y,timeline:e,periodIndex:e,duration:w,sourceDuration:a,indexRange:k},l=ad(d)[0];f&&(l.map=f);s.push(l);r+=c}return n.segments=s,n},vd=function(n){var t=oet(n.reduce(function(n,t){var i=t.attributes.id+(t.attributes.lang||""),r;return n[i]?(t.segments[0]&&(t.segments[0].discontinuity=!0),(r=n[i].segments).push.apply(r,t.segments),t.attributes.contentProtection&&(n[i].attributes.contentProtection=t.attributes.contentProtection)):n[i]=t,n},{}));return t.map(function(n){return n.discontinuityStarts=het(n.segments,"discontinuity"),n})},ba=function(n,t){var f,i,r,u;if(t===void 0&&(t={}),!Object.keys(t).length)return n;for(f in n)(i=n[f],i.sidx)&&(r=i.sidx.uri+"-"+aet(i.sidx.byterange),u=t[r]&&t[r].sidx,i.sidx&&u&&pet(i,u,i.sidx.resolvedUri));return n},wet=function(n){var i,t=n.attributes,r=n.segments,f=n.sidx,u={attributes:(i={NAME:t.id,BANDWIDTH:t.bandwidth,CODECS:t.codecs},i["PROGRAM-ID"]=1,i),uri:"",endList:(t.type||"static")==="static",timeline:t.periodIndex,resolvedUri:"",targetDuration:t.duration,segments:r,mediaSequence:r.length?r[0].number:1};return t.contentProtection&&(u.contentProtection=t.contentProtection),f&&(u.sidx=f),u},bet=function(n){var r,t=n.attributes,i=n.segments;return typeof i=="undefined"&&(i=[{uri:t.baseUrl,timeline:t.periodIndex,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration),{attributes:(r={NAME:t.id,BANDWIDTH:t.bandwidth},r["PROGRAM-ID"]=1,r),uri:"",endList:(t.type||"static")==="static",timeline:t.periodIndex,resolvedUri:t.baseUrl||"",targetDuration:t.duration,segments:i,mediaSequence:i.length?i[0].number:1}},ket=function(n,t){var i,r,u;return t===void 0&&(t={}),r=n.reduce(function(n,r){var u=r.attributes.role&&r.attributes.role.value||"",e=r.attributes.lang||"",f="main",o;return(e&&(o=u?" ("+u+")":"",f=""+r.attributes.lang+o),n[f]&&n[f].playlists[0].attributes.BANDWIDTH>r.attributes.bandwidth)?n:(n[f]={language:e,autoselect:!0,"default":u==="main",playlists:ba([wet(r)],t),uri:""},typeof i=="undefined"&&u==="main"&&(i=r,i["default"]=!0),n)},{}),i||(u=Object.keys(r)[0],r[u]["default"]=!0),r},det=function(n,t){return t===void 0&&(t={}),n.reduce(function(n,i){var r=i.attributes.lang||"text";return n[r]?n:(n[r]={language:r,"default":!1,autoselect:!1,playlists:ba([bet(i)],t),uri:""},n)},{})},get=function(n){var i,t=n.attributes,r=n.segments,f=n.sidx,u={attributes:(i={NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth},i["PROGRAM-ID"]=1,i),uri:"",endList:(t.type||"static")==="static",timeline:t.periodIndex,resolvedUri:"",targetDuration:t.duration,segments:r,mediaSequence:r.length?r[0].number:1};return t.contentProtection&&(u.contentProtection=t.contentProtection),f&&(u.sidx=f),u},not=function(n,t){var i;if(t===void 0&&(t={}),!n.length)return{};var u=n[0].attributes,s=u.sourceDuration,f=u.minimumUpdatePeriod,h=f===void 0?0:f,c=function(n){var t=n.attributes;return t.mimeType==="video/mp4"||t.contentType==="video"},l=function(n){var t=n.attributes;return t.mimeType==="audio/mp4"||t.contentType==="audio"},a=function(n){var t=n.attributes;return t.mimeType==="text/vtt"||t.contentType==="text"},v=vd(n.filter(c)).map(get),e=vd(n.filter(l)),o=n.filter(a),r={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:(i={AUDIO:{},VIDEO:{}},i["CLOSED-CAPTIONS"]={},i.SUBTITLES={},i),uri:"",duration:s,playlists:ba(v,t),minimumUpdatePeriod:h*1e3};return e.length&&(r.mediaGroups.AUDIO.audio=ket(e,t)),o.length&&(r.mediaGroups.SUBTITLES.subs=det(o,t)),r},tot=function(n,t,i){var e=n.NOW,o=n.clientOffset,s=n.availabilityStartTime,r=n.timescale,h=r===void 0?1:r,u=n.start,c=u===void 0?0:u,f=n.minimumUpdatePeriod,l=f===void 0?0:f,a=(e+o)/1e3,v=s+c,y=a+l,p=y-v;return Math.ceil((p*h-t)/i)},yd=function(n,t){for(var o,c,d,s,l=n.type,g=l===void 0?"static":l,a=n.minimumUpdatePeriod,nt=a===void 0?0:a,v=n.media,tt=v===void 0?"":v,it=n.sourceDuration,y=n.timescale,p=y===void 0?1:y,w=n.startNumber,b=w===void 0?1:w,rt=n.periodIndex,u=[],i=-1,f=0;f<t.length;f++){var h=t[f],r=h.d,k=h.r||0,e=h.t||0;for(i<0&&(i=e),e&&e>i&&(i=e),o=void 0,k<0?(c=f+1,o=c===t.length?g==="dynamic"&&nt>0&&tt.indexOf("$Number$")>0?tot(n,i,r):(it*p-i)/r:(t[c].t-i)/r):o=k+1,d=b+u.length+o,s=b+u.length;s<d;)u.push({number:s,duration:r/p,time:i,timeline:rt}),i+=r,s++}return u},iot=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,rot=function(n){return function(t,i,r,u){if(t==="$$")return"$";if(typeof n[i]=="undefined")return t;var f=""+n[i];return i==="RepresentationID"?f:(u=r?parseInt(u,10):1,f.length>=u)?f:""+new Array(u-f.length+1).join("0")+f}},pd=function(n,t){return n.replace(iot,rot(t))},uot=function(n,t){return!n.duration&&!t?[{number:n.startNumber||1,duration:n.sourceDuration,time:0,timeline:n.periodIndex}]:n.duration?wa(n):yd(n,t)},fot=function(n,t){var i={RepresentationID:n.id,Bandwidth:n.bandwidth||0},r=n.initialization,u=r===void 0?{sourceURL:"",range:""}:r,f=re({baseUrl:n.baseUrl,source:pd(u.sourceURL,i),range:u.range}),e=uot(n,t);return e.map(function(t){i.Number=t.number;i.Time=t.time;var r=pd(n.media||"",i);return{uri:r,timeline:t.timeline,duration:t.duration,resolvedUri:pa(n.baseUrl||"",r),map:f,number:t.number}})},eot=function(n,t){var i=n.baseUrl,r=n.initialization,u=r===void 0?{}:r,e=re({baseUrl:i,source:u.sourceURL,range:u.range}),f=re({baseUrl:i,source:t.media,range:t.mediaRange});return f.map=e,f},oot=function(n,t){var i=n.duration,f=n.segmentUrls,e=f===void 0?[]:f,r,u;if(!i&&!t||i&&t)throw new Error(wu.SEGMENT_TIME_UNSPECIFIED);return r=e.map(function(t){return eot(n,t)}),i&&(u=wa(n)),t&&(u=yd(n,t)),u.map(function(n,t){if(r[t]){var i=r[t];return i.timeline=n.timeline,i.duration=n.duration,i.number=n.number,i}}).filter(function(n){return n})},sot=function(n){var e=n.attributes,i=n.segmentInfo,t,u,r,f;if(i.template?(u=fot,t=lt(e,i.template)):i.base?(u=ad,t=lt(e,i.base)):i.list&&(u=oot,t=lt(e,i.list)),r={attributes:e},!u)return r;if(f=u(t,i.timeline),t.duration){var o=t,h=o.duration,s=o.timescale,c=s===void 0?1:s;t.duration=h/c}else t.duration=f.length?f.reduce(function(n,t){return Math.max(n,Math.ceil(t.duration))},0):0;return r.attributes=t,r.segments=f,i.base&&t.indexRange&&(r.sidx=f[0],r.segments=[]),r},hot=function(n){return n.map(sot)},nt=function(n,t){return cd(n.childNodes).filter(function(n){var i=n.tagName;return i===t})},wd=function(n){return n.textContent.trim()},ue=function(n){var i=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(n);if(!i)return 0;var t=i.slice(1),r=t[0],u=t[1],f=t[2],e=t[3],o=t[4],s=t[5];return parseFloat(r||0)*31536e3+parseFloat(u||0)*2592e3+parseFloat(f||0)*86400+parseFloat(e||0)*3600+parseFloat(o||0)*60+parseFloat(s||0)},cot=function(n){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(n)&&(n+="Z"),Date.parse(n)},bd={mediaPresentationDuration:function(n){return ue(n)},availabilityStartTime:function(n){return cot(n)/1e3},minimumUpdatePeriod:function(n){return ue(n)},timeShiftBufferDepth:function(n){return ue(n)},start:function(n){return ue(n)},width:function(n){return parseInt(n,10)},height:function(n){return parseInt(n,10)},bandwidth:function(n){return parseInt(n,10)},startNumber:function(n){return parseInt(n,10)},timescale:function(n){return parseInt(n,10)},duration:function(n){var t=parseInt(n,10);return isNaN(t)?ue(n):t},d:function(n){return parseInt(n,10)},t:function(n){return parseInt(n,10)},r:function(n){return parseInt(n,10)},DEFAULT:function(n){return n}},et=function(n){return(n&&n.attributes)?cd(n.attributes).reduce(function(n,t){var i=bd[t.name]||bd.DEFAULT;return n[t.name]=i(t.value),n},{}):{}};var aot={"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"},ws=function(n,t){return t.length?ps(n.map(function(n){return t.map(function(t){return pa(n,wd(t))})})):n},ka=function(n){var f=nt(n,"SegmentTemplate")[0],i=nt(n,"SegmentList")[0],c=i&&nt(i,"SegmentURL").map(function(n){return lt({tag:"SegmentURL"},et(n))}),e=nt(n,"SegmentBase")[0],o=i||f,s=o&&nt(o,"SegmentTimeline")[0],h=i||e||f,r=h&&nt(h,"Initialization")[0],t=f&&et(f),u;return t&&r?t.initialization=r&&et(r):t&&t.initialization&&(t.initialization={sourceURL:t.initialization}),u={template:t,timeline:s&&nt(s,"S").map(function(n){return et(n)}),list:i&&lt(et(i),{segmentUrls:c,initialization:et(r)}),base:e&&lt(et(e),{initialization:et(r)})},Object.keys(u).forEach(function(n){u[n]||delete u[n]}),u},vot=function(n,t,i){return function(r){var u=nt(r,"BaseURL"),f=ws(t,u),e=lt(n,et(r)),o=ka(r);return f.map(function(n){return{segmentInfo:lt(i,o),attributes:lt(e,{baseUrl:n})}})}},yot=function(n){return n.reduce(function(n,t){var f=et(t),i=aot[f.schemeIdUri],r,u,e;return i&&(n[i]={attributes:f},r=nt(t,"cenc:pssh")[0],r&&(u=wd(r),e=u&&lot(u),n[i].pssh=e)),n},{})},pot=function(n,t,i){return function(r){var e=et(r),o=ws(t,nt(r,"BaseURL")),s=nt(r,"Role")[0],h={role:et(s)},u=lt(n,e,h),f=yot(nt(r,"ContentProtection"));Object.keys(f).length&&(u=lt(u,{contentProtection:f}));var c=ka(r),l=nt(r,"Representation"),a=lt(i,c);return ps(l.map(vot(u,o,a)))}},wot=function(t,i){return function(r,u){var e=ws(i,nt(r,"BaseURL")),o=et(r),f=parseInt(o.id,10),s=n.isNaN(f)?u:f,h=lt(t,{periodIndex:s}),c=nt(r,"AdaptationSet"),l=ka(r);return ps(c.map(pot(h,e,l)))}},bot=function(n,t){var i,s;t===void 0&&(t={});var r=t,u=r.manifestUri,h=u===void 0?"":u,f=r.NOW,c=f===void 0?Date.now():f,e=r.clientOffset,l=e===void 0?0:e,o=nt(n,"Period");if(!o.length)throw new Error(wu.INVALID_NUMBER_OF_PERIOD);return i=et(n),s=ws([h],nt(n,"BaseURL")),i.sourceDuration=i.mediaPresentationDuration||0,i.NOW=c,i.clientOffset=l,ps(o.map(wot(i,s)))},kd=function(t){if(t==="")throw new Error(wu.DASH_EMPTY_MANIFEST);var u=new n.DOMParser,r=u.parseFromString(t,"application/xml"),i=r&&r.documentElement.tagName==="MPD"?r.documentElement:null;if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(wu.DASH_INVALID_XML);return i},kot=function(n){var i=nt(n,"UTCTiming")[0],t;if(!i)return null;t=et(i);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.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":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT";t.value=Date.parse(t.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(wu.UNSUPPORTED_UTC_TIMING_SCHEME);}return t},dd=function(n,t){return t===void 0&&(t={}),not(hot(bot(kd(n),t)),t.sidxMapping)},dot=function(n){return kot(kd(n))},got=function(n){return n>>>0},nst=function(n){return("00"+n.toString(16)).slice(-2)},da={toUnsigned:got,toHexString:nst},ot,ga,nv=da.toUnsigned,gt=function(n){return new Date(n*1e3-20828448e5)},gd=function(n){return{isLeading:(n[0]&12)>>>2,dependsOn:n[0]&3,isDependedOn:(n[1]&192)>>>6,hasRedundancy:(n[1]&48)>>>4,paddingValue:(n[1]&14)>>>1,isNonSyncSample:n[1]&1,degradationPriority:n[2]<<8|n[3]}},bu=function(n){var t="";return t+=String.fromCharCode(n[0]),t+=String.fromCharCode(n[1]),t+=String.fromCharCode(n[2]),t+String.fromCharCode(n[3])},ng=function ng(n,t){var r=[],i,f,o,u,e;if(!t.length)return null;for(i=0;i<n.byteLength;)f=nv(n[i]<<24|n[i+1]<<16|n[i+2]<<8|n[i+3]),o=bu(n.subarray(i+4,i+8)),u=f>1?i+f:n.byteLength,o===t[0]&&(t.length===1?r.push(n.subarray(i+8,u)):(e=ng(n.subarray(i+8,u),t.slice(1)),e.length&&(r=r.concat(e)))),i=u;return r},tst=function(n){for(var u=new DataView(n.buffer,n.byteOffset,n.byteLength),t=[],r,i=0;i+4<n.length;i+=r){if(r=u.getUint32(i),i+=4,r<=0){t.push("<span style='color:red;'>MALFORMED DATA<\/span>");continue}switch(n[i]&31){case 1:t.push("slice_layer_without_partitioning_rbsp");break;case 5:t.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:t.push("sei_rbsp");break;case 7:t.push("seq_parameter_set_rbsp");break;case 8:t.push("pic_parameter_set_rbsp");break;case 9:t.push("access_unit_delimiter_rbsp");break;default:t.push("UNKNOWN NAL - "+n[i]&31)}}return t},gi={avc1:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{dataReferenceIndex:t.getUint16(6),width:t.getUint16(24),height:t.getUint16(26),horizresolution:t.getUint16(28)+t.getUint16(30)/16,vertresolution:t.getUint16(32)+t.getUint16(34)/16,frameCount:t.getUint16(40),depth:t.getUint16(74),config:ot(n.subarray(78,n.byteLength))}},avcC:function(n){for(var f=new DataView(n.buffer,n.byteOffset,n.byteLength),u={configurationVersion:n[0],avcProfileIndication:n[1],profileCompatibility:n[2],avcLevelIndication:n[3],lengthSizeMinusOne:n[4]&3,sps:[],pps:[]},o=n[5]&31,e,i,t=6,r=0;r<o;r++)i=f.getUint16(t),t+=2,u.sps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;for(e=n[t],t++,r=0;r<e;r++)i=f.getUint16(t),t+=2,u.pps.push(new Uint8Array(n.subarray(t,t+i))),t+=i;return u},btrt:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{bufferSizeDB:t.getUint32(0),maxBitrate:t.getUint32(4),avgBitrate:t.getUint32(8)}},esds:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),esId:n[6]<<8|n[7],streamPriority:n[8]&31,decoderConfig:{objectProfileIndication:n[11],streamType:n[12]>>>2&63,bufferSize:n[13]<<16|n[14]<<8|n[15],maxBitrate:n[16]<<24|n[17]<<16|n[18]<<8|n[19],avgBitrate:n[20]<<24|n[21]<<16|n[22]<<8|n[23],decoderConfigDescriptor:{tag:n[24],length:n[25],audioObjectType:n[26]>>>3&31,samplingFrequencyIndex:(n[26]&7)<<1|n[27]>>>7&1,channelConfiguration:n[27]>>>3&15}}}},ftyp:function(n){for(var r=new DataView(n.buffer,n.byteOffset,n.byteLength),i={majorBrand:bu(n.subarray(0,4)),minorVersion:r.getUint32(4),compatibleBrands:[]},t=8;t<n.byteLength;)i.compatibleBrands.push(bu(n.subarray(t,t+4))),t+=4;return i},dinf:function(n){return{boxes:ot(n)}},dref:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),dataReferences:ot(n.subarray(8))}},hdlr:function(n){for(var r=new DataView(n.buffer,n.byteOffset,n.byteLength),i={version:r.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),handlerType:bu(n.subarray(8,12)),name:""},t=8,t=24;t<n.byteLength;t++){if(n[t]===0){t++;break}i.name+=String.fromCharCode(n[t])}return i.name=decodeURIComponent(escape(i.name)),i},mdat:function(n){return{byteLength:n.byteLength,nals:tst(n)}},mdhd:function(n){var r=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,u,i={version:r.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),language:""};return i.version===1?(t+=4,i.creationTime=gt(r.getUint32(t)),t+=8,i.modificationTime=gt(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=8,i.duration=r.getUint32(t)):(i.creationTime=gt(r.getUint32(t)),t+=4,i.modificationTime=gt(r.getUint32(t)),t+=4,i.timescale=r.getUint32(t),t+=4,i.duration=r.getUint32(t)),t+=4,u=r.getUint16(t),i.language+=String.fromCharCode((u>>10)+96),i.language+=String.fromCharCode(((u&992)>>5)+96),i.language+=String.fromCharCode((u&31)+96),i},mdia:function(n){return{boxes:ot(n)}},mfhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sequenceNumber:n[4]<<24|n[5]<<16|n[6]<<8|n[7]}},minf:function(n){return{boxes:ot(n)}},mp4a:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength),i={dataReferenceIndex:t.getUint16(6),channelcount:t.getUint16(16),samplesize:t.getUint16(18),samplerate:t.getUint16(24)+t.getUint16(26)/65536};return n.byteLength>28&&(i.streamDescriptor=ot(n.subarray(28))[0]),i},moof:function(n){return{boxes:ot(n)}},moov:function(n){return{boxes:ot(n)}},mvex:function(n){return{boxes:ot(n)}},mvhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return r.version===1?(t+=4,r.creationTime=gt(i.getUint32(t)),t+=8,r.modificationTime=gt(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=8,r.duration=i.getUint32(t)):(r.creationTime=gt(i.getUint32(t)),t+=4,r.modificationTime=gt(i.getUint32(t)),t+=4,r.timescale=i.getUint32(t),t+=4,r.duration=i.getUint32(t)),t+=4,r.rate=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,t+=8,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,t+=24,r.nextTrackId=i.getUint32(t),r},pdin:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:t.getUint8(0),flags:new Uint8Array(n.subarray(1,4)),rate:t.getUint32(4),initialDelay:t.getUint32(8)}},sdtp:function(n){for(var i={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},t=4;t<n.byteLength;t++)i.samples.push({dependsOn:(n[t]&48)>>4,isDependedOn:(n[t]&12)>>2,hasRedundancy:n[t]&3});return i},sidx:function(n){for(var t=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),references:[],referenceId:t.getUint32(4),timescale:t.getUint32(8),earliestPresentationTime:t.getUint32(12),firstOffset:t.getUint32(16)},u=t.getUint16(22),i=24;u;i+=12,u--)r.references.push({referenceType:(n[i]&128)>>>7,referencedSize:t.getUint32(i)&2147483647,subsegmentDuration:t.getUint32(i+4),startsWithSap:!!(n[i+8]&128),sapType:(n[i+8]&112)>>>4,sapDeltaTime:t.getUint32(i+8)&268435455});return r},smhd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),balance:n[4]+n[5]/256}},stbl:function(n){return{boxes:ot(n)}},stco:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),chunkOffsets:[]},u=i.getUint32(4),t=8;u;t+=4,u--)r.chunkOffsets.push(i.getUint32(t));return r},stsc:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r=i.getUint32(4),u={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleToChunks:[]},t=8;r;t+=12,r--)u.sampleToChunks.push({firstChunk:i.getUint32(t),samplesPerChunk:i.getUint32(t+4),sampleDescriptionIndex:i.getUint32(t+8)});return u},stsd:function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleDescriptions:ot(n.subarray(8))}},stsz:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),sampleSize:i.getUint32(4),entries:[]},t=12;t<n.byteLength;t+=4)r.entries.push(i.getUint32(t));return r},stts:function(n){for(var i=new DataView(n.buffer,n.byteOffset,n.byteLength),r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),timeToSamples:[]},u=i.getUint32(4),t=8;u;t+=8,u--)r.timeToSamples.push({sampleCount:i.getUint32(t),sampleDelta:i.getUint32(t+4)});return r},styp:function(n){return gi.ftyp(n)},tfdt:function(n){var t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),baseMediaDecodeTime:nv(n[4]<<24|n[5]<<16|n[6]<<8|n[7])};return t.version===1&&(t.baseMediaDecodeTime*=Math.pow(2,32),t.baseMediaDecodeTime+=nv(n[8]<<24|n[9]<<16|n[10]<<8|n[11])),t},tfhd:function(n){var r=new DataView(n.buffer,n.byteOffset,n.byteLength),t={version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:r.getUint32(4)},u=t.flags[2]&1,f=t.flags[2]&2,e=t.flags[2]&8,o=t.flags[2]&16,s=t.flags[2]&32,h=t.flags[0]&65536,c=t.flags[0]&131072,i;return i=8,u&&(i+=4,t.baseDataOffset=r.getUint32(12),i+=4),f&&(t.sampleDescriptionIndex=r.getUint32(i),i+=4),e&&(t.defaultSampleDuration=r.getUint32(i),i+=4),o&&(t.defaultSampleSize=r.getUint32(i),i+=4),s&&(t.defaultSampleFlags=r.getUint32(i)),h&&(t.durationIsEmpty=!0),!u&&c&&(t.baseDataOffsetIsMoof=!0),t},tkhd:function(n){var i=new DataView(n.buffer,n.byteOffset,n.byteLength),t=4,r={version:i.getUint8(0),flags:new Uint8Array(n.subarray(1,4))};return r.version===1?(t+=4,r.creationTime=gt(i.getUint32(t)),t+=8,r.modificationTime=gt(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=8,r.duration=i.getUint32(t)):(r.creationTime=gt(i.getUint32(t)),t+=4,r.modificationTime=gt(i.getUint32(t)),t+=4,r.trackId=i.getUint32(t),t+=4,t+=4,r.duration=i.getUint32(t)),t+=4,t+=8,r.layer=i.getUint16(t),t+=2,r.alternateGroup=i.getUint16(t),t+=2,r.volume=i.getUint8(t)+i.getUint8(t+1)/8,t+=2,t+=2,r.matrix=new Uint32Array(n.subarray(t,t+36)),t+=36,r.width=i.getUint16(t)+i.getUint16(t+2)/16,t+=4,r.height=i.getUint16(t)+i.getUint16(t+2)/16,r},traf:function(n){return{boxes:ot(n)}},trak:function(n){return{boxes:ot(n)}},trex:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),trackId:t.getUint32(4),defaultSampleDescriptionIndex:t.getUint32(8),defaultSampleDuration:t.getUint32(12),defaultSampleSize:t.getUint32(16),sampleDependsOn:n[20]&3,sampleIsDependedOn:(n[21]&192)>>6,sampleHasRedundancy:(n[21]&48)>>4,samplePaddingValue:(n[21]&14)>>1,sampleIsDifferenceSample:!!(n[21]&1),sampleDegradationPriority:t.getUint16(22)}},trun:function(n){var r={version:n[0],flags:new Uint8Array(n.subarray(1,4)),samples:[]},u=new DataView(n.buffer,n.byteOffset,n.byteLength),h=r.flags[2]&1,c=r.flags[2]&4,e=r.flags[1]&1,o=r.flags[1]&2,l=r.flags[1]&4,s=r.flags[1]&8,f=u.getUint32(4),t=8,i;for(h&&(r.dataOffset=u.getInt32(t),t+=4),c&&f&&(i={flags:gd(n.subarray(t,t+4))},t+=4,e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i),f--);f--;)i={},e&&(i.duration=u.getUint32(t),t+=4),o&&(i.size=u.getUint32(t),t+=4),l&&(i.flags=gd(n.subarray(t,t+4)),t+=4),s&&(i.compositionTimeOffset=u.getUint32(t),t+=4),r.samples.push(i);return r},"url ":function(n){return{version:n[0],flags:new Uint8Array(n.subarray(1,4))}},vmhd:function(n){var t=new DataView(n.buffer,n.byteOffset,n.byteLength);return{version:n[0],flags:new Uint8Array(n.subarray(1,4)),graphicsmode:t.getUint16(4),opcolor:new Uint16Array([t.getUint16(6),t.getUint16(8),t.getUint16(10)])}}};ot=function(n){for(var t=0,o=[],s,i,f,e,r,h=new ArrayBuffer(n.length),c=new Uint8Array(h),u=0;u<n.length;++u)c[u]=n[u];for(s=new DataView(h);t<n.byteLength;)i=s.getUint32(t),f=bu(n.subarray(t+4,t+8)),e=i>1?t+i:n.byteLength,r=(gi[f]||function(n){return{data:n}})(n.subarray(t+8,e)),r.size=i,r.type=f,o.push(r),t=e;return o};ga=function(n,t){var i;return t=t||0,i=new Array(t*2+1).join(" "),n.map(function(n){return i+n.type+"\n"+Object.keys(n).filter(function(n){return n!=="type"&&n!=="boxes"}).map(function(t){var f=i+"  "+t+": ",r=n[t],u;return r instanceof Uint8Array||r instanceof Uint32Array?(u=Array.prototype.slice.call(new Uint8Array(r.buffer,r.byteOffset,r.byteLength)).map(function(n){return" "+("00"+n.toString(16)).slice(-2)}).join("").match(/.{1,24}/g),!u)?f+"<>":u.length===1?f+"<"+u.join("").slice(1)+">":f+"<\n"+u.map(function(n){return i+"  "+n}).join("\n")+"\n"+i+"  >":f+JSON.stringify(r,null,2).split("\n").map(function(n,t){return t===0?n:i+"  "+n}).join("\n")}).join("\n")+(n.boxes?"\n"+ga(n.boxes,t+1):"")}).join("\n")};var l={inspect:ot,textify:ga,parseType:bu,findBox:ng,parseTraf:gi.traf,parseTfdt:gi.tfdt,parseHdlr:gi.hdlr,parseTfhd:gi.tfhd,parseTrun:gi.trun,parseSidx:gi.sidx},ku=da.toUnsigned,fe=da.toHexString,tg,ig,rg,ug,fg;tg=function(n){var t=l.findBox(n,["moov","trak"]);return t.reduce(function(n,t){var r,f,i,e,u;return(r=l.findBox(t,["tkhd"])[0],!r)?null:(f=r[0],i=f===0?12:20,e=ku(r[i]<<24|r[i+1]<<16|r[i+2]<<8|r[i+3]),u=l.findBox(t,["mdia","mdhd"])[0],!u)?null:(f=u[0],i=f===0?12:20,n[e]=ku(u[i]<<24|u[i+1]<<16|u[i+2]<<8|u[i+3]),n)},{})};ig=function(n,t){var r,u,i;return r=l.findBox(t,["moof","traf"]),u=[].concat.apply([],r.map(function(t){return l.findBox(t,["tfhd"]).map(function(i){var u,f,r;return u=ku(i[4]<<24|i[5]<<16|i[6]<<8|i[7]),f=n[u]||9e4,r=l.findBox(t,["tfdt"]).map(function(n){var i,t;return i=n[0],t=ku(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),i===1&&(t*=Math.pow(2,32),t+=ku(n[8]<<24|n[9]<<16|n[10]<<8|n[11])),t})[0],r=r||Infinity,r/f})})),i=Math.min.apply(null,u),isFinite(i)?i:0};rg=function(n,t){var u=l.findBox(t,["moof","traf"]),f=0,e=0,o,r,i,s;if(u&&u.length)for(r=l.parseTraf(u[0]),i=0;i<r.boxes.length;i++)r.boxes[i].type==="tfhd"?o=r.boxes[i].trackId:r.boxes[i].type==="tfdt"?f=r.boxes[i].baseMediaDecodeTime:r.boxes[i].type==="trun"&&r.boxes[i].samples.length&&(e=r.boxes[i].samples[0].compositionTimeOffset||0);return s=n[o]||9e4,(f+e)/s};ug=function(n){var i=l.findBox(n,["moov","trak"]),t=[];return i.forEach(function(n){var i=l.findBox(n,["mdia","hdlr"]),r=l.findBox(n,["tkhd"]);i.forEach(function(n,i){var s=l.parseType(n.subarray(8,12)),f=r[i],u,e,o;s==="vide"&&(u=new DataView(f.buffer,f.byteOffset,f.byteLength),e=u.getUint8(0),o=e===0?u.getUint32(12):u.getUint32(20),t.push(o))})}),t};fg=function(n){var i=l.findBox(n,["moov","trak"]),t=[];return i.forEach(function(n){var i={},f=l.findBox(n,["tkhd"])[0],o,a,v,s,y,p,h,r,c,u,e;f&&(o=new DataView(f.buffer,f.byteOffset,f.byteLength),a=o.getUint8(0),i.id=a===0?o.getUint32(12):o.getUint32(20));v=l.findBox(n,["mdia","hdlr"])[0];v&&(s=l.parseType(v.subarray(8,12)),i.type=s==="vide"?"video":s==="soun"?"audio":s);y=l.findBox(n,["mdia","minf","stbl","stsd"])[0];y&&(p=y.subarray(8),i.codec=l.parseType(p.subarray(4,8)),h=l.findBox(p,[i.codec])[0],h&&(/^[a-z]vc[1-9]$/i.test(i.codec)?(r=h.subarray(78),c=l.parseType(r.subarray(4,8)),c==="avcC"&&r.length>11?(i.codec+=".",i.codec+=fe(r[9]),i.codec+=fe(r[10]),i.codec+=fe(r[11])):i.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(i.codec)&&(r=h.subarray(28),c=l.parseType(r.subarray(4,8)),c==="esds"&&r.length>20&&r[19]!==0?(i.codec+="."+fe(r[19]),i.codec+="."+fe(r[20]>>>2&63).replace(/^0/,"")):i.codec="mp4a.40.2")));u=l.findBox(n,["mdia","mdhd"])[0];u&&f&&(e=a===0?12:20,i.timescale=ku(u[e]<<24|u[e+1]<<16|u[e+2]<<8|u[e+3]));t.push(i)}),t};var vi={findBox:l.findBox,parseType:l.parseType,timescale:tg,startTime:ig,compositionStartTime:rg,videoTrackIds:ug,tracks:fg},eg=4,ist=128,rst=function(n){for(var t=0,r={payloadType:-1,payloadSize:0},u=0,i=0;t<n.byteLength;){if(n[t]===ist)break;while(n[t]===255)u+=255,t++;for(u+=n[t++];n[t]===255;)i+=255,t++;if(i+=n[t++],!r.payload&&u===eg){r.payloadType=u;r.payloadSize=i;r.payload=n.subarray(t,t+i);break}t+=i;u=0;i=0}return r},ust=function(n){return n.payload[0]!==181?null:(n.payload[1]<<8|n.payload[2])!=49?null:String.fromCharCode(n.payload[3],n.payload[4],n.payload[5],n.payload[6])!=="GA94"?null:n.payload[7]!==3?null:n.payload.subarray(8,n.payload.length-1)},fst=function(n,t){var u=[],r,e,i,f;if(!(t[0]&64))return u;for(e=t[0]&31,r=0;r<e;r++)i=r*3,f={type:t[i+2]&3,pts:n},t[i+2]&4&&(f.ccData=t[i+3]<<8|t[i+4],u.push(f));return u},est=function(n){for(var e=n.byteLength,i=[],t=1,u,f,r;t<e-2;)n[t]===0&&n[t+1]===0&&n[t+2]===3?(i.push(t+2),t+=2):t++;if(i.length===0)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},ee={parseSei:rst,parseUserData:ust,parseCaptionPackets:fst,discardEmulationPreventionBytes:est,USER_DATA_REGISTERED_ITU_T_T35:eg},yr=function(){this.init=function(){var n={};this.on=function(t,i){n[t]||(n[t]=[]);n[t]=n[t].concat(i)};this.off=function(t,i){var r;return n[t]?(r=n[t].indexOf(i),n[t]=n[t].slice(),n[t].splice(r,1),r>-1):!1};this.trigger=function(t){var r,i,u,f;if(r=n[t],r)if(arguments.length===2)for(u=r.length,i=0;i<u;++i)r[i].call(this,arguments[1]);else{for(f=[],i=arguments.length,i=1;i<arguments.length;++i)f.push(arguments[i]);for(u=r.length,i=0;i<u;++i)r[i].apply(this,f)}};this.dispose=function(){n={}}}};yr.prototype.pipe=function(n){this.on("data",function(t){n.push(t)});this.on("done",function(t){n.flush(t)});this.on("partialdone",function(t){n.partialFlush(t)});this.on("endedtimeline",function(t){n.endTimeline(t)});this.on("reset",function(t){n.reset(t)});return n};yr.prototype.push=function(n){this.trigger("data",n)};yr.prototype.flush=function(n){this.trigger("done",n)};yr.prototype.partialFlush=function(n){this.trigger("partialdone",n)};yr.prototype.endTimeline=function(n){this.trigger("endedtimeline",n)};yr.prototype.reset=function(n){this.trigger("reset",n)};bs=yr;at=function at(){at.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new p(0,0),new p(0,1),new p(1,0),new p(1,1)];this.reset();this.ccStreams_.forEach(function(n){n.on("data",this.trigger.bind(this,"data"));n.on("partialdone",this.trigger.bind(this,"partialdone"));n.on("done",this.trigger.bind(this,"done"))},this)};at.prototype=new bs;at.prototype.push=function(n){var t,i,r;if(n.nalUnitType==="sei_rbsp"&&(t=ee.parseSei(n.escapedRBSP),t.payloadType===ee.USER_DATA_REGISTERED_ITU_T_T35)&&(i=ee.parseUserData(t),i)){if(n.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}if(n.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--;this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}r=ee.parseCaptionPackets(n.pts,i);this.captionPackets_=this.captionPackets_.concat(r);this.latestDts_!==n.dts&&(this.numSameDts_=0);this.numSameDts_++;this.latestDts_=n.dts}};at.prototype.flushCCStreams=function(n){this.ccStreams_.forEach(function(t){return n==="flush"?t.flush():t.partialFlush()},this)};at.prototype.flushStream=function(n){if(!this.captionPackets_.length){this.flushCCStreams(n);return}this.captionPackets_.forEach(function(n,t){n.presortIndex=t});this.captionPackets_.sort(function(n,t){return n.pts===t.pts?n.presortIndex-t.presortIndex:n.pts-t.pts});this.captionPackets_.forEach(function(n){n.type<2&&this.dispatchCea608Packet(n)},this);this.captionPackets_.length=0;this.flushCCStreams(n)};at.prototype.flush=function(){return this.flushStream("flush")};at.prototype.partialFlush=function(){return this.flushStream("partialFlush")};at.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(n){n.reset()})};at.prototype.dispatchCea608Packet=function(n){(this.setsTextOrXDSActive(n)?this.activeCea608Channel_[n.type]=null:this.setsChannel1Active(n)?this.activeCea608Channel_[n.type]=0:this.setsChannel2Active(n)&&(this.activeCea608Channel_[n.type]=1),this.activeCea608Channel_[n.type]!==null)&&this.ccStreams_[(n.type<<1)+this.activeCea608Channel_[n.type]].push(n)};at.prototype.setsChannel1Active=function(n){return(n.ccData&30720)==4096};at.prototype.setsChannel2Active=function(n){return(n.ccData&30720)==6144};at.prototype.setsTextOrXDSActive=function(n){return(n.ccData&28928)==256||(n.ccData&30974)==4138||(n.ccData&30974)==6186};var ost={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},ks=function(n){return n===null?"":(n=ost[n]||n,String.fromCharCode(n))},ds=14,sst=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],pr=function(){for(var n=[],t=ds+1;t--;)n.push("");return n},p=function p(n,t){p.prototype.init.call(this);this.field_=n||0;this.dataChannel_=t||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(n){var t,e,r,i,u,f;if(t=n.ccData&32639,t===this.lastControlCode_){this.lastControlCode_=null;return}((t&61440)==4096?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,i=t&255,t!==this.PADDING_)&&(t===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":t===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(n.pts),this.flushDisplayed(n.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=n.pts):t===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(n.pts)):t===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(n.pts)):t===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(n.pts)):t===this.CARRIAGE_RETURN_?(this.clearFormatting(n.pts),this.flushDisplayed(n.pts),this.shiftRowsUp_(),this.startPts_=n.pts):t===this.BACKSPACE_?this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):t===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(n.pts),this.displayed_=pr()):t===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=pr():t===this.RESUME_DIRECT_CAPTIONING_?(this.mode_!=="paintOn"&&(this.flushDisplayed(n.pts),this.displayed_=pr()),this.mode_="paintOn",this.startPts_=n.pts):this.isSpecialCharacter(r,i)?(r=(r&3)<<8,u=ks(r|i),this[this.mode_](n.pts,u),this.column_++):this.isExtCharacter(r,i)?(this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=(r&3)<<8,u=ks(r|i),this[this.mode_](n.pts,u),this.column_++):this.isMidRowCode(r,i)?(this.clearFormatting(n.pts),this[this.mode_](n.pts," "),this.column_++,(i&14)==14&&this.addFormatting(n.pts,["i"]),(i&1)==1&&this.addFormatting(n.pts,["u"])):this.isOffsetControlCode(r,i)?this.column_+=i&3:this.isPAC(r,i)?(f=sst.indexOf(t&7968),this.mode_==="rollUp"&&(f-this.rollUpRows_+1<0&&(f=this.rollUpRows_-1),this.setRollUp(n.pts,f)),f!==this.row_&&(this.clearFormatting(n.pts),this.row_=f),i&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(n.pts,["u"]),(t&16)==16&&(this.column_=((t&14)>>1)*4),this.isColorPAC(i)&&(i&14)==14&&this.addFormatting(n.pts,["i"])):this.isNormalChar(r)&&(i===0&&(i=null),u=ks(r),u+=ks(i),this[this.mode_](n.pts,u),this.column_+=u.length))}};p.prototype=new bs;p.prototype.flushDisplayed=function(n){var t=this.displayed_.map(function(n){try{return n.trim()}catch(t){return console.error("Skipping malformed caption."),""}}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:t,stream:this.name_})};p.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=pr();this.nonDisplayed_=pr();this.lastControlCode_=null;this.column_=0;this.row_=ds;this.rollUpRows_=2;this.formatting_=[]};p.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31);this.PADDING_=0;this.RESUME_CAPTION_LOADING_=this.CONTROL_|32;this.END_OF_CAPTION_=this.CONTROL_|47;this.ROLL_UP_2_ROWS_=this.CONTROL_|37;this.ROLL_UP_3_ROWS_=this.CONTROL_|38;this.ROLL_UP_4_ROWS_=this.CONTROL_|39;this.CARRIAGE_RETURN_=this.CONTROL_|45;this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41;this.BACKSPACE_=this.CONTROL_|33;this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44;this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46};p.prototype.isSpecialCharacter=function(n,t){return n===this.EXT_&&t>=48&&t<=63};p.prototype.isExtCharacter=function(n,t){return(n===this.EXT_+1||n===this.EXT_+2)&&t>=32&&t<=63};p.prototype.isMidRowCode=function(n,t){return n===this.EXT_&&t>=32&&t<=47};p.prototype.isOffsetControlCode=function(n,t){return n===this.OFFSET_&&t>=33&&t<=35};p.prototype.isPAC=function(n,t){return n>=this.BASE_&&n<this.BASE_+8&&t>=64&&t<=127};p.prototype.isColorPAC=function(n){return n>=64&&n<=79||n>=96&&n<=127};p.prototype.isNormalChar=function(n){return n>=32&&n<=127};p.prototype.setRollUp=function(n,t){if(this.mode_!=="rollUp"&&(this.row_=ds,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=pr(),this.displayed_=pr()),t!==undefined&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";t===undefined&&(t=this.row_);this.topRow_=t-this.rollUpRows_+1};p.prototype.addFormatting=function(n,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(n,t){return n+"<"+t+">"},"");this[this.mode_](n,i)};p.prototype.clearFormatting=function(n){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(n,t){return n+"<\/"+t+">"},"");this.formatting_=[];this[this.mode_](n,t)}};p.prototype.popOn=function(n,t){var i=this.nonDisplayed_[this.row_];i+=t;this.nonDisplayed_[this.row_]=i};p.prototype.rollUp=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};p.prototype.shiftRowsUp_=function(){for(var n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<ds+1;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};p.prototype.paintOn=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};var hst={CaptionStream:at,Cea608Stream:p},cst=ee.discardEmulationPreventionBytes,lst=hst.CaptionStream,ast=function(n,t){for(var i,u=n,r=0;r<t.length;r++){if(i=t[r],u<i.size)return i;u-=i.size}return null},vst=function(n,t,i){for(var c=new DataView(n.buffer,n.byteOffset,n.byteLength),h=[],u,f,o,s,e,r=0;r+4<n.length;r+=f)if(f=c.getUint32(r),r+=4,!(f<=0))switch(n[r]&31){case 6:s=n.subarray(r+1,r+1+f);e=ast(r,t);u={nalUnitType:"sei_rbsp",size:f,data:s,escapedRBSP:cst(s),trackId:i};e?(u.pts=e.pts,u.dts=e.dts,o=e):(u.pts=o.pts,u.dts=o.dts);h.push(u)}return h},yst=function(n,t,i){var r=t,f=i.defaultSampleDuration||0,e=i.defaultSampleSize||0,o=i.trackId,u=[];return n.forEach(function(n){var i=l.parseTrun(n),t=i.samples;t.forEach(function(n){n.duration===undefined&&(n.duration=f);n.size===undefined&&(n.size=e);n.trackId=o;n.dts=r;n.compositionTimeOffset===undefined&&(n.compositionTimeOffset=0);n.pts=r+n.compositionTimeOffset;r+=n.duration});u=u.concat(t)}),u},pst=function(n,t){var u=vi.findBox(n,["moof","traf"]),f=vi.findBox(n,["mdat"]),i={},r=[];return f.forEach(function(n,t){var i=u[t];r.push({mdat:n,traf:i})}),r.forEach(function(n){var c=n.mdat,u=n.traf,a=vi.findBox(u,["tfhd"]),f=l.parseTfhd(a[0]),r=f.trackId,e=vi.findBox(u,["tfdt"]),v=e.length>0?l.parseTfdt(e[0]).baseMediaDecodeTime:0,o=vi.findBox(u,["trun"]),s,h;t===r&&o.length>0&&(s=yst(o,v,f),h=vst(c,s,r),i[r]||(i[r]=[]),i[r]=i[r].concat(h))}),i},wst=function(n,t,i){var r;return t===null?null:(r=pst(n,t),{seiNals:r[t],timescale:i})},bst=function(){var f=!1,r,u,n,t,i,e;this.isInitialized=function(){return f};this.init=function(n){r=new lst;f=!0;e=n?n.isPartial:!1;r.on("data",function(n){n.startTime=n.startPts/t;n.endTime=n.endPts/t;i.captions.push(n);i.captionStreams[n.stream]=!0})};this.isNewInit=function(i,r){return i&&i.length===0||r&&typeof r=="object"&&Object.keys(r).length===0?!1:n!==i[0]||t!==r[n]};this.parse=function(r,f,e){var o,s;if(this.isInitialized())if(f&&e){if(this.isNewInit(f,e))n=f[0],t=e[n];else if(n===null||!t)return u.push(r),null}else return null;else return null;while(u.length>0)s=u.shift(),this.parse(s,f,e);return(o=wst(r,n,t),o===null||!o.seiNals)?null:(this.pushNals(o.seiNals),this.flushStream(),i)};this.pushNals=function(n){if(!this.isInitialized()||!n||n.length===0)return null;n.forEach(function(n){r.push(n)})};this.flushStream=function(){if(!this.isInitialized())return null;e?r.partialFlush():r.flush()};this.clearParsedCaptions=function(){i.captions=[];i.captionStreams={}};this.resetCaptionStream=function(){if(!this.isInitialized())return null;r.reset()};this.clearAllCaptions=function(){this.clearParsedCaptions();this.resetCaptionStream()};this.reset=function(){u=[];n=null;t=null;i?this.clearParsedCaptions():i={captions:[],captionStreams:{}};this.resetCaptionStream()};this.reset()},kst=bst,oe={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},dst=8589934592,gst=4294967296,og="shared",tv=function(n,t){var i=1;for(n>t&&(i=-1);Math.abs(t-n)>gst;)n+=i*dst;return n},iv=function iv(n){var i,t;iv.prototype.init.call(this);this.type_=n||og;this.push=function(n){(this.type_===og||n.type===this.type_)&&(t===undefined&&(t=n.dts),n.dts=tv(n.dts,t),n.pts=tv(n.pts,t),i=n.dts,this.trigger("data",n))};this.flush=function(){t=i;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){t=void 0;i=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};iv.prototype=new bs;var nht={TimestampRolloverStream:iv,handleRollover:tv},sg=function(n){var t=n[1]&31;return t<<=8,t|n[2]},gs=function(n){return!!(n[1]&64)},nh=function(n){var t=0;return(n[3]&48)>>>4>1&&(t+=n[4]+1),t},tht=function(n,t){var i=sg(n);return i===0?"pat":i===t?"pmt":t?"pes":null},iht=function(n){var i=gs(n),t=4+nh(n);return i&&(t+=n[t]+1),(n[t+10]&31)<<8|n[t+11]},rht=function(n){var u={},s=gs(n),t=4+nh(n),f,e,o,r,i;if(s&&(t+=n[t]+1),n[t+5]&1){for(f=(n[t+1]&15)<<8|n[t+2],e=3+f-4,o=(n[t+10]&15)<<8|n[t+11],r=12+o;r<e;)i=t+r,u[(n[i+1]&31)<<8|n[i+2]]=n[i],r+=((n[i+3]&15)<<8|n[i+4])+5;return u}},uht=function(n,t){var i=sg(n),r=t[i];switch(r){case oe.H264_STREAM_TYPE:return"video";case oe.ADTS_STREAM_TYPE:return"audio";case oe.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},fht=function(n){var u=gs(n),t,i,r;return u?(t=4+nh(n),t>=n.byteLength)?null:(i=null,r=n[t+7],r&192&&(i={},i.pts=(n[t+9]&14)<<27|(n[t+10]&255)<<20|(n[t+11]&254)<<12|(n[t+12]&255)<<5|(n[t+13]&254)>>>3,i.pts*=4,i.pts+=(n[t+13]&6)>>>1,i.dts=i.pts,r&64&&(i.dts=(n[t+14]&14)<<27|(n[t+15]&255)<<20|(n[t+16]&254)<<12|(n[t+17]&255)<<5|(n[t+18]&254)>>>3,i.dts*=4,i.dts+=(n[t+18]&6)>>>1)),i):null},rv=function(n){switch(n){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}},eht=function(n){for(var e=4+nh(n),i=n.subarray(e),t=0,r=0,f=!1,u;r<i.byteLength-3;r++)if(i[r+2]===1){t=r+5;break}while(t<i.byteLength)switch(i[t]){case 0:if(i[t-1]!==0){t+=2;break}else if(i[t-2]!==0){t++;break}r+3!==t-2&&(u=rv(i[r+3]&31),u==="slice_layer_without_partitioning_rbsp_idr"&&(f=!0));do t++;while(i[t]!==1&&t<i.length);r=t-2;t+=3;break;case 1:if(i[t-1]!==0||i[t-2]!==0){t+=3;break}u=rv(i[r+3]&31);u==="slice_layer_without_partitioning_rbsp_idr"&&(f=!0);r=t-2;t+=3;break;default:t+=3}return i=i.subarray(r),t-=r,r=0,i&&i.byteLength>3&&(u=rv(i[r+3]&31),u==="slice_layer_without_partitioning_rbsp_idr"&&(f=!0)),f},oht={parseType:tht,parsePat:iht,parsePmt:rht,parsePayloadUnitStartIndicator:gs,parsePesType:uht,parsePesTime:fht,videoPacketContainsKeyFrame:eht},sht=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],hht=function(n){return n[0]==="I".charCodeAt(0)&&n[1]==="D".charCodeAt(0)&&n[2]==="3".charCodeAt(0)?!0:!1},hg=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},cht=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},lht=function(n,t,i){return unescape(cht(n,t,i))},aht=function(n,t){var i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9],r=n[t+5],u=(r&16)>>4;return u?i+20:i+10},vht=function(n,t){var i=(n[t+5]&224)>>5,r=n[t+4]<<3,u=n[t+3]&6144;return u|r|i},yht=function(n,t){return n[t]==="I".charCodeAt(0)&&n[t+1]==="D".charCodeAt(0)&&n[t+2]==="3".charCodeAt(0)?"timed-metadata":n[t]&!0&&(n[t+1]&240)==240?"audio":null},pht=function(n){for(var t=0;t+5<n.length;){if(n[t]!==255||(n[t+1]&246)!=240){t++;continue}return sht[(n[t+2]&60)>>>2]}return null},wht=function(n){var t,f,u,o,r,s,i,e;t=10;n[5]&64&&(t+=4,t+=hg(n.subarray(10,14)));do{if(f=hg(n.subarray(t+4,t+8)),f<1)return null;if(o=String.fromCharCode(n[t],n[t+1],n[t+2],n[t+3]),o==="PRIV")for(u=n.subarray(t+10,t+f+10),r=0;r<u.byteLength;r++)if(u[r]===0){if(s=lht(u,0,r),s==="com.apple.streaming.transportStreamTimestamp")return i=u.subarray(r+1),e=(i[3]&1)<<30|i[4]<<22|i[5]<<14|i[6]<<6|i[7]>>>2,e*=4,e+(i[7]&3);break}t+=10;t+=f}while(t<n.byteLength);return null},bht={isLikelyAacData:hht,parseId3TagSize:aht,parseAdtsSize:vht,parseType:yht,parseSampleRate:pht,parseAacTimestamp:wht},uv=9e4,fv,ev,th,ov,cg,lg,ag;fv=function(n){return n*uv};ev=function(n,t){return n*t};th=function(n){return n/uv};ov=function(n,t){return n/t};cg=function(n,t){return fv(ov(n,t))};lg=function(n,t){return ev(th(n),t)};ag=function(n,t,i){return th(i?n:n-t)};var kht={ONE_SECOND_IN_TS:uv,secondsToVideoTs:fv,secondsToAudioTs:ev,videoTsToSeconds:th,audioTsToSeconds:ov,audioTsToVideoTs:cg,videoTsToAudioTs:lg,metadataTsToSeconds:ag},du=nht.handleRollover,c={};c.ts=oht;c.aac=bht;var wr=kht.ONE_SECOND_IN_TS,st=188,ei=71,dht=function(n,t){for(var r=0,i=st,u,f;i<n.byteLength;){if(n[r]===ei&&n[i]===ei){u=n.subarray(r,i);f=c.ts.parseType(u,t.pid);switch(f){case"pat":t.pid||(t.pid=c.ts.parsePat(u));break;case"pmt":t.table||(t.table=c.ts.parsePmt(u))}if(t.pid&&t.table)return;r+=st;i+=st;continue}r++;i++}},vg=function(n,t,i){for(var u=0,r=st,f,s,h,l,e,o=!1;r<=n.byteLength;){if(n[u]===ei&&(n[r]===ei||r===n.byteLength)){f=n.subarray(u,r);s=c.ts.parseType(f,t.pid);switch(s){case"pes":h=c.ts.parsePesType(f,t.table);l=c.ts.parsePayloadUnitStartIndicator(f);h==="audio"&&l&&(e=c.ts.parsePesTime(f),e&&(e.type="audio",i.audio.push(e),o=!0))}if(o)break;u+=st;r+=st;continue}u++;r++}for(r=n.byteLength,u=r-st,o=!1;u>=0;){if(n[u]===ei&&(n[r]===ei||r===n.byteLength)){f=n.subarray(u,r);s=c.ts.parseType(f,t.pid);switch(s){case"pes":h=c.ts.parsePesType(f,t.table);l=c.ts.parsePayloadUnitStartIndicator(f);h==="audio"&&l&&(e=c.ts.parsePesTime(f),e&&(e.type="audio",i.audio.push(e),o=!0))}if(o)break;u-=st;r-=st;continue}u--;r--}},ght=function(n,t,i){for(var f=0,u=st,r,l,a,h,e,v,y,p,s=!1,o={data:[],size:0},w;u<n.byteLength;){if(n[f]===ei&&n[u]===ei){r=n.subarray(f,u);l=c.ts.parseType(r,t.pid);switch(l){case"pes":if(a=c.ts.parsePesType(r,t.table),h=c.ts.parsePayloadUnitStartIndicator(r),a==="video"&&(h&&!s&&(e=c.ts.parsePesTime(r),e&&(e.type="video",i.video.push(e),s=!0)),!i.firstKeyFrame)){if(h&&o.size!==0){for(v=new Uint8Array(o.size),y=0;o.data.length;)p=o.data.shift(),v.set(p,y),y+=p.byteLength;c.ts.videoPacketContainsKeyFrame(v)&&(w=c.ts.parsePesTime(v),w?(i.firstKeyFrame=w,i.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself."));o.size=0}o.data.push(r);o.size+=r.byteLength}}if(s&&i.firstKeyFrame)break;f+=st;u+=st;continue}f++;u++}for(u=n.byteLength,f=u-st,s=!1;f>=0;){if(n[f]===ei&&n[u]===ei){r=n.subarray(f,u);l=c.ts.parseType(r,t.pid);switch(l){case"pes":a=c.ts.parsePesType(r,t.table);h=c.ts.parsePayloadUnitStartIndicator(r);a==="video"&&h&&(e=c.ts.parsePesTime(r),e&&(e.type="video",i.video.push(e),s=!0))}if(s)break;f-=st;u-=st;continue}f--;u--}},nct=function(n,t){var u,r,i;n.audio&&n.audio.length&&(u=t,typeof u=="undefined"&&(u=n.audio[0].dts),n.audio.forEach(function(n){n.dts=du(n.dts,u);n.pts=du(n.pts,u);n.dtsTime=n.dts/wr;n.ptsTime=n.pts/wr}));n.video&&n.video.length&&(r=t,typeof r=="undefined"&&(r=n.video[0].dts),n.video.forEach(function(n){n.dts=du(n.dts,r);n.pts=du(n.pts,r);n.dtsTime=n.dts/wr;n.ptsTime=n.pts/wr}),n.firstKeyFrame&&(i=n.firstKeyFrame,i.dts=du(i.dts,r),i.pts=du(i.pts,r),i.dtsTime=i.dts/wr,i.ptsTime=i.dts/wr))},tct=function(n){for(var u=!1,o=0,f=null,r=null,i=0,t=0,e,h,s,l;n.length-t>=3;){h=c.aac.parseType(n,t);switch(h){case"timed-metadata":if(n.length-t<10){u=!0;break}if(i=c.aac.parseId3TagSize(n,t),i>n.length){u=!0;break}r===null&&(e=n.subarray(t,t+i),r=c.aac.parseAacTimestamp(e));t+=i;break;case"audio":if(n.length-t<7){u=!0;break}if(i=c.aac.parseAdtsSize(n,t),i>n.length){u=!0;break}f===null&&(e=n.subarray(t,t+i),f=c.aac.parseSampleRate(e));o++;t+=i;break;default:t++}if(u)return null}return f===null||r===null?null:(s=wr/f,l={audio:[{type:"audio",dts:r,pts:r},{type:"audio",dts:r+o*1024*s,pts:r+o*1024*s}]},l)},ict=function(n){var i={pid:null,table:null},t={},r,u;dht(n,i);for(r in i.table)if(i.table.hasOwnProperty(r)){u=i.table[r];switch(u){case oe.H264_STREAM_TYPE:t.video=[];ght(n,i,t);t.video.length===0&&delete t.video;break;case oe.ADTS_STREAM_TYPE:t.audio=[];vg(n,i,t);t.audio.length===0&&delete t.audio}}return t},rct=function(n,t){var r=c.aac.isLikelyAacData(n),i;return(i=r?tct(n):ict(n),!i||!i.audio&&!i.video)?null:(nct(i,t),i)},uct={inspect:rct,parseAudioPes_:vg};var ih=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},ect=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),oct=function(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},sct=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n},hct=function(){for(var h=[[[],[],[],[],[]],[[],[],[],[],[]]],f=h[0],e=h[1],l=f[4],p=e[4],n=void 0,i=void 0,r=void 0,u=[],a=[],c=void 0,v=void 0,y=void 0,t=void 0,o=void 0,s=void 0,n=0;n<256;n++)a[(u[n]=n<<1^(n>>7)*283)^n]=n;for(i=r=0;!l[i];i^=c||1,r=a[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^t&255^99,l[i]=t,p[t]=i,y=u[v=u[c=u[i]]],s=y*16843009^v*65537^c*257^i*16843008,o=u[t]*257^t*16843008,n=0;n<4;n++)f[n][i]=o=o<<24^o>>>8,e[n][t]=s=s<<24^s>>>8;for(n=0;n<5;n++)f[n]=f[n].slice(0),e[n]=e[n].slice(0);return h},ni=null,cct=function(){function n(t){ih(this,n);ni||(ni=hct());this._tables=[[ni[0][0].slice(),ni[0][1].slice(),ni[0][2].slice(),ni[0][3].slice(),ni[0][4].slice()],[ni[1][0].slice(),ni[1][1].slice(),ni[1][2].slice(),ni[1][3].slice(),ni[1][4].slice()]];var r=void 0,o=void 0,i=void 0,e=void 0,c=void 0,f=this._tables[0][4],s=this._tables[1],u=t.length,h=1;if(u!==4&&u!==6&&u!==8)throw new Error("Invalid aes key size");for(e=t.slice(0),c=[],this._key=[e,c],r=u;r<4*u+28;r++)i=e[r-1],(r%u==0||u===8&&r%u==4)&&(i=f[i>>>24]<<24^f[i>>16&255]<<16^f[i>>8&255]<<8^f[i&255],r%u==0&&(i=i<<8^i>>>24^h<<24,h=h<<1^(h>>7)*283)),e[r]=e[r-u]^i;for(o=0;r;o++,r--)i=e[o&3?r:r-4],c[o]=r<=4||o<4?i:s[0][f[i>>>24]]^s[1][f[i>>16&255]]^s[2][f[i>>8&255]]^s[3][f[i&255]]}return n.prototype.decrypt=function(n,t,i,r,u,f){for(var e=this._key[1],o=n^e[0],s=r^e[1],h=i^e[2],c=t^e[3],y=void 0,g=void 0,nt=void 0,tt=e.length/4-2,l=void 0,a=4,v=this._tables[1],p=v[0],w=v[1],b=v[2],k=v[3],d=v[4],l=0;l<tt;l++)y=p[o>>>24]^w[s>>16&255]^b[h>>8&255]^k[c&255]^e[a],g=p[s>>>24]^w[h>>16&255]^b[c>>8&255]^k[o&255]^e[a+1],nt=p[h>>>24]^w[c>>16&255]^b[o>>8&255]^k[s&255]^e[a+2],c=p[c>>>24]^w[o>>16&255]^b[s>>8&255]^k[h&255]^e[a+3],a+=4,o=y,s=g,h=nt;for(l=0;l<4;l++)u[(3&-l)+f]=d[o>>>24]<<24^d[s>>16&255]<<16^d[h>>8&255]<<8^d[c&255]^e[a++],y=o,o=s,s=h,h=c,c=y},n}(),yg=function(){function n(){ih(this,n);this.listeners={}}return n.prototype.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.prototype.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),i>-1},n.prototype.trigger=function(n){var t=this.listeners[n],u,i,f,e,r;if(t)if(arguments.length===2)for(u=t.length,i=0;i<u;++i)t[i].call(this,arguments[1]);else for(f=Array.prototype.slice.call(arguments,1),e=t.length,r=0;r<e;++r)t[r].apply(this,f)},n.prototype.dispose=function(){this.listeners={}},n.prototype.pipe=function(n){this.on("data",function(t){n.push(t)})},n}(),pg=function(n){function t(){ih(this,t);var i=sct(this,n.call(this,yg));return i.jobs=[],i.delay=1,i.timeout_=null,i}return oct(t,n),t.prototype.processJob_=function(){this.jobs.shift()();this.timeout_=this.jobs.length?setTimeout(this.processJob_.bind(this),this.delay):null},t.prototype.push=function(n){this.jobs.push(n);this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(yg),ti=function(n){return n<<24|(n&65280)<<8|(n&16711680)>>8|n>>>24},wg=function(n,t,i){var f=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>2),p=new cct(Array.prototype.slice.call(t)),y=new Uint8Array(n.byteLength),u=new Int32Array(y.buffer),e=void 0,o=void 0,s=void 0,h=void 0,c=void 0,l=void 0,a=void 0,v=void 0,r=void 0;for(e=i[0],o=i[1],s=i[2],h=i[3],r=0;r<f.length;r+=4)c=ti(f[r]),l=ti(f[r+1]),a=ti(f[r+2]),v=ti(f[r+3]),p.decrypt(c,l,a,v,u,r),u[r]=ti(u[r]^e),u[r+1]=ti(u[r+1]^o),u[r+2]=ti(u[r+2]^s),u[r+3]=ti(u[r+3]^h),e=c,o=l,s=a,h=v;return y},lct=function(){function n(t,i,r,u){ih(this,n);var o=n.STEP,e=new Int32Array(t.buffer),s=new Uint8Array(t.byteLength),f=0;for(this.asyncStream_=new pg,this.asyncStream_.push(this.decryptChunk_(e.subarray(f,f+o),i,r,s)),f=o;f<e.length;f+=o)r=new Uint32Array([ti(e[f-4]),ti(e[f-3]),ti(e[f-2]),ti(e[f-1])]),this.asyncStream_.push(this.decryptChunk_(e.subarray(f,f+o),i,r,s));this.asyncStream_.push(function(){u(null,fct(s))})}return n.prototype.decryptChunk_=function(n,t,i,r){return function(){var u=wg(n,t,i);r.set(u,n.byteOffset)}},ect(n,null,[{key:"STEP",get:function(){return 32e3}}]),n}(),br=function(t,i){return/^[a-z]+:/i.test(i)?i:(/\/\//i.test(t)||(t=la.buildAbsoluteURL(n.location.href,t)),la.buildAbsoluteURL(t,i))},rh=function(n,t,i){return n&&i.responseURL&&t!==i.responseURL?i.responseURL:t},ii=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},ui=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),act=function ob(n,t,i){var r,u,f;return n===null&&(n=Function.prototype),r=Object.getOwnPropertyDescriptor(n,t),r===undefined?(u=Object.getPrototypeOf(n),u===null?undefined:ob(u,t,i)):"value"in r?r.value:(f=r.get,f===undefined)?undefined:f.call(i)},yi=function(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},oi=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n},vct=function(){function n(n,t){var r=[],u=!0,f=!1,e=undefined,i,o;try{for(i=n[Symbol.iterator]();!(u=(o=i.next()).done);u=!0)if(r.push(o.value),t&&r.length===t)break}catch(s){f=!0;e=s}finally{try{!u&&i["return"]&&i["return"]()}finally{if(f)throw e;}}return r}return function(t,i){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return n(t,i);throw new TypeError("Invalid attempt to destructure non-iterable instance");}}(),sv=i.mergeOptions,yct=i.EventTarget,pct=i.log,uh=function(n,t){["AUDIO","SUBTITLES"].forEach(function(i){var r,u,f;for(r in n.mediaGroups[i])for(u in n.mediaGroups[i][r])f=n.mediaGroups[i][r][u],t(f,i,r,u)})},wct=function(n,t,i){var u=t.slice(),f,r;for(i=i||0,f=Math.min(n.length,t.length+i),r=i;r<f;r++)u[r-i]=sv(n[r],u[r-i]);return u},bct=function(n,t){n.resolvedUri||(n.resolvedUri=br(t,n.uri));n.key&&!n.key.resolvedUri&&(n.key.resolvedUri=br(t,n.key.uri));n.map&&!n.map.resolvedUri&&(n.map.resolvedUri=br(t,n.map.uri))},hv=function(n,t){var r=sv(n,{}),i=r.playlists[t.uri],u,f;if(!i||i.segments&&t.segments&&i.segments.length===t.segments.length&&i.endList===t.endList&&i.mediaSequence===t.mediaSequence)return null;for(u=sv(i,t),i.segments&&(u.segments=wct(i.segments,t.segments,t.mediaSequence-i.mediaSequence)),u.segments.forEach(function(n){bct(n,u.resolvedUri)}),f=0;f<r.playlists.length;f++)r.playlists[f].uri===t.uri&&(r.playlists[f]=u);return r.playlists[t.uri]=u,r},bg=function(n){for(var i=n.playlists.length,t;i--;)t=n.playlists[i],n.playlists[t.uri]=t,t.resolvedUri=br(n.uri,t.uri),t.id=i,t.attributes||(t.attributes={},pct.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute."))},kg=function(n){uh(n,function(t){t.uri&&(t.resolvedUri=br(n.uri,t.uri))})},dg=function(n,t){var i=n.segments[n.segments.length-1];return t&&i&&i.duration?i.duration*1e3:(n.targetDuration||10)*500},fh=function(t){function i(n,t){var f=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},u;ii(this,i);var r=oi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),e=f.withCredentials,s=e===undefined?!1:e,o=f.handleManifestRedirects,h=o===undefined?!1:o;if(r.srcUrl=n,r.hls_=t,r.withCredentials=s,r.handleManifestRedirects=h,u=t.options_,r.customTagParsers=u&&u.customTagParsers||[],r.customTagMappers=u&&u.customTagMappers||[],!r.srcUrl)throw new Error("A non-empty playlist URL is required");r.state="HAVE_NOTHING";r.on("mediaupdatetimeout",function(){r.state==="HAVE_METADATA"&&(r.state="HAVE_CURRENT_METADATA",r.request=r.hls_.xhr({uri:br(r.master.uri,r.media().uri),withCredentials:r.withCredentials},function(n){if(r.request){if(n)return r.playlistRequestError(r.request,r.media().uri,"HAVE_METADATA");r.haveMetadata(r.request,r.media().uri)}}))});return r}return yi(i,t),ui(i,[{key:"playlistRequestError",value:function(n,t,i){this.request=null;i&&(this.state=i);this.error={playlist:this.master.playlists[t],status:n.status,message:"HLS playlist request error at URL: "+t+".",responseText:n.responseText,code:n.status>=500?4:2};this.trigger("error")}},{key:"haveMetadata",value:function(t,i){var f=this,r,u;this.request=null;this.state="HAVE_METADATA";r=new sd;this.customTagParsers.forEach(function(n){return r.addParser(n)});this.customTagMappers.forEach(function(n){return r.addTagMapper(n)});r.push(t.responseText);r.end();r.manifest.uri=i;r.manifest.attributes=r.manifest.attributes||{};u=hv(this.master,r.manifest);this.targetDuration=r.manifest.targetDuration;u?(this.master=u,this.media_=this.master.playlists[r.manifest.uri]):this.trigger("playlistunchanged");this.media().endList||(n.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=n.setTimeout(function(){f.trigger("mediaupdatetimeout")},dg(this.media(),!!u)));this.trigger("loadedplaylist")}},{key:"dispose",value:function(){this.stopRequest();n.clearTimeout(this.mediaUpdateTimeout);n.clearTimeout(this.finalRenditionTimeout)}},{key:"stopRequest",value:function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}}},{key:"media",value:function(t,i){var r=this,e,u,f;if(!t)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof t=="string"){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(n.clearTimeout(this.finalRenditionTimeout),i){e=t.targetDuration*500||5e3;this.finalRenditionTimeout=n.setTimeout(this.media.bind(this,t,!1),e);return}if(u=this.state,f=!this.media_||t.uri!==this.media_.uri,this.master.playlists[t.uri].endList){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null);this.state="HAVE_METADATA";this.media_=t;f&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}if(f){if(this.state="SWITCHING_MEDIA",this.request){if(t.resolvedUri===this.request.url)return;this.request.onreadystatechange=null;this.request.abort();this.request=null}this.media_&&this.trigger("mediachanging");this.request=this.hls_.xhr({uri:t.resolvedUri,withCredentials:this.withCredentials},function(n,i){if(r.request){if(t.resolvedUri=rh(r.handleManifestRedirects,t.resolvedUri,i),n)return r.playlistRequestError(r.request,t.uri,u);r.haveMetadata(i,t.uri);u==="HAVE_MASTER"?r.trigger("loadedmetadata"):r.trigger("mediachange")}})}}},{key:"pause",value:function(){this.stopRequest();n.clearTimeout(this.mediaUpdateTimeout);this.state==="HAVE_NOTHING"&&(this.started=!1);this.state==="SWITCHING_MEDIA"?this.state=this.media_?"HAVE_METADATA":"HAVE_MASTER":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}},{key:"load",value:function(t){var u=this,i,r;if(n.clearTimeout(this.mediaUpdateTimeout),i=this.media(),t){r=i?i.targetDuration*500:5e3;this.mediaUpdateTimeout=n.setTimeout(function(){return u.load()},r);return}if(!this.started){this.start();return}i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}},{key:"start",value:function(){var t=this;this.started=!0;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){if(t.request){if(t.request=null,i)return t.error={status:r.status,message:"HLS playlist request error at URL: "+t.srcUrl+".",responseText:r.responseText,code:2},t.state==="HAVE_NOTHING"&&(t.started=!1),t.trigger("error");var u=new sd;if(t.customTagParsers.forEach(function(n){return u.addParser(n)}),t.customTagMappers.forEach(function(n){return u.addTagMapper(n)}),u.push(r.responseText),u.end(),t.state="HAVE_MASTER",t.srcUrl=rh(t.handleManifestRedirects,t.srcUrl,r),u.manifest.uri=t.srcUrl,u.manifest.playlists){t.master=u.manifest;bg(t.master);kg(t.master);t.trigger("loadedplaylist");t.request||t.media(u.manifest.playlists[0]);return}return t.master={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:n.location.href,playlists:[{uri:t.srcUrl,id:0,resolvedUri:t.srcUrl,attributes:{}}]},t.master.playlists[t.srcUrl]=t.master.playlists[0],t.haveMetadata(r,t.srcUrl),t.trigger("loadedmetadata")}})}}]),i}(yct),gg=i.createTimeRange,kct=function(n,t){var r=0,u=t-n.mediaSequence,i=n.segments[u];if(i){if(typeof i.start!="undefined")return{result:i.start,precise:!0};if(typeof i.end!="undefined")return{result:i.end-i.duration,precise:!0}}while(u--){if(i=n.segments[u],typeof i.end!="undefined")return{result:r+i.end,precise:!0};if(r+=i.duration,typeof i.start!="undefined")return{result:r+i.start,precise:!0}}return{result:r,precise:!1}},dct=function(n,t){for(var r=0,i=void 0,u=t-n.mediaSequence;u<n.segments.length;u++){if(i=n.segments[u],typeof i.start!="undefined")return{result:i.start-r,precise:!0};if(r+=i.duration,typeof i.end!="undefined")return{result:i.end-r,precise:!0}}return{result:-1,precise:!1}},nn=function(n,t,i){var r=void 0,u=void 0;return(typeof t=="undefined"&&(t=n.mediaSequence+n.segments.length),t<n.mediaSequence)?0:(r=kct(n,t),r.precise)?r.result:(u=dct(n,t),u.precise)?u.result:r.result+i},tn=function(t,i,r){if(!t)return 0;if(typeof r!="number"&&(r=0),typeof i=="undefined"){if(t.totalDuration)return t.totalDuration;if(!t.endList)return n.Infinity}return nn(t,i,r)},se=function(n,t,i){var u=0,f,e,r;if(t>i&&(f=[i,t],t=f[0],i=f[1]),t<0){for(e=t;e<Math.min(0,i);e++)u+=n.targetDuration;t=0}for(r=t;r<i;r++)u+=n.segments[r].duration;return u},rn=function(n){if(!n.segments.length)return 0;for(var t=n.segments.length-1,i=n.segments[t].duration||n.targetDuration,r=i+n.targetDuration*2;t--;)if(i+=n.segments[t].duration,i>=r)break;return Math.max(0,t)},un=function(n,t,i){if(!n||!n.segments)return null;if(n.endList)return tn(n);if(t===null)return null;t=t||0;var r=i?rn(n):n.segments.length;return nn(n,n.mediaSequence+r,t)},gct=function(n,t){var r=t||0,i=un(n,t,!0);return i===null?gg():gg(r,i)},fn=function(n){return n-Math.floor(n)==0},en=function(n,t){var r,i,u,f;if(fn(t))return t+n*.1;for(r=t.toString().split(".")[1].length,i=1;i<=r;i++)if(u=Math.pow(10,i),f=t*u,fn(f)||i===r)return(f+n)/u},nlt=en.bind(null,1),tlt=en.bind(null,-1),ilt=function(n,t,i,r){var u=void 0,e=void 0,o=n.segments.length,f=t-r;if(f<0){if(i>0)for(u=i-1;u>=0;u--)if(e=n.segments[u],f+=tlt(e.duration),f>0)return{mediaIndex:u,startTime:r-se(n,i,u)};return{mediaIndex:0,startTime:t}}if(i<0){for(u=i;u<0;u++)if(f-=n.targetDuration,f<0)return{mediaIndex:0,startTime:t};i=0}for(u=i;u<o;u++)if(e=n.segments[u],f-=nlt(e.duration),f<0)return{mediaIndex:u,startTime:r+se(n,i,u)};return{mediaIndex:o-1,startTime:t}},on=function(n){return n.excludeUntil&&n.excludeUntil>Date.now()},cv=function(n){return n.excludeUntil&&n.excludeUntil===Infinity},eh=function(n){var t=on(n);return!n.disabled&&!t},rlt=function(n){return n.disabled},ult=function(n){for(var t=0;t<n.segments.length;t++)if(n.segments[t].key)return!0;return!1},flt=function(n){for(var t=0;t<n.segments.length;t++)if(n.segments[t].map)return!0;return!1},sn=function(n,t){return t.attributes&&t.attributes[n]},elt=function(n,t,i){var u=arguments.length>3&&arguments[3]!==undefined?arguments[3]:0,r;return sn("BANDWIDTH",i)?(r=n*i.attributes.BANDWIDTH,(r-u*8)/t):NaN},lv=function(n,t){if(n.playlists.length===1)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return n.playlists.filter(function(n){return eh(n)?(n.attributes.BANDWIDTH||0)<i:!1}).length===0},vt={duration:tn,seekable:gct,safeLiveIndex:rn,getMediaInfoForTime:ilt,isEnabled:eh,isDisabled:rlt,isBlacklisted:on,isIncompatible:cv,playlistEnd:un,isAes:ult,isFmp4:flt,hasAttribute:sn,estimateSegmentRequestTime:elt,isLowestEnabledRendition:lv},olt=i.xhr,slt=i.mergeOptions,hn=function(){return function n(t,r){var f,e,u,o;return t=slt({timeout:45e3},t),f=n.beforeRequest||i.Hls.xhr.beforeRequest,f&&typeof f=="function"&&(e=f(t),e&&(t=e)),u=olt(t,function(n,t){var i=u.response;!n&&i&&(u.responseTime=Date.now(),u.roundTripTime=u.responseTime-u.requestTime,u.bytesReceived=i.byteLength||i.length,u.bandwidth||(u.bandwidth=Math.floor(u.bytesReceived/u.roundTripTime*8e3)));t.headers&&(u.responseHeaders=t.headers);n&&n.code==="ETIMEDOUT"&&(u.timedout=!0);n||u.aborted||t.statusCode===200||t.statusCode===206||t.statusCode===0||(n=new Error("XHR Failed with a response of: "+(u&&(i||u.responseText))));r(n,u)}),o=u.abort,u.abort=function(){return u.aborted=!0,o.apply(u,arguments)},u.uri=t.uri,u.requestTime=Date.now(),u}},hlt=function(n){var t=void 0,i=void 0;return i=n.offset+n.length-1,t=n.offset,"bytes="+t+"-"+i},av=function(n){var t={};return n.byterange&&(t.Range=hlt(n.byterange)),t},clt=function(n,t){return n.start(t)+"-"+n.end(t)},llt=function(n,t){var i=n.toString(16);return"00".substring(0,2-i.length)+i+(t%2?" ":"")},alt=function(n){return n>=32&&n<126?String.fromCharCode(n):"."},cn=function(n){var t={};return Object.keys(n).forEach(function(i){var r=n[i];t[i]=ArrayBuffer.isView(r)?{bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:r}),t},oh=function(n){var t=n.byterange||{length:Infinity,offset:0};return[t.length,t.offset,n.resolvedUri].join(",")},ln=function(n){return n.resolvedUri},an=function(n){for(var r=Array.prototype.slice.call(n),t=16,u="",f=void 0,e=void 0,i=0;i<r.length/t;i++)f=r.slice(i*t,i*t+t).map(llt).join(""),e=r.slice(i*t,i*t+t).map(alt).join(""),u+=f+" "+e+"\n";return u},vlt=function(n){var t=n.bytes;return an(t)},ylt=function(n){for(var i="",t=void 0,t=0;t<n.length;t++)i+=clt(n,t)+" ";return i},plt=Object.freeze({createTransferableMessage:cn,initSegmentId:oh,segmentKeyId:ln,hexDump:an,tagDump:vlt,textRanges:ylt}),vn=.25,wlt=function(n,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,r=t.videoTimingInfo.transmuxedPresentationStart,u=r+i,f=n-u;return new Date(t.dateTimeObject.getTime()+f*1e3)},blt=function(n){return n.transmuxedPresentationEnd-n.transmuxedPresentationStart-n.transmuxerPrependedSeconds},klt=function(n,t){var u=void 0,i,f,e;try{u=new Date(n)}catch(c){return null}if(!t||!t.segments||t.segments.length===0||(i=t.segments[0],u<i.dateTimeObject))return null;for(f=0;f<t.segments.length-1;f++)if(i=t.segments[f],e=t.segments[f+1].dateTimeObject,u<e)break;var r=t.segments[t.segments.length-1],o=r.dateTimeObject,s=r.videoTimingInfo?blt(r.videoTimingInfo):r.duration+r.duration*vn,h=new Date(o.getTime()+s*1e3);return u>h?null:(u>o&&(i=r),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:vt.duration(t,t.mediaSequence+t.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},dlt=function(n,t){var r,i,f,u;if(!t||!t.segments||t.segments.length===0)return null;for(r=0,i=void 0,f=0;f<t.segments.length;f++)if(i=t.segments[f],r=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:r+i.duration,n<=r)break;if(u=t.segments[t.segments.length-1],u.videoTimingInfo&&u.videoTimingInfo.transmuxedPresentationEnd<n)return null;if(n>r){if(n>r+u.duration*vn)return null;i=u}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:r-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},glt=function(n,t){var i=void 0,r=void 0,u,f;try{i=new Date(n);r=new Date(t)}catch(e){}return u=i.getTime(),f=r.getTime(),(f-u)/1e3},nat=function(n){var t,i;if(!n.segments||n.segments.length===0)return!1;for(t=0;t<n.segments.length;t++)if(i=n.segments[t],!i.dateTimeObject)return!1;return!0},tat=function(n){var e=n.playlist,o=n.time,r=o===undefined?undefined:o,t=n.callback,i,u,f;if(!t)throw new Error("getProgramTime: callback must be provided");return!e||r===undefined?t({message:"getProgramTime: playlist and time must be provided"}):(i=dlt(r,e),!i)?t({message:"valid programTime was not found"}):i.type==="estimate"?t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart}):(u={mediaSeconds:r},f=wlt(r,i.segment),f&&(u.programDateTime=f.toISOString()),t(null,u))},yn=function yn(n){var i=n.programTime,r=n.playlist,h=n.retryCount,c=h===undefined?2:h,e=n.seekTo,l=n.pauseAfterSeek,a=l===undefined?!0:l,u=n.tech,t=n.callback,f,o,s,v,y;if(!t)throw new Error("seekToProgramTime: callback must be provided");if(typeof i=="undefined"||!r||!e)return t({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!r.endList&&!u.hasStarted_)return t({message:"player must be playing a live stream to start buffering"});if(!nat(r))return t({message:"programDateTime tags must be provided in the manifest "+r.resolvedUri});if(f=klt(i,r),!f)return t({message:i+" was not found in the stream"});if(o=f.segment,s=glt(o.dateTimeObject,i),f.type==="estimate"){if(c===0)return t({message:i+" is not buffered yet. Try again"});e(f.estimatedStart+s);u.one("seeked",function(){yn({programTime:i,playlist:r,retryCount:c-1,seekTo:e,pauseAfterSeek:a,tech:u,callback:t})});return}v=o.start+s;y=function(){return t(null,u.currentTime())};u.one("seeked",y);a&&u.pause();e(v)},sh=1/30,pi=sh*3,pn=function(n,t){var u=[],r=void 0;if(n&&n.length)for(r=0;r<n.length;r++)t(n.start(r),n.end(r))&&u.push([n.start(r),n.end(r)]);return i.createTimeRanges(u)},wn=function(n,t){return pn(n,function(n,i){return n-pi<=t&&i+pi>=t})},bn=function(n,t){return pn(n,function(n){return n-sh>=t})},iat=function(n){var r,t,u,f;if(n.length<2)return i.createTimeRanges();for(r=[],t=1;t<n.length;t++)u=n.end(t-1),f=n.start(t),r.push([u,f]);return i.createTimeRanges(r)},vv=function(n){var i=[],t;if(!n||!n.length)return"";for(t=0;t<n.length;t++)i.push(n.start(t)+" => "+n.end(t));return i.join(", ")},rat=function(n,t){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:1,r=n.length?n.end(n.length-1):0;return(r-t)/i},kn=function(n){for(var i=[],t=0;t<n.length;t++)i.push({start:n.start(t),end:n.end(t)});return i},uat=function(n,t,i){var u=t.player_,r,f;if(i.captions&&i.captions.length){n.inbandTextTracks_||(n.inbandTextTracks_={});for(r in i.captionStreams)n.inbandTextTracks_[r]||(u.tech_.trigger({type:"usage",name:"hls-608"}),f=u.textTracks().getTrackById(r),n.inbandTextTracks_[r]=f?f:u.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track)}i.metadata&&i.metadata.length&&!n.metadataTrack_&&(n.metadataTrack_=u.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,n.metadataTrack_.inBandMetadataTrackDispatchType=i.metadata.dispatchType)},gu=function(n,t,i){var u=void 0,r=void 0;if(i&&i.cues)for(u=i.cues.length;u--;)r=i.cues[u],r.startTime<=t&&r.endTime>=n&&i.removeCue(r)},fat=function(n){Object.defineProperties(n.frame,{id:{get:function(){return i.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),n.value.key}},value:{get:function(){return i.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),n.value.data}},privateData:{get:function(){return i.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),n.value.data}}})},dn=function(n){return isNaN(n)||Math.abs(n)===Infinity?Number.MAX_VALUE:n},eat=function(t,i,r){var h=n.WebKitDataCue||n.VTTCue,c,f,e,u,o,s;if(i&&i.forEach(function(n){var t=n.stream;this.inbandTextTracks_[t].addCue(new h(n.startTime+this.timestampOffset,n.endTime+this.timestampOffset,n.text))},t),r&&(c=dn(t.mediaSource_.duration),r.forEach(function(t){var i=t.cueTime+this.timestampOffset;typeof i!="number"||n.isNaN(i)||i<0||!(i<Infinity)||t.frames.forEach(function(n){var t=new h(i,i,n.value||n.url||n.data||"");t.frame=n;t.value=n;fat(t);this.metadataTrack_.addCue(t)},this)},t),t.metadataTrack_&&t.metadataTrack_.cues&&t.metadataTrack_.cues.length)){for(f=t.metadataTrack_.cues,e=[],u=0;u<f.length;u++)f[u]&&e.push(f[u]);o=e.reduce(function(n,t){var i=n[t.startTime]||[];return i.push(t),n[t.startTime]=i,n},{});s=Object.keys(o).sort(function(n,t){return Number(n)-Number(t)});s.forEach(function(n,t){var i=o[n],r=Number(s[t+1])||c;i.forEach(function(n){n.endTime=r})})}},kr=typeof window!="undefined"?window:{},yv=typeof Symbol=="undefined"?"__target":Symbol(),oat="application/javascript",sat=kr.BlobBuilder||kr.WebKitBlobBuilder||kr.MozBlobBuilder||kr.MSBlobBuilder,nf=kr.URL||kr.webkitURL||nf&&nf.msURL,tf=kr.Worker;if(tf){pv=ntt("self.onmessage = function () {}");wv=new Uint8Array(1);try{hh=new tf(pv);hh.postMessage(wv,[wv.buffer])}catch(gkt){tf=null}finally{nf.revokeObjectURL(pv);hh&&hh.terminate()}}var cat=new gn("./transmuxer-worker.worker.js",function(){var n=this,t=function(){var a=function(){this.init=function(){var n={};this.on=function(t,i){n[t]||(n[t]=[]);n[t]=n[t].concat(i)};this.off=function(t,i){var r;return n[t]?(r=n[t].indexOf(i),n[t]=n[t].slice(),n[t].splice(r,1),r>-1):!1};this.trigger=function(t){var r,i,u,f;if(r=n[t],r)if(arguments.length===2)for(u=r.length,i=0;i<u;++i)r[i].call(this,arguments[1]);else{for(f=[],i=arguments.length,i=1;i<arguments.length;++i)f.push(arguments[i]);for(u=r.length,i=0;i<u;++i)r[i].apply(this,f)}};this.dispose=function(){n={}}}},f,bt,i,yi,pi,kt,wi,bi,ki,di,dt,gi,nr,tr,ir,rr,ur,fr,er,or,sr,hr,cr,gt,t,ni,lr,ar,vr,yr,pr,wr,br,kr,tt,dr,gr,nu,hi,at,ci,lu,au,yt,g,vu;a.prototype.pipe=function(n){this.on("data",function(t){n.push(t)});this.on("done",function(t){n.flush(t)});this.on("partialdone",function(t){n.partialFlush(t)});this.on("endedtimeline",function(t){n.endTimeline(t)});this.on("reset",function(t){n.reset(t)});return n};a.prototype.push=function(n){this.trigger("data",n)};a.prototype.flush=function(n){this.trigger("done",n)};a.prototype.partialFlush=function(n){this.trigger("partialdone",n)};a.prototype.endTimeline=function(n){this.trigger("endedtimeline",n)};a.prototype.reset=function(n){this.trigger("reset",n)};f=a;bt=Math.pow(2,32)-1,function(){var n;if(t={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},typeof Uint8Array!="undefined"){for(n in t)t.hasOwnProperty(n)&&(t[n]=[n.charCodeAt(0),n.charCodeAt(1),n.charCodeAt(2),n.charCodeAt(3)]);ni=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]);ar=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]);lr=new Uint8Array([0,0,0,1]);vr=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]);yr=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);pr={video:vr,audio:yr};kr=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]);br=new Uint8Array([0,0,0,0,0,0,0,0]);tt=new Uint8Array([0,0,0,0,0,0,0,0]);dr=tt;gr=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]);nu=tt;wr=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}();i=function(n){for(var r=[],u=0,i,f,t=1;t<arguments.length;t++)r.push(arguments[t]);for(t=r.length;t--;)u+=r[t].byteLength;for(i=new Uint8Array(u+8),f=new DataView(i.buffer,i.byteOffset,i.byteLength),f.setUint32(0,i.byteLength),i.set(n,4),t=0,u=8;t<r.length;t++)i.set(r[t],u),u+=r[t].byteLength;return i};yi=function(){return i(t.dinf,i(t.dref,kr))};pi=function(n){return i(t.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,n.audioobjecttype<<3|n.samplingfrequencyindex>>>1,n.samplingfrequencyindex<<7|n.channelcount<<3,6,1,2]))};kt=function(){return i(t.ftyp,ni,lr,ni,ar)};fr=function(n){return i(t.hdlr,pr[n])};wi=function(n){return i(t.mdat,n)};ur=function(n){var r=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,n.duration>>>24&255,n.duration>>>16&255,n.duration>>>8&255,n.duration&255,85,196,0,0]);return n.samplerate&&(r[12]=n.samplerate>>>24&255,r[13]=n.samplerate>>>16&255,r[14]=n.samplerate>>>8&255,r[15]=n.samplerate&255),i(t.mdhd,r)};rr=function(n){return i(t.mdia,ur(n),fr(n.type),ki(n))};bi=function(n){return i(t.mfhd,new Uint8Array([0,0,0,0,(n&4278190080)>>24,(n&16711680)>>16,(n&65280)>>8,n&255]))};ki=function(n){return i(t.minf,n.type==="video"?i(t.vmhd,wr):i(t.smhd,br),yi(),or(n))};di=function(n,r){for(var f=[],u=r.length;u--;)f[u]=hr(r[u]);return i.apply(null,[t.moof,bi(n)].concat(f))};dt=function(n){for(var r=n.length,u=[];r--;)u[r]=tr(n[r]);return i.apply(null,[t.moov,nr(4294967295)].concat(u).concat(gi(n)))};gi=function(n){for(var r=n.length,u=[];r--;)u[r]=cr(n[r]);return i.apply(null,[t.mvex].concat(u))};nr=function(n){var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(n&4278190080)>>24,(n&16711680)>>16,(n&65280)>>8,n&255,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 i(t.mvhd,r)};er=function(n){for(var f=n.samples||[],e=new Uint8Array(4+f.length),u,r=0;r<f.length;r++)u=f[r].flags,e[r+4]=u.dependsOn<<4|u.isDependedOn<<2|u.hasRedundancy;return i(t.sdtp,e)};or=function(n){return i(t.stbl,sr(n),i(t.stts,nu),i(t.stsc,dr),i(t.stsz,gr),i(t.stco,tt))},function(){var n,r;sr=function(u){return i(t.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),u.type==="video"?n(u):r(u))};n=function(n){for(var u=n.sps||[],f=n.pps||[],e=[],o=[],c,s,h,r=0;r<u.length;r++)e.push((u[r].byteLength&65280)>>>8),e.push(u[r].byteLength&255),e=e.concat(Array.prototype.slice.call(u[r]));for(r=0;r<f.length;r++)o.push((f[r].byteLength&65280)>>>8),o.push(f[r].byteLength&255),o=o.concat(Array.prototype.slice.call(f[r]));return c=[t.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,(n.width&65280)>>8,n.width&255,(n.height&65280)>>8,n.height&255,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]),i(t.avcC,new Uint8Array([1,n.profileIdc,n.profileCompatibility,n.levelIdc,255].concat([u.length],e,[f.length],o))),i(t.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],n.sarRatio&&(s=n.sarRatio[0],h=n.sarRatio[1],c.push(i(t.pasp,new Uint8Array([(s&4278190080)>>24,(s&16711680)>>16,(s&65280)>>8,s&255,(h&4278190080)>>24,(h&16711680)>>16,(h&65280)>>8,h&255])))),i.apply(null,c)};r=function(n){return i(t.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(n.channelcount&65280)>>8,n.channelcount&255,(n.samplesize&65280)>>8,n.samplesize&255,0,0,0,0,(n.samplerate&65280)>>8,n.samplerate&255,0,0]),pi(n))}}();ir=function(n){var r=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(n.id&4278190080)>>24,(n.id&16711680)>>16,(n.id&65280)>>8,n.id&255,0,0,0,0,(n.duration&4278190080)>>24,(n.duration&16711680)>>16,(n.duration&65280)>>8,n.duration&255,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,(n.width&65280)>>8,n.width&255,0,0,(n.height&65280)>>8,n.height&255,0,0]);return i(t.tkhd,r)};hr=function(n){var e,o,f,s,h,r,u;return(e=i(t.tfhd,new Uint8Array([0,0,0,58,(n.id&4278190080)>>24,(n.id&16711680)>>16,(n.id&65280)>>8,n.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),r=Math.floor(n.baseMediaDecodeTime/(bt+1)),u=Math.floor(n.baseMediaDecodeTime%(bt+1)),o=i(t.tfdt,new Uint8Array([1,0,0,0,r>>>24&255,r>>>16&255,r>>>8&255,r&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255])),h=92,n.type==="audio")?(f=gt(n,h),i(t.traf,e,o,f)):(s=er(n),f=gt(n,s.length+h),i(t.traf,e,o,f,s))};tr=function(n){return n.duration=n.duration||4294967295,i(t.trak,ir(n),rr(n))};cr=function(n){var r=new Uint8Array([0,0,0,0,(n.id&4278190080)>>24,(n.id&16711680)>>16,(n.id&65280)>>8,n.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return n.type!=="video"&&(r[r.length-1]=0),i(t.trex,r)},function(){var r,u,n;n=function(n,t){var i=0,r=0,u=0,f=0;return n.length&&(n[0].duration!==undefined&&(i=1),n[0].size!==undefined&&(r=2),n[0].flags!==undefined&&(u=4),n[0].compositionTimeOffset!==undefined&&(f=8)),[0,0,i|r|u|f,1,(n.length&4278190080)>>>24,(n.length&16711680)>>>16,(n.length&65280)>>>8,n.length&255,(t&4278190080)>>>24,(t&16711680)>>>16,(t&65280)>>>8,t&255]};u=function(r,u){var o,e,f,s;for(e=r.samples||[],u+=20+16*e.length,o=n(e,u),s=0;s<e.length;s++)f=e[s],o=o.concat([(f.duration&4278190080)>>>24,(f.duration&16711680)>>>16,(f.duration&65280)>>>8,f.duration&255,(f.size&4278190080)>>>24,(f.size&16711680)>>>16,(f.size&65280)>>>8,f.size&255,f.flags.isLeading<<2|f.flags.dependsOn,f.flags.isDependedOn<<6|f.flags.hasRedundancy<<4|f.flags.paddingValue<<1|f.flags.isNonSyncSample,f.flags.degradationPriority&61440,f.flags.degradationPriority&15,(f.compositionTimeOffset&4278190080)>>>24,(f.compositionTimeOffset&16711680)>>>16,(f.compositionTimeOffset&65280)>>>8,f.compositionTimeOffset&255]);return i(t.trun,new Uint8Array(o))};r=function(r,u){var o,e,f,s;for(e=r.samples||[],u+=20+8*e.length,o=n(e,u),s=0;s<e.length;s++)f=e[s],o=o.concat([(f.duration&4278190080)>>>24,(f.duration&16711680)>>>16,(f.duration&65280)>>>8,f.duration&255,(f.size&4278190080)>>>24,(f.size&16711680)>>>16,(f.size&65280)>>>8,f.size&255]);return i(t.trun,new Uint8Array(o))};gt=function(n,t){return n.type==="audio"?r(n,t):u(n,t)}}();var b={ftyp:kt,mdat:wi,moof:di,moov:dt,initSegment:function(n){var i=kt(),r=dt(n),t;return t=new Uint8Array(i.byteLength+r.byteLength),t.set(i),t.set(r,i.byteLength),t}},ku=function(n){var u,r,t=[],i=[];for(i.byteLength=0,i.nalCount=0,i.duration=0,t.byteLength=0,u=0;u<n.length;u++)r=n[u],r.nalUnitType==="access_unit_delimiter_rbsp"?(t.length&&(t.duration=r.dts-t.dts,i.byteLength+=t.byteLength,i.nalCount+=t.length,i.duration+=t.duration,i.push(t)),t=[r],t.byteLength=r.data.byteLength,t.pts=r.pts,t.dts=r.dts):(r.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(t.keyFrame=!0),t.duration=r.dts-t.dts,t.byteLength+=r.data.byteLength,t.push(r));return i.length&&(!t.duration||t.duration<=0)&&(t.duration=i[i.length-1].duration),i.byteLength+=t.byteLength,i.nalCount+=t.length,i.duration+=t.duration,i.push(t),i},du=function(n){var u,r,t=[],i=[];for(t.byteLength=0,t.nalCount=0,t.duration=0,t.pts=n[0].pts,t.dts=n[0].dts,i.byteLength=0,i.nalCount=0,i.duration=0,i.pts=n[0].pts,i.dts=n[0].dts,u=0;u<n.length;u++)r=n[u],r.keyFrame?(t.length&&(i.push(t),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration),t=[r],t.nalCount=r.length,t.byteLength=r.byteLength,t.pts=r.pts,t.dts=r.dts,t.duration=r.duration):(t.duration+=r.duration,t.nalCount+=r.length,t.byteLength+=r.byteLength,t.push(r));return i.length&&t.duration<=0&&(t.duration=i[i.length-1].duration),i.byteLength+=t.byteLength,i.nalCount+=t.nalCount,i.duration+=t.duration,i.push(t),i},gu=function(n){var t;return!n[0][0].keyFrame&&n.length>1&&(t=n.shift(),n.byteLength-=t.byteLength,n.nalCount-=t.nalCount,n[0][0].dts=t.dts,n[0][0].pts=t.pts,n[0][0].duration+=t.duration),n},nf=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},tu=function(n,t){var i=nf();return i.dataOffset=t,i.compositionTimeOffset=n.pts-n.dts,i.duration=n.duration,i.size=4*n.length,i.size+=n.byteLength,n.keyFrame&&(i.flags.dependsOn=2,i.flags.isNonSyncSample=0),i},tf=function(n,t){for(var r,u,f,e,o=t||0,s=[],i=0;i<n.length;i++)for(f=n[i],r=0;r<f.length;r++)e=f[r],u=tu(e,o),o+=u.size,s.push(u);return s},rf=function(n){for(var i,r,e,o,u,f=0,h=n.byteLength,c=n.nalCount,l=h+4*c,s=new Uint8Array(l),a=new DataView(s.buffer),t=0;t<n.length;t++)for(e=n[t],i=0;i<e.length;i++)for(o=e[i],r=0;r<o.length;r++)u=o[r],a.setUint32(f,u.data.byteLength),f+=4,s.set(u.data,f),f+=u.data.byteLength;return s},uf=function(n,t){var i,u=t||0,r=[];return i=tu(n,u),r.push(i),r},ff=function(n){for(var i,r=0,f=n.byteLength,e=n.length,o=f+4*e,u=new Uint8Array(o),s=new DataView(u.buffer),t=0;t<n.length;t++)i=n[t],s.setUint32(r,i.data.byteLength),r+=4,u.set(i.data,r),r+=i.data.byteLength;return u},k={groupNalsIntoFrames:ku,groupFramesIntoGops:du,extendFirstKeyFrame:gu,generateSampleTable:tf,concatenateNalData:rf,generateSampleTableForFrame:uf,concatenateNalDataForFrame:ff},l=[33,16,5,32,164,27],ti=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],r=function(n){for(var t=[];n--;)t.push(0);return t},ef=function(n){return Object.keys(n).reduce(function(t,i){return t[i]=new Uint8Array(n[i].reduce(function(n,t){return n.concat(t)},[])),t},{})},of={96e3:[l,[227,64],r(154),[56]],88200:[l,[231],r(170),[56]],64e3:[l,[248,192],r(240),[56]],48e3:[l,[255,192],r(268),[55,148,128],r(54),[112]],44100:[l,[255,192],r(268),[55,163,128],r(84),[112]],32e3:[l,[255,192],r(268),[55,234],r(226),[112]],24e3:[l,[255,192],r(268),[55,255,128],r(268),[111,112],r(126),[224]],16e3:[l,[255,192],r(268),[55,255,128],r(268),[111,255],r(269),[223,108],r(195),[1,192]],12e3:[ti,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,253,128],r(259),[56]],11025:[ti,r(268),[3,127,248],r(268),[6,255,240],r(268),[13,255,224],r(268),[27,255,192],r(268),[55,175,128],r(108),[112]],8e3:[ti,r(268),[3,121,16],r(47),[7]]},sf=ef(of),ii=9e4,ri,ui,it,fi,iu,ru,uu;ri=function(n){return n*ii};ui=function(n,t){return n*t};it=function(n){return n/ii};fi=function(n,t){return n/t};iu=function(n,t){return ri(fi(n,t))};ru=function(n,t){return ui(it(n),t)};uu=function(n,t,i){return it(i?n:n-t)};var h={ONE_SECOND_IN_TS:ii,secondsToVideoTs:ri,secondsToAudioTs:ui,videoTsToSeconds:it,audioTsToSeconds:fi,audioTsToVideoTs:iu,videoTsToAudioTs:ru,metadataTsToSeconds:uu},hf=function(n){for(var i,r=0,t=0;t<n.length;t++)i=n[t],r+=i.data.byteLength;return r},cf=function(n,t,i,r){var l,u=0,a=0,f=0,o=0,e,s,c;if(t.length&&(l=h.audioTsToVideoTs(n.baseMediaDecodeTime,n.samplerate),u=Math.ceil(h.ONE_SECOND_IN_TS/(n.samplerate/1024)),i&&r&&(a=l-Math.max(i,r),f=Math.floor(a/u),o=f*u),!(f<1)&&!(o>h.ONE_SECOND_IN_TS/2))){for(e=sf[n.samplerate],e||(e=t[0].data),s=0;s<f;s++)c=t[0],t.splice(0,0,{data:e,dts:c.dts-u,pts:c.pts-u});n.baseMediaDecodeTime-=Math.floor(h.videoTsToAudioTs(o,n.samplerate))}},lf=function(n,t,i){return t.minSegmentDts>=i?n:(t.minSegmentDts=Infinity,n.filter(function(n){return n.dts>=i?(t.minSegmentDts=Math.min(t.minSegmentDts,n.dts),t.minSegmentPts=t.minSegmentDts,!0):!1}))},af=function(n){for(var i,r=[],t=0;t<n.length;t++)i=n[t],r.push({size:i.data.byteLength,duration:1024});return r},vf=function(n){for(var i,r=0,u=new Uint8Array(hf(n)),t=0;t<n.length;t++)i=n[t],u.set(i.data,r),r+=i.data.byteLength;return u},rt={prefixWithSilence:cf,trimAdtsFramesByEarliestDts:lf,generateSampleTable:af,concatenateFrameData:vf},yf=h.ONE_SECOND_IN_TS,pf=function(n,t){typeof t.pts=="number"&&(n.timelineStartInfo.pts===undefined&&(n.timelineStartInfo.pts=t.pts),n.minSegmentPts=n.minSegmentPts===undefined?t.pts:Math.min(n.minSegmentPts,t.pts),n.maxSegmentPts=n.maxSegmentPts===undefined?t.pts:Math.max(n.maxSegmentPts,t.pts));typeof t.dts=="number"&&(n.timelineStartInfo.dts===undefined&&(n.timelineStartInfo.dts=t.dts),n.minSegmentDts=n.minSegmentDts===undefined?t.dts:Math.min(n.minSegmentDts,t.dts),n.maxSegmentDts=n.maxSegmentDts===undefined?t.dts:Math.max(n.maxSegmentDts,t.dts))},wf=function(n){delete n.minSegmentDts;delete n.maxSegmentDts;delete n.minSegmentPts;delete n.maxSegmentPts},bf=function(n,t){var i,r,u=n.minSegmentDts;return t||(u-=n.timelineStartInfo.dts),i=n.timelineStartInfo.baseMediaDecodeTime,i+=u,i=Math.max(0,i),n.type==="audio"&&(r=n.samplerate/yf,i*=r,i=Math.floor(i)),i},s={clearDtsInfo:wf,calculateTrackBaseMediaDecodeTime:bf,collectDtsInfo:pf},fu=4,kf=128,df=function(n){for(var t=0,r={payloadType:-1,payloadSize:0},u=0,i=0;t<n.byteLength;){if(n[t]===kf)break;while(n[t]===255)u+=255,t++;for(u+=n[t++];n[t]===255;)i+=255,t++;if(i+=n[t++],!r.payload&&u===fu){r.payloadType=u;r.payloadSize=i;r.payload=n.subarray(t,t+i);break}t+=i;u=0;i=0}return r},gf=function(n){return n.payload[0]!==181?null:(n.payload[1]<<8|n.payload[2])!=49?null:String.fromCharCode(n.payload[3],n.payload[4],n.payload[5],n.payload[6])!=="GA94"?null:n.payload[7]!==3?null:n.payload.subarray(8,n.payload.length-1)},ne=function(n,t){var u=[],r,e,i,f;if(!(t[0]&64))return u;for(e=t[0]&31,r=0;r<e;r++)i=r*3,f={type:t[i+2]&3,pts:n},t[i+2]&4&&(f.ccData=t[i+3]<<8|t[i+4],u.push(f));return u},te=function(n){for(var e=n.byteLength,i=[],t=1,u,f,r;t<e-2;)n[t]===0&&n[t+1]===0&&n[t+2]===3?(i.push(t+2),t+=2):t++;if(i.length===0)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f},ut={parseSei:df,parseUserData:gf,parseCaptionPackets:ne,discardEmulationPreventionBytes:te,USER_DATA_REGISTERED_ITU_T_T35:fu},e=function e(){e.prototype.init.call(this);this.captionPackets_=[];this.ccStreams_=[new u(0,0),new u(0,1),new u(1,0),new u(1,1)];this.reset();this.ccStreams_.forEach(function(n){n.on("data",this.trigger.bind(this,"data"));n.on("partialdone",this.trigger.bind(this,"partialdone"));n.on("done",this.trigger.bind(this,"done"))},this)};e.prototype=new f;e.prototype.push=function(n){var t,i,r;if(n.nalUnitType==="sei_rbsp"&&(t=ut.parseSei(n.escapedRBSP),t.payloadType===ut.USER_DATA_REGISTERED_ITU_T_T35)&&(i=ut.parseUserData(t),i)){if(n.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}if(n.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--;this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}r=ut.parseCaptionPackets(n.pts,i);this.captionPackets_=this.captionPackets_.concat(r);this.latestDts_!==n.dts&&(this.numSameDts_=0);this.numSameDts_++;this.latestDts_=n.dts}};e.prototype.flushCCStreams=function(n){this.ccStreams_.forEach(function(t){return n==="flush"?t.flush():t.partialFlush()},this)};e.prototype.flushStream=function(n){if(!this.captionPackets_.length){this.flushCCStreams(n);return}this.captionPackets_.forEach(function(n,t){n.presortIndex=t});this.captionPackets_.sort(function(n,t){return n.pts===t.pts?n.presortIndex-t.presortIndex:n.pts-t.pts});this.captionPackets_.forEach(function(n){n.type<2&&this.dispatchCea608Packet(n)},this);this.captionPackets_.length=0;this.flushCCStreams(n)};e.prototype.flush=function(){return this.flushStream("flush")};e.prototype.partialFlush=function(){return this.flushStream("partialFlush")};e.prototype.reset=function(){this.latestDts_=null;this.ignoreNextEqualDts_=!1;this.numSameDts_=0;this.activeCea608Channel_=[null,null];this.ccStreams_.forEach(function(n){n.reset()})};e.prototype.dispatchCea608Packet=function(n){(this.setsTextOrXDSActive(n)?this.activeCea608Channel_[n.type]=null:this.setsChannel1Active(n)?this.activeCea608Channel_[n.type]=0:this.setsChannel2Active(n)&&(this.activeCea608Channel_[n.type]=1),this.activeCea608Channel_[n.type]!==null)&&this.ccStreams_[(n.type<<1)+this.activeCea608Channel_[n.type]].push(n)};e.prototype.setsChannel1Active=function(n){return(n.ccData&30720)==4096};e.prototype.setsChannel2Active=function(n){return(n.ccData&30720)==6144};e.prototype.setsTextOrXDSActive=function(n){return(n.ccData&28928)==256||(n.ccData&30974)==4138||(n.ccData&30974)==6186};var ie={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},ft=function(n){return n===null?"":(n=ie[n]||n,String.fromCharCode(n))},et=14,re=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],v=function(){for(var n=[],t=et+1;t--;)n.push("");return n},u=function u(n,t){u.prototype.init.call(this);this.field_=n||0;this.dataChannel_=t||0;this.name_="CC"+((this.field_<<1|this.dataChannel_)+1);this.setConstants();this.reset();this.push=function(n){var t,e,r,i,u,f;if(t=n.ccData&32639,t===this.lastControlCode_){this.lastControlCode_=null;return}((t&61440)==4096?this.lastControlCode_=t:t!==this.PADDING_&&(this.lastControlCode_=null),r=t>>>8,i=t&255,t!==this.PADDING_)&&(t===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":t===this.END_OF_CAPTION_?(this.mode_="popOn",this.clearFormatting(n.pts),this.flushDisplayed(n.pts),e=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=e,this.startPts_=n.pts):t===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(n.pts)):t===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(n.pts)):t===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(n.pts)):t===this.CARRIAGE_RETURN_?(this.clearFormatting(n.pts),this.flushDisplayed(n.pts),this.shiftRowsUp_(),this.startPts_=n.pts):t===this.BACKSPACE_?this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1):t===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(n.pts),this.displayed_=v()):t===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=v():t===this.RESUME_DIRECT_CAPTIONING_?(this.mode_!=="paintOn"&&(this.flushDisplayed(n.pts),this.displayed_=v()),this.mode_="paintOn",this.startPts_=n.pts):this.isSpecialCharacter(r,i)?(r=(r&3)<<8,u=ft(r|i),this[this.mode_](n.pts,u),this.column_++):this.isExtCharacter(r,i)?(this.mode_==="popOn"?this.nonDisplayed_[this.row_]=this.nonDisplayed_[this.row_].slice(0,-1):this.displayed_[this.row_]=this.displayed_[this.row_].slice(0,-1),r=(r&3)<<8,u=ft(r|i),this[this.mode_](n.pts,u),this.column_++):this.isMidRowCode(r,i)?(this.clearFormatting(n.pts),this[this.mode_](n.pts," "),this.column_++,(i&14)==14&&this.addFormatting(n.pts,["i"]),(i&1)==1&&this.addFormatting(n.pts,["u"])):this.isOffsetControlCode(r,i)?this.column_+=i&3:this.isPAC(r,i)?(f=re.indexOf(t&7968),this.mode_==="rollUp"&&(f-this.rollUpRows_+1<0&&(f=this.rollUpRows_-1),this.setRollUp(n.pts,f)),f!==this.row_&&(this.clearFormatting(n.pts),this.row_=f),i&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(n.pts,["u"]),(t&16)==16&&(this.column_=((t&14)>>1)*4),this.isColorPAC(i)&&(i&14)==14&&this.addFormatting(n.pts,["i"])):this.isNormalChar(r)&&(i===0&&(i=null),u=ft(r),u+=ft(i),this[this.mode_](n.pts,u),this.column_+=u.length))}};u.prototype=new f;u.prototype.flushDisplayed=function(n){var t=this.displayed_.map(function(n){try{return n.trim()}catch(t){return console.error("Skipping malformed caption."),""}}).join("\n").replace(/^\n+|\n+$/g,"");t.length&&this.trigger("data",{startPts:this.startPts_,endPts:n,text:t,stream:this.name_})};u.prototype.reset=function(){this.mode_="popOn";this.topRow_=0;this.startPts_=0;this.displayed_=v();this.nonDisplayed_=v();this.lastControlCode_=null;this.column_=0;this.row_=et;this.rollUpRows_=2;this.formatting_=[]};u.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31);this.PADDING_=0;this.RESUME_CAPTION_LOADING_=this.CONTROL_|32;this.END_OF_CAPTION_=this.CONTROL_|47;this.ROLL_UP_2_ROWS_=this.CONTROL_|37;this.ROLL_UP_3_ROWS_=this.CONTROL_|38;this.ROLL_UP_4_ROWS_=this.CONTROL_|39;this.CARRIAGE_RETURN_=this.CONTROL_|45;this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41;this.BACKSPACE_=this.CONTROL_|33;this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44;this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46};u.prototype.isSpecialCharacter=function(n,t){return n===this.EXT_&&t>=48&&t<=63};u.prototype.isExtCharacter=function(n,t){return(n===this.EXT_+1||n===this.EXT_+2)&&t>=32&&t<=63};u.prototype.isMidRowCode=function(n,t){return n===this.EXT_&&t>=32&&t<=47};u.prototype.isOffsetControlCode=function(n,t){return n===this.OFFSET_&&t>=33&&t<=35};u.prototype.isPAC=function(n,t){return n>=this.BASE_&&n<this.BASE_+8&&t>=64&&t<=127};u.prototype.isColorPAC=function(n){return n>=64&&n<=79||n>=96&&n<=127};u.prototype.isNormalChar=function(n){return n>=32&&n<=127};u.prototype.setRollUp=function(n,t){if(this.mode_!=="rollUp"&&(this.row_=et,this.mode_="rollUp",this.flushDisplayed(n),this.nonDisplayed_=v(),this.displayed_=v()),t!==undefined&&t!==this.row_)for(var i=0;i<this.rollUpRows_;i++)this.displayed_[t-i]=this.displayed_[this.row_-i],this.displayed_[this.row_-i]="";t===undefined&&(t=this.row_);this.topRow_=t-this.rollUpRows_+1};u.prototype.addFormatting=function(n,t){this.formatting_=this.formatting_.concat(t);var i=t.reduce(function(n,t){return n+"<"+t+">"},"");this[this.mode_](n,i)};u.prototype.clearFormatting=function(n){if(this.formatting_.length){var t=this.formatting_.reverse().reduce(function(n,t){return n+"<\/"+t+">"},"");this.formatting_=[];this[this.mode_](n,t)}};u.prototype.popOn=function(n,t){var i=this.nonDisplayed_[this.row_];i+=t;this.nonDisplayed_[this.row_]=i};u.prototype.rollUp=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};u.prototype.shiftRowsUp_=function(){for(var n=0;n<this.topRow_;n++)this.displayed_[n]="";for(n=this.row_+1;n<et+1;n++)this.displayed_[n]="";for(n=this.topRow_;n<this.row_;n++)this.displayed_[n]=this.displayed_[n+1];this.displayed_[this.row_]=""};u.prototype.paintOn=function(n,t){var i=this.displayed_[this.row_];i+=t;this.displayed_[this.row_]=i};var eu={CaptionStream:e,Cea608Stream:u},o={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ue=8589934592,fe=4294967296,ou="shared",ei=function(n,t){var i=1;for(n>t&&(i=-1);Math.abs(t-n)>fe;)n+=i*ue;return n},oi=function oi(n){var i,t;oi.prototype.init.call(this);this.type_=n||ou;this.push=function(n){(this.type_===ou||n.type===this.type_)&&(t===undefined&&(t=n.dts),n.dts=ei(n.dts,t),n.pts=ei(n.pts,t),i=n.dts,this.trigger("data",n))};this.flush=function(){t=i;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.discontinuity=function(){t=void 0;i=void 0};this.reset=function(){this.discontinuity();this.trigger("reset")}};oi.prototype=new f;var ee={TimestampRolloverStream:oi,handleRollover:ei},su=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},ot=function(n,t,i){return decodeURIComponent(su(n,t,i))},oe=function(n,t,i){return unescape(su(n,t,i))},st=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},hu={TXXX:function(n){var t;if(n.data[0]===3){for(t=1;t<n.data.length;t++)if(n.data[t]===0){n.description=ot(n.data,1,t);n.value=ot(n.data,t+1,n.data.length).replace(/\0*$/,"");break}n.data=n.value}},WXXX:function(n){var t;if(n.data[0]===3)for(t=1;t<n.data.length;t++)if(n.data[t]===0){n.description=ot(n.data,1,t);n.url=ot(n.data,t+1,n.data.length);break}},PRIV:function(n){for(var t=0;t<n.data.length;t++)if(n.data[t]===0){n.owner=oe(n.data,0,t);break}n.privateData=n.data.subarray(t+1);n.data=n.privateData}},ht;ht=function(n){var r={debug:!!(n&&n.debug),descriptor:n&&n.descriptor},i=0,t=[],u=0,f;if(ht.prototype.init.call(this),this.dispatchType=o.METADATA_STREAM_TYPE.toString(16),r.descriptor)for(f=0;f<r.descriptor.length;f++)this.dispatchType+=("00"+r.descriptor[f].toString(16)).slice(-2);this.push=function(n){var f,e,c,o,h,a,s,l;if(n.type==="timed-metadata"){if(n.dataAlignmentIndicator&&(u=0,t.length=0),t.length===0&&(n.data.length<10||n.data[0]!=="I".charCodeAt(0)||n.data[1]!=="D".charCodeAt(0)||n.data[2]!=="3".charCodeAt(0))){r.debug&&console.log("Skipping unrecognized metadata packet");return}if(t.push(n),u+=n.data.byteLength,t.length===1&&(i=st(n.data.subarray(6,10))+10),!(u<i)){for(f={data:new Uint8Array(i),frames:[],pts:t[0].pts,dts:t[0].dts},h=0;h<i;)f.data.set(t[0].data.subarray(0,i-h),h),h+=t[0].data.byteLength,u-=t[0].data.byteLength,t.shift();e=10;f.data[5]&64&&(e+=4,e+=st(f.data.subarray(10,14)),i-=st(f.data.subarray(16,20)));do{if(c=st(f.data.subarray(e+4,e+8)),c<1)return console.log("Malformed ID3 frame encountered. Skipping metadata parsing.");a=String.fromCharCode(f.data[e],f.data[e+1],f.data[e+2],f.data[e+3]);o={id:a,data:f.data.subarray(e+10,e+c+10)};o.key=o.id;hu[o.id]&&(hu[o.id](o),o.owner==="com.apple.streaming.transportStreamTimestamp"&&(s=o.data,l=(s[3]&1)<<30|s[4]<<22|s[5]<<14|s[6]<<6|s[7]>>>2,l*=4,l+=s[7]&3,o.timeStamp=l,f.pts===undefined&&f.dts===undefined&&(f.pts=o.timeStamp,f.dts=o.timeStamp),this.trigger("timestamp",o)));f.frames.push(o);e+=10;e+=c}while(e<i);this.trigger("data",f)}}}};ht.prototype=new f;var se=ht,he=ee.TimestampRolloverStream,ct,d,lt,p=188,si=71;ct=function(){var t=new Uint8Array(p),n=0;ct.prototype.init.call(this);this.push=function(i){var u=0,f=p,r;for(n?(r=new Uint8Array(i.byteLength+n),r.set(t.subarray(0,n)),r.set(i,n),n=0):r=i;f<r.byteLength;){if(r[u]===si&&r[f]===si){this.trigger("data",r.subarray(u,f));u+=p;f+=p;continue}u++;f++}u<r.byteLength&&(t.set(r.subarray(u),0),n=r.byteLength-u)};this.flush=function(){n===p&&t[0]===si&&(this.trigger("data",t),n=0);this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")};this.reset=function(){n=0;this.trigger("reset")}};ct.prototype=new f;d=function(){var t,i,r,n;d.prototype.init.call(this);n=this;this.packetsWaitingForPmt=[];this.programMapTable=undefined;t=function(n,t){var u=0;t.payloadUnitStartIndicator&&(u+=n[u]+1);t.type==="pat"?i(n.subarray(u),t):r(n.subarray(u),t)};i=function(t,i){i.section_number=t[7];i.last_section_number=t[8];n.pmtPid=(t[10]&31)<<8|t[11];i.pmtPid=n.pmtPid};r=function(t,i){var e,s,h,r,u,f;if(t[5]&1){for(n.programMapTable={video:null,audio:null,"timed-metadata":{}},e=(t[1]&15)<<8|t[2],s=3+e-4,h=(t[10]&15)<<8|t[11],r=12+h;r<s;)u=t[r],f=(t[r+1]&31)<<8|t[r+2],u===o.H264_STREAM_TYPE&&n.programMapTable.video===null?n.programMapTable.video=f:u===o.ADTS_STREAM_TYPE&&n.programMapTable.audio===null?n.programMapTable.audio=f:u===o.METADATA_STREAM_TYPE&&(n.programMapTable["timed-metadata"][f]=u),r+=((t[r+3]&15)<<8|t[r+4])+5;i.programMapTable=n.programMapTable}};this.push=function(n){var i={},r=4;if(i.payloadUnitStartIndicator=!!(n[1]&64),i.pid=n[1]&31,i.pid<<=8,i.pid|=n[2],(n[3]&48)>>>4>1&&(r+=n[r]+1),i.pid===0)i.type="pat",t(n.subarray(r),i),this.trigger("data",i);else if(i.pid===this.pmtPid)for(i.type="pmt",t(n.subarray(r),i),this.trigger("data",i);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===undefined?this.packetsWaitingForPmt.push([n,r,i]):this.processPes_(n,r,i)};this.processPes_=function(n,t,i){i.streamType=i.pid===this.programMapTable.video?o.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?o.ADTS_STREAM_TYPE:this.programMapTable["timed-metadata"][i.pid];i.type="pes";i.data=n.subarray(t);this.trigger("data",i)}};d.prototype=new f;d.STREAM_TYPES={h264:27,adts:15};lt=function(){var u=this,t={data:[],size:0},i={data:[],size:0},f={data:[],size:0},n,e=function(n,t){var i;t.packetLength=6+(n[4]<<8|n[5]);t.dataAlignmentIndicator=(n[6]&4)!=0;i=n[7];i&192&&(t.pts=(n[9]&14)<<27|(n[10]&255)<<20|(n[11]&254)<<12|(n[12]&255)<<5|(n[13]&254)>>>3,t.pts*=4,t.pts+=(n[13]&6)>>>1,t.dts=t.pts,i&64&&(t.dts=(n[14]&14)<<27|(n[15]&255)<<20|(n[16]&254)<<12|(n[17]&255)<<5|(n[18]&254)>>>3,t.dts*=4,t.dts+=(n[18]&6)>>>1));t.data=n.subarray(9+n[8])},r=function(n,t,i){var h=new Uint8Array(n.size),r={type:t},f=0,c=0,o=!1,s;if(n.data.length&&!(n.size<9)){for(r.trackId=n.data[0].pid,f=0;f<n.data.length;f++)s=n.data[f],h.set(s.data,c),c+=s.data.byteLength;e(h,r);o=t==="video"||r.packetLength<=n.size;(i||o)&&(n.size=0,n.data.length=0);o&&u.trigger("data",r)}};lt.prototype.init.call(this);this.push=function(e){({pat:function(){},pes:function(){var n,u;switch(e.streamType){case o.H264_STREAM_TYPE:case o.H264_STREAM_TYPE:n=t;u="video";break;case o.ADTS_STREAM_TYPE:n=i;u="audio";break;case o.METADATA_STREAM_TYPE:n=f;u="timed-metadata";break;default:return}e.payloadUnitStartIndicator&&r(n,u,!0);n.data.push(e);n.size+=e.data.byteLength},pmt:function(){var t={type:"metadata",tracks:[]};n=e.programMapTable;n.video!==null&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.video,codec:"avc",type:"video"});n.audio!==null&&t.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+n.audio,codec:"adts",type:"audio"});u.trigger("data",t)}})[e.type]()};this.reset=function(){t.size=0;t.data.length=0;i.size=0;i.data.length=0;this.trigger("reset")};this.flushStreams_=function(){r(t,"video");r(i,"audio");r(f,"timed-metadata")};this.flush=function(){this.flushStreams_();this.trigger("done")}};lt.prototype=new f;hi={PAT_PID:0,MP2T_PACKET_LENGTH:p,TransportPacketStream:ct,TransportParseStream:d,ElementaryStream:lt,TimestampRolloverStream:he,CaptionStream:eu.CaptionStream,Cea608Stream:eu.Cea608Stream,MetadataStream:se};for(at in o)o.hasOwnProperty(at)&&(hi[at]=o[at]);var c=hi,ce=h.ONE_SECOND_IN_TS,vt,cu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];vt=function(n){var t,i=0;vt.prototype.init.call(this);this.push=function(r){var u=0,h,c,f,e,o,s;if(n||(i=0),r.type==="audio")for(t?(e=t,t=new Uint8Array(e.byteLength+r.data.byteLength),t.set(e),t.set(r.data,e.byteLength)):t=r.data;u+5<t.length;){if(t[u]!==255||(t[u+1]&246)!=240){u++;continue}if(c=(~t[u+1]&1)*2,h=(t[u+3]&3)<<11|t[u+4]<<3|(t[u+5]&224)>>5,o=((t[u+6]&3)+1)*1024,s=o*ce/cu[(t[u+2]&60)>>>2],f=u+h,t.byteLength<f)return;if(this.trigger("data",{pts:r.pts+i*s,dts:r.dts+i*s,sampleCount:o,audioobjecttype:(t[u+2]>>>6&3)+1,channelcount:(t[u+2]&1)<<2|(t[u+3]&192)>>>6,samplerate:cu[(t[u+2]&60)>>>2],samplingfrequencyindex:(t[u+2]&60)>>>2,samplesize:16,data:t.subarray(u+7+c,f)}),i++,t.byteLength===f){t=undefined;return}t=t.subarray(f)}};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")}};vt.prototype=new f;ci=vt;lu=function(n){var i=n.byteLength,r=0,t=0;this.length=function(){return 8*i};this.bitsAvailable=function(){return 8*i+t};this.loadWord=function(){var f=n.byteLength-i,e=new Uint8Array(4),u=Math.min(4,i);if(u===0)throw new Error("no bytes available");e.set(n.subarray(f,f+u));r=new DataView(e.buffer).getUint32(0);t=u*8;i-=u};this.skipBits=function(n){var u;t>n?(r<<=n,t-=n):(n-=t,u=Math.floor(n/8),n-=u*8,i-=u,this.loadWord(),r<<=n,t-=n)};this.readBits=function(n){var u=Math.min(t,n),f=r>>>32-u;return(t-=u,t>0?r<<=u:i>0&&this.loadWord(),u=n-u,u>0)?f<<u|this.readBits(u):f};this.skipLeadingZeros=function(){for(var n=0;n<t;++n)if((r&2147483648>>>n)!=0)return r<<=n,t-=n,n;return this.loadWord(),n+this.skipLeadingZeros()};this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())};this.readUnsignedExpGolomb=function(){var n=this.skipLeadingZeros();return this.readBits(n+1)-1};this.readExpGolomb=function(){var n=this.readUnsignedExpGolomb();return 1&n?1+n>>>1:-1*(n>>>1)};this.readBoolean=function(){return this.readBits(1)===1};this.readUnsignedByte=function(){return this.readBits(8)};this.loadWord()};au=lu;g=function(){var i=0,t,n;g.prototype.init.call(this);this.push=function(r){var u,f;for(n?(u=new Uint8Array(n.byteLength+r.data.byteLength),u.set(n),u.set(r.data,n.byteLength),n=u):n=r.data,f=n.byteLength;i<f-3;i++)if(n[i+2]===1){t=i+5;break}while(t<f)switch(n[t]){case 0:if(n[t-1]!==0){t+=2;break}else if(n[t-2]!==0){t++;break}i+3!==t-2&&this.trigger("data",n.subarray(i+3,t-2));do t++;while(n[t]!==1&&t<f);i=t-2;t+=3;break;case 1:if(n[t-1]!==0||n[t-2]!==0){t+=3;break}this.trigger("data",n.subarray(i+3,t-2));i=t-2;t+=3;break;default:t+=3}n=n.subarray(i);t-=i;i=0};this.reset=function(){n=null;i=0;this.trigger("reset")};this.flush=function(){n&&n.byteLength>3&&this.trigger("data",n.subarray(i+3));n=null;i=0;this.trigger("done")};this.endTimeline=function(){this.flush();this.trigger("endedtimeline")}};g.prototype=new f;vu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0};yt=function(){var n=new g,t,u,f,e,i,o,r;yt.prototype.init.call(this);t=this;this.push=function(t){t.type==="video"&&(u=t.trackId,f=t.pts,e=t.dts,n.push(t))};n.on("data",function(n){var r={trackId:u,pts:f,dts:e,data:n};switch(n[0]&31){case 5:r.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:r.nalUnitType="sei_rbsp";r.escapedRBSP=i(n.subarray(1));break;case 7:r.nalUnitType="seq_parameter_set_rbsp";r.escapedRBSP=i(n.subarray(1));r.config=o(r.escapedRBSP);break;case 8:r.nalUnitType="pic_parameter_set_rbsp";break;case 9:r.nalUnitType="access_unit_delimiter_rbsp"}t.trigger("data",r)});n.on("done",function(){t.trigger("done")});n.on("partialdone",function(){t.trigger("partialdone")});n.on("reset",function(){t.trigger("reset")});n.on("endedtimeline",function(){t.trigger("endedtimeline")});this.flush=function(){n.flush()};this.partialFlush=function(){n.partialFlush()};this.reset=function(){n.reset()};this.endTimeline=function(){n.endTimeline()};r=function(n,t){for(var r=8,i=8,f,u=0;u<n;u++)i!==0&&(f=t.readExpGolomb(),i=(r+f+256)%256),r=i===0?r:i};i=function(n){for(var e=n.byteLength,i=[],t=1,u,f,r;t<e-2;)n[t]===0&&n[t+1]===0&&n[t+2]===3?(i.push(t+2),t+=2):t++;if(i.length===0)return n;for(u=e-i.length,f=new Uint8Array(u),r=0,t=0;t<u;r++,t++)r===i[0]&&(r++,i.shift()),f[t]=n[r];return f};o=function(n){var h=0,c=0,l=0,a=0,v=1,t,f,y,p,e,o,w,b,k,s,d,i,g,u;if(t=new au(n),f=t.readUnsignedByte(),p=t.readUnsignedByte(),y=t.readUnsignedByte(),t.skipUnsignedExpGolomb(),vu[f]&&(e=t.readUnsignedExpGolomb(),e===3&&t.skipBits(1),t.skipUnsignedExpGolomb(),t.skipUnsignedExpGolomb(),t.skipBits(1),t.readBoolean()))for(d=e!==3?8:12,u=0;u<d;u++)t.readBoolean()&&(u<6?r(16,t):r(64,t));if(t.skipUnsignedExpGolomb(),o=t.readUnsignedExpGolomb(),o===0)t.readUnsignedExpGolomb();else if(o===1)for(t.skipBits(1),t.skipExpGolomb(),t.skipExpGolomb(),w=t.readUnsignedExpGolomb(),u=0;u<w;u++)t.skipExpGolomb();if(t.skipUnsignedExpGolomb(),t.skipBits(1),b=t.readUnsignedExpGolomb(),k=t.readUnsignedExpGolomb(),s=t.readBits(1),s===0&&t.skipBits(1),t.skipBits(1),t.readBoolean()&&(h=t.readUnsignedExpGolomb(),c=t.readUnsignedExpGolomb(),l=t.readUnsignedExpGolomb(),a=t.readUnsignedExpGolomb()),t.readBoolean()&&t.readBoolean()){g=t.readUnsignedByte();switch(g){case 1:i=[1,1];break;case 2:i=[12,11];break;case 3:i=[10,11];break;case 4:i=[16,11];break;case 5:i=[40,33];break;case 6:i=[24,11];break;case 7:i=[20,11];break;case 8:i=[32,11];break;case 9:i=[80,33];break;case 10:i=[18,11];break;case 11:i=[15,11];break;case 12:i=[64,33];break;case 13:i=[160,99];break;case 14:i=[4,3];break;case 15:i=[3,2];break;case 16:i=[2,1];break;case 255:i=[t.readUnsignedByte()<<8|t.readUnsignedByte(),t.readUnsignedByte()<<8|t.readUnsignedByte()]}i&&(v=i[0]/i[1])}return{profileIdc:f,levelIdc:y,profileCompatibility:p,width:Math.ceil(((b+1)*16-h*2-c*2)*v),height:(2-s)*(k+1)*16-l*2-a*2,sarRatio:i}}};yt.prototype=new f;var le={H264Stream:yt,NalByteStream:g},ae=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ve=function(n){return n[0]==="I".charCodeAt(0)&&n[1]==="D".charCodeAt(0)&&n[2]==="3".charCodeAt(0)?!0:!1},yu=function(n){return n[0]<<21|n[1]<<14|n[2]<<7|n[3]},ye=function(n,t,i){for(var u="",r=t;r<i;r++)u+="%"+("00"+n[r].toString(16)).slice(-2);return u},pe=function(n,t,i){return unescape(ye(n,t,i))},we=function(n,t){var i=n[t+6]<<21|n[t+7]<<14|n[t+8]<<7|n[t+9],r=n[t+5],u=(r&16)>>4;return u?i+20:i+10},be=function(n,t){var i=(n[t+5]&224)>>5,r=n[t+4]<<3,u=n[t+3]&6144;return u|r|i},ke=function(n,t){return n[t]==="I".charCodeAt(0)&&n[t+1]==="D".charCodeAt(0)&&n[t+2]==="3".charCodeAt(0)?"timed-metadata":n[t]&!0&&(n[t+1]&240)==240?"audio":null},de=function(n){for(var t=0;t+5<n.length;){if(n[t]!==255||(n[t+1]&246)!=240){t++;continue}return ae[(n[t+2]&60)>>>2]}return null},ge=function(n){var t,f,u,o,r,s,i,e;t=10;n[5]&64&&(t+=4,t+=yu(n.subarray(10,14)));do{if(f=yu(n.subarray(t+4,t+8)),f<1)return null;if(o=String.fromCharCode(n[t],n[t+1],n[t+2],n[t+3]),o==="PRIV")for(u=n.subarray(t+10,t+f+10),r=0;r<u.byteLength;r++)if(u[r]===0){if(s=pe(u,0,r),s==="com.apple.streaming.transportStreamTimestamp")return i=u.subarray(r+1),e=(i[3]&1)<<30|i[4]<<22|i[5]<<14|i[6]<<6|i[7]>>>2,e*=4,e+(i[7]&3);break}t+=10;t+=f}while(t<n.byteLength);return null},li={isLikelyAacData:ve,parseId3TagSize:we,parseAdtsSize:be,parseType:ke,parseSampleRate:de,parseAacTimestamp:ge},pt;pt=function(){var n=new Uint8Array,t=0;pt.prototype.init.call(this);this.setTimestamp=function(n){t=n};this.push=function(i){var u=0,r=0,e,o,s,f;for(n.length?(f=n.length,n=new Uint8Array(i.byteLength+f),n.set(n.subarray(0,f)),n.set(i,f)):n=i;n.length-r>=3;){if(n[r]==="I".charCodeAt(0)&&n[r+1]==="D".charCodeAt(0)&&n[r+2]==="3".charCodeAt(0)){if(n.length-r<10)break;if(u=li.parseId3TagSize(n,r),r+u>n.length)break;o={type:"timed-metadata",data:n.subarray(r,r+u)};this.trigger("data",o);r+=u;continue}else if((n[r]&255)==255&&(n[r+1]&240)==240){if(n.length-r<7)break;if(u=li.parseAdtsSize(n,r),r+u>n.length)break;s={type:"audio",data:n.subarray(r,r+u),pts:t,dts:t};this.trigger("data",s);r+=u;continue}r++}e=n.length-r;n=e>0?n.subarray(r):new Uint8Array};this.reset=function(){n=new Uint8Array;this.trigger("reset")};this.endTimeline=function(){n=new Uint8Array;this.trigger("endedtimeline")}};pt.prototype=new f;var no=pt,to=le.H264Stream,io=li.isLikelyAacData,ro=h.ONE_SECOND_IN_TS,ai=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],vi=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],nt,w,wt,y,pu=function(n,t){var i;if(n.length!==t.length)return!1;for(i=0;i<n.length;i++)if(n[i]!==t[i])return!1;return!0},wu=function(n,t,i,r,u,f){var e=i-t,o=r-t,s=u-i;return{start:{dts:n,pts:n+e},end:{dts:n+o,pts:n+s},prependedContentDuration:f,baseMediaDecodeTime:n}};w=function(n,t){var i=[],r=0,u=0,f=0,e=Infinity;t=t||{};w.prototype.init.call(this);this.push=function(t){s.collectDtsInfo(n,t);n&&ai.forEach(function(i){n[i]=t[i]});i.push(t)};this.setEarliestDts=function(t){u=t-n.timelineStartInfo.baseMediaDecodeTime};this.setVideoBaseMediaDecodeTime=function(n){e=n};this.setAudioAppendStart=function(n){f=n};this.flush=function(){var o,h,l,c,a;if(i.length===0){this.trigger("done","AudioSegmentStream");return}o=rt.trimAdtsFramesByEarliestDts(i,n,u);n.baseMediaDecodeTime=s.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps);rt.prefixWithSilence(n,o,f,e);n.samples=rt.generateSampleTable(o);l=b.mdat(rt.concatenateFrameData(o));i=[];h=b.moof(r,[n]);c=new Uint8Array(h.byteLength+l.byteLength);r++;c.set(h);c.set(l,h.byteLength);s.clearDtsInfo(n);a=Math.ceil(ro*1024/n.samplerate);o.length&&this.trigger("timingInfo",{start:o[0].dts,end:o[0].dts+o.length*a});this.trigger("data",{track:n,boxes:c});this.trigger("done","AudioSegmentStream")};this.reset=function(){s.clearDtsInfo(n);i=[];this.trigger("reset")}};w.prototype=new f;nt=function(n,t){var e=0,i=[],r=[],u,f;t=t||{};nt.prototype.init.call(this);delete n.minPTS;this.gopCache_=[];this.push=function(t){s.collectDtsInfo(n,t);t.nalUnitType!=="seq_parameter_set_rbsp"||u||(u=t.config,n.sps=[t.data],vi.forEach(function(t){n[t]=u[t]},this));t.nalUnitType!=="pic_parameter_set_rbsp"||f||(f=t.data,n.pps=[t.data]);i.push(t)};this.flush=function(){for(var y,f,u,h,l,c,p=0,a,o,v;i.length;){if(i[0].nalUnitType==="access_unit_delimiter_rbsp")break;i.shift()}if(i.length===0){this.resetStream_();this.trigger("done","VideoSegmentStream");return}if(y=k.groupNalsIntoFrames(i),u=k.groupFramesIntoGops(y),u[0][0].keyFrame||(f=this.getGopForFusion_(i[0],n),f?(p=f.duration,u.unshift(f),u.byteLength+=f.byteLength,u.nalCount+=f.nalCount,u.pts=f.pts,u.dts=f.dts,u.duration+=f.duration):u=k.extendFirstKeyFrame(u)),r.length){if(v=t.alignGopsAtEnd?this.alignGopsAtEnd_(u):this.alignGopsAtStart_(u),!v){this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);i=[];this.resetStream_();this.trigger("done","VideoSegmentStream");return}s.clearDtsInfo(n);u=v}s.collectDtsInfo(n,u);n.samples=k.generateSampleTable(u);l=b.mdat(k.concatenateNalData(u));n.baseMediaDecodeTime=s.calculateTrackBaseMediaDecodeTime(n,t.keepOriginalTimestamps);this.trigger("processedGopsInfo",u.map(function(n){return{pts:n.pts,dts:n.dts,byteLength:n.byteLength}}));a=u[0];o=u[u.length-1];this.trigger("segmentTimingInfo",wu(n.baseMediaDecodeTime,a.dts,a.pts,o.dts+o.duration,o.pts+o.duration,p));this.trigger("timingInfo",{start:u[0].dts,end:u[u.length-1].dts+u[u.length-1].duration});this.gopCache_.unshift({gop:u.pop(),pps:n.pps,sps:n.sps});this.gopCache_.length=Math.min(6,this.gopCache_.length);i=[];this.trigger("baseMediaDecodeTime",n.baseMediaDecodeTime);this.trigger("timelineStartInfo",n.timelineStartInfo);h=b.moof(e,[n]);c=new Uint8Array(h.byteLength+l.byteLength);e++;c.set(h);c.set(l,h.byteLength);this.trigger("data",{track:n,boxes:c});this.resetStream_();this.trigger("done","VideoSegmentStream")};this.reset=function(){this.resetStream_();i=[];this.gopCache_.length=0;r.length=0;this.trigger("reset")};this.resetStream_=function(){s.clearDtsInfo(n);u=undefined;f=undefined};this.getGopForFusion_=function(t){for(var o=Infinity,i,u,f,r,e=0;e<this.gopCache_.length;e++)(r=this.gopCache_[e],f=r.gop,n.pps&&pu(n.pps[0],r.pps[0])&&n.sps&&pu(n.sps[0],r.sps[0]))&&(f.dts<n.timelineStartInfo.dts||(i=t.dts-f.dts-f.duration,i>=-1e4&&i<=45e3&&(!u||o>i)&&(u=r,o=i)));return u?u.gop:null};this.alignGopsAtStart_=function(n){var f,i,e,u,o,s,h,t;for(o=n.byteLength,s=n.nalCount,h=n.duration,f=i=0;f<r.length&&i<n.length;){if(e=r[f],u=n[i],e.pts===u.pts)break;if(u.pts>e.pts){f++;continue}i++;o-=u.byteLength;s-=u.nalCount;h-=u.duration}return i===0?n:i===n.length?null:(t=n.slice(i),t.byteLength=o,t.duration=h,t.nalCount=s,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsAtEnd_=function(n){var u,i,s,h,f,e,c,t,o;for(u=r.length-1,i=n.length-1,f=null,e=!1;u>=0&&i>=0;){if(s=r[u],h=n[i],s.pts===h.pts){e=!0;break}if(s.pts>h.pts){u--;continue}u===r.length-1&&(f=i);i--}return!e&&f===null?null:(c=e?i:f,c===0)?n:(t=n.slice(c),o=t.reduce(function(n,t){return n.byteLength+=t.byteLength,n.duration+=t.duration,n.nalCount+=t.nalCount,n},{byteLength:0,duration:0,nalCount:0}),t.byteLength=o.byteLength,t.duration=o.duration,t.nalCount=o.nalCount,t.pts=t[0].pts,t.dts=t[0].dts,t)};this.alignGopsWith=function(n){r=n}};nt.prototype=new f;y=function(n,t){this.numberOfTracks=0;this.metadataStream=t;n=n||{};this.remuxTracks=typeof n.remux!="undefined"?!!n.remux:!0;this.keepOriginalTimestamps=typeof n.keepOriginalTimestamps=="boolean"?n.keepOriginalTimestamps:!1;this.pendingTracks=[];this.videoTrack=null;this.pendingBoxes=[];this.pendingCaptions=[];this.pendingMetadata=[];this.pendingBytes=0;this.emittedTracks=0;y.prototype.init.call(this);this.push=function(n){if(n.text)return this.pendingCaptions.push(n);if(n.frames)return this.pendingMetadata.push(n);this.pendingTracks.push(n.track);this.pendingBytes+=n.boxes.byteLength;n.track.type==="video"&&(this.videoTrack=n.track,this.pendingBoxes.push(n.boxes));n.track.type==="audio"&&(this.audioTrack=n.track,this.pendingBoxes.unshift(n.boxes))}};y.prototype=new f;y.prototype.flush=function(n){var o=0,i={captions:[],captionStreams:{},metadata:[],info:{}},r,u,e,f=0,t;if(this.pendingTracks.length<this.numberOfTracks){if(n!=="VideoSegmentStream"&&n!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++;this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(f=this.videoTrack.timelineStartInfo.pts,vi.forEach(function(n){i.info[n]=this.videoTrack[n]},this)):this.audioTrack&&(f=this.audioTrack.timelineStartInfo.pts,ai.forEach(function(n){i.info[n]=this.audioTrack[n]},this)),this.videoTrack||this.audioTrack){for(i.type=this.pendingTracks.length===1?this.pendingTracks[0].type:"combined",this.emittedTracks+=this.pendingTracks.length,e=b.initSegment(this.pendingTracks),i.initSegment=new Uint8Array(e.byteLength),i.initSegment.set(e),i.data=new Uint8Array(this.pendingBytes),t=0;t<this.pendingBoxes.length;t++)i.data.set(this.pendingBoxes[t],o),o+=this.pendingBoxes[t].byteLength;for(t=0;t<this.pendingCaptions.length;t++)r=this.pendingCaptions[t],r.startTime=h.metadataTsToSeconds(r.startPts,f,this.keepOriginalTimestamps),r.endTime=h.metadataTsToSeconds(r.endPts,f,this.keepOriginalTimestamps),i.captionStreams[r.stream]=!0,i.captions.push(r);for(t=0;t<this.pendingMetadata.length;t++)u=this.pendingMetadata[t],u.cueTime=h.metadataTsToSeconds(u.pts,f,this.keepOriginalTimestamps),i.metadata.push(u);for(i.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",i),t=0;t<i.captions.length;t++)r=i.captions[t],this.trigger("caption",r);for(t=0;t<i.metadata.length;t++)u=i.metadata[t],this.trigger("id3Frame",u)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)};y.prototype.setRemux=function(n){this.remuxTracks=n};wt=function(n){var i=this,u=!0,r,t;wt.prototype.init.call(this);n=n||{};this.baseMediaDecodeTime=n.baseMediaDecodeTime||0;this.transmuxPipeline_={};this.setupAacPipeline=function(){var u={};this.transmuxPipeline_=u;u.type="aac";u.metadataStream=new c.MetadataStream;u.aacStream=new no;u.audioTimestampRolloverStream=new c.TimestampRolloverStream("audio");u.timedMetadataTimestampRolloverStream=new c.TimestampRolloverStream("timed-metadata");u.adtsStream=new ci;u.coalesceStream=new y(n,u.metadataStream);u.headOfPipeline=u.aacStream;u.aacStream.pipe(u.audioTimestampRolloverStream).pipe(u.adtsStream);u.aacStream.pipe(u.timedMetadataTimestampRolloverStream).pipe(u.metadataStream).pipe(u.coalesceStream);u.metadataStream.on("timestamp",function(n){u.aacStream.setTimestamp(n.timeStamp)});u.aacStream.on("data",function(f){if(f.type==="timed-metadata"&&!u.audioSegmentStream){t=t||{timelineStartInfo:{baseMediaDecodeTime:i.baseMediaDecodeTime},codec:"adts",type:"audio"};u.coalesceStream.numberOfTracks++;u.audioSegmentStream=new w(t,n);u.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo"));u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream)}i.trigger("trackinfo",{hasAudio:!!t,hasVideo:!!r})});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setupTsPipeline=function(){var u={};this.transmuxPipeline_=u;u.type="ts";u.metadataStream=new c.MetadataStream;u.packetStream=new c.TransportPacketStream;u.parseStream=new c.TransportParseStream;u.elementaryStream=new c.ElementaryStream;u.timestampRolloverStream=new c.TimestampRolloverStream;u.adtsStream=new ci;u.h264Stream=new to;u.captionStream=new c.CaptionStream;u.coalesceStream=new y(n,u.metadataStream);u.headOfPipeline=u.packetStream;u.packetStream.pipe(u.parseStream).pipe(u.elementaryStream).pipe(u.timestampRolloverStream);u.timestampRolloverStream.pipe(u.h264Stream);u.timestampRolloverStream.pipe(u.adtsStream);u.timestampRolloverStream.pipe(u.metadataStream).pipe(u.coalesceStream);u.h264Stream.pipe(u.captionStream).pipe(u.coalesceStream);u.elementaryStream.on("data",function(f){var e;if(f.type==="metadata"){for(e=f.tracks.length;e--;)r||f.tracks[e].type!=="video"?t||f.tracks[e].type!=="audio"||(t=f.tracks[e],t.timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime):(r=f.tracks[e],r.timelineStartInfo.baseMediaDecodeTime=i.baseMediaDecodeTime);if(r&&!u.videoSegmentStream){u.coalesceStream.numberOfTracks++;u.videoSegmentStream=new nt(r,n);u.videoSegmentStream.on("timelineStartInfo",function(n){t&&(t.timelineStartInfo=n,u.audioSegmentStream.setEarliestDts(n.dts))});u.videoSegmentStream.on("processedGopsInfo",i.trigger.bind(i,"gopInfo"));u.videoSegmentStream.on("segmentTimingInfo",i.trigger.bind(i,"videoSegmentTimingInfo"));u.videoSegmentStream.on("baseMediaDecodeTime",function(n){t&&u.audioSegmentStream.setVideoBaseMediaDecodeTime(n)});u.videoSegmentStream.on("timingInfo",i.trigger.bind(i,"videoTimingInfo"));u.h264Stream.pipe(u.videoSegmentStream).pipe(u.coalesceStream)}if(t&&!u.audioSegmentStream){u.coalesceStream.numberOfTracks++;u.audioSegmentStream=new w(t,n);u.audioSegmentStream.on("timingInfo",i.trigger.bind(i,"audioTimingInfo"));u.adtsStream.pipe(u.audioSegmentStream).pipe(u.coalesceStream)}i.trigger("trackinfo",{hasAudio:!!t,hasVideo:!!r})}});u.coalesceStream.on("data",this.trigger.bind(this,"data"));u.coalesceStream.on("id3Frame",function(n){n.dispatchType=u.metadataStream.dispatchType;i.trigger("id3Frame",n)});u.coalesceStream.on("caption",this.trigger.bind(this,"caption"));u.coalesceStream.on("done",this.trigger.bind(this,"done"))};this.setBaseMediaDecodeTime=function(i){var u=this.transmuxPipeline_;n.keepOriginalTimestamps||(this.baseMediaDecodeTime=i);t&&(t.timelineStartInfo.dts=undefined,t.timelineStartInfo.pts=undefined,s.clearDtsInfo(t),n.keepOriginalTimestamps||(t.timelineStartInfo.baseMediaDecodeTime=i),u.audioTimestampRolloverStream&&u.audioTimestampRolloverStream.discontinuity());r&&(u.videoSegmentStream&&(u.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=undefined,r.timelineStartInfo.pts=undefined,s.clearDtsInfo(r),u.captionStream.reset(),n.keepOriginalTimestamps||(r.timelineStartInfo.baseMediaDecodeTime=i));u.timestampRolloverStream&&u.timestampRolloverStream.discontinuity()};this.setAudioAppendStart=function(n){t&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(n)};this.setRemux=function(t){var i=this.transmuxPipeline_;n.remux=t;i&&i.coalesceStream&&i.coalesceStream.setRemux(t)};this.alignGopsWith=function(n){r&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(n)};this.push=function(n){if(u){var t=io(n);t&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():t||this.transmuxPipeline_.type==="ts"||this.setupTsPipeline();u=!1}this.transmuxPipeline_.headOfPipeline.push(n)};this.flush=function(){u=!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()}};wt.prototype=new f;var uo={Transmuxer:wt,VideoSegmentStream:nt,AudioSegmentStream:w,AUDIO_PROPERTIES:ai,VIDEO_PROPERTIES:vi,generateVideoSegmentTimingInfo:wu},fo=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},eo=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),oo=function(n,t){t.on("data",function(t){var r=t.initSegment,i;t.initSegment={data:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength};i=t.data;t.data=i.buffer;n.postMessage({action:"data",segment:t,byteOffset:i.byteOffset,byteLength:i.byteLength},[t.data])});if(t.captionStream)t.captionStream.on("data",function(t){n.postMessage({action:"caption",data:t})});t.on("done",function(){n.postMessage({action:"done"})});t.on("gopInfo",function(t){n.postMessage({action:"gopInfo",gopInfo:t})});t.on("videoSegmentTimingInfo",function(t){n.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})})},bu=function(){function n(t,i){fo(this,n);this.options=i||{};this.self=t;this.init()}return eo(n,[{key:"init",value:function(){this.transmuxer&&this.transmuxer.dispose();this.transmuxer=new uo.Transmuxer(this.options);oo(this.self,this.transmuxer)}},{key:"push",value:function(n){var t=new Uint8Array(n.data,n.byteOffset,n.byteLength);this.transmuxer.push(t)}},{key:"reset",value:function(){this.init()}},{key:"setTimestampOffset",value:function(n){var t=n.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(t*9e4))}},{key:"setAudioAppendStart",value:function(n){this.transmuxer.setAudioAppendStart(Math.ceil(n.appendStart*9e4))}},{key:"flush",value:function(){this.transmuxer.flush()}},{key:"resetCaptions",value:function(){this.transmuxer.resetCaptions()}},{key:"alignGopsWith",value:function(n){this.transmuxer.alignGopsWith(n.gopsToAlignWith.slice())}}]),n}(),so=function(n){n.onmessage=function(t){if(t.data.action==="init"&&t.data.options){this.messageHandlers=new bu(n,t.data.options);return}this.messageHandlers||(this.messageHandlers=new bu(n));t.data&&t.data.action&&t.data.action!=="init"&&this.messageHandlers[t.data.action]&&this.messageHandlers[t.data.action](t.data)}};return new so(n)}()}),ttt={videoCodec:"avc1",videoObjectTypeIndicator:".4d400d",audioProfile:"2"},itt=function(n){return n.map(function(n){return n.replace(/avc1\.(\d+)\.(\d+)/i,function(n,t,i){var r=("00"+Number(t).toString(16)).slice(-2),u=("00"+Number(i).toString(16)).slice(-2);return"avc1."+r+"00"+u})})},he=function(){var i=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"",n={codecCount:0},t=void 0;return n.codecCount=i.split(",").length,n.codecCount=n.codecCount||2,t=/(^|\s|,)+(avc[13])([^ ,]*)/i.exec(i),t&&(n.videoCodec=t[2],n.videoObjectTypeIndicator=t[3]),n.audioProfile=/(^|\s|,)+mp4a.[0-9A-Fa-f]+\.([0-9A-Fa-f]+)/i.exec(i),n.audioProfile=n.audioProfile&&n.audioProfile[2],n},lat=function(n){return n.replace(/avc1\.(\d+)\.(\d+)/i,function(n){return itt([n])[0]})},bv=function(n,t,i){return n+"/"+t+'; codecs="'+i.filter(function(n){return!!n}).join(", ")+'"'},aat=function(n){return n.segments&&n.segments.length&&n.segments[0].map?"mp4":"mp2t"},vat=function(n){var t=n.attributes||{};return t.CODECS?he(t.CODECS):ttt},yat=function(n,t){var i,u,r;if(!n.mediaGroups.AUDIO||!t||(i=n.mediaGroups.AUDIO[t],!i))return null;for(u in i)if(r=i[u],r["default"]&&r.playlists)return he(r.playlists[0].attributes.CODECS).audioProfile;return null},pat=function(n,t){var s=aat(t),u=vat(t),h=t.attributes||{},f=!0,c=!1,e,l,r;if(!t)return[];if(n.mediaGroups.AUDIO&&h.AUDIO&&(e=n.mediaGroups.AUDIO[h.AUDIO],e)){c=!0;f=!1;for(l in e)if(!e[l].uri&&!e[l].playlists){f=!0;break}}c&&!u.audioProfile&&(f||(u.audioProfile=yat(n,h.AUDIO)),u.audioProfile||(i.log.warn("Multiple audio tracks present but no audio codec string is specified. Attempting to use the default audio codec (mp4a.40.2)"),u.audioProfile=ttt.audioProfile));r={};u.videoCodec&&(r.video=""+u.videoCodec+u.videoObjectTypeIndicator);u.audioProfile&&(r.audio="mp4a.40."+u.audioProfile);var o=bv("audio",s,[r.audio]),v=bv("video",s,[r.video]),a=bv("video",s,[r.video,r.audio]);return c?!f&&r.video?[v,o]:!f&&!r.video?[o,o]:[a,o]:r.video?[a]:[o]},rtt=function(n){var t={type:"",parameters:{}},i=n.trim().split(";");return t.type=i.shift().trim(),i.forEach(function(n){var i=n.trim().split("="),r,u;i.length>1&&(r=i[0].replace(/"/g,"").trim(),u=i[1].replace(/"/g,"").trim(),t.parameters[r]=u)}),t},kv=function(n){return/mp4a\.\d+.\d+/i.test(n)},dv=function(n){return/avc1\.[\da-f]+/i.test(n)},wat=function(n,t,i){if(typeof t=="undefined"||t===null||!n.length)return[];for(var u=Math.ceil((t-i+3)*9e4),r=void 0,r=0;r<n.length;r++)if(n[r].pts>u)break;return n.slice(r)},bat=function(n,t,i){if(!t.length)return n;if(i)return t.slice();var u=t[0].pts,r=0;for(r;r<n.length;r++)if(n[r].pts>=u)break;return n.slice(0,r).concat(t)},kat=function(n,t,i,r){for(var o=Math.ceil((t-r)*9e4),s=Math.ceil((i-r)*9e4),e=n.slice(),f=n.length,u;f--;)if(n[f].pts<=s)break;if(f===-1)return e;for(u=f+1;u--;)if(n[u].pts<=o)break;return u=Math.max(u,0),e.splice(u,f-u+1),e},dat=function(n,t,r){var e=null,o=null,s=0,f=[],l=[];if(!n&&!t)return i.createTimeRange();if(!n)return t.buffered;if(!t||r)return n.buffered;if(n.buffered.length===0&&t.buffered.length===0)return i.createTimeRange();for(var h=n.buffered,c=t.buffered,u=h.length;u--;)f.push({time:h.start(u),type:"start"}),f.push({time:h.end(u),type:"end"});for(u=c.length;u--;)f.push({time:c.start(u),type:"start"}),f.push({time:c.end(u),type:"end"});for(f.sort(function(n,t){return n.time-t.time}),u=0;u<f.length;u++)f[u].type==="start"?(s++,s===2&&(e=f[u].time)):f[u].type==="end"&&(s--,s===1&&(o=f[u].time)),e!==null&&o!==null&&(l.push([e,o]),e=null,o=null);return i.createTimeRanges(l)},rf=9e4,gat=function(n,t){var i=n.addSourceBuffer(t),r=Object.create(null),u,f;r.updating=!1;r.realBuffer_=i;u=function(n){typeof i[n]=="function"?r[n]=function(){return i[n].apply(i,arguments)}:typeof r[n]=="undefined"&&Object.defineProperty(r,n,{get:function(){return i[n]},set:function(t){return i[n]=t}})};for(f in i)u(f);return r},nvt=function(n){function t(n,r){var u,f;return ii(this,t),u=oi(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,i.EventTarget)),u.timestampOffset_=0,u.pendingBuffers_=[],u.bufferUpdating_=!1,u.mediaSource_=n,u.codecs_=r,u.audioCodec_=null,u.videoCodec_=null,u.audioDisabled_=!1,u.appendAudioInitSegment_=!0,u.gopBuffer_=[],u.timeMapping_=0,u.safeAppend_=i.browser.IE_VERSION>=11,f={remux:!1,alignGopsAtEnd:u.safeAppend_},u.codecs_.forEach(function(n){kv(n)?u.audioCodec_=n:dv(n)&&(u.videoCodec_=n)}),u.transmuxer_=new cat,u.transmuxer_.postMessage({action:"init",options:f}),u.transmuxer_.onmessage=function(n){return n.data.action==="data"?u.data_(n):n.data.action==="done"?u.done_(n):n.data.action==="gopInfo"?u.appendGopInfo_(n):n.data.action==="videoSegmentTimingInfo"?u.videoSegmentTimingInfo_(n.data.videoSegmentTimingInfo):void 0},Object.defineProperty(u,"timestampOffset",{get:function(){return this.timestampOffset_},set:function(n){typeof n=="number"&&n>=0&&(this.timestampOffset_=n,this.appendAudioInitSegment_=!0,this.gopBuffer_.length=0,this.timeMapping_=0,this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:n}))}}),Object.defineProperty(u,"appendWindowStart",{get:function(){return(this.videoBuffer_||this.audioBuffer_).appendWindowStart},set:function(n){this.videoBuffer_&&(this.videoBuffer_.appendWindowStart=n);this.audioBuffer_&&(this.audioBuffer_.appendWindowStart=n)}}),Object.defineProperty(u,"updating",{get:function(){return!!(this.bufferUpdating_||!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.updating||this.videoBuffer_&&this.videoBuffer_.updating)}}),Object.defineProperty(u,"buffered",{get:function(){return dat(this.videoBuffer_,this.audioBuffer_,this.audioDisabled_)}}),u}return yi(t,n),ui(t,[{key:"data_",value:function(n){var t=n.data.segment;t.data=new Uint8Array(t.data,n.data.byteOffset,n.data.byteLength);t.initSegment=new Uint8Array(t.initSegment.data,t.initSegment.byteOffset,t.initSegment.byteLength);uat(this,this.mediaSource_,t);this.pendingBuffers_.push(t);return}},{key:"done_",value:function(){if(this.mediaSource_.readyState==="closed"){this.pendingBuffers_.length=0;return}this.processPendingSegments_();return}},{key:"videoSegmentTimingInfo_",value:function(n){var t={start:{decode:n.start.dts/rf,presentation:n.start.pts/rf},end:{decode:n.end.dts/rf,presentation:n.end.pts/rf},baseMediaDecodeTime:n.baseMediaDecodeTime/rf};n.prependedContentDuration&&(t.prependedContentDuration=n.prependedContentDuration/rf);this.trigger({type:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}},{key:"createRealSourceBuffers_",value:function(){var n=this,t=["audio","video"];t.forEach(function(i){var r,u,f;n[i+"Codec_"]&&(n[i+"Buffer_"]||(r=null,n.mediaSource_[i+"Buffer_"]?(r=n.mediaSource_[i+"Buffer_"],r.updating=!1):(u=i+"Codec_",f=i+'/mp4;codecs="'+n[u]+'"',r=gat(n.mediaSource_.nativeMediaSource_,f),n.mediaSource_[i+"Buffer_"]=r),n[i+"Buffer_"]=r,["update","updatestart","updateend"].forEach(function(u){r.addEventListener(u,function(){if(i!=="audio"||!n.audioDisabled_){u==="updateend"&&(n[i+"Buffer_"].updating=!1);var r=t.every(function(t){return t==="audio"&&n.audioDisabled_?!0:i!==t&&n[t+"Buffer_"]&&n[t+"Buffer_"].updating?!1:!0});if(r)return n.trigger(u)}})})))})}},{key:"appendBuffer",value:function(n){if(this.bufferUpdating_=!0,this.audioBuffer_&&this.audioBuffer_.buffered.length){var t=this.audioBuffer_.buffered;this.transmuxer_.postMessage({action:"setAudioAppendStart",appendStart:t.end(t.length-1)})}this.videoBuffer_&&this.transmuxer_.postMessage({action:"alignGopsWith",gopsToAlignWith:wat(this.gopBuffer_,this.mediaSource_.player_?this.mediaSource_.player_.currentTime():null,this.timeMapping_)});this.transmuxer_.postMessage({action:"push",data:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength},[n.buffer]);this.transmuxer_.postMessage({action:"flush"})}},{key:"appendGopInfo_",value:function(n){this.gopBuffer_=bat(this.gopBuffer_,n.data.gopInfo,this.safeAppend_)}},{key:"remove",value:function(n,t){if(this.videoBuffer_&&(this.videoBuffer_.updating=!0,this.videoBuffer_.remove(n,t),this.gopBuffer_=kat(this.gopBuffer_,n,t,this.timeMapping_)),!this.audioDisabled_&&this.audioBuffer_&&(this.audioBuffer_.updating=!0,this.audioBuffer_.remove(n,t)),gu(n,t,this.metadataTrack_),this.inbandTextTracks_)for(var i in this.inbandTextTracks_)gu(n,t,this.inbandTextTracks_[i])}},{key:"processPendingSegments_",value:function(){var n={video:{segments:[],bytes:0},audio:{segments:[],bytes:0},captions:[],metadata:[]},t;if(!this.pendingBuffers_.length){this.trigger("updateend");this.bufferUpdating_=!1;return}n=this.pendingBuffers_.reduce(function(n,t){var i=t.type,r=t.data,u=t.initSegment;return n[i].segments.push(r),n[i].bytes+=r.byteLength,n[i].initSegment=u,t.captions&&(n.captions=n.captions.concat(t.captions)),t.info&&(n[i].info=t.info),t.metadata&&(n.metadata=n.metadata.concat(t.metadata)),n},n);this.videoBuffer_||this.audioBuffer_||(n.video.bytes===0&&(this.videoCodec_=null),n.audio.bytes===0&&(this.audioCodec_=null),this.createRealSourceBuffers_());n.audio.info&&this.mediaSource_.trigger({type:"audioinfo",info:n.audio.info});n.video.info&&this.mediaSource_.trigger({type:"videoinfo",info:n.video.info});this.appendAudioInitSegment_&&(!this.audioDisabled_&&this.audioBuffer_&&(n.audio.segments.unshift(n.audio.initSegment),n.audio.bytes+=n.audio.initSegment.byteLength),this.appendAudioInitSegment_=!1);t=!1;this.videoBuffer_&&n.video.bytes?(n.video.segments.unshift(n.video.initSegment),n.video.bytes+=n.video.initSegment.byteLength,this.concatAndAppendSegments_(n.video,this.videoBuffer_)):this.videoBuffer_&&(this.audioDisabled_||!this.audioBuffer_)&&(t=!0);eat(this,n.captions,n.metadata);!this.audioDisabled_&&this.audioBuffer_&&this.concatAndAppendSegments_(n.audio,this.audioBuffer_);this.pendingBuffers_.length=0;t&&this.trigger("updateend");this.bufferUpdating_=!1}},{key:"concatAndAppendSegments_",value:function(n,t){var r=0,i=void 0;if(n.bytes){i=new Uint8Array(n.bytes);n.segments.forEach(function(n){i.set(n,r);r+=n.byteLength});try{t.updating=!0;t.appendBuffer(i)}catch(u){this.mediaSource_.player_&&this.mediaSource_.player_.error({code:-3,type:"APPEND_BUFFER_ERR",message:u.message,originalError:u})}}}},{key:"abort",value:function(){this.videoBuffer_&&this.videoBuffer_.abort();!this.audioDisabled_&&this.audioBuffer_&&this.audioBuffer_.abort();this.transmuxer_&&this.transmuxer_.postMessage({action:"reset"});this.pendingBuffers_.length=0;this.bufferUpdating_=!1}}]),t}(i.EventTarget),gv=function(r){function u(){ii(this,u);var r=oi(this,(u.__proto__||Object.getPrototypeOf(u)).call(this)),f=void 0;r.nativeMediaSource_=new n.MediaSource;for(f in r.nativeMediaSource_)f in u.prototype||typeof r.nativeMediaSource_[f]!="function"||(r[f]=r.nativeMediaSource_[f].bind(r.nativeMediaSource_));r.duration_=NaN;Object.defineProperty(r,"duration",{get:function(){return this.duration_===Infinity?this.duration_:this.nativeMediaSource_.duration},set:function(n){if(this.duration_=n,n!==Infinity){this.nativeMediaSource_.duration=n;return}}});Object.defineProperty(r,"seekable",{get:function(){return this.duration_===Infinity?i.createTimeRanges([[0,this.nativeMediaSource_.duration]]):this.nativeMediaSource_.seekable}});Object.defineProperty(r,"readyState",{get:function(){return this.nativeMediaSource_.readyState}});Object.defineProperty(r,"activeSourceBuffers",{get:function(){return this.activeSourceBuffers_}});r.sourceBuffers=[];r.activeSourceBuffers_=[];r.updateActiveSourceBuffers_=function(){var n,u,t,i,f;if(r.activeSourceBuffers_.length=0,r.sourceBuffers.length===1){n=r.sourceBuffers[0];n.appendAudioInitSegment_=!0;n.audioDisabled_=!n.audioCodec_;r.activeSourceBuffers_.push(n);return}for(u=!1,t=!0,i=0;i<r.player_.audioTracks().length;i++)if(f=r.player_.audioTracks()[i],f.enabled&&f.kind!=="main"){u=!0;t=!1;break}r.sourceBuffers.forEach(function(n,i){if(n.appendAudioInitSegment_=!0,n.videoCodec_&&n.audioCodec_)n.audioDisabled_=u;else if(n.videoCodec_&&!n.audioCodec_)n.audioDisabled_=!0,t=!1;else if(!n.videoCodec_&&n.audioCodec_&&(n.audioDisabled_=i?t:!t,n.audioDisabled_))return;r.activeSourceBuffers_.push(n)})};r.onPlayerMediachange_=function(){r.sourceBuffers.forEach(function(n){n.appendAudioInitSegment_=!0})};r.onHlsReset_=function(){r.sourceBuffers.forEach(function(n){n.transmuxer_&&n.transmuxer_.postMessage({action:"resetCaptions"})})};r.onHlsSegmentTimeMapping_=function(n){r.sourceBuffers.forEach(function(t){return t.timeMapping_=n.mapping})};["sourceopen","sourceclose","sourceended"].forEach(function(n){this.nativeMediaSource_.addEventListener(n,this.trigger.bind(this))},r);r.on("sourceopen",function(){var n=t.querySelector('[src="'+r.url_+'"]');if(n&&(r.player_=i(n.parentNode),r.player_)){r.player_.tech_.on("hls-reset",r.onHlsReset_);r.player_.tech_.on("hls-segment-time-mapping",r.onHlsSegmentTimeMapping_);if(r.player_.audioTracks&&r.player_.audioTracks()){r.player_.audioTracks().on("change",r.updateActiveSourceBuffers_);r.player_.audioTracks().on("addtrack",r.updateActiveSourceBuffers_);r.player_.audioTracks().on("removetrack",r.updateActiveSourceBuffers_)}r.player_.on("mediachange",r.onPlayerMediachange_)}});r.on("sourceended",function(){for(var i,n,u=dn(r.duration),t=0;t<r.sourceBuffers.length;t++)i=r.sourceBuffers[t],n=i.metadataTrack_&&i.metadataTrack_.cues,n&&n.length&&(n[n.length-1].endTime=u)});r.on("sourceclose",function(){(this.sourceBuffers.forEach(function(n){n.transmuxer_&&n.transmuxer_.terminate()}),this.sourceBuffers.length=0,this.player_)&&(this.player_.audioTracks&&this.player_.audioTracks()&&(this.player_.audioTracks().off("change",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("addtrack",this.updateActiveSourceBuffers_),this.player_.audioTracks().off("removetrack",this.updateActiveSourceBuffers_)),this.player_.el_&&this.player_.off("mediachange",this.onPlayerMediachange_),this.player_.tech_&&this.player_.tech_.el_&&(this.player_.tech_.off("hls-reset",this.onHlsReset_),this.player_.tech_.off("hls-segment-time-mapping",this.onHlsSegmentTimeMapping_)))});return r}return yi(u,r),ui(u,[{key:"addSeekableRange_",value:function(n,t){var i=void 0;if(this.duration!==Infinity){i=new Error("MediaSource.addSeekableRange() can only be invoked when the duration is Infinity");i.name="InvalidStateError";i.code=11;throw i;}(t>this.nativeMediaSource_.duration||isNaN(this.nativeMediaSource_.duration))&&(this.nativeMediaSource_.duration=t)}},{key:"addSourceBuffer",value:function(n){var i=void 0,r=rtt(n),t;return/^(video|audio)\/mp2t$/i.test(r.type)?(t=[],r.parameters&&r.parameters.codecs&&(t=r.parameters.codecs.split(","),t=itt(t),t=t.filter(function(n){return kv(n)||dv(n)})),t.length===0&&(t=["avc1.4d400d","mp4a.40.2"]),i=new nvt(this,t),this.sourceBuffers.length!==0&&(this.sourceBuffers[0].createRealSourceBuffers_(),i.createRealSourceBuffers_(),this.sourceBuffers[0].audioDisabled_=!0)):i=this.nativeMediaSource_.addSourceBuffer(n),this.sourceBuffers.push(i),i}}]),u}(i.EventTarget),utt=0;i.mediaSources={};var ftt=function(n,t){var r=i.mediaSources[n];if(r)r.trigger({type:"sourceopen",swfId:t});else throw new Error("Media Source not found (Video.js)");},ny=function(){return!!n.MediaSource&&!!n.MediaSource.isTypeSupported&&n.MediaSource.isTypeSupported('video/mp4;codecs="avc1.4d400d,mp4a.40.2"')},ce=function(){if(this.MediaSource={open:ftt,supportsNativeMediaSources:ny},ny())return new gv;throw new Error("Cannot use create a virtual MediaSource for this video");};ce.open=ftt;ce.supportsNativeMediaSources=ny;ty={createObjectURL:function(t){var r=void 0;return t instanceof gv?(r=n.URL.createObjectURL(t.nativeMediaSource_),t.url_=r,r):(t instanceof gv)?(r="blob:vjs-media-source/"+utt,utt++,i.mediaSources[r]=t,r):(r=n.URL.createObjectURL(t),t.url_=r,r)}};i.MediaSource=ce;i.URL=ty;var tvt=i.EventTarget,ett=i.mergeOptions,ott=function(n,t){for(var f,r=void 0,i=ett(n,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod}),u=0;u<t.playlists.length;u++)f=hv(i,t.playlists[u]),f?i=f:r=!0;return(uh(t,function(n,t,u,f){if(n.playlists&&n.playlists.length){var o=n.playlists[0].uri,e=hv(i,n.playlists[0]);e&&(i=e,i.mediaGroups[t][u][f].playlists[0]=i.playlists[o],r=!1)}}),r)?null:i},iy=function(n){var t=n.byterange.offset+n.byterange.length-1;return n.uri+"-"+n.byterange.offset+"-"+t},ivt=function(n,t){var i=Boolean(!n.map&&!t.map),r=i||Boolean(n.map&&t.map&&n.map.byterange.offset===t.map.byterange.offset&&n.map.byterange.length===t.map.byterange.length);return r&&n.uri===t.uri&&n.byterange.offset===t.byterange.offset&&n.byterange.length===t.byterange.length},stt=function(n,t){var u={},f,e,r,i,o;for(f in n)if(e=n[f],r=e.sidx,r){if(i=iy(r),!t[i])break;o=t[i].sidxInfo;ivt(o,r)&&(u[i]=t[i])}return u},rvt=function(n,t,i,r){var f=dd(n,{manifestUri:t,clientOffset:i}),e=stt(f.playlists,r),u=e;return uh(f,function(n){if(n.playlists&&n.playlists.length){var t=n.playlists;u=ett(u,stt(t,r))}}),u},htt=function(n,t,r,u,f){var e={uri:rh(u.handleManifestRedirects,n.resolvedUri),byterange:n.byterange,playlist:t},o=i.mergeOptions(e,{responseType:"arraybuffer",headers:av(e)});return r(o,f)},ry=function(t){function i(n,t){var u=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},o=arguments[3];ii(this,i);var r=oi(this,(i.__proto__||Object.getPrototypeOf(i)).call(this)),f=u.withCredentials,s=f===undefined?!1:f,e=u.handleManifestRedirects,h=e===undefined?!1:e;if(r.hls_=t,r.withCredentials=s,r.handleManifestRedirects=h,!n)throw new Error("A non-empty playlist URL or playlist is required");r.on("minimumUpdatePeriod",function(){r.refreshXml_()});r.on("mediaupdatetimeout",function(){r.refreshMedia_(r.media().uri)});return(r.state="HAVE_NOTHING",r.loadedPlaylists_={},typeof n=="string")?(r.srcUrl=n,r.sidxMapping_={},oi(r)):(r.setupChildLoader(o,n),r)}return yi(i,t),ui(i,[{key:"setupChildLoader",value:function(n,t){this.masterPlaylistLoader_=n;this.childPlaylist_=t}},{key:"dispose",value:function(){this.stopRequest();this.loadedPlaylists_={};n.clearTimeout(this.minimumUpdatePeriodTimeout_);n.clearTimeout(this.mediaRequest_);n.clearTimeout(this.mediaUpdateTimeout)}},{key:"hasPendingRequest",value:function(){return this.request||this.mediaRequest_}},{key:"stopRequest",value:function(){if(this.request){var n=this.request;this.request=null;n.onreadystatechange=null;n.abort()}}},{key:"sidxRequestFinished_",value:function(n,t,i,r){var u=this;return function(f,e){if(u.request){if(u.request=null,f)return u.error={status:e.status,message:"DASH playlist request error at URL: "+n.uri,response:e.response,code:2},i&&(u.state=i),u.trigger("error"),r(t,null);var o=new Uint8Array(e.response),s=l.parseSidx(o.subarray(8));return r(t,s)}}}},{key:"media",value:function(t){var o=this,r,u,f,i,e;if(!t)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(r=this.state,typeof t=="string"){if(!this.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.master.playlists[t]}if(u=!this.media_||t.uri!==this.media_.uri,u&&this.loadedPlaylists_[t.uri]&&this.loadedPlaylists_[t.uri].endList){this.state="HAVE_METADATA";this.media_=t;u&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}if(u){if(this.media_&&this.trigger("mediachanging"),!t.sidx){this.mediaRequest_=n.setTimeout(this.haveMetadata.bind(this,{startingState:r,playlist:t}),0);return}f=void 0;i=void 0;this.masterPlaylistLoader_?(f=this.masterPlaylistLoader_.master,i=this.masterPlaylistLoader_.sidxMapping_):(f=this.master,i=this.sidxMapping_);e=iy(t.sidx);i[e]={sidxInfo:t.sidx};this.request=htt(t.sidx,t,this.hls_.xhr,{handleManifestRedirects:this.handleManifestRedirects},this.sidxRequestFinished_(t,f,r,function(n,u){if(!n||!u)throw new Error("failed to request sidx");i[e].sidx=u;o.haveMetadata({startingState:r,playlist:n.playlists[t.uri]})}))}}},{key:"haveMetadata",value:function(n){var i=n.startingState,t=n.playlist;this.state="HAVE_METADATA";this.loadedPlaylists_[t.uri]=t;this.mediaRequest_=null;this.refreshMedia_(t.uri);i==="HAVE_MASTER"?this.trigger("loadedmetadata"):this.trigger("mediachange")}},{key:"pause",value:function(){this.stopRequest();n.clearTimeout(this.mediaUpdateTimeout);n.clearTimeout(this.minimumUpdatePeriodTimeout_);this.state==="HAVE_NOTHING"&&(this.started=!1)}},{key:"load",value:function(t){var u=this,i,r;if(n.clearTimeout(this.mediaUpdateTimeout),n.clearTimeout(this.minimumUpdatePeriodTimeout_),i=this.media(),t){r=i?i.targetDuration*500:5e3;this.mediaUpdateTimeout=n.setTimeout(function(){return u.load()},r);return}if(!this.started){this.start();return}this.trigger("loadedplaylist")}},{key:"parseMasterXml",value:function(){var n=dd(this.masterXml_,{manifestUri:this.srcUrl,clientOffset:this.clientOffset_,sidxMapping:this.sidxMapping_}),t,i;for(n.uri=this.srcUrl,t=0;t<n.playlists.length;t++)i="placeholder-uri-"+t,n.playlists[t].uri=i,n.playlists[i]=n.playlists[t];return uh(n,function(t,i,r,u){if(t.playlists&&t.playlists.length){var f="placeholder-uri-"+i+"-"+r+"-"+u;t.playlists[0].uri=f;n.playlists[f]=t.playlists[0]}}),bg(n),kg(n),n}},{key:"start",value:function(){var t=this;if(this.started=!0,this.masterPlaylistLoader_){this.mediaRequest_=n.setTimeout(this.haveMaster_.bind(this),0);return}this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(n,i){if(t.request){if(t.request=null,n)return t.error={status:i.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:i.responseText,code:2},t.state==="HAVE_NOTHING"&&(t.started=!1),t.trigger("error");t.masterXml_=i.responseText;t.masterLoaded_=i.responseHeaders&&i.responseHeaders.date?Date.parse(i.responseHeaders.date):Date.now();t.srcUrl=rh(t.handleManifestRedirects,t.srcUrl,i);t.syncClientServerClock_(t.onClientServerClockSync_.bind(t))}})}},{key:"syncClientServerClock_",value:function(n){var i=this,t=dot(this.masterXml_);if(t===null)return this.clientOffset_=this.masterLoaded_-Date.now(),n();if(t.method==="DIRECT")return this.clientOffset_=t.value-Date.now(),n();this.request=this.hls_.xhr({uri:br(this.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},function(r,u){if(i.request){if(r)return i.clientOffset_=i.masterLoaded_-Date.now(),n();var f=void 0;f=t.method==="HEAD"?u.responseHeaders&&u.responseHeaders.date?Date.parse(u.responseHeaders.date):i.masterLoaded_:Date.parse(u.responseText);i.clientOffset_=f-Date.now();n()}})}},{key:"haveMaster_",value:function(){this.state="HAVE_MASTER";this.mediaRequest_=null;this.masterPlaylistLoader_?this.media_||this.media(this.childPlaylist_):(this.master=this.parseMasterXml(),this.trigger("loadedplaylist"))}},{key:"onClientServerClockSync_",value:function(){var t=this;this.haveMaster_();this.hasPendingRequest()||this.media_||this.media(this.master.playlists[0]);this.master&&this.master.minimumUpdatePeriod&&(this.minimumUpdatePeriodTimeout_=n.setTimeout(function(){t.trigger("minimumUpdatePeriod")},this.master.minimumUpdatePeriod))}},{key:"refreshXml_",value:function(){var t=this;this.request=this.hls_.xhr({uri:this.srcUrl,withCredentials:this.withCredentials},function(i,r){var f,u;if(t.request){if(t.request=null,i)return t.error={status:r.status,message:"DASH playlist request error at URL: "+t.srcUrl,responseText:r.responseText,code:2},t.state==="HAVE_NOTHING"&&(t.started=!1),t.trigger("error");t.masterXml_=r.responseText;t.sidxMapping_=rvt(t.masterXml_,t.srcUrl,t.clientOffset_,t.sidxMapping_);var e=t.parseMasterXml(),o=ott(t.master,e),s=t.media().sidx;o&&(s?(f=iy(s),t.sidxMapping_[f]||(u=t.media(),t.request=htt(u.sidx,u,t.hls_.xhr,{handleManifestRedirects:t.handleManifestRedirects},t.sidxRequestFinished_(u,e,t.state,function(i,r){if(!i||!r)throw new Error("failed to request sidx on minimumUpdatePeriod");t.sidxMapping_[f].sidx=r;t.minimumUpdatePeriodTimeout_=n.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod);t.refreshMedia_(t.media().uri);return})))):t.master=o);t.minimumUpdatePeriodTimeout_=n.setTimeout(function(){t.trigger("minimumUpdatePeriod")},t.master.minimumUpdatePeriod)}})}},{key:"refreshMedia_",value:function(t){var f=this,u,r,i;if(!t)throw new Error("refreshMedia_ must take a media uri");u=void 0;r=void 0;this.masterPlaylistLoader_?(u=this.masterPlaylistLoader_.master,r=this.masterPlaylistLoader_.parseMasterXml()):(u=this.master,r=this.parseMasterXml());i=ott(u,r);i?(this.masterPlaylistLoader_?this.masterPlaylistLoader_.master=i:this.master=i,this.media_=i.playlists[t]):(this.media_=r.playlists[t],this.trigger("playlistunchanged"));this.media().endList||(this.mediaUpdateTimeout=n.setTimeout(function(){f.trigger("mediaupdatetimeout")},dg(this.media(),!!i)));this.trigger("loadedplaylist")}}]),i}(tvt),le=function(n){return i.log.debug?i.log.debug.bind(i,"VHS:",n+" >"):function(){}};var uvt=function(){function n(t,i,r,u){ii(this,n);this.callbacks_=[];this.pendingCallback_=null;this.timestampOffset_=0;this.mediaSource=t;this.processedAppend_=!1;this.type_=r;this.mimeType_=i;this.logger_=le("SourceUpdater["+r+"]["+i+"]");t.readyState==="closed"?t.addEventListener("sourceopen",this.createSourceBuffer_.bind(this,i,u)):this.createSourceBuffer_(i,u)}return ui(n,[{key:"createSourceBuffer_",value:function(n,t){var i=this;if(this.sourceBuffer_=this.mediaSource.addSourceBuffer(n),this.logger_("created SourceBuffer"),t&&(t.trigger("sourcebufferadded"),this.mediaSource.sourceBuffers.length<2)){t.on("sourcebufferadded",function(){i.start_()});return}this.start_()}},{key:"start_",value:function(){var n=this;this.started_=!0;this.onUpdateendCallback_=function(){var t=n.pendingCallback_;n.pendingCallback_=null;n.sourceBuffer_.removing=!1;n.logger_("buffered ["+vv(n.buffered())+"]");t&&t();n.runCallback_()};this.sourceBuffer_.addEventListener("updateend",this.onUpdateendCallback_);this.runCallback_()}},{key:"abort",value:function(n){var t=this;this.processedAppend_&&this.queueCallback_(function(){t.sourceBuffer_.abort()},n)}},{key:"appendBuffer",value:function(n,t){var i=this;this.processedAppend_=!0;this.queueCallback_(function(){n.videoSegmentTimingInfoCallback&&i.sourceBuffer_.addEventListener("videoSegmentTimingInfo",n.videoSegmentTimingInfoCallback);i.sourceBuffer_.appendBuffer(n.bytes)},function(){n.videoSegmentTimingInfoCallback&&i.sourceBuffer_.removeEventListener("videoSegmentTimingInfo",n.videoSegmentTimingInfoCallback);t()})}},{key:"buffered",value:function(){return this.sourceBuffer_?this.sourceBuffer_.buffered:i.createTimeRanges()}},{key:"remove",value:function(n,t){var i=this,r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:uf;this.processedAppend_&&this.queueCallback_(function(){i.logger_("remove ["+n+" => "+t+"]");i.sourceBuffer_.removing=!0;i.sourceBuffer_.remove(n,t)},r)}},{key:"updating",value:function(){return!this.sourceBuffer_||this.sourceBuffer_.updating||!!this.pendingCallback_&&this.pendingCallback_!==uf}},{key:"timestampOffset",value:function(n){var t=this;return typeof n!="undefined"&&(this.queueCallback_(function(){t.sourceBuffer_.timestampOffset=n;t.runCallback_()}),this.timestampOffset_=n),this.timestampOffset_}},{key:"queueCallback_",value:function(n,t){this.callbacks_.push([n.bind(this),t]);this.runCallback_()}},{key:"runCallback_",value:function(){var n=void 0;!this.updating()&&this.callbacks_.length&&this.started_&&(n=this.callbacks_.shift(),this.pendingCallback_=n[1],n[0]())}},{key:"dispose",value:function(){var n=this,t=function t(){n.sourceBuffer_&&n.mediaSource.readyState==="open"&&n.sourceBuffer_.abort();n.sourceBuffer_.removeEventListener("updateend",t)};this.sourceBuffer_.removeEventListener("updateend",this.onUpdateendCallback_);this.sourceBuffer_.removing?this.sourceBuffer_.addEventListener("updateend",t):t()}}]),n}(),bt={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,BUFFER_LOW_WATER_LINE_RATE:1},nr={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ctt=function(n){n.forEach(function(n){n.abort()})},fvt=function(n){return{bandwidth:n.bandwidth,bytesReceived:n.bytesReceived||0,roundTripTime:n.roundTripTime||0}},evt=function(n){var i=n.target,r=Date.now()-i.requestTime,t={bandwidth:Infinity,bytesReceived:0,roundTripTime:r||0};return t.bytesReceived=n.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8e3),t},uy=function(n,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:nr.TIMEOUT,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:nr.ABORTED,xhr:t}:n?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:nr.FAILURE,xhr:t}:null},ovt=function(n,t){return function(i,r){var f=r.response,e=uy(i,r),u;return e?t(e,n):f.byteLength!==16?t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:nr.FAILURE,xhr:r},n):(u=new DataView(f),n.key.bytes=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]),t(null,n))}},svt=function(n,t,i){return function(r,u){var e=u.response,f=uy(r,u);return f?i(f,n):e.byteLength===0?i({status:u.status,message:"Empty HLS segment content at URL: "+u.uri,code:nr.FAILURE,xhr:u},n):(n.map.bytes=new Uint8Array(u.response),t&&!t.isInitialized()&&t.init(),n.map.timescales=vi.timescale(n.map.bytes),n.map.videoTrackIds=vi.videoTrackIds(n.map.bytes),i(null,n))}},hvt=function(n,t,i){return function(r,u){var o=u.response,e=uy(r,u),f=void 0;return e?i(e,n):o.byteLength===0?i({status:u.status,message:"Empty HLS segment content at URL: "+u.uri,code:nr.FAILURE,xhr:u},n):(n.stats=fvt(u),n.key?n.encryptedBytes=new Uint8Array(u.response):n.bytes=new Uint8Array(u.response),t&&n.map&&n.map.bytes&&(t.isInitialized()||t.init(),f=t.parse(n.bytes,n.map.videoTrackIds,n.map.timescales),f&&f.captions&&(n.captionStreams=f.captionStreams,n.fmp4Captions=f.captions)),i(null,n))}},cvt=function(n,t,i){var u=function u(r){if(r.data.source===t.requestId){n.removeEventListener("message",u);var f=r.data.decrypted;return t.bytes=new Uint8Array(f.bytes,f.byteOffset,f.byteLength),i(null,t)}},r;n.addEventListener("message",u);r=void 0;r=t.key.bytes.slice?t.key.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.key.bytes));n.postMessage(cn({source:t.requestId,encrypted:t.encryptedBytes,key:r,iv:t.key.iv}),[t.encryptedBytes.buffer,r.buffer])},lvt=function(n,t,i){var r=0,u=!1;return function(f,e){if(!u)return f?(u=!0,ctt(n),i(f,e)):(r+=1,r===n.length?(e.endOfAllRequests=Date.now(),e.encryptedBytes)?cvt(t,e,i):i(null,e):void 0)}},avt=function(n,t){return function(r){return n.stats=i.mergeOptions(n.stats,evt(r)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),t(r,n)}},vvt=function(n,t,r,u,f,e,o){var s=[],h=lvt(s,r,o);if(f.key&&!f.key.bytes){var l=i.mergeOptions(t,{uri:f.key.resolvedUri,responseType:"arraybuffer"}),a=ovt(f,h),v=n(l,a);s.push(v)}if(f.map&&!f.map.bytes){var y=i.mergeOptions(t,{uri:f.map.resolvedUri,responseType:"arraybuffer",headers:av(f.map)}),p=svt(f,u,h),w=n(y,p);s.push(w)}var b=i.mergeOptions(t,{uri:f.resolvedUri,responseType:"arraybuffer",headers:av(f)}),k=hvt(f,u,h),c=n(b,k);return c.addEventListener("progress",avt(f,e)),s.push(c),function(){return ctt(s)}},ltt=function(t,i){var r=void 0;return t?(r=n.getComputedStyle(t),!r)?"":r[i]:""},ae=function(n,t){var i=n.slice();n.sort(function(n,r){var u=t(n,r);return u===0?i.indexOf(n)-i.indexOf(r):u})},fy=function(t,i){var r=void 0,u=void 0;return t.attributes.BANDWIDTH&&(r=t.attributes.BANDWIDTH),r=r||n.Number.MAX_VALUE,i.attributes.BANDWIDTH&&(u=i.attributes.BANDWIDTH),u=u||n.Number.MAX_VALUE,r-u},yvt=function(t,i){var r=void 0,u=void 0;return(t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width&&(r=t.attributes.RESOLUTION.width),r=r||n.Number.MAX_VALUE,i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(u=i.attributes.RESOLUTION.width),u=u||n.Number.MAX_VALUE,r===u&&t.attributes.BANDWIDTH&&i.attributes.BANDWIDTH)?t.attributes.BANDWIDTH-i.attributes.BANDWIDTH:r-u},pvt=function(t,i,r,u,f){var e=t.playlists.map(function(t){var r=void 0,u=void 0,i=void 0;return r=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width,u=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.height,i=t.attributes.BANDWIDTH,i=i||n.Number.MAX_VALUE,{bandwidth:i,width:r,height:u,playlist:t}}),o,y,c,l,p;ae(e,function(n,t){return n.bandwidth-t.bandwidth});e=e.filter(function(n){return!vt.isIncompatible(n.playlist)});o=e.filter(function(n){return vt.isEnabled(n.playlist)});o.length||(o=e.filter(function(n){return!vt.isDisabled(n.playlist)}));var h=o.filter(function(n){return n.bandwidth*bt.BANDWIDTH_VARIANCE<i}),s=h[h.length-1],w=h.filter(function(n){return n.bandwidth===s.bandwidth})[0];if(f===!1)return y=w||o[0]||e[0],y?y.playlist:null;c=h.filter(function(n){return n.width&&n.height});ae(c,function(n,t){return n.width-t.width});l=c.filter(function(n){return n.width===r&&n.height===u});s=l[l.length-1];var b=l.filter(function(n){return n.bandwidth===s.bandwidth})[0],a=void 0,v=void 0,k=void 0;return b||(a=c.filter(function(n){return n.width>r||n.height>u}),v=a.filter(function(n){return n.width===a[0].width&&n.height===a[0].height}),s=v[v.length-1],k=v.filter(function(n){return n.bandwidth===s.bandwidth})[0]),p=k||b||w||o[0]||e[0],p?p.playlist:null},wvt=function(){return pvt(this.playlists.master,this.systemBandwidth,parseInt(ltt(this.tech_.el(),"width"),10),parseInt(ltt(this.tech_.el(),"height"),10),this.limitRenditionByPlayerDimensions)},bvt=function(n){var f=n.master,e=n.currentTime,o=n.bandwidth,s=n.duration,h=n.segmentDuration,c=n.timeUntilRebuffer,l=n.currentTimeline,a=n.syncController,u=f.playlists.filter(function(n){return!vt.isIncompatible(n)}),t=u.filter(vt.isEnabled);t.length||(t=u.filter(function(n){return!vt.isDisabled(n)}));var v=t.filter(vt.hasAttribute.bind(null,"BANDWIDTH")),i=v.map(function(n){var t=a.getSyncPoint(n,s,l,e),i=t?1:2,r=vt.estimateSegmentRequestTime(h,o,n),u=r*i-c;return{playlist:n,rebufferingImpact:u}}),r=i.filter(function(n){return n.rebufferingImpact<=0});return(ae(r,function(n,t){return fy(t.playlist,n.playlist)}),r.length)?r[0]:(ae(i,function(n,t){return n.rebufferingImpact-t.rebufferingImpact}),i[0]||null)},kvt=function(){var n=this.playlists.master.playlists.filter(vt.isEnabled),t;return ae(n,function(n,t){return fy(n,t)}),t=n.filter(function(n){return he(n.attributes.CODECS).videoCodec}),t[0]||null},dvt=function(n,t,i){var r,u;for(r in i)n[r]||(t.trigger({type:"usage",name:"hls-608"}),u=t.textTracks().getTrackById(r),n[r]=u?u:t.addRemoteTextTrack({kind:"captions",id:r,label:r},!1).track)},gvt=function(n){var t=n.inbandTextTracks,i=n.captionArray,r=n.timestampOffset,u;i&&(u=window.WebKitDataCue||window.VTTCue,i.forEach(function(n){var i=n.stream,f=n.startTime,e=n.endTime;t[i]&&(f+=r,e+=r,t[i].addCue(new u(f,e,n.text)))}))},nyt=500,tyt=function(n,t,i){if(!n||!t)return!1;var r=n.segments,u=i===r.length;return n.endList&&t.readyState==="open"&&u},att=function(n){return typeof n=="number"&&isFinite(n)},iyt=function(n,t,i){return n!=="main"||!t||!i?null:!i.containsAudio&&!i.containsVideo?"Neither audio nor video found in segment.":t.containsVideo&&!i.containsVideo?"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.containsVideo&&i.containsVideo?"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},ryt=function(n,t,i){var r=void 0;return r=n.length&&n.start(0)>0&&n.start(0)<t?n.start(0):t-30,Math.min(r,t-i)},uyt=function(n){var i=n.segment,f=i.start,e=i.end,t=n.playlist,r=t.mediaSequence,o=t.id,u=t.segments,s=u===undefined?[]:u,h=n.mediaIndex,c=n.timeline;return["appending ["+h+"] of ["+r+", "+(r+s.length)+"] from playlist ["+o+"]","["+f+" => "+e+"] in timeline ["+c+"]"].join(" ")},ey=function(t){function r(n){ii(this,r);var t=oi(this,(r.__proto__||Object.getPrototypeOf(r)).call(this));if(!n)throw new TypeError("Initialization settings are required");if(typeof n.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!n.mediaSource)throw new TypeError("No MediaSource specified");t.bandwidth=n.bandwidth;t.throughput={rate:0,count:0};t.roundTrip=NaN;t.resetStats_();t.mediaIndex=null;t.hasPlayed_=n.hasPlayed;t.currentTime_=n.currentTime;t.seekable_=n.seekable;t.seeking_=n.seeking;t.duration_=n.duration;t.mediaSource_=n.mediaSource;t.hls_=n.hls;t.loaderType_=n.loaderType;t.startingMedia_=void 0;t.segmentMetadataTrack_=n.segmentMetadataTrack;t.goalBufferLength_=n.goalBufferLength;t.sourceType_=n.sourceType;t.inbandTextTracks_=n.inbandTextTracks;t.state_="INIT";t.checkBufferTimeout_=null;t.error_=void 0;t.currentTimeline_=-1;t.pendingSegment_=null;t.mimeType_=null;t.sourceUpdater_=null;t.xhrOptions_=null;t.activeInitSegmentId_=null;t.initSegments_={};t.cacheEncryptionKeys_=n.cacheEncryptionKeys;t.keyCache_={};t.captionParser_=t.loaderType_==="main"?new kst:null;t.decrypter_=n.decrypter;t.syncController_=n.syncController;t.syncPoint_={segmentIndex:0,time:0};t.syncController_.on("syncinfoupdate",function(){return t.trigger("syncinfoupdate")});return t.mediaSource_.addEventListener("sourceopen",function(){return t.ended_=!1}),t.fetchAtBuffer_=!1,t.logger_=le("SegmentLoader["+t.loaderType_+"]"),Object.defineProperty(t,"state",{get:function(){return this.state_},set:function(n){n!==this.state_&&(this.logger_(this.state_+" -> "+n),this.state_=n)}}),t}return yi(r,t),ui(r,[{key:"resetStats_",value:function(){this.mediaBytesTransferred=0;this.mediaRequests=0;this.mediaRequestsAborted=0;this.mediaRequestsTimedout=0;this.mediaRequestsErrored=0;this.mediaTransferDuration=0;this.mediaSecondsLoaded=0}},{key:"dispose",value:function(){this.state="DISPOSED";this.pause();this.abort_();this.sourceUpdater_&&this.sourceUpdater_.dispose();this.resetStats_();this.captionParser_&&this.captionParser_.reset()}},{key:"abort",value:function(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_();this.state="READY";this.paused()||this.monitorBuffer_()}},{key:"abort_",value:function(){this.pendingSegment_&&this.pendingSegment_.abortRequests();this.pendingSegment_=null}},{key:"error",value:function(n){return typeof n!="undefined"&&(this.error_=n),this.pendingSegment_=null,this.error_}},{key:"endOfStream",value:function(){this.ended_=!0;this.pause();this.trigger("ended")}},{key:"buffered_",value:function(){return this.sourceUpdater_?this.sourceUpdater_.buffered():i.createTimeRanges()}},{key:"initSegment",value:function(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1,i,t;return n?(i=oh(n),t=this.initSegments_[i],r&&!t&&n.bytes&&(this.initSegments_[i]=t={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:n.bytes,timescales:n.timescales,videoTrackIds:n.videoTrackIds}),t||n):null}},{key:"segmentKey",value:function(n){var u=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1,i,t,r;return n?(i=ln(n),t=this.keyCache_[i],this.cacheEncryptionKeys_&&u&&!t&&n.bytes&&(this.keyCache_[i]=t={resolvedUri:n.resolvedUri,bytes:n.bytes}),r={resolvedUri:(t||n).resolvedUri},t&&(r.bytes=t.bytes),r):null}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&(this.sourceUpdater_||this.mimeType_&&this.state==="INIT")&&!this.paused()}},{key:"load",value:function(){if(this.monitorBuffer_(),this.playlist_){if(this.syncController_.setDateTimeMapping(this.playlist_),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();this.couldBeginLoading_()&&(this.state==="READY"||this.state==="INIT")&&(this.state="READY")}}},{key:"init_",value:function(){return this.state="READY",this.sourceUpdater_=new uvt(this.mediaSource_,this.mimeType_,this.loaderType_,this.sourceBufferEmitter_),this.resetEverything(),this.monitorBuffer_()}},{key:"playlist",value:function(n){var f=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},t,i,r,u;if(n){if(t=this.playlist_,i=this.pendingSegment_,this.playlist_=n,this.xhrOptions_=f,this.hasPlayed_()||(n.syncInfo={mediaSequence:n.mediaSequence,time:0}),r=null,t&&(t.id?r=t.id:t.uri&&(r=t.uri)),this.logger_("playlist update ["+r+" => "+(n.id||n.uri)+"]"),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!t||t.uri!==n.uri){this.mediaIndex!==null&&this.resyncLoader();return}u=n.mediaSequence-t.mediaSequence;this.logger_("live window shift ["+u+"]");this.mediaIndex!==null&&(this.mediaIndex-=u);i&&(i.mediaIndex-=u,i.mediaIndex>=0&&(i.segment=n.segments[i.mediaIndex]));this.syncController_.saveExpiredSegmentInfo(t,n)}}},{key:"pause",value:function(){this.checkBufferTimeout_&&(n.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}},{key:"paused",value:function(){return this.checkBufferTimeout_===null}},{key:"mimeType",value:function(n,t){this.mimeType_||(this.mimeType_=n,this.sourceBufferEmitter_=t,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_())}},{key:"resetEverything",value:function(n){this.ended_=!1;this.resetLoader();this.remove(0,this.duration_(),n);this.captionParser_&&this.captionParser_.clearAllCaptions();this.trigger("reseteverything")}},{key:"resetLoader",value:function(){this.fetchAtBuffer_=!1;this.resyncLoader()}},{key:"resyncLoader",value:function(){this.mediaIndex=null;this.syncPoint_=null;this.abort()}},{key:"remove",value:function(n,t,i){if(this.sourceUpdater_&&this.sourceUpdater_.remove(n,t,i),gu(n,t,this.segmentMetadataTrack_),this.inbandTextTracks_)for(var r in this.inbandTextTracks_)gu(n,t,this.inbandTextTracks_[r])}},{key:"monitorBuffer_",value:function(){this.checkBufferTimeout_&&n.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=n.setTimeout(this.monitorBufferTick_.bind(this),1)}},{key:"monitorBufferTick_",value:function(){this.state==="READY"&&this.fillBuffer_();this.checkBufferTimeout_&&n.clearTimeout(this.checkBufferTimeout_);this.checkBufferTimeout_=n.setTimeout(this.monitorBufferTick_.bind(this),nyt)}},{key:"fillBuffer_",value:function(){if(!this.sourceUpdater_.updating()){this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_()));var n=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_);if(n){if(this.isEndOfStream_(n.mediaIndex)){this.endOfStream();return}(n.mediaIndex!==this.playlist_.segments.length-1||this.mediaSource_.readyState!=="ended"||this.seeking_())&&(n.timeline!==this.currentTimeline_&&(this.syncController_.reset(),n.timestampOffset=n.startOfSegment,this.captionParser_&&this.captionParser_.clearAllCaptions()),this.loadSegment_(n))}}}},{key:"isEndOfStream_",value:function(n){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:this.playlist_;return tyt(t,this.mediaSource_,n)&&!this.sourceUpdater_.updating()}},{key:"checkBuffer_",value:function(n,t,i,r,u,f){var o=0,e=void 0,s,l,h,c;return(n.length&&(o=n.end(n.length-1)),s=Math.max(0,o-u),!t.segments.length)?null:s>=this.goalBufferLength_()?null:!r&&s>=1?null:f===null?(i=this.getSyncSegmentCandidate_(t),this.generateSegmentInfo_(t,i,null,!0)):i!==null?(l=t.segments[i],e=o,this.generateSegmentInfo_(t,i+1,e,!1)):(this.fetchAtBuffer_?(h=vt.getMediaInfoForTime(t,o,f.segmentIndex,f.time),i=h.mediaIndex,e=h.startTime):(c=vt.getMediaInfoForTime(t,u,f.segmentIndex,f.time),i=c.mediaIndex,e=c.startTime),this.generateSegmentInfo_(t,i,e,!1))}},{key:"getSyncSegmentCandidate_",value:function(n){var i=this,t;return this.currentTimeline_===-1?0:(t=n.segments.map(function(n,t){return{timeline:n.timeline,segmentIndex:t}}).filter(function(n){return n.timeline===i.currentTimeline_}),t.length)?t[Math.min(t.length-1,1)].segmentIndex:Math.max(n.segments.length-1,0)}},{key:"generateSegmentInfo_",value:function(n,t,i,r){if(t<0||t>=n.segments.length)return null;var u=n.segments[t];return{requestId:"segment-loader-"+Math.random(),uri:u.resolvedUri,mediaIndex:t,isSyncRequest:r,startOfSegment:i,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:u.timeline,duration:u.duration,segment:u}}},{key:"abortRequestEarly_",value:function(n){var t;if(this.hls_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(n.firstBytesReceivedAt||Date.now())<1e3)return!1;var r=this.currentTime_(),u=n.bandwidth,f=this.pendingSegment_.duration,e=vt.estimateSegmentRequestTime(f,u,this.playlist_,n.bytesReceived),i=rat(this.buffered_(),r,this.hls_.tech_.playbackRate())-1;if(e<=i)return!1;if(t=bvt({master:this.hls_.playlists.master,currentTime:r,bandwidth:u,duration:this.duration_(),segmentDuration:f,timeUntilRebuffer:i,currentTimeline:this.currentTimeline_,syncController:this.syncController_}),t){var s=e-i,h=s-t.rebufferingImpact,o=.5;return(i<=sh&&(o=1),!t.playlist||t.playlist.uri===this.playlist_.uri||h<o)?!1:(this.bandwidth=t.playlist.attributes.BANDWIDTH*bt.BANDWIDTH_VARIANCE+1,this.abort(),this.trigger("earlyabort"),!0)}}},{key:"handleProgress_",value:function(n,t){this.pendingSegment_&&t.requestId===this.pendingSegment_.requestId&&!this.abortRequestEarly_(t.stats)&&this.trigger("progress")}},{key:"loadSegment_",value:function(n){this.state="WAITING";this.pendingSegment_=n;this.trimBackBuffer_(n);n.abortRequests=vvt(this.hls_.xhr,this.xhrOptions_,this.decrypter_,this.captionParser_,this.createSimplifiedSegmentObj_(n),this.handleProgress_.bind(this),this.segmentRequestFinished_.bind(this))}},{key:"trimBackBuffer_",value:function(){var n=ryt(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);n>0&&this.remove(0,n)}},{key:"createSimplifiedSegmentObj_",value:function(n){var t=n.segment,i={resolvedUri:t.resolvedUri,byterange:t.byterange,requestId:n.requestId},r;return t.key&&(r=t.key.iv||new Uint32Array([0,0,0,n.mediaIndex+n.playlist.mediaSequence]),i.key=this.segmentKey(t.key),i.key.iv=r),t.map&&(i.map=this.initSegment(t.map)),i}},{key:"segmentRequestFinished_",value:function(n,t){if(this.mediaRequests+=1,t.stats&&(this.mediaBytesTransferred+=t.stats.bytesReceived,this.mediaTransferDuration+=t.stats.roundTripTime),!this.pendingSegment_){this.mediaRequestsAborted+=1;return}if(t.requestId===this.pendingSegment_.requestId){if(n){if(this.pendingSegment_=null,this.state="READY",n.code===nr.ABORTED){this.mediaRequestsAborted+=1;return}if(this.pause(),n.code===nr.TIMEOUT){this.mediaRequestsTimedout+=1;this.bandwidth=1;this.roundTrip=NaN;this.trigger("bandwidthupdate");return}this.mediaRequestsErrored+=1;this.error(n);this.trigger("error");return}this.bandwidth=t.stats.bandwidth;this.roundTrip=t.stats.roundTripTime;t.map&&(t.map=this.initSegment(t.map,!0));t.key&&this.segmentKey(t.key,!0);this.processSegmentResponse_(t)}}},{key:"processSegmentResponse_",value:function(n){var t=this.pendingSegment_;t.bytes=n.bytes;n.map&&(t.segment.map.bytes=n.map.bytes);t.endOfAllRequests=n.endOfAllRequests;n.fmp4Captions&&(dvt(this.inbandTextTracks_,this.hls_.tech_,n.captionStreams),gvt({inbandTextTracks:this.inbandTextTracks_,captionArray:n.fmp4Captions,timestampOffset:0}),this.captionParser_&&this.captionParser_.clearParsedCaptions());this.handleSegment_()}},{key:"handleSegment_",value:function(){var h=this,r,e,o,u,f,s;if(!this.pendingSegment_){this.state="READY";return}var n=this.pendingSegment_,i=n.segment,t=this.syncController_.probeSegmentInfo(n);if(typeof this.startingMedia_=="undefined"&&t&&(t.containsAudio||t.containsVideo)&&(this.startingMedia_={containsAudio:t.containsAudio,containsVideo:t.containsVideo}),r=iyt(this.loaderType_,this.startingMedia_,t),r){this.error({message:r,blacklistDuration:Infinity});this.trigger("error");return}if(n.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}n.timestampOffset!==null&&n.timestampOffset!==this.sourceUpdater_.timestampOffset()&&(t&&t.segmentTimestampInfo&&(e=t.segmentTimestampInfo[0].ptsTime,o=t.segmentTimestampInfo[0].dtsTime,n.timestampOffset-=e-o),this.sourceUpdater_.timestampOffset(n.timestampOffset),this.trigger("timestampoffset"));u=this.syncController_.mappingForTimeline(n.timeline);u!==null&&this.trigger({type:"segmenttimemapping",mapping:u});this.state="APPENDING";i.map&&(f=oh(i.map),this.activeInitSegmentId_&&this.activeInitSegmentId_===f||(s=this.initSegment(i.map),this.sourceUpdater_.appendBuffer({bytes:s.bytes},function(){h.activeInitSegmentId_=f})));n.byteLength=n.bytes.byteLength;this.mediaSecondsLoaded+=typeof i.start=="number"&&typeof i.end=="number"?i.end-i.start:i.duration;this.logger_(uyt(n));this.sourceUpdater_.appendBuffer({bytes:n.bytes,videoSegmentTimingInfoCallback:this.handleVideoSegmentTimingInfo_.bind(this,n.requestId)},this.handleUpdateEnd_.bind(this))}},{key:"handleVideoSegmentTimingInfo_",value:function(n,t){if(this.pendingSegment_&&n===this.pendingSegment_.requestId){var i=this.pendingSegment_.segment;i.videoTimingInfo||(i.videoTimingInfo={});i.videoTimingInfo.transmuxerPrependedSeconds=t.videoSegmentTimingInfo.prependedContentDuration||0;i.videoTimingInfo.transmuxedPresentationStart=t.videoSegmentTimingInfo.start.presentation;i.videoTimingInfo.transmuxedPresentationEnd=t.videoSegmentTimingInfo.end.presentation;i.videoTimingInfo.baseMediaDecodeTime=t.videoSegmentTimingInfo.baseMediaDecodeTime}}},{key:"handleUpdateEnd_",value:function(){if(!this.pendingSegment_){this.state="READY";this.paused()||this.monitorBuffer_();return}var n=this.pendingSegment_,t=n.segment,i=this.mediaIndex!==null;if(this.pendingSegment_=null,this.recordThroughput_(n),this.addSegmentMetadataCue_(n),this.state="READY",this.mediaIndex=n.mediaIndex,this.fetchAtBuffer_=!0,this.currentTimeline_=n.timeline,this.trigger("syncinfoupdate"),t.end&&this.currentTime_()-t.end>n.playlist.targetDuration*3){this.resetEverything();return}i&&this.trigger("bandwidthupdate");this.trigger("progress");this.isEndOfStream_(n.mediaIndex+1,n.playlist)&&this.endOfStream();this.paused()||this.monitorBuffer_()}},{key:"recordThroughput_",value:function(n){var t=this.throughput.rate,i=Date.now()-n.endOfAllRequests+1,r=Math.floor(n.byteLength/i*8e3);this.throughput.rate+=(r-t)/++this.throughput.count}},{key:"addSegmentMetadataCue_",value:function(t){if(this.segmentMetadataTrack_){var i=t.segment,r=i.start,u=i.end;if(att(r)&&att(u)){gu(r,u,this.segmentMetadataTrack_);var o=n.WebKitDataCue||n.VTTCue,f={custom:i.custom,dateTimeObject:i.dateTimeObject,dateTimeString:i.dateTimeString,bandwidth:t.playlist.attributes.BANDWIDTH,resolution:t.playlist.attributes.RESOLUTION,codecs:t.playlist.attributes.CODECS,byteLength:t.byteLength,uri:t.uri,timeline:t.timeline,playlist:t.playlist.uri,start:r,end:u},s=JSON.stringify(f),e=new o(r,u,s);e.value=f;this.segmentMetadataTrack_.addCue(e)}}}}]),r}(i.EventTarget),vtt=function(n){return decodeURIComponent(escape(String.fromCharCode.apply(null,n)))},ytt=new Uint8Array("\n\n".split("").map(function(n){return n.charCodeAt(0)})),fyt=function(t){function r(n){var i=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},t;return ii(this,r),t=oi(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,n,i)),t.mediaSource_=null,t.subtitlesTrack_=null,t}return yi(r,t),ui(r,[{key:"buffered_",value:function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues.length)return i.createTimeRanges();var n=this.subtitlesTrack_.cues,t=n[0].startTime,r=n[n.length-1].startTime;return i.createTimeRanges([[t,r]])}},{key:"initSegment",value:function(n){var f=arguments.length>1&&arguments[1]!==undefined?arguments[1]:!1,r,t,u,i;return n?(r=oh(n),t=this.initSegments_[r],f&&!t&&n.bytes&&(u=ytt.byteLength+n.bytes.byteLength,i=new Uint8Array(u),i.set(n.bytes),i.set(ytt,n.bytes.byteLength),this.initSegments_[r]=t={resolvedUri:n.resolvedUri,byterange:n.byterange,bytes:i}),t||n):null}},{key:"couldBeginLoading_",value:function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}},{key:"init_",value:function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}},{key:"track",value:function(n){return typeof n=="undefined"?this.subtitlesTrack_:(this.subtitlesTrack_=n,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}},{key:"remove",value:function(n,t){gu(n,t,this.subtitlesTrack_)}},{key:"fillBuffer_",value:function(){var t=this,n,i;if(this.syncPoint_||(this.syncPoint_=this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_())),n=this.checkBuffer_(this.buffered_(),this.playlist_,this.mediaIndex,this.hasPlayed_(),this.currentTime_(),this.syncPoint_),n=this.skipEmptySegments_(n),n){if(this.syncController_.timestampOffsetForTimeline(n.timeline)===null){i=function(){t.state="READY";t.paused()||t.monitorBuffer_()};this.syncController_.one("timestampoffset",i);this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(n)}}},{key:"skipEmptySegments_",value:function(n){while(n&&n.segment.empty)n=this.generateSegmentInfo_(n.playlist,n.mediaIndex+1,n.startOfSegment+n.duration,n.isSyncRequest);return n}},{key:"handleSegment_",value:function(){var i=this,t,u,r,f;if(!this.pendingSegment_||!this.subtitlesTrack_){this.state="READY";return}if(this.state="APPENDING",t=this.pendingSegment_,u=t.segment,typeof n.WebVTT!="function"&&this.subtitlesTrack_&&this.subtitlesTrack_.tech_){r=void 0;f=function(){i.subtitlesTrack_.tech_.off("vttjsloaded",r);i.error({message:"Error loading vtt.js"});i.state="READY";i.pause();i.trigger("error")};r=function(){i.subtitlesTrack_.tech_.off("vttjserror",f);i.handleSegment_()};this.state="WAITING_ON_VTTJS";this.subtitlesTrack_.tech_.one("vttjsloaded",r);this.subtitlesTrack_.tech_.one("vttjserror",f);return}u.requested=!0;try{this.parseVTTCues_(t)}catch(e){return this.error({message:e.message}),this.state="READY",this.pause(),this.trigger("error")}if(this.updateTimeMapping_(t,this.syncController_.timelines[t.timeline],this.playlist_),t.isSyncRequest){this.trigger("syncinfoupdate");this.pendingSegment_=null;this.state="READY";return}t.byteLength=t.bytes.byteLength;this.mediaSecondsLoaded+=u.duration;t.cues.length&&this.remove(t.cues[0].endTime,t.cues[t.cues.length-1].endTime);t.cues.forEach(function(n){i.subtitlesTrack_.addCue(n)});this.handleUpdateEnd_()}},{key:"parseVTTCues_",value:function(t){var e=void 0,o=!1,r,u,f;typeof n.TextDecoder=="function"?e=new n.TextDecoder("utf8"):(e=n.WebVTT.StringDecoder(),o=!0);r=new n.WebVTT.Parser(n,n.vttjs,e);t.cues=[];t.timestampmap={MPEGTS:0,LOCAL:0};r.oncue=t.cues.push.bind(t.cues);r.ontimestampmap=function(n){return t.timestampmap=n};r.onparsingerror=function(n){i.log.warn("Error encountered when parsing cues: "+n.message)};t.segment.map&&(u=t.segment.map.bytes,o&&(u=vtt(u)),r.parse(u));f=t.bytes;o&&(f=vtt(f));r.parse(f);r.flush()}},{key:"updateTimeMapping_",value:function(n,t,i){var f=n.segment,r,u,e,o;if(t){if(!n.cues.length){f.empty=!0;return}r=n.timestampmap;u=r.MPEGTS/9e4-r.LOCAL+t.mapping;n.cues.forEach(function(n){n.startTime+=u;n.endTime+=u});i.syncInfo||(e=n.cues[0].startTime,o=n.cues[n.cues.length-1].startTime,i.syncInfo={mediaSequence:i.mediaSequence+n.mediaIndex,time:Math.min(e,o-f.duration)})}}}]),r}(ey),eyt=function(n,t){for(var i,u=n.cues,r=0;r<u.length;r++)if(i=u[r],t>=i.adStartTime&&t<=i.adEndTime)return i;return null},oyt=function(t,i){var c=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0,u,r,e,f;if(t.segments)for(u=c,r=void 0,e=0;e<t.segments.length;e++){if(f=t.segments[e],r||(r=eyt(i,u+f.duration/2)),r){if("cueIn"in f){r.endTime=u;r.adEndTime=u;u+=f.duration;r=null;continue}if(u<r.endTime){u+=f.duration;continue}r.endTime+=f.duration}else if("cueOut"in f&&(r=new n.VTTCue(u,u+f.duration,f.cueOut),r.adStartTime=u,r.adEndTime=u+parseFloat(f.cueOut),i.addCue(r)),"cueOutCont"in f){var o=void 0,s=void 0,l=f.cueOutCont.split("/").map(parseFloat),h=vct(l,2);o=h[0];s=h[1];r=new n.VTTCue(u,u+f.duration,"");r.adStartTime=u-o;r.adEndTime=r.adStartTime+s;i.addCue(r)}u+=f.duration}},syt=uct.inspect,ptt=[{name:"VOD",run:function(n,t,i){return i!==Infinity?{time:0,segmentIndex:0}:null}},{name:"ProgramDateTime",run:function(n,t,i,r,u){var f,o;if(!n.datetimeToDisplayTime)return null;var h=t.segments||[],c=null,e=null;for(u=u||0,f=0;f<h.length;f++)if(o=h[f],o.dateTimeObject){var a=o.dateTimeObject.getTime()/1e3,l=a+n.datetimeToDisplayTime,s=Math.abs(u-l);if(e!==null&&(s===0||e<s))break;e=s;c={time:l,segmentIndex:f}}return c}},{name:"Segment",run:function(n,t,i,r,u){var c=t.segments||[],h=null,f=null,e,o,s;for(u=u||0,e=0;e<c.length;e++)if(o=c[e],o.timeline===r&&typeof o.start!="undefined"){if(s=Math.abs(u-o.start),f!==null&&f<s)break;(!h||f===null||f>=s)&&(f=s,h={time:o.start,segmentIndex:e})}return h}},{name:"Discontinuity",run:function(n,t,i,r,u){var s=null,f,e,o;if(u=u||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(f=null,e=0;e<t.discontinuityStarts.length;e++){var c=t.discontinuityStarts[e],l=t.discontinuitySequence+e+1,h=n.discontinuities[l];if(h){if(o=Math.abs(u-h.time),f!==null&&f<o)break;(!s||f===null||f>=o)&&(f=o,s={time:h.time,segmentIndex:c})}}return s}},{name:"Playlist",run:function(n,t){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence}:null}}],hyt=function(n){function t(){ii(this,t);var n=oi(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.inspectCache_=undefined,n.timelines=[],n.discontinuities=[],n.datetimeToDisplayTime=null,n.logger_=le("SyncController"),n}return yi(t,n),ui(t,[{key:"getSyncPoint",value:function(n,t,i,r){var u=this.runStrategies_(n,t,i,r);return u.length?this.selectSyncPoint_(u,{key:"time",value:r}):null}},{key:"getExpiredTime",value:function(n,t){var r,i;return!n||!n.segments?null:(r=this.runStrategies_(n,t,n.discontinuitySequence,0),!r.length)?null:(i=this.selectSyncPoint_(r,{key:"segmentIndex",value:0}),i.segmentIndex>0&&(i.time*=-1),Math.abs(i.time+se(n,i.segmentIndex,0)))}},{key:"runStrategies_",value:function(n,t,i,r){for(var u,f,o=[],e=0;e<ptt.length;e++)u=ptt[e],f=u.run(this,n,t,i,r),f&&(f.strategy=u.name,o.push({strategy:u.name,syncPoint:f}));return o}},{key:"selectSyncPoint_",value:function(n,t){for(var u,r=n[0].syncPoint,f=Math.abs(n[0].syncPoint[t.key]-t.value),e=n[0].strategy,i=1;i<n.length;i++)u=Math.abs(n[i].syncPoint[t.key]-t.value),u<f&&(f=u,r=n[i].syncPoint,e=n[i].strategy);return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy"+(" ["+e+"]: [time:"+r.time+",")+(" segmentIndex:"+r.segmentIndex+"]")),r}},{key:"saveExpiredSegmentInfo",value:function(n,t){for(var r,u=t.mediaSequence-n.mediaSequence,i=u-1;i>=0;i--)if(r=n.segments[i],r&&typeof r.start!="undefined"){t.syncInfo={mediaSequence:n.mediaSequence+i,time:r.start};this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+","+(" mediaSequence: "+t.syncInfo.mediaSequence+"]"));this.trigger("syncinfoupdate");break}}},{key:"setDateTimeMapping",value:function(n){if(!this.datetimeToDisplayTime&&n.segments&&n.segments.length&&n.segments[0].dateTimeObject){var t=n.segments[0].dateTimeObject.getTime()/1e3;this.datetimeToDisplayTime=-t}}},{key:"reset",value:function(){this.inspectCache_=undefined}},{key:"probeSegmentInfo",value:function(n){var r=n.segment,i=n.playlist,t=void 0;return t=r.map?this.probeMp4Segment_(n):this.probeTsSegment_(n),t&&this.calculateSegmentTimeMapping_(n,t)&&(this.saveDiscontinuitySyncInfo_(n),i.syncInfo||(i.syncInfo={mediaSequence:i.mediaSequence+n.mediaIndex,time:r.start})),t}},{key:"probeMp4Segment_",value:function(n){var i=n.segment,r=vi.timescale(i.map.bytes),t=vi.compositionStartTime(r,n.bytes);return n.timestampOffset!==null&&(n.timestampOffset-=t),{start:t,end:t+i.duration}}},{key:"probeTsSegment_",value:function(n){var t=syt(n.bytes,this.inspectCache_),i=void 0,r=void 0,u=void 0;return t?(t.video&&t.video.length===2?(this.inspectCache_=t.video[1].dts,i=t.video[0].dtsTime,r=t.video[1].dtsTime,u=t.video):t.audio&&t.audio.length===2&&(this.inspectCache_=t.audio[1].dts,i=t.audio[0].dtsTime,r=t.audio[1].dtsTime,u=t.audio),{segmentTimestampInfo:u,start:i,end:r,containsVideo:t.video&&t.video.length===2,containsAudio:t.audio&&t.audio.length===2}):null}},{key:"timestampOffsetForTimeline",value:function(n){return typeof this.timelines[n]=="undefined"?null:this.timelines[n].time}},{key:"mappingForTimeline",value:function(n){return typeof this.timelines[n]=="undefined"?null:this.timelines[n].mapping}},{key:"calculateSegmentTimeMapping_",value:function(n,t){var r=n.segment,i=this.timelines[n.timeline];if(n.timestampOffset!==null)i={time:n.startOfSegment,mapping:n.startOfSegment-t.start},this.timelines[n.timeline]=i,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+n.timeline+": "+("[time: "+i.time+"] [mapping: "+i.mapping+"]")),r.start=n.startOfSegment,r.end=t.end+i.mapping;else if(i)r.start=t.start+i.mapping,r.end=t.end+i.mapping;else return!1;return!0}},{key:"saveDiscontinuitySyncInfo_",value:function(n){var t=n.playlist,i=n.segment,r,e;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(r=0;r<t.discontinuityStarts.length;r++){var u=t.discontinuityStarts[r],f=t.discontinuitySequence+r+1,o=u-n.mediaIndex,s=Math.abs(o);(!this.discontinuities[f]||this.discontinuities[f].accuracy>s)&&(e=void 0,e=o<0?i.start-se(t,n.mediaIndex,u):i.end+se(t,n.mediaIndex+1,u),this.discontinuities[f]={time:e,accuracy:s})}}}]),t}(i.EventTarget),cyt=new gn("./decrypter-worker.worker.js",function(){var n=this,t=function(){function f(n){return n.subarray(0,n.byteLength-n[n.byteLength-1])}var r=function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");},e=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),o=function(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},s=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n},h=function(){for(var h=[[[],[],[],[],[]],[[],[],[],[],[]]],f=h[0],e=h[1],l=f[4],p=e[4],n=void 0,i=void 0,r=void 0,u=[],a=[],c=void 0,v=void 0,y=void 0,t=void 0,o=void 0,s=void 0,n=0;n<256;n++)a[(u[n]=n<<1^(n>>7)*283)^n]=n;for(i=r=0;!l[i];i^=c||1,r=a[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^t&255^99,l[i]=t,p[t]=i,y=u[v=u[c=u[i]]],s=y*16843009^v*65537^c*257^i*16843008,o=u[t]*257^t*16843008,n=0;n<4;n++)f[n][i]=o=o<<24^o>>>8,e[n][t]=s=s<<24^s>>>8;for(n=0;n<5;n++)f[n]=f[n].slice(0),e[n]=e[n].slice(0);return h},t=null,c=function(){function n(i){r(this,n);t||(t=h());this._tables=[[t[0][0].slice(),t[0][1].slice(),t[0][2].slice(),t[0][3].slice(),t[0][4].slice()],[t[1][0].slice(),t[1][1].slice(),t[1][2].slice(),t[1][3].slice(),t[1][4].slice()]];var f=void 0,c=void 0,u=void 0,s=void 0,v=void 0,o=this._tables[0][4],l=this._tables[1],e=i.length,a=1;if(e!==4&&e!==6&&e!==8)throw new Error("Invalid aes key size");for(s=i.slice(0),v=[],this._key=[s,v],f=e;f<4*e+28;f++)u=s[f-1],(f%e==0||e===8&&f%e==4)&&(u=o[u>>>24]<<24^o[u>>16&255]<<16^o[u>>8&255]<<8^o[u&255],f%e==0&&(u=u<<8^u>>>24^a<<24,a=a<<1^(a>>7)*283)),s[f]=s[f-e]^u;for(c=0;f;c++,f--)u=s[c&3?f:f-4],v[c]=f<=4||c<4?u:l[0][o[u>>>24]]^l[1][o[u>>16&255]]^l[2][o[u>>8&255]]^l[3][o[u&255]]}return n.prototype.decrypt=function(n,t,i,r,u,f){for(var e=this._key[1],o=n^e[0],s=r^e[1],h=i^e[2],c=t^e[3],y=void 0,g=void 0,nt=void 0,tt=e.length/4-2,l=void 0,a=4,v=this._tables[1],p=v[0],w=v[1],b=v[2],k=v[3],d=v[4],l=0;l<tt;l++)y=p[o>>>24]^w[s>>16&255]^b[h>>8&255]^k[c&255]^e[a],g=p[s>>>24]^w[h>>16&255]^b[c>>8&255]^k[o&255]^e[a+1],nt=p[h>>>24]^w[c>>16&255]^b[o>>8&255]^k[s&255]^e[a+2],c=p[c>>>24]^w[o>>16&255]^b[s>>8&255]^k[h&255]^e[a+3],a+=4,o=y,s=g,h=nt;for(l=0;l<4;l++)u[(3&-l)+f]=d[o>>>24]<<24^d[s>>16&255]<<16^d[h>>8&255]<<8^d[c&255]^e[a++],y=o,o=s,s=h,h=c,c=y},n}(),u=function(){function n(){r(this,n);this.listeners={}}return n.prototype.on=function(n,t){this.listeners[n]||(this.listeners[n]=[]);this.listeners[n].push(t)},n.prototype.off=function(n,t){if(!this.listeners[n])return!1;var i=this.listeners[n].indexOf(t);return this.listeners[n].splice(i,1),i>-1},n.prototype.trigger=function(n){var t=this.listeners[n],u,i,f,e,r;if(t)if(arguments.length===2)for(u=t.length,i=0;i<u;++i)t[i].call(this,arguments[1]);else for(f=Array.prototype.slice.call(arguments,1),e=t.length,r=0;r<e;++r)t[r].apply(this,f)},n.prototype.dispose=function(){this.listeners={}},n.prototype.pipe=function(n){this.on("data",function(t){n.push(t)})},n}(),l=function(n){function t(){r(this,t);var i=s(this,n.call(this,u));return i.jobs=[],i.delay=1,i.timeout_=null,i}return o(t,n),t.prototype.processJob_=function(){this.jobs.shift()();this.timeout_=this.jobs.length?setTimeout(this.processJob_.bind(this),this.delay):null},t.prototype.push=function(n){this.jobs.push(n);this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},t}(u),i=function(n){return n<<24|(n&65280)<<8|(n&16711680)>>8|n>>>24},a=function(n,t,r){var e=new Int32Array(n.buffer,n.byteOffset,n.byteLength>>2),b=new c(Array.prototype.slice.call(t)),w=new Uint8Array(n.byteLength),f=new Int32Array(w.buffer),o=void 0,s=void 0,h=void 0,l=void 0,a=void 0,v=void 0,y=void 0,p=void 0,u=void 0;for(o=r[0],s=r[1],h=r[2],l=r[3],u=0;u<e.length;u+=4)a=i(e[u]),v=i(e[u+1]),y=i(e[u+2]),p=i(e[u+3]),b.decrypt(a,v,y,p,f,u),f[u]=i(f[u]^o),f[u+1]=i(f[u+1]^s),f[u+2]=i(f[u+2]^h),f[u+3]=i(f[u+3]^l),o=a,s=v,h=y,l=p;return w},v=function(){function n(t,u,e,o){r(this,n);var c=n.STEP,h=new Int32Array(t.buffer),a=new Uint8Array(t.byteLength),s=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(h.subarray(s,s+c),u,e,a)),s=c;s<h.length;s+=c)e=new Uint32Array([i(h[s-4]),i(h[s-3]),i(h[s-2]),i(h[s-1])]),this.asyncStream_.push(this.decryptChunk_(h.subarray(s,s+c),u,e,a));this.asyncStream_.push(function(){o(null,f(a))})}return n.prototype.decryptChunk_=function(n,t,i,r){return function(){var u=a(n,t,i);r.set(u,n.byteOffset)}},e(n,null,[{key:"STEP",get:function(){return 32e3}}]),n}(),y=function(n){var t={};return Object.keys(n).forEach(function(i){var r=n[i];t[i]=ArrayBuffer.isView(r)?{bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:r}),t},p=function(n){n.onmessage=function(t){var i=t.data,r=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),u=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),f=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new v(r,u,f,function(t,r){n.postMessage(y({source:i.source,decrypted:r}),[r.buffer])})}};return new p(n)}()}),lyt=function(n){var t=n["default"]?"main":"alternative";return n.characteristics&&n.characteristics.indexOf("public.accessibility.describes-video")>=0&&(t="main-desc"),t},ch=function(n,t){n.abort();n.pause();t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)},oy=function(n,t){t.activePlaylistLoader=n;n.load()},ayt=function(n,t){return function(){var u=t.segmentLoaders,f=u[n],e=u.main,i=t.mediaTypes[n],o=i.activeTrack(),r=i.activeGroup(o),s=i.activePlaylistLoader;if(ch(f,i),r){if(!r.playlistLoader){s&&e.resetEverything();return}f.resyncLoader();oy(r.playlistLoader,i)}}},vyt=function(n,t){return function(){var f=t.segmentLoaders,u=f[n],o=f.main,i=t.mediaTypes[n],e=i.activeTrack(),r=i.activeGroup(e),s=i.activePlaylistLoader;if(ch(u,i),r){if(!r.playlistLoader){o.resetEverything();return}if(s===r.playlistLoader){oy(r.playlistLoader,i);return}u.track&&u.track(e);u.resetEverything();oy(r.playlistLoader,i)}}},lh={AUDIO:function(n,t){return function(){var o=t.segmentLoaders[n],r=t.mediaTypes[n],s=t.blacklistCurrentPlaylist,u;ch(o,r);var h=r.activeTrack(),f=r.activeGroup(),c=(f.filter(function(n){return n["default"]})[0]||f[0]).id,e=r.tracks[c];if(h===e){s({message:"Problem encountered loading the default audio track."});return}i.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(u in r.tracks)r.tracks[u].enabled=r.tracks[u]===e;r.onTrackChanged()}},SUBTITLES:function(n,t){return function(){var f=t.segmentLoaders[n],r=t.mediaTypes[n],u;i.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");ch(f,r);u=r.activeTrack();u&&(u.mode="disabled");r.onTrackChanged()}}},wtt={AUDIO:function(n,t,i){if(t){var u=i.tech,f=i.requestOptions,r=i.segmentLoaders[n];t.on("loadedmetadata",function(){var n=t.media();r.playlist(n,f);(!u.paused()||n.endList&&u.preload()!=="none")&&r.load()});t.on("loadedplaylist",function(){r.playlist(t.media(),f);u.paused()||r.load()});t.on("error",lh[n](n,i))}},SUBTITLES:function(n,t,i){var u=i.tech,f=i.requestOptions,r=i.segmentLoaders[n],e=i.mediaTypes[n];t.on("loadedmetadata",function(){var n=t.media();r.playlist(n,f);r.track(e.activeTrack());(!u.paused()||n.endList&&u.preload()!=="none")&&r.load()});t.on("loadedplaylist",function(){r.playlist(t.media(),f);u.paused()||r.load()});t.on("error",lh[n](n,i))}},yyt={AUDIO:function(n,t){var h=t.hls,y=t.sourceType,p=t.segmentLoaders[n],c=t.requestOptions,f=t.master.mediaGroups,l=t.mediaTypes[n],o=l.groups,a=l.tracks,w=t.masterPlaylistLoader,e,u,r,s,v;f[n]&&Object.keys(f[n]).length!==0||(f[n]={main:{"default":{"default":!0}}});for(e in f[n]){o[e]||(o[e]=[]);for(u in f[n][e])r=f[n][e][u],s=void 0,s=r.resolvedUri?new fh(r.resolvedUri,h,c):r.playlists&&y==="dash"?new ry(r.playlists[0],h,c,w):null,r=i.mergeOptions({id:u,playlistLoader:s},r),wtt[n](n,r.playlistLoader,t),o[e].push(r),typeof a[u]=="undefined"&&(v=new i.AudioTrack({id:u,kind:lyt(r),enabled:!1,language:r.language,"default":r["default"],label:u}),a[u]=v)}p.on("error",lh[n](n,t))},SUBTITLES:function(n,t){var p=t.tech,h=t.hls,c=t.sourceType,w=t.segmentLoaders[n],l=t.requestOptions,e=t.master.mediaGroups,a=t.mediaTypes[n],s=a.groups,v=a.tracks,b=t.masterPlaylistLoader,f,u,r,o,y;for(f in e[n]){s[f]||(s[f]=[]);for(u in e[n][f])e[n][f][u].forced||(r=e[n][f][u],o=void 0,c==="hls"?o=new fh(r.resolvedUri,h,l):c==="dash"&&(o=new ry(r.playlists[0],h,l,b)),r=i.mergeOptions({id:u,playlistLoader:o},r),wtt[n](n,r.playlistLoader,t),s[f].push(r),typeof v[u]=="undefined"&&(y=p.addRemoteTextTrack({id:u,kind:"subtitles","default":r["default"]&&r.autoselect,language:r.language,label:u},!1).track,v[u]=y))}w.on("error",lh[n](n,t))},"CLOSED-CAPTIONS":function(n,t){var l=t.tech,e=t.master.mediaGroups,s=t.mediaTypes[n],o=s.groups,h=s.tracks,u,f,r,c;for(u in e[n]){o[u]||(o[u]=[]);for(f in e[n][u])(r=e[n][u][f],r.instreamId.match(/CC\d/))&&(o[u].push(i.mergeOptions({id:f},r)),typeof h[f]=="undefined"&&(c=l.addRemoteTextTrack({id:r.instreamId,kind:"captions","default":r["default"]&&r.autoselect,language:r.language,label:f},!1).track,h[f]=c))}}},pyt=function(n,t){return function(i){var e=t.masterPlaylistLoader,f=t.mediaTypes[n].groups,u=e.media(),r;return u?(r=null,u.attributes[n]&&(r=f[u.attributes[n]]),r=r||f.main,typeof i=="undefined")?r:i===null?null:r.filter(function(n){return n.id===i.id})[0]||null:null}},wyt={AUDIO:function(n,t){return function(){var i=t.mediaTypes[n].tracks;for(var r in i)if(i[r].enabled)return i[r];return null}},SUBTITLES:function(n,t){return function(){var i=t.mediaTypes[n].tracks;for(var r in i)if(i[r].mode==="showing")return i[r];return null}}},byt=function(n){var r,f,u,e;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){yyt[t](t,n)});var t=n.mediaTypes,o=n.masterPlaylistLoader,i=n.tech,s=n.hls;["AUDIO","SUBTITLES"].forEach(function(i){t[i].activeGroup=pyt(i,n);t[i].activeTrack=wyt[i](i,n);t[i].onGroupChanged=ayt(i,n);t[i].onTrackChanged=vyt(i,n)});r=t.AUDIO.activeGroup();f=(r.filter(function(n){return n["default"]})[0]||r[0]).id;t.AUDIO.tracks[f].enabled=!0;t.AUDIO.onTrackChanged();o.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(n){return t[n].onGroupChanged()})});u=function(){t.AUDIO.onTrackChanged();i.trigger({type:"usage",name:"hls-audio-change"})};i.audioTracks().addEventListener("change",u);i.remoteTextTracks().addEventListener("change",t.SUBTITLES.onTrackChanged);s.on("dispose",function(){i.audioTracks().removeEventListener("change",u);i.remoteTextTracks().removeEventListener("change",t.SUBTITLES.onTrackChanged)});i.clearTracks("audio");for(e in t.AUDIO.tracks)i.audioTracks().addTrack(t.AUDIO.tracks[e])},kyt=function(){var n={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(t){n[t]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:uf,activeTrack:uf,onGroupChanged:uf,onTrackChanged:uf}}),n},dyt=120,tr=void 0,gyt=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred"],npt=function(n){return this.audioSegmentLoader_[n]+this.mainSegmentLoader_[n]},tpt=function(t){function r(n){var u;ii(this,r);var t=oi(this,(r.__proto__||Object.getPrototypeOf(r)).call(this)),f=n.url,s=n.handleManifestRedirects,o=n.withCredentials,e=n.tech,h=n.bandwidth,c=n.externHls,l=n.useCueTags,a=n.blacklistDuration,v=n.enableLowInitialPlaylist,y=n.sourceType,p=n.seekTo,w=n.cacheEncryptionKeys;if(!f)throw new Error("A non-empty playlist URL is required");return tr=c,t.withCredentials=o,t.tech_=e,t.hls_=e.hls,t.seekTo_=p,t.sourceType_=y,t.useCueTags_=l,t.blacklistDuration=a,t.enableLowInitialPlaylist=v,t.useCueTags_&&(t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues"),t.cueTagsTrack_.inBandMetadataTrackDispatchType=""),t.requestOptions_={withCredentials:o,handleManifestRedirects:s,timeout:null},t.mediaTypes_=kyt(),t.mediaSource=new i.MediaSource,t.mediaSource.addEventListener("sourceopen",t.handleSourceOpen_.bind(t)),t.seekable_=i.createTimeRanges(),t.hasPlayed_=function(){return!1},t.syncController_=new hyt(n),t.segmentMetadataTrack_=e.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,t.decrypter_=new cyt,t.inbandTextTracks_={},u={hls:t.hls_,mediaSource:t.mediaSource,currentTime:t.tech_.currentTime.bind(t.tech_),seekable:function(){return t.seekable()},seeking:function(){return t.tech_.seeking()},duration:function(){return t.mediaSource.duration},hasPlayed:function(){return t.hasPlayed_()},goalBufferLength:function(){return t.goalBufferLength()},bandwidth:h,syncController:t.syncController_,decrypter:t.decrypter_,sourceType:t.sourceType_,inbandTextTracks:t.inbandTextTracks_,cacheEncryptionKeys:w},t.masterPlaylistLoader_=t.sourceType_==="dash"?new ry(f,t.hls_,t.requestOptions_):new fh(f,t.hls_,t.requestOptions_),t.setupMasterPlaylistLoaderListeners_(),t.mainSegmentLoader_=new ey(i.mergeOptions(u,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),n),t.audioSegmentLoader_=new ey(i.mergeOptions(u,{loaderType:"audio"}),n),t.subtitleSegmentLoader_=new fyt(i.mergeOptions(u,{loaderType:"vtt"}),n),t.setupSegmentLoaderListeners_(),gyt.forEach(function(n){t[n+"_"]=npt.bind(t,n)}),t.logger_=le("MPC"),t.masterPlaylistLoader_.load(),t}return yi(r,t),ui(r,[{key:"setupMasterPlaylistLoaderListeners_",value:function(){var n=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var t=n.masterPlaylistLoader_.media(),r=t.targetDuration*1.5*1e3;n.requestOptions_.timeout=lv(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.media())?0:r;t.endList&&n.tech_.preload()!=="none"&&(n.mainSegmentLoader_.playlist(t,n.requestOptions_),n.mainSegmentLoader_.load());byt({sourceType:n.sourceType_,segmentLoaders:{AUDIO:n.audioSegmentLoader_,SUBTITLES:n.subtitleSegmentLoader_,main:n.mainSegmentLoader_},tech:n.tech_,requestOptions:n.requestOptions_,masterPlaylistLoader:n.masterPlaylistLoader_,hls:n.hls_,master:n.master(),mediaTypes:n.mediaTypes_,blacklistCurrentPlaylist:n.blacklistCurrentPlaylist.bind(n)});n.triggerPresenceUsage_(n.master(),t);try{n.setupSourceBuffers_()}catch(u){return i.log.warn("Failed to create SourceBuffers",u),n.mediaSource.endOfStream("decode")}if(n.setupFirstPlay(),!n.mediaTypes_.AUDIO.activePlaylistLoader||n.mediaTypes_.AUDIO.activePlaylistLoader.media())n.trigger("selectedinitialmedia");else n.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){n.trigger("selectedinitialmedia")})});this.masterPlaylistLoader_.on("loadedplaylist",function(){var i=n.masterPlaylistLoader_.media(),t,r,u;if(!i){n.excludeUnsupportedVariants_();t=void 0;n.enableLowInitialPlaylist&&(t=n.selectInitialPlaylist());t||(t=n.selectPlaylist());n.initialMedia_=t;n.masterPlaylistLoader_.media(n.initialMedia_);return}if(n.useCueTags_&&n.updateAdCues_(i),n.mainSegmentLoader_.playlist(i,n.requestOptions_),n.updateDuration(),n.tech_.paused()||(n.mainSegmentLoader_.load(),n.audioSegmentLoader_&&n.audioSegmentLoader_.load()),!i.endList)if(r=function(){var t=n.seekable();t.length!==0&&n.mediaSource.addSeekableRange_(t.start(0),t.end(0))},n.duration()!==Infinity){u=function u(){if(n.duration()===Infinity)r();else n.tech_.one("durationchange",u)};n.tech_.one("durationchange",u)}else r()});this.masterPlaylistLoader_.on("error",function(){n.blacklistCurrentPlaylist(n.masterPlaylistLoader_.error)});this.masterPlaylistLoader_.on("mediachanging",function(){n.mainSegmentLoader_.abort();n.mainSegmentLoader_.pause()});this.masterPlaylistLoader_.on("mediachange",function(){var t=n.masterPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;n.requestOptions_.timeout=lv(n.masterPlaylistLoader_.master,n.masterPlaylistLoader_.media())?0:i;n.mainSegmentLoader_.playlist(t,n.requestOptions_);n.mainSegmentLoader_.load();n.tech_.trigger({type:"mediachange",bubbles:!0})});this.masterPlaylistLoader_.on("playlistunchanged",function(){var t=n.masterPlaylistLoader_.media(),i=n.stuckAtPlaylistEnd_(t);i&&(n.blacklistCurrentPlaylist({message:"Playlist no longer updating."}),n.tech_.trigger("playliststuck"))});this.masterPlaylistLoader_.on("renditiondisabled",function(){n.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})});this.masterPlaylistLoader_.on("renditionenabled",function(){n.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})}},{key:"triggerPresenceUsage_",value:function(n,t){var i=n.mediaGroups||{},u=!0,f=Object.keys(i.AUDIO),r,e,o;for(r in i.AUDIO)for(e in i.AUDIO[r])o=i.AUDIO[r][e],o.uri||(u=!1);u&&this.tech_.trigger({type:"usage",name:"hls-demuxed"});Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"hls-webvtt"});tr.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"hls-aes"});tr.Playlist.isFmp4(t)&&this.tech_.trigger({type:"usage",name:"hls-fmp4"});f.length&&Object.keys(i.AUDIO[f[0]]).length>1&&this.tech_.trigger({type:"usage",name:"hls-alternate-audio"});this.useCueTags_&&this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"})}},{key:"setupSegmentLoaderListeners_",value:function(){var n=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){var i=n.selectPlaylist(),r=n.masterPlaylistLoader_.media(),t=n.tech_.buffered(),u=t.length?t.end(t.length-1)-n.tech_.currentTime():0,f=n.bufferLowWaterLine();(!r.endList||n.duration()<bt.MAX_BUFFER_LOW_WATER_LINE||i.attributes.BANDWIDTH<r.attributes.BANDWIDTH||u>=f)&&n.masterPlaylistLoader_.media(i);n.tech_.trigger("bandwidthupdate")});this.mainSegmentLoader_.on("progress",function(){n.trigger("progress")});this.mainSegmentLoader_.on("error",function(){n.blacklistCurrentPlaylist(n.mainSegmentLoader_.error())});this.mainSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("timestampoffset",function(){n.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})});this.audioSegmentLoader_.on("syncinfoupdate",function(){n.onSyncInfoUpdate_()});this.mainSegmentLoader_.on("ended",function(){n.onEndOfStream()});this.mainSegmentLoader_.on("earlyabort",function(){n.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},dyt)});this.mainSegmentLoader_.on("reseteverything",function(){n.tech_.trigger("hls-reset")});this.mainSegmentLoader_.on("segmenttimemapping",function(t){n.tech_.trigger({type:"hls-segment-time-mapping",mapping:t.mapping})});this.audioSegmentLoader_.on("ended",function(){n.onEndOfStream()})}},{key:"mediaSecondsLoaded_",value:function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}},{key:"load",value:function(){this.mainSegmentLoader_.load();this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load();this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}},{key:"smoothQualityChange_",value:function(){var n=this.selectPlaylist();n!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(n),this.mainSegmentLoader_.resetLoader())}},{key:"fastQualityChange_",value:function(){var n=this,t=this.selectPlaylist();t!==this.masterPlaylistLoader_.media()&&(this.masterPlaylistLoader_.media(t),this.mainSegmentLoader_.resetEverything(function(){i.browser.IE_VERSION||i.browser.IS_EDGE?n.tech_.setCurrentTime(n.tech_.currentTime()+.04):n.tech_.setCurrentTime(n.tech_.currentTime())}))}},{key:"play",value:function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.seekTo_(0);this.hasPlayed_()&&this.load();var n=this.tech_.seekable();if(this.tech_.duration()===Infinity&&this.tech_.currentTime()<n.start(0))return this.seekTo_(n.end(n.length-1))}}},{key:"setupFirstPlay",value:function(){var t=this,r=this.masterPlaylistLoader_.media(),n;if(!r||this.tech_.paused()||this.hasPlayed_())return!1;if(!r.endList){if(n=this.seekable(),!n.length)return!1;if(i.browser.IE_VERSION&&this.tech_.readyState()===0){this.tech_.one("loadedmetadata",function(){t.trigger("firstplay");t.seekTo_(n.end(0));t.hasPlayed_=function(){return!0}});return!1}this.trigger("firstplay");this.seekTo_(n.end(0))}return this.hasPlayed_=function(){return!0},this.load(),!0}},{key:"handleSourceOpen_",value:function(){try{this.setupSourceBuffers_()}catch(t){return i.log.warn("Failed to create Source Buffers",t),this.mediaSource.endOfStream("decode")}if(this.tech_.autoplay()){var n=this.tech_.play();typeof n!="undefined"&&typeof n.then=="function"&&n.then(null,function(){})}this.trigger("sourceopen")}},{key:"onEndOfStream",value:function(){var n=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(n=!this.mainSegmentLoader_.startingMedia_||this.mainSegmentLoader_.startingMedia_.containsVideo?n&&this.audioSegmentLoader_.ended_:this.audioSegmentLoader_.ended_),n){this.logger_("calling mediaSource.endOfStream()");try{this.mediaSource.endOfStream()}catch(t){i.log.warn("Failed to call media source endOfStream",t)}}}},{key:"stuckAtPlaylistEnd_",value:function(n){var e=this.seekable(),t,r;if(!e.length||(t=this.syncController_.getExpiredTime(n,this.mediaSource.duration),t===null))return!1;var u=tr.Playlist.playlistEnd(n,t),f=this.tech_.currentTime(),i=this.tech_.buffered();return i.length?(r=i.end(i.length-1),r-f<=pi&&u-r<=pi):u-f<=pi}},{key:"blacklistCurrentPlaylist",value:function(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},r=arguments[1],u=void 0,e=void 0,t,f;if(u=n.playlist||this.masterPlaylistLoader_.media(),r=r||n.blacklistDuration||this.blacklistDuration,!u){this.error=n;try{return this.mediaSource.endOfStream("network")}catch(o){return this.trigger("error")}}return(t=this.masterPlaylistLoader_.master.playlists.filter(eh).length===1,f=this.masterPlaylistLoader_.master.playlists,f.length===1)?(i.log.warn("Problem encountered with the current HLS playlist. Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(t)):(t&&(i.log.warn("Removing all playlists from the blacklist because the last rendition is about to be blacklisted."),f.forEach(function(n){n.excludeUntil!==Infinity&&delete n.excludeUntil}),this.tech_.trigger("retryplaylist")),u.excludeUntil=Date.now()+r*1e3,this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"}),e=this.selectPlaylist(),i.log.warn("Problem encountered with the current HLS playlist."+(n.message?" "+n.message:"")+" Switching to another playlist."),this.masterPlaylistLoader_.media(e,t))}},{key:"pauseLoading",value:function(){this.mainSegmentLoader_.pause();this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause();this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}},{key:"setCurrentTime",value:function(n){var t=wn(this.tech_.buffered(),n);if(!(this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media())||!this.masterPlaylistLoader_.media().segments)return 0;if(t&&t.length)return n;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());this.load()}},{key:"duration",value:function(){return this.masterPlaylistLoader_?this.mediaSource?this.mediaSource.duration:tr.Playlist.duration(this.masterPlaylistLoader_.media()):0}},{key:"seekable",value:function(){return this.seekable_}},{key:"onSyncInfoUpdate_",value:function(){var n=void 0,t=void 0,r,u,f,e;if(this.masterPlaylistLoader_&&(r=this.masterPlaylistLoader_.media(),r)&&(u=this.syncController_.getExpiredTime(r,this.mediaSource.duration),u!==null)&&(n=tr.Playlist.seekable(r,u),n.length!==0)){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(r=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),u=this.syncController_.getExpiredTime(r,this.mediaSource.duration),u===null)return;if(t=tr.Playlist.seekable(r,u),t.length===0)return}(f=void 0,e=void 0,this.seekable_&&this.seekable_.length&&(f=this.seekable_.end(0),e=this.seekable_.start(0)),this.seekable_=t?t.start(0)>n.end(0)||n.start(0)>t.end(0)?n:i.createTimeRanges([[t.start(0)>n.start(0)?t.start(0):n.start(0),t.end(0)<n.end(0)?t.end(0):n.end(0)]]):n,this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===f&&this.seekable_.start(0)===e)||(this.logger_("seekable updated ["+vv(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}},{key:"updateDuration",value:function(){var n=this,f=this.mediaSource.duration,t=tr.Playlist.duration(this.masterPlaylistLoader_.media()),r=this.tech_.buffered(),u=function u(){n.logger_("Setting duration from "+n.mediaSource.duration+" => "+t);try{n.mediaSource.duration=t}catch(r){i.log.warn("Failed to set media source duration",r)}n.tech_.trigger("durationchange");n.mediaSource.removeEventListener("sourceopen",u)};r.length>0&&(t=Math.max(t,r.end(r.length-1)));f!==t&&(this.mediaSource.readyState!=="open"?this.mediaSource.addEventListener("sourceopen",u):u())}},{key:"dispose",value:function(){var n=this;this.decrypter_.terminate();this.masterPlaylistLoader_.dispose();this.mainSegmentLoader_.dispose();["AUDIO","SUBTITLES"].forEach(function(t){var i=n.mediaTypes_[t].groups;for(var r in i)i[r].forEach(function(n){n.playlistLoader&&n.playlistLoader.dispose()})});this.audioSegmentLoader_.dispose();this.subtitleSegmentLoader_.dispose()}},{key:"master",value:function(){return this.masterPlaylistLoader_.master}},{key:"media",value:function(){return this.masterPlaylistLoader_.media()||this.initialMedia_}},{key:"setupSourceBuffers_",value:function(){var n=this.masterPlaylistLoader_.media(),t=void 0;if(n&&this.mediaSource.readyState==="open"){if(t=pat(this.masterPlaylistLoader_.master,n),t.length<1)return this.error="No compatible SourceBuffer configuration for the variant stream:"+n.resolvedUri,this.mediaSource.endOfStream("decode");this.configureLoaderMimeTypes_(t);this.excludeIncompatibleVariants_(n)}}},{key:"configureLoaderMimeTypes_",value:function(n){var t=n.length>1&&n[0].indexOf(",")===-1&&n[0]!==n[1]?new i.EventTarget:null;this.mainSegmentLoader_.mimeType(n[0],t);n[1]&&this.audioSegmentLoader_.mimeType(n[1],t)}},{key:"excludeUnsupportedVariants_",value:function(){this.master().playlists.forEach(function(t){t.attributes.CODECS&&n.MediaSource&&n.MediaSource.isTypeSupported&&!n.MediaSource.isTypeSupported('video/mp4; codecs="'+lat(t.attributes.CODECS)+'"')&&(t.excludeUntil=Infinity)})}},{key:"excludeIncompatibleVariants_",value:function(n){var i=2,r=null,t=void 0;n.attributes.CODECS&&(t=he(n.attributes.CODECS),r=t.videoCodec,i=t.codecCount);this.master().playlists.forEach(function(n){var t={codecCount:2,videoCodec:null};n.attributes.CODECS&&(t=he(n.attributes.CODECS));t.codecCount!==i&&(n.excludeUntil=Infinity);t.videoCodec!==r&&(n.excludeUntil=Infinity)})}},{key:"updateAdCues_",value:function(n){var t=0,i=this.seekable();i.length&&(t=i.start(0));oyt(n,this.cueTagsTrack_,t)}},{key:"goalBufferLength",value:function(){var t=this.tech_.currentTime(),n=bt.GOAL_BUFFER_LENGTH,i=bt.GOAL_BUFFER_LENGTH_RATE,r=Math.max(n,bt.MAX_GOAL_BUFFER_LENGTH);return Math.min(n+t*i,r)}},{key:"bufferLowWaterLine",value:function(){var t=this.tech_.currentTime(),n=bt.BUFFER_LOW_WATER_LINE,i=bt.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(n,bt.MAX_BUFFER_LOW_WATER_LINE);return Math.min(n+t*i,r)}}]),r}(i.EventTarget),ipt=function(n,t,i){return function(r){var u=n.master.playlists[t],e=cv(u),f=eh(u);return typeof r=="undefined"?f:(r?delete u.disabled:u.disabled=!0,r===f||e||(i(),r?n.trigger("renditionenabled"):n.trigger("renditiondisabled")),r)}},btt=function btt(n,t,i){var r;ii(this,btt);var u=n.masterPlaylistController_,f=n.options_.smoothQualityChange,e=f?"smooth":"fast",o=u[e+"QualityChange_"].bind(u);t.attributes.RESOLUTION&&(r=t.attributes.RESOLUTION,this.width=r.width,this.height=r.height);this.bandwidth=t.attributes.BANDWIDTH;this.id=i;this.enabled=ipt(n.playlists,t.uri,o)},rpt=function(n){var t=n.playlists;n.representations=function(){return t.master.playlists.filter(function(n){return!cv(n)}).map(function(t){return new btt(n,t,t.uri)})}},ktt=["seeking","seeked","pause","playing","error"],upt=function(){function t(i){var r=this;ii(this,t);this.tech_=i.tech;this.seekable=i.seekable;this.seekTo=i.seekTo;this.allowSeeksWithinUnsafeLiveWindow=i.allowSeeksWithinUnsafeLiveWindow;this.media=i.media;this.consecutiveUpdates=0;this.lastRecordedTime=null;this.timer_=null;this.checkCurrentTimeTimeout_=null;this.logger_=le("PlaybackWatcher");this.logger_("initialize");var u=function(){return r.monitorCurrentTime_()},f=function(){return r.techWaiting_()},e=function(){return r.cancelTimer_()},o=function(){return r.fixesBadSeeks_()};this.tech_.on("seekablechanged",o);this.tech_.on("waiting",f);this.tech_.on(ktt,e);this.tech_.on("canplay",u);this.dispose=function(){r.logger_("dispose");r.tech_.off("seekablechanged",o);r.tech_.off("waiting",f);r.tech_.off(ktt,e);r.tech_.off("canplay",u);r.checkCurrentTimeTimeout_&&n.clearTimeout(r.checkCurrentTimeTimeout_);r.cancelTimer_()}}return ui(t,[{key:"monitorCurrentTime_",value:function(){this.checkCurrentTime_();this.checkCurrentTimeTimeout_&&n.clearTimeout(this.checkCurrentTimeTimeout_);this.checkCurrentTimeTimeout_=n.setTimeout(this.monitorCurrentTime_.bind(this),250)}},{key:"checkCurrentTime_",value:function(){if(this.tech_.seeking()&&this.fixesBadSeeks_()){this.consecutiveUpdates=0;this.lastRecordedTime=this.tech_.currentTime();return}if(!this.tech_.paused()&&!this.tech_.seeking()){var n=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===n&&(!t.length||n+pi>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&n===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):n===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=n)}}},{key:"cancelTimer_",value:function(){this.consecutiveUpdates=0;this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_));this.timer_=null}},{key:"fixesBadSeeks_",value:function(){var f=this.tech_.seeking(),r,u;if(!f)return!1;var n=this.seekable(),i=this.tech_.currentTime(),e=this.afterSeekableWindow_(n,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow),t=void 0;return(e&&(r=n.end(n.length-1),t=r),this.beforeSeekableWindow_(n,i)&&(u=n.start(0),t=u+pi),typeof t!="undefined")?(this.logger_("Trying to seek outside of seekable at time "+i+" with "+("seekable range "+vv(n)+". Seeking to ")+(t+".")),this.seekTo(t),!0):!1}},{key:"waiting_",value:function(){if(!this.techWaiting_()){var n=this.tech_.currentTime(),i=this.tech_.buffered(),t=wn(i,n);if(t.length&&n+3<=t.end(0)){this.cancelTimer_();this.seekTo(n);this.logger_("Stopped at "+n+" while inside a buffered region "+("["+t.start(0)+" -> "+t.end(0)+"]. Attempting to resume ")+"playback by seeking to the current time.");this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"});return}}}},{key:"techWaiting_",value:function(){var i=this.seekable(),n=this.tech_.currentTime(),r,u,t,f;return this.tech_.seeking()&&this.fixesBadSeeks_()?!0:this.tech_.seeking()||this.timer_!==null?!0:this.beforeSeekableWindow_(i,n)?(r=i.end(i.length-1),this.logger_("Fell out of live window at time "+n+". Seeking to "+("live point (seekable end) "+r)),this.cancelTimer_(),this.seekTo(r),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0):(u=this.tech_.buffered(),t=bn(u,n),this.videoUnderflow_(t,u,n))?(this.cancelTimer_(),this.seekTo(n),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0):t.length>0?(f=t.start(0)-n,this.logger_("Stopped at "+n+", setting timer for "+f+", seeking "+("to "+t.start(0))),this.timer_=setTimeout(this.skipTheGap_.bind(this),f*1e3,n),!0):!1}},{key:"afterSeekableWindow_",value:function(n,t,i){var f=arguments.length>3&&arguments[3]!==undefined?arguments[3]:!1,r,u;return n.length?(r=n.end(n.length-1)+pi,u=!i.endList,u&&f&&(r=n.end(n.length-1)+i.targetDuration*3),t>r)?!0:!1:!1}},{key:"beforeSeekableWindow_",value:function(n,t){return n.length&&n.start(0)>0&&t<n.start(0)-pi?!0:!1}},{key:"videoUnderflow_",value:function(n,t,i){if(n.length===0){var r=this.gapFromVideoUnderflow_(t,i);if(r)return this.logger_("Encountered a gap in video from "+r.start+" to "+r.end+". "+("Seeking to current time "+i)),!0}return!1}},{key:"skipTheGap_",value:function(n){var r=this.tech_.buffered(),t=this.tech_.currentTime(),i=bn(r,t);(this.cancelTimer_(),i.length!==0&&t===n)&&(this.logger_("skipTheGap_:","currentTime:",t,"scheduled currentTime:",n,"nextRange start:",i.start(0)),this.seekTo(i.start(0)+sh),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))}},{key:"gapFromVideoUnderflow_",value:function(n,t){for(var r,f,u=iat(n),i=0;i<u.length;i++)if(r=u.start(i),f=u.end(i),t-r<4&&t-r>2)return{start:r,end:f};return null}}]),t}(),fpt={errorInterval:30,getSource:function(n){var t=this.tech({IWillNotUseThisInPlugins:!0}),i=t.currentSource_;return n(i)}},dtt=function dtt(n,t){var e=0,u=0,r=i.mergeOptions(fpt,t);n.ready(function(){n.trigger({type:"usage",name:"hls-error-reload-initialized"})});var o=function(){u&&n.currentTime(u)},h=function(t){if(t!==null&&t!==undefined){u=n.duration()!==Infinity&&n.currentTime()||0;n.one("loadedmetadata",o);n.src(t);n.trigger({type:"usage",name:"hls-error-reload"});n.play()}},s=function(){if(Date.now()-e<r.errorInterval*1e3){n.trigger({type:"usage",name:"hls-error-reload-canceled"});return}if(!r.getSource||typeof r.getSource!="function"){i.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return e=Date.now(),r.getSource.call(n,h)},f=function f(){n.off("loadedmetadata",o);n.off("error",s);n.off("dispose",f)},c=function(t){f();dtt(n,t)};n.on("error",s);n.on("dispose",f);n.reloadSourceOnError=c},gtt=function(n){dtt(this,n)};i.use("*",function(n){return{setSource:function(n,t){t(null,n)},setCurrentTime:function(t){return n.vhs&&n.currentSource().src===n.vhs.source_.src&&n.vhs.setCurrentTime(t),t},play:function(){n.vhs&&n.currentSource().src===n.vhs.source_.src&&n.vhs.setCurrentTime(n.tech_.currentTime())}}});ht={PlaylistLoader:fh,Playlist:vt,Decrypter:lct,AsyncStream:pg,decrypt:wg,utils:plt,STANDARD_PLAYLIST_SELECTOR:wvt,INITIAL_PLAYLIST_SELECTOR:kvt,comparePlaylistBandwidth:fy,comparePlaylistResolution:yvt,xhr:hn()};["GOAL_BUFFER_LENGTH","MAX_GOAL_BUFFER_LENGTH","GOAL_BUFFER_LENGTH_RATE","BUFFER_LOW_WATER_LINE","MAX_BUFFER_LOW_WATER_LINE","BUFFER_LOW_WATER_LINE_RATE","BANDWIDTH_VARIANCE"].forEach(function(n){Object.defineProperty(ht,n,{get:function(){return i.log.warn("using Hls."+n+" is UNSAFE be sure you know what you are doing"),bt[n]},set:function(t){if(i.log.warn("using Hls."+n+" is UNSAFE be sure you know what you are doing"),typeof t!="number"||t<0){i.log.warn("value of Hls."+n+" must be greater than or equal to 0");return}bt[n]=t}})});var nit="videojs-vhs",tit=function(n){var t;return/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i.test(n)?"hls":(t=/^application\/dash\+xml/i,t.test(n))?"dash":null},iit=function(n,t){for(var u=t.media(),r=-1,i=0;i<n.length;i++)if(n[i].id===u.uri){r=i;break}n.selectedIndex_=r;n.trigger({selectedIndex:r,type:"change"})},ept=function(n,t){t.representations().forEach(function(t){n.addQualityLevel(t)});iit(n,t.playlists)};ht.canPlaySource=function(){return i.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var opt=function(n,t,r){var o,s,f,e,u;if(!n)return n;if(o=void 0,s=void 0,r.mimeType_)o=t.mimeType_,s=r.mimeType_;else{var h=rtt(t.mimeType_),a=h.parameters.codecs.split(","),c=void 0,l=void 0;a.forEach(function(n){n=n.trim();kv(n)?c=n:dv(n)&&(l=n)});o=h.type+'; codecs="'+l+'"';s=h.type.replace("video","audio")+'; codecs="'+c+'"'}f={};e=t.playlist_;for(u in n)f[u]={audioContentType:s,videoContentType:o},e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(f[u].pssh=e.contentProtection[u].pssh),typeof n[u]=="string"&&(f[u].url=n[u]);return i.mergeOptions(n,f)},spt=function(n){var u=n.masterPlaylistController_.mainSegmentLoader_,f=n.masterPlaylistController_.audioSegmentLoader_,t=i.players[n.tech_.options_.playerId],r;t.eme&&(r=opt(n.source_.keySystems,u,f),r&&(t.currentSource().keySystems=r,i.browser.IE_VERSION===11||!t.eme.initializeMediaKeys||t.eme.initializeMediaKeys()))},rit=function(){if(!window.localStorage)return null;var n=window.localStorage.getItem(nit);if(!n)return null;try{return JSON.parse(n)}catch(t){return null}},hpt=function(n){if(!window.localStorage)return!1;var t=rit();t=t?i.mergeOptions(t,n):n;try{window.localStorage.setItem(nit,JSON.stringify(t))}catch(r){return!1}return t};ht.supportsNativeHls=function(){var r=t.createElement("video"),n;return i.getTech("Html5").isSupported()?(n=["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"],n.some(function(n){return/maybe|probably/i.test(r.canPlayType(n))})):!1}();ht.supportsNativeDash=function(){return i.getTech("Html5").isSupported()?/maybe|probably/i.test(t.createElement("video").canPlayType("application/dash+xml")):!1}();ht.supportsTypeNatively=function(n){return n==="hls"?ht.supportsNativeHls:n==="dash"?ht.supportsNativeDash:!1};ht.isSupported=function(){return i.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var cpt=i.getComponent("Component"),uit=function(n){function r(n,u,f){var e,o;if(ii(this,r),e=oi(this,(r.__proto__||Object.getPrototypeOf(r)).call(this,u,f.hls)),u.options_&&u.options_.playerId&&(o=i(u.options_.playerId),o.hasOwnProperty("hls")||Object.defineProperty(o,"hls",{get:function(){return i.log.warn("player.hls is deprecated. Use player.tech().hls instead."),u.trigger({type:"usage",name:"hls-player-access"}),e},configurable:!0}),o.vhs=e,o.dash=e,e.player_=o),e.tech_=u,e.source_=n,e.stats={},e.setOptions_(),e.options_.overrideNative&&u.overrideNativeAudioTracks&&u.overrideNativeVideoTracks)u.overrideNativeAudioTracks(!0),u.overrideNativeVideoTracks(!0);else if(e.options_.overrideNative&&(u.featuresNativeVideoTracks||u.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");e.on(t,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(){var n=t.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement;n&&n.contains(e.tech_.el())&&e.masterPlaylistController_.smoothQualityChange_()});e.on(e.tech_,"seeking",function(){this.tech_.currentTime()===0&&this.tech_.player_.loop()&&this.setCurrentTime(0)});e.on(e.tech_,"error",function(){this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()});e.on(e.tech_,"play",e.play);return e}return yi(r,n),ui(r,[{key:"setOptions_",value:function(){var t=this,n;this.options_.withCredentials=this.options_.withCredentials||!1;this.options_.handleManifestRedirects=this.options_.handleManifestRedirects||!1;this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions===!1?!1:!0;this.options_.smoothQualityChange=this.options_.smoothQualityChange||!1;this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage!="undefined"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1;this.options_.customTagParsers=this.options_.customTagParsers||[];this.options_.customTagMappers=this.options_.customTagMappers||[];this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1;typeof this.options_.blacklistDuration!="number"&&(this.options_.blacklistDuration=300);typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage&&(n=rit(),n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"})));typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=bt.INITIAL_BANDWIDTH);this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===bt.INITIAL_BANDWIDTH;["withCredentials","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys"].forEach(function(n){typeof t.source_[n]!="undefined"&&(t.options_[n]=t.source_[n])});this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions}},{key:"src",value:function(n,t){var r=this;if(n){this.setOptions_();this.options_.url=this.source_.src;this.options_.tech=this.tech_;this.options_.externHls=ht;this.options_.sourceType=tit(t);this.options_.seekTo=function(n){r.tech_.setCurrentTime(n);r.setCurrentTime(n)};this.masterPlaylistController_=new tpt(this.options_);this.playbackWatcher_=new upt(i.mergeOptions(this.options_,{seekable:function(){return r.seekable()},media:function(){return r.masterPlaylistController_.media()}}));this.masterPlaylistController_.on("error",function(){var n=i.players[r.tech_.options_.playerId];n.error(r.masterPlaylistController_.error)});this.masterPlaylistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):ht.STANDARD_PLAYLIST_SELECTOR.bind(this);this.masterPlaylistController_.selectInitialPlaylist=ht.INITIAL_PLAYLIST_SELECTOR.bind(this);this.playlists=this.masterPlaylistController_.masterPlaylistLoader_;this.mediaSource=this.masterPlaylistController_.mediaSource;Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(n){this.masterPlaylistController_.selectPlaylist=n.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(n){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=n;this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.bandwidth},set:function(n){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=n;this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var t=1/(this.bandwidth||1),n=void 0;return n=this.throughput>0?1/this.throughput:0,Math.floor(1/(t+n))},set:function(){i.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 r.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return r.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return r.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return r.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return r.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return r.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return r.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return r.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},buffered:{get:function(){return kn(r.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return r.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return r.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return r.tech_.name_},enumerable:!0},duration:{get:function(){return r.tech_.duration()},enumerable:!0},master:{get:function(){return r.playlists.master},enumerable:!0},playerDimensions:{get:function(){return r.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return kn(r.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return r.tech_.getVideoPlaybackQuality()},enumerable:!0}});this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));this.tech_.on("bandwidthupdate",function(){r.options_.useBandwidthFromLocalStorage&&hpt({bandwidth:r.bandwidth,throughput:Math.round(r.throughput)})});this.masterPlaylistController_.on("selectedinitialmedia",function(){rpt(r);spt(r)});this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")});(this.tech_.ready(function(){return r.setupQualityLevels_()}),this.tech_.el())&&this.tech_.src(i.URL.createObjectURL(this.masterPlaylistController_.mediaSource))}}},{key:"setupQualityLevels_",value:function(){var n=this,t=i.players[this.tech_.options_.playerId];if(t&&t.qualityLevels){this.qualityLevels_=t.qualityLevels();this.masterPlaylistController_.on("selectedinitialmedia",function(){ept(n.qualityLevels_,n)});this.playlists.on("mediachange",function(){iit(n.qualityLevels_,n.playlists)})}}},{key:"play",value:function(){this.masterPlaylistController_.play()}},{key:"setCurrentTime",value:function(n){this.masterPlaylistController_.setCurrentTime(n)}},{key:"duration",value:function(){return this.masterPlaylistController_.duration()}},{key:"seekable",value:function(){return this.masterPlaylistController_.seekable()}},{key:"dispose",value: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_.hls&&delete this.tech_.hls;act(r.prototype.__proto__||Object.getPrototypeOf(r.prototype),"dispose",this).call(this)}},{key:"convertToProgramTime",value:function(n,t){return tat({playlist:this.masterPlaylistController_.media(),time:n,callback:t})}},{key:"seekToProgramTime",value:function(n,t){var i=arguments.length>2&&arguments[2]!==undefined?arguments[2]:!0,r=arguments.length>3&&arguments[3]!==undefined?arguments[3]:2;return yn({programTime:n,playlist:this.masterPlaylistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}}]),r}(cpt),sy={name:"videojs-http-streaming",VERSION:"1.11.2",canHandleSource:function(n){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},r=i.mergeOptions(i.options,t);return sy.canPlayType(n.type,r)},handleSource:function(n,t){var r=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},u=i.mergeOptions(i.options,r);return t.hls=new uit(n,t,u),t.hls.xhr=hn(),t.hls.src(n.src,n.type),t.hls},canPlayType:function(n){var r=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},u=i.mergeOptions(i.options,r),f=u.hls.overrideNative,t=tit(n),e=t&&(!ht.supportsTypeNatively(t)||f);return e?"maybe":""}};return(typeof i.MediaSource=="undefined"||typeof i.URL=="undefined")&&(i.MediaSource=ce,i.URL=ty),ce.supportsNativeMediaSources()&&i.getTech("Html5").registerSourceHandler(sy,0),i.HlsHandler=uit,i.HlsSourceHandler=sy,i.Hls=ht,i.use||i.registerComponent("Hls",ht),i.options.hls=i.options.hls||{},i.registerPlugin?i.registerPlugin("reloadSourceOnError",gtt):i.plugin("reloadSourceOnError",gtt),i});!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):n.videojsContribAds=t(n.videojs)}(this,function(n){"use strict";function st(n){"playing"===n.type?ut(this,n):"ended"===n.type?ft(this,n):"loadstart"===n.type||"loadeddata"===n.type||"loadedmetadata"===n.type?et(this,n):"play"===n.type?ot(this,n):this.ads.isInAdMode()&&(this.ads.isContentResuming()?i(this,"content",n):i(this,"ad",n))}function tt(n){n.ads.cancelPlayTimeout||(n.ads.cancelPlayTimeout=n.setTimeout(function(){n.ads.cancelPlayTimeout=null;n.ads.isInAdMode()&&(n.paused()||n.pause(),n.ads._cancelledPlay=!0)},1))}n=n&&n.hasOwnProperty("default")?n["default"]:n;var v=function(n,t){t.isImmediatePropagationStopped=function(){return!0};t.cancelBubble=!0;t.isPropagationStopped=function(){return!0}},i=function(n,t,i){v(0,i);n.trigger({type:t+i.type,originalEvent:i})},ut=function(n,t){n.ads.isInAdMode()&&(n.ads.isContentResuming()?n.ads._contentEnding&&i(n,"content",t):n.ads._cancelledPlay?v(0,t):i(n,"ad",t))},ft=function(n,t){if(n.ads.isInAdMode()){if(n.ads.isContentResuming())return;i(n,"ad",t)}else n.ads._contentHasEnded||i(n,"content",t)},et=function(n,t){if(!("loadstart"===t.type&&!n.ads._hasThereBeenALoadStartDuringPlayerLife||"loadeddata"===t.type&&!n.ads._hasThereBeenALoadedData||"loadedmetadata"===t.type&&!n.ads._hasThereBeenALoadedMetaData))if(n.ads.inAdBreak())i(n,"ad",t);else{if(n.currentSrc()!==n.ads.contentSrc)return;i(n,"content",t)}},ot=function(n,t){var r=n.ads._cancelledPlay&&!n.ads.isInAdMode();n.ads.inAdBreak()?i(n,"ad",t):(n.ads.isContentResuming()||r)&&i(n,"content",t)};var o,s="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},y="undefined"!=typeof window?window:void 0!==s?s:"undefined"!=typeof self?self:{},p={},w=(Object.freeze||Object)({"default":p}),ht=w&&p||w,b=void 0!==s?s:"undefined"!=typeof window?window:{};"undefined"!=typeof document?o=document:(o=b["__GLOBAL_DOCUMENT_CACHE@4"])||(o=b["__GLOBAL_DOCUMENT_CACHE@4"]=ht);var ct=o,lt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r=(function(){function t(n){this.value=n}function n(n){function u(i,r){try{var e=n[i](r),o=e.value;o instanceof t?Promise.resolve(o.value).then(function(n){u("next",n)},function(n){u("throw",n)}):f(e.done?"return":"normal",e.value)}catch(s){f("throw",s)}}function f(n,t){switch(n){case"return":i.resolve({value:t,done:!0});break;case"throw":i.reject(t);break;default:i.resolve({value:t,done:!1})}(i=i.next)?u(i.key,i.arg):r=null}var i,r;this._invoke=function(n,t){return new Promise(function(f,e){var o={key:n,arg:t,resolve:f,reject:e,next:null};r?r=r.next=o:(i=r=o,u(n,t))})};"function"!=typeof n["return"]&&(this["return"]=undefined)}"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this});n.prototype.next=function(n){return this._invoke("next",n)};n.prototype["throw"]=function(n){return this._invoke("throw",n)};n.prototype["return"]=function(n){return this._invoke("return",n)}}(),function(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}),u=function(n,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)},f=function(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?n:t},k=function(n,t){return t?encodeURIComponent(n):n},d=function(n,t,i){if(n&&n[i])for(var f=n[i],u=Object.keys(f),r=0;r<u.length;r++)t["{mediainfo."+i+"."+u[r]+"}"]=f[u[r]]},g={processMetadataTracks:function(n,t){for(var i=n.textTracks(),u=function(i){"metadata"===i.kind&&(n.ads.cueTextTracks.setMetadataTrackMode(i),t(n,i))},r=0;r<i.length;r++)u(i[r]);i.addEventListener("addtrack",function(n){u(n.track)})},setMetadataTrackMode:function(){},getSupportedAdCue:function(n,t){return t},isSupportedAdCue:function(){return!0},getCueId:function(n,t){return t.id}};g.processAdTrack=function(t,i,r,u){var o,f,s,e,h,c,l;for(t.ads.includedCues={},o=0;o<i.length;o++){if(f=i[o],s=this.getSupportedAdCue(t,f),!this.isSupportedAdCue(t,f))return void n.log.warn("Skipping as this is not a supported ad cue.",f);if(e=this.getCueId(t,f),h=f.startTime,(l=e)!==undefined&&t.ads.includedCues[l])return void n.log("Skipping ad already seen with ID "+e);u&&u(t,s,e,h);r(t,s,e,h);(c=e)!==undefined&&""!==c&&(t.ads.includedCues[c]=!0)}};var nt=function(){function t(n){r(this,t);this.player=n}return t.prototype.transitionTo=function(n){var i=this.player,t;this.cleanup();t=new n(i);i.ads._state=t;i.ads.debug(this.constructor.name+" -> "+t.constructor.name);for(var u=arguments.length,f=Array(u>1?u-1:0),r=1;r<u;r++)f[r-1]=arguments[r];t.init.apply(t,[i].concat(f))},t.prototype.init=function(){},t.prototype.cleanup=function(){},t.prototype.onPlay=function(){},t.prototype.onPlaying=function(){},t.prototype.onEnded=function(){},t.prototype.onAdsReady=function(){n.log.warn("Unexpected adsready event")},t.prototype.onAdsError=function(){},t.prototype.onAdsCanceled=function(){},t.prototype.onAdTimeout=function(){},t.prototype.onAdStarted=function(){},t.prototype.onContentChanged=function(){},t.prototype.onContentResumed=function(){},t.prototype.onContentEnded=function(){n.log.warn("Unexpected contentended event")},t.prototype.onNoPreroll=function(){},t.prototype.onNoPostroll=function(){},t.prototype.startLinearAdMode=function(){n.log.warn("Unexpected startLinearAdMode invocation (State via "+this.constructor.name+")")},t.prototype.endLinearAdMode=function(){n.log.warn("Unexpected endLinearAdMode invocation (State via "+this.constructor.name+")")},t.prototype.skipLinearAdMode=function(){n.log.warn("Unexpected skipLinearAdMode invocation (State via "+this.constructor.name+")")},t.prototype.isAdState=function(){throw new Error("isAdState unimplemented for "+this.constructor.name);},t.prototype.isContentResuming=function(){return!1},t.prototype.inAdBreak=function(){return!1},t.prototype.handleEvent=function(n){var t=this.player;"play"===n?this.onPlay(t):"adsready"===n?this.onAdsReady(t):"adserror"===n?this.onAdsError(t):"adscanceled"===n?this.onAdsCanceled(t):"adtimeout"===n?this.onAdTimeout(t):"ads-ad-started"===n?this.onAdStarted(t):"contentchanged"===n?this.onContentChanged(t):"contentresumed"===n?this.onContentResumed(t):"contentended"===n?this.onContentEnded(t):"playing"===n?this.onPlaying(t):"ended"===n?this.onEnded(t):"nopreroll"===n?this.onNoPreroll(t):"nopostroll"===n&&this.onNoPostroll(t)},t}(),h=function(n){function i(t){r(this,i);var u=f(this,n.call(this,t));return u.contentResuming=!1,u}return u(i,n),i.prototype.isAdState=function(){return!0},i.prototype.onPlaying=function(){this.contentResuming&&this.transitionTo(t)},i.prototype.onContentResumed=function(){this.contentResuming&&this.transitionTo(t)},i.prototype.isContentResuming=function(){return this.contentResuming},i.prototype.inAdBreak=function(){return!0===this.player.ads._inLinearAdMode},i}(nt),c=function(n){function t(){return r(this,t),f(this,n.apply(this,arguments))}return u(t,n),t.prototype.isAdState=function(){return!1},t.prototype.onContentChanged=function(n){n.ads.debug("Received contentchanged event (ContentState)");n.paused()?this.transitionTo(a):(this.transitionTo(l,!1),n.pause(),n.ads._pausedOnContentupdate=!0)},t}(nt);var e={start:function(t){t.ads.debug("Starting ad break");t.ads._inLinearAdMode=!0;t.trigger("adstart");t.ads.shouldPlayContentBehindAd(t)||(t.ads.snapshot=function(t){var e=void 0,r,u;e=n.browser.IS_IOS&&t.ads.isLive(t)&&t.seekable().length>0?t.currentTime()-t.seekable().end(0):t.currentTime();var f=t.$(".vjs-tech"),o=t.textTracks?t.textTracks():[],s=[],i={ended:t.ended(),currentSrc:t.currentSrc(),src:t.tech_.src(),currentTime:e,type:t.currentType()};for(f&&(i.nativePoster=f.poster,i.style=f.getAttribute("style")),r=0;r<o.length;r++)u=o[r],s.push({track:u,mode:u.mode}),u.mode="disabled";return i.suppressedTracks=s,i}(t));t.ads.shouldPlayContentBehindAd(t)&&(t.ads.preAdVolume_=t.volume(),t.volume(0));t.addClass("vjs-ad-playing");t.hasClass("vjs-live")&&t.removeClass("vjs-live");t.ads.removeNativePoster()},end:function(t){t.ads.debug("Ending ad break");t.ads.adType=null;t.ads._inLinearAdMode=!1;t.trigger("adend");t.removeClass("vjs-ad-playing");t.ads.isLive(t)&&t.addClass("vjs-live");t.ads.shouldPlayContentBehindAd(t)||function(t,i){if(!0!==t.ads.disableNextSnapshotRestore){var r=t.$(".vjs-tech"),c=20,f=i.suppressedTracks,e=void 0,o=function(){for(var n=0;n<f.length;n++)(e=f[n]).track.mode=e.mode},u=function(){var r=void 0;n.browser.IS_IOS&&t.ads.isLive(t)?i.currentTime<0&&(r=t.seekable().length>0?t.seekable().end(0)+i.currentTime:t.currentTime(),t.currentTime(r)):i.ended?t.currentTime(t.duration()):t.currentTime(i.currentTime);i.ended||t.play();t.ads.shouldRemoveAutoplay_&&(t.autoplay(!1),t.ads.shouldRemoveAutoplay_=!1)},s=function h(){if((t.off("contentcanplay",h),t.ads.tryToResumeTimeout_&&(t.clearTimeout(t.ads.tryToResumeTimeout_),t.ads.tryToResumeTimeout_=null),(r=t.el().querySelector(".vjs-tech")).readyState>1)||r.seekable===undefined||r.seekable.length>0)return u();if(c--)t.setTimeout(h,50);else try{u()}catch(i){n.log.warn("Failed to resume the content after an advertisement",i)}};i.nativePoster&&(r.poster=i.nativePoster);"style"in i&&r.setAttribute("style",i.style||"");t.ads.videoElementRecycled()?(t.one("contentloadedmetadata",o),n.browser.IS_IOS&&!t.autoplay()&&(t.autoplay(!0),t.ads.shouldRemoveAutoplay_=!0),t.src({src:i.currentSrc,type:i.type}),t.one("contentcanplay",s),t.ads.tryToResumeTimeout_=t.setTimeout(s,2e3)):(o(),t.ended()||t.play())}else t.ads.disableNextSnapshotRestore=!1}(t,t.ads.snapshot);t.ads.shouldPlayContentBehindAd(t)&&t.volume(t.ads.preAdVolume_)}},l=function(i){function o(){return r(this,o),f(this,i.apply(this,arguments))}return u(o,i),o.prototype.init=function(n,t){n.addClass("vjs-ad-loading");var i=n.ads.settings.timeout;"number"==typeof n.ads.settings.prerollTimeout&&(i=n.ads.settings.prerollTimeout);this._timeout=n.setTimeout(function(){n.trigger("adtimeout")},i);t?this.handleAdsReady():this.adsReady=!1},o.prototype.onAdsReady=function(t){t.ads.inAdBreak()||t.ads.isContentResuming()?n.log.warn("Unexpected adsready event (Preroll)"):(t.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},o.prototype.handleAdsReady=function(){this.adsReady=!0;this.player.ads.nopreroll_?this.noPreroll():this.readyForPreroll()},o.prototype.afterLoadStart=function(n){var t=this.player;t.ads._hasThereBeenALoadStartDuringPlayerLife?n():(t.ads.debug("Waiting for loadstart..."),t.one("loadstart",function(){t.ads.debug("Received loadstart event");n()}))},o.prototype.noPreroll=function(){var n=this;this.afterLoadStart(function(){n.player.ads.debug("Skipping prerolls due to nopreroll event (Preroll)");n.transitionTo(t)})},o.prototype.readyForPreroll=function(){var n=this.player;this.afterLoadStart(function(){n.ads.debug("Triggered readyforpreroll event (Preroll)");n.trigger("readyforpreroll")})},o.prototype.onPlay=function(n){n.ads.debug("Received play event (Preroll)");this.inAdBreak()||this.isContentResuming()||tt(this.player)},o.prototype.onAdsCanceled=function(n){var i=this;n.ads.debug("adscanceled (Preroll)");this.afterLoadStart(function(){i.transitionTo(t)})},o.prototype.onAdsError=function(i){var r=this;n.log("adserror (Preroll)");this.inAdBreak()&&i.ads.endLinearAdMode();this.afterLoadStart(function(){r.transitionTo(t)})},o.prototype.startLinearAdMode=function(){var t=this.player;!this.adsReady||t.ads.inAdBreak()||this.isContentResuming()?n.log.warn("Unexpected startLinearAdMode invocation (Preroll)"):(t.clearTimeout(this._timeout),t.ads.adType="preroll",e.start(t))},o.prototype.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},o.prototype.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(n.removeClass("vjs-ad-loading"),e.end(n),this.contentResuming=!0)},o.prototype.skipLinearAdMode=function(){var r=this,i=this.player;i.ads.inAdBreak()||this.isContentResuming()?n.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){i.trigger("adskip");i.ads.debug("skipLinearAdMode (Preroll)");r.transitionTo(t)})},o.prototype.onAdTimeout=function(n){var i=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (Preroll)");i.transitionTo(t)})},o.prototype.onNoPreroll=function(t){t.ads.inAdBreak()||this.isContentResuming()?n.log.warn("Unexpected nopreroll event (Preroll)"):this.noPreroll()},o.prototype.cleanup=function(){var t=this.player;t.ads._hasThereBeenALoadStartDuringPlayerLife||n.log.warn("Leaving Preroll state before loadstart event can cause issues.");t.removeClass("vjs-ad-loading");t.clearTimeout(this._timeout)},o}(h),at=function(n){function t(){return r(this,t),f(this,n.apply(this,arguments))}return u(t,n),t.prototype.init=function(n){n.ads.adType="midroll";e.start(n)},t.prototype.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(this.contentResuming=!0,e.end(n))},t.prototype.onAdsError=function(n){this.inAdBreak()&&n.ads.endLinearAdMode()},t}(h),vt=function(t){function i(){return r(this,i),f(this,t.apply(this,arguments))}return u(i,t),i.prototype.init=function(n){var i=this,t;(n.ads._contentEnding=!0,n.ads.nopostroll_)?n.setTimeout(function(){n.ads.debug("Triggered ended event (no postroll)");i.contentResuming=!0;n.trigger("ended")},1):(n.addClass("vjs-ad-loading"),t=n.ads.settings.timeout,"number"==typeof n.ads.settings.postrollTimeout&&(t=n.ads.settings.postrollTimeout),this._postrollTimeout=n.setTimeout(function(){n.trigger("adtimeout")},t))},i.prototype.startLinearAdMode=function(){var t=this.player;t.ads.inAdBreak()||this.isContentResuming()?n.log.warn("Unexpected startLinearAdMode invocation (Postroll)"):(t.ads.adType="postroll",t.clearTimeout(this._postrollTimeout),e.start(t))},i.prototype.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},i.prototype.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(n.removeClass("vjs-ad-loading"),e.end(n),this.contentResuming=!0,n.ads.debug("Triggered ended event (endLinearAdMode)"),n.trigger("ended"))},i.prototype.skipLinearAdMode=function(){var t=this.player;t.ads.inAdBreak()||this.isContentResuming()?n.log.warn("Unexpected skipLinearAdMode invocation"):(t.ads.debug("Postroll abort (skipLinearAdMode)"),t.trigger("adskip"),this.abort())},i.prototype.onAdTimeout=function(n){n.ads.debug("Postroll abort (adtimeout)");this.abort()},i.prototype.onAdsError=function(n){n.ads.debug("Postroll abort (adserror)");n.ads.inAdBreak()&&n.ads.endLinearAdMode();this.abort()},i.prototype.onEnded=function(){this.isContentResuming()?this.transitionTo(it):n.log.warn("Unexpected ended event during postroll")},i.prototype.onContentChanged=function(){this.isContentResuming()?this.transitionTo(a):this.inAdBreak()||this.transitionTo(l)},i.prototype.onNoPostroll=function(){this.isContentResuming()||this.inAdBreak()?n.log.warn("Unexpected nopostroll event (Postroll)"):this.transitionTo(it)},i.prototype.abort=function(){var n=this.player;this.contentResuming=!0;n.removeClass("vjs-ad-loading");n.ads.debug("Triggered ended event (postroll abort)");n.trigger("ended")},i.prototype.cleanup=function(){var n=this.player;n.clearTimeout(this._postrollTimeout);n.ads._contentEnding=!1},i}(h),a=function(n){function i(){return r(this,i),f(this,n.apply(this,arguments))}return u(i,n),i.prototype.init=function(){this.adsReady=!1},i.prototype.onAdsReady=function(n){n.ads.debug("Received adsready event (BeforePreroll)");this.adsReady=!0},i.prototype.onPlay=function(n){n.ads.debug("Received play event (BeforePreroll)");tt(n);this.transitionTo(l,this.adsReady)},i.prototype.onAdsCanceled=function(n){n.ads.debug("adscanceled (BeforePreroll)");this.transitionTo(t)},i.prototype.onAdsError=function(){this.transitionTo(t)},i.prototype.onNoPreroll=function(){this.player.ads.debug("Skipping prerolls due to nopreroll event (BeforePreroll)");this.transitionTo(t)},i.prototype.skipLinearAdMode=function(){this.player.trigger("adskip");this.transitionTo(t)},i.prototype.onContentChanged=function(){},i}(c),t=function(n){function t(){return r(this,t),f(this,n.apply(this,arguments))}return u(t,n),t.prototype.init=function(n){n.paused()&&(n.ads._cancelledPlay||n.ads._pausedOnContentupdate)&&n.play()},t.prototype.onAdsReady=function(n){n.ads.debug("Received adsready event (ContentPlayback)");n.ads.nopreroll_||(n.ads.debug("Triggered readyforpreroll event (ContentPlayback)"),n.trigger("readyforpreroll"))},t.prototype.onContentEnded=function(n){n.ads.debug("Received contentended event");this.transitionTo(vt)},t.prototype.startLinearAdMode=function(){this.transitionTo(at)},t}(c),it=function(t){function i(){return r(this,i),f(this,t.apply(this,arguments))}return u(i,t),i.prototype.init=function(n){n.ads._contentHasEnded=!0},i.prototype.startLinearAdMode=function(){n.log.warn("Unexpected startLinearAdMode invocation (AdsDone)")},i}(c),yt=n.getTech("Html5").Events,pt={timeout:5e3,prerollTimeout:undefined,postrollTimeout:undefined,debug:!1,stitchedAds:!1},rt=function(t){var r,i=this,f=n.mergeOptions(pt,t),e=yt.concat(["firstplay","loadedalldata","playing"]),u;i.on(e,st);i.setTimeout(function(){i.ads._hasThereBeenALoadStartDuringPlayerLife||""===i.src()||n.log.error("videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see https://github.com/videojs/videojs-contrib-ads#important-note-about-initialization")},5e3);i.on("ended",function(){i.hasClass("vjs-has-started")||i.addClass("vjs-has-started")});i.on(["addurationchange","adcanplay"],function(){i.ads.snapshot&&i.currentSrc()===i.ads.snapshot.currentSrc||i.ads.inAdBreak()&&i.play()});i.on("nopreroll",function(){i.ads.debug("Received nopreroll event");i.ads.nopreroll_=!0});i.on("nopostroll",function(){i.ads.debug("Received nopostroll event");i.ads.nopostroll_=!0});i.on("playing",function(){i.ads._cancelledPlay=!1;i.ads._pausedOnContentupdate=!1});i.one("loadstart",function(){i.ads._hasThereBeenALoadStartDuringPlayerLife=!0});i.on("loadeddata",function(){i.ads._hasThereBeenALoadedData=!0});i.on("loadedmetadata",function(){i.ads._hasThereBeenALoadedMetaData=!0});i.ads={settings:f,disableNextSnapshotRestore:!1,_contentEnding:!1,_contentHasEnded:!1,_hasThereBeenALoadStartDuringPlayerLife:!1,_hasThereBeenALoadedData:!1,_hasThereBeenALoadedMetaData:!1,_inLinearAdMode:!1,adType:null,VERSION:"__VERSION__",reset:function(){i.ads.disableNextSnapshotRestore=!1;i.ads._contentEnding=!1;i.ads._contentHasEnded=!1;i.ads.snapshot=null;i.ads.adType=null;i.ads._hasThereBeenALoadedData=!1;i.ads._hasThereBeenALoadedMetaData=!1;i.ads._cancelledPlay=!1;i.ads.nopreroll_=!1;i.ads.nopostroll_=!1},startLinearAdMode:function(){i.ads._state.startLinearAdMode()},endLinearAdMode:function(){i.ads._state.endLinearAdMode()},skipLinearAdMode:function(){i.ads._state.skipLinearAdMode()},stitchedAds:function(n){return n!==undefined&&(this._stitchedAds=!!n),this._stitchedAds},videoElementRecycled:function(){if(i.ads.shouldPlayContentBehindAd(i))return!1;if(!this.snapshot)throw new Error("You cannot use videoElementRecycled while there is no snapshot.");var n=i.tech_.src()!==this.snapshot.src,t=i.currentSrc()!==this.snapshot.currentSrc;return n||t},isLive:function(t){return t.duration()===Infinity||"8"===n.browser.IOS_VERSION&&0===t.duration()},shouldPlayContentBehindAd:function(t){return!n.browser.IS_IOS&&!n.browser.IS_ANDROID&&t.duration()===Infinity},isInAdMode:function(){return this._state.isAdState()},isContentResuming:function(){return this._state.isContentResuming()},isAdPlaying:function(){return this._state.inAdBreak()},inAdBreak:function(){return this._state.inAdBreak()},removeNativePoster:function(){var n=i.$(".vjs-tech");n&&n.removeAttribute("poster")},debug:function(){if(this.settings.debug){for(var r=arguments.length,t=Array(r),i=0;i<r;i++)t[i]=arguments[i];1===t.length&&"string"==typeof t[0]?n.log("ADS: "+t[0]):n.log.apply(n,["ADS:"].concat(t))}}};i.ads._state=new a(i);i.ads.stitchedAds(f.stitchedAds);i.ads.cueTextTracks=g;i.ads.adMacroReplacement=function(t,i,r){var u,f;i===undefined&&(i=!1);u={};for(f in r!==undefined&&(u=r),u["{player.id}"]=this.options_["data-player"],u["{mediainfo.id}"]=this.mediainfo?this.mediainfo.id:"",u["{mediainfo.name}"]=this.mediainfo?this.mediainfo.name:"",u["{mediainfo.description}"]=this.mediainfo?this.mediainfo.description:"",u["{mediainfo.tags}"]=this.mediainfo?this.mediainfo.tags:"",u["{mediainfo.reference_id}"]=this.mediainfo?this.mediainfo.reference_id:"",u["{mediainfo.duration}"]=this.mediainfo?this.mediainfo.duration:"",u["{mediainfo.ad_keys}"]=this.mediainfo?this.mediainfo.ad_keys:"",u["{player.duration}"]=this.duration(),u["{timestamp}"]=(new Date).getTime(),u["{document.referrer}"]=ct.referrer,u["{window.location.href}"]=y.location.href,u["{random}"]=Math.floor(1e12*Math.random()),d(this.mediainfo,u,"custom_fields"),d(this.mediainfo,u,"customFields"),u)t=t.split(f).join(k(u[f],i));return t.replace(/{pageVariable\.([^}]+)}/g,function(t,r){for(var o,u=void 0,s=y,e=r.split("."),f=0;f<e.length;f++)f===e.length-1?u=s[e[f]]:s=s[e[f]];return o=void 0===u?"undefined":lt(u),null===u?"null":u===undefined?(n.log.warn('Page variable "'+r+'" not found'),""):"string"!==o&&"number"!==o&&"boolean"!==o?(n.log.warn('Page variable "'+r+'" is not a supported type'),""):k(String(u),i)})}.bind(i);(r=i).ads.contentSrc=r.currentSrc();r.ads._seenInitialLoadstart=!1;r.on("loadstart",function(){if(!r.ads.inAdBreak()){var n=r.currentSrc();n!==r.ads.contentSrc&&(r.ads._seenInitialLoadstart&&r.trigger({type:"contentchanged"}),r.trigger({type:"contentupdate",oldValue:r.ads.contentSrc,newValue:n}),r.ads.contentSrc=n);r.ads._seenInitialLoadstart=!0}});i.on("contentchanged",i.ads.reset);u=function(){var u=i.textTracks(),t,r;if(!i.ads.shouldPlayContentBehindAd(i)&&i.ads.inAdBreak()&&i.tech_.featuresNativeTextTracks&&n.browser.IS_IOS&&!Array.isArray(i.textTracks()))for(t=0;t<u.length;t++)r=u[t],"showing"===r.mode&&(r.mode="disabled")};i.ready(function(){i.textTracks().addEventListener("change",u)});i.on(["play","playing","ended","adsready","adscanceled","adskip","adserror","adtimeout","ads-ad-started","contentchanged","contentresumed","contentended","nopreroll","nopostroll"],function(n){i.ads._state.handleEvent(n.type)});i.on("dispose",function(){i.textTracks().removeEventListener("change",u)})};return(n.registerPlugin||n.plugin)("ads",rt),rt});!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("video.js")):"function"==typeof define&&define.amd?define(["video.js"],t):n.videojsIma=t(n.videojs)}(this,function(n){"use strict";var r,u,t,f;n=n&&n.hasOwnProperty("default")?n.default:n;r=function(n,t,i){this.vjsPlayer=n;this.controller=i;this.contentTrackingTimer=null;this.contentComplete=!1;this.updateTimeIntervalHandle=null;this.updateTimeInterval=1e3;this.seekCheckIntervalHandle=null;this.seekCheckInterval=1e3;this.resizeCheckIntervalHandle=null;this.resizeCheckInterval=250;this.seekThreshold=100;this.contentEndedListeners=[];this.contentSource="";this.contentSourceType="";this.contentPlayheadTracker={currentTime:0,previousTime:0,seeking:!1,duration:0};this.vjsPlayerDimensions={width:this.getPlayerWidth(),height:this.getPlayerHeight()};this.vjsControls=this.vjsPlayer.getChild("controlBar");this.h5Player=null;this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this));this.boundContentEndedListener=this.localContentEndedListener.bind(this);this.vjsPlayer.on("contentended",this.boundContentEndedListener);this.vjsPlayer.on("dispose",this.playerDisposedListener.bind(this));this.vjsPlayer.on("readyforpreroll",this.onReadyForPreroll.bind(this));this.vjsPlayer.on("adtimeout",this.onAdTimeout.bind(this));this.vjsPlayer.ready(this.onPlayerReady.bind(this));"onPlay"===this.controller.getSettings().requestMode&&this.vjsPlayer.one("play",this.controller.requestAds.bind(this.controller));this.vjsPlayer.ads(t)};r.prototype.setUpPlayerIntervals=function(){this.updateTimeIntervalHandle=setInterval(this.updateCurrentTime.bind(this),this.updateTimeInterval);this.seekCheckIntervalHandle=setInterval(this.checkForSeeking.bind(this),this.seekCheckInterval);this.resizeCheckIntervalHandle=setInterval(this.checkForResize.bind(this),this.resizeCheckInterval)};r.prototype.updateCurrentTime=function(){this.contentPlayheadTracker.seeking||(this.contentPlayheadTracker.currentTime=this.vjsPlayer.currentTime())};r.prototype.checkForSeeking=function(){var n=1e3*(this.vjsPlayer.currentTime()-this.contentPlayheadTracker.previousTime);this.contentPlayheadTracker.seeking=Math.abs(n)>this.seekCheckInterval+this.seekThreshold?!0:!1;this.contentPlayheadTracker.previousTime=this.vjsPlayer.currentTime()};r.prototype.checkForResize=function(){var n=this.getPlayerWidth(),t=this.getPlayerHeight();n==this.vjsPlayerDimensions.width&&t==this.vjsPlayerDimensions.height||(this.vjsPlayerDimensions.width=n,this.vjsPlayerDimensions.height=t,this.controller.onPlayerResize(n,t))};r.prototype.localContentEndedListener=function(){for(var n in this.contentComplete||(this.contentComplete=!0,this.controller.onContentComplete()),this.contentEndedListeners)"function"==typeof this.contentEndedListeners[n]&&this.contentEndedListeners[n]();clearInterval(this.updateTimeIntervalHandle);clearInterval(this.seekCheckIntervalHandle);clearInterval(this.resizeCheckIntervalHandle);this.vjsPlayer.el()&&this.vjsPlayer.one("play",this.setUpPlayerIntervals.bind(this))};r.prototype.onNoPostroll=function(){this.vjsPlayer.trigger("nopostroll")};r.prototype.playerDisposedListener=function(){var n,t;this.contentEndedListeners=[];this.controller.onPlayerDisposed();this.contentComplete=!0;this.vjsPlayer.off("contentended",this.boundContentEndedListener);this.vjsPlayer.ads.adTimeoutTimeout&&clearTimeout(this.vjsPlayer.ads.adTimeoutTimeout);n=[this.updateTimeIntervalHandle,this.seekCheckIntervalHandle,this.resizeCheckIntervalHandle];for(t in n)n[t]&&clearInterval(n[t])};r.prototype.onReadyForPreroll=function(){this.controller.onPlayerReadyForPreroll()};r.prototype.onAdTimeout=function(){this.controller.onAdTimeout()};r.prototype.onPlayerReady=function(){this.h5Player=document.getElementById(this.getPlayerId()).getElementsByClassName("vjs-tech")[0];this.h5Player.hasAttribute("autoplay")&&this.controller.setSetting("adWillAutoPlay",!0);this.onVolumeChange();this.vjsPlayer.on("fullscreenchange",this.onFullscreenChange.bind(this));this.vjsPlayer.on("volumechange",this.onVolumeChange.bind(this));this.controller.onPlayerReady()};r.prototype.onFullscreenChange=function(){this.vjsPlayer.isFullscreen()?this.controller.onPlayerEnterFullscreen():this.controller.onPlayerExitFullscreen()};r.prototype.onVolumeChange=function(){var n=this.vjsPlayer.muted()?0:this.vjsPlayer.volume();this.controller.onPlayerVolumeChanged(n)};r.prototype.injectAdContainerDiv=function(n){this.vjsControls.el().parentNode.appendChild(n)};r.prototype.getContentPlayer=function(){return this.h5Player};r.prototype.getVolume=function(){return this.vjsPlayer.muted()?0:this.vjsPlayer.volume()};r.prototype.setVolume=function(n){this.vjsPlayer.volume(n);0==n?this.vjsPlayer.muted(!0):this.vjsPlayer.muted(!1)};r.prototype.unmute=function(){this.vjsPlayer.muted(!1)};r.prototype.mute=function(){this.vjsPlayer.muted(!0)};r.prototype.play=function(){this.vjsPlayer.play()};r.prototype.getPlayerWidth=function(){var n=(getComputedStyle(this.vjsPlayer.el())||{}).width;return n&&0!==parseFloat(n)||(n=(this.vjsPlayer.el().getBoundingClientRect()||{}).width),parseFloat(n)||this.vjsPlayer.width()};r.prototype.getPlayerHeight=function(){var n=(getComputedStyle(this.vjsPlayer.el())||{}).height;return n&&0!==parseFloat(n)||(n=(this.vjsPlayer.el().getBoundingClientRect()||{}).height),parseFloat(n)||this.vjsPlayer.height()};r.prototype.getPlayerOptions=function(){return this.vjsPlayer.options_};r.prototype.getPlayerId=function(){return this.vjsPlayer.id()};r.prototype.toggleFullscreen=function(){this.vjsPlayer.isFullscreen()?this.vjsPlayer.exitFullscreen():this.vjsPlayer.requestFullscreen()};r.prototype.getContentPlayheadTracker=function(){return this.contentPlayheadTracker};r.prototype.onAdError=function(n){this.vjsControls.show();var t=void 0!==n.getError?n.getError():n.stack;this.vjsPlayer.trigger({type:"adserror",data:{AdError:t,AdErrorEvent:n}})};r.prototype.onAdLog=function(n){var t=n.getAdData(),i=void 0!==t.adError?t.adError.getMessage():void 0;this.vjsPlayer.trigger({type:"adslog",data:{AdError:i,AdEvent:n}})};r.prototype.onAdBreakStart=function(){this.contentSource=this.vjsPlayer.currentSrc();this.contentSourceType=this.vjsPlayer.currentType();this.vjsPlayer.off("contentended",this.boundContentEndedListener);this.vjsPlayer.ads.startLinearAdMode();this.vjsControls.hide();this.vjsPlayer.pause()};r.prototype.onAdBreakEnd=function(){this.vjsPlayer.on("contentended",this.boundContentEndedListener);this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode();this.vjsControls.show()};r.prototype.onAdStart=function(){this.vjsPlayer.trigger("ads-ad-started")};r.prototype.onAllAdsCompleted=function(){1==this.contentComplete&&(this.contentSource&&this.vjsPlayer.currentSrc()!=this.contentSource&&this.vjsPlayer.src({src:this.contentSource,type:this.contentSourceType}),this.controller.onContentAndAdsCompleted())};r.prototype.onAdsReady=function(){this.vjsPlayer.trigger("adsready")};r.prototype.changeSource=function(n){this.vjsPlayer.currentSrc()&&(this.vjsPlayer.currentTime(0),this.vjsPlayer.pause());n&&this.vjsPlayer.src(n);this.vjsPlayer.one("loadedmetadata",this.seekContentToZero.bind(this))};r.prototype.seekContentToZero=function(){this.vjsPlayer.currentTime(0)};r.prototype.triggerPlayerEvent=function(n,t){this.vjsPlayer.trigger(n,t)};r.prototype.addContentEndedListener=function(n){this.contentEndedListeners.push(n)};r.prototype.reset=function(){this.vjsPlayer.off("contentended",this.boundContentEndedListener);this.vjsPlayer.on("contentended",this.boundContentEndedListener);this.vjsControls.show();this.vjsPlayer.ads.inAdBreak()&&this.vjsPlayer.ads.endLinearAdMode();this.contentPlayheadTracker.currentTime=0;this.contentComplete=!1};u=function(n){this.controller=n;this.adContainerDiv=document.createElement("div");this.controlsDiv=document.createElement("div");this.countdownDiv=document.createElement("div");this.seekBarDiv=document.createElement("div");this.progressDiv=document.createElement("div");this.playPauseDiv=document.createElement("div");this.muteDiv=document.createElement("div");this.sliderDiv=document.createElement("div");this.sliderLevelDiv=document.createElement("div");this.fullscreenDiv=document.createElement("div");this.boundOnMouseUp=this.onMouseUp.bind(this);this.boundOnMouseMove=this.onMouseMove.bind(this);this.adPlayheadTracker={currentTime:0,duration:0,isPod:!1,adPosition:0,totalAds:0};this.controlPrefix=this.controller.getPlayerId()+"_";this.showCountdown=!0;!1===this.controller.getSettings().showCountdown&&(this.showCountdown=!1);this.createAdContainer()};u.prototype.createAdContainer=function(){this.assignControlAttributes(this.adContainerDiv,"ima-ad-container");this.adContainerDiv.style.position="absolute";this.adContainerDiv.style.zIndex=1111;this.adContainerDiv.addEventListener("mouseenter",this.showAdControls.bind(this),!1);this.adContainerDiv.addEventListener("mouseleave",this.hideAdControls.bind(this),!1);this.createControls();this.controller.injectAdContainerDiv(this.adContainerDiv)};u.prototype.createControls=function(){this.assignControlAttributes(this.controlsDiv,"ima-controls-div");this.controlsDiv.style.width="100%";this.controller.getIsMobile()?this.countdownDiv.style.display="none":(this.assignControlAttributes(this.countdownDiv,"ima-countdown-div"),this.countdownDiv.innerHTML=this.controller.getSettings().adLabel,this.countdownDiv.style.display=this.showCountdown?"block":"none");this.assignControlAttributes(this.seekBarDiv,"ima-seek-bar-div");this.seekBarDiv.style.width="100%";this.assignControlAttributes(this.progressDiv,"ima-progress-div");this.assignControlAttributes(this.playPauseDiv,"ima-play-pause-div");this.addClass(this.playPauseDiv,"ima-playing");this.playPauseDiv.addEventListener("click",this.onAdPlayPauseClick.bind(this),!1);this.assignControlAttributes(this.muteDiv,"ima-mute-div");this.addClass(this.muteDiv,"ima-non-muted");this.muteDiv.addEventListener("click",this.onAdMuteClick.bind(this),!1);this.assignControlAttributes(this.sliderDiv,"ima-slider-div");this.sliderDiv.addEventListener("mousedown",this.onAdVolumeSliderMouseDown.bind(this),!1);this.controller.getIsIos()&&(this.sliderDiv.style.display="none");this.assignControlAttributes(this.sliderLevelDiv,"ima-slider-level-div");this.assignControlAttributes(this.fullscreenDiv,"ima-fullscreen-div");this.addClass(this.fullscreenDiv,"ima-non-fullscreen");this.fullscreenDiv.addEventListener("click",this.onAdFullscreenClick.bind(this),!1);this.adContainerDiv.appendChild(this.controlsDiv);this.controlsDiv.appendChild(this.countdownDiv);this.controlsDiv.appendChild(this.seekBarDiv);this.controlsDiv.appendChild(this.playPauseDiv);this.controlsDiv.appendChild(this.muteDiv);this.controlsDiv.appendChild(this.sliderDiv);this.controlsDiv.appendChild(this.fullscreenDiv);this.seekBarDiv.appendChild(this.progressDiv);this.sliderDiv.appendChild(this.sliderLevelDiv)};u.prototype.onAdPlayPauseClick=function(){this.controller.onAdPlayPauseClick()};u.prototype.onAdMuteClick=function(){this.controller.onAdMuteClick()};u.prototype.onAdFullscreenClick=function(){this.controller.toggleFullscreen()};u.prototype.onAdsPaused=function(){this.controller.sdkImpl.adPlaying=!1;this.addClass(this.playPauseDiv,"ima-paused");this.removeClass(this.playPauseDiv,"ima-playing");this.showAdControls()};u.prototype.onAdsResumed=function(){this.onAdsPlaying();this.showAdControls()};u.prototype.onAdsPlaying=function(){this.controller.sdkImpl.adPlaying=!0;this.addClass(this.playPauseDiv,"ima-playing");this.removeClass(this.playPauseDiv,"ima-paused")};u.prototype.updateAdUi=function(n,t,i,r,u){var s=Math.floor(t/60),f=Math.floor(t%60),e,o;f.toString().length<2&&(f="0"+f);e=": ";u>1&&(e=" ("+r+" "+this.controller.getSettings().adLabelNofN+" "+u+"): ");this.countdownDiv.innerHTML=this.controller.getSettings().adLabel+e+s+":"+f;o=100*(n/i);this.progressDiv.style.width=o+"%"};u.prototype.unmute=function(){this.addClass(this.muteDiv,"ima-non-muted");this.removeClass(this.muteDiv,"ima-muted");this.sliderLevelDiv.style.width=100*this.controller.getPlayerVolume()+"%"};u.prototype.mute=function(){this.addClass(this.muteDiv,"ima-muted");this.removeClass(this.muteDiv,"ima-non-muted");this.sliderLevelDiv.style.width="0%"};u.prototype.onAdVolumeSliderMouseDown=function(){document.addEventListener("mouseup",this.boundOnMouseUp,!1);document.addEventListener("mousemove",this.boundOnMouseMove,!1)};u.prototype.onMouseMove=function(n){this.changeVolume(n)};u.prototype.onMouseUp=function(n){this.changeVolume(n);document.removeEventListener("mouseup",this.boundOnMouseUp);document.removeEventListener("mousemove",this.boundOnMouseMove)};u.prototype.changeVolume=function(n){var t=(n.clientX-this.sliderDiv.getBoundingClientRect().left)/this.sliderDiv.offsetWidth;t*=100;t=Math.min(Math.max(t,0),100);this.sliderLevelDiv.style.width=t+"%";0==this.percent?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted")):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"));this.controller.setVolume(t/100)};u.prototype.showAdContainer=function(){this.adContainerDiv.style.display="block"};u.prototype.hideAdContainer=function(){this.adContainerDiv.style.display="none"};u.prototype.reset=function(){this.hideAdContainer()};u.prototype.onAdError=function(){this.hideAdContainer()};u.prototype.onAdBreakStart=function(n){this.showAdContainer();this.controlsDiv.style.display="application/javascript"!==n.getAd().getContentType()||this.controller.getSettings().showControlsForJSAds?"block":"none";this.onAdsPlaying();this.hideAdControls()};u.prototype.onAdBreakEnd=function(){var n=this.controller.getCurrentAd();(null==n||n.isLinear())&&this.hideAdContainer();this.controlsDiv.style.display="none";this.countdownDiv.innerHTML=""};u.prototype.onAllAdsCompleted=function(){this.hideAdContainer()};u.prototype.onLinearAdStart=function(){this.removeClass(this.adContainerDiv,"bumpable-ima-ad-container")};u.prototype.onNonLinearAdLoad=function(){this.adContainerDiv.style.display="block";this.addClass(this.adContainerDiv,"bumpable-ima-ad-container")};u.prototype.onPlayerEnterFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-fullscreen");this.removeClass(this.fullscreenDiv,"ima-non-fullscreen")};u.prototype.onPlayerExitFullscreen=function(){this.addClass(this.fullscreenDiv,"ima-non-fullscreen");this.removeClass(this.fullscreenDiv,"ima-fullscreen")};u.prototype.onPlayerVolumeChanged=function(n){0==n?(this.addClass(this.muteDiv,"ima-muted"),this.removeClass(this.muteDiv,"ima-non-muted"),this.sliderLevelDiv.style.width="0%"):(this.addClass(this.muteDiv,"ima-non-muted"),this.removeClass(this.muteDiv,"ima-muted"),this.sliderLevelDiv.style.width=100*n+"%")};u.prototype.showAdControls=function(){this.controller.getSettings().disableAdControls||this.addClass(this.controlsDiv,"ima-controls-div-showing")};u.prototype.hideAdControls=function(){this.removeClass(this.controlsDiv,"ima-controls-div-showing")};u.prototype.assignControlAttributes=function(n,t){n.id=this.controlPrefix+t;n.className=this.controlPrefix+t+" "+t};u.prototype.getClassRegexp=function(n){return new RegExp("(^|[^A-Za-z-])"+n+"((?![A-Za-z-])|$)","gi")};u.prototype.elementHasClass=function(n,t){return this.getClassRegexp(t).test(n.className)};u.prototype.addClass=function(n,t){n.className=n.className.trim()+" "+t};u.prototype.removeClass=function(n,t){var i=this.getClassRegexp(t);n.className=n.className.trim().replace(i,"")};u.prototype.getAdContainerDiv=function(){return this.adContainerDiv};u.prototype.setShowCountdown=function(n){this.showCountdown=n;this.countdownDiv.style.display=this.showCountdown?"block":"none"};var e="1.8.0",o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},i=function(n){this.controller=n;this.adDisplayContainer=null;this.adDisplayContainerInitialized=!1;this.adsLoader=null;this.adsManager=null;this.adsRenderingSettings=null;this.adsResponse=null;this.currentAd=null;this.adTrackingTimer=null;this.allAdsCompleted=!1;this.adsActive=!1;this.adPlaying=!1;this.adMuted=!1;this.adBreakReadyListener=void 0;this.contentCompleteCalled=!1;this.isAdTimedOut=!1;this.adsManagerDimensions={width:0,height:0};this.autoPlayAdBreaks=!0;!1===this.controller.getSettings().autoPlayAdBreaks&&(this.autoPlayAdBreaks=!1);this.controller.getSettings().locale&&google.ima.settings.setLocale(this.controller.getSettings().locale);this.controller.getSettings().disableFlashAds&&google.ima.settings.setDisableFlashAds(this.controller.getSettings().disableFlashAds);this.controller.getSettings().disableCustomPlaybackForIOS10Plus&&google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.controller.getSettings().disableCustomPlaybackForIOS10Plus);this.controller.getSettings().ppid&&google.ima.settings.setPpid(this.controller.getSettings().ppid)};return i.prototype.initAdObjects=function(){this.adDisplayContainer=new google.ima.AdDisplayContainer(this.controller.getAdContainerDiv(),this.controller.getContentPlayer());this.adsLoader=new google.ima.AdsLoader(this.adDisplayContainer);this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED);0==this.controller.getSettings().vpaidAllowed&&this.adsLoader.getSettings().setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.DISABLED);this.controller.getSettings().vpaidMode&&this.adsLoader.getSettings().setVpaidMode(this.controller.getSettings().vpaidMode);this.controller.getSettings().locale&&this.adsLoader.getSettings().setLocale(this.controller.getSettings().locale);this.controller.getSettings().numRedirects&&this.adsLoader.getSettings().setNumRedirects(this.controller.getSettings().numRedirects);this.adsLoader.getSettings().setPlayerType("videojs-ima");this.adsLoader.getSettings().setPlayerVersion(e);this.adsLoader.getSettings().setAutoPlayAdBreaks(this.autoPlayAdBreaks);this.adsLoader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded.bind(this),!1);this.adsLoader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdsLoaderError.bind(this),!1);this.controller.playerWrapper.vjsPlayer.trigger({type:"ads-loader",adsLoader:this.adsLoader})},i.prototype.requestAds=function(){var n=new google.ima.AdsRequest,t;this.controller.getSettings().adTagUrl?n.adTagUrl=this.controller.getSettings().adTagUrl:n.adsResponse=this.controller.getSettings().adsResponse;this.controller.getSettings().forceNonLinearFullSlot&&(n.forceNonLinearFullSlot=!0);this.controller.getSettings().vastLoadTimeout&&(n.vastLoadTimeout=this.controller.getSettings().vastLoadTimeout);n.linearAdSlotWidth=this.controller.getPlayerWidth();n.linearAdSlotHeight=this.controller.getPlayerHeight();n.nonLinearAdSlotWidth=this.controller.getSettings().nonLinearWidth||this.controller.getPlayerWidth();n.nonLinearAdSlotHeight=this.controller.getSettings().nonLinearHeight||this.controller.getPlayerHeight();n.setAdWillAutoPlay(this.controller.adsWillAutoplay());n.setAdWillPlayMuted(this.controller.adsWillPlayMuted());t=this.controller.getSettings().adsRequest;t&&"object"===(void 0===t?"undefined":o(t))&&Object.keys(t).forEach(function(i){n[i]=t[i]});this.adsLoader.requestAds(n);this.controller.playerWrapper.vjsPlayer.trigger({type:"ads-request",AdsRequest:n})},i.prototype.onAdsManagerLoaded=function(n){this.createAdsRenderingSettings();this.adsManager=n.getAdsManager(this.controller.getContentPlayheadTracker(),this.adsRenderingSettings);this.adsManager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.AD_BREAK_READY,this.onAdBreakReady.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAllAdsCompleted.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.LOADED,this.onAdLoaded.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.STARTED,this.onAdStarted.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.COMPLETE,this.onAdComplete.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.SKIPPED,this.onAdComplete.bind(this));this.adsManager.addEventListener(google.ima.AdEvent.Type.LOG,this.onAdLog.bind(this));this.controller.getIsMobile()&&(this.adsManager.addEventListener(google.ima.AdEvent.Type.PAUSED,this.onAdPaused.bind(this)),this.adsManager.addEventListener(google.ima.AdEvent.Type.RESUMED,this.onAdResumed.bind(this)));this.controller.playerWrapper.vjsPlayer.trigger({type:"ads-manager",adsManager:this.adsManager});this.autoPlayAdBreaks||this.initAdsManager();var t=this.controller.getSettings().preventLateAdStart;t?t&&!this.isAdTimedOut&&this.controller.onAdsReady():this.controller.onAdsReady();this.controller.getSettings().adsManagerLoadedCallback&&this.controller.getSettings().adsManagerLoadedCallback()},i.prototype.onAdsLoaderError=function(n){window.console.warn("AdsLoader error: "+n.getError());this.controller.onErrorLoadingAds(n);this.adsManager&&this.adsManager.destroy()},i.prototype.initAdsManager=function(){try{var n=this.controller.getPlayerWidth(),t=this.controller.getPlayerHeight();this.adsManagerDimensions.width=n;this.adsManagerDimensions.height=t;this.adsManager.init(n,t,google.ima.ViewMode.NORMAL);this.adsManager.setVolume(this.controller.getPlayerVolume());this.initializeAdDisplayContainer()}catch(n){this.onAdError(n)}},i.prototype.createAdsRenderingSettings=function(){if(this.adsRenderingSettings=new google.ima.AdsRenderingSettings,this.adsRenderingSettings.restoreCustomPlaybackStateOnAdBreakComplete=!0,this.controller.getSettings().adsRenderingSettings)for(var n in this.controller.getSettings().adsRenderingSettings)""!==n&&(this.adsRenderingSettings[n]=this.controller.getSettings().adsRenderingSettings[n])},i.prototype.onAdError=function(n){var t=void 0!==n.getError?n.getError():n.stack;window.console.warn("Ad error: "+t);this.adsManager.destroy();this.controller.onAdError(n);this.adsActive=!1;this.adPlaying=!1},i.prototype.onAdBreakReady=function(n){this.adBreakReadyListener(n)},i.prototype.onContentPauseRequested=function(n){this.adsActive=!0;this.adPlaying=!0;this.controller.onAdBreakStart(n)},i.prototype.onContentResumeRequested=function(){this.adsActive=!1;this.adPlaying=!1;this.controller.onAdBreakEnd()},i.prototype.onAllAdsCompleted=function(){this.allAdsCompleted=!0;this.controller.onAllAdsCompleted()},i.prototype.onAdLoaded=function(n){n.getAd().isLinear()||(this.controller.onNonLinearAdLoad(),this.controller.playContent())},i.prototype.onAdStarted=function(n){this.currentAd=n.getAd();this.currentAd.isLinear()?(this.adTrackingTimer=setInterval(this.onAdPlayheadTrackerInterval.bind(this),250),this.controller.onLinearAdStart()):this.controller.onNonLinearAdStart()},i.prototype.onAdPaused=function(){this.controller.onAdsPaused()},i.prototype.onAdResumed=function(){this.controller.onAdsResumed()},i.prototype.onAdComplete=function(){this.currentAd.isLinear()&&clearInterval(this.adTrackingTimer)},i.prototype.onAdLog=function(n){this.controller.onAdLog(n)},i.prototype.onAdPlayheadTrackerInterval=function(){var t,i;if(null!==this.adsManager){var r=this.adsManager.getRemainingTime(),u=this.currentAd.getDuration(),n=u-r;n=n>0?n:0;t=0;i=void 0;this.currentAd.getAdPodInfo()&&(i=this.currentAd.getAdPodInfo().getAdPosition(),t=this.currentAd.getAdPodInfo().getTotalAds());this.controller.onAdPlayheadUpdated(n,r,u,i,t)}},i.prototype.onContentComplete=function(){this.adsLoader&&(this.adsLoader.contentComplete(),this.contentCompleteCalled=!0);this.adsManager&&this.adsManager.getCuePoints()&&!this.adsManager.getCuePoints().includes(-1)&&this.controller.onNoPostroll();this.allAdsCompleted&&this.controller.onContentAndAdsCompleted()},i.prototype.onPlayerDisposed=function(){this.adTrackingTimer&&clearInterval(this.adTrackingTimer);this.adsManager&&(this.adsManager.destroy(),this.adsManager=null)},i.prototype.onPlayerReadyForPreroll=function(){if(this.autoPlayAdBreaks){this.initAdsManager();try{this.controller.showAdContainer();this.adsManager.setVolume(this.controller.getPlayerVolume());this.adsManager.start()}catch(n){this.onAdError(n)}}},i.prototype.onAdTimeout=function(){this.isAdTimedOut=!0},i.prototype.onPlayerReady=function(){this.initAdObjects();(this.controller.getSettings().adTagUrl||this.controller.getSettings().adsResponse)&&"onLoad"===this.controller.getSettings().requestMode&&this.requestAds()},i.prototype.onPlayerEnterFullscreen=function(){this.adsManager&&this.adsManager.resize(window.screen.width,window.screen.height,google.ima.ViewMode.FULLSCREEN)},i.prototype.onPlayerExitFullscreen=function(){this.adsManager&&this.adsManager.resize(this.controller.getPlayerWidth(),this.controller.getPlayerHeight(),google.ima.ViewMode.NORMAL)},i.prototype.onPlayerVolumeChanged=function(n){this.adsManager&&this.adsManager.setVolume(n);this.adMuted=0==n},i.prototype.onPlayerResize=function(n,t){this.adsManager&&(this.adsManagerDimensions.width=n,this.adsManagerDimensions.height=t,this.adsManager.resize(n,t,google.ima.ViewMode.NORMAL))},i.prototype.getCurrentAd=function(){return this.currentAd},i.prototype.setAdBreakReadyListener=function(n){this.adBreakReadyListener=n},i.prototype.isAdPlaying=function(){return this.adPlaying},i.prototype.isAdMuted=function(){return this.adMuted},i.prototype.pauseAds=function(){this.adsManager.pause();this.adPlaying=!1},i.prototype.resumeAds=function(){this.adsManager.resume();this.adPlaying=!0},i.prototype.unmute=function(){this.adsManager.setVolume(1);this.adMuted=!1},i.prototype.mute=function(){this.adsManager.setVolume(0);this.adMuted=!0},i.prototype.setVolume=function(n){this.adsManager.setVolume(n);this.adMuted=0==n},i.prototype.initializeAdDisplayContainer=function(){this.adDisplayContainer&&(this.adDisplayContainerInitialized||(this.adDisplayContainer.initialize(),this.adDisplayContainerInitialized=!0))},i.prototype.playAdBreak=function(){this.autoPlayAdBreaks||(this.controller.showAdContainer(),this.adsManager.setVolume(this.controller.getPlayerVolume()),this.adsManager.start())},i.prototype.addEventListener=function(n,t){this.adsManager&&this.adsManager.addEventListener(n,t)},i.prototype.getAdsManager=function(){return this.adsManager},i.prototype.reset=function(){this.adsActive=!1;this.adPlaying=!1;this.adTrackingTimer&&clearInterval(this.adTrackingTimer);this.adsManager&&(this.adsManager.destroy(),this.adsManager=null);this.adsLoader&&!this.contentCompleteCalled&&this.adsLoader.contentComplete();this.contentCompleteCalled=!1;this.allAdsCompleted=!1},t=function(n,t){this.settings={};this.contentAndAdsEndedListeners=[];this.isMobile=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i);this.isIos=navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPad/i);this.initWithSettings(t);var f={debug:this.settings.debug,timeout:this.settings.timeout,prerollTimeout:this.settings.prerollTimeout},e=this.extend({},f,t.contribAdsSettings||{});this.playerWrapper=new r(n,e,this);this.adUi=new u(this);this.sdkImpl=new i(this)},t.IMA_DEFAULTS={adLabel:"Advertisement",adLabelNofN:"of",debug:!1,disableAdControls:!1,prerollTimeout:1e3,preventLateAdStart:!1,requestMode:"onLoad",showControlsForJSAds:!0,timeout:5e3},t.prototype.initWithSettings=function(n){this.settings=this.extend({},t.IMA_DEFAULTS,n||{});this.warnAboutDeprecatedSettings();this.showCountdown=!0;!1===this.settings.showCountdown&&(this.showCountdown=!1)},t.prototype.warnAboutDeprecatedSettings=function(){var n=this;["adWillAutoplay","adsWillAutoplay","adWillPlayMuted","adsWillPlayMuted"].forEach(function(t){void 0!==n.settings[t]&&console.warn("WARNING: videojs.ima setting "+t+" is deprecated")})},t.prototype.getSettings=function(){return this.settings},t.prototype.getIsMobile=function(){return this.isMobile},t.prototype.getIsIos=function(){return this.isIos},t.prototype.injectAdContainerDiv=function(n){this.playerWrapper.injectAdContainerDiv(n)},t.prototype.getAdContainerDiv=function(){return this.adUi.getAdContainerDiv()},t.prototype.getContentPlayer=function(){return this.playerWrapper.getContentPlayer()},t.prototype.getContentPlayheadTracker=function(){return this.playerWrapper.getContentPlayheadTracker()},t.prototype.requestAds=function(){this.sdkImpl.requestAds()},t.prototype.setSetting=function(n,t){this.settings[n]=t},t.prototype.onErrorLoadingAds=function(n){this.adUi.onAdError();this.playerWrapper.onAdError(n)},t.prototype.onAdPlayPauseClick=function(){this.sdkImpl.isAdPlaying()?(this.adUi.onAdsPaused(),this.sdkImpl.pauseAds()):(this.adUi.onAdsPlaying(),this.sdkImpl.resumeAds())},t.prototype.onAdMuteClick=function(){this.sdkImpl.isAdMuted()?(this.playerWrapper.unmute(),this.adUi.unmute(),this.sdkImpl.unmute()):(this.playerWrapper.mute(),this.adUi.mute(),this.sdkImpl.mute())},t.prototype.setVolume=function(n){this.playerWrapper.setVolume(n);this.sdkImpl.setVolume(n)},t.prototype.getPlayerVolume=function(){return this.playerWrapper.getVolume()},t.prototype.toggleFullscreen=function(){this.playerWrapper.toggleFullscreen()},t.prototype.onAdError=function(n){this.adUi.onAdError();this.playerWrapper.onAdError(n)},t.prototype.onAdBreakStart=function(n){this.playerWrapper.onAdBreakStart();this.adUi.onAdBreakStart(n)},t.prototype.showAdContainer=function(){this.adUi.showAdContainer()},t.prototype.onAdBreakEnd=function(){this.playerWrapper.onAdBreakEnd();this.adUi.onAdBreakEnd()},t.prototype.onAllAdsCompleted=function(){this.adUi.onAllAdsCompleted();this.playerWrapper.onAllAdsCompleted()},t.prototype.onAdsPaused=function(){this.adUi.onAdsPaused()},t.prototype.onAdsResumed=function(){this.adUi.onAdsResumed()},t.prototype.onAdPlayheadUpdated=function(n,t,i,r,u){this.adUi.updateAdUi(n,t,i,r,u)},t.prototype.onAdLog=function(n){this.playerWrapper.onAdLog(n)},t.prototype.getCurrentAd=function(){return this.sdkImpl.getCurrentAd()},t.prototype.playContent=function(){this.playerWrapper.play()},t.prototype.onLinearAdStart=function(){this.adUi.onLinearAdStart();this.playerWrapper.onAdStart()},t.prototype.onNonLinearAdLoad=function(){this.adUi.onNonLinearAdLoad()},t.prototype.onNonLinearAdStart=function(){this.adUi.onNonLinearAdLoad();this.playerWrapper.onAdStart()},t.prototype.getPlayerWidth=function(){return this.playerWrapper.getPlayerWidth()},t.prototype.getPlayerHeight=function(){return this.playerWrapper.getPlayerHeight()},t.prototype.onAdsReady=function(){this.playerWrapper.onAdsReady()},t.prototype.onPlayerResize=function(n,t){this.sdkImpl.onPlayerResize(n,t)},t.prototype.onContentComplete=function(){this.sdkImpl.onContentComplete()},t.prototype.onNoPostroll=function(){this.playerWrapper.onNoPostroll()},t.prototype.onContentAndAdsCompleted=function(){for(var n in this.contentAndAdsEndedListeners)"function"==typeof this.contentAndAdsEndedListeners[n]&&this.contentAndAdsEndedListeners[n]()},t.prototype.onPlayerDisposed=function(){this.contentAndAdsEndedListeners=[];this.sdkImpl.onPlayerDisposed()},t.prototype.onPlayerReadyForPreroll=function(){this.sdkImpl.onPlayerReadyForPreroll()},t.prototype.onAdTimeout=function(){this.sdkImpl.onAdTimeout()},t.prototype.onPlayerReady=function(){this.sdkImpl.onPlayerReady()},t.prototype.onPlayerEnterFullscreen=function(){this.adUi.onPlayerEnterFullscreen();this.sdkImpl.onPlayerEnterFullscreen()},t.prototype.onPlayerExitFullscreen=function(){this.adUi.onPlayerExitFullscreen();this.sdkImpl.onPlayerExitFullscreen()},t.prototype.onPlayerVolumeChanged=function(n){this.adUi.onPlayerVolumeChanged(n);this.sdkImpl.onPlayerVolumeChanged(n)},t.prototype.setContentWithAdTag=function(n,t){this.reset();this.settings.adTagUrl=t||this.settings.adTagUrl;this.playerWrapper.changeSource(n)},t.prototype.setContentWithAdsResponse=function(n,t){this.reset();this.settings.adsResponse=t||this.settings.adsResponse;this.playerWrapper.changeSource(n)},t.prototype.setContentWithAdsRequest=function(n,t){this.reset();this.settings.adsRequest=t||this.settings.adsRequest;this.playerWrapper.changeSource(n)},t.prototype.reset=function(){this.sdkImpl.reset();this.playerWrapper.reset();this.adUi.reset()},t.prototype.addContentEndedListener=function(n){this.playerWrapper.addContentEndedListener(n)},t.prototype.addContentAndAdsEndedListener=function(n){this.contentAndAdsEndedListeners.push(n)},t.prototype.setAdBreakReadyListener=function(n){this.sdkImpl.setAdBreakReadyListener(n)},t.prototype.setShowCountdown=function(n){this.adUi.setShowCountdown(n);this.showCountdown=n;this.adUi.countdownDiv.style.display=this.showCountdown?"block":"none"},t.prototype.initializeAdDisplayContainer=function(){this.sdkImpl.initializeAdDisplayContainer()},t.prototype.playAdBreak=function(){this.sdkImpl.playAdBreak()},t.prototype.addEventListener=function(n,t){this.sdkImpl.addEventListener(n,t)},t.prototype.getAdsManager=function(){return this.sdkImpl.getAdsManager()},t.prototype.getPlayerId=function(){return this.playerWrapper.getPlayerId()},t.prototype.changeAdTag=function(n){this.reset();this.settings.adTagUrl=n},t.prototype.pauseAd=function(){this.adUi.onAdsPaused();this.sdkImpl.pauseAds()},t.prototype.resumeAd=function(){this.adUi.onAdsPlaying();this.sdkImpl.resumeAds()},t.prototype.adsWillAutoplay=function(){return void 0!==this.settings.adsWillAutoplay?this.settings.adsWillAutoplay:void 0!==this.settings.adWillAutoplay?this.settings.adWillAutoplay:!!this.playerWrapper.getPlayerOptions().autoplay},t.prototype.adsWillPlayMuted=function(){return void 0!==this.settings.adsWillPlayMuted?this.settings.adsWillPlayMuted:void 0!==this.settings.adWillPlayMuted?this.settings.adWillPlayMuted:void 0!==this.playerWrapper.getPlayerOptions().muted?this.playerWrapper.getPlayerOptions().muted:0==this.playerWrapper.getVolume()},t.prototype.triggerPlayerEvent=function(n,t){this.playerWrapper.triggerPlayerEvent(n,t)},t.prototype.extend=function(n){for(var u=void 0,t=void 0,i=void 0,f=arguments.length,e=Array(f>1?f-1:0),r=1;r<f;r++)e[r-1]=arguments[r];for(t=0;t<e.length;t++)for(i in u=e[t])u.hasOwnProperty(i)&&(n[i]=u[i]);return n},f=function(n,i){this.controller=new t(n,i);this.addContentAndAdsEndedListener=function(n){this.controller.addContentAndAdsEndedListener(n)}.bind(this);this.addContentEndedListener=function(n){this.controller.addContentEndedListener(n)}.bind(this);this.addEventListener=function(n,t){this.controller.addEventListener(n,t)}.bind(this);this.changeAdTag=function(n){this.controller.changeAdTag(n)}.bind(this);this.getAdsManager=function(){return this.controller.getAdsManager()}.bind(this);this.initializeAdDisplayContainer=function(){this.controller.initializeAdDisplayContainer()}.bind(this);this.pauseAd=function(){this.controller.pauseAd()}.bind(this);this.playAdBreak=function(){this.controller.playAdBreak()}.bind(this);this.requestAds=function(){this.controller.requestAds()}.bind(this);this.resumeAd=function(){this.controller.resumeAd()}.bind(this);this.setAdBreakReadyListener=function(n){this.controller.setAdBreakReadyListener(n)}.bind(this);this.setContentWithAdTag=function(n,t){this.controller.setContentWithAdTag(n,t)}.bind(this);this.setContentWithAdsResponse=function(n,t){this.controller.setContentWithAdsResponse(n,t)}.bind(this);this.setContentWithAdsRequest=function(n,t){this.controller.setContentWithAdsRequest(n,t)}.bind(this);this.setShowCountdown=function(n){this.controller.setShowCountdown(n)}.bind(this)},(n.registerPlugin||n.plugin)("ima",function(n){this.ima=new f(this,n)}),f}),function(){function n(){function f(n,t){for(var i in t)n[i]=t[i]}function o(n){n.id&&!n._asData&&(n._asData={eventType:"not set",videoPlayer:"VJS",videoLength:"not set",milestones:[25,50,75],firstPlay:!0,justSeeked:!1,justFinished:!1,justMuted:!1,justFullScreen:!1,justPlayed:!1,isFullScreen:!1,nonInteraction:null,vidLoaded:!1,hitValue:0,autoplay:!1,isPlaylist:!1,adPlaying:!1},f(n,e),n.setAutoplay(),n.setMute(),n.setListeners())}function s(){var n=[],t,i;if(window.videojs.getAllPlayers)n=window.videojs.getAllPlayers();else if(window.videojs.getPlayers){t=window.videojs.getPlayers();for(i in t)n.push(t[i])}return n}var u=function(){return function(n){VM.Track.trackEvent({eventCategory:"NTG Video",eventAction:n.eventType,eventLabel:VM.Scroll.detailsTitle,eventValue:n.hitValue,nonInteraction:n.nonInteraction})}}(),e={setMilestones:function(){var n=this,t=window.setInterval(function(){if(!isNaN(n._asData.videoLength)){var i=n._asData.videoLength;n._asData.milestones=n._asData.milestones.map(function(n){return n/100*i});window.clearInterval(t)}},40,n)},setAutoplay:function(){this.player_&&this.player_.options_&&(this._asData.autoplay=this.player_.options_.autoplay);!this._asData.autoplay&&this.getAttribute&&(this._asData.autoplay=this.getAttribute("data-autoplay")==="true");this._asData.autoplay||(this._asData.autoplay=this.autoplay())},setMute:function(){this.muted()&&(this._asData.justMuted=this.muted())},getVideoLength:function(){return Math.round(this.duration())},setVideoLength:function(){var n=this,t=window.setInterval(function(){isNaN(n._asData.videoLength)?n._asData.videoLength=Math.round(n.duration()):window.clearInterval(t)},20,n)},getCurrentTime:function(){return Math.round(this.currentTime())},isVideo:function(){return this&&this.nodeName==="VIDEO"},_vidLoaded:function(){this._asData.vidLoaded||(this._asData.vidLoaded=!0,this._asData.videoLength="not set",this.setVideoLength(),this._asData.milestones=[25,50,75],this.setMilestones(),this._sendHit("player loaded",!0),this&&this.playlist&&this.playlist.length>0&&(this._asData.isPlaylist=!0),this._asData.justFinished=!1,n=!1)},_vidPlay:function(){var t=this;(t._asData.justFinished&&window.setTimeout(function(){t._asData.justFinished=!1},500,t),t._asData.justFinished||t._asData.justFullScreen||t._asData.justPlayed)||(t._asData.justPlayed=!0,window.setTimeout(function(){if(t._asData.justPlayed=!1,!n&&!t._asData.justFullScreen)if(t._asData.vidLoaded){if(t._asData.justFinished&&(t._asData.justFinished=!1),this.ads)if(this.ads.isAdPlaying())this._asData.adPlaying=!0;else if(this._asData.adPlaying){this._asData.adPlaying=!1;return}var i=t._asData.firstPlay?["initial click to play","autoplay"]:"resume";i.length===2?(t._asData.firstPlay=!1,t._asData.autoplay?t._sendHit(i[1],!0):t._sendHit(i[0],!1)):t._sendHit(i,!1)}else t._vidLoaded(),t._vidPlay()},2500,t))},_vidPause:function(){var t=this;window.setTimeout(function(){n||t._asData.justFinished||t._asData.justFullScreen||t._asData.nextVideo||t.getCurrentTime()!==t._asData.videoLength&&t._sendHit("pause",!1)},2500,t)},_vidSeek:function(){if(!n&&!this._asData.justFinished&&!this._asData.justFullScreen){n=!0;var t=this;window.setTimeout(function(){n=!1},3e3);this._sendHit("seek",!1)}},_vidComplete:function(){var t,i,n;if(this.ended()&&this.getCurrentTime()==this._asData.videoLength&&!this._asData.justFinished){if(this._asData.milestones.length>0)for(t=0;t<this._asData.milestones.length;t++)i=this._asData.milestones[t],n=i/this._asData.videoLength*100,!Number.isNaN(n)&&n%25==0&&n>0&&n<=100&&(this._asData.hitValue=n,this._sendHit(decodeURIComponent(encodeURIComponent("milestone "+n+"%")),!0));this._asData.justFinished=!0;this._asData.hitValue=100;this._sendHit("complete",!0);this._asData.firstPlay=!0;this._asData.videoLength="not set";this.setVideoLength();this._asData.milestones=[25,50,75];this.setMilestones()}},_vidMilestones:function(){var r,t,n;if(!i&&!(this.getCurrentTime()<5)&&(i=!0,setTimeout(function(){i=!1},2e3),this._asData.firstPlay&&this._vidPlay(),!(this.getCurrentTime()<this._asData.milestones[0])&&this._asData.milestones.length!==0)){r=this.getCurrentTime();do t=this._asData.milestones.splice(0,1)[0];while(t>r);n=t/this._asData.videoLength*100;!Number.isNaN(n)&&n%25==0&&n>0&&n<=100&&(this._asData.hitValue=n,this._sendHit(decodeURIComponent(encodeURIComponent("milestone "+n+"%")),!0))}},_vidMuted:function(){this.muted()||this.volume()===0?this._asData.justMuted||(this._asData.justMuted=!0,this._sendHit("mute",!1)):this._asData.justMuted&&(this._asData.justMuted=!1,this._sendHit("unmute",!1))},_vidFullScreen:function(){var n=this,t;document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen||document.msFullscreenElement||document.fullScreen?(this._asData.justFullScreen&&window.clearTimeout(t),this._sendHit("full screen",!1),this._asData.justFullScreen=!0,this._asData.isFullScreen=!0,t=window.setTimeout(function(){n._asData.justFullScreen=!1},3e3,n)):this._asData.isFullScreen&&(this._asData.justFullScreen&&window.clearTimeout(t),this._asData.isFullScreen=!1,this._asData.justFullScreen=!0,t=window.setTimeout(function(){n._asData.justFullScreen=!1},3e3,n))},_sendHit:function(n,t){this._asData.eventType=n;this._asData.hitValue=n.match(/milestone|complete/i)?this._asData.hitValue:null;this._asData.nonInteraction=t;u(this._asData)},setListeners:function(){if(this.on){this.on("play",this._vidPlay);this.on("pause",this._vidPause);this.on("seeking",this._vidSeek);this.on("ended",this._vidComplete);this.on("timeupdate",this._vidMilestones);this.on("volumechange",this._vidMuted);this.on("fullscreenchange",this._vidFullScreen);this.on("canplay",this._vidLoaded)}}},t,n=!1,i=!1,r=setInterval(function(){if(window.videojs&&(t=s(),t.length>0)){clearInterval(r);for(var n=0;n<t.length;n++)o(t[n])}},500);setTimeout(function(){clearInterval(r)},1e4)}n()}();window.googletag=window.googletag||{cmd:[]};var VM=VM||{};VM.AmsVideo={containerId:null,embedded:!1,base:null,preinit:function(){var n=this;n.embedded=document.getElementById("ams-embed")!=null;n.base=n.embedded?window.top.document:document},init:function(n){var u=this,i=document.getElementById("vjs"),h=window.top.document.getElementById("ams-embed-settings"),r=null,t,o,c,s,f,e;if(u.embedded?u.embedded&&h&&(r=h.getAttribute("data-vast-tag")):r=i.getAttribute("data-vast-tag"),u.containerId=document.querySelector(".details-file").getAttribute("id"),i){i.setAttribute("playsinline","");t=videojs(i,{controls:!0,width:"auto",height:"auto",aspectRatio:"16:9",fluid:!0,html5:{vhs:{overrideNative:!videojs.browser.IS_SAFARI},nativeTextTracks:!1,nativeAudioTracks:!1,nativeVideoTracks:!1}});o=i.getAttribute("data-audio")=="true";t.ready(function(){var n=i.getAttribute("data-vtt-src"),r;n&&(r=t.addRemoteTextTrack({src:n,language:"English"},!1),i.getAttribute("data-vtt-hide")!="true"&&r.addEventListener("load",function(){u.loadTranscription()}))});t.on("play",function(){var n=document.querySelector(".vjs-share");n&&document.querySelector(".vjs-share").classList.add("hidden");o&&VM.AmsVideo.loadAudioAnimation()});if(o)t.on("pause",function(){document.querySelector(".audio-animation").classList.add("audio-animation-paused")});t.on("ended",function(){o&&document.querySelector(".vjs-audio-animation").classList.add("hidden");u.loadShare()});n&&r!=null&&(r=r.replace(/&amp;/g,"&"),c={adTagUrl:r},t.ima(c),s=document.getElementById("vjs_video_html5_api"),s&&(navigator.userAgent.match(/iPad/i)||navigator.userAgent.match(/Android/i))&&s.hasAttribute("controls")&&s.removeAttribute("controls"),f=document.getElementById("vjs"),e=function(){t.ima.initializeAdDisplayContainer();f.removeEventListener("click",e);f.removeEventListener("touchend",e)},f.addEventListener("click",e),f.addEventListener("touchend",e))}},loadAudioAnimation:function(){var i;if(document.querySelector(".vjs-audio-animation"))document.querySelector(".vjs-audio-animation").classList.remove("hidden"),document.querySelector(".audio-animation").classList.remove("audio-animation-paused");else if(i=VM.AmsVideo.base.querySelector(".nav.nav-table.sc.sc-expanded.rendered"),i){var n=document.createElement("div"),t=document.createElement("div"),r=document.createElement("div");t.classList.add("audio-animation-container");r.classList.add("audio-animation");n.classList.add("vjs-audio-animation");t.appendChild(r);n.appendChild(t);document.getElementById("vjs").insertBefore(n,document.querySelector(".vjs-control-bar"))}},loadShare:function(){var i;if(document.querySelector(".vjs-share"))document.querySelector(".vjs-share").classList.remove("hidden");else if(i=VM.AmsVideo.base.querySelector(".nav.nav-table.sc.sc-expanded.rendered"),i){var n=document.createElement("div"),r=i.cloneNode(!0),t=document.createElement("button");t.innerHTML="&times;";t.classList="vjs-share-close";t.addEventListener("click",function(){document.querySelector(".vjs-share").classList.add("hidden")});r.classList.remove("sc-expanded");r.classList.add("sc-compact");n.classList.add("vjs-share");n.appendChild(r);n.appendChild(t);document.getElementById("vjs").insertBefore(n,document.querySelector(".vjs-control-bar"))}},loadTranscription:function(){var n=this,r=videojs.players.vjs.remoteTextTracks(),i,t,o,s;if(r.length>0){for(t=0;t<r.length;t++)if(r[t].kind=="subtitles"&&r[t].language=="English"){i=r[t];break}if(i!=undefined&&i.cues.length>0){n.embedded&&n.base.querySelector(".embed.embed-ams#"+n.containerId).classList.add("ams-transcription");var u=document.querySelector(".details-file"),f=document.createElement("div"),e="";for(t=0;t<i.cues.length;t++)o=i.cues[t].startTime,s=i.cues[t].text.split(" ").map(function(n){return"<span class='transcription-word' data-start-time='"+o+"'>"+n+"<\/span>"}),e+=s.join("");f.innerHTML='<div id="transcription" class="row"><div class="col-md-7"><div class="input-group"><label for="search-box" class="sr-only">Search transcript<\/label><input type="text" id="search-box" class="form-control" placeholder="Search transcript"><span class="input-group-btn"><button type="button" id="search-transcription" class="btn btn-default" aria-label="Search"><i class="ic ic-search ic-muted"><\/i><\/button><\/span><\/div><\/div><div class="col-md-4 col-md-offset-1"><button type="button" id="transcriptionbutton" class="btn btn-muted btn-block"><i class="ic ic-audio"><\/i> <span id="show-transcript">Show transcript<\/span><\/button><\/div><\/div>  <div id="transcription-wrapper" class="hidden"><div id="transcription-container" class="triangle-border"><div id="transcription-results"><\/div><\/div><div id="search-result-buttons" class="row hidden"><div class="col-xs-12 text-right"><button type="button" class="btn btn-muted" id="previous-search-result" disabled>&lt;<\/button><button type="button" class="btn btn-muted" id="next-search-result" disabled>&gt;<\/button><\/div><\/div><\/div>';u.parentNode.insertBefore(f,u.nextSibling);document.getElementById("transcription-results").innerHTML=e;document.getElementById("search-transcription").addEventListener("click",function(){n.searchTrancription(document.getElementById("search-box").value)});document.getElementById("search-box").addEventListener("keyup",function(t){t.key==="Enter"&&(t.preventDefault(),n.searchTrancription(document.getElementById("search-box").value))});document.getElementById("next-search-result").addEventListener("click",function(){n.nextResult(1)});document.getElementById("previous-search-result").addEventListener("click",function(){n.nextResult(-1)});document.getElementById("transcriptionbutton").addEventListener("click",function(){var i=document.getElementById("transcription-wrapper"),t=n.base.querySelector(".embed.embed-ams#"+n.containerId);i.classList.contains("hidden")?(i.classList.remove("hidden"),document.getElementById("search-box").focus(),document.getElementById("show-transcript").innerHTML="Hide transcript",n.embedded&&(t.style.height=document.getElementById("ams-embed").offsetHeight+45+"px",t.classList.add("pb-0"))):(i.classList.add("hidden"),document.getElementById("show-transcript").innerHTML="Show transcript",n.embedded&&(t.style.height="",t.classList.remove("pb-0")))});document.addEventListener("click",function(t){if(t.target.matches(".transcription-word")&&t.target.parentNode.classList.contains("transcription-search-result")){var i=document.querySelectorAll(".transcription-search-result"),r=[].indexOf.call(i,t.target.parentNode),u=t.target.getAttribute("data-start-time");document.querySelector(".current").classList.remove("current");n.setButtons(i.length,r);t.target.parentNode.classList.add("current");videojs.players.vjs.play().then(function(){videojs.players.vjs.currentTime(u)})}},!0)}}},toHHMMSS:function(n){var t=parseInt(n,10),i=Math.floor(t/3600),r=Math.floor(t/60)%60,u=t%60;return[i,r,u].map(function(n){return n<10?"0"+n:n}).join(":")},searchTrancription:function(n){var f=this,t,r,h,s,u,o,l;if(f.clearResults(),n!=""&&n!=" "){var e=n.split(" ").filter(function(n,t,i){return i.indexOf(n)===t}),i=document.querySelectorAll(".transcription-word"),a=i.length-e.length,o=document.getElementById("transcription-results"),c=document.createElement("span");for(c.classList.add("transcription-search-result"),t=0;t<a;t++)if(e.every(function(n,r){return i[t+r].innerHTML.toLowerCase().indexOf(n.trim().toLowerCase())!==-1})){for(r=c.cloneNode(),h=i[t].getAttribute("data-start-time"),r.setAttribute("data-start-time",h),r.setAttribute("title",f.toHHMMSS(h)),s=0;s<e.length;s++)r.appendChild(i[t+s]);o.insertBefore(r,i[t+e.length])}}u=document.querySelector(".transcription-search-result");u?(o=document.getElementById("transcription-wrapper"),o.classList.contains("hidden")&&(o.classList.remove("hidden"),document.getElementById("show-transcript").innerHTML="Hide transcript"),u.classList.add("current"),u.parentNode.scrollTop=u.offsetTop-20,l=document.querySelectorAll(".transcription-search-result"),f.setButtons(l.length,0)):f.setButtons(0,0)},setButtons:function(n,t){n>1?(document.getElementById("next-search-result").disabled=t>=n-1,document.getElementById("previous-search-result").disabled=t==0,document.getElementById("search-result-buttons").classList.remove("hidden")):document.getElementById("search-result-buttons").classList.add("hidden")},clearResults:function(){for(var n,r,i=document.querySelectorAll(".transcription-search-result"),t=0;t<i.length;t++){for(n=i[t],n.classList.contains("current")&&(n.parentNode.parentNode.scrollTop=0,n.classList.remove("current")),r=n.childNodes.length,j=0;j<r;j++)n.parentNode.insertBefore(n.childNodes[0],n);n.parentNode.removeChild(n)}this.setButtons(1,0)},nextResult:function(n){var i=document.querySelectorAll(".transcription-search-result"),t=document.querySelector(".current"),r=[].indexOf.call(i,t)+n;t.classList.remove("current");t=i[r];t.classList.add("current");t.parentNode.scrollTop=t.offsetTop-20;this.setButtons(i.length,r)}};$(function(){VM.AmsVideo.preinit();VM.AmsVideo.init(!VM.AmsVideo.base.querySelector("body").classList.contains("noads")&&!VM.AmsVideo.base.querySelector("body").classList.contains("novideoads"))})